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

Reporting events

Former Member
0 Likes
1,181

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.

1 ACCEPTED SOLUTION
Read only

anversha_s
Active Contributor
0 Likes
1,154

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

9 REPLIES 9
Read only

Former Member
0 Likes
1,154
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

Read only

Former Member
0 Likes
1,154

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

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
1,154

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

Read only

Former Member
0 Likes
1,154

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

Read only

anversha_s
Active Contributor
0 Likes
1,155

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

Read only

Former Member
0 Likes
1,154

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

Read only

0 Likes
1,154

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.

Read only

Former Member
0 Likes
1,154

<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>

Read only

Former Member
0 Likes
1,154

top -of -page will be first trigerred,then initialization then start-of- selection and then end-of-selection.

reward this with points