Вы находитесь на странице: 1из 3

10/27/2014 ABAP EVENTS in Report Programming

http://saptechsrs.blogspot.in/2011/10/abap-events-in-report-programming.html 1/3
[http://1.bp.blogspot.com/-
PYb6qkHLvrc/TpW_9V_v9lI/AAAAAAAAAR8/VCLk09cn7GM/s1600/EVENTS.jpg]
ABAP EVENTS FOR REPORT PROGRAM-a close brief look
There is no mandatory event in a report program. Events are actually used to organize the statements and
control the flow of the program. If the program contains no explicitly defined event blocks, all the statements
in the program form the entire event block START-OF-SELECTION. ABAP runtime environment automatically
introduces a START-OF-SELECTION at the first execution line.
Let us see how events are triggered. And how the flow of events occurs. At first load of program takes place.
LOAD OF PROGRAM - If program is of type 1, M, F, or S; then LOAD-OF-PROGRAM is triggered first and
then INITIALIZATION. The purpose of load of program is to load the program into system memory so that the
program can be executed.
---------------------------------------------EVENTS IN A CLASSICAL REPORT-----------------------------------------------
-------------
INITIALIZATION: This is triggered when the report is loaded in memory. It happens just once in program
execution. If a report has a selection screen defined (either explicitly or by default through the use of a logical
database), the ABAP processor processes the selection screen first. A programmer can execute another
block of code before the selection screen by using the event keyword INITIALIZATION. This processing block
can be used to define characteristics of the selection screen. Examples include: setting default values on
selection fields, setting a title bar, assigning text to push buttons, etc.
AT SELECTION-SCREEN OUTPUT: This is triggered when the selection screen is loaded in memory before
being displayed. We can use it to modify selection screen, for example hide / unhide parameter, enable
disable input parameter.
AT SELECTION-SCREEN: This event is triggered before leaving the selection screen. Occurs when the user
triggers a function code on the selection screen (i.e., by clicking on push-button, hitting a function key, etc.).
Checks can be made on selection screen fields and appropriate messages sent back to the user (error,
confirmation, warning messages), or the program can be terminated. After the user enters new information,
ABAP EVENTS in Report Programming
10/27/2014 ABAP EVENTS in Report Programming
http://saptechsrs.blogspot.in/2011/10/abap-events-in-report-programming.html 2/3
AT SELECTION-SCREEN is triggered again. AT-SELECTION-SCREEN is used for field validation of selection
screen.
START-OF-SELECTION: is triggered after the selection screens is processed, and before any GET events or
any other event processing blocks. If no event keywords are coded in a report program, the report statement
automatically starts START-OF-SELECTION processing (it can be explicitly coded, but need not be). All ABAP
statements that are not part of a processing block (after an event keyword) or a FORM-ENDFORM block are
automatically part of the START-OF-SELECTION processing block if they are coded above all other event
keywords or subroutines. The Syntax Check will offer a warning if it detects that a line of code is inaccessible
due to being severed from an event processing block.
START-OF-SELECTION can be used to set default values of program-defined variables, or to code WRITE
statements to be output to the screen.
END-OF-SELECTION: This event is triggered after the START-OF-SELECTION is completed.
This event is used when there is a use of logical data base in the report. It is triggered in type 1 programs
once the logical database completes reading all data i.e. all the selection is finished and before the list
processor is started. This statement tells the server that all the database reading is completed and no more
data reading is going to take place. END-OF-SELECTION is generally used for the summary/results of
reports.
Note: - In an executable program without logical data base, there is no need to implement the event block
END-OF-SELECTION.
After a program is executed by the user, the database is locked when it encounters a START-OF-
SELECTION statement and the lock is released when an END-OF-SELECTION statement is encountered (to
maintain the consistency). Data selection is done between START-OF-SELECTION and END-OF-
SELECTION. Now if we dont write the END-OF-SELECTION statement, the database will remain locked till
the programs get terminated. Hence, the performance will be reduced. So it is always good practice to write
END-OF-SELECTION statement after finishing the data selection from database.
--------------------------------EVENTS IN AN INTERACTIVE REPORT-------------------------------------------------------
--
In addition of the above, the following events are possible in case of Interactive Reports.
GET and GET LATE: GET
events can only be used for the basic list in an interactive report. The GET event is triggered each time a row
is read from a logical database table. The data for this record is loaded into the table work area. A GET event
keyword can only be coded once for any one table in the logical database program.
The GET
LATE event, if coded, occurs just before the next row (record) of the table specified in the GET event is
selected from the database. It also occurs after any other GET or GET LATE events for tables lower in the
hierarchy of the logical database program.
GET event processing requires that the logical database be specified as an attribute of the report program
(while in the ABAP Editor, use the menu path Go to -> Attributes).
TOP-OF-PAGE: TOP-OF-PAGE is used for page headers on the basic list only. TOP-OF-PAGE is triggered
when the system encounters a WRITE, SKIP, or ULINE statement on the basic list. TOP-OF-PAGE occurs the
moment the first line of the first page is written to the screen. NEW-PAGE also invokes the TOP-OF-PAGE
event.
TOP-OF-PAGE DURING LINE-SELECTION allows a programmer to display headers for detail lists (other
than the basic list).
TOP-OF-PAGE DURING LINE-SELECTION is triggered with a WRITE, SKIP or ULINE statement on a detail
list.
END-OF-PAGE: The END-OF-PAGE event is used for page footers. This event is triggered when the system
10/27/2014 ABAP EVENTS in Report Programming
http://saptechsrs.blogspot.in/2011/10/abap-events-in-report-programming.html 3/3
encounters insufficient space on the current output page. The LINE-COUNT statement within the REPORT
statement specifies the size of the page area. If a LINE-COUNT is not explicitly coded, the END-OF-PAGE
event block will not be processed.
AT LINE-SELECTION: Every time user dbl-clicks(F2) on the list data.
At pF: Function key from F5 to F12 to perform interactive action on the list.
AT USER-COMMAND: Occurs when the user push toolbar button.
Finally I want to include one point:
If you debug your report program from the ABAP editor screen then it triggers from
1. Initialization,
2. At Selection-screen,
3. Start-of Selection,
4. End-of Selection,
5. Top-of-page,
6. End-of-page.
But if you debug from the selection-screen then it triggers from
1. At Selection-Screen,
2. Start-of-selection,
3. Top-of-page,
4. End-of-page.
Posted 12th October 2011 by SR Sarkar

Вам также может понравиться