‎2007 Feb 26 11:45 AM
In report if we have write statements in initialization, top of page and in start of selection then which event is first excuted and what is the output?
Please help me.
vamsi.
‎2007 Feb 26 11:51 AM
hi,
First event -
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 : before leaving the selection screen.
start-of-selection : the first event for displaying the report.
This event keyword defines an event block whose event is triggered by the ABAP runtime environment
when calling the executable program selection screen processing of a selection screen.
In an executable program, all statements that are not declarations,
and are listed before the first explicit processing block, are assigned to this event block.
If the program does not contain an explicitly defined event block START-OF-SELECTION,
these statements form the complete event block START-OF-SELECTION.
If a program contains an explicitly defined event block START-OF-SELECTION,
these statements are added to the beginning of the event block.
If the program contains no explicitly defined event blocks,
these statements form the entire event block START-OF-SELECTION.
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.
at user-command
http://help.sap.com/saphelp_47x200/helpdata/en/56/1eb6c705ad11d2952f0000e8353423/content.htm
Regards
anver
‎2007 Feb 26 11:47 AM
TOP-OF-PAGE.
INITIALIZATION.
START-OF-SELECTION.
END-OF-SELECTION.
Reward if this helps.
U can try out a sample program.
please reward and close the other threads opened by you.
Message was edited by:
Judith Jessie Selvi
‎2007 Feb 26 11:48 AM
First thing is that you cannot have write statements in initialization.
The order of execution is, Initialization , start-of-selection,Top-of-page.
But If there is any write statement in Start-of-selection, then the Top-of-page event will get triggered and then only the write statement in the start-of-selection write statement will be executed.
Regards,
Ravi
‎2007 Feb 26 11:49 AM
Hi,
The sequence of events for a report are
INITIALIZATION and then
START -OF-SELECTION
and TOP-OF-PAGE is fired before the list generation.
In you case it will TOP-OF-PAGE first then output of INITIALIZATION and then START-OF-SELECTION.
Regards,
Sesh
‎2007 Feb 26 11:50 AM
hi,
first top-of-page,initialization and then start-of-selection will beexecuted..
generaly when the first write statement is encountered point goes to tiop-of-page that will be executed then it comes back to the point of execution.
and generally Initialization event is used to initialize the selection-screen fieilds.
As u asked in ur case,as given above it will be executed.
Regards
‎2007 Feb 26 11:51 AM
hi,
First event -
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 : before leaving the selection screen.
start-of-selection : the first event for displaying the report.
This event keyword defines an event block whose event is triggered by the ABAP runtime environment
when calling the executable program selection screen processing of a selection screen.
In an executable program, all statements that are not declarations,
and are listed before the first explicit processing block, are assigned to this event block.
If the program does not contain an explicitly defined event block START-OF-SELECTION,
these statements form the complete event block START-OF-SELECTION.
If a program contains an explicitly defined event block START-OF-SELECTION,
these statements are added to the beginning of the event block.
If the program contains no explicitly defined event blocks,
these statements form the entire event block START-OF-SELECTION.
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.
at user-command
http://help.sap.com/saphelp_47x200/helpdata/en/56/1eb6c705ad11d2952f0000e8353423/content.htm
Regards
anver
‎2007 Feb 26 11:51 AM
hi
i doubt it judith..
initialization.
write '1'.
start-of-selection.
write '2'.
end-of-selection.
write '3'.
top-of-page.
write '4'.
the output of the above code is
4
1
2
3
top-of-page will be triggered first
cheers,
Sathish. R
‎2007 Feb 26 11:57 AM
S thats right, that is in the order of events in report.
Hi vamsi,
See this sample code for simpale report
REPORT ztemplate
NO STANDARD PAGE HEADING
LINE-SIZE 130
LINE-COUNT 65
MESSAGE-ID zm.
**************************************
* The Data Declarations
TABLES: mara." General Material Data.
************************************************************************
* Type Declarations:
************************************************************************
TYPES : BEGIN OF ty_mara,
cb(1),
matnr LIKE mara-matnr,
mtart LIKE mara-mtart,
matkl LIKE mara-matkl,
END OF ty_mara.
************************************************************************
* Internal Tables:
************************************************************************
* The following structure type must be defined in the data dictionary
DATA : i_output TYPE ty_mara OCCURS 0 WITH HEADER LINE.
DATA: lines TYPE i, free TYPE i.
* The Selection Screen Definition
SELECTION-SCREEN BEGIN OF BLOCK b_main WITH FRAME TITLE text-b01.
*
*SELECTION-SCREEN skip.
*
SELECT-OPTIONS: s_matnr FOR mara-matnr. "Material No
*PARAMETERS: P_XXXXX like XXXX-XXXXX. "Description
*PARAMETERS: CB_XXXX as checkbox. "Description
*PARAMETERS: RB_XXXY radiobutton group XXX default 'X'. "Description
*PARAMETERS: RB_XXXZ radiobutton group XXX. "Description
*
*SELECTION-SCREEN COMMENT fmt name.
SELECTION-SCREEN END OF BLOCK b_main.
*SELECTION-SCREEN ULINE.
*eject
************************************************************************
* INITIALIZATION
************************************************************************
INITIALIZATION.
*
************************************************************************
* AT SELECTION-SCREEN
************************************************************************
AT SELECTION-SCREEN.
*Validate material no details
IF NOT s_matnr[] IS INITIAL.
LOOP AT s_matnr.
IF NOT s_matnr-low IS INITIAL.
SELECT SINGLE matnr INTO v_matnr
FROM mara
WHERE matnr = s_matnr-low.
IF sy-subrc NE 0.
MESSAGE i128.
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
IF NOT s_matnr-high IS INITIAL.
SELECT SINGLE matnr INTO v_matnr
FROM mara
WHERE matnr = s_matnr-high.
IF sy-subrc NE 0.
MESSAGE i128.
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
************************************************************************
* START-OF-SELECTION
************************************************************************
START-OF-SELECTION.
REFRESH: i_output.
CLEAR : i_output.
SELECT matnr
mtart
matkl
INTO TABLE i_output
FROM mara
WHERE mara~matnr IN s_matnr.
IF sy-subrc NE 0.
MESSAGE i000 WITH text-002.
" No records found for selected criteria
leave list-processing.
ENDIF.
IF NOT i_output[] IS INITIAL.
LOOP AT i_output INTO wa_output.
WRITE:/001 wa_output-cb AS checkbox,
003 wa_output-matnr,
015 wa_output-mtart,
024 wa_output-matkl.
CLEAR wa_output.
ENDLOOP.
ENDIF.
************************************************************************
* END-OF-SELECTION
************************************************************************
END-OF-SELECTION.
lines = sy-linno - 1.
SET PF-STATUS 'ZSTATUS'.
AT USER-COMMAND.
wa_output-cb = space.
SET PF-STATUS 'ZSTATUS' EXCLUDING 'SAVE'.
DO lines TIMES.
READ LINE sy-index FIELD VALUE wa_output-cb.
IF wa_output-cb = 'X'.
MODIFY i_output FROM wa_output INDEX sy-tabix TRANSPORTING cb.
ENDIF.
ENDDO.
CASE sy-ucomm.
WHEN 'SAVE'.
DELETE i_output WHERE cb = 'X'.
WHEN 'BACK'.
LEAVE SCREEN.
ENDCASE.
************************************************************************
* TOP-OF-PAGE.
************************************************************************
TOP-OF-PAGE.
ULINE.
FORMAT INTENSIFIED OFF.
FORMAT COLOR COL_HEADING.
WRITE:/001 'CB' ,
003 'Material No',
015 'Mat type',
024 'Mat group'.
FORMAT COLOR OFF.
FORMAT INTENSIFIED ON.
ULINE.
‎2007 Feb 26 11:58 AM
<b>The order of triggering of events
1. Top-of-page
2. Initialization
3. start-of-selection
Report zex36.
INITIALIZATION.
WRITE : / 'sree'.
TOP-OF-PAGE.
WRITE : / 'kanth'.
START-OF-SELECTION.
WRITE : / 'Reddy'.
O/P will be
kanth
sree
Reddy</b>
‎2007 Feb 26 12:12 PM
top -of -page will be first trigerred,then initialization then start-of- selection and then end-of-selection.
reward this with points