ABAP Events - AT SELECTION-SCREEN ON field - Introduction With Sample Program.
AT SELECTION-SCREEN ON <field> Event With A Sample Program
This event can be used if the user wants checks or validations to be carried out for a particular field on the selection screen.
At Selection-Screen On <field> and At Selection-Screen events, both do the same job i.e. validating the input fields present on the selection screen. The only difference is At Selection-screen event is used to validate all the fields on the selection screen where as At Selection-Screen On <field> event is used to validate a particular field in the selection screen.
Suppose there are 4 input fields in the selection screen, we want validation for input field FIELD1 only.
Using AT-SELECTION-SCREEN ON <field>:
REPORT ztest.
PARAMETERS: p_field1 TYPE char10,
p_field2 TYPE char10,
p_field3 TYPE char10,
p_field4 TYPE char10.
AT SELECTION-SCREEN ON p_field1.
IF p_field1 IS INITIAL.
MESSAGE 'Please enter a value in Field1.' TYPE 'E'.
ENDIF.
OUTPUT:
On pressing “ENTER” button or executing the program (F8):
Using AT-SELECTION-SCREEN:
REPORT ztest.
PARAMETERS: p_field1 TYPE char10,
p_field2 TYPE char10,
p_field3 TYPE char10,
p_field4 TYPE char10.
AT SELECTION-SCREEN.
IF p_field1 IS INITIAL.
MESSAGE 'Please enter a value in Field1.' TYPE 'E'.
ENDIF.
OUTPUT:
On pressing “ENTER” button or executing the program (F8):
The difference between AT SELECTION-SCREEN ON <field> & AT SELECTION-SCREEN events can be clearly seen:
- When we use At Selection-screen on <field> event, and while performing the check or validation of that particular field if an error message is displayed, then that particular is only open and rest all the fields are grayed out.
Whereas when we use At Selection-Screen event all the inputs fields are open and editable.
- At selection-screen on <field> is triggered first and then At selection-screen event follows it.
ALSO READ:
- ABAP EVENTS During Runtime Of A Report Program.
- INITIALIZATION Event - Introduction With A Sample Code.
- AT SELECTION-SCREEN Event - Introduction With A Sample Code.
- AT SELECTION-SCREEN OUTPUT Event - Introduction With A Sample Code.
- AT SELECTION-SCREEN ON VALUE REQUEST- Introduction With A Sample Code.
- AT SELECTION-SCREEN ON HELP REQUEST- Introduction With A Sample Code.
- AT SELECTION-SCREEN ON - Introduction With A Sample Code.
- Sample Program On AT SELECTION-SCREEN OUTPUT - 1.
- Sample Program On AT SELECTION-SCREEN OUTPUT - 2.
- Sample Program On AT SELECTION-SCREEN OUTPUT - 3.
- Sample Program On AT SELECTION-SCREEN OUTPUT - 4.
- Sample Program On AT SELECTION-SCREEN ON VALUE REQUEST FOR field - 1.
- Sample Program On AT SELECTION-SCREEN ON VALUE REQUEST FOR field - 2.
- Sample Program On AT SELECTION-SCREEN ON HELP REQUEST FOR field- 1.
Your suggestions and comments are welcome in this section.
Please mail all your contributions to administrator@abapmadeeasy.com We request you to mention your Name, Designation, Experience & Organization you are working for. Your posts will be verified and posted in this site with your name.