Start of Content Area

Background documentation InputField  Locate the document in its SAP Library structure

The InputField UI element allows the user to edit or display a single-line text. With an InputField you can edit any simple data type you like. The conversion from the internal display format and, when the user has input a value, back into the internal display format is done automatically. If, after the user has input a value into the field an error occurs during the conversion to the internal format, the value is not put back into the context, but remains in the data container. When it is next displayed, the InputField with the erroneous value is bordered in red and displayed with an error message.

The input is not checked until the roundtrip is triggered.

Note

To enable the development of accessible applications the label property is checked during the syntax check.

If no label has been set, and no descriptive text has been specified for the appropriate bound context element in the ABAP Dictionary, the tooltip property is checked.

Caution

Note that the value of InputField is also transferred to the password mode in plain text. For this reason applications that use the property passwordField should only run in HTTPS mode.

You can go to the HTTPS mode through an ICF service setting in transaction SICF by setting SSL as the Security Requirement on the Logon Data tab on the node for your application in the HTTP service tree.

More information:

InputField in a Table

Example of the Display with a Label

This graphic is explained in the accompanying text

Checking Required Entry Fields

A check of required entry fields is not implemented in Web Dynpro and is also not planned for the future.

      In applications you can check whether the fields are empty. There is a method which is used by the application to do this.

Call the method CL_WD_DYNAMIC_TOOL=>CHECK_MANDATORY_ATTRIBUTES in your action handler or in the method wdDoBeforeAction. A example of this is the Web Dynpro application  WDR_TEST_MANDATORY.

      In applications you can check whether the required entry fields of a complete view are empty. Any personalized required entry fields are also considered.

Call the method CL_WD_DYNAMIC_TOOL=>CHECK_MANDATORY_ATTR_ON_VIEW in your action handler or in the method wdDoBeforeAction. A example of this is the Web Dynpro application  WDR_TEST_MANDATORY.

Comparison of design specification for the properties readOnly and enabled

You should only set fields to enabled=false if these fields are not relevant for the user for his/her current work tasks, and if they are not relevant within the current context. For this reason a field with disabled=false is displayed on the screen in such a way that the user's attention is not directed to it. In this case the font of the label is displayed in grey so that it matches the hidden InputField.

Example

Example of an InputField with enabled=false:

This graphic is explained in the accompanying text

Read-only fields on the other hand should only be used for fields that are relevant for the user's current work tasks, and which can also be changed later, but not at this precise moment.

Data that is relevant for the current context but that can never be edited here, should at present be displayed by using a TextView. This could however result in, for instance, that no input help can be called using the keyboard, or no field explanation can be appended (see Help Texts in and for Web Dynpro Applications).

Implementation Details

Runtime Class

CL_WD_INPUT_FIELD

 

Properties in the View Designer

Name

Type

Initial Value

Bindable

ID

STRING

(automatic)

No

activateAccessKey

WDY_BOOLEAN

false

No

alignment

WDUI_INPUT_FIELD_ALIGNMENT

auto

Yes

contextMenuBehaviour

WDUI_CONTEXT_MENU_BEHAVIOUR

inherit

No

contextMenuId

WDY_MD_UI_ELEMENT_REFERENCE

 

No

enabled

WDY_BOOLEAN

true

Yes

explanation

Translatable text

 

No

imeMode

WDUI_IMEMODE

auto

Yes

length

I

20

Yes

passwordField

WDY_BOOLEAN

false

Yes

readOnly

WDY_BOOLEAN

false

Yes

state

WDUI_STATE

normal

Yes

textDirection

WDUI_TEXT_DIRECTION

inherit

Yes

tooltip

Translatable text

 

Yes

value

Translatable text

 

Mandatory

visible

WDUI_VISIBILITY

visible

Yes

width

STRING

 

Yes

 

Events in the View Designer

Name

onEnter

Note

Other properties that can be inherited are defined in the associated higher-level classes. The associated UI elements are:

        AbstractInputFields

        UIElements

        ContextMenuProvider

        ViewElements

