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: 

initialization & at selection-screen output difference

Former Member
0 Kudos

i think what we are handling in INITIALIZATION also we can handle same in AT SELECTION SCREEN OUTPUT also. can any one give example where we can handle things only in INITIALIZATION instead of AT SELECTION-SCREEN OUTPUT.

1 ACCEPTED SOLUTION

Former Member

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.

10 REPLIES 10

Former Member
0 Kudos

initilization event for setting calculate default value in selection screen and s_s_o if u want to change the attribute of current screen field in that case u use s_s_o

Former Member
0 Kudos

same thread.

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

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.

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/initiali.htm

KIndly reward points by clikcing the star on the left fo reply,if it helps.

Former Member
0 Kudos

Hi Gopal..

The event are triggered depended on the way the output is generated .

for eg:

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

~Sri.

Former Member
0 Kudos

Hi ,

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.

thanks

venki

Former Member
0 Kudos

Hi Gopal,

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.

Regards,

Chetan.

PS:Reward points if this helps.

Former Member
0 Kudos

hi

good

INITIALIZAION->

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.

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

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

MODIFY SCREEN.

CONTINUE.

ENDIF.

IF screen-group1 = 'SC2'.

screen-intensified = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

if you go through this you ll find both are completely difference and they do different job at different point.

thanks

mrutyun^

Former Member

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.

Former Member
0 Kudos

Hello,

Initialization will be triggered before selection screen is displayed for the first time.

Regards,

Shehryar Dahar

Former Member
0 Kudos

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.

Reagrds

Arun