Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Reports - initialization event

Former Member
0 Kudos

Hi Experts,

we can initialize the value by using data statement also then what is the purpose of initilization event in reports can any one explain me with example.......

advance in thanks

venki

5 REPLIES 5

Former Member
0 Kudos

YOu can use this even to set up the selection screen parameters:

For parameters you can assign values to them in their declaration. But you cannot do this for select-options.

INITIALIZATION.

S_MATNR-OPTION = 'EQ'.

S_MATNR-SIGN = 'I'

S_MATNR-LOW = '1'

APPEND S_MATNR.

Former Member
0 Kudos

hi,

There is no diffrence between them when it comes to initial value of varaibles/selection screen objects.

But initialization event is generally used when you want to do some processing once at the beginning of the program ,e,g, in a program check if a varaint exists and give the option to select that varaint.

This is just a very generic example .

rgds plz award points if it helps.

Former Member
0 Kudos

Hi,

We can use INITIALIZATION when we want to give some initial values to the selection fields

SELECTION-SCREEN BEGIN OF BLOCK B1.

SELECT-OPTIONS : SO_PDATE FOR CDHDR-UDATE.

SELECTION-SCREEN END OF BLOCK B1.

INITIALIZATION.

so_pdate-low = sy-datum.

append so_pdate.

This will initializes the low field with the system date.

If it helps REWARD...

rgds

harris

Former Member
0 Kudos

Hi

The INITIALIZATION event is only fired one time at the start of the program

<u><b>

INITIALIZATION</b></u>

Point before the selection screen is displayed. When you start a program in which a selection screen is defined (either in the program itself or in the linked logical database program), the system normally processes this selection screen first. If you want to execute a processing block before the selection screen is processed, you can assign it to the event keyword INITIALIZATION. Mostly global variables, classes, internal tables declarations are made here.

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.

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.

<b><u>Suppose we now change the program as follows:</u></b>


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'.

Reward all helpfull answers

Regards

Pavan

Former Member
0 Kudos

INITIALIZATION

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, 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.

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:

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:

http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db9a2135c111d1829f0000e829fbfe/content.htm