Show TOC

InputFieldLocate this document in the navigation 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 format into the display format, and back into the internal format after the user has input a value, 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.

For more information, see:

InputField in a Table

Suggested Values for Input Fields

Personal Value List as Dropdown List for InputFields

Example of the Display with a Label

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 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.

Tip

Example of an InputField with enabled=false:

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 currently be displayed by using a TextView. This could, however, mean that no input help can be called using the keyboard, for example, or that 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 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

displayAsText

WDY_BOOLEAN

false

Yes

enabled

WDY_BOOLEAN

true

Yes

explanation

Translatable text

No

imeMode

WDUI_IMEMODE

auto

Yes

inputPrompt

Translatable text

Yes

length

I

20

Yes

passwordField

WDY_BOOLEAN

false

Yes

readOnly

WDY_BOOLEAN

false

Yes

state

WDUI_STATE

normal

Yes

suggestValues

WDY_BOOLEAN

false

No

textDirection

WDUI_TEXT_DIRECTION

inherit

Yes

tooltip

Translatable text

Yes

value

Translatable text

Mandatory

visible

WDUI_VISIBILITY

visible

Yes

width

STRING

Yes

Events in View Designer

Name

onEnter

Note

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

Dynamic Programming

For dynamic programming, the same properties, events, and aggregations as in the View Designer are available. But note that the spelling format and use of upper/lower case is different.

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

displayAsText

DISPLAY_AS_TEXT

WDY_BOOLEAN

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

inputPrompt

INPUT_PROMPT

WDY_MD_TRANSLATABLE_TEXT

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

suggestValues

SUGGEST_VALUES

WDY_BOOLEAN

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.