Step-by-step approach to create
pushbuttons on the selection screen
Step 1:
Choose Save or Enter Button.
Step 2:
Write the following code
REPORT ZPUSH_BUTTON.
TABLES: SSCRFIELDS.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS: P_BSART TYPE BSART DEFAULT 'XXX'.
SELECTION-SCREEN SKIP 3.
SELECTION-SCREEN PUSHBUTTON /15(10) TEXT-002 USER-COMMAND CL1.
SELECTION-SCREEN PUSHBUTTON 45(10) TEXT-003 USER-COMMAND CL2.
SELECTION-SCREEN END OF BLOCK B1.
DATA: L_UCOM LIKE SY-UCOMM.
AT SELECTION-SCREEN OUTPUT.
IF L_UCOM = 'CL1'.
LOOP AT SCREEN.
IF SCREEN-NAME CS 'P_BSART'.
SCREEN-INPUT = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSEIF L_UCOM = 'CL2'.
LOOP AT SCREEN.
IF SCREEN-NAME CS 'P_BSART'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
AT SELECTION-SCREEN.
CASE SSCRFIELDS.
WHEN 'CL1'.
L_UCOM = 'CL1'.
WHEN 'CL2'.
L_UCOM = 'CL2'.
ENDCASE.
TABLES: SSCRFIELDS.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS: P_BSART TYPE BSART DEFAULT 'XXX'.
SELECTION-SCREEN SKIP 3.
SELECTION-SCREEN PUSHBUTTON /15(10) TEXT-002 USER-COMMAND CL1.
SELECTION-SCREEN PUSHBUTTON 45(10) TEXT-003 USER-COMMAND CL2.
SELECTION-SCREEN END OF BLOCK B1.
DATA: L_UCOM LIKE SY-UCOMM.
AT SELECTION-SCREEN OUTPUT.
IF L_UCOM = 'CL1'.
LOOP AT SCREEN.
IF SCREEN-NAME CS 'P_BSART'.
SCREEN-INPUT = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSEIF L_UCOM = 'CL2'.
LOOP AT SCREEN.
IF SCREEN-NAME CS 'P_BSART'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
AT SELECTION-SCREEN.
CASE SSCRFIELDS.
WHEN 'CL1'.
L_UCOM = 'CL1'.
WHEN 'CL2'.
L_UCOM = 'CL2'.
ENDCASE.
Step 3:
Execute the program.
No comments:
Post a Comment