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

'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

I'M having problem in this FM as when i run program it goes to dump and tells that it_header is not of type i_tabname_header

plz help ....reward assured

CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

I_CALLBACK_PROGRAM = V_PROGNAME

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

IS_LAYOUT = WA_LAYOUT

IT_FIELDCAT = IT_FIELDCAT

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

IT_EVENTS = IT_EVENTCAT

  • IT_EVENT_EXIT =

i_tabname_header = IT_HEADER

i_tabname_item = IT_ITEMS

  • I_STRUCTURE_NAME_HEADER =

  • I_STRUCTURE_NAME_ITEM =

is_keyinfo = WA_keyinfo

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

  • IR_SALV_HIERSEQ_ADAPTER =

  • IT_EXCEPT_QINFO =

  • I_SUPPRESS_EMPTY_DATA = ABAP_FALSE

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

tables

t_outtab_header = IT_HEADER

t_outtab_item = IT_ITEMS

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2008 at 07:14 AM

    Hi,

    how is your internal table defined?

    regards

    Nicole

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2008 at 07:14 AM

    Hi Sir ,

    Please have a look below .Hope it is suitable and simpler solution for your question.

    Please do reward if useful.

    Thankx.

    Just go through this demo program

    BALVHD01.

    Just copy and paste this piece of code also

    REPORT ZTESTS .

    type-pools:slis.

    tables: ekko,ekpo.

    data:begin of it_ekko occurs 0,

    ebeln like ekko-ebeln,

    bukrs like ekko-bukrs,

    lifnr like ekko-lifnr,

    bedat like ekko-bedat,

    end of it_ekko.

    data: begin of it_ekpo occurs 0,

    sno like ekpo-ebeln,

    ebelp like ekpo-ebelp,

    menge like ekpo-menge,

    netwr like ekpo-netwr,

    end of it_ekpo.

    data v_repid like sy-repid.

    data it_fieldcat type slis_fieldcat_alv occurs 0 with header line.

    data x_keyinfo type slis_keyinfo_alv.

    select-options:s_ebeln for ekko-ebeln.

    initialization.

    v_repid = sy-repid.

    s_ebeln-low = '1000'.

    s_ebeln-sign = 'I'.

    s_ebeln-option = 'EQ'.

    S_ebeln-high = '5000'.

    append s_ebeln.

    start-of-selection.

    perform get_data.

    perform get_field.

    perform get_key.

    perform key_modify.

    perform display.

    &----


    *& Form get_data

    &----


    text

    -


    --> p1 text

    <-- p2 text

    -


    form get_data.

    select ebeln

    bukrs

    lifnr

    bedat

    from ekko into table it_ekko." where ebeln in s_ebeln.

    select ebeln

    ebelp

    menge

    netwr from ekpo into table it_ekpo." where ebeln in s_ebeln.

    endform. " get_data

    &----


    *& Form get_field

    &----


    text

    -


    --> p1 text

    <-- p2 text

    -


    form get_field.

    call function 'REUSE_ALV_FIELDCATALOG_MERGE'

    exporting

    i_program_name = v_repid

    i_internal_tabname = 'IT_EKKO'

    I_STRUCTURE_NAME =

    I_CLIENT_NEVER_DISPLAY = 'X'

    i_inclname = v_repid

    I_BYPASSING_BUFFER =

    I_BUFFER_ACTIVE =

    changing

    ct_fieldcat = it_fieldcat[] .

    call function 'REUSE_ALV_FIELDCATALOG_MERGE'

    exporting

    i_program_name = v_repid

    i_internal_tabname = 'IT_EKPO'

    I_STRUCTURE_NAME =

    I_CLIENT_NEVER_DISPLAY = 'X'

    i_inclname = v_repid

    I_BYPASSING_BUFFER =

    I_BUFFER_ACTIVE =

    changing

    ct_fieldcat = it_fieldcat[]

    EXCEPTIONS

    INCONSISTENT_INTERFACE = 1

    PROGRAM_ERROR = 2

    OTHERS = 3

    .

    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. " get_field

    &----


    *& Form get_key

    &----


    text

    -


    --> p1 text

    <-- p2 text

    -


    form get_key.

    x_keyinfo-header01 = 'EBELN'.

    x_keyinfo-item01 = 'SNO'.

    endform. " get_key

    &----


    *& Form DISPLAY

    &----


    text

    -


    --> p1 text

    <-- p2 text

    -


    form display.

    *loop at it_ekko where ebeln eq '4500005016'.

    write it_ekko-ebeln.

    endloop.

    *

    *loop at it_ekpo where sno eq '4500005016'.

    write it_ekpo-sno.

    endloop.

    *

    **

    *loop at it_fieldcat where key eq space .

    write : / it_fieldcat-fieldname,it_fieldcat-key.

    *endloop.

    *

    *loop at it_ekko.

    loop at it_ekpo where sno eq it_ekko-ebeln.

    write : / it_ekpo-menge,it_ekpo-ebelp.

    endloop.

    endloop.

    *

    *

    *

    call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

    exporting

    I_INTERFACE_CHECK = ' '

    i_callback_program = v_repid

    I_CALLBACK_PF_STATUS_SET = ' '

    I_CALLBACK_USER_COMMAND = ' '

    IS_LAYOUT =

    it_fieldcat = it_fieldcat[]

    IT_EXCLUDING =

    IT_SPECIAL_GROUPS =

    IT_SORT =

    IT_FILTER =

    IS_SEL_HIDE =

    I_SCREEN_START_COLUMN = 0

    I_SCREEN_START_LINE = 0

    I_SCREEN_END_COLUMN = 0

    I_SCREEN_END_LINE = 0

    I_DEFAULT = 'X'

    I_SAVE = ' '

    IS_VARIANT =

    IT_EVENTS =

    IT_EVENT_EXIT =

    i_tabname_header = 'IT_EKKO'

    i_tabname_item = 'IT_EKPO'

    I_STRUCTURE_NAME_HEADER =

    I_STRUCTURE_NAME_ITEM =

    is_keyinfo = x_keyinfo

    IS_PRINT =

    IS_REPREP_ID =

    I_BUFFER_ACTIVE =

    I_BYPASSING_BUFFER =

    IMPORTING

    E_EXIT_CAUSED_BY_CALLER =

    ES_EXIT_CAUSED_BY_USER =

    tables

    t_outtab_header = it_ekko

    t_outtab_item = it_ekpo

    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

    &----


    *& Form key_modify

    &----


    text

    -


    --> p1 text

    <-- p2 text

    -


    form key_modify.

    loop at it_fieldcat. "Avoid Repitiotion of data.

    case it_fieldcat-fieldname.

    when 'SNO'.

    if it_fieldcat-tabname = 'IT_EKPO'.

    it_fieldcat-no_out = 'X'.

    it_fieldcat-key = space.

    endif.

    endcase.

    modify it_fieldcat index sy-tabix.

    endloop.

    endform. " key_modify

    OR

    See the code below.

    REPORT z_alv_hierseq_list.

    -


    SELECTION-SCREEN :

    SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max. "#EC NEEDED

    PARAMETERS p_max(02) TYPE n DEFAULT '10' OBLIGATORY.

    SELECTION-SCREEN END OF LINE.

    -


    CONSTANTS :

    c_x VALUE 'X'.

    -


    TYPES :

    1st Table

    BEGIN OF ty_vbak,

    vbeln TYPE vbak-vbeln, " Sales document

    kunnr TYPE vbak-kunnr, " Sold-to party

    netwr TYPE vbak-netwr, " Net Value of the Sales Order

    waerk TYPE vbak-waerk, " SD document currency

    END OF ty_vbak,

    2nd Table

    BEGIN OF ty_vbap,

    vbeln TYPE vbap-vbeln, " Sales document

    posnr TYPE vbap-posnr, " Sales document

    matnr TYPE vbap-matnr, " Material number

    netwr TYPE vbap-netwr, " Net Value of the Sales Order

    waerk TYPE vbap-waerk, " SD document currency

    END OF ty_vbap.

    -


    DATA :

    1st Table

    gt_vbak TYPE TABLE OF ty_vbak,

    2nd Table

    gt_vbap TYPE TABLE OF ty_vbap.

    -


    INITIALIZATION.

    v_1 = 'Maximum of records to read'.

    -


    START-OF-SELECTION.

    Read Sales Document: Header Data

    SELECT vbeln kunnr netwr waerk

    FROM vbak

    UP TO p_max ROWS

    INTO CORRESPONDING FIELDS OF TABLE gt_vbak.

    IF NOT gt_vbak[] IS INITIAL.

    Read Sales Document: Item Data

    SELECT vbeln posnr matnr netwr waerk

    FROM vbap

    INTO CORRESPONDING FIELDS OF TABLE gt_vbap

    FOR ALL ENTRIES IN gt_vbak

    WHERE vbeln = gt_vbak-vbeln.

    ENDIF.

    PERFORM f_display.

    -


    Form F_DISPLAY

    -


    FORM f_display.

    TYPE-POOLS: slis. " ALV Global types

    Macro definition

    DEFINE m_fieldcat.

    ls_fieldcat-tabname = &1.

    ls_fieldcat-fieldname = &2.

    ls_fieldcat-ref_tabname = &3.

    append ls_fieldcat to lt_fieldcat.

    END-OF-DEFINITION.

    DEFINE m_sort.

    ls_sort-tabname = &1.

    ls_sort-fieldname = &2.

    ls_sort-up = c_x.

    append ls_sort to lt_sort.

    END-OF-DEFINITION.

    DATA:

    ls_layout TYPE slis_layout_alv,

    ls_keyinfo TYPE slis_keyinfo_alv,

    ls_sort TYPE slis_sortinfo_alv,

    lt_sort TYPE slis_t_sortinfo_alv," Sort table

    ls_fieldcat TYPE slis_fieldcat_alv,

    lt_fieldcat TYPE slis_t_fieldcat_alv." Field catalog

    ls_layout-group_change_edit = c_x.

    ls_layout-colwidth_optimize = c_x.

    ls_layout-zebra = c_x.

    ls_layout-detail_popup = c_x.

    ls_layout-get_selinfos = c_x.

    Build field catalog and sort table

    m_fieldcat 'GT_VBAK' 'VBELN' 'VBAK'.

    m_fieldcat 'GT_VBAK' 'KUNNR' 'VBAK'.

    m_fieldcat 'GT_VBAK' 'NETWR' 'VBAK'.

    m_fieldcat 'GT_VBAK' 'ERDAT' 'VBAK'.

    m_fieldcat 'GT_VBAK' 'WAERK' 'VBAK'.

    m_fieldcat 'GT_VBAP' 'POSNR' 'VBAP'.

    m_fieldcat 'GT_VBAP' 'MATNR' 'VBAP'.

    m_fieldcat 'GT_VBAP' 'NETWR' 'VBAP'.

    m_fieldcat 'GT_VBAP' 'WAERK' 'VBAP'.

    m_sort 'GT_VBAK' 'KUNNR'.

    m_sort 'GT_VBAP' 'NETWR'.

    ls_keyinfo-header01 = 'VBELN'.

    ls_keyinfo-item01 = 'VBELN'.

    CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

    EXPORTING

    i_callback_program = sy-cprog

    i_callback_user_command = 'USER_COMMAND'

    is_layout = ls_layout

    it_fieldcat = lt_fieldcat

    it_sort = lt_sort

    i_tabname_header = 'GT_VBAK'

    i_tabname_item = 'GT_VBAP'

    is_keyinfo = ls_keyinfo

    TABLES

    t_outtab_header = gt_vbak

    t_outtab_item = gt_vbap

    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. " F_LIST_DISPLAY

    -


    FORM USER_COMMAND *

    -


    FORM user_command USING i_ucomm TYPE sy-ucomm

    is_selfield TYPE slis_selfield. "#EC CALLED

    DATA ls_vbak TYPE ty_vbak.

    CASE i_ucomm.

    WHEN '&IC1'. " Pick

    CASE is_selfield-tabname.

    WHEN 'GT_VBAP'.

    WHEN 'GT_VBAK'.

    READ TABLE gt_vbak INDEX is_selfield-tabindex INTO ls_vbak.

    IF sy-subrc EQ 0.

    Sales order number

    SET PARAMETER ID 'AUN' FIELD ls_vbak-vbeln.

    Display Sales Order

    CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.

    ENDIF.

    ENDCASE.

    ENDCASE.

    ENDFORM. " USER_COMMAND

    rEWARD IF USEFULL

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2008 at 07:18 AM

    RESOLVED

    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.