SAPHub

Create password field in ABAP selection screen

There is no password field type in ABAP. But it is very easy to create a password like field in ABAP selection screen using the invisible field of the screen table.

Refer to the below code to create a password like field on selection screen

*----------------------------------------------------------------------*
*Selection-Screen
*----------------------------------------------------------------------*
PARAMETERS: p_name TYPE char10.
PARAMETERS: p_pass TYPE char10.

*----------------------------------------------------------------------*
*At Selection Screen Output
*----------------------------------------------------------------------*
AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    IF screen-name = 'P_PASS'.
      screen-invisible = 1.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

*----------------------------------------------------------------------*
*Start of Selection
*----------------------------------------------------------------------*
START-OF-SELECTION.
  WRITE:/ 'Name', ' : ', p_name.
  WRITE:/ 'Pass', ' : ', p_pass.

Selection Screen

Output