SAP ABAP - INITIALIZATION Events, Examples With Output.
Initialization event gets triggered when the program is loaded in memory but before the selection screen processing. This event gives an opportunity to initialize the input fields of the selection screen.
Initialization is an event that can be used for setting default values on selection fields, setting a title bar, assigning text to pushbuttons, etc. at runtime.
Initialization event block can also be used to perform authority checks.
SAMPLE PROGRAM - 1:
REPORT ztest.
SELECTION-SCREEN BEGIN OF BLOCK rad1 WITH FRAME TITLE title.
PARAMETER: p_budat LIKE bsid-budat OBLIGATORY.
SELECTION-SCREEN END OF BLOCK rad1.
INITIALIZATION.
title = 'Selection'.
p_budat = '20110825'.
AUTHORITY-CHECK OBJECT 'Z_BUDAT'
ID 'ZCHECK' FIELD 'BUDAT'.
IF sy-subrc EQ 0.
.....
ENDIF.
START-OF-SELECTION.
WRITE: 'START-OF-SELECTION Event Initialized'.
OUTPUT:
On executing / F8:
The output is as expected:
Also remember there is no such rule that u have to use this event only once. You can use this event a number of times. But this is not recommended.
There will be no error message or warning message in case you use more than one initialization event in your program.
SAMPLE PROGRAM - 2:
REPORT ztest.
END-OF-SELECTION.
WRITE:/ 'END-OF-SELECTION Event Trigerred'.
TOP-OF-PAGE.
WRITE:/ 'TOP-OF-PAGE Event Trigerred'.
START-OF-SELECTION.
WRITE:/ 'START-OF-SELECTION Event Trigerred'.
INITIALIZATION.
WRITE:/ '3 - INITIALIZATION Event Trigerred'.
INITIALIZATION.
WRITE:/ '1 - INITIALIZATION Event Trigerred'.
INITIALIZATION.
WRITE:/ '2 - INITIALIZATION1 Event Trigerred'.
OUTPUT:
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.