Wednesday, December 26, 2012

Create Pushbuttons on the selection screen without using PF Status


Creating pushbuttons on the selection without using SET PF-STATUS

Step-by-step approach to create pushbuttons on the selection screen
Step 1:
Create a program “ZPUSH_BUTTON” in SE38 with meaning full name.

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(10TEXT-002 USER-COMMAND CL1.
SELECTION-
SCREEN PUSHBUTTON 45(10TEXT-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.
The Initial selection screen will be displayed as below.



No comments:

Post a Comment