INITIALIZATION.
Event keyword:
(For executable programs of type 1), the associated event is executed before
the selection screen is displayed.
The parameters (PARAMETERS)
and selection criteria (SELECT-OPTIONS)
defined in the program already contain default values (if specified). You can assign different values here and also change the database-specific selections.
Define the last day of the previous month as the key date:
PARAMETERS QUAL_DAY TYPE D DEFAULT SY-DATUM.
INITIALIZATION.
QUAL_DAY+6(2) = '01'.
QUAL_DAY = QUAL_DAY - 1.
Here, the default value of QUAL_DAY is the current date,
e.g. 05.04.88 (QUAL_DAY = '19880405'). Two subseqent statements
set the date first to the beginning of the month, e.g. 01.04.88 (QUAL_DAY
= '19880401') and then, by subtracting one day, to the last day of the previous month, e.g. 31.03.88 (QUAL_DAY = '19880331').
When the selection screen is displayed, the
SELECT-OPTION FL_DATE should contain two selection lines.
DATA SBOOK_WA TYPE SBOOK.
SELECT-OPTIONS FL_DATE FOR SBOOK_WA-FLDATE.
INITIALIZATION.
MOVE: 'I' TO FL_DATE-SIGN,
'EQ'
TO FL_DATE-OPTION,
SY-DATUM TO FL_DATE-LOW.
APPEND
FL_DATE.
MOVE: 'BT' TO FL_DATE-OPTION,
'19960101'
TO FL_DATE-LOW,
'19960630' TO FL_DATE-HIGH.
APPEND FL_DATE.
When the selection screen is displayed, FL_DATE contains
the selection by the single value SY-DATUM (current date) and the interval from January 1, 1996 to June 30, 1996.
In more precise terms, INITIALIZATION is executed in the following steps:
Since INITIALIZATION is only executed once when you start
the report, it is not suitable for screen modifications such as suppressing individual parameters (
LOOP AT SCREEN, MODIFY
SCREEN) because these changes would disappear again when the user pressed ENTER. The
correct event for screen modifications is AT SELECTION-SCREEN OUTPUT.
The INITIALIZATION event is processed only in the case
of SUBMIT, not CALL SELECTION-SCREEN.
The SET PF-STATUS
statement does not work during the processing of an event. Instead, you should set a status with one
of the function modules RS_SET_SELSCREEN_STATUS or RS_EXTERNAL_SELSCREEN_STATUS.
AT SELECTION-SCREEN, START-OF-SELECTION
Description of Reporting Events