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

Hierarchical sequential List

Hi friends,

Can anybody tell me how to display a hierarchical Sequential List in the form of a Grid.

I know we have the function module REUSE_ALV_HERISEQ_LIST_DISPLAY

but this will display as a LIST and I want it as a GRID.

Thanks in advance.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Mar 29, 2009 at 06:42 AM

    Hi,

    Refer to this Demo program BCALV_TREE_01

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 30, 2009 at 06:45 AM

    THIS CODE IS MORE THEN 5000 CHAR SO I GIVE THIS CODE IN TWO PART

    PART-1

    REPORT ZHIERSEQ_ALV.

    TYPE-POOLS: slis. " ALV Global types

    CONSTANTS :

    c_x VALUE 'X',

    c_gt_vbap TYPE slis_tabname VALUE 'GT_VBAP',

    c_gt_vbak TYPE slis_tabname VALUE 'GT_VBAK'.

    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.

    SELECTION-SCREEN :

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

    PARAMETERS p_expand AS CHECKBOX DEFAULT c_x.

    SELECTION-SCREEN END OF LINE.

    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

    erdat TYPE vbak-erdat, " Creation date

    waerk TYPE vbak-waerk, " SD document currency

    expand TYPE xfeld,

    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

    arktx TYPE vbap-arktx, " Material description

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

    v_2 = 'With ''EXPAND'' field'.

    START-OF-SELECTION.

    • Read Sales Document: Header Data

    SELECT vbeln kunnr netwr waerk erdat

    FROM vbak

    UP TO p_max ROWS

    INTO CORRESPONDING FIELDS OF TABLE gt_vbak.

    IF gt_vbak[] IS NOT INITIAL.

    • Read Sales Document: Item Data

    SELECT vbeln posnr matnr arktx netwr waerk

    FROM vbap

    INTO CORRESPONDING FIELDS OF TABLE gt_vbap

    FOR ALL ENTRIES IN gt_vbak

    WHERE vbeln = gt_vbak-vbeln.

    ENDIF.

    END-OF-SELECTION.

    PERFORM f_display.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 30, 2009 at 07:33 AM

    PART-2

    ----


    • Form F_DISPLAY

    ----


    FORM f_display.

    • Macro definition

    DEFINE m_fieldcat.

    ls_fieldcat-tabname = &1.

    ls_fieldcat-fieldname = &2.

    ls_fieldcat-ref_tabname = &3.

    ls_fieldcat-cfieldname = &4. " Field with currency unit

    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.

    IF p_expand = c_x.

    ls_layout-expand_fieldname = 'EXPAND'.

    ENDIF.

    • Build field catalog and sort table

    m_fieldcat c_gt_vbak 'VBELN' 'VBAK' ''.

    m_fieldcat c_gt_vbak 'KUNNR' 'VBAK' ''.

    m_fieldcat c_gt_vbak 'NETWR' 'VBAK' 'WAERK'.

    m_fieldcat c_gt_vbak 'WAERK' 'VBAK' ''.

    m_fieldcat c_gt_vbak 'ERDAT' 'VBAK' ''.

    m_fieldcat c_gt_vbap 'POSNR' 'VBAP' ''.

    m_fieldcat c_gt_vbap 'MATNR' 'VBAP' ''.

    m_fieldcat c_gt_vbap 'ARKTX' 'VBAP' ''.

    m_fieldcat c_gt_vbap 'NETWR' 'VBAP' 'WAERK'.

    m_fieldcat c_gt_vbap 'WAERK' 'VBAP' ''.

    m_sort c_gt_vbak 'KUNNR'.

    m_sort c_gt_vbap 'NETWR'.

    ls_keyinfo-header01 = 'VBELN'.

    ls_keyinfo-item01 = 'VBELN'.

    ls_keyinfo-item02 = 'POSNR'.

    • Dipslay Hierarchical list

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

    i_tabname_item = c_gt_vbap

    is_keyinfo = ls_keyinfo

    i_save = 'A'

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

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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 31, 2009 at 09:42 AM

    i think it is not possible...

    if you see the documentation for the function module ..it is written for the list

    All interactions which are performed on the list refer directly to the internal output tables, e.g. sorting the list also sorts the passed internal output tables (passed by reference).

    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.