You are on page 1of 5

How to use Events in an ABAP/4 Report Program

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 ST !T"#$" SE%E&TI#'. ( ) runtime environment automatically introduces a ST !T"#$"SE%E&TI#' at the first execution line. ( )*+ report programs are event driven programs. $ollowing events are triggered in a report. %# , #$ )!#-! .. " If propgram is of type /, ., $, or S0 then %# ," #$")!#-! . is trigerred first and then I'ITI %I1 TI#'. The purpose of load of program is to load the program into system memory so that the program can be executed. I'ITI %I1 TI#'. " 2ust once. T SE%E&TI#'"S&!EE' #3T)3T. " when there is selection"screen T SE%E&TI#'"S&!EE'. " when user interacts. ST !T"#$"SE%E&TI#'. " when $4.This is the default event in E',"#$"SE%E&TI#'. " E5E'TS I' t the end ( ).

&% SSI& % !E)#!T6

/. I'ITI %I1 TI#'6 This is triggered when the report is loaded in memory. 7. T SE%E&TI#'"S&!EE' #3T)3T6 This is triggered when the selection

screen is loaded in memory before being displayed.

8.

T SE%E&TI#'"S&!EE' 6 This event is triggered before leaving the

selection screen. +. ST !T"#$"SE%E&TI#'6 This is the the first and default event for displaying the report. ,ata retrieval logic is written under this event. #3T)3T E5E'T9:, ;<6 :. T#)"#$") -E6 This event is triggered every time a new page is started in the list. ;. E',"#$") -E 6 This event is triggered every time the list data reaches the footer region of the page. =. E',"#$"SE%E&TI#'6 This event is triggered after the ST !T"#$" SE%E&TI#' is completed. This event is used when there is use of logical data base in the report. It is triggered in type / 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. E',"#$"SE%E&TI#' is generally used for the summary*results of reports. In an executable program without logical data base, there is no need to implement the event block E',"#$"SE%E&TI#'. fter a program is executed by the user, the database is locked when it encounters a ST !T"#$"SE%E&TI#' statement and the lock is released when an E',"#$"SE%E&TI#' statement is encountered 9to maintain the consistency<. ,ata selection is done between ST !T"#$"SE%E&TI#' and E',"#$"SE%E&TI#'. 'ow if we don>t write the E',"#$"SE%E&TI#' statement, the database will remain locked till the programs get terminated. ?ence, the performance will be reduced. So it is always good practice to write E',"#$"SE%E&TI#' statement after finishing the data selection from database. E5E'TS I' ' I'TE! &TI5E !E)#!T6

In addition of the above, the following events are possible in case of Interactive !eports. /. Top of page during line selection 6 top of page event for secondary list. 7. 8. t line"selection 6 evey time user dbl"clicks9$7< on the list data. t p$ 6 function key from $: to $/7 to perform interactive action on

the list. +. t user"command.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@ $inally I want to include one point6 If you debug your report program from the triggers from /.Initialization, 7. t Selection"screen, 8.Start"of Selection, +.End"of Selection, :.Top"of"page, ;.End"of"page. (ut if you debug from the selection"screen then it triggers from /. t Selection"Screen, 7.Start"of"selection, 8.Top"of"page, +.End"of"page. bap editor screen then it

ABAP Programs
ABAP has the following program types: Executable Program Type 1; introduced with the REPORT statement; can be started by entering the program name or using a transaction code; can be called using !B"#T; can ha$e its own screens% Module Pool Type "; introduced with the PRO&RA" statement; can be started using a transaction code; can be called using 'A(( TRA) A'T#O) or (EA*E TO TRA) A'T#O); ha$e their own screens% Function Group Type +; introduced with the +!)'T#O),POO( statement; non,e-ecutable; container for function modules; can ha$e its own screens% Class Definition Type .; introduced with the '(A ,POO( statement; non,e-ecutable; container for classes; cannot /currently0 ha$e its own screens% Interface Definition Type 1; introduced with the '(A cannot ha$e its own screens% Subroutine Pool Type ; introduced with the PRO&RA" statement; non,e-ecutable; container for subroutines; cannot ha$e its own screens% T pe Groups Type T; introduced with the T2PE,POO( statement; non,e-ecutable; container for type definitions; cannot ha$e its own screens% Include Program Type #; no introductory statement; non,e-ecutable; container for source code modules% )on,e-ecutable programs with types +3 .3 13 3 and T are loaded into memory as re4uired% #nclude programs are not separately,compiled units; their source code is inserted into the programs in which the corresponding include statement occurs% ,POO( statement; non,e-ecutable; container for interfaces;

HIDE
For displaying the details on secondary lists requires that you have previously stored the contents of the selected line from within the program. To do this, ABAP/4 provides the HIDE statement. This statement stores the current field contents for the current list line. When calling a secondary list from a list line for which the HIDE fields are stored, the system fills the stored values back into the variables in the program. In the program code, insert the HIDE statement directly after the WRITE statement for the current line. Interactive lists provide the user with the so-called INTERACTIVE REPORTING facility. For background processing the only possible method of picking the relevant data is through NON INTERACTIVE REPORT . - See more at: http://www.saptechies.org/what-will-exactly-the-hidestatement-do/#sthash.p4EsTqTI.dpuf

!"at is t"e significance of #IDE $


HIDE is used to create an array of all the hidden variables. HIDE f Effect % Retains the contents of f related to the current output line. When the user selects the line from the list f is automatically filled with the retained value. The selection can occur in: 1. T !I"E#$E!E%TI&" '. T ()* +. T ,$ER#%&-- "D .. RE D !I"E The contents of the field do not have to have been displayed usin/ WRITE in order for you to retain them. The HIDE statement does not support deep structures 0structures that contain internal tables1. ,seful system fields for interactive reportin/ are listed in the $ystem )ields for !ists documentation. "ote
Lines or components of lines of an internal table that you address using a field symbol (see ASSIGNING addition to the READ and LOOP statements), cannot be retained using HIDE. You can store them using a global variable instead.

You might also like