Multiple tree structured rows in output header

Hi All,
I have a requirement to create an output layout in which there are 3 dynamic rows in header and each row is having its own sub devision (like a tree structure). The number of columns will depend upon the data.
I am able to create N number of dynamic columns according to data fetched at run time but dont know how to create multiple tree structures rows in header.
Can any one please suggest how can I achieve this in SAP?
Regards,
Nilanjana

Hi All,
I have a requirement to create an output layout in which there are 3 dynamic rows in header and each row is having its own sub devision (like a tree structure). The number of columns will depend upon the data.
I am able to create N number of dynamic columns according to data fetched at run time but dont know how to create multiple tree structures rows in header.
Can any one please suggest how can I achieve this in SAP?
Regards,
Nilanjana

Similar Messages

  • Bookmarks of a Responsive HTML5 output as part of an overall tree structure

    With its Responsive HTML5 output, unstructured FrameMaker 12 can create a bookmark tree.
    Is it possible to tie trees (bookmarks) of multiple Responsive HTML5 outputs in an overall HTML tree structure?

    Hi Herbert
    Thanks for reporting the issue.
    For this problem, I will suggest two solutions
    1. Either create a master book containing all your books / fm documents and then publish, you will get integrated Responsive HTML5 output.
    2. Or use TCS and in RoboHelp use merge project Adobe RoboHelp 11 * Merging Help projects
    Please let us know if you find any issue in that.
    Thanks
    Amit Jha

  • Tree Structure Output

    Hello Everyone,
    I have only using ADOBE Interactive forms for a short time. I have a table that has
    seven fields. Region, Location, 4 diminsion fields, and one field that contains notes.
    The region and the locations are currently on every row of the table.
    However I would like the the output to be in a tree structure. Is there a
    way to out put the data in this format like below? Its a lot cleaners than
    duplicate regions and locations for every record.
    Like Below
    Region1
                Location1
                              Dimensions 1
                              Dimensions 2
                              Dimensions 3
                Location2
                              Dimensions 1
                              Dimensions 2
                              Dimensions 3
    Region2
                Location1
                              Dimensions 1
                              Dimensions 2
                              Dimensions 3
                Location2
                              Dimensions 1
                              Dimensions 2
                              Dimensions 3
    Thanks,
    Stephen

    I guess you can achieve that by nested tables. You can find lot of threads discussing it.
    Below given blog also discusses the same.
    /people/juergen.hauser2/blog/2009/12/01/using-tables-or-subforms-in-interactive-forms
    Thanks,
    Aravind

  • Output like Tree structure

    Hi
    I am having Data in one internal table
    BEGIN OF ty_box,
           vbeln LIKE vbak-vbeln, "Sales Order Document Number
           exidv LIKE vekp-exidv, "External Handling Unit Identification
           vegr4 LIKE vekp-vegr4, "Integration required if the value is INTR
           matnr LIKE lips-matnr, "Delivery Item-Material Number
           arktx LIKE lips-arktx, "Delivery Item-Short text for Material
    END OF ty_box.
    I want to Display output like tree structure
    integration required?
    () Sales order                                              
    () HU  -
    checkbox                                                                               
    Mat A       Description of A
    Mat B       Description of B
    Please give sample program for this type.  '-' indicate sapce
    Message was edited by:
            sudhakara reddy
    Message was edited by:
            sudhakara reddy

    hi,
    use ALV TREE
    check these links.
    http://www.erpgenie.com/sap/abap/SalesOrderFlow.htm
    http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_basic.htm
    Check these programs.
    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
    RSDEMO_DRAG_DROP_TREE_MULTI
    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
    Also please check the transaction DWDM This will give info also on trees.
    Check the links -
    drag drop required for alv column!
    drag and drop in a tree
    Drag&Drop within the Tree
    Drag&Drop within a tree
    Drag and drop in ALV tree

  • How do I read text from specific rows and columns in a tree structure?

    How do I read text from specific rows and columns in a tree structure? In a table you can specify the cell to read from but I have not been able to figure out how to do this with a tree structure.

    You need to set two properties to activate the correct cell and then you can read it's string property.
    The positioning properties are the "ActiveItemTag" and
    "ActiveColNum" properties. With them you select the tree item by it's tag and the active column. The string can then be read from the "Cell String" property.
    MTO

  • How to create tree structure in abap

    hi,
       I am mohan. Please send the how to create the tree structure. how to insert the child nodes in  root node. actually our requirement is we have list transaction codes. We are planning to put all transaction codes in tree level.
    please tell me how to do the program in tree structure.

    Hi Mohan,
    Check the following program on ALV tree.
    REPORT zalvtree.
    CLASS cl_gui_column_tree DEFINITION LOAD.
    CLASS cl_gui_cfw DEFINITION LOAD.
    DATA: go_grid TYPE REF TO cl_gui_alv_grid.
    DATA: ro_grid TYPE REF TO cl_gui_alv_grid.
    DATA tree1  TYPE REF TO cl_gui_alv_tree.
    DATA mr_toolbar TYPE REF TO cl_gui_toolbar.
    DATA : gt_checked TYPE lvc_t_chit,
           gs_checked LIKE LINE OF gt_checked,
           l_part_key TYPE lvc_nkey,
           gt_node TYPE lvc_s_chit-nodekey.
    INCLUDE <icon>.
    INCLUDE zamit_alv_tree_toolbar_event.
    INCLUDE zbcalv_tree_event_receiver.
    *DATA: toolbar_event_receiver TYPE REF TO lcl_toolbar_event_receiver.
    DATA: gt_sflight      TYPE sflight OCCURS 0,      "Output-Table
          gt_fieldcatalog TYPE lvc_t_fcat, "Fieldcatalog
          ok_code LIKE sy-ucomm.           "OK-Code
    START-OF-SELECTION.
    END-OF-SELECTION.
      CALL SCREEN 100.
    *&      Module  PBO  OUTPUT
          process before output
    MODULE pbo OUTPUT.
      SET PF-STATUS 'MAIN100'.
      IF tree1 IS INITIAL.
        PERFORM init_tree.
    else.
                  CALL METHOD me->refresh_table_display
                    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.
      ENDIF.
      CALL METHOD cl_gui_cfw=>flush.
    ENDMODULE.                             " PBO  OUTPUT
    *&      Module  PAI  INPUT
          process after input
    MODULE pai INPUT.
      CASE ok_code.
        WHEN 'EXIT' OR 'BACK' OR 'CANC'.
          PERFORM exit_program.
    *mrk
        WHEN 'MOVE'.
          PERFORM check_selection.
        WHEN 'MBAK'.
          PERFORM another_selection.
        WHEN 'ALL'.
          PERFORM select_all.
        WHEN 'CLEAR'.
          PERFORM clear_all.
        WHEN 'DELETE'.
          PERFORM delete_all.
        WHEN 'EXPAND'.
          PERFORM expand_all.
        WHEN 'COLLAPSE'.
          PERFORM collapse_all.
        WHEN OTHERS.
          CALL METHOD cl_gui_cfw=>dispatch.
      ENDCASE.
      CLEAR ok_code.
      CALL METHOD cl_gui_cfw=>flush.
    ENDMODULE.                             " PAI  INPUT
    *&      Form  build_fieldcatalog
          build fieldcatalog for structure sflight
    FORM build_fieldcatalog.
    get fieldcatalog
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'SFLIGHT'
        CHANGING
          ct_fieldcat      = gt_fieldcatalog.
    change fieldcatalog
      DATA: ls_fieldcatalog TYPE lvc_s_fcat.
      LOOP AT gt_fieldcatalog INTO ls_fieldcatalog.
        CASE ls_fieldcatalog-fieldname.
          WHEN 'CARRID' OR 'CONNID' OR 'FLDATE'.
            ls_fieldcatalog-no_out = 'X'.
            ls_fieldcatalog-key    = ''.
          WHEN 'PRICE' OR 'SEATSOCC' OR 'SEATSMAX' OR 'PAYMENTSUM'.
            ls_fieldcatalog-do_sum = 'X'.
        ENDCASE.
        MODIFY gt_fieldcatalog FROM ls_fieldcatalog.
      ENDLOOP.
    ENDFORM.                               " build_fieldcatalog
    *&      Form  build_hierarchy_header
          build hierarchy-header-information
         -->P_L_HIERARCHY_HEADER  strucxture for hierarchy-header
    FORM build_hierarchy_header CHANGING
                                   p_hierarchy_header TYPE treev_hhdr.
      p_hierarchy_header-heading = 'Hierarchy Header'.          "#EC NOTEXT
      p_hierarchy_header-tooltip =
                             'This is the Hierarchy Header !'.  "#EC NOTEXT
      p_hierarchy_header-width = 30.
      p_hierarchy_header-width_pix = ''.
    ENDFORM.                               " build_hierarchy_header
    *&      Form  exit_program
          free object and leave program
    FORM exit_program.
      CALL METHOD tree1->free.
      LEAVE PROGRAM.
    ENDFORM.                               " exit_program
    *&      Form  check_selection
          text
    -->  p1        text
    <--  p2        text
    FORM check_selection .
    create container for alv-tree
      DATA: l_tree_container_name(30) TYPE c,
            l_custom_container2 TYPE REF TO cl_gui_custom_container.
      l_tree_container_name = 'TREE2'.
      IF sy-batch IS INITIAL.
        CREATE OBJECT l_custom_container2
          EXPORTING
                container_name = l_tree_container_name
          EXCEPTIONS
                cntl_error                  = 1
                cntl_system_error           = 2
                create_error                = 3
                lifetime_error              = 4
                lifetime_dynpro_dynpro_link = 5.
        IF sy-subrc <> 0.
          MESSAGE x208(00) WITH 'ERROR'.                        "#EC NOTEXT
        ENDIF.
      ENDIF.
      CREATE OBJECT go_grid
        EXPORTING
       I_SHELLSTYLE      = 0
       I_LIFETIME        =
          i_parent          = l_custom_container2
       I_APPL_EVENTS     = space
       I_PARENTDBG       =
       I_APPLOGPARENT    =
       I_GRAPHICSPARENT  =
       I_NAME            =
    EXCEPTIONS
       ERROR_CNTL_CREATE = 1
       ERROR_CNTL_INIT   = 2
       ERROR_CNTL_LINK   = 3
       ERROR_DP_CREATE   = 4
       others            = 5
      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 load_data_into_grid.
    *data: lt_nodes type LVC_T_NKEY,
         ls_nodes like line of lt_nodes,
         ls_checked like line of gt_checked.
    *loop at gt_checked into ls_checked.
    ls_nodes = ls_checked-nodekey.
    append ls_nodes to lt_nodes.
    *endloop.
    *CALL METHOD tree1->unselect_nodes
    EXPORTING
       it_node_key                  = lt_nodes
    EXCEPTIONS
       CNTL_SYSTEM_ERROR            = 1
       DP_ERROR                     = 2
       MULTIPLE_NODE_SELECTION_ONLY = 3
       ERROR_IN_NODE_KEY_TABLE      = 4
       FAILED                       = 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.
    ENDFORM.                    " check_selection
    *&      Form  another_selection
          text
    -->  p1        text
    <--  p2        text
    FORM another_selection .
    create container for alv-tree
      DATA: l_tree_container_name(30) TYPE c,
            l_custom_container2 TYPE REF TO cl_gui_custom_container.
      l_tree_container_name = 'TREE2'.
      IF sy-batch IS INITIAL.
        CREATE OBJECT l_custom_container2
          EXPORTING
                container_name = l_tree_container_name
          EXCEPTIONS
                cntl_error                  = 1
                cntl_system_error           = 2
                create_error                = 3
                lifetime_error              = 4
                lifetime_dynpro_dynpro_link = 5.
        IF sy-subrc <> 0.
          MESSAGE x208(00) WITH 'ERROR'.                        "#EC NOTEXT
        ENDIF.
      ENDIF.
      CREATE OBJECT ro_grid
        EXPORTING
       I_SHELLSTYLE      = 0
       I_LIFETIME        =
          i_parent          = l_custom_container2
       I_APPL_EVENTS     = space
       I_PARENTDBG       =
       I_APPLOGPARENT    =
       I_GRAPHICSPARENT  =
       I_NAME            =
    EXCEPTIONS
       ERROR_CNTL_CREATE = 1
       ERROR_CNTL_INIT   = 2
       ERROR_CNTL_LINK   = 3
       ERROR_DP_CREATE   = 4
       others            = 5
      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 load_data_into_grid1.
      DATA: lt_unsel TYPE lvc_t_nkey,
            ls_unsel LIKE LINE OF lt_unsel.
      LOOP AT gt_checked INTO gs_checked.
        ls_unsel = gs_checked-nodekey.
        APPEND ls_unsel TO lt_unsel.
      ENDLOOP.
      CALL METHOD tree1->unselect_nodes
        EXPORTING
          it_node_key                  = lt_unsel
        EXCEPTIONS
          cntl_system_error            = 1
          dp_error                     = 2
          multiple_node_selection_only = 3
          error_in_node_key_table      = 4
          failed                       = 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.
    *CALL METHOD tree1->unselect_all
    EXCEPTIONS
       CNTL_SYSTEM_ERROR = 1
       FAILED            = 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.
      DATA: text TYPE lvc_value,
       item TYPE lvc_t_layi,
       node TYPE lvc_s_layn,
       inode TYPE lvc_nkey.
      FIELD-SYMBOLS: <wa> TYPE ANY.
      DATA: l_dref_wa LIKE LINE OF gt_sflight.
      ASSIGN l_dref_wa TO <wa>.
      READ TABLE gt_checked INTO gs_checked WITH KEY nodekey = 3.
      inode = gs_checked-nodekey.
      CALL METHOD tree1->get_outtab_line
        EXPORTING
          i_node_key     = inode
        IMPORTING
          e_outtab_line  = <wa>
          e_node_text    = text
          et_item_layout = item
          es_node_layout = node
        EXCEPTIONS
          node_not_found = 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.
      DATA: lt_layout TYPE lvc_t_laci,
            layout LIKE LINE OF lt_layout.
      layout-chosen = 'X'.
      layout-fieldname = tree1->c_hierarchy_column_name.
    ls_item_layout-chosen = 'X'.           "To give default checkbox value checked
      layout-class   = cl_gui_column_tree=>item_class_checkbox.
      layout-editable = 'X'.
    LAYOUT-U_CHOSEN = 'X'.
      APPEND layout TO lt_layout.
      CALL METHOD tree1->change_node
        EXPORTING
          i_node_key     = inode
          i_outtab_line  = <wa>
       IS_NODE_LAYOUT =
          it_item_layout =  lt_layout
       I_NODE_TEXT    =
       I_U_NODE_TEXT  =
        EXCEPTIONS
          node_not_found = 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.
    *CALL METHOD tree1->change_item
    EXPORTING
       i_node_key     = inode
       i_fieldname    = gs_checked-FIELDNAME
       i_data         = <wa>
       I_U_DATA       = ''
       IS_ITEM_LAYOUT = layout
    EXCEPTIONS
       NODE_NOT_FOUND = 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.
    *loop at lt_unsel into ls_unsel.
    *CALL METHOD tree1->update_checked_items
    EXPORTING
       i_node_key    = ls_unsel
       i_fieldname   = ''
       i_checked     = ''
    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.
    *endif.
    ENDFORM.                    " another_selection
    *&      Form  select_all
          text
    -->  p1        text
    <--  p2        text
    FORM select_all .
      CONSTANTS: c_x(1) TYPE c VALUE 'X'.
    *********Check box modifications.
      CALL METHOD tree1->delete_all_nodes
        EXCEPTIONS
          failed            = 1
          cntl_system_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.
    clear l_part_key.
    create hierarchy
      PERFORM create_hierarchy USING c_x.
      CALL METHOD tree1->expand_node
        EXPORTING
          i_node_key          = gt_node
       I_LEVEL_COUNT       = 1
          i_expand_subtree    = 'X'
        EXCEPTIONS
          failed              = 1
          illegal_level_count = 2
          cntl_system_error   = 3
          node_not_found      = 4
          cannot_expand_leaf  = 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.
    add own functioncodes to the toolbar
    perform change_toolbar.
    register events
    perform register_events.
    adjust column_width
    call method tree1->COLUMN_OPTIMIZE.
    ENDFORM.                    " select_all
    *&      Form  clear_all
          text
    -->  p1        text
    <--  p2        text
    FORM clear_all .
      CONSTANTS: c_x(1) TYPE c VALUE space.
    *********Check box modifications.
      CALL METHOD tree1->delete_all_nodes
        EXCEPTIONS
          failed            = 1
          cntl_system_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.
    create hierarchy
      PERFORM create_hierarchy USING c_x.
      CALL METHOD tree1->expand_node
        EXPORTING
          i_node_key          = gt_node
       I_LEVEL_COUNT       = 1
          i_expand_subtree    = 'X'
        EXCEPTIONS
          failed              = 1
          illegal_level_count = 2
          cntl_system_error   = 3
          node_not_found      = 4
          cannot_expand_leaf  = 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.
    ENDFORM.                    " clear_all
    *&      Form  delete_all
          text
    -->  p1        text
    <--  p2        text
    FORM delete_all .
    *********Check box modifications.
      CALL METHOD tree1->delete_all_nodes
        EXCEPTIONS
          failed            = 1
          cntl_system_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.                    " delete_all
    *&      Form  expand_all
          text
    -->  p1        text
    <--  p2        text
    FORM expand_all .
      CALL METHOD tree1->expand_node
        EXPORTING
          i_node_key          = gt_node
       I_LEVEL_COUNT       = 1
          i_expand_subtree    = 'X'
        EXCEPTIONS
          failed              = 1
          illegal_level_count = 2
          cntl_system_error   = 3
          node_not_found      = 4
          cannot_expand_leaf  = 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.
    ENDFORM.                    " expand_all
    *&      Form  collapse_all
          text
    -->  p1        text
    <--  p2        text
    FORM collapse_all .
      CALL METHOD tree1->collapse_all_nodes
        EXCEPTIONS
          failed            = 1
          cntl_system_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.                    " collapse_all
    *&      Form  load_data_into_grid
          text
    -->  p1        text
    <--  p2        text
    FORM load_data_into_grid .
      DATA:
      For parameter IS_VARIANT
          l_layout TYPE disvariant,
      gs_layout TYPE lvc_s_layo.
      DATA gi_sflight TYPE TABLE OF zsflight.
    Load data into the grid and display them
      l_layout-report = sy-repid.
      gs_layout-grid_title = 'Amits Test Program'.
      gs_layout-sel_mode = 'A'.
      SELECT *
       FROM zsflight
       INTO TABLE gi_sflight.
      CALL METHOD go_grid->set_table_for_first_display
        EXPORTING
          i_structure_name = 'SFLIGHT'
          is_layout        = gs_layout
          is_variant       = l_layout
          i_save           = 'A'
        CHANGING
          it_outtab        = gi_sflight.
    ENDFORM.                    " load_data_into_grid
    *&      Form  load_data_into_grid
          text
    -->  p1        text
    <--  p2        text
    FORM load_data_into_grid1.
      DATA:
      For parameter IS_VARIANT
          l_layout TYPE disvariant,
      gs_layout TYPE lvc_s_layo.
      DATA gi_sflight TYPE TABLE OF zapempl.
    Load data into the grid and display them
      l_layout-report = sy-repid.
      gs_layout-grid_title = 'Rams Test Program'.
      gs_layout-sel_mode = 'A'.
      SELECT *
       FROM zapempl
       INTO TABLE gi_sflight.
      CALL METHOD ro_grid->set_table_for_first_display
        EXPORTING
          i_structure_name = 'ZAPEMPL'
          is_layout        = gs_layout
          is_variant       = l_layout
          i_save           = 'A'
        CHANGING
          it_outtab        = gi_sflight.
    ENDFORM.                    " load_data_into_grid1
    *&      Form  build_header
          build table for html_header
    -->  p1        text
    <--  p2        text
    FORM build_comment USING
          pt_list_commentary TYPE slis_t_listheader
          p_logo             TYPE sdydo_value.
      DATA: ls_line TYPE slis_listheader.
    LIST HEADING LINE: TYPE H
      CLEAR ls_line.
      ls_line-typ  = 'H'.
    LS_LINE-KEY:  NOT USED FOR THIS TYPE
      ls_line-info = 'ALV-tree-demo: flight-overview'.          "#EC NOTEXT
      APPEND ls_line TO pt_list_commentary.
    STATUS LINE: TYPE S
      CLEAR ls_line.
      ls_line-typ  = 'S'.
      ls_line-key  = 'valid until'.                             "#EC NOTEXT
      ls_line-info = 'January 29 1999'.                         "#EC NOTEXT
      APPEND ls_line TO pt_list_commentary.
      ls_line-key  = 'time'.
      ls_line-info = '2.00 pm'.                                 "#EC NOTEXT
      APPEND ls_line TO pt_list_commentary.
    ACTION LINE: TYPE A
      CLEAR ls_line.
      ls_line-typ  = 'A'.
    LS_LINE-KEY:  NOT USED FOR THIS TYPE
      ls_line-info = 'actual data'.                             "#EC NOTEXT
      APPEND ls_line TO pt_list_commentary.
      p_logo = 'ENJOYSAP_LOGO'.
    ENDFORM.                    "build_comment
    *&      Form  create_hierarchy
          text
    -->  p1        text
    <--  p2        text
    FORM create_hierarchy USING p_x.
      DATA: ls_sflight TYPE sflight,
            lt_sflight TYPE sflight OCCURS 0.
    get data
      SELECT * FROM sflight INTO TABLE lt_sflight
                            UP TO 200 ROWS .
      SORT lt_sflight BY carrid connid fldate.
    add data to tree
      DATA: l_carrid_key TYPE lvc_nkey,
            l_connid_key TYPE lvc_nkey,
            l_last_key TYPE lvc_nkey.
           l_part_key TYPE lvc_nkey
      PERFORM add_carrid_line USING    ls_sflight
                              CHANGING l_part_key.
      gt_node = l_part_key.
      LOOP AT lt_sflight INTO ls_sflight.
        ON CHANGE OF ls_sflight-carrid.
          PERFORM add_carrid_line USING    ls_sflight
                                           l_part_key
                                  CHANGING l_carrid_key.
          PERFORM add_connid_line USING    ls_sflight
                                           l_carrid_key
                                  CHANGING l_connid_key.
          PERFORM add_complete_line USING  ls_sflight
                                         l_connid_key
                                         p_x
                                CHANGING l_last_key.
          CONTINUE.
        ENDON.
        ON CHANGE OF ls_sflight-connid.
          PERFORM add_connid_line USING    ls_sflight
                                           l_carrid_key
                                  CHANGING l_connid_key.
          PERFORM add_complete_line USING  ls_sflight
                                         l_connid_key
                                         p_x
                                CHANGING l_last_key.
          CONTINUE.
        ENDON.
        PERFORM add_complete_line USING  ls_sflight
                                         l_connid_key
                                         p_x
                                CHANGING l_last_key.
      ENDLOOP.
    calculate totals
      CALL METHOD tree1->update_calculations.
    this method must be called to send the data to the frontend
      CALL METHOD tree1->frontend_update.
    ENDFORM.                               " create_hierarchy
    *&      Form  add_carrid_line
          add hierarchy-level 1 to tree
         -->P_LS_SFLIGHT  sflight
         -->P_RELEATKEY   relatkey
        <-->p_node_key    new node-key
    FORM add_carrid_line USING     ps_sflight TYPE sflight
                                   p_relat_key TYPE lvc_nkey
                         CHANGING  p_node_key TYPE lvc_nkey.
      DATA: l_node_text TYPE lvc_value,
            ls_sflight TYPE sflight.
    set item-layout
      DATA: lt_item_layout TYPE lvc_t_layi,
            ls_item_layout TYPE lvc_s_layi.
      ls_item_layout-t_image = '@3P@'.
      ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
      ls_item_layout-style   =
                            cl_gui_column_tree=>style_intensifd_critical.
      APPEND ls_item_layout TO lt_item_layout.
    add node
      l_node_text =  ps_sflight-carrid.
      CALL METHOD tree1->add_node
        EXPORTING
          i_relat_node_key = p_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = l_node_text
          is_outtab_line   = ls_sflight
          it_item_layout   = lt_item_layout
        IMPORTING
          e_new_node_key   = p_node_key.
    ENDFORM.                               " add_carrid_line
    *&      Form  add_connid_line
          add hierarchy-level 2 to tree
         -->P_LS_SFLIGHT  sflight
         -->P_RELEATKEY   relatkey
        <-->p_node_key    new node-key
    FORM add_connid_line USING     ps_sflight TYPE sflight
                                   p_relat_key TYPE lvc_nkey
                         CHANGING  p_node_key TYPE lvc_nkey.
      DATA: l_node_text TYPE lvc_value,
            ls_sflight TYPE sflight.
    set item-layout
      DATA: lt_item_layout TYPE lvc_t_layi,
            ls_item_layout TYPE lvc_s_layi.
      ls_item_layout-t_image = '@3Y@'.
      ls_item_layout-style   =
                            cl_gui_column_tree=>style_intensified.
      ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
      APPEND ls_item_layout TO lt_item_layout.
    add node
      l_node_text =  ps_sflight-connid.
      CALL METHOD tree1->add_node
        EXPORTING
          i_relat_node_key = p_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = l_node_text
          is_outtab_line   = ls_sflight
          it_item_layout   = lt_item_layout
        IMPORTING
          e_new_node_key   = p_node_key.
    ENDFORM.                               " add_connid_line
    *&      Form  add_cmplete_line
          add hierarchy-level 3 to tree
         -->P_LS_SFLIGHT  sflight
         -->P_RELEATKEY   relatkey
        <-->p_node_key    new node-key
    FORM add_complete_line USING   ps_sflight TYPE sflight
                                   p_relat_key TYPE lvc_nkey
                                   p_x
                         CHANGING  p_node_key TYPE lvc_nkey.
      DATA: l_node_text TYPE lvc_value.
    set item-layout
      DATA: lt_item_layout TYPE lvc_t_layi,
            ls_item_layout TYPE lvc_s_layi.
      ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
      ls_item_layout-chosen = p_x.           "To give default checkbox value checked
      ls_item_layout-class   = cl_gui_column_tree=>item_class_checkbox.
      ls_item_layout-editable = 'X'.
      APPEND ls_item_layout TO lt_item_layout.
      l_node_text =  ps_sflight-fldate.
      CALL METHOD tree1->add_node
        EXPORTING
          i_relat_node_key = p_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          is_outtab_line   = ps_sflight
          i_node_text      = l_node_text
          it_item_layout   = lt_item_layout
        IMPORTING
          e_new_node_key   = p_node_key.
    ENDFORM.                               " add_complete_line
    *&      Form  register_events
          text
    -->  p1        text
    <--  p2        text
    FORM register_events.
    define the events which will be passed to the backend
      DATA: lt_events TYPE cntl_simple_events,
            l_event TYPE cntl_simple_event.
    define the events which will be passed to the backend
      l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
      APPEND l_event TO lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_checkbox_change.
      APPEND l_event TO lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
      APPEND l_event TO lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
      APPEND l_event TO lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
      APPEND l_event TO lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_header_click.
      APPEND l_event TO lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_item_keypress.
      APPEND l_event TO lt_events.
      CALL METHOD tree1->set_registered_events
        EXPORTING
          events                    = lt_events
        EXCEPTIONS
          cntl_error                = 1
          cntl_system_error         = 2
          illegal_event_combination = 3.
      IF sy-subrc <> 0.
        MESSAGE x208(00) WITH 'ERROR'.                          "#EC NOTEXT
      ENDIF.
    set Handler
      DATA: l_event_receiver TYPE REF TO lcl_tree_event_receiver.
      CREATE OBJECT l_event_receiver.
      SET HANDLER l_event_receiver->handle_node_ctmenu_request
                                                            FOR tree1.
      SET HANDLER l_event_receiver->handle_node_ctmenu_selected
                                                            FOR tree1.
      SET HANDLER l_event_receiver->handle_item_ctmenu_request
                                                            FOR tree1.
      SET HANDLER l_event_receiver->handle_item_ctmenu_selected
                                                            FOR tree1.
      SET HANDLER l_event_receiver->handle_checkbox_change FOR tree1.
    ENDFORM.                               " register_events
    *&      Form  change_toolbar
          text
    -->  p1        text
    <--  p2        text
    FORM change_toolbar.
    DATA: toolbar_event_receiver TYPE REF TO lcl_toolbar_event_receiver.
    get toolbar control
      CALL METHOD tree1->get_toolbar_object
        IMPORTING
          er_toolbar = mr_toolbar.
      CHECK NOT mr_toolbar IS INITIAL.
    add seperator to toolbar
      CALL METHOD mr_toolbar->add_button
        EXPORTING
          fcode     = ''
          icon      = ''
          butn_type = cntb_btype_sep
          text      = ''
          quickinfo = 'This is a Seperator'.                    "#EC NOTEXT
    add Standard Button to toolbar (for Delete Subtree)
      CALL METHOD mr_toolbar->add_button
        EXPORTING
          fcode     = 'DELETE'
          icon      = '@18@'
          butn_type = cntb_btype_button
          text      = ''
          quickinfo = 'Delete subtree'.                         "#EC NOTEXT
    add Dropdown Button to toolbar (for Insert Line)
      CALL METHOD mr_toolbar->add_button
        EXPORTING
          fcode     = 'INSERT_LC'
          icon      = '@17@'
          butn_type = cntb_btype_dropdown
          text      = ''
          quickinfo = 'Insert Line'.                            "#EC NOTEXT
    set event-handler for toolbar-control
      CREATE OBJECT toolbar_event_receiver.
      SET HANDLER toolbar_event_receiver->on_function_selected
                                                          FOR mr_toolbar.
      SET HANDLER toolbar_event_receiver->on_toolbar_dropdown
                                                          FOR mr_toolbar.
    ENDFORM.                               " change_toolbar
    *&      Form  init_tree
          text
    -->  p1        text
    <--  p2        text
    FORM init_tree.
    create fieldcatalog for structure sflight
      PERFORM build_fieldcatalog.
    create container for alv-tree
      DATA: l_tree_container_name(30) TYPE c,
            l_custom_container TYPE REF TO cl_gui_custom_container.
      l_tree_container_name = 'TREE1'.
      IF sy-batch IS INITIAL.
        CREATE OBJECT l_custom_container
          EXPORTING
                container_name = l_tree_container_name
          EXCEPTIONS
                cntl_error                  = 1
                cntl_system_error           = 2
                create_error                = 3
                lifetime_error              = 4
                lifetime_dynpro_dynpro_link = 5.
        IF sy-subrc <> 0.
          MESSAGE x208(00) WITH 'ERROR'.                        "#EC NOTEXT
        ENDIF.
      ENDIF.
    create tree control
      CREATE OBJECT tree1
        EXPORTING
            parent              = l_custom_container
            node_selection_mode = cl_gui_column_tree=>node_sel_mode_multiple "node_sel_mode_single
            item_selection      = 'X'
            no_html_header      = ''
            no_toolbar          = ''
        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.
      IF sy-subrc <> 0.
        MESSAGE x208(00) WITH 'ERROR'.                          "#EC NOTEXT
      ENDIF.
    create Hierarchy-header
      DATA l_hierarchy_header TYPE treev_hhdr.
      PERFORM build_hierarchy_header CHANGING l_hierarchy_header.
    create info-table for html-header
      DATA: lt_list_commentary TYPE slis_t_listheader,
            l_logo             TYPE sdydo_value.
      PERFORM build_comment USING
                     lt_list_commentary
                     l_logo.
    repid for saving variants
      DATA: ls_variant TYPE disvariant.
      ls_variant-report = sy-repid.
    create emty tree-control
      CALL METHOD tree1->set_table_for_first_display
        EXPORTING
          is_hierarchy_header = l_hierarchy_header
          it_list_commentary  = lt_list_commentary
          i_logo              = l_logo
          i_background_id     = 'ALV_BACKGROUND'
          i_save              = 'A'
          is_variant          = ls_variant
        CHANGING
          it_outtab           = gt_sflight "table must be emty !!
          it_fieldcatalog     = gt_fieldcatalog.
      CONSTANTS: c_s(1) TYPE c VALUE space.
    create hierarchy
      PERFORM create_hierarchy USING c_s.
    add own functioncodes to the toolbar
      PERFORM change_toolbar.
    register events
      PERFORM register_events.
    adjust column_width
    call method tree1->COLUMN_OPTIMIZE.
    ENDFORM.                    " init_tree
    Award points if found useful.
    Regards
    Indrajit

  • How to get Text for nodes in Tree Structure

    Hi Friends,
    How to get Text for nodes in Tree Structure
    REPORT  YFIIN_REP_TREE_STRUCTURE  no standard page heading.
                       I N I T I A L I Z A T I O N
    INITIALIZATION.
    AUTHORITY-CHECK OBJECT 'ZPRCHK_NEW' :
                      ID 'YFIINICD' FIELD SY-TCODE.
      IF SY-SUBRC NE 0.
        MESSAGE I000(yFI02) with SY-TCODE .
        LEAVE PROGRAM.
      ENDIF.
    class screen_init definition create private.
    Public section
      public section.
        class-methods init_screen.
        methods constructor.
    Private section
      private section.
        data: container1 type ref to cl_gui_custom_container,
              container2 type ref to cl_gui_custom_container,
              tree type ref to cl_gui_simple_tree.
        methods: fill_tree.
    endclass.
    Class for Handling Events
    class screen_handler definition.
    Public section
      public section.
        methods: constructor importing container
                   type ref to cl_gui_custom_container,
                 handle_node_double_click
                   for event node_double_click
                   of cl_gui_simple_tree
                   importing node_key .
    Private section
      private section.
    endclass.
    *&                        Classes implementation
    class screen_init implementation.
    *&                        Method INIT_SCREEN
      method init_screen.
        data screen type ref to screen_init.
        create object screen.
      endmethod.
    *&                        Method CONSTRUCTOR
      method constructor.
        data: events type cntl_simple_events,
              event like line of events,
              event_handler type ref to screen_handler.
        create object: container1 exporting container_name = 'CUSTOM_1',
                       tree exporting parent = container1
                         node_selection_mode =
                cl_gui_simple_tree=>node_sel_mode_multiple.
        create object: container2 exporting container_name = 'CUSTOM_2',
        event_handler exporting container = container2.
    event-eventid = cl_gui_simple_tree=>eventid_node_double_click.
        event-appl_event = ' '.   "system event, does not trigger PAI
        append event to events.
        call method tree->set_registered_events
             exporting events = events.
        set handler event_handler->handle_node_double_click for tree.
         call method: me->fill_tree.
      endmethod.
    *&                        Method FILL_TREE
      method fill_tree.
        data: node_table type table of abdemonode,
              node type abdemonode.
    types:    begin of tree_node,
              folder(50) type c,
              tcode(60) type c,
              tcode1(60) type c,
              tcode2(60) type c,
              text(60) type c,
              text1(60) type c,
              text2(60) type c,
              end of tree_node.
      data:  wa_tree_node type tree_node,
                t_tree_node type table of tree_node.
    wa_tree_node-folder = text-001.
    wa_tree_node-tcode  = text-002.
    wa_tree_node-text =  'Creditors ageing'.
    wa_tree_node-tcode1 = text-003.
    wa_tree_node-text1 =  'GR/IR aging'.
    wa_tree_node-tcode2 = text-004.
    wa_tree_node-text2 =  'Bank Balance'.
    append wa_tree_node to t_tree_node.
    clear wa_tree_node .
    wa_tree_node-folder = text-005.
    wa_tree_node-tcode  = text-006.
    wa_tree_node-text =  'Creditors ageing'.
    wa_tree_node-tcode1 = text-007.
    wa_tree_node-text1 =  'Creditors ageing'.
    wa_tree_node-tcode2 = text-008.
    wa_tree_node-text2 =  'Creditors ageing'.
    append wa_tree_node to t_tree_node.
    clear wa_tree_node .
    wa_tree_node-folder = text-009.
    wa_tree_node-tcode  = text-010.
    wa_tree_node-text =  'Creditors ageing'.
    wa_tree_node-tcode1 = text-011.
    wa_tree_node-text1 =  'Creditors ageing'.
    wa_tree_node-tcode2 = text-012.
    wa_tree_node-text2 =  'Creditors ageing'.
    append wa_tree_node to t_tree_node.
    clear wa_tree_node .
    node-hidden = ' '.                 " All nodes are visible,
        node-disabled = ' '.               " selectable,
        node-isfolder = 'X'.                                    " a folder,
        node-expander = ' '.               " have no '+' sign forexpansion.
        loop at t_tree_node into wa_tree_node.
          at new folder.
            node-isfolder = 'X'.                      " a folder,
            node-node_key = wa_tree_node-folder.
                   clear node-relatkey.
            clear node-relatship.
            node-text = wa_tree_node-folder.
            node-n_image =   ' '.
            node-exp_image = ' '.
            append node to node_table.
          endat.
         at new tcode .
            node-isfolder = ' '.                          " a folder,
            node-n_image =   '@CS@'.       "AV is the internal code
            node-exp_image = '@CS@'.       "for an airplane icon
            node-node_key = wa_tree_node-tcode.
             node-text = wa_tree_node-text .
                     node-relatkey = wa_tree_node-folder.
            node-relatship = cl_gui_simple_tree=>relat_last_child.
          endat.
          append node to node_table.
        at new tcode1 .
            node-isfolder = ' '.                          " a folder,
            node-n_image =   '@CS@'.       "AV is the internal code
            node-exp_image = '@CS@'.       "for an airplane icon
            node-node_key = wa_tree_node-tcode1.
                     node-relatkey = wa_tree_node-folder.
            node-relatship = cl_gui_simple_tree=>relat_last_child.
              node-text = wa_tree_node-text1.
         endat.
          append node to node_table.
           at new tcode2 .
            node-isfolder = ' '.                          " a folder,
            node-n_image =   '@CS@'.       "AV is the internal code
            node-exp_image = '@CS@'.       "for an airplane icon
            node-node_key = wa_tree_node-tcode2.
                     node-relatkey = wa_tree_node-folder.
            node-relatship = cl_gui_simple_tree=>relat_last_child.
            node-text = wa_tree_node-text2.
         endat.
          append node to node_table.
        endloop.
        call method tree->add_nodes
             exporting table_structure_name = 'ABDEMONODE'
                       node_table = node_table.
      endmethod.
    endclass.
    *&                        Class implementation
    class screen_handler implementation.
    *&                        Method CONSTRUCTOR
      method constructor.
       create object: HTML_VIEWER exporting PARENT = CONTAINER,
                      LIST_VIEWER exporting I_PARENT = CONTAINER.
      endmethod.
    *&                 Method HANDLE_NODE_DOUBLE_CLICK
      method handle_node_double_click.
      case node_key(12).
    when 'Creditors'.
    submit YFIIN_REP_CREADITORS_AGING  via selection-screen and return.
    when  'Vendor'.
    submit YFIIN_REP_VENDOR_OUTSTANDING  via selection-screen and return.
    when 'Customer'.
    submit YFIIN_REP_CUSTOMER_OUTSTANDING  via selection-screen and
    return.
    when 'GR/IR'.
    submit YFIIN_REP_GRIR_AGING  via selection-screen and return.
    when 'Acc_Doc_List'.
    submit YFIIN_REP_ACCOUNTINGDOCLIST  via selection-screen and return.
    when 'Bank Bal'.
    submit YFIIN_REP_BANKBALANCE  via selection-screen and return.
    when 'Ven_Cus_Dtl'.
    submit YFIIN_REP_VENDORCUST_DETAIL via selection-screen and return.
    when 'G/L_Open_Bal'.
    submit YFIIN_REP_OPENINGBALANCE via selection-screen and return.
    when 'Usr_Authn'.
    submit YFIIN_REP_USERAUTHRIZATION via selection-screen and return.
    endcase.
      endmethod.
    endclass.
    Program execution ************************************************
    load-of-program.
      call screen 9001.
    at selection-screen.
    Dialog Modules PBO
    *&      Module  STATUS_9001  OUTPUT
          text
    module status_9001 output.
      set pf-status 'SCREEN_9001'.
      set titlebar 'TIT_9001'.
      call method screen_init=>init_screen.
    endmodule.                 " STATUS_9001  OUTPUT
    Dialog Modules PAI
    *&      Module  USER_COMMAND_9001  INPUT
          text
    module user_command_9001 input.
    endmodule.                 " USER_COMMAND_9001  INPUT
    *&      Module  exit_9001  INPUT
          text
    module exit_9001 input.
    case sy-ucomm.
    when 'EXIT'.
      set screen 0.
    endcase.
    endmodule.
            exit_9001  INPUT

    you can read  the table node_table with nody key value which imports when docubble click the the tree node (Double clifk event).
    Regards,
    Gopi .
    Reward points if helpfull.

  • ALV report with dynamic columns, and repeated structure rows

    Hey Guys,
    I've done some ALV programming, but most of the reports were straight forward. This one is a little interesting. So here go the questions...
    Q1: Regarding Columns:
    What is the best way to code a report with columns being dynamic. This is one of the parameters the user is going to enter in his input.
    Q2: Regarding Rows:
    I want to repeat a structure(say it contains f1, f2, f3) multiple time in rows. What is the best way to do it? The labels for these fields have to appear in the first column.
    Below is the visual representation of the questions.
    Jan 06  , Feb 06, Mar 06....(dynamic)
       material 1
    Current Stock
    current required
    $Value of stock
       material 2
    Current Stock
    current required
    $Value of stock
       material 3
    Current Stock
    current required
    $Value of stock
    Thanks for your help.
    Sumit.

    Hi Sumit,
    Just check this sample from one of the SAP site
    ABAP Code Sample for Dynamic Table for ALV with Cell Coloring
    Applies To:
    ABAP / ALV Grid
    Article Summary
    ABAP Code Sample that uses dynamic programming techniques to build a dynamic internal table for display in an ALV Grid with Cell Coloring.
    Code Sample
    REPORT zcdf_dynamic_table.
    * Dynamic ALV Grid with Cell Coloring.
    * Build a field catalog dynamically and provide the ability to color
    * the cells.
    * To test, copy this code to any program name and create screen 100
    * as described in the comments. After the screen is displayed, hit
    * enter to exit the screen.
    * Tested in 4.6C and 6.20
    * Charles Folwell - [email protected] - Feb 2, 2005
    DATA:
    r_dyn_table TYPE REF TO data,
    r_wa_dyn_table TYPE REF TO data,
    r_dock_ctnr TYPE REF TO cl_gui_docking_container,
    r_alv_grid TYPE REF TO cl_gui_alv_grid,
    t_fieldcat1 TYPE lvc_t_fcat, "with cell color
    t_fieldcat2 TYPE lvc_t_fcat, "without cell color
    wa_fieldcat LIKE LINE OF t_fieldcat1,
    wa_cellcolors TYPE LINE OF lvc_t_scol,
    wa_is_layout TYPE lvc_s_layo.
    FIELD-SYMBOLS:
    <t_dyn_table> TYPE STANDARD TABLE,
    <wa_dyn_table> TYPE ANY,
    <t_cellcolors> TYPE lvc_t_scol,
    <w_field> TYPE ANY.
    START-OF-SELECTION.
    * Build field catalog based on your criteria.
    wa_fieldcat-fieldname = 'FIELD1'.
    wa_fieldcat-inttype = 'C'.
    wa_fieldcat-outputlen = '10'.
    wa_fieldcat-coltext = 'My Field 1'.
    wa_fieldcat-seltext = wa_fieldcat-coltext.
    APPEND wa_fieldcat TO t_fieldcat1.
    wa_fieldcat-fieldname = 'FIELD2'.
    wa_fieldcat-inttype = 'C'.
    wa_fieldcat-outputlen = '10'.
    wa_fieldcat-coltext = 'My Field 2'.
    wa_fieldcat-seltext = wa_fieldcat-coltext.
    APPEND wa_fieldcat TO t_fieldcat1.
    * Before adding cell color table, save fieldcatalog to pass
    * to ALV call. The ALV call needs a fieldcatalog without
    * the internal table for cell coloring.
    t_fieldcat2[] = t_fieldcat1[].
    * Add cell color table.
    * CALENDAR_TYPE is a structure in the dictionary with a
    * field called COLTAB of type LVC_T_SCOL. You can use
    * any structure and field that has the type LVC_T_SCOL.
    wa_fieldcat-fieldname = 'T_CELLCOLORS'.
    wa_fieldcat-ref_field = 'COLTAB'.
    wa_fieldcat-ref_table = 'CALENDAR_TYPE'.
    APPEND wa_fieldcat TO t_fieldcat1.
    * Create dynamic table including the internal table
    * for cell coloring.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
    it_fieldcatalog = t_fieldcat1
    IMPORTING
    ep_table = r_dyn_table
    EXCEPTIONS
    generate_subpool_dir_full = 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.
    * Get access to new table using field symbol.
    ASSIGN r_dyn_table->* TO <t_dyn_table>.
    * Create work area for new table.
    CREATE DATA r_wa_dyn_table LIKE LINE OF <t_dyn_table>.
    * Get access to new work area using field symbol.
    ASSIGN r_wa_dyn_table->* TO <wa_dyn_table>.
    * Get data into table from somewhere. Field names are
    * known at this point because field catalog is already
    * built. Read field names from the field catalog or use
    * COMPONENT <number> in a DO loop to access the fields. A
    * simpler hard coded approach is used here.
    ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    <w_field> = 'ABC'.
    ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    <w_field> = 'XYZ'.
    APPEND <wa_dyn_table> TO <t_dyn_table>.
    ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    <w_field> = 'TUV'.
    ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    <w_field> = 'DEF'.
    APPEND <wa_dyn_table> TO <t_dyn_table>.
    * Color cells based on your criteria. In this example, a test on
    * FIELD2 is used to decide on color.
    LOOP AT <t_dyn_table> INTO <wa_dyn_table>.
    ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table> TO <w_field>.
    * Get access to internal table used to color cells.
    ASSIGN COMPONENT 'T_CELLCOLORS'
    OF STRUCTURE <wa_dyn_table> TO <t_cellcolors>.
    CLEAR wa_cellcolors.
    wa_cellcolors-fname = 'FIELD2'.
    IF <w_field> = 'DEF'.
    wa_cellcolors-color-col = '7'.
    ELSE.
    wa_cellcolors-color-col = '5'.
    ENDIF.
    APPEND wa_cellcolors TO <t_cellcolors>.
    MODIFY <t_dyn_table> FROM <wa_dyn_table>.
    ENDLOOP.
    * Display screen. Define screen 100 as empty, with next screen
    * set to 0 and flow logic of:
    * PROCESS BEFORE OUTPUT.
    * MODULE initialization.
    * PROCESS AFTER INPUT.
    CALL SCREEN 100.
    * MODULE initialization OUTPUT
    MODULE initialization OUTPUT.
    * Set up for ALV display.
    IF r_dock_ctnr IS INITIAL.
    CREATE OBJECT r_dock_ctnr
    EXPORTING
    side = cl_gui_docking_container=>dock_at_left
    ratio = '90'.
    CREATE OBJECT r_alv_grid
    EXPORTING i_parent = r_dock_ctnr.
    * Set ALV controls for cell coloring table.
    wa_is_layout-ctab_fname = 'T_CELLCOLORS'.
    * Display.
    CALL METHOD r_alv_grid->set_table_for_first_display
    EXPORTING
    is_layout = wa_is_layout
    CHANGING
    it_outtab = <t_dyn_table>
    it_fieldcatalog = t_fieldcat2.
    ELSE. "grid already prepared
    * Refresh display.
    CALL METHOD r_alv_grid->refresh_table_display
    EXPORTING
    i_soft_refresh = ' '
    EXCEPTIONS
    finished = 1
    OTHERS = 2.
    ENDIF.
    ENDMODULE. " initialization OUTPUT
    Regards
    vijay

  • WDA:  Tree structure in web dynpro for ABAP

    Hi,
    I am trying to build a tree structure with information something like the following:
    Country
    State
    City
    I used the UI Element "Tree" and I was successful in building it. The only problem is that it supports only one column in each row like name.
    I need multiple columns in each row like Name and population.
    1) Is there any solution for this using UI element "Tree" only?
    2)I checked that there is Table tree UI element, but I could not figure out how I could use it for hierarchial structure like that of my requirement? Can I use it? Is there any example application with hierarchial structure?
    3)For tree UI element, any node that is not directly below context node has to be non-singleton. It will lead to adverse performance. Is there any solution for this?
    Thanks in advance.
    Regards,
    Srini.

    Hi Srinivasa,
    In the context, please create a node DATA with the following fields:
    KEY type string
    PARENT type string
    LOCATION type string
    POPULATION type string (or "I" if you happen to have numbers only without a unit like "k" for "thousand").
    Then please create a table with a TreeByKeyTableColumn namde LOCATION and an additional TableColumn called POPULATION. Now please add a TextView cell editor to both and bind the text value of each of them to the attributes LOCATION and POPULATION of the context node DATA. Last step is to bind the attribtues rowKey and parentRowKey(?) to the KEY and the PARENT attributes. This concludes the design time part.
    Next step is to fill the node DATA with actual data. Just use a supply function and do it like this:
    First entry:
    KEY = 'WORLD'.
    PARENT = ''.
    LOCATION = 'World'.
    POPULATION = '4 billion'.
    Second entry:
    KEY = 'DE'.
    PARENT = 'WORLD'.
    LOCATION = 'Germany'.
    POPULATION = '80 million'.
    You should now see a table with a tree at the left column that looks like:
    <pre>
      World        4 billion
       ->Germany   80 million
    </pre>
    Kind regards,
    Thomas
    Message was edited by: Thomas Szuecs

  • Tree structure in f4 help

    Hi experts,
    can any one give me sample code for providing tree structure in f4help.  like object part field have in iw21 transaction
    Regards
    reddy

    Hi Muttukundu,
    SAP has provided a lot of sample programs for developing tree structures. Just go to SE38, type BCALVTREE and hit F4. You'll get different sample programs with a range of operations on trees
    Go through the link,
    http://www.sapdevelopment.co.uk/reporting/alv/alvtree.htm
    Slowly check this code..you will get idea of how to develop tree structure.
    REPORT y_hierarchies_in_tables
    NO STANDARD PAGE HEADING.
    PARAMETER: g_group TYPE grpname. " DEFAULT 'Z_GLAB0000'.
    DATA:
    g_setid TYPE setid,
    g_class TYPE setclass.
    DATA: lt_hier TYPE STANDARD TABLE OF sethier,
    lt_val TYPE STANDARD TABLE OF setvalues.
    DATA: hier LIKE sethier OCCURS 0 WITH HEADER LINE,
    val LIKE setvalues OCCURS 0 WITH HEADER LINE,
    setinfo LIKE setinfo OCCURS 0 WITH HEADER LINE.
    DATA: zaccbas(20) TYPE c OCCURS 0 WITH HEADER LINE.
    DATA: miss_val LIKE setvalues-from OCCURS 0 WITH HEADER LINE.
    DATA: table_name TYPE tabname,
    field_name TYPE setfld.
    DATA: ambiguity_flag TYPE c.
    Ambiguity check
    PERFORM ambiguity_check.
    Display Records
    PERFORM display_records.
    *& Form AMBIGUITY_CHECK
    Ambiguity check
    FORM ambiguity_check .
    DATA: it_abaplist LIKE abaplist OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF it_ascilist OCCURS 0,
    zeile(256) TYPE c,
    END OF it_ascilist.
    DATA: flag.
    SUBMIT rgsovl00 "VIA SELECTION-SCREEN
    WITH p_shrtn = g_group
    WITH path = 'X'
    EXPORTING LIST TO MEMORY
    AND RETURN.
    CALL FUNCTION 'LIST_FROM_MEMORY'
    TABLES
    listobject = it_abaplist
    EXCEPTIONS
    not_found = 1
    OTHERS = 2.
    CALL FUNCTION 'LIST_TO_ASCI'
    TABLES
    listasci = it_ascilist
    listobject = it_abaplist
    EXCEPTIONS
    empty_list = 1
    list_index_invalid = 2
    OTHERS = 3 .
    LOOP AT it_ascilist.
    IF it_ascilist-zeile = text-001.
    flag = 'X'.
    ENDIF.
    IF flag = 'X' AND
    it_ascilist-zeile = text-002.
    ambiguity_flag = 'X'.
    CLEAR flag.
    ENDIF.
    ENDLOOP.
    FREE MEMORY.
    ENDFORM. " AMBIGUITY_CHECK
    *& Form DISPLAY_RECORDS
    Display the Records
    FORM display_records .
    PERFORM get_records.
    PERFORM header_data.
    PERFORM item_data.
    ENDFORM. " DISPLAY_RECORDS
    *& Form GET_RECORDS
    Get all the Node values
    FORM get_records .
    Get the ID name for the Hierarchy
    CALL FUNCTION 'G_SET_GET_ID_FROM_NAME'
    EXPORTING
    shortname = g_group
    setclass = g_class
    old_setid = g_setid
    IMPORTING
    new_setid = g_setid.
    Get the Table and Field name for the Top Node
    CALL FUNCTION 'G_SET_GET_INFO'
    EXPORTING
    setname = g_setid
    no_set_title = 'X'
    use_table_buffer = 'X'
    IMPORTING
    info = setinfo.
    table_name = setinfo-tabname.
    field_name = setinfo-fld.
    Get all the Nodes for the Hierarchy
    CALL FUNCTION 'G_SET_TREE_IMPORT'
    EXPORTING
    no_descriptions = ' '
    no_rw_info = 'X'
    setid = g_setid
    TABLES
    set_hierarchy = lt_hier
    set_values = lt_val.
    hier[] = lt_hier.
    val[] = lt_val.
    SELECT (field_name) FROM (table_name) INTO TABLE zaccbas.
    LOOP AT zaccbas.
    READ TABLE val WITH KEY FROM = zaccbas.
    IF sy-subrc = 0.
    DELETE zaccbas.
    CLEAR zaccbas.
    DELETE val INDEX sy-tabix.
    CLEAR val.
    ENDIF.
    ENDLOOP.
    ENDFORM. " GET_RECORDS
    *& Form HEADER_DATA
    Header Data
    FORM header_data .
    DATA: desc TYPE settext.
    READ TABLE hier WITH KEY fieldname = field_name
    shortname = g_group.
    IF sy-subrc = 0.
    desc = hier-descript.
    ENDIF.
    SKIP.
    WRITE: 'Node :',g_group.
    WRITE:75 'User name :', sy-uname.
    WRITE:/ 'Description :', desc.
    WRITE:75 'Date:', sy-datum.
    WRITE:/ 'Table Name :' , table_name.
    WRITE:75 'Time:', sy-timlo.
    WRITE:/ 'Field Name :', field_name.
    write:75 'Client:', SY-MANDT.
    skip.
    IF ambiguity_flag = 'X'.
    WRITE:/ 'Ambiguity Check :'. WRITE: 'Success' COLOR 5.
    ELSE.
    WRITE:/ 'Ambiguity Check :'. WRITE: 'Failed' COLOR 6 .
    ENDIF.
    WRITE:/ sy-uline.
    WRITE:/37 'Validation for Hierarchy'.
    WRITE:/ sy-uline.
    ENDFORM. " HEADER_DATA
    *& Form ITEM_DATA
    Output Report for Nodes
    FORM item_data .
    IF NOT zaccbas[] IS INITIAL.
    WRITE:/ 'Missing Records from Hierarchy' COLOR 3.
    LOOP AT zaccbas.
    WRITE:/ zaccbas.
    ENDLOOP.
    ENDIF.
    IF NOT val[] IS INITIAL.
    SKIP 1.
    WRITE:/ 'Additional Records in Hierarchy' COLOR 3.
    LOOP AT val.
    WRITE:/ val-from. ", 28 val-DESCRIPT.
    ENDLOOP.
    ELSEIF ZACCBAS[] IS INITIAL.
    WRITE:/ 'No Missing Records Found' COLOR 3.
    ENDIF.
    ENDFORM. " ITEM_DATA
    Reward if found helpfull,
    Cheers,
    Chaitanya.

  • ALV Tree Structure

    Hi All,
           Is there any Function module to display the output in a ALV tree structure( like parent node --> child nodes)
    Thanx in advance,
    Regards,
    Ravi

    Hi kranthi,
    1. Its quite simple.
    2. Basically there are TWO FMs,
    which do the job.
    3. just copy paste in new program
    and u will know the whole logic.
    4.
    REPORT abc.
    DATA : tr LIKE TABLE OF snodetext WITH HEADER LINE.
    data
    tr-id = '1'.
    tr-tlevel = 1.
    tr-name = 'amit'.
    APPEND tr.
    tr-id = '2'.
    tr-tlevel = 2.
    tr-name = 'mittal'.
    APPEND tr.
    display
    CALL FUNCTION 'RS_TREE_CONSTRUCT'
    TABLES
    nodetab = tr
    EXCEPTIONS
    tree_failure = 1
    OTHERS = 4.
    CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
    regards,
    amit m.

  • Tree structure format in report.

    Hi all,
    I have got a report to develop where in i have to display the ouptut of the report
    in a tree structure.Can anybody tell me how to proceed with this ??     This  is
    basically an interactive report where clicking on one of the node will take us to
    another page.
    Thanks and Regards.
    syed.

    HI
    Refer this code.
    REPORT YMS_ALVTREEDEMO .
    *Data Declaration
    TABLES: ekko.
    TYPE-POOLS: slis. "ALV Declarations
    TYPES: BEGIN OF t_ekko,
    ebeln TYPE ekpo-ebeln,
    ebelp TYPE ekpo-ebelp,
    statu TYPE ekpo-statu,
    aedat TYPE ekpo-aedat,
    matnr TYPE ekpo-matnr,
    menge TYPE ekpo-menge,
    meins TYPE ekpo-meins,
    netpr TYPE ekpo-netpr,
    peinh TYPE ekpo-peinh,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
    it_ekpo TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
    it_emptytab TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
    wa_ekko TYPE t_ekko,
    wa_ekpo TYPE t_ekko.
    DATA: ok_code like sy-ucomm, "OK-Code
    save_ok like sy-ucomm.
    *ALV data declarations
    DATA: fieldcatalog TYPE lvc_t_fcat WITH HEADER LINE.
    DATA: gd_fieldcat TYPE lvc_t_fcat,
    gd_tab_group TYPE slis_t_sp_group_alv,
    gd_layout TYPE slis_layout_alv.
    *ALVtree data declarations
    CLASS cl_gui_column_tree DEFINITION LOAD.
    CLASS cl_gui_cfw DEFINITION LOAD.
    DATA: gd_tree TYPE REF TO cl_gui_alv_tree,
    gd_hierarchy_header TYPE treev_hhdr,
    gd_report_title TYPE slis_t_listheader,
    gd_logo TYPE sdydo_value,
    gd_variant TYPE disvariant.
    *Create container for alv-tree
    DATA: l_tree_container_name(30) TYPE c,
    l_custom_container TYPE REF TO cl_gui_custom_container.
    *Includes
    *INCLUDE ZDEMO_ALVTREEO01. "Screen PBO Modules
    *INCLUDE ZDEMO_ALVTREEI01. "Screen PAI Modules
    *INCLUDE ZDEMO_ALVTREEF01. "ABAP Subroutines(FORMS)
    *Start-of-selection.
    START-OF-SELECTION.
    ALVtree setup data
    PERFORM data_retrieval.
    PERFORM build_fieldcatalog.
    PERFORM build_layout.
    PERFORM build_hierarchy_header CHANGING gd_hierarchy_header.
    PERFORM build_report_title USING gd_report_title gd_logo.
    PERFORM build_variant.
    Display ALVtree report
    call screen 100.
    *& Form DATA_RETRIEVAL
    Retrieve data into Internal tables
    FORM data_retrieval.
    SELECT ebeln
    UP TO 10 ROWS
    FROM ekko
    INTO corresponding fields of TABLE it_ekko.
    loop at it_ekko into wa_ekko.
    SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
    FROM ekpo
    appending TABLE it_ekpo
    where ebeln eq wa_ekko-ebeln.
    endloop.
    ENDFORM. " DATA_RETRIEVAL
    *& Form BUILD_FIELDCATALOG
    Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
    Please not there are a number of differences between the structure of
    ALVtree fieldcatalogs and ALVgrid fieldcatalogs.
    For example the field seltext_m is replace by scrtext_m in ALVtree.
    fieldcatalog-fieldname = 'EBELN'. "Field name in itab
    fieldcatalog-scrtext_m = 'Purchase Order'. "Column text
    fieldcatalog-col_pos = 0. "Column position
    fieldcatalog-outputlen = 15. "Column width
    fieldcatalog-emphasize = 'X'. "Emphasize (X or SPACE)
    fieldcatalog-key = 'X'. "Key Field? (X or SPACE)
    fieldcatalog-do_sum = 'X'. "Sum Column?
    fieldcatalog-no_zero = 'X'. "Don't display if zero
    APPEND fieldcatalog TO gd_fieldcat.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'EBELP'.
    fieldcatalog-scrtext_m = 'PO Iten'.
    fieldcatalog-outputlen = 15.
    fieldcatalog-col_pos = 1.
    APPEND fieldcatalog TO gd_fieldcat..
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'STATU'.
    fieldcatalog-scrtext_m = 'Status'.
    fieldcatalog-outputlen = 15.
    fieldcatalog-col_pos = 2.
    APPEND fieldcatalog TO gd_fieldcat..
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'AEDAT'.
    fieldcatalog-scrtext_m = 'Item change date'.
    fieldcatalog-outputlen = 15.
    fieldcatalog-col_pos = 3.
    APPEND fieldcatalog TO gd_fieldcat..
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'MATNR'.
    fieldcatalog-scrtext_m = 'Material Number'.
    fieldcatalog-outputlen = 15.
    fieldcatalog-col_pos = 4.
    APPEND fieldcatalog TO gd_fieldcat..
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'MENGE'.
    fieldcatalog-scrtext_m = 'PO quantity'.
    fieldcatalog-outputlen = 15.
    fieldcatalog-col_pos = 5.
    APPEND fieldcatalog TO gd_fieldcat..
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'MEINS'.
    fieldcatalog-scrtext_m = 'Order Unit'.
    fieldcatalog-outputlen = 15.
    fieldcatalog-col_pos = 6.
    APPEND fieldcatalog TO gd_fieldcat..
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'NETPR'.
    fieldcatalog-scrtext_m = 'Net Price'.
    fieldcatalog-outputlen = 15.
    fieldcatalog-col_pos = 7.
    fieldcatalog-datatype = 'CURR'.
    APPEND fieldcatalog TO gd_fieldcat..
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'PEINH'.
    fieldcatalog-scrtext_m = 'Price Unit'.
    fieldcatalog-outputlen = 15.
    fieldcatalog-col_pos = 8.
    APPEND fieldcatalog TO gd_fieldcat..
    CLEAR fieldcatalog.
    ENDFORM. " BUILD_FIELDCATALOG
    *& Form BUILD_LAYOUT
    Build layout for ALV grid report
    FORM build_layout.
    gd_layout-no_input = 'X'.
    gd_layout-colwidth_optimize = 'X'.
    gd_layout-totals_text = 'Totals'(201).
    gd_layout-totals_only = 'X'.
    gd_layout-f2code = 'DISP'. "Sets fcode for when double
    "click(press f2)
    gd_layout-zebra = 'X'.
    gd_layout-group_change_edit = 'X'.
    gd_layout-header_text = 'helllllo'.
    ENDFORM. " BUILD_LAYOUT
    *& Form build_hierarchy_header
    build hierarchy-header-information
    -->P_L_HIERARCHY_HEADER structure for hierarchy-header
    FORM build_hierarchy_header CHANGING
    p_hierarchy_header TYPE treev_hhdr.
    p_hierarchy_header-heading = 'Hierarchy Header'(013).
    p_hierarchy_header-tooltip = 'This is the Hierarchy Header !'(014).
    p_hierarchy_header-width = 30.
    p_hierarchy_header-width_pix = ''.
    ENDFORM. " build_hierarchy_header
    *& Form BUILD_REPORT_TITLE
    Build table for ALVtree header
    <-> p1 Header details
    <-> p2 Logo value
    FORM build_report_title CHANGING
    pt_report_title TYPE slis_t_listheader
    pa_logo TYPE sdydo_value.
    DATA: ls_line TYPE slis_listheader,
    ld_date(10) TYPE c.
    List Heading Line(TYPE H)
    CLEAR ls_line.
    ls_line-typ = 'H'.
    ls_line-key "Not Used For This Type(H)
    ls_line-info = 'PO ALVTree Display'.
    APPEND ls_line TO pt_report_title.
    Status Line(TYPE S)
    ld_date(2) = sy-datum+6(2).
    ld_date+2(1) = '/'.
    ld_date3(2) = sy-datum4(2).
    ld_date+5(1) = '/'.
    ld_date+6(4) = sy-datum(4).
    ls_line-typ = 'S'.
    ls_line-key = 'Date'.
    ls_line-info = ld_date.
    APPEND ls_line TO pt_report_title.
    Action Line(TYPE A)
    CLEAR ls_line.
    ls_line-typ = 'A'.
    CONCATENATE 'Report: ' sy-repid INTO ls_line-info SEPARATED BY space.
    APPEND ls_line TO pt_report_title.
    ENDFORM.
    *& Form BUILD_VARIANT
    Build variant
    form build_variant.
    Set repid for storing variants
    gd_variant-report = sy-repid.
    endform. " BUILD_VARIANT
    Check these programs.
    e.g
    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
    RSDEMO_DRAG_DROP_TREE_MULTI
    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
    Reward all helpfull answers.
    Regards.
    Jay

  • Complex Tree Structure Query

    Hi,
    I have a table which contains the hierarchial data upto 4 levels. I needed to have the information of all the four levels in a row, so I created 3 tree structured views and one another view using the tree structured views as below
    --To get the great grand parent id for the children*
    CREATE OR REPLACE VIEW VR_PO_TREE AS
    SELECT LEVEL pathlength,
    connect_by_root partner_organization_id root_po,
    partner_organization_id,
    partner_common_name,
    partner_organization_type
    FROM partner_organization po
    START WITH po.org_entity_above_id IS NULL
    CONNECT BY PRIOR po.partner_organization_id = po.org_entity_above_id
    ORDER BY po.partner_organization_id;
    -- level 2 (grant parent) id
    CREATE OR REPLACE VIEW VR_PO_AREA_TR AS
    SELECT LEVEL pathlength,
    connect_by_root partner_organization_id root_po,
    partner_organization_id,
    partner_common_name,
    partner_organization_type
    FROM partner_organization vcpo
    START WITH vco.partner_organization_type = 'AREA'
    CONNECT BY PRIOR vcpo.partner_organization_id = vcpo.org_entity_above_id
    ORDER BY vcpo.partner_organization_id;
    --level 3 (parent) id*
    CREATE OR REPLACE VIEW VR_PO_REGION_TREE AS
    SELECT LEVEL pathlength,
    connect_by_root partner_organization_id root_po,
    vcpo.partner_organization_id,
    vcpo.partner_common_name,
    vcpo.partner_type
    FROM partner_organization vcpo
    START WITH vcpo.partner_organization_type = 'REGION'
    CONNECT BY PRIOR vcpo.partner_organization_id = vcpo.org_entity_above_id
    ORDER BY vcpo.partner_organization_id;
    ---and finally created a view to have all the levels in a single row
    CREATE OR REPLACE VIEW VR_PO_ALL_TREE AS
    SELECT pot.pathlength,
    po.partner_organization_id,
    po.partner_common_name,
    pot.root_po int_partner_org_id,
    pot.intl_po_name int_partner_common_name,
    vpat.root_po area_partner_org_id,
    vpat.area_po_name area_partner_common_name,
    vprt.root_po region_partner_org_id,
    vprt.region_po_name region_partner_common_name
    FROM partner_organization po
    JOIN vr_po_tree pot
    ON pot.partner_organization_id = po.partner_organization_id
    LEFT outer JOIN vr_po_area_tr vpat
    ON vpat.partner_organization_id = po.partner_organization_id
    LEFT OUTER JOIN vr_po_region_tree vprt
    ON vprt.partner_organization_id = po.partner_organization_id;
    All the views are working fine, very fast, giving the expected output.
    if we make a join to the view vr_po_all_tree in a query that also works fine. However, if we make an outer join to a query that has the join to vr_po_all_tree, Oracle throws an internal error - Ora-00600 internal error codes, arguments [qrctce1], [0],[0],.....
    Is the view vr_po_all_tree is cause for this problem?, in such a case can any one help me to rewrite the view with a simple query to give the same results?
    Thanks in advance.
    Nattu
    Edited by: Nattu on Nov 26, 2009 8:25 PM
    Edited by: Nattu on Nov 27, 2009 11:48 AM
    Edited by: Nattu on Nov 27, 2009 11:55 AM

    Hi,
    if we make a join to the view vr_po_all_tree in a query that also works fine. However, if we make an outer join to a query that has the join to vr_po_all_tree, Oracle throws an internal error - Ora-00600 internal error codes, arguments [qrctce1], [0],[0],.....
    Is the view vr_po_all_tree is cause for this problem?As Sven said, ORA-00600 is the sign of some low-level problem, and you should seek a solution from Oracle support. Your views are not the cause of this problem; most likely, the views trigger something that would not be a problem except for a installatin problem or maybe a bug.
    We can try to find a work-around for you, but don't ignore the problem.
    in such a case can any one help me to rewrite the view with a simple query to give the same results?It seems very likely that you could do something that didn't involve so many CONNECT BYs and outer joins.
    Post some sample data (CREATE TABLE and INSERT statements) and the results you want from that data.
    Simplify as much as possible. For example, in the first view you say:
    CREATE OR REPLACE VIEW VR_PO_TREE AS
    SELECT LEVEL pathlength,
    connect_by_root partner_organization_id root_po,
    connect_by_root partner_common_name intl_po_name,
    connect_by_root is_wbti is_wbti,
    connect_by_root is_sil_int is_sil_int,
    connect_by_root organization_entity_code int_org_entity_code,
    org_entity_above_id, partner_organization_id,
    partner_organization_type,
    sys_connect_by_path(partner_organization_id, '\') po_path_id,
    sys_connect_by_path(partner_common_name, '\') po_path_name
    FROM ...That is, you're selecting 1 pseudo-column (LEVEL), 4 CONNECT_BY_ROOTs, 3 plain columns, and 2 SYS_CONNECT_BY_PATHs.
    Can you post a problem with just one of each: 1 pseudo-column, 1 CONNECT_BY_ROOT, 1 plain column, and 1 SYS_CONNECT_BY_PATH?  Adding the others later should be easy.
    Any information you can give about the data would be helpful.
    In particular,
    (a) Can org_entity_above be NULL on the same row where partner_organization_type is 'AREA' or 'REGION'?
    (b) How many ancestors with partner_organization_type = 'AREA' Can a node have? 1? No more than 1?  1 or more? 0 or more?
    (c) Same for 'REGION'.  How many ancestors with partner_organization_type = 'REGION' Can a node have? 1? No more than 1?  1 or more? 0 or more?
    (d) Can a node with partner_organization_type = 'REGION' be the ancestor of a row with partner_organization_type = 'AREA'?
    (e) Other way around: can a node with partner_organization_type = 'AREA' be the ancestor of a row with partner_organization_type = 'REGION'?
    Some of these questions may seem silly to you, because you know the table and the data so well.  I don't, so you'll have to explain things.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to get Tree structure in JSP page?

    Hi,
    I would like get data from the database and display the data in tree structure with the check boxes at each nodes on a jsp page with out using any third party tools. how can i do that? Do i require any new tags to fulfill this requirement?
    can any one help me out by sending any example code?
    thanks in advance.
    Regards,
    Reddy

    Once you have the data in a list or something, can't you just use <c:forEach> and then output standard nested <ul> and <li> tags to give the tree structure.
    <html>
         <style>
              li
                   list-style-type:none;
         </style>
         <body>
              <form>
                   <ul>
                        <li>
                             <input type="checkbox">Check 1</input>
                             <ul>
                                  <li>
                                       <input type="checkbox">Check 1A</input>
                                  </li>
                                  <li>
                                       <input type="checkbox">Check 1B</input>
                                  </li>
                             </ul>
                        </li>
                        <li>
                             <input type="checkbox">Check 2</input>
                             <ul>
                                  <li>
                                       <input type="checkbox">Check 2A</input>
                                  </li>
                             </ul>
                        </li>
                        <li>
                             <input type="checkbox">Check 3</input>
                        </li>
                   </ul>
              </form>
         </body>
    </html>

  • How to populate Tree structure from BAPI while tree grows or shrinks

    Hi All
    Currently I am populating the tree structure from BAPI based on the HLevel (Hierarchy  Level) parameter, but when ever insertion and deletion happens in the tree at any level in the UI and at the same time i am updating these tree node values with HLevel value(example : 1 is first level , 2 is second level, 3 is third level etc)  updating successfully& correctly  into the BAPI, no issues.
    Once it is updated into the BAPI, next time when i refreshed the UI then i am not populating the tree structure correctly from BAPI with updated new nodes based on the HLevel. when tree struture grows or shrinks in the BAPI after updating into BAPI from UI then i am not populating the tree sturcture correctly based on the HLevel value from the BAPI.
    Please let me know any sample code how to populate tree structure correctly when tree structure grows or shrinks based on the HLevel value ( Hierarchy Level , for example : 1 is level , 2 is 2nd level , 3 is third level nodes etc)
    anybody helps in this regard with sample code on the populating tree tructure then it would be great help to me.
    Thanks in advance
    Regards
    Kalki Reddy
    Edited by: KalkiReddy on Nov 29, 2009 3:48 PM

    Bapi output node:
    Value     | Text     | HLevel
    01     | A     | 1               
    0101     | AA       | 2
    010101     | AAA     | 3
    01010B     | AAB     | 3
    0102     | AB     | 2
    02     | B     | 1
    0201     | BA        | 2
    This code is used to build the tree in wdDoInit method
         IE_T_CatalogueNode catalogueNode = wdContext.nodeE_T_Catalogue();
         int size = catalogueNode.size();
         ICatalogoElement level1elem = null;
         for (int i = 0; i < size; i ++)
              IE_T_CatalogueElement catalogueElem = catalogueNode.getE_T_CatalogueElementAt(i);
              if (catalogueElem.getLevel().equals("1"))
                   // 1 Livello
                   level1elem = wdContext.createCatalogoElement();
                   level1elem.setKATALOGART_CODE(catalogueElem.getKatalogart());
                   level1elem.setCODEGRUPPE_CODE(catalogueElem.getCodegruppe());
                   level1elem.setCODE(catalogueElem.getCode());
                   level1elem.setCODE_DESCR(catalogueElem.getKatalogart_Descr());
                   level1elem.setDESCR(catalogueElem.getKatalogart_Descr());
                   wdContext.nodeCatalogo().addElement(level1elem);
                   for (int j = i + 1; j < size; j ++)
                        IE_T_CatalogueElement catalogueElem2level =
                                                 catalogueNode.getE_T_CatalogueElementAt( j );
                        String level2 = catalogueElem2level.getLevel();
                        if (level2.equals("2"))
                             ICatalogoElement level2elem = level1elem.nodeChild().createCatalogoElement();
                             level2elem.setKATALOGART_CODE(catalogueElem2level.getKatalogart());
                             level2elem.setCODEGRUPPE_CODE(catalogueElem2level.getCodegruppe());
                             level2elem.setCODE(catalogueElem2level.getCode());
                             level2elem.setCODE_DESCR(catalogueElem2level.getCodegruppe_Descr());
                             level2elem.setDESCR(catalogueElem2level.getCodegruppe_Descr());
                             level1elem.nodeChild().addElement(level2elem);
                             for (int k = j + 1; k < size; k ++)
                                  IE_T_CatalogueElement catalogueElem3level =
                                                           catalogueNode.getE_T_CatalogueElementAt( k );
                                  String level3 = catalogueElem3level.getLevel();
                                  if (level3.equals("3"))
                                       ICatalogoElement level3elem = level2elem.nodeChild().createCatalogoElement();
                                       level3elem.setKATALOGART_CODE(catalogueElem3level.getKatalogart());
                                       level3elem.setCODEGRUPPE_CODE(catalogueElem3level.getCodegruppe());
                                       level3elem.setCODE(catalogueElem3level.getCode());
                                       level3elem.setCODE_DESCR(catalogueElem3level.getCode_Descr());
                                       level3elem.setDESCR(catalogueElem3level.getCode_Descr());
                                       level2elem.nodeChild().addElement(level3elem);
    Damiano

Maybe you are looking for