Dynamic Programming

For dynamic programming, the same properties, events, and aggregations as in the View Designer are available. Bear in mind the different spellings.

Dynamic Programming of Properties

View Designer Name

Runtime Name

Type

activateAccessKey

ACTIVATE_ACCESS_KEY

WDY_BOOLEAN

alignment

ALIGNMENT

WDUI_INPUT_FIELD_ALIGNMENT

alignment: auto

CL_WD_INPUT_FIELD=>E_ALIGNMENT-AUTO

alignment: beginOfLine

CL_WD_INPUT_FIELD=>E_ALIGNMENT-BEGIN_OF_LINE

alignment: center

CL_WD_INPUT_FIELD=>E_ALIGNMENT-CENTER

alignment: endOfLine

CL_WD_INPUT_FIELD=>E_ALIGNMENT-END_OF_LINE

alignment: forcedLeft

CL_WD_INPUT_FIELD=>E_ALIGNMENT-FORCED_LEFT

alignment: forcedRight

CL_WD_INPUT_FIELD=>E_ALIGNMENT-FORCED_RIGHT

contextMenuBehaviour

CONTEXT_MENU_BEHAVIOUR

WDUI_CONTEXT_MENU_BEHAVIOUR

 contextMenuBehaviour: inherit

CL_WD_INPUT_FIELD=>E_CONTEXT_MENU_BEHAVIOUR-INHERIT

 contextMenuBehaviour: provide

CL_WD_INPUT_FIELD=>E_CONTEXT_MENU_BEHAVIOUR-PROVIDE

 contextMenuBehaviour: suppress

CL_WD_INPUT_FIELD=>E_CONTEXT_MENU_BEHAVIOUR-SUPPRESS

contextMenuId

CONTEXT_MENU_ID

WDY_MD_UI_ELEMENT_REFERENCE

enabled

ENABLED

WDY_BOOLEAN

explanation

EXPLANATION

WDY_MD_TRANSLATABLE_TEXT

imeMode

IME_MODE

WDUI_IMEMODE

imeMode: active

CL_WD_INPUT_FIELD=>E_IME_MODE-ACTIVE

imeMode: auto

CL_WD_INPUT_FIELD=>E_IME_MODE-AUTO

imeMode: disabled

CL_WD_INPUT_FIELD=>E_IME_MODE-DISABLED

imeMode: inactive

CL_WD_INPUT_FIELD=>E_IME_MODE-INACTIVE

length

LENGTH

I

passwordField

PASSWORD_FIELD

WDY_BOOLEAN

readOnly

READ_ONLY

WDY_BOOLEAN

state

STATE

WDUI_STATE

 state: normal

CL_WD_INPUT_FIELD=>E_STATE-NORMAL

 state: required

CL_WD_INPUT_FIELD=>E_STATE-REQUIRED

textDirection

TEXT_DIRECTION

WDUI_TEXT_DIRECTION

textDirection inherit

CL_WD_INPUT_FIELD=>E_TEXT_DIRECTION-INHERIT

textDirection ltr

CL_WD_INPUT_FIELD=>E_TEXT_DIRECTION-LTR

textDirection rtl

CL_WD_INPUT_FIELD=>E_TEXT_DIRECTION-RTL

tooltip

TOOLTIP

WDY_MD_TRANSLATABLE_TEXT

value

VALUE

WDY_MD_TRANSLATABLE_TEXT

visible

VISIBLE

WDUI_VISIBILITY

visible: none

CL_WD_INPUT_FIELD=>E_VISIBLE-NONE

visible: visible

CL_WD_INPUT_FIELD=>E_VISIBLE-VISIBLE

width

WIDTH

STRING

 

Dynamic Programming of Events

View Designer Name

Runtime Name

onEnter

ON_ENTER

Example

You can find examples of this interface element in the system in the WDR_TEST_UI_ELEMENTS Web Dynpro application and in the WDR_TEST_EVENTS component in the InputField view.

 

 

 

End of Content Area