In this recipe, we will see how toolbar buttons (and their relevant click code) may be added to selection screens. In this recipe, we will create a program that will display a selection screen having three toolbar buttons, each of which when clicked, takes us to a different transaction.
For adding buttons on your selection screen toolbar, proceed as follows:
sscrfields
.1
, 2
, and 3
using the selection-screen
statement.abc
is defined.initialization
event, the respective texts for the buttons are assigned to the functxt_01
, functxt_02
, and functxt_03
fields of the structure sscrfields
.at selection-screen
event, we check the value of the field sscrfields-ucomm
. The FC01
, FC02
, and FC03
values represent the button-click event of the first, second, and third buttons respectively. We call the respective transactions, SE38
, SE80
, and SBWP
, for each button-click.We will now see how the coding works in displaying the toolbar buttons along with the necessary button text, and how the respective transactions are called after button-click events.
The selection-screen
statements' coding and the initialization creates the three toolbar buttons and the relevant texts, ABAP Editor, Object Navigator, and Business Workplace. The function code FC01
, FC02
, and FC03
are assigned to the three buttons. When any of the buttons are pressed, the at selection-screen
event is called. The value of the field sscrfields-ucomm
is checked. Depending on which button, the UCOMM field is automatically populated with FC01
, FC02
, or FC03
. After checking the value, the relevant transaction code is called via the call transaction
statement and the user is taken to the appropriate transaction.
3.145.103.154