Skip to Content
author's profile photo Former Member
Former Member

ABAP native Events

HI,

In any of the typical ABAP programs, we have some events that are native to ABAP runtime (e.g., initialization, start-of-selection,etc),now, i need to know that on which order these events will get executed. also below I've given the events just order them on their execution basis.

initialization

start-of-selection

top-of-page

end-of-page

at selection-screen

end-of-selection

at user-command

at selection-screen output

Regards,

Srikanth.P.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Mar 20, 2008 at 11:33 AM

    initialization

    start-of-selection

    top-of-page

    end-of-page

    at selection-screen

    end-of-selection

    at user-command

    at selection-screen output

    Hello,

    Here are the events in order

    Classical Report Events:

    Initialization

    At selection-screen

    at selection-screen output

    start-of-selection

    end-of-selection

    top-of-page

    end-of-page

    Interactive Report Events:

    Above events and also,

    at line-selection,

    at user-command,

    at pfn

    reward if useful.

    Sandeep Salaria

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 20, 2008 at 11:38 AM

    hi use this....

    REPORT zwk22671 LINE-COUNT 40(3)

    LINE-SIZE 200

    NO STANDARD PAGE HEADING.

    *----


    *TABLES

    *----


    TABLES : mkpf , "MATERIAL DOCUMENT

    mseg , "DOCUMENT SEGMENT : MATERIAL

    t156t , "MOVEMENT TYPE TEXT

    makt. "MATERIAL DESCRIPTIONS

    *----


    **DECLARATION OF STRUCTURE , INTERNAL TABLES , VARIABLES

    *----


    *STRUCTURE OF INTERNAL TABLES

    DATA : BEGIN OF xtab,

    mblnr TYPE mkpf-mblnr , "DOCUMENT NUMBER

    mjahr TYPE mkpf-mjahr , "YEAR

    budat TYPE mkpf-budat , "POST DATE

    blart TYPE mkpf-blart , "DOCUMENT TYPE

    END OF xtab.

    DATA : BEGIN OF ytab,

    mblnr TYPE mseg-mblnr , "DOCUMENT NUMBER

    mjahr TYPE mseg-mjahr , "YEAR

    zeile TYPE mseg-zeile , "ITEM NUMBER

    bwart TYPE mseg-bwart , "MOVEMENT TYPE

    btext TYPE t156t-btext , "MOVEMENT DESCRIPTION

    matnr TYPE mseg-matnr , "MATERIAL NUMBER

    maktx TYPE makt-maktx , "MATERIAL DESCRIPTION

    meins TYPE mseg-meins , "UNIT OF MEASURE

    menge TYPE mseg-menge , "QUANTITY

    dmbtr TYPE mseg-dmbtr , "AMOUNT

    END OF ytab.

    *INTERNAL TABLE DECLARATION

    DATA : i_tab1 LIKE STANDARD TABLE OF xtab WITH HEADER LINE. "INTERNAL TABLE 1 : CONTAINS MATERIAL DETAILS

    DATA : i_tab2 LIKE STANDARD TABLE OF ytab WITH HEADER LINE. "INTERNAL TABLE 2 : CONTAINS ITEMWISE MATERIAL DETAILS

    *VARIABLES

    DATA : v_color TYPE sy-tabix , "FOR SETTING COLOR FORMATS DURING GENERATING REPORT

    v_field(20) , "FOR STORING THE CLICKED FIELD NAME

    v_value(20) , "FOR STORING THE CLICKED FIELD VALUE

    v_mblnr TYPE mkpf-mblnr , "FOR VALIDATING DOCUMENT NUMBER

    v_mjahr TYPE mkpf-mjahr , "FOR VALIDATING DOCUMENT YEAR

    v_bwart TYPE mseg-bwart , "FOR VALIDATING MOVEMENT TYPE

    v_matnr TYPE mseg-matnr . "FOR VALIDATING MATERIAL NUMBER

    *----


    **SELECTION-SCREEN

    *----


    SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.

    SELECT-OPTIONS : s_mblnr FOR mkpf-mblnr , "DOCUMENT NUMBER

    s_mjahr FOR mkpf-mjahr OBLIGATORY, "DOCUMENT YEAR

    s_bwart FOR mseg-bwart NO INTERVALS NO-EXTENSION, "MOVEMENT TYPE

    s_matnr FOR mseg-matnr . "MATERIAL NUMBER

    SELECTION-SCREEN : END OF BLOCK blk1.

    *----


    AT SELECTION-SCREEN

    *----


    AT SELECTION-SCREEN.

    PERFORM validation. "PERFORMS VALIDATION OF SELECTION-SCREEN FIELDS

    *----


    *TOP-OF-PAGE

    *----


    TOP-OF-PAGE.

    PERFORM header. "CREATES HEADER FOR THE BASIC LIST

    *----


    *END-OF-PAGE

    *----


    END-OF-PAGE. "CREATES FOOTER FOR THE BASIC AND SECONDARY LIST

    PERFORM footer.

    *----


    *START-OF-SELECTION

    *----


    START-OF-SELECTION.

    PERFORM generation_basic. "GENERATES REPORT FOR BASIC LIST WHICH CONTAINS DOCUMENT NO , DOCUMENT YEAR

    "POST DATE , DOCUMENT TYPE.

    *----


    *END-OF-SELECTION

    *----


    END-OF-SELECTION.

    PERFORM report_basic. "DISPLAY REPORT FOR BASIC LIST

    *----


    *AT LINE-SELECTION

    *----


    AT LINE-SELECTION.

    PERFORM generation_secondary. "GENERATES REPORT FOR SECONDARY LIST BASED ON THE DOCUMENT NUMBER AND DOCUMENT YEAR

    "WHICH CONTAINS DOCUMENT NO , YEAR , ITEM NO , MOVEMENT TYPE , MOVEMENT DESCRIPTION ,

    "MATERIAL NUMBER , MATERIAL DESC , UNIT OF MEASURE , QUANTITY AND AMOUNT

    *----


    *TOP-OF-PAGE DURING LINE-SELECTION

    *----


    TOP-OF-PAGE DURING LINE-SELECTION.

    PERFORM header_secondary. "CREATES HEADER FOR THE SECONDARY LIST

    *----


    *AT USER-COMMAND

    *----


    AT USER-COMMAND.

    PERFORM user_secondary. "SUBROUTINE FOR HANDLING USER EVENTS

    &----


    *& Form VALIDATION

    &----


    text

    -


    --> p1 text

    <-- p2 text

    -


    FORM validation .

    *VALIDATING MATERIAL DOCUMENT NUMBER

    SELECT SINGLE mblnr

    INTO v_mblnr

    FROM mkpf

    WHERE mblnr IN s_mblnr.

    IF sy-subrc NE 0.

    MESSAGE 'ENTER CORRECT DOCUMENT NUMBER' TYPE 'E'.

    ENDIF.

    *VALIDATING MATERIAL DOCUMENT YEAR

    SELECT SINGLE mjahr

    INTO v_mjahr

    FROM mkpf

    WHERE mjahr IN s_mjahr.

    IF sy-subrc NE 0.

    MESSAGE 'ENTER CORRECT MATERIAL DOCUMENT YEAR' TYPE 'E'.

    ENDIF.

    *VALIDATING MOVEMENT TYPE

    SELECT SINGLE bwart

    INTO v_bwart

    FROM mseg

    WHERE bwart IN s_bwart.

    IF sy-subrc NE 0.

    MESSAGE 'ENTER CORRECT MOVEMENT TYPE' TYPE 'E'.

    ENDIF.

    *VALIDATING MATERIAL NUMBER

    SELECT SINGLE matnr

    INTO v_matnr

    FROM mseg

    WHERE matnr IN s_matnr.

    IF sy-subrc NE 0.

    MESSAGE 'ENTER CORRECT MATERIAL NUMBER' TYPE 'E'.

    ENDIF.

    ENDFORM. " VALIDATION

    &----


    *& Form HEADER

    &----


    text

    -


    --> p1 text

    <-- p2 text

    -


    FORM header .

    WRITE :/30 'MATERIAL DOCUMENTS' COLOR 1. "TITLE OF BASIC LIST

    WRITE :/1(89) sy-uline.

    FORMAT COLOR 1.

    WRITE :/1 sy-vline ,

    3 'DOCUMENT NUMBER' ,

    23 sy-vline ,

    25 'YEAR' ,

    45 sy-vline ,

    47 'POST DATE' ,

    67 sy-vline ,

    69 'DOCTYP' ,

    89 sy-vline .

    FORMAT RESET.

    WRITE :/1(89) sy-uline.

    ENDFORM. " HEADER

    &----


    *& Form FOOTER

    &----


    text

    -


    --> p1 text

    <-- p2 text

    -


    FORM footer .

    IF sy-lsind EQ 0. "CHECKS WHICH LIST IS IT BASIC LIST OR SECONDARY (AND NO. OF SECONDARY LIST)

    WRITE :/1(89) sy-uline.

    ELSEIF sy-lsind EQ 1.

    WRITE :/1(192) sy-uline.

    ENDIF.

    ENDFORM. " FOOTER

    &----


    *& Form GENERATION_BASIC

    &----


    text

    -


    --> p1 text

    <-- p2 text

    -


    FORM generation_basic .

    SELECT mkpf~mblnr "DOCUMENT NUMBER

    mkpf~mjahr "DOCUMENT YEAR

    mkpf~budat "POST DATE

    mkpf~blart "DOCUMENT TYPE

    INTO TABLE i_tab1

    FROM mkpf INNER JOIN mseg ON mkpfmjahr EQ msegmjahr AND

    mkpfmblnr EQ msegmblnr

    WHERE mkpf~mblnr IN s_mblnr

    AND mkpf~mjahr IN s_mjahr

    AND mseg~bwart IN s_bwart

    AND mseg~matnr IN s_matnr.

    IF sy-subrc NE 0.

    WRITE :/ 'MATERIAL DATA NOT FOUND'.

    ENDIF.

    DELETE ADJACENT DUPLICATES FROM i_tab1 COMPARING mblnr mjahr.

    ENDFORM. " GENERATION_BASIC

    &----


    *& Form REPORT_BASIC

    &----


    text

    -


    --> p1 text

    <-- p2 text

    -


    FORM report_basic .

    LOOP AT i_tab1.

    v_color = sy-tabix MOD 2.

    IF v_color EQ 0.

    FORMAT COLOR 1 INTENSIFIED OFF.

    ELSE.

    FORMAT COLOR 2 INTENSIFIED OFF.

    ENDIF.

    WRITE :/1 sy-vline ,

    3 i_tab1-mblnr ,

    23 sy-vline ,

    25 i_tab1-mjahr ,

    45 sy-vline ,

    47 i_tab1-budat ,

    67 sy-vline ,

    69 i_tab1-blart ,

    89 sy-vline .

    HIDE : i_tab1-mblnr , i_tab1-mjahr. "STORING THE VALUE OF FIELDS CLICKED IN SYSTEM AREA

    ENDLOOP.

    FORMAT RESET.

    WRITE :/1(89) sy-uline.

    ENDFORM. " REPORT_BASIC

    &----


    *& Form GENERATION_SECONDARY

    &----


    text

    -


    --> p1 text

    <-- p2 text

    -


    FORM generation_secondary .

    IF sy-lsind EQ 1.

    SET PF-STATUS 'DISPLAY'.

    GET CURSOR FIELD v_field VALUE v_value. "GET THE FIELD VALUE AND NAME WHERE THE CURSOR WAS CLICKED

    CASE v_field.

    WHEN 'I_TAB1-MBLNR'. "DISPLAYS SECONDARY LIST ONLY IF DOCUMENT NUMBER IS CLICKED

    SELECT mseg~mblnr "DOCUMENT NUMBER

    mseg~mjahr "DOCUMENT YEAR

    mseg~zeile "ITEM NUMBER

    mseg~bwart "MOVEMENT TYPE

    t156t~btext "MOVEMENT DESCRIPTION

    mseg~matnr "MATERIAL NUMBER

    makt~maktx "MATERIAL DESCRIPTION

    mseg~meins "UNIT OF MEASURE

    mseg~menge "QUANTITY

    mseg~dmbtr "AMOUNT

    INTO TABLE i_tab2

    FROM ( ( mseg INNER JOIN t156t

    ON msegbwart EQ t156tbwart )

    INNER JOIN makt

    ON msegmatnr EQ maktmatnr )

    WHERE mseg~mblnr EQ i_tab1-mblnr

    AND mseg~mjahr EQ i_tab1-mjahr

    AND t156t~spras EQ sy-langu

    AND makt~spras EQ sy-langu.

    DELETE ADJACENT DUPLICATES FROM i_tab2 COMPARING mblnr mjahr.

    WHEN OTHERS.

    MESSAGE 'SELECT DOCUMENT NUMBER' TYPE 'E'.

    ENDCASE.

    LOOP AT i_tab2.

    v_color = sy-tabix MOD 2.

    IF v_color EQ 0.

    FORMAT COLOR 1 INTENSIFIED OFF.

    ELSE.

    FORMAT COLOR 2 INTENSIFIED OFF.

    ENDIF.

    WRITE :/1 sy-vline ,

    3 i_tab2-mblnr ,

    12 sy-vline ,

    14 i_tab2-mjahr ,

    19 sy-vline ,

    21 i_tab2-zeile ,

    30 sy-vline ,

    32 i_tab2-bwart ,

    40 sy-vline ,

    42 i_tab2-btext ,

    72 sy-vline ,

    74 i_tab2-matnr ,

    94 sy-vline ,

    96 i_tab2-maktx ,

    146 sy-vline ,

    148 i_tab2-meins ,

    153 sy-vline ,

    155 i_tab2-menge ,

    170 sy-vline ,

    172 i_tab2-dmbtr ,

    192 sy-vline .

    ENDLOOP.

    WRITE :/1(192) sy-uline.

    FORMAT RESET.

    ELSEIF sy-lsind EQ 2.

    GET CURSOR FIELD v_field VALUE v_value. "GET THE FIELD VALUE AND NAME WHERE THE CURSOR WAS CLICKED

    CASE v_field.

    WHEN 'I_TAB2-MBLNR'. "DISPLAYS SECONDARY LIST ONLY IF DOCUMENT NUMBER IS CLICKED

    SET PARAMETER ID : "SETTING PARAMETER ID FOR DOCUMENT NUMBER AND YEAR.

    'MBN' FIELD i_tab2-mblnr ,

    'MJA' FIELD i_tab2-mjahr.

    CALL TRANSACTION 'MB03' AND SKIP FIRST SCREEN. "CALLING TRABSACTION CODE 'MBO3'.

    WHEN OTHERS.

    MESSAGE 'SELECT DOCUMENT NUMBER' TYPE 'E'.

    ENDCASE.

    ENDIF.

    ENDFORM. " GENERATION_SECONDARY

    &----


    *& Form HEADER_SECONDARY

    &----


    text

    -


    --> p1 text

    <-- p2 text

    -


    FORM header_secondary .

    WRITE :/50 'ITEMWISE MATERIAL DOCUMENTS' COLOR 1.

    WRITE :/1(192) sy-uline.

    FORMAT COLOR 1.

    WRITE :/1 sy-vline ,

    3 'DOCUMENT NO' ,

    12 sy-vline ,

    14 'YEAR' ,

    19 sy-vline ,

    21 'ITEM NO.' ,

    30 sy-vline ,

    32 'MOV TYP' ,

    40 sy-vline ,

    42 'MOV DESCRIPTION' ,

    72 sy-vline ,

    74 'MATERIAL NO' ,

    94 sy-vline ,

    96 'MATERIAL DESCRIPTION' ,

    146 sy-vline ,

    148 'UOM' ,

    153 sy-vline ,

    155 'QUANTITY' ,

    170 sy-vline ,

    172 'AMOUNT' ,

    192 sy-vline .

    WRITE :/1(192) sy-uline.

    FORMAT RESET.

    ENDFORM. " HEADER_SECONDARY

    &----


    *& Form USER_SECONDARY

    &----


    text

    -


    --> p1 text

    <-- p2 text

    -


    FORM user_secondary .

    IF sy-ucomm EQ 'DISPLAY'. "EXECUTES ONLY IF 'DISPLAY DOCUMENTS' ITEM IS CLICKED ON APPLICATION TOOL BAR.

    IF sy-lsind EQ 2.

    GET CURSOR FIELD v_field VALUE v_value. "GET THE FIELD VALUE AND NAME WHERE THE CURSOR WAS CLICKED

    CASE v_field.

    WHEN 'I_TAB2-MBLNR'. "DISPLAYS SECONDARY LIST ONLY IF DOCUMENT NUMBER IS CLICKED

    SET PARAMETER ID :

    'MBN' FIELD i_tab2-mblnr ,

    'MJA' FIELD i_tab2-mjahr.

    CALL TRANSACTION 'MB03' AND SKIP FIRST SCREEN.

    WHEN OTHERS.

    MESSAGE 'SELECT DOCUMENT NUMBER' TYPE 'E'.

    ENDCASE.

    ENDIF.

    LEAVE PROGRAM.

    ENDIF.

    ENDFORM. " USER_SECONDARY

    *&----


    **& Module USER_COMMAND_0100 INPUT

    *&----


    text

    *----


    *module USER_COMMAND_0100 input.

    *

    *if sy-ucomm eq 'SUBMIT'.

    *

    *submit zwk22671. " and return using selection-set 'MATERIAL VAR'.

    *

    *ENDIF.

    *

    *

    *

    *endmodule. " USER_COMMAND_0100 INPUT

    regards,

    venkat.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 20, 2008 at 11:46 AM

    Hi..the Order is

    initialization

    at selection-screen output

    at selection-screen

    start-of-selection

    top-of-page

    end-of-page

    end-of-selection

    at user-command

    and u run a prograg using these events and debugg it..then u wil know that these events are working in correct order or not.

    reward is helpful..

    thank u.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 20, 2008 at 11:31 AM

    Refer to this related thread

    order-of-events

    order-of-events

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 20, 2008 at 11:36 AM

    Hi,

    Initialization

    At selection-screen output

    at selection-screen

    At triggering of first write statement the top-of-page is triggered

    start-of-selection

    end-of-page will trigger at end of the page.

    if u double click on the list then at line-selection will trigger

    if u click any button the list then at user command will trigger

    I hope it helps u.

    Thanks and regards,

    Manjari

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.