‎2008 Jan 13 1:46 PM
Hi Experts,
Can we code all the events in disorder? What is the execution
of those events ?
Thanx in Advance,
Sridhar.
‎2008 Jan 13 2:43 PM
Hi Sridhar,
If you are talking about events in the report programming then,
These are the events that the report programming is comprised of.
INITIALIZATION
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. Mostly global variables, classes, internal tables declarations are made here.
AT SELECTION-SCREEN
Point after processing user input on the selection screen while the selection screen is active. It provides you with several possibilities to carry out processing blocks while the system is processing the selection screen.
START-OF-SELECTION
Point after processing the selection screen. It gives you the possibility of creating a processing block after processing the selection screen and before accessing database tables using a logical database. You can use this processing block, for example, to set the values of internal fields or to write informational statements onto the output screen. At the START-OF-SELECTION event, also all statements are processed that are not attached to an event keyword except those that are written behind FORM-ENDFORM block.
You can do select database tables data processing here. REPORT statement always execute a START-OF-SELECTION implicitly. Consequently all processing logic between the REPORT statement and the next event keyword is automatically processed in the START-OF-SELECTION event.
*GET *
After the logical database has read an entry from the node . The most important event for report programs with an attached logical database is the moment at which the logical database program has read a line from a database table. When many programmers learn how to write an ABAP program, they confuse about logical database concept and this GET events. At first glance GET looks like a normal statement, but it is event keyword. If you look at the source of the logical database program code, it is easier to understand the GET keyword, even when you see the opposite keyword PUT inside the logical database program.
GET LATE
After the logical database has read an entry from the node . The event is triggered when all of the records for a node of the logical database have been read. If you want to write, for example, a sub total for a field, you can use this event.
END-OF-SELECTION
To define a processing block after the system has read processed all selections. It is triggered in type 1 programs (reports). This is the last of the events called by the runtime environment occur. It is triggered after all of the data has been read from the logical database, and before the list processor started. You can use the corresponding event block to process and format the data that the program has stored in internal tables or extracts during the various GET events.
The following events occur during the processing of the output list of a report program:
TOP-OF-PAGE
In list processing when a new page starts.
END-OF-PAGE
In list processing when a page ends.
AT LINE-SELECTION
When the user triggers the predefined function code PICK.
AT PF
When the user triggers the predefined function code PF.
AT USER-COMMAND
When the user triggers a function code defined in the program.
The last three events are used when an interactive report program has been written.
‎2008 Jan 13 11:33 PM
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
Also check this link.
Regards,
Maha
‎2008 Jan 14 3:37 AM
hi sridhar,
yes what ever the order of the events in the program, still they trigger according to the order of prefrence.
sequence of the events are of the form.
INITIALIZATION
AT SELECTION-SCREEN ON OUTPUT
AT SELECTIO-SCREEN ON FIELD
AT SELECTION-SCREEN
START-OF-SELECTION
TOP-OF-PAGE
END-OF-PAGE
END-OF-SELECTION
regards
shashikanth naram.
‎2008 Jan 14 4:13 AM
Hi Sridhar,
See This
The First Event For All Report Program Is
The first event triger is LOAD OF PROGRAM This will Trigger Whenever a report starts.
Then
Initialization
At selection-screen On
At selection-screen output
Start-of-selection(Default Event in Abap)
Top-of-page
End-of-page
End-of-Selection.
For Interactive..
At Line Selectio
At use Command
At pf 'n'
Top-Of_Page During Line selection....
These are the events.......
Regards,
Chandru
‎2008 Jan 14 4:16 AM
Hi,
Common Events:
1. Intialization:
This is the first event will be trigerred among all the events. In this event you will assigning values to variables.
For eg: if you want to display comments on the selection -screen.
v1 = 'HAI'. and write this variable in the at selection screen then HAI will be displayed in the selection screen.
2. At Selection-screen OUTPUT.
This is triggered before displaying the selection screen. It's just like PBO in Module pool.
3. At Selection-screen.
This event is triggered when the before leaving the selection screen.
4. Start-of-selection.
this is default event trigerred for every executable program. Here you can do all the retrival logic.
5. End-of-selection:
This event is triggered after the start-of-selection. to display the contents on the report.
Classical report events:
1.Top-of-page: Every time a new page is triggered. Mainly this is used for header of the report.
2. 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.
1. At line-selection : evey time user dbl-clicks(F2) on the list data.
2. At pF<key> :function key from F5 to F12 to perform interactive action on the lis
3. At user-command: to assign the function code for the button on the report.
It's just like PAI of the Module pool program.
Also Check This Link..
http://www.sap-img.com/abap/events-related-to-reporting.htm
Regards,
Priyanka.
‎2008 Jan 14 4:16 AM
Hi Sridhar,
Here is an example of all events
REPORT zyh284_test2.
PARAMETERS:
p_matnr TYPE mara-matnr.
AT SELECTION-SCREEN OUTPUT.
break-point.
p_matnr = '102'.
AT SELECTION-SCREEN ON p_matnr.
break-point.
IF p_matnr IS INITIAL.
MESSAGE e000(oo) WITH 'Enter a value for Material #'.
ENDIF.
AT SELECTION-SCREEN.
break-point.
IF p_matnr IS INITIAL.
MESSAGE e000(oo) WITH 'Enter a value for Material #'.
ENDIF.
START-OF-SELECTION.
WRITE:p_matnr.
Regards,
Chandru
‎2008 Jan 14 4:29 AM
Hi sridhar,
this may probably help you.
INITIALIZATION
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. Mostly global variables, classes, internal tables declarations are made here.
AT SELECTION-SCREEN
Point after processing user input on the selection screen while the selection screen is active. It provides you with several possibilities to carry out processing blocks while the system is processing the selection screen.
START-OF-SELECTION
Point after processing the selection screen. It gives you the possibility of creating a processing block after processing the selection screen and before accessing database tables using a logical database. You can use this processing block, for example, to set the values of internal fields or to write informational statements onto the output screen. At the START-OF-SELECTION event, also all statements are processed that are not attached to an event keyword except those that are written behind FORM-ENDFORM block.
You can do select database tables data processing here. REPORT statement always execute a START-OF-SELECTION implicitly. Consequently all processing logic between the REPORT statement and the next event keyword is automatically processed in the START-OF-SELECTION event.
*GET *
After the logical database has read an entry from the node . The most important event for report programs with an attached logical database is the moment at which the logical database program has read a line from a database table. When many programmers learn how to write an ABAP program, they confuse about logical database concept and this GET events. At first glance GET looks like a normal statement, but it is event keyword. If you look at the source of the logical database program code, it is easier to understand the GET keyword, even when you see the opposite keyword PUT inside the logical database program.
GET LATE
After the logical database has read an entry from the node . The event is triggered when all of the records for a node of the logical database have been read. If you want to write, for example, a sub total for a field, you can use this event.
END-OF-SELECTION
To define a processing block after the system has read processed all selections. It is triggered in type 1 programs (reports). This is the last of the events called by the runtime environment occur. It is triggered after all of the data has been read from the logical database, and before the list processor started. You can use the corresponding event block to process and format the data that the program has stored in internal tables or extracts during the various GET events.
The following events occur during the processing of the output list of a report program:
TOP-OF-PAGE
In list processing when a new page starts.
END-OF-PAGE
In list processing when a page ends.
AT LINE-SELECTION
When the user triggers the predefined function code PICK.
AT PF
When the user triggers the predefined function code PF.
AT USER-COMMAND
When the user triggers a function code defined in the program.
The last three events are used when an interactive report program has been written.
PS. There are some other events and events have some extra usage options for different purposes; but major event are above as mentioned.
also read this..
Initialization.
At selection-screen.
At selection-screen on .
Start-of-selection.
Top-of-page.
End-of-page.
End-of-selection.
Initialization.
We can initialize the selection-screen with calculated default values under this event.
Initialization.
s_date-high = sy-datum.
s_date-low = sy-datum - 15.
Append s_date.
At selection-screen.
We can validate all the inputs on selection screen fields under this event.
At selection-screen.
If s_carrid-low is initial or s_connid-low is initial or s_date is initial.
.
Endif.
At selection-screen on .
We can validate a particular field input on selection screen under this event.
At selection-screen on s_carrid.
If s_carrid-low LH.
Endif.
Start-of-selection.
By default the program is under this event.
If any of the other event comes before
Select Endselect. statements, then to break that event, we require this S-O-S event.
Start-of-selection.
Select * from
Endselect.
Top-of-page.
If we need some portion of the output (like column headings) to appear in all the pages, then we use this event.
Top-of-page.
Write:/ Carrier,10 Connection 20 Date.
If there is no external output statement before Top-of-page event, then this event will not work.
End-of-page.
Once the cursor reaches the last line of the page, automatically this event will be triggered.
Report Zxxx line-count 25(3).
In this case line numbers 23, 24 and 25 are reserved for footer.
Once the cursor reaches 23rd line, this event will be triggered.
End-of-page.
Write:/ sy-uline(75).
Write:/ This is end of page:,sy-pagno.
Write:/ sy-uline(75).
End-of-selection.
This event is used for concluding part of List.
End-of-selection.
Write:/ This is end of the Report.
Additional events in interactive reports: The following additional events are applicable to secondary lists.
Top-of-page during line-selection.
At line-selection.
At user-command.
plz reward if you find this material helpful,
thanks and regards,
srikanth tulasi.