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

ALV report

Hi all,

I'm learning ALV report generation. I tried executing the program http://www.sap-img.com/abap/sample-alv-heading-in-alv.htm. But I ended up with the run time error saying it_event is not defined. here it event is a parameter to 'REUSE_ALV_GRID_DISPLAY'. May I know the reason for it?

Thanks in advance

regards,

Ananda

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

10 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 21, 2006 at 06:52 AM

    Hi Ananda,

    just check the export parameters.

    call function 'REUSE_ALV_GRID_DISPLAY'

    exporting

    i_callback_program = gd_repid

    is_layout = gd_layout

    i_callback_top_of_page = 'TOP-OF-PAGE'

    i_callback_user_command = 'USER_COMMAND'

    i_callback_pf_status_set = 'SET_PF_STATUS'

    <b>it_event<i><u>s</u></i></b> = gt_events

    is_print = gd_prntparams

    it_fieldcat = fieldcatalog[]

    it_sort = it_sortcat

    i_save = 'X'

    tables

    t_outtab = it_ekko

    exceptions

    program_error = 1

    others = 2.

    change it_event to it_events.

    there is not import parameter for FM as it_event

    but there is one as it_events

    Hope it helps.

    Regards,

    kinshuk

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 21, 2006 at 06:49 AM

    Hi ,

    form z_alv_events.
      call function 'REUSE_ALV_EVENTS_GET'
        exporting
          i_list_type = 0
        importing
          et_events   = fevents[].
    
      read table fevents with key name = 'TOP_OF_PAGE'.
    
      if sy-subrc = 0.
        fevents-form = 'Z_TOPOFPAGE'.
    *    fevents-form = 'Z_LIST'.
        modify fevents index sy-tabix.
        clear fevents.
      endif.                              " IF SY-SUBRC = 0.
    
    * Drill down
      read table fevents with key name = 'USER_COMMAND'.
      if sy-subrc = 0.
        fevents-form = 'Z_USER_COMMAND'.
        modify fevents index sy-tabix.
        clear fevents.
      endif.
    
    endform.                    "Z_ALV_EVENTS
    
    

    u have to call perform stmt for Events

    Regards

    Prabhu

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 21, 2006 at 07:00 AM

    Hi,

    Below is the declaration of ALV. Hope this might give you an idea.

    Regards!

    REPORT zdp_print NO STANDARD PAGE HEADING

    LINE-SIZE 0

    LINE-COUNT 0

    MESSAGE-ID zweb.

    TYPE-POOLS: slis.

    ----


    • Tables

    ----


    TABLES: kna1, vbpa, t001, zsoemailid, vbap.

    ----


    • Internal tables and data declarations

    ----


    *AVH - start of modification - 05/15/06

    **removed vgbel, kzwil, netwr, mwsbp

    DATA: BEGIN OF order_details OCCURS 0,

    vbeln LIKE vbap-vbeln,

    posnr LIKE vbap-posnr,

    matnr LIKE vbap-matnr,

    arktx LIKE vbap-arktx,

    zieme LIKE vbap-zieme,

    kwmeng TYPE p DECIMALS 0, "LIKE vbap-kwmeng,

    ls_lines2 LIKE tline-tdline,

    ls_lines3 LIKE tline-tdline,

    ls_lines4 LIKE tline-tdline,

    END OF order_details.

    DATA : discount LIKE vbap-kzwi1.

    *AVH - end of modification

    *AVH - start of insertion - 04/27/06

    *DATA : BEGIN OF it_vbpa OCCURS 0,

    • kunnr LIKE vbpa-kunnr,

    • END OF it_vbpa.

    *DATA: BEGIN OF it_vbak OCCURS 0.

    • INCLUDE STRUCTURE vbak.

    *DATA: END OF it_vbak.

    DATA: BEGIN OF it_vbak OCCURS 0,

    vbeln LIKE vbak-vbeln,

    kunnr LIKE vbak-kunnr,

    auart LIKE vbak-auart,

    erdat LIKE vbak-erdat,

    vkorg LIKE vbak-vkorg,

    xblnr LIKE vbak-xblnr,

    END OF it_vbak.

    *DATA: BEGIN OF it_t001 OCCURS 0,

    • butxt LIKE t001-butxt,

    • END OF it_t001.

    *DATA : BEGIN OF it_vbkd OCCURS 0,

    • zterm LIKE vbkd-zterm,

    • INCLUDE STRUCTURE vbkd.

    • END OF it_vbkd.

    *DATA : BEGIN OF it_t052u OCCURS 0,

    • text1 LIKE t052u-text1,

    • INCLUDE STRUCTURE t052u.

    • END OF it_t052u.

    *AVH - end of insertion

    DATA : ls_thead LIKE thead.

    *DATA: gross_total LIKE vbap-kzwi1,

    • discount_total LIKE vbap-kzwi1,

    • net_total LIKE vbap-kzwi1,

    • old_matnr LIKE vbap-matnr,

    • gross_total_grand LIKE vbap-kzwi1,

    • discount_total_grand LIKE vbap-kzwi1,

    • net_total_grand LIKE vbap-kzwi1,

    • price LIKE vbap-kzwi1.

    DATA : lt_lines TYPE TABLE OF tline WITH HEADER LINE.

    *DATA : wa_line LIKE tline.

    *DATA : lv_net_price LIKE vbap-netwr.

    *DATA : lv_gross LIKE vbap-kzwi1.

    *DATA : lv_gross_dis LIKE vbap-kzwi1.

    • kunnr LIKE kna1-kunnr,

    DATA: zname1 LIKE kna1-name1,

    ztelf1 LIKE kna1-telf1,

    zstras LIKE kna1-stras.

    RANGES: r_auart FOR vbak-auart.

    *DATA: v_matkl LIKE mara-matkl,

    • v_display(50) TYPE c.

    DATA: v_check TYPE n.

    **-added by weng 04282005

    *DATA: v_payterms(100) TYPE c.

    *

    *DATA: v_color TYPE i VALUE '1'.

    *AVH - start of insertion - 04/18/06

    **ALV Declarations

    DATA: gt_fieldcat TYPE slis_t_fieldcat_alv,

    g_repid LIKE sy-repid,

    gs_layout TYPE slis_layout_alv,

    gt_list_top_of_page TYPE slis_t_listheader,

    gt_events TYPE slis_t_event WITH HEADER LINE,

    gt_print TYPE slis_print_alv,

    gt_sort TYPE slis_t_sortinfo_alv.

    CONSTANTS: gc_top TYPE slis_formname VALUE 'TOP_OF_PAGE',

    gc_topsum TYPE slis_formname VALUE 'TOP_OF_LIST',

    gc_ucomm TYPE slis_formname VALUE 'USER_COMMAND'.

    *AVH - end of insertion

    ----


    • Selection screen

    ----


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

    SELECTION-SCREEN BEGIN OF LINE.

    SELECTION-SCREEN COMMENT 1(28) text-002 FOR FIELD p_dcode.

    SELECTION-SCREEN POSITION POS_LOW.

    PARAMETER: p_dcode LIKE zsoemailid-kunnr MODIF ID id1.

    PARAMETER: p_name1 LIKE kna1-name1 MODIF ID id1.

    SELECTION-SCREEN END OF LINE.

    SELECT-OPTIONS: s_sorder FOR vbap-vbeln MODIF ID id2,

    so_date FOR vbap-erdat MODIF ID id2.

    SELECTION-SCREEN END OF BLOCK b1.

    ----


    • At selection screen output

    ----


    AT SELECTION-SCREEN OUTPUT.

    LOOP AT SCREEN.

    IF screen-group1 = 'ID1'.

    screen-input = '0'.

    screen-output = '1'.

    MODIFY SCREEN.

    ENDIF.

    ENDLOOP.

    SELECT SINGLE name1 FROM kna1

    INTO p_name1

    WHERE kunnr = p_dcode.

    ----


    • Initialization

    ----


    INITIALIZATION.

    • PERFORM authority_check.

    g_repid = sy-repid.

    r_auart-sign = 'I'.

    r_auart-option = 'EQ'.

    r_auart-low = 'ZCF'.

    APPEND r_auart.

    CLEAR r_auart.

    r_auart-sign = 'I'.

    r_auart-option = 'EQ'.

    r_auart-low = 'ZCC'.

    APPEND r_auart.

    CLEAR r_auart.

    *This is to check if current user is stored in ztable.

    *if not found, user will not be authorized to use this program

    SELECT SINGLE kunnr FROM zsoemailid INTO zsoemailid-kunnr

    WHERE bname EQ sy-uname.

    p_dcode = zsoemailid-kunnr.

    IF sy-subrc <> 0.

    MESSAGE i000 WITH

    'You are not authorized to use this transaction!'.

    LEAVE PROGRAM.

    ENDIF.

    ----


    • Start of selection

    ----


    START-OF-SELECTION.

    *Get sales order header details

    SELECT vbeln kunnr auart erdat vkorg

    FROM vbak INTO TABLE it_vbak

    WHERE auart IN r_auart

    AND vbeln IN s_sorder

    AND erdat IN so_date

    AND kunnr EQ p_dcode.

    IF sy-subrc <> 0.

    MESSAGE i000 WITH

    'No order found based from selection criteria'.

    LEAVE PROGRAM.

    ELSEIF sy-subrc = 0.

    *Get sales order item details

    SELECT vbeln posnr matnr arktx zieme kwmeng

    INTO TABLE order_details

    FROM vbap

    FOR ALL ENTRIES IN it_vbak

    WHERE vbeln = it_vbak-vbeln.

    ENDIF.

    ----


    • End of selection

    ----


    END-OF-SELECTION.

    CHECK v_check = 0.

    IF order_details[] IS INITIAL.

    MESSAGE i000 WITH 'No Data found for selection criteria'.

    v_check = 1.

    ENDIF.

    CHECK v_check = 0.

    SELECT SINGLE name1 telf1 stras

    INTO (zname1,ztelf1,zstras)

    FROM kna1 WHERE kunnr = p_dcode.

    CLEAR kna1.

    CONCATENATE order_details-vbeln order_details-posnr

    INTO ls_thead-tdname.

    *Function to read text related to item.

    REFRESH : lt_lines.

    CALL FUNCTION 'READ_TEXT'

    EXPORTING

    id = '0002'

    language = sy-langu

    name = ls_thead-tdname

    object = 'VBBP'

    TABLES

    lines = lt_lines

    EXCEPTIONS

    id = 1

    language = 2

    name = 3

    not_found = 4.

    *AVH - Start of insertion - 05/02/06

    **The original code dumps both tdline and tdformat thus

    *generating an '' in the report output. Only tdline is needed.

    IF sy-subrc = 0.

    READ TABLE lt_lines INDEX 2 TRANSPORTING tdline.

    IF sy-subrc = 0.

    order_details-ls_lines2 = lt_lines-tdline.

    ENDIF.

    READ TABLE lt_lines INDEX 3 TRANSPORTING tdline.

    IF sy-subrc = 0.

    order_details-ls_lines3 = lt_lines-tdline.

    ENDIF.

    READ TABLE lt_lines INDEX 4 TRANSPORTING tdline.

    IF sy-subrc = 0.

    order_details-ls_lines4 = lt_lines-tdline.

    ENDIF.

    ELSE.

    SELECT SINGLE kunnr INTO vbpa-kunnr FROM vbpa

    WHERE vbeln = order_details-vbeln AND

    posnr = order_details-posnr AND

    parvw = 'WE'.

    IF sy-subrc = 0.

    • READ TABLE it_vbpa INDEX 1.

    SELECT SINGLE name1 telf1 stras

    INTO (kna1-name1,kna1-telf1,kna1-stras)

    FROM kna1

    WHERE kunnr = vbpa-kunnr.

    MOVE: kna1-stras TO order_details-ls_lines2,

    kna1-name1 TO order_details-ls_lines3,

    kna1-telf1 TO order_details-ls_lines4.

    ELSE.

    MOVE: zstras TO order_details-ls_lines2,

    zname1 TO order_details-ls_lines3,

    ztelf1 TO order_details-ls_lines4.

    ENDIF.

    ENDIF.

    • FORMAT COLOR OFF.

    MODIFY order_details.

    ENDLOOP.

    ----


    • Display ALV

    ----


    PERFORM display_alv.

    &----


    *& Form AUTHORITY_CHECK

    &----


    FORM authority_check.

    CALL FUNCTION 'AUTHORITY_CHECK'

    EXPORTING

    field1 = 'TCD' "MDM

    object = 'S_TCODE'

    user = sy-uname

    value1 = 'ZMEN'

    EXCEPTIONS

    user_dont_exist = 1

    user_is_authorized = 2

    user_not_authorized = 3

    user_is_locked = 4

    OTHERS = 5.

    CASE sy-subrc.

    WHEN 1 OR 3 OR 4 OR 5.

    MESSAGE i000 WITH

    'You are not authorised to use this transaction'.

    LEAVE PROGRAM.

    ENDCASE.

    ENDFORM. " AUTHORITY_CHECK

    ----


    • FORM display_alv *

    ----


    • ........ *

    ----


    FORM display_alv.

    SORT order_details BY vbeln posnr.

    PERFORM f_build_layout USING gs_layout.

    PERFORM f_init_fieldcat USING gt_fieldcat[].

    PERFORM f_init_events USING 'TOP' gt_events[].

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    i_callback_program = g_repid

    i_callback_top_of_page = 'TOP_OF_PAGE'

    i_callback_user_command = 'USER_COMMAND'

    is_layout = gs_layout

    it_fieldcat = gt_fieldcat[]

    it_events = gt_events[]

    i_save = 'X'

    TABLES

    t_outtab = order_details

    EXCEPTIONS

    program_error = 1

    OTHERS = 2.

    IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

    ENDFORM. " DISPLAY_ALV

    ----


    • FORM top_of_page *

    ----


    • ........ *

    ----


    • --> %TOP_OF_PAGE *

    ----


    FORM top_of_page.

    *ALV Header declarations

    DATA: t_header TYPE slis_t_listheader,

    wa_header TYPE slis_listheader,

    t_line LIKE wa_header-info,

    lv_title(60),

    lv_user(60),

    lv_date(10),

    lv_time(10),

    lv_time_n_date(30),

    lv_dlr_n_desc(100),

    ld_lines TYPE i,

    ld_linesc(10) TYPE c.

    • Title

    CLEAR: lv_title, wa_header.

    MOVE sy-title TO lv_title.

    wa_header-typ = 'H'.

    wa_header-info = lv_title.

    APPEND wa_header TO t_header.

    CLEAR wa_header.

    • User

    CLEAR: lv_user, wa_header.

    CONCATENATE: 'Generated by:' sy-uname

    INTO lv_user SEPARATED BY space.

    wa_header-typ = 'A'.

    wa_header-info = lv_user.

    APPEND wa_header TO t_header.

    CLEAR wa_header.

    *Date and time

    CLEAR: lv_date, lv_time.

    WRITE: sy-datum TO lv_date MM/DD/YYYY,

    sy-uzeit TO lv_time USING EDIT MASK '__:__:__'.

    CONCATENATE: 'Generated on:' lv_date lv_time

    INTO lv_time_n_date SEPARATED BY space.

    wa_header-typ = 'A'.

    wa_header-info = lv_time_n_date.

    APPEND wa_header TO t_header.

    CLEAR wa_header.

    *Dealer code and description

    CONCATENATE: 'Dealer:' p_dcode p_name1

    INTO lv_dlr_n_desc SEPARATED BY space.

    wa_header-typ = 'A'.

    wa_header-info = lv_dlr_n_desc.

    APPEND wa_header TO t_header.

    CLEAR wa_header.

    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    EXPORTING

    it_list_commentary = t_header.

    ENDFORM. " TOP_OF_PAGE

    ----


    • FORM f_build_layout *

    ----


    • ........ *

    ----


    • --> %LAYOUT *

    ----


    FORM f_build_layout USING %layout TYPE slis_layout_alv.

    %layout-zebra = 'X'.

    %layout-colwidth_optimize = 'X'.

    ENDFORM. " F_BUILD_LAYOUT

    ----


    • FORM f_init_fieldcat *

    ----


    • ........ *

    ----


    • --> %FIELDCAT *

    ----


    FORM f_init_fieldcat USING %fieldcat TYPE slis_t_fieldcat_alv.

    DATA: lc_fieldcat TYPE slis_fieldcat_alv.

    CLEAR lc_fieldcat.

    DEFINE m_field.

    add 1 to lc_fieldcat-col_pos.

    lc_fieldcat-fieldname = &1.

    lc_fieldcat-outputlen = &2.

    lc_fieldcat-seltext_l = &3.

    lc_fieldcat-do_sum = &4.

    lc_fieldcat-inttype = &5.

    lc_fieldcat-hotspot = &6.

    lc_fieldcat-fix_column = &7.

    lc_fieldcat-just = &8.

    lc_fieldcat-decimals_out = '0'.

    lc_fieldcat-ddictxt = 'L'.

    lc_fieldcat-no_zero = 'X'.

    append lc_fieldcat to %fieldcat.

    END-OF-DEFINITION.

    m_field 'VBELN' '10' 'Ref Doc' '' '' 'X' '' ''.

    m_field 'POSNR' '06' 'Item' '' '' '' '' ''.

    m_field 'MATNR' '18' 'Material' '' '' '' '' ''.

    m_field 'ARKTX' '40' 'Description' '' '' '' '' ''.

    m_field 'KWMENG' '15' 'Quantity' '' '' '' '' 'R'.

    m_field 'ZIEME' '3' 'UM' '' '' '' '' ''.

    m_field 'LS_LINES2' '132' 'Ship-To' '' '' '' '' ''.

    m_field 'LS_LINES3' '132' 'Contact Person' '' '' '' '' ''.

    m_field 'LS_LINES4' '132' 'Contact Number' '' '' '' '' ''.

    ENDFORM. " f_init_fieldcat

    ----


    • FORM f_init_events *

    ----


    • ........ *

    ----


    • --> P_TYPE *

    • --> %EVENTS *

    ----


    FORM f_init_events USING p_type CHANGING %events TYPE slis_t_event.

    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

    EXPORTING

    i_list_type = 0

    IMPORTING

    et_events = %events

    EXCEPTIONS

    list_type_wrong = 1

    OTHERS = 2.

    IF sy-subrc = 0.

    PERFORM f_build_events USING: slis_ev_user_command.

    IF p_type = 'TOP'.

    PERFORM f_build_events USING: gc_top.

    • ELSEIF p_type = 'SUM'.

    • PERFORM f_build_events_sum USING: gc_topsum.

    ENDIF.

    ELSE.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

    ENDFORM. " F_INIT_EVENTS

    ----


    • FORM f_build_events *

    ----


    • ........ *

    ----


    • --> %EVENT *

    ----


    FORM f_build_events USING %event.

    READ TABLE gt_events WITH KEY name = %event.

    IF sy-subrc = 0.

    MOVE: %event TO gt_events-form.

    • MOVE 'USER_COMMAND' TO gt_events-form.

    MODIFY gt_events INDEX sy-tabix.

    ENDIF.

    ENDFORM. " F_BUILD_EVENTS

    ----


    • FORM top_of_page *

    ----


    • ........ *

    ----


    *AVH - start of modification - 05/17/06

    **use this header if ALV_LIST_DISPLAY will be used

    FORM top-of-page.

    • CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

    • EXPORTING

    • it_list_commentary = gt_list_top_of_page.

    WRITE: sy-title,

    / 'Generated by:', sy-uname,

    / 'Generated on:', sy-datum MM/DD/YYYY, sy-uzeit USING

    EDIT MASK '__:__:__'.

    SKIP 1.

    WRITE: / 'Dealer', AT 13 ':' , p_dcode, p_name1.

    ENDFORM.

    ----


    • FORM user_command *

    ----


    • ........ *

    ----


    • --> P_UCOMM *

    • --> P_SELFIELD *

    ----


    FORM user_command USING p_ucomm LIKE sy-ucomm

    p_selfield TYPE slis_selfield.

    • DATA: lv_length TYPE i.

    • CASE p_ucomm.

    • WHEN '&IC1'. " SAP standard code for double-clicking

    • IF NOT p_selfield-value IS INITIAL.

    • lv_length = strlen( p_selfield-value ).

    • IF lv_length = 6.

    • SET PARAMETER ID 'AUN' FIELD p_selfield-value.

    • CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.

    • ENDIF.

    • ENDIF.

    • ENDCASE.

    CASE p_ucomm.

    WHEN '&IC1'.

    IF p_selfield-fieldname = 'VBELN'.

    SET PARAMETER ID 'AUN' FIELD p_selfield-value.

    CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.

    ENDIF.

    ENDCASE.

    ENDFORM. " user_command

    ----


    • FORM f_init_sort *

    ----


    • ........ *

    ----


    • --> %SORT *

    ----


    FORM f_init_sort USING %sort TYPE slis_t_sortinfo_alv.

    DATA: gs_sort TYPE slis_sortinfo_alv.

    CLEAR gs_sort.

    gs_sort-fieldname = 'VBELN'.

    gs_sort-up = 'X'.

    gs_sort-spos = 1.

    APPEND gs_sort TO %sort.

    CLEAR gs_sort.

    gs_sort-fieldname = 'POSNR'.

    gs_sort-up = 'X'.

    gs_sort-spos = 2.

    APPEND gs_sort TO %sort.

    ENDFORM. " F_INIT_SORT

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 21, 2006 at 07:04 AM

    Hi Ananda,

    i have copy the Abap-Code and tried it. I have no

    Problems. What changes do you do. Do you have

    create the pf_status?

    Which Release do you have.

    Regards, Dieter

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 21, 2006 at 06:49 AM

    Hi,

    <b>Have a look at the following link. You will find everything related to ALV here. Reward points if it helps.</b>

    http://sapfans.com/forums/viewtopic.php?t=94198&sid=faa1b3ecd13879a721df1236e7dbc182

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 21, 2006 at 06:51 AM

    se38--> BCALV* will list u all the alv relevant alv reports...

    The function module outputs an internal table with whatever structure in the form of a formatted single- oder multi-line list..

    the user action needs to be captured using events.

    reward points if it helps

    regards

    Gunjan

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 21, 2006 at 07:04 AM

    Hai Ananda

    Go through the following Code

    for 'REUSE_ALV_GRID_DISPLAY'.

    REPORT ZALV_GRID_SAMP .

    TABLES: MARA.

    TYPE-POOLS : SLIS.

    *----


    • Data declaration

    *----


    DATA: BEGIN OF I_MARA OCCURS 0.

    INCLUDE STRUCTURE MARA.

    DATA: END OF I_MARA.

    DATA: V_REPID LIKE SY-REPID.

    *----


    • selection-screen

    *----


    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.

    SELECT-OPTIONS : S_MATNR FOR MARA-MATNR.

    PARAMETERS: P_MTART LIKE MARA-MTART DEFAULT 'ROH'.

    SELECTION-SCREEN END OF BLOCK B1.

    *----


    • initialisation

    *----


    INITIALIZATION.

    S_MATNR-LOW = '1400'.

    S_MATNR-HIGH = '1500'.

    APPEND S_MATNR.

    V_REPID = SY-REPID.

    *----


    • start-of-selection

    *----


    START-OF-SELECTION.

    SELECT * FROM MARA

    INTO TABLE I_MARA

    WHERE MATNR IN S_MATNR AND

    MTART = P_MTART.

    CHECK SY-SUBRC = 0.

    *----


    • end of selection

    *----


    END-OF-SELECTION.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    I_STRUCTURE_NAME = 'MARA'

    TABLES

    T_OUTTAB = I_MARA.

    Thanks & regards

    Sreeni

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 21, 2006 at 07:05 AM

    in the form <b>build_events</b>, they mistakenly written APPEND instead of MODIFY.

    so replace it.

    read table gt_events with key name = slis_ev_end_of_page

    into ls_event.

    if sy-subrc = 0.

    move 'END_OF_PAGE' to ls_event-form.

    <b>WRONG--> append ls_event to gt_events.</b>

    <b>RIGHT-> MODIFY LS_EVENT FROM LS_EVENT WHERE NAME =

    slis_ev_end_of_page</b>

    endif.

    read table gt_events with key name = slis_ev_end_of_list

    into ls_event.

    if sy-subrc = 0.

    move 'END_OF_LIST' to ls_event-form.

    <b>*--SAME HEREALSO append ls_event to gt_events.</b> endif.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 21, 2006 at 07:19 AM

    HI,

    it seems to be the order is changed .

    i too got the same DUMP stating IT_EVENTS is not defined etc..

    but when i called again this REUSE_ALV_GRID_DISPLAY & populated the parameters, now i am getting the output.

    the problem i observed here is the sequence of fields.

    in the given program its randomly defined.but i used the order in which the function module have.

    check this & let us know.

    replace your function module call with this code below.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    I_CALLBACK_PROGRAM = gd_repid

    I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'

    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

    IS_LAYOUT = GD_LAYOUT

    IT_FIELDCAT = fieldcatalog[]

    IT_SORT = it_sortcat

    I_SAVE = 'X'

    IT_EVENTS = gt_events

    IS_PRINT = gd_prntparams

    TABLES

    t_outtab = it_ekko

    EXCEPTIONS

    PROGRAM_ERROR = 1

    OTHERS = 2

    .

    and one more Mistake i observed in that code is in the EVENTS population, instead of modify the GT_EVENTS Table with the FORM names they are appending records again .

    so instead of 17 events you will see 19 here,which is not needed. i given the explanation for this in the earlier post.

    regards

    srikanth

    Message was edited by: Srikanth Kidambi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 21, 2006 at 07:22 AM

    Hi,

    I have docs with complete details.

    It helps to learn ALV in better way.

    Mail @

    manoj.baijnath@wipro.com

    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.