Entering content frame

INITIALIZATION Locate the document in its SAP Library structure

This event occurs before the standard selection screen is called. During this event block, the input fields of the standard selection screen can only be initialized once after the program has been started. If an executable program declares a standard selection screen the same program will be automatically called again by the system once the selection screen has been executed (see SUBMIT).  This triggers the INITIALIZATION  event again. It is important to note however that the initialization of parameters or selection criteria will not have an effect because at this point the value of the AT SELECTION-SCREEN OUTPUT is assigned using the previous user inputs. Only the remaining global fields which were set during INITIALIZATION are initialized during each program run.

During INITIALIZATION (but also during AT SELECTION-SCREEN OUTPUT) the standard values for parameters or selection criteria, which are declared in logical databases, can be changed. To change a selection criterion, you must fill at least the components seltab-sign, seltab-option and seltab-low of the selection table seltab, otherwise it remains undefined.

If you want to initialize the input fields of a logical database, you need to find out the names of the fields. To do this for the logical database SAPDB<ldb>, use Transaction SLDB or choose Tools ®  
ABAP Workbench, followed by Development
®  Programming environ. ®  Logical databases. You can also display the technical information for the required field on the selection screen. To do this, call the F1 help for the required field and then choose Technical info. In the field Scrn Field of the following dialog box, you then see the name of the field used in the program.

Example

The following executable program is connected to the logical database F1S.

REPORT event_demo.

PARAMETERS datum TYPE sy-datum DEFAULT sy-datum.

NODES spfli.

When you start the program, the selection screen appears:

This graphic is explained in the accompanying text

Only the parameter DATUM is defined in the program itself. All of the other input fields are defined in the logical database F1S.

When you call the F1 help for the first input field for Airline and then choose Technical info. the field name CARRID-LOW appears in the Scrn field field. This is the component of the selection table that corresponds to the input field. From this, you see that the name of the selection criterion is CARRID. In the same procedure as described above, you find that the parameters of the input fields From and To are named CITY_FR and CITY_TO.

Suppose we now change the program as follows:

REPORT demo_program_initialization.

PARAMETERS datum TYPE sy-datum DEFAULT sy-datum.

NODES spfli.

INITIALIZATION.
  airp_fr-sign = 'I'.
  airp_fr-option = 'EQ'.
  airp_fr-low = 'JFK'.
  APPEND airp_fr.
  airp_to-sign = 'I'.
  airp_to-option = 'EQ'.
  airp_to-low = 'FRA'.
  APPEND airp_to.
  carrid-sign   = 'I'.
  carrid-option = 'BT'.
  carrid-low    = 'AA'.
  carrid-high   = 'LH'.
  APPEND carrid.

  datum+6(2) = '01'.

The selection screen is now filled with default values as follows:

This graphic is explained in the accompanying text

 

Leaving content frame