2006 Nov 06 5:03 PM
hi !
i need the difference between
initialization and at selection-screen output events.
please explain with an example.
points will be awarded!
hi !
i need the difference between
initialization and at selection-screen output events.
please explain with an example.
points will be awarded!
2006 Nov 06 5:06 PM
Hi the INITIALIZATION event is only fired one time at the start of the program. The AT SELECTION-SCREEN OUTPUT event is fired every screen cycle, it is just like the PBO. The user hits enter, the AT SELECTION-SCREEN event is fired to check validations, then back around to the AT SEL.... OUTPUT event. This is the screen cycle.
REgards,
Rich Heilman
2006 Nov 06 5:07 PM
At selection screen o/pevent is executed at PBO of the selection screen every time the user presses ENTER - in contrast to INITIALIZATION . Therefore, this event is not suitable for setting selection screen default values. Also, since AT SELECTION-SCREEN OUTPUT is first executed after the variant is imported (if a variant is used) and after adopting any values specified under SUBMIT in the WITH clause, changing the report parameters or the selection options in AT SELECTION-SCREEN OUTPUT would destroy the specified values.
Here, however, you can use LOOP AT SCREEN or MODIFY SCREEN to change the input/output attributes of selection screen fields.
Example
Output all fields of the SELECT-OPTION NAME highlighted:
SELECT-OPTIONS NAME FOR SY-REPID MODIF ID XYZ.
...
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
CHECK SCREEN-GROUP1 = 'XYZ'.
SCREEN-INTENSIFIED = '1'.
MODIFY SCREEN.
ENDLOOP.
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.
In contrast to R/2 , this event is also executed during background processing.
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').
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 .
2006 Nov 06 5:09 PM
Hi Ravi,
<b>Event keyword Event</b>----
<b>INITIALIZATION</b> 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.
<b>AT SELECTION-SCREEN OUTPUT</b>This event is executed at PBO of the selection screen every time the user presses ENTER - in contrast to INITIALIZATION. Therefore, this event is not suitable for setting selection screen default values. Also, since AT SELECTION-SCREEN OUTPUT is first executed after the variant is imported (if a variant is used) and after adopting any values specified under SUBMIT in the WITH clause, changing the report parameters or the selection options in AT SELECTION-SCREEN OUTPUT would destroy the specified values.
Here, however, you can use LOOP AT SCREEN or MODIFY SCREEN to change the input/output attributes of selection screen fields.
Reward points if this helps
Manish
2006 Nov 06 5:10 PM
Hi Ravi,
Please check this links including sample codes.
http://help.sap.com/saphelp_nw2004s/helpdata/en/56/1eb6c705ad11d2952f0000e8353423/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db9a2135c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/79/34a234d9b511d1950e0000e8353423/content.htm
Regards,
Ferry Lianto
2006 Nov 06 5:11 PM
Ravi,
Check this link:
<a href="http://www.itcserver.com/blog/2006/06/26/events-in-abap/">Events in ABAP</a>
Point before the selection screen is displayed. Basically <b>INITIALIZATION </b>is triggered when you run the report and you use this event to assign some initial values to your variables.
<b>AT SELECTION-SCREEN </b>
Point after processing user input on the selection screen while the selection screen is active.