Initialization will be triggered before selection screen is displayed for the first time.
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 .
Check this link for more information.
KIndly reward points by clikcing the star on the left fo reply,if it helps.
The event are triggered depended on the way the output is generated .
Initialization : triggered when the report is loaded in memory.
At selection-screen output : triggered when the selection screen is loaded in memory before being displayed.
At selection-screen / <field> : before leaving the selection screen.
start-of-selection : the first event for displaying the report.
end-of-selection : after the start-of-selection is completed.
classiscal report events.
top-of-page : every time a new page is started in the list.
end-of-page : every time the list data reaches the footer region of the page.
interactive report events.
top of page during line selection : top of page event for secondary list.
at line-selection : evey time user dbl-clicks(F2) on the list data.
at pF<key> : function key from F5 to F12 to perform interactive action on the list.
Hope this helps...
INITIALIZATION event is triggered by ABAP runtime environment directly after LOAD-OF-PROGRAM and before the selection screen processing of any existing standard selection screen. This gives you the one-time opportunity to initialize the input fields of the selection screen as well as intializing/clearing the global variables in your program.
AT SELECTION-SCREEN OUTPUT event is always called before the standard/user defined selection screen is called.
So you can initialize your fields on the selection screen in At Selection Screen-Output even & for global variable initializations you can use the Initialization Event.
PS:Reward points if this helps.
initialization is the value you pass initially which you already know.
lets say you have a defined a value for a field in selection screen in the initialization part but the user doesnot know the value right.
in that case you put the field in at selection screen output where you make screen-input = 0 which gives the user to see the value and cannot change it.
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.
airp_fr-sign = 'I'.
airp_fr-option = 'EQ'.
airp_fr-low = 'JFK'.
airp_to-sign = 'I'.
airp_to-option = 'EQ'.
airp_to-low = 'FRA'.
carrid-sign = 'I'.
carrid-option = 'BT'.
carrid-low = 'AA'.
carrid-high = 'LH'.
datum+6(2) = '01'.
AT SELECTION-SCREEN OUTPUT->
In the PBO of the selection screen, the
AT SELECTION-SCREEN OUTPUT
event is triggered. This event block allows you to modify the selection screen and its fields directly before it is displayed.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-group1 = 'SC1'.
screen-intensified = '1'.
IF screen-group1 = 'SC2'.
screen-intensified = '0'.
if you go through this you ll find both are completely difference and they do different job at different point.
HI Gopal ,
Ex : You want to add some values to your parameters or select-options as listbox values by extracting from tables.
If you write this code in "At selection-screen output" whenever this event fire(Multipletimes can fire this event) each time this extraction statement add values to listbox.So duplicate values will be added to this.
Where as in "Initialization".Only one time this will fire.So no chances to add duplicate values.
Pls. reward points for helpful answers.
Hi Gopal ,
No there is a difference between intilization and at selection-screen output , initilization is called only once and that too at the beginning , but at selection-screen output is called each time the selection screen is displayed.
Here is a sample code for it.
Parameters : p_string type string. initilization. break-point. p_string = 'test_1'. at selection-screen output. break-point. p-string = 'test_2'. start-of-selection. write: p_string.
now execute this code once , you see the value of p_string as output , press the back button and try to go back to selection screen now see at where all the progam stops.
Hope this clears your doubt.