loading...
Hi Friends!!! In this post, we would be discussing about How to add Buttons on the application toolbar of Selection Screens?
We can add buttons to the application toolbar of selection screen by implementing the following steps:
Step 1: At first, we need to bring the buttons to the layout of the selection screen. You should note that SAP allows a maximum of 5 buttons to the application toolbar of selection screen excluding the ‘Execute’ button. These buttons are numbered from 1 to 5 and each can be added to the selection screen’s application toolbar using the following ABAP statement:
SELECTION-SCREEN FUNCTION KEY n.
where, n ranges from 1 to 5 representing the button number.
Step 2: Next, you would like to choose some some display text for the buttons you have added.
This could be taken care in the INITIALIZATION event of the selection screen using the selection screen’s control structure SSCRFIELDS. This structure contains text fields FUNCTXT_01 to FUNCTXT_05 for each button. You can do it as follows:
TABLES: SSCRFIELDS.
……….
……………
INITIALIZATION:
MOVE ‘User Function 1′ TO SSCRFIELDS-FUNCTXT_01.
Step 3: Lastly, you would like to handle the CLICK of your added buttons. Each button (1 to 5) on the selection screen’s application toolbar is pre-associated with function code FC01 to FC05.
You can handle the click of these buttons in the AT SELECTION-SCREEN event of Selection screen by accessing the relevant user-command from SSCRFIELDS-UCOMM.
AT SELECTION-SCREEN.
IF SSCRFIELDS-UCOMM = ‘FC01′.
…
ENDIF.IF SSCRFIELDS-UCOMM = ‘FC02′.
…
ENDIF.
An example to explain overall process:
TABLES: SSCRFIELDS.
……….
SELECTION-SCREEN FUNCTION KEY 1.
SELECTION-SCREEN FUNCTION KEY 2.
………..
…………
………..
INITIALIZATION.
MOVE ‘My Function 01′ TO SSCRFIELDS-FUNCTXT_01.
MOVE ‘My Function 02′ TO SSCRFIELDS-FUNCTXT_02.
………………….
………………….
AT SELECTION-SCREEN.
IF SSCRFIELDS-UCOMM = ‘FC01′.
…
ENDIF.
IF SSCRFIELDS-UCOMM = ‘FC02′.
…
ENDIF.
………………………..……………………….
START-OF-SELECTION.
………………..
………………..
Thats all which was required. Stay tuned for our further posts.
loading...
loading...

