Application Development and Automation 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: 
Read only

init & at selection screen o/p

Former Member
0 Likes
824

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!

5 REPLIES 5
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
794

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

Read only

Former Member
0 Likes
794

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 .

Read only

Former Member
0 Likes
794

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

Read only

TuncayKaraca
Active Contributor
0 Likes
794

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.