Buttons on the Selection Screen
To generate buttons on a selection screen, you use the SELECTION-SCREEN PUSHBUTTON statement.
By default, the button is not positioned in a new line. To insert an explicit line break, add a slash (/) with your position and length specification, for example, /1(20).
You need to specify a name and a user command for the button.
You need to maintain the text that is to appear on the button separately. This can be done using text symbols, which you assign to the button during INITIALIZATION.
You can also use the ICON_CREATE function module to generate a text and an icon. If the user chooses the button, the system triggers the user command assigned to it and places the user command in the sscrfields-ucomm field. You need to include the TABLES sscrfields statement in your program to be able to access this field.
ABAP Events for the Selection Screen Versus Dynpro Events
Selection screens are special screens, which are generated by the system based on ABAP statements.
For standard screen programming, the process logic can be implemented at the following event for each screen:
The equivalents to these events for selection screens are as follows:
Evaluating Selection Screen Buttons
The user command of the button chosen by the user is placed into the sscrfields-ucomm field at the beginning of the AT SELECTION-SCREEN event. Here, you can determine the button that the user chose and react accordingly in the application. The best way to implement this is by using a CASE statement.
Runtime Changes to the Selection Screen
Each field of the selection screen has an entry in the SCREEN system table. You can change the contents of this table at runtime.
To hide selection fields, assign the value 0 to the SCREEN-ACTIVE attribute. You control the fields that are hidden using the name of the field or the group name.
To change whether a field is ready for input, you must assign 0 or 1 to the screen-input field.
LOOP AT SCREEN
Every field on the selection screen has a name, such as so_car-low and so_car-high, respectively, for the low and high field of a SELECT-OPTION so_car.
You can address these fields in LOOP AT SCREEN....ENDLOOP using their names, for example if you want to control whether they are shown or hidden on the selection screen at runtime. These dynamic changes must be performed in the AT SELECTION- SCREEN OUTPUT event block.