Alv three hierarchy

hello everyone,
I want to out put to alv list with three hierarchy,is there any way to solve this problem?
for example:
1.CAUFV-AUFNR                                     CAUFV-PLNBEZ
2.AFVC-VORNR       CRHD-ARBPL          AFVC-LTXA1
3.RESB-MATNR      RESB-BDMNG         RESB-MEINS
AND AT NEW AUFNR SUM.
thanks a million1
regards
davidzhang.

Hi,
for this requirement, best you should go to Tree alv.
Check the below links for alv Tree.
[http://www.****************/Tutorials/ALV/ALVTreeDemo/demo.htm|http://www.****************/Tutorials/ALV/ALVTreeDemo/demo.htm]
DWDM -  transaction for sample/demo programs for controls
check the below example program are in se38
BCALV_GRID_DND_TREE            ALV Grid: Drag and Drop with ALV Tree
BCALV_GRID_DND_TREE_SIMPLE     ALV GRID: Drag and drop with ALV tree (simple)
BCALV_TEST_COLUMN_TREE         Program BCALV_TEST_COLUMN_TREE
BCALV_TEST_SIMPLE_TREE         Program BCALV_TEST_SIMPLE_TREE
BCALV_TREE_01                  ALV Tree Control: Build Up the Hierarchy Tree
BCALV_TREE_02                  ALV Tree Control: Event Handling
BCALV_TREE_03                  ALV Tree Control: Use an Own Context Menu
BCALV_TREE_04                  ALV Tree Control: Add a Button to the Toolbar
BCALV_TREE_05                  ALV Tree Control: Add a Menu to the Toolbar
BCALV_TREE_06                  ALV tree control: Icon column and icon for nodes/items
BCALV_TREE_DEMO                Demo for ALV tree control
BCALV_TREE_DND                 ALV tree control: Drag & Drop within a hierarchy tree
BCALV_TREE_DND_MULTIPLE        ALV tree control: Drag & Drop within a hierarchy tree
BCALV_TREE_EVENT_RECEIVER      Include BCALV_TREE_EVENT_RECEIVER
BCALV_TREE_EVENT_RECEIVER01
BCALV_TREE_ITEMLAYOUT          ALV Tree: Change Item Layouts at Runtime
BCALV_TREE_MOVE_NODE_TEST      Demo for ALV tree control
BCALV_TREE_SIMPLE_DEMO         Program BCALV_TREE_SIMPLE_DEMO
BCALV_TREE_VERIFY              Verifier for ALV Tree and Simple ALV Tree
Regards,
SB

Similar Messages

  • ALV Tree Hierarchy using OOPS

    Hi all,
    I have developed a program for ALV Tree Hierarchy using OOPs.I followed the SAP demo program.I am not able to get the values in the output.Please can anyone guide me where to correct my program. I am placing the entire code so that you all can also debug and see what is wrong.
    *& Report  ZZHIERARCHY_TEST1
    REPORT  zzhierarchy_test1.
    DATA : alv_container TYPE REF TO cl_gui_custom_container,
           alv_tree      TYPE REF TO cl_gui_alv_tree,
           gt_fcat          TYPE lvc_t_fcat,
           gt_vbrk TYPE vbrk OCCURS 0.                             "Output Table
    DATA : gs_hirarchy_header TYPE treev_hhdr.
    START-OF-SELECTION.
    END-OF-SELECTION.
      CALL SCREEN 9100.
    *&      Module  STATUS_9100  OUTPUT
    MODULE status_9100 OUTPUT.
      SET PF-STATUS 'ALV_TREE'.
      IF alv_container IS INITIAL.
        PERFORM tree_dev.
      ENDIF.
    ENDMODULE.                 " STATUS_9100  OUTPUT
    *&      Form  tree_dev
          text
    FORM tree_dev .
      DATA lv_container_name(20) TYPE c.
      lv_container_name = 'ALV_TREE'.
      CREATE OBJECT alv_container
        EXPORTING
          container_name              = lv_container_name
        EXCEPTIONS
          cntl_error                  = 1
          cntl_system_error           = 2
          create_error                = 3
          lifetime_error              = 4
          lifetime_dynpro_dynpro_link = 5
          OTHERS                      = 6.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      CREATE OBJECT alv_tree
        EXPORTING
          parent                      = alv_container
          node_selection_mode         = cl_gui_column_tree=>node_sel_mode_single
          item_selection              = 'X'
          no_toolbar                  = ''
          no_html_header              = 'X'
        EXCEPTIONS
          cntl_error                  = 1
          cntl_system_error           = 2
          create_error                = 3
          lifetime_error              = 4
          illegal_node_selection_mode = 5
          failed                      = 6
          illegal_column_name         = 7
          OTHERS                      = 8.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      PERFORM build_hirarchy_header CHANGING gs_hirarchy_header.
      PERFORM buid_fieldcatalog.
      CALL METHOD alv_tree->set_table_for_first_display
        EXPORTING
          is_hierarchy_header = gs_hirarchy_header
        CHANGING
          it_outtab           = gt_vbrk               "Table Must be Empty
          it_fieldcatalog     = gt_fcat.
      PERFORM create_hierarchy.
      CALL METHOD alv_tree->frontend_update.
    ENDFORM.                    " tree_dev
    *&      Form  build_hirarchy_header
         <--P_GS_HIRARCHY_HEADER  text
    FORM build_hirarchy_header  CHANGING p_gs_hirarchy_header TYPE treev_hhdr.
      p_gs_hirarchy_header-heading   =  'Company Code'(001).
      p_gs_hirarchy_header-tooltip   =  'Comapny Code'(002).
      p_gs_hirarchy_header-width     =   35.
      p_gs_hirarchy_header-width_pix =   ''.
    ENDFORM.                    " build_hirarchy_header
    *&      Form  buid_fieldcatalog
    FORM buid_fieldcatalog .
      DATA ls_fcat TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
       EXPORTING
         i_structure_name             = 'VBRK'
        CHANGING
          ct_fieldcat                  = gt_fcat
       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.
      LOOP AT gt_fcat INTO ls_fcat.
        CASE ls_fcat-fieldname.
          WHEN 'NETWR'.
            ls_fcat-do_sum = 'X'.
            ls_fcat-h_ftype = 'MAX'.
        ENDCASE.
        MODIFY gt_fcat FROM ls_fcat.
      ENDLOOP.
    ENDFORM.                    " buid_fieldcatalog
    *&      Form  create_hierarchy
    FORM create_hierarchy .
      DATA : lt_vbrk TYPE TABLE OF vbrk,
             ls_vbrk TYPE vbrk.
      DATA : top_key     TYPE lvc_nkey,
             company_key TYPE lvc_nkey,
             bzirk_key   TYPE lvc_nkey.
      DATA : lv_bukrs     TYPE bukrs,
             lv_bukrs_prv TYPE bukrs,
             lv_bzirk     TYPE bzirk,
             lv_bzirk_prv TYPE bzirk.
      SELECT * FROM vbrk INTO TABLE lt_vbrk UP TO 500 ROWS.
      SORT lt_vbrk BY bukrs .
      CALL METHOD alv_tree->add_node
        EXPORTING
          i_relat_node_key     = ''
          i_relationship       = cl_gui_column_tree=>relat_last_child
          i_node_text          = 'Company Code'
        IMPORTING
          e_new_node_key       = top_key
        EXCEPTIONS
          relat_node_not_found = 1
          node_not_found       = 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.
      LOOP AT lt_vbrk INTO ls_vbrk.
        lv_bukrs = ls_vbrk-bukrs .
        lv_bzirk = ls_vbrk-bzirk .
        IF lv_bukrs <> lv_bukrs_prv.
          lv_bukrs_prv =  lv_bukrs.
          PERFORM add_node USING lv_bukrs
                                 top_key
                        CHANGING company_key.
        ENDIF.
        IF lv_bzirk <> lv_bzirk_prv.
          lv_bzirk_prv = lv_bzirk.
          PERFORM add_posnr USING lv_bzirk
                                  company_key
                         CHANGING bzirk_key.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " create_hierarchy
    *&      Form  add_node
         -->P_LV_BUKRS  text
         -->P_TOP_KEY  text
         <--P_COMPANY_KEY  text
    FORM add_node  USING    p_lv_bukrs    TYPE bukrs
                            p_top_key     TYPE lvc_nkey
                   CHANGING p_company_key TYPE lvc_nkey .
      DATA: l_node_text TYPE lvc_value,
            ls_vbrk TYPE vbrk.
      l_node_text = 'Company' .
      CALL METHOD alv_tree->add_node
        EXPORTING
          i_relat_node_key     = p_top_key
          i_relationship       = cl_gui_column_tree=>relat_last_child
          is_outtab_line       = ls_vbrk
          i_node_text          = l_node_text
        IMPORTING
          e_new_node_key       = p_company_key
        EXCEPTIONS
          relat_node_not_found = 1
          node_not_found       = 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.                    " add_node
    *&      Form  add_posnr
          text
         -->P_LV_POSNR  text
         -->P_COMPANY_KEY  text
         <--P_POSNR_KEY  text
    FORM add_posnr  USING    p_lv_bzirk    TYPE bzirk
                             p_company_key TYPE lvc_nkey
                    CHANGING p_bzirk_key   TYPE lvc_nkey.
      DATA ls_vbrk TYPE vbrk.
      CALL METHOD alv_tree->add_node
        EXPORTING
          i_relat_node_key     = p_company_key
          i_relationship       = cl_gui_column_tree=>relat_last_child
          is_outtab_line       = ls_vbrk
          i_node_text          = 'Sales District'
        IMPORTING
          e_new_node_key       = p_bzirk_key
        EXCEPTIONS
          relat_node_not_found = 1
          node_not_found       = 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.                    " add_posnr
    *&      Module  USER_COMMAND_9100  INPUT
    MODULE user_command_9100 INPUT.
      CASE sy-ucomm.
        WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
      CALL METHOD alv_container->free.
      LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_9100  INPUT

    Check this forum there are many threads on this.

  • WD Abap Alv With hierarchy

    hi folks,
    i use an wd abap alv with hierarchy, on EVENT CLICKED on a CELL never gives me the correct R_PARAM->INDEX back as it does without hierarchy.
    how can i find out the exactly row which is behind the clicked cell?????
    kind regards,
    oliver

    Hi Oliver,
      Hierarchy is one type of setting in WD ABAP not like in normal ALV. I think there is no way to set the lead selection index in the case of Hiearchy, why becuase you can able to select only the leaf nodes only not all the nodes in the hiearachy. For the leaf nodes you can make the lead selected node. Just try to access the leaf node and find out that how you are accesing depending on that you can set the leaf node as selected.
    1. This is link to ALV tutorial, ALV Demo
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1190424a-0801-0010-84b5-ef03fd2d33d9
    There are some standard examples also,
    2.Please refer to Package called as SALV_WD_DEMO .In this you will get ample of sample examples about ALV .
    3. Please search in SDN library you will ALV in WD ABAP you will get many pdfs avilable that will guide you to develope ALV application in WD ABAP.
    Hope this will help you.
    Cheers,
    Darshna.

  • ALV WebDynpro Hierarchy -Setting non-numeric values in the header level row

    Hi Experts,
    When setting up an ALV table as a table hierarchy the standard ALV settings only seem to allow for numeric values to be displayed in the higher hierarchy levels. Is there a way to also set the values for some non-numeric columns into these higher-level rows - programmatically or through the ALV Settings?
    Example: I have delivery item level data in my context and the delivery number as a hierarchy column. Some columns in my context however actually come from the delivery header e.g. delivery block, delivery priority, ship-to etc and I would like to display these in the collapsed header rows of the delivery number.
    It seems obvious to me that this should be doable otherwise if you are looking at at a list of hundreds of deliveries and all you see besides the delivery number is numeric data such as sums & totals, it's kind of hard to know which delivery you might want to expand the sub-level for.
    Please help,
    Peter

    Hi,
    Even we have faced the same issue.
    In ALV hierarchy, we cannot display data at header items/levels. this is a constraint in ALV. You can achieve the same usign TABLE UI element.

  • About ALV as Hierarchy

    I want to make my ALV like this [https://weblogs.sdn.sap.com/weblogs/images/1918/wda_alv17.jpg|https://weblogs.sdn.sap.com/weblogs/images/1918/wda_alv17.jpg] by coding. I've found a pdf about how to do it, but it doesn't work.
    Here is my code:
      DATA:
            l_ref_cmp_usage TYPE REF TO if_wd_component_usage,
            l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table.
      l_ref_cmp_usage = wd_this->wd_cpuse_salv( ).
      IF l_ref_cmp_usage->has_active_component( ) is INITIAL.
        l_ref_cmp_usage->create_component( ).
      ENDIF.
      l_ref_interfacecontroller = wd_this->wd_cpifc_salv( ).
      wd_this->r_table = l_ref_interfacecontroller->get_model( ).
      cl_salv_wd_model_table_util=>if_salv_wd_table_util_stdfuncs~set_all(
        r_model = wd_this->r_table ).
      wd_this->r_table->if_salv_wd_table_settings~set_display_type(
      if_salv_wd_c_table_settings=>display_type_hierarchy ).
      DATA: lr_column TYPE REF TO cl_salv_wd_column.
      lr_column = wd_this->r_table->if_salv_wd_column_settings~get_column( 'CNOID' ).
      lr_column->if_salv_wd_column_hierarchy~set_hierarchy_column( abap_true ).
      lr_column = wd_this->r_table->if_salv_wd_column_settings~get_column( 'STOID' ).
      lr_column->if_salv_wd_column_hierarchy~set_hierarchy_column( abap_true ).
      wd_this->r_table->if_salv_wd_table_hierarchy~set_last_hier_column_as_leaf( abap_true ).
    how can i make these code work?
    thx
    by jkchen

    hi arjun,
    it still doesn't work. when i debug it, the system sets the column hierarchy "false"...
    the code is like this now:
      DATA:
            l_ref_cmp_usage TYPE REF TO if_wd_component_usage,
            l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table,
            l_value TYPE REF TO cl_salv_wd_config_table.
      l_ref_cmp_usage = wd_this->wd_cpuse_salv( ).
      IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
        l_ref_cmp_usage->create_component( ).
      ENDIF.
      l_ref_interfacecontroller = wd_this->wd_cpifc_salv( ).
      l_value = l_ref_interfacecontroller->get_model( ).
    *  cl_salv_wd_model_table_util=>if_salv_wd_table_util_stdfuncs~set_all(
    *    r_model = l_value ).
      l_value->if_salv_wd_std_functions~set_hierarchy_allowed( abap_true ).
      l_value->if_salv_wd_table_settings~set_display_type(
      if_salv_wd_c_table_settings=>display_type_hierarchy ).
      DATA: lr_column TYPE REF TO cl_salv_wd_column.
      lr_column = l_value->if_salv_wd_column_settings~get_column( 'CNOID' ).
      lr_column->if_salv_wd_column_hierarchy~set_hierarchy_column( abap_true ).
      lr_column = l_value->if_salv_wd_column_settings~get_column( 'STOID' ).
      lr_column->if_salv_wd_column_hierarchy~set_hierarchy_column( abap_true ).
      l_value->if_salv_wd_table_hierarchy~set_last_hier_column_as_leaf( abap_true ).

  • ALV as Hierarchy with aggregation

    Hi
    I have 5 columns: H1, H2, H3, SUM1, SUM2
    For columns SUM1, SUM2:
    lo_field = lo_value->if_salv_wd_field_settings~get_field( <fs_col>-id ).
    lo_field->if_salv_wd_aggr~create_aggr_rule( ).
    lo_aggr_rule = lo_field->if_salv_wd_aggr~get_aggr_rule(  ).
    lo_aggr_rule->set_aggregation_type( if_salv_wd_c_aggregation=>aggrtype_total ).
    For columns H1, H2, H3:
    <fs_col>-r_column->if_salv_wd_column_hierarchy~set_hierarchy_column( value = abap_true ).
    If i create sort rule for H1,H2,H3 hierarchy automatic sort is broken.
    How i can create aggregation on Hierarchy ALV?

    hi arjun,
    it still doesn't work. when i debug it, the system sets the column hierarchy "false"...
    the code is like this now:
      DATA:
            l_ref_cmp_usage TYPE REF TO if_wd_component_usage,
            l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table,
            l_value TYPE REF TO cl_salv_wd_config_table.
      l_ref_cmp_usage = wd_this->wd_cpuse_salv( ).
      IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
        l_ref_cmp_usage->create_component( ).
      ENDIF.
      l_ref_interfacecontroller = wd_this->wd_cpifc_salv( ).
      l_value = l_ref_interfacecontroller->get_model( ).
    *  cl_salv_wd_model_table_util=>if_salv_wd_table_util_stdfuncs~set_all(
    *    r_model = l_value ).
      l_value->if_salv_wd_std_functions~set_hierarchy_allowed( abap_true ).
      l_value->if_salv_wd_table_settings~set_display_type(
      if_salv_wd_c_table_settings=>display_type_hierarchy ).
      DATA: lr_column TYPE REF TO cl_salv_wd_column.
      lr_column = l_value->if_salv_wd_column_settings~get_column( 'CNOID' ).
      lr_column->if_salv_wd_column_hierarchy~set_hierarchy_column( abap_true ).
      lr_column = l_value->if_salv_wd_column_settings~get_column( 'STOID' ).
      lr_column->if_salv_wd_column_hierarchy~set_hierarchy_column( abap_true ).
      l_value->if_salv_wd_table_hierarchy~set_last_hier_column_as_leaf( abap_true ).

  • Webdynpro ALV Tree hierarchy N

    Hi Experts ,
    Can you tell me how to use ALV tree to list the NOT flat data?
    1
    ***1-1
    ******1-1-1
    ******1-1-2
    ***1-2
    ******1-2-1
    ******1-2-2
    ***1-3
    2
    3
    I will very appreciate if you can give me an example!
    Karl.
    Edited by: Karl Li on Jun 13, 2010 11:43 AM

    Hello,
    thranks for your information.
    I have a column in my table with the name 'Level', which has values as following:
    1.1; 1.1.0; 1.1.1 .... 2.1; 2.2; 2.2.1  etc.
    This means that I want to specify one column as hierarchy column depending on the value. If I just follow the steps of the tutorial above. There is only one hiearchy in the ALV table.
    Do you have any idea, how to implement it? Many thanks!
    Regards
    meer

  • Blocked and Hierarchial ALV s

    Hi Experts,
    wht is the use of blocked and hierarchial ALV's.
    In which situations are they used? Can u provide any material
    Thank You

    hi,
    <b>Block ALV</b> means more than one list in one screen.
    Means u can have many list in one screen at a time.
    Like this,
    TYPE-POOLS : slis.
    TABLES : mara,
             makt.
    SELECT-OPTIONS : mat FOR mara-matnr.
    DATA : BEGIN OF itab OCCURS 0,
            matnr LIKE mara-matnr,
            maktx LIKE makt-maktx,
            matkl LIKE mara-matkl,
            mtart LIKE mara-mtart,
           END OF itab.
    DATA : BEGIN OF itab1 OCCURS 0,
            mtart LIKE mara-mtart,
            count TYPE i,
           END OF itab1.
    DATA : BEGIN OF itab1_col OCCURS 0,
            mtart LIKE mara-mtart,
            count TYPE i,
           END OF itab1_col.
    DATA : t_fcat1 TYPE slis_t_fieldcat_alv,
           t_fcat2 TYPE slis_t_fieldcat_alv,
           wa_fcat TYPE slis_fieldcat_alv,
           t_eve TYPE slis_t_event,
           wa_eve TYPE slis_alv_event,
           t_layout TYPE slis_layout_alv.
    DATA : v_repid LIKE sy-repid,
           t_mat LIKE mara-matnr.
    DEFINE create_fcat.
      clear wa_fcat.
      wa_fcat-fieldname = &1.
      wa_fcat-seltext_l = &2.
      wa_fcat-outputlen = &3.
      append wa_fcat to t_fcat1.
    END-OF-DEFINITION.
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM dis_data.
    *&      Form  get_data
          text
    FORM get_data.
      SELECT amatnr bmaktx amtart amatkl INTO CORRESPONDING FIELDS OF TABLE itab
      FROM mara AS a INNER JOIN makt AS b ON
      amatnr = bmatnr
      WHERE a~matnr IN mat.
      LOOP AT itab.
        itab1-mtart = itab-mtart.
        itab1-count = 1.
        APPEND itab1.
      ENDLOOP.
      SORT itab1 BY mtart.
      LOOP AT itab1.
        MOVE-CORRESPONDING itab1 TO itab1_col.
        COLLECT itab1_col.
      ENDLOOP.
    ENDFORM.                    "get_data
    *&      Form  dis_data
          text
    FORM dis_data.
      v_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
        EXPORTING
          i_callback_program      = v_repid.
      REFRESH t_fcat1.
      CLEAR t_fcat1.
      REFRESH t_eve.
      wa_eve-name = 'TOP_OF_PAGE'.
      wa_eve-form = 'TOP_OF_PAGE1'.
      APPEND wa_eve TO t_eve.
      create_fcat:
      'MATNR' 'Material' '10',
      'MAKTX' 'Material Description' '40',
      'MTART' 'Type' '10',
      'MATKL' 'Group' '10'.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          is_layout   = t_layout
          it_fieldcat = t_fcat1
          i_tabname   = 'ITAB'
          it_events   = t_eve
        TABLES
          t_outtab    = itab.
      REFRESH t_fcat1.
      CLEAR t_fcat1.
      REFRESH t_eve.
      wa_eve-name = 'TOP_OF_PAGE'.
      wa_eve-form = 'TOP_OF_PAGE2'.
      APPEND wa_eve TO t_eve.
      create_fcat:
      'MTART' 'Type' '10',
      'COUNT' 'Total' '5'.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          is_layout   = t_layout
          it_fieldcat = t_fcat1
          i_tabname   = 'ITAB1_COL'
          it_events   = t_eve
        TABLES
          t_outtab    = itab1_col.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
    ENDFORM.                    "dis_data
    *&      Form  top_of_page1
          text
    FORM top_of_page1.
      FORMAT COLOR COL_POSITIVE.
      WRITE:/ 'First Block'.
      FORMAT COLOR OFF.
    ENDFORM.                    "top_of_page
    *&      Form  top_of_page2
          text
    FORM top_of_page2.
      FORMAT COLOR COL_NEGATIVE.
      WRITE /5 'Second Block'.
      FORMAT COLOR OFF.
    ENDFORM.                    "top_of_page
    In <b>hierarchical ALV</b> hierarchy will create,
    Like This,
    TYPE-POOLS : slis.
    TABLES : mseg.
    DATA : BEGIN OF itab_head OCCURS 0,
            matnr LIKE mseg-matnr,
            werks LIKE mseg-werks,
           END OF itab_head.
    DATA : BEGIN OF itab_item OCCURS 0,
            matnr LIKE mseg-matnr,
            werks LIKE mseg-werks,
            mblnr LIKE mseg-mblnr,
            menge LIKE mseg-menge,
           END OF itab_item.
    DATA : t_fcat TYPE slis_t_fieldcat_alv,
           key_info TYPE slis_keyinfo_alv,
           t_eve TYPE slis_t_event,
           gt_subtot TYPE slis_t_sortinfo_alv,
           subtot LIKE LINE OF gt_subtot,
           t_listhead TYPE slis_t_listheader,
           st_line TYPE slis_listheader.
    DATA : t_mtdoc LIKE mseg-mblnr.
    SELECT-OPTIONS : mat FOR mseg-matnr.
    INITIALIZATION.
      PERFORM build_cat USING t_fcat.
      PERFORM build_eve.
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM dis_data.
    *&      Form  build_cat
          text
         -->TEMP_FCAT  text
    FORM build_cat USING temp_fcat TYPE slis_t_fieldcat_alv.
      DATA : wa_fcat TYPE slis_fieldcat_alv.
      wa_fcat-tabname = 'ITAB_HEAD'.
      wa_fcat-fieldname = 'MATNR'.
      wa_fcat-seltext_m = 'Material'.
      APPEND wa_fcat TO temp_fcat.
      CLEAR wa_fcat.
      wa_fcat-tabname = 'ITAB_HEAD'.
      wa_fcat-fieldname = 'WERKS'.
      wa_fcat-seltext_m = 'Plant'.
      APPEND wa_fcat TO temp_fcat.
      CLEAR wa_fcat.
      wa_fcat-tabname = 'ITAB_ITEM'.
      wa_fcat-fieldname = 'MBLNR'.
      wa_fcat-seltext_m = 'Material Doc.'.
      APPEND wa_fcat TO temp_fcat.
      CLEAR wa_fcat.
      wa_fcat-tabname = 'ITAB_ITEM'.
      wa_fcat-fieldname = 'MENGE'.
      wa_fcat-seltext_m = 'Quantity'.
    wa_fcat-do_sum = 'Y'.
      APPEND wa_fcat TO temp_fcat.
      CLEAR wa_fcat.
    subtot-spos = 1.
    subtot-fieldname = 'MATNR'.
    subtot-tabname = 'ITAB_HEAD'.
    subtot-up = 'X'.
    subtot-group = 'X'.
    subtot-subtot = 'X'.
    subtot-expa = 'X'.
    APPEND subtot TO gt_subtot.
    ENDFORM.                    "build_cat
    *&      Form  build_eve
          text
    FORM build_eve.
      DATA : wa_eve TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         i_list_type           = 0
       IMPORTING
         et_events             = t_eve
      EXCEPTIONS
        LIST_TYPE_WRONG       = 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.
      READ TABLE t_eve INTO wa_eve WITH KEY name = 'TOP_OF_PAGE'.
      IF sy-subrc = 0.
        wa_eve-form = 'TOP_OF_PAGE'.
        MODIFY t_eve FROM wa_eve INDEX sy-tabix.
      ENDIF.
    ENDFORM.                    "build_eve
    *&      Form  get_data
          text
    FORM get_data.
      SELECT matnr werks mblnr menge FROM mseg INTO CORRESPONDING FIELDS OF TABLE itab_item
      WHERE matnr IN mat.
    ENDFORM.                    "get_data
    *&      Form  dis_data
          text
    FORM dis_data.
      key_info-header01 = 'MATNR'.
      key_info-item01 = 'MATNR'.
      key_info-header02 = 'WERKS'.
      key_info-item02 = 'WERKS'.
      REFRESH itab_head.
      LOOP AT itab_item.
        ON CHANGE OF itab_item-matnr OR itab_item-werks.
          MOVE-CORRESPONDING itab_item TO itab_head.
          APPEND itab_head.
        ENDON.
      ENDLOOP.
      CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
        EXPORTING
          i_callback_program             = 'ZHEIRALV_PRDS'
         i_callback_user_command        = 'USER_COMMAND'
          it_fieldcat                    = t_fcat
          it_sort                        = gt_subtot
          it_events                      = t_eve[]
          i_tabname_header               = 'ITAB_HEAD'
          i_tabname_item                 = 'ITAB_ITEM'
          is_keyinfo                     = key_info
        TABLES
          t_outtab_header                = itab_head
          t_outtab_item                  = itab_item
    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.                    "dis_data
    *&      Form  top_of_page
          text
    FORM top_of_page.
      CLEAR st_line.
      st_line-typ = 'H'.
      st_line-info = 'Dhwani Shah'.
      APPEND st_line TO t_listhead.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary       = t_listhead
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    ENDFORM.                    "top_of_page
    reward if useful.

  • Alv reports sample example req..

    can anybody help me out with a simple example regarding ALV Reports.(simple ALV Reports , Blocked ALV Reports & Hierarchy ALV Reports).
    or pls send me a word document regarding the same ..to [email protected]
    response is highly appreciated..
    bye--
    Pradeepa

    Following document should get you started.
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907">An Easy Reference For ALV Grid Control.pdf</a>
    tip : if you do a <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/advancedsearch?query=alv%20grid&cat=sdn_all">search for alv grid</a> on the sdn homepage, this is the first result.
    Message was edited by:
            Dries Horions

  • Popin for ALV

    Hi All,
    I need some clarification regarding the Popins for ALV.
    I have already searched SCN on the same.
    As we have Popins for Table UI element.
    Does ALV WD component provides any of this POPIN functionality either at Table or Row or Column or Cell level.
    My requirement has Collapse or Expand when selecting a column in standard ALV WDA table .
    Upon this column collapse/expand I need to show some columns.
    I'm not using any Tree ALV or Hierarchial ALV.
    As there are no column events in ALV.
    One more query- Does ON_CELL_ACTION requires 'ENTER key' to be pressed to trigger it.
    Any workaround for this would be highly appreciated.
    Regards,
    Lekha.

    >Does ALV WD component provides any of this POPIN functionality either at Table or Row or Column or Cell level.
    No, the ALV doesn't support the Popin Construct.
    >One more query- Does ON_CELL_ACTION requires 'ENTER key' to be pressed to trigger it.
    It requires something to trigger the round trip to the server - Enter Key or Change of Lead Selection.  There is no on loss of focus event in Web Dynpro.

  • ALV List, which one is better?

    Hi All,
    I need a suggestion which type of ALV(Block, hierarchy, etc...) is Best for given situation below.
    I am showing data in ALV with respect to multiple Vendors. There are multiple line items to single Vendor and then Summary of printed line items. In Summary i am showing % values. This is repeated for all Vendors.
    Please suggest.
    Thanks

    Hi,
    Grid layout is best
    Regards,
    Bhaskar

  • Searching for products via Product Hierarchy ID in CRM Webclient 2007

    Hello,
    When creating a sales order in CRM Webclient 2007 I would like to be able to search for products by using the Product Hierarchy ID. When clicking the search help for product in the order entry screen in the webclient UI, I get a pop-up with the available search criteria. I select Product Hierarchy ID and click on Input Help. A new pop-up is displayed with the three Hierarchy ID:s:
    R3MATCLASS Material Group
    R3PRODSTYP Product Subtype
    R3PRODHIER Product Hierarchy
    I select R3PRODHIER. When hitting the search button, I get all materials which have Hierarchy ID R3PRODHIER assigned as a product category in the material master data. I can however not search for materials which belong to a certain hierarchy node in the product hierarchy.
    In transaction VA01 in ECC it is possible to drill down through the three levels of the product hierarchy to find the desired material. Is the same type of searching possible in CRM?
    Any help much appreciated.
    Kind regards,
    Johan Wigert

    Hi Johan
    I want to know if finally you have found the way to deal this problem.
    Thank you very much,
    Yannuchi

  • Total in REUSE_ALV_BLOCK_LIST_HS_APPEND

    hi,
    i am using "REUSE_ALV_BLOCK_LIST_HS_APPEND" to display alv in hierarchy.
    i have some 5 columns to display, i need to have total for all these 5 columns at the end and text for it as "TOTAL".
    i have used DO_SUM in fieldcat and declared layout to display the text as "TOTAL".
    even then i am not getting the text and sum.
    am not getting the problem here.
    pls help...

    hi,
    i am using "REUSE_ALV_BLOCK_LIST_HS_APPEND" to display alv in hierarchy.
    i have some 5 columns to display, i need to have total for all these 5 columns at the end and text for it as "TOTAL".
    i have used DO_SUM in fieldcat and declared layout to display the text as "TOTAL".
    even then i am not getting the text and sum.
    am not getting the problem here.
    pls help...

  • Hiearchy Authorization

    Hi All ,
    Consider a scenario in which in a single infoobject which is authorization relevant consist of three heirarchies i only want a user to accesss two hierarchy out of three but in all the three hierarchy some common values are present due to this reason  i need to give user all value authorization
    (Value authorization: I CP *).But due to this when i excute a query i can see all the hierarchy evethough i have includes only two in the hierarchy authorization.
    How should i i assign a authorization in order to get proper result.
    Regards,
    Deepak

    Hello Deepak warbhe,
    If you give CP * you'll always give full authorizations regarding of any hierarchies assigned.
    You should give EQ : and assign two hierarchies in that authorization.
    It should work right that way.
    Remember even with the third hierarchy not assigned, you're giving authorization to the two hierarchies and whatever structure of nodes and leafs that belong to that hierarchy, you'll see values of that characteristic that belong to the tree of the hierarchy in the nodes and the leafs.
    Diogo.

  • How to create the Hierarchial table using ALV.in WD4A

    Hi All,
    I am struggling hard to make the hierarchial ALV,  But could not do it.
    Could you help me.
    Actually I want the column to be hierarchial. For this i am using
    if_salv_wd_column_hierarchy~set_hierarchy_column.
    Also i tried to display the whole table as Hierarchial
        lr_table_settings->set_display_type( if_salv_wd_c_table_settings=>display_type_hierarchy ).
    For both the possibilities the result is not as desired.
    Regards,
    Arti.

    Hi Aleem,
    The link u have provided gives the solution for the Table.
    I want the implementation for ALV.
    Also my requirement is that the first column of the ALV should be hierarchial.
    On expanding the table cell of first column one more table should open of same type.
    This way user can navigate to three diffierent database tables.
    The tree is populated at runtime with the data. So the depth of branches is unknown at design time.
    I hope the requirements are clear to u now.
    Thanks and Regards,
    Arti.

Maybe you are looking for

  • Partial Delivery when the complete delivery flag is checked in Sales Order

    We do the ATP check in APO when we create a sales order in R/3. We have "complete delivery" flag checked in Sales Order. But when we create batch orders say may be of 20, one of 20 is confirming with partial delivery. We thought the issue is with ATP

  • Macbook pro 15" vs Macbook pro retina 15"

    I have recently bought macbook pro retina 15" it has yet to arrive it is still in the processing stage. I prefer the retina slightly more than the traditional version, however upon reading the image retention issues of the macbook pro retina after I

  • Combining Text in Automator for Excel import.

    I'm attempting to create an automator workflow that will string some text together so that it can be imported into an Excel worksheet. Here's my workflow so far. • New Text File Creates file temp.txt • Run AppleScript Opens file temp.txt • Get Specif

  • Problem in SQL with CURSOR( ) ,Why the CURSOR did not work?

    hi All: I have a problem in SQL with CURSOR. The data is as the attachments. Here is the SQL statement as follow: SELECT A.WADCTO,A.WADOCO,B.IGCOST,CURSOR (SELECT X.IGLITM FROM F3102 X WHERE X.IGDOCO=A.WADOCO AND X.IGCOST IN ('B1','D1','C3')) AS DETA

  • How do you Reset iPad to factory defaults

    How do you reset an iPad to factory defaults?