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: 

At selection-screen ouput and Initilization

Former Member
0 Kudos

Hi,

When we can do initializations in At selection-screen output why we need initialization event.

Regards,

Satya

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Initialization event is used to set the default values for the parameters/selct-options.

AT Selection-Screen output is used for validation of the selection-screen

Regards

Anurag

8 REPLIES 8

Former Member
0 Kudos

Initialization event is used for popultating the default data on to the selection screen or populating the data to their respective internal tables before the output is being displayed

************************************************************************
*              AT SELECTION SCREEN OUTPUT                              *
************************************************************************
AT SELECTION-SCREEN OUTPUT.
   PERFORM schedule_update.

************************************************************************
*               INITIALISATION                                         *
************************************************************************
INITIALIZATION.
  r_balance-low = p_box1.
  r_balance-option = 'GT'.
  r_balance-sign = 'I'.
  APPEND r_balance.
  CLEAR r_balance.

  r_balance-low = p_box2.
  r_balance-option = 'LE'.
  r_balance-sign = 'I'.
  APPEND r_balance.
  CLEAR r_balance.

  r_balance-low = p_box2.
  r_balance-option = 'GT'.
  r_balance-sign = 'I'.
  APPEND r_balance.
  CLEAR r_balance.

Regards,

Santosh

former_member181962
Active Contributor
0 Kudos

at selection-screen is more useful in making dynamic screen modifications like making screen fields input enabled/disabled at run time.

and more over, if you press enter 10 times, then the code in at-selection screen out put triggers ten times.

Initialization event triggers only once.

Regards,

Ravi

Former Member
0 Kudos

Initialization event is used to set the default values for the parameters/selct-options.

AT Selection-Screen output is used for validation of the selection-screen

Regards

Anurag

Former Member
0 Kudos

hi,

EVENTS IN CLASSICAL REPORTS,

1.INITIALIZATION.

2.AT SELECTION-SCREEN.

3.TOP-OF-PAGE.

4.START-OF-SELECTION.

5.END-OF-SELECTION.

6.END-OF-PAGE.

INITIALIZATION, IS THE EVENT USED TO INITIALIZE THE SELECTION SCREEN FIELDS

AFTER THE SELECTION SCREEN IS DISPLAYED ON THE SCREEN,AND AFTER YOU GIVE ALL THE INPUT VALUES ON THE SCREEN,

AT SELECTION-SCREEN ENVET WILL EXECUTE.

IT IS THE EVENT FOR INPUT-FIELD VALIDATATIONS.

check for it,

regards,

kcc

Former Member
0 Kudos

Hi,

the INITIALIZATION event is perform after starting the program (of type 1) and before the selection screen appears. You can use it for variables or selection fields initialization, for instance. AT SELECTION-SCREEN OUTPUT is executed in the PBO (Process Before Output) of the screen. As difference to INITIALIZATION, this event can be executed many times, like when the user presses ENTER.

Former Member
0 Kudos

INITIALIZATION : tigger only once when program is loaded.

AT SELECTION-SCREEN OUTPUT, if it occurs in the report this event is always executed for PBO of a selection screen.

Syntax Diagram 
INITIALIZATION 


Basic form 
INITIALIZATION. 



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



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


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



Note 
In more precise terms, INITIALIZATION is executed in the following steps: 



Specify default values for the selections. 

Execute the event INITIALIZATION. 

Import variant (if used to start the report). On SUBMIT, the values specified for each WHERE clause are also transferred, if necessary. 

Execute the event AT SELECTION-SCREEN OUTPUT, if it occurs in the report (unlike INITIALIZATION, this event is always executed for PBO of a selection screen). 

Display selection screen. 

Transport the screen fields containing user input to the report fields. 

Continue with START-OF-SELECTION. 



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



Note 
The INITIALIZATION event is processed only in the case of SUBMIT, not CALL SELECTION-SCREEN. 



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



Related 
AT SELECTION-SCREEN, START-OF-SELECTION 


Additional help 
Description of Reporting Events

Regards

Prabhu

Former Member
0 Kudos

Hi Prasad,

Just as an example if we have 4 tabs(A, B, C, D) on the selection screen with each tab having different input fields, and in one tab i have to set a default value based on some Validation....say in tab C.

so..we can do the consition either in initialization or at selection-screen output.

Suppose i do at at selection screen output it will set and once i press tab B and come back to tab C again the validation is done.

If we do at initialization then the validation is done only once.

Regards,

Vidya.

Former Member
0 Kudos

Hi Prasad,

I guess INITIALIZATION is a one time event , it will be triggered only once in Program

where as AT SELECTION_SCREEN OUTPUT will be triggered when we change any thing in the selection screen ,

so its better to use INITIALIZATION when we want to initialize any data