ALV Tree (Fixed Columns)

Hi,
I'm currently working on a program using ALV Tree (cl_gui_alv_tree) and I need to have fixed columns other than the hierarchy column (columns which cannot be scrolled).  I tried editing the field catalog but it's not working.  Is it also possible to make single cells editable in the ALV tree?
Thanks a lot.
Bonn Mendoza

Hi,
I think the method  SET_HEIGHT of class CL_GUI_ALV_TREE can be used to set the heights of various controls. Just try for columns in your case.
Else as you are looking for column with special function, we have an expansion column but is available in hierarchical-sequential list.
For this you need to use class CL_SALV_COLUMNS_HIERSEQ
there are 2 methods in this class
SET_EXPAND_COLUMN and GET_EXPAND_COLUMN.
As far as second query is concerned go through the below link
http://help.sap.com/download/documentation/additional/getstart/ecc50/GettingStarted_ECC50_EN.pdf
Regards
Khushboo

Similar Messages

  • How to identify column name in ALV tree when user clicks a particular field

    Hi All,
    In My requirement i am displaying ALV Tree.
    In Which When the user clicks on a particular header column it should navigate to other transaction.
    Now the issue is it is navigating to other transaction when we click on any column of the header row.
    But, the user requires only for particular column .
    Is there any method  to catch the field name in CLASS 'CL_GUI_ALV_TREE'.
    Regards,
    Bhanu.R

    Check out for CUCOL system field.
    Regards,
    Lalit Mohan Gupta.

  • Average sum for a column in ALV tree layout

    Hi,
    I've trying to set an average sum for a column in an ALV tree report.  In the field catalog i set the DO_SUM field to 'X' and this will do a total sum, but I can't find out how in the code to do the average sum.
    Also to get round this I was going to just set a default display variant with the "average" sum option saved after i had manually selected the columns and set it to this.  Problem with this is that when i re-run it, the sum comes back as a total rather than an average.  I have tried setting display variants on the SAP example ALV tree programs and the same thing happens.
    Does anyone know how i can get round this?
    Cheers
    Matt.

    Hi,
    In addition to setting DO_SUM = 'X' you need to specify function in H_FTYPE field. It should be set to 'AVG' in your case.
    ls_fielcat-do_sum = 'X'.
    ls_fieldcat-h_ftype = 'AVG.

  • How to avoid blank column display in output in ALV TREE

    how to avoid blank column display in output while decreasing the length of other columns in ALV Tree.
    Example: please refer to BCALV_TREE_01 and see the output, then decrease the length of all columns . Then you can see a blank column appearing in screen at last, i.e in container. so how to avoid that.
    Thanks for reply.
    Edited by: morpeous on Jul 1, 2009 1:53 PM

    Hi,
    Check BCALV_TREE_02 on how to hide columns.
    Thanks & Regards,
    Anand Patil

  • Coloring column in an ALV tree

    Hi all,
    What I want to do is set background color for columns in a tree-view ALV(class cl_gui_alv_tree). However no matter how I set the field EMPHASIZE in the fieldcatalog internal table, the display of the ALV tree keeps unchange. Anyone can help me on this?
    Thanks,
    Chen Chang

    Hi,
    <b>If u want to change the node colr in ALV tree do as follows</b>
    Adding Root Nodes for the tree.
    Key:
    NODE_KEY, RELATKEY, RELATSHIP, HIDDEN, DISABLED, ISFOLDER, N_IMAGE,
    EXP_IMAGE, <b>STYLE</b>, LAST_HITEM, NO_BRANCH, EXPANDER, DRAGDROPID, TEXT
      perform f9101_node_list using: '1' 'ROOT' '' '' '' c_x '' '' '' '' ''
                              c_x '' text-003.
    Adding subitems for the root node.
      perform f9101_node_list using:
                            Material Details
                              'MATRL' '1' '' '' '' '' '' '' '' '' '' '' ''
                              text-001,
                            Document Details
                              'DOCU' '1' '' '' '' '' '' '' '' '' '' '' ''
                              text-002.
    form f9101_node_list using    value(pnodekey)
                                 value(prelatkey)
                                 value(prelatship)
                                 value(phidden)
                                 value(pdisabled)
                                 value(pisfolder)
                                 value(pimage)
                                 value(pexpimage)
                                 value(pstyle)
                                 value(plastitem)
                                 value(pnobranch)
                                 value(pexpander)
                                 value(pdragdropid)
                                 value(ptext).
      w_nodes-node_key   = pnodekey.
      w_nodes-relatkey   = prelatkey.
      w_nodes-relatship  = prelatship. "Natural number
      w_nodes-hidden     = phidden.
      w_nodes-disabled   = pdisabled.
      w_nodes-isfolder   = pisfolder.
      w_nodes-n_image    =  pimage.  "Icons / embedded bitmap
      w_nodes-exp_image  = pexpimage. "Icons / embedded bitmap
    <b>  w_nodes-style      = pstyle.</b>  w_nodes-last_hitem = plastitem. "Tree Control: Column Name / Item
      "Name
      w_nodes-no_branch  = pnobranch.
      w_nodes-expander   = pexpander.
      w_nodes-dragdropid = pdragdropid.
      w_nodes-text       = ptext.
      append w_nodes to i_nodes.
    endform.                    " f9101_node_list
    Try changing the style so that u can change the column color.
    If u want that in ALV grid
    1. different color in line of alv
    2. Coloring Cells/rows in ALV Grid.
    Got this from forum
    report .
    Use of colours in ALV grid (cell, line and column) *
    Table
    tables : mara.
    Type
    types : begin of ty_mara,
    matnr like mara-matnr,
    matkl like mara-matkl,
    counter(4) type n,
    free_text(15) type c,
    color_line(4) type c, " Line color
    color_cell type lvc_t_scol, " Cell color
    end of ty_mara.
    Structures
    data : wa_mara type ty_mara,
    wa_fieldcat type lvc_s_fcat,
    is_layout type lvc_s_layo,
    wa_color type lvc_s_scol.
    Internal table
    data : it_mara type standard table of ty_mara,
    it_fieldcat type standard table of lvc_s_fcat,
    it_color type table of lvc_s_scol.
    Variables
    data : okcode like sy-ucomm,
    w_alv_grid type ref to cl_gui_alv_grid,
    w_docking_container type ref to cl_gui_docking_container.
    parameters : p_column as checkbox,
    p_line as checkbox,
    p_cell as checkbox.
    at selection-screen output.
    perform get_data.
    perform fill_catalog.
    if w_docking_container is initial.
    perform create_objects.
    endif.
    *& Form create_objects
    form create_objects.
    create object w_docking_container
    exporting
    ratio = 60
    exceptions
    cntl_error = 1
    cntl_system_error = 2
    create_error = 3
    lifetime_error = 4
    lifetime_dynpro_dynpro_link = 5
    others = 6.
    create object w_alv_grid
    exporting
    i_parent = w_docking_container.
    Field that identify color line in internal table
    move 'COLOR_LINE' to is_layout-info_fname.
    Field that identify cell color in inetrnal table
    move 'COLOR_CELL' to is_layout-ctab_fname.
    call method w_alv_grid->set_table_for_first_display
    exporting
    is_layout = is_layout
    changing
    it_outtab = it_mara
    it_fieldcatalog = it_fieldcat
    exceptions
    invalid_parameter_combination = 1
    program_error = 2
    too_many_lines = 3
    others = 4.
    endform.
    *& Form get_data
    form get_data.
    select * from mara up to 5 rows.
    clear : wa_mara-color_line, wa_mara-color_cell.
    move-corresponding mara to wa_mara.
    add 1 to wa_mara-counter.
    move 'Blabla' to wa_mara-free_text.
    if wa_mara-counter = '0002'
    and p_line = 'X'.
    Color line move 'C410' to wa_mara-color_line.
    elseif wa_mara-counter = '0004'
    and p_cell = 'X'.
    Color cell
    move 'FREE_TEXT' to wa_color-fname.
    move '6' to wa_color-color-col.
    move '1' to wa_color-color-int.
    move '1' to wa_color-color-inv.
    append wa_color to it_color.
    wa_mara-color_cell[] = it_color[].
    endif.
    append wa_mara to it_mara.
    endselect.
    endform.
    *& Form fill_catalog
    form fill_catalog.
    Colour code : *
    Colour is a 4-char field where : *
    - 1st char = C (color property) *
    - 2nd char = color code (from 0 to 7) *
    0 = background color *
    1 = blue *
    2 = gray *
    3 = yellow *
    4 = blue/gray *
    5 = green *
    6 = red *
    7 = orange *
    - 3rd char = intensified (0=off, 1=on) *
    - 4th char = inverse display (0=off, 1=on) *
    Colour overwriting priority : *
    1. Line *
    2. Cell *
    3. Column *
    data : w_position type i value '1'.
    clear wa_fieldcat.
    move w_position to wa_fieldcat-col_pos.
    move 'MATNR' to wa_fieldcat-fieldname.
    move 'MARA' to wa_fieldcat-ref_table.
    move 'MATNR' to wa_fieldcat-ref_field.
    append wa_fieldcat to it_fieldcat.
    add 1 to w_position.
    clear wa_fieldcat.
    move w_position to wa_fieldcat-col_pos.
    move 'MATKL' to wa_fieldcat-fieldname.
    move 'MARA' to wa_fieldcat-ref_table.
    move 'MATKL' to wa_fieldcat-ref_field.
    Color column
    if p_column = 'X'.
    move 'C610' to wa_fieldcat-emphasize.
    endif.
    append wa_fieldcat to it_fieldcat.
    add 1 to w_position.
    clear wa_fieldcat.
    move w_position to wa_fieldcat-col_pos.
    move 'COUNTER' to wa_fieldcat-fieldname.
    move 'N' to wa_fieldcat-inttype.
    move '4' to wa_fieldcat-intlen.
    move 'Counter' to wa_fieldcat-coltext.
    append wa_fieldcat to it_fieldcat.
    add 1 to w_position.
    clear wa_fieldcat.
    move w_position to wa_fieldcat-col_pos.
    move 'FREE_TEXT' to wa_fieldcat-fieldname.
    move 'C' to wa_fieldcat-inttype.
    move '20' to wa_fieldcat-intlen.
    move 'Text' to wa_fieldcat-coltext.
    append wa_fieldcat to it_fieldcat.
    endform.
    Check this link to get code for different colors http://www.sapdesignguild.org/resources/ma_guidelines/VisualDesignRules/colors.html
    Try this out the same thing will work for Reuse also.
    Thanks & Regards,
    Judith.
    Message was edited by: Judith Jessie Selvi

  • ALV printed in batch with fixed columns

    Hi,
    I am trying to print an ALV List report in a batch job. Fixed column widths and a filter on the layout was a requirement, so I have a layout variant as part of the initial selection screen and my batch variant.
    When I print online, it looks great. When I print through batch, the font is much bigger and the rows wrap. Is there a way to print using a layout variant for ALV list in batch?
    Thanks!

    Hi,
    When you execute an ALV List through a Job, the Output Settings are determined by the Printer settings that are set for the Output device that you have selected while creating the backgorund job. so i suggest you will have to look at those settings and make the changes occordingly or change the output device that you select.
    regards,
    Mahesh

  • ALV Tree/Grid: maximum columns

    Hello.
    How many columns can have a maximum of ALV Tree/Grid?
    Thanks.
    P.S. Sorry, self-solved: OO ALV : Maximum number of columns, Daixiong Jiang.

    Hello Emir
    Call the static method <b>cl_gui_cfw=>set_new_okcode</b> with your required ok-code. The short description of this methods says <i>"Be careful: This sets a new Fcode in Eventhandler for PAI",</i> exactly what you want.
    Regards
       Uwe

  • Get subtotal value of different column of different root_node in alv tree

    Dear All,
    I am working on hierarchical alv tree and using class "cl_gui_alv_tree"
    CALL METHOD g_alv_tree->update_calculations is providing subtotal
    I want to get  subtotal value for different node(based on node key) and different column
    i am using following method
    CALL METHOD g_alv_tree->GET_OUTTAB_LINE(if I am passing pamater "node key" it is returning column name with '0' value,not exact subtotal value)
    Thanks and regards in advance. Edited by: Gyanendra Dubey on Jan 26, 2012 7:55 AM
    Edited by: Gyanendra Dubey on Jan 26, 2012 8:03 AM

    Hi Dubey,
    We are currently facing similar issue, would you be able to share your solution?
    CALL METHOD g_alv_tree->GET_OUTTAB_LINE is returning 0 value for the subtotal.
    Thank you.

  • ALV Not Fix a Column for specific SAP GUI

    Hello Team.
    we have a little problem when We try Fix a Column.
    We create an ALV report, for user with the SAP GUI 7.20
    ls_dispo-FIX_COLUMN   = 'X'.
    Some user has the Patch Level 4 and the fix column work Fine.
    Other has the Patch Level 7, and when the user move the scroll bar, the fixed column not work.
    I think Some Difference in parameter configuration in SAP GUI is the problem,
    Can you help me.
    Best Regards

    Hi David
    I am not sure this might be a solution if you have mentioned all the parameters programatically but you can try if this works
    You can compare the Options between the users GUI
    Goto ->Customize Local Layout ( Alt + F12 ) on your Logon Screen-> Options
    and check if there is any change between these two Patch Levels.
    Thanks
    Dev

  • To display complete Column as Pushbottons in Simple ALV Tree

    Hi Everybody,
    Are pushbuttons possible in Simple ALV Tree?
    If yes, Can anybody help me in displaying one of the Columns in ALV Tree as Pushbuttons.
    Sample Code for this would also be appreciated.
    Thanks in Advance.
    Regards,
    Arshad

    Hi,
    Check this out.
    http://help.sap.com/saphelp_erp2004/helpdata/en/88/387f380c2f2e3ce10000009b38f8cf/content.htm
    Reward if helpful.
    Regards,
    Ramya

  • Editing of a  Column of ALV Tree(OOPS) node

    is it possible to edit a column of node of ALV tree.
    i am using ALV class "CL_GUI_ALV_TREE".
    After searching existing threads, for the same issue..i found the following.
    1) Editable Tree ALV
      ( displays pop up window where user can change values and then transfer these changes back to ALV tree)
    2) Editable Field in ALV TREE Display Using OOPs
         (this approach is not working for ALV Tree)
    But i want to edit directly coulmn of a node of ALV tree.
    is it possible in  OOPS ALV Tree?
    if it possible, can any one provide the sample code,

    As you already noticed, this is not possible, but you may edit your fields outside the tree and bring your changes back to tree. I struggled with the same once but eventually used described alternative. If you use saplink you may check upgrade [chain and rename|http://code.google.com/p/saplink-chain-and-rename/downloads/list] where this approach is released. The code is free so you will be able to study and copy whatever you need from it.
    Editing in a pop up is also an alternative here.
    Regards
    Marcin

  • ALV Tree, Expanded node do not show data in certain column

    Hi all,
    I need your help regard to below problem.
    I have an ALV grid in which one of the columns has F4 (search help). If search help is called by pressing a F4 button a dialog box will be shown with ALV tree on it.
    The ALV Tree has 2 columns which are: hierarchy column and one other column called WBS column. At the first show, all expanded node show data contained in WBS column, but if I click to expand a collapsed node, data is not shown in WBS column for the new expanded rows, only shows data in hierarchy column. How to show data in WBS column for the new expanded rows..?
    Basically if at the first show I expand all node, data in WBS column are shown for all rows. It seems that the Expand Node event doesn't update all column data to be shown.
    Please share if anyone of you has faced this kind of problem. Thank you.
    Regards,
    Ramses Hutahaean
    Edited by: Ramses Hutahaean on Feb 29, 2012 1:38 PM

    Hi Fenja,
    as the click-events only raise the node_key (at least I couldn't detect another information), I assume the only way is maintaining an internal helper table by yourself which you build up in parallel when creating the tree and its nodes.
    The (hashed) table might contain 2 columns:
    1. node_key (as table key)
    2. reference to an object
    When a click-event is raised, you look up the corresponding object reference in your table.
    Regards,
    Ulrich

  • Edit the column in ALV tree

    Hi Experts ,
                          I want to edit the column contents in a ALV tree and the save the content . I am using CL_ALV_gui_tree class to build the tree structure.please help on this
    With regards
    RKM

    Hi,
    In the field catalog internal table ,
    Fcat-edit  = 'X'.
    This makes the particular field as editable mode. append to field catelog internal table.
    include into your internal table.
    in the structure.
       types: cellstyles type lvc_t_styl.
    call this class
    class lcl_event_handlers definition.
      public section.
        methods:handle_button_click for event button_click of cl_gui_alv_grid
                                                              importing  es_row_no.   " METHOD TO HANDLE PUSH BUTTON
    endclass.                "lcl_event_handlers DEFINITION
    class lcl_event_handlers implementation.
    method handle_button_click.
    perform handle_button_click using   es_row_no .   " ACTION TO BE PERFORMED WHEN CLICKING ON PUSH BUTTON
    endmethod.
    layout :
    gs_layout-stylefname = 'CELLSTYLES'.
    endclass.
    ls_style-fieldname = 'BUTTON'.
    ls_style-style = cl_gui_alv_grid=>mc_style_button.
    append ls_style to wa_str-cellstyles.
    ***********button name
       wa_str-button = 'SAVE'.
       modify it_str from wa_str transporting button.

  • ALV Tree - Color Specific Column based on value in that cell?

    Hi Forums,
    I have searched the forum and I am unable to find the answer to my question.
    I am using an ALV tree and I would like to color a cell RED is the value in the cell is negative.
    I have set my field catalog to many different emphasize numbers and no luck either?
      CLEAR ls_fieldcatalog.
      ls_fieldcatalog-fieldname  = 'ORG_TXT'.
      ls_fieldcatalog-coltext    = text-d02.
      ls_fieldcatalog-scrtext_m  = text-d02.
      ls_fieldcatalog-col_pos    = 2.
      ls_fieldcatalog-outputlen  = '30'.
      ls_fieldcatalog-no_out     = 'X'.
      ls_fieldcatalog-emphasize  = 5.
      APPEND ls_fieldcatalog TO et_fieldcatalog.
    I am using 
        gr_alv_tree_control  TYPE REF TO cl_gui_alv_tree
    as my class to display my tree and I have found no methods that would set the color in there either?
    What else could be checked?

    To those interested, i was able to color the TEXT of a First coloumn of the TREE. Using this code:
    That said it will not work without BOTH
           ls_layout_item-fieldname = gr_alv_tree_control->c_hierarchy_column_name.
          ls_layout_item-style   =
                               cl_gui_column_tree=>style_intensifd_critical.
        IF ls_vip_display-vip_diff_tot > 0.
           ls_layout_item-fieldname = gr_alv_tree_control->c_hierarchy_column_name.
          ls_layout_item-style   =
                               cl_gui_column_tree=>style_intensifd_critical.
        ENDIF.
        IF ls_vip_display-vip_diff > 0.
          ls_layout_item-style   =
                               cl_gui_column_tree=>style_intensifd_critical.
        ENDIF.
        ls_layout_item-t_image = '@GZ@'.
        ls_layout_item-style   =
                            cl_gui_column_tree=>style_intensifd_critical.
        APPEND ls_layout_item TO lt_layout_item.
    *   add leaf nodes
        CALL METHOD gr_alv_tree_control->add_node
          EXPORTING
            i_relat_node_key     = lv_parent_id
            i_relationship       = cl_gui_column_tree=>relat_last_child
            i_node_text          = lv_node_text
            is_outtab_line       = ls_vip_display
            it_item_layout       = lt_layout_item
            is_node_layout       = ls_node_layout
          IMPORTING
            e_new_node_key       = lv_new_key
          EXCEPTIONS
            relat_node_not_found = 1
            node_not_found       = 2
            OTHERS               = 3.
    Anybody else who can shed some light to why both are needed OR possibly how I can change the position of the colored text to a different cell?
    Edited by: Keith Warnock on Feb 9, 2011 6:48 PM

  • Unable to expand child links in ALV Tree

    Hi,
    I have written the following code for ALV Tree using function modules.
    REPORT  ZSID_ALV_TREE.
    type pool declarations for tree
    TYPE-POOLS : fibs,stree.
    tables: ekko.
    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:w_repid type sy-cprog.
    *Data declaration for additional node information
    DATA : t_node TYPE snodetext.
    *Internal table and wa decl for nodes
    DATA : it_node LIKE TABLE OF t_node INITIAL SIZE 0,
           wa_node LIKE t_node.
    *Start of selection event
    START-OF-SELECTION.
    *Select the data for tree
    PERFORM fetch_data.
    *Build the hierarchy for tree
    PERFORM build_hierarchy.
    *Build Tree for display
    PERFORM build_tree.
    *& Form fetch_data
    text
    --> p1 text
    <-- p2 text
    FORM fetch_data .
      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.
    *& Form build_hierarchy
    text
    --> p1 text
    <-- p2 text
    FORM build_hierarchy .
    *Building the nodes and hierarchy for tree
    CLEAR : it_node[], wa_node.
    wa_node-type = 'T'.
    wa_node-name = 'Product Hierarchy Level'.
    wa_node-tlevel = '01'.
    wa_node-nlength = '35'.
    wa_node-color = '4'.
    wa_node-text = 'Test'.
    wa_node-tlength ='20'.
    wa_node-tcolor = 3.
    APPEND wa_node TO it_node.
    CLEAR wa_node.
    loop at it_ekpo into wa_ekpo.
    wa_node-type = 'P'.
    wa_node-name = 'Purchasing Doc'.
    wa_node-tlevel = '02'.
    wa_node-nlength = '25'.
    wa_node-color = '4'.
    wa_node-text = wa_ekpo-ebeln.
    wa_node-tlength ='20'.
    wa_node-tcolor = 3.
    APPEND wa_node TO it_node.
    CLEAR wa_node.
    *Filling the values of internal table into tree
    wa_node-type = 'P'.
    wa_node-name = 'Material No'.
    wa_node-tlevel = '03'.
    wa_node-nlength = '20'.
    wa_node-color = '1'.
    wa_node-text = wa_ekpo-matnr.
    wa_node-tlength ='20'.
    wa_node-tcolor = 4.
    APPEND wa_node TO it_node.
    CLEAR wa_node.
    ENDLOOP.
    ENDFORM. " build_hierarchy
    *& Form build_tree
    text
    --> p1 text
    <-- p2 text
    FORM build_tree .
    *Fm for constructing the tree
    CALL FUNCTION 'RS_TREE_CONSTRUCT'
    TABLES
    nodetab = it_node.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    w_repid = SY-CPROG.
    *FM for displaying the tree
                    CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
                     EXPORTING
                       CALLBACK_PROGRAM                = w_repid
                      CALLBACK_USER_COMMAND           = 'USER1_COMMAND'
                      CALLBACK_TEXT_DISPLAY           =
                      CALLBACK_MOREINFO_DISPLAY       =
                      CALLBACK_COLOR_DISPLAY          =
                      CALLBACK_TOP_OF_PAGE            =
                      CALLBACK_GUI_STATUS             =
                      CALLBACK_CONTEXT_MENU           =
                      STATUS                          = 'IMPLICIT'
                       CHECK_DUPLICATE_NAME            = '0'
                       COLOR_OF_NODE                   = '4'
                       COLOR_OF_MARK                   = '3'
                       COLOR_OF_LINK                   = '1'
                       COLOR_OF_MATCH                  = '5'
                       LOWER_CASE_SENSITIVE            = 'X'
                       MODIFICATION_LOG                = 'X'
                       NODE_LENGTH                     = 40
                       TEXT_LENGTH                     = 75
                       TEXT_LENGTH1                    = 0
                       TEXT_LENGTH2                    = 0
                       RETURN_MARKED_SUBTREE           = 'X'
                       SCREEN_START_COLUMN             = 0
                       SCREEN_START_LINE               = 0
                       SCREEN_END_COLUMN               = 0
                       SCREEN_END_LINE                 = 0
                       SUPPRESS_NODE_OUTPUT            = 'X'
                      LAYOUT_MODE                     = ' '
                       USE_CONTROL                     = 'L'.
                    IMPORTING
                      F15                             =
    ENDFORM. " build_tree
    FORM USER1_COMMAND TABLES node        STRUCTURE seucomm
                                 USING command
                             CHANGING value(exit)
                                     VALUE(LIST_REFRESH).
    write 'Hi'.
    endform.
    But I have a problem
    1.  I can expand the child links in tree structure when I comment the exporting parameter CALLBACK_USER_COMMAND in the function Module  'RS_TREE_LIST_DISPLAY'.
    2 But when i uncomment the exporting parameter I am unable to expand the child links in output.
    Please let me know if i have missed something in the code.
    Useful answers will be rewarded
    Regards,
    Siddharth

    Hi Sidhhart,
    Check out this prog.
    REPORT Z_KULDEEP_ALV_HIERARCHY
    message-id zord
    line-size 270.
    Tables:
      Vbap,
      Vbak.
    *& PROGRAM VARIABLES
    type-pools slis.
    *& INTERNAL TABLES & STRUCTURES
    data:
      begin of t_header occurs 0,
        EXPCOL type c,
        vbeln type vbak-vbeln,
        audat type vbak-audat,
        vkorg type vbak-vkorg,
        vtweg type vbak-vtweg,
        spart type vbak-spart,
      end of t_header,
      begin of t_item occurs 0,
        vbeln type vbap-vbeln,
        posnr type vbap-posnr,
        matnr type vbap-matnr,
        arktx type vbap-arktx,
        pstyv type vbap-pstyv,
      end of t_item,
      t_fieldcat type standard table of slis_fieldcat_alv with header line,
      t_event    type standard table of slis_alv_event with header line,
      x_keyinfo  type slis_keyinfo_alv,
      x_layout   type slis_layout_alv,
      x_variant  like disvariant.
    *& GLOBAL VARIABLES
      data:
        g_repid    type sy-repid,
        g_formname type slis_formname value 'TOP_OF_PAGE'.
    *& SELECTION SCREEN                                                    *
    selection-screen begin of block a with frame title text-000.
      Select-options : s_date for vbak-audat obligatory.
       p_date type vbak-audat.
    selection-screen end of block a.
    *& INITIALIZATION                                                      *
    initialization.
      clear : g_repid,t_header,t_item.
      refresh : t_header,t_item.
      g_repid = sy-repid.
    *& AT SELECTION-SCREEN                                                 *
    at selection-screen.
      if s_date-high > sy-datum.
        message e001.
      endif.
    start-of-selection.
      select vbeln audat vkorg vtweg spart from vbak
      into corresponding fields of table t_header
      where audat in s_date.
      select vbeln posnr matnr arktx pstyv from vbap
      into table t_item
      for all entries in t_header
      where vbeln = t_header-vbeln.
    end-of-selection.
      perform sub_display_alv.
    *&      Form  sub_display_alv
          text
    -->  p1        text
    <--  p2        text
    form sub_display_alv.
    *column 1
      perform sub_populate_fieldcatalog using:
          'VBELN'                             " field name
          'T_HEADER'                          " table name
          'ORDER'                             " column heading
          '8'                                 " column width
          ' '                                 " fix column?
          ' '                                 " key
          ' '                                 " no display
          ' '                                 " sum this column
          'X'                                 " do not sum
          ' '                                 " input allowed?
          ' '                                 " currenct type field name
          ' '                                 " data type
          'X'.                                 " hotspot.
    *column 2
        perform sub_populate_fieldcatalog  using:
          'AUDAT'                             " field name
          'T_HEADER'                          " table name
          'ORDERDATE'                         " column heading
          '10'                                " column width
          ' '                                 " fix column?
          ' '                                 " key
          ' '                                 " no display
          ' '                                 " sum this column
          'X'                                 " do not sum
          ' '                                 " input allowed?
          ' '                                 " currenct type field name
          ' '                                 " data type
          'X'.                                 " hotspot.
    *column 3
      perform sub_populate_fieldcatalog using:
          'VKORG'                             " field name
          'T_HEADER'                          " table name
          'SALES ORG'                         " column heading
          '6'                                 " column width
          ' '                                 " fix column?
          ' '                                 " key
          ' '                                 " no display
          ' '                                 " sum this column
          'X'                                 " do not sum
          ' '                                 " input allowed?
          ' '                                 " currenct type field name
          ' '                                 " data type
          'X'.                                 " hotspot.
    *column 4
      perform sub_populate_fieldcatalog  using:
          'VTWEG'                             " field name
          'T_HEADER'                          " table name
          'DIVISION'                          " column heading
          '2'                                 " column width
          ' '                                 " fix column?
          ' '                                 " key
          ' '                                 " no display
          ' '                                 " sum this column
          'X'                                 " do not sum
          ' '                                 " input allowed?
          ' '                                 " currenct type field name
          ' '                                 " data type
          'X'.                                 " hotspot.
    *column 5
      perform sub_populate_fieldcatalog  using:
          'SPART'                             " field name
          'T_HEADER'                          " table name
          'CHANNEL'                             " column heading
          '4'                                " column width
          ' '                                 " fix column?
          ' '                                 " key
          ' '                                 " no display
          ' '                                 " sum this column
          'X'                                 " do not sum
          ' '                                 " input allowed?
          ' '                                 " currenct type field name
          ' '                                 " data type
          'X'.                                 " hotspot.
    *column 6
    perform sub_populate_fieldcatalog using:
         'vbeln'                             " field name
         'T_item'                            " table name
         'Order'                             " column heading
         '8'                                 " column width
         ' '                                 " fix column?
         ' '                                 " key
         ' '                                 " no display
         ' '                                 " sum this column
         'X'                                 " do not sum
         ' '                                 " input allowed?
         ' '                                 " currenct type field name
         ' '                                 " data type
         'X'.                                 " hotspot.
    *column 7
      perform sub_populate_fieldcatalog using:
          'POSNR'                             " field name
          'T_ITEM'                            " table name
          'SALES DOC.ITEM'                    " column heading
          '8'                                 " column width
          ' '                                 " fix column?
          ' '                                 " key
          ' '                                 " no display
          ' '                                 " sum this column
          'X'                                 " do not sum
          ' '                                 " input allowed?
          ' '                                 " currenct type field name
          ' '                                 " data type
          'X'.                                 " hotspot.
    *column 8
      perform sub_populate_fieldcatalog using:
          'MATNR'                             " field name
          'T_ITEM'                            " table name
          'MATERIAL'                          " column heading
          '8'                                 " column width
          ' '                                 " fix column?
          ' '                                 " key
          ' '                                 " no display
          ' '                                 " sum this column
          'X'                                 " do not sum
          ' '                                 " input allowed?
          ' '                                 " currenct type field name
          ' '                                 " data type
          'X'.                                 " hotspot.
    *column 9
      perform sub_populate_fieldcatalog using:
          'ARKTX'                             " field name
          'T_ITEM'                            " table name
          'SALES ORDER ITEM'                  " column heading
          '8'                                 " column width
          ' '                                 " fix column?
          ' '                                 " key
          ' '                                 " no display
          ' '                                 " sum this column
          'X'                                 " do not sum
          ' '                                 " input allowed?
          ' '                                 " currenct type field name
          ' '                                 " data type
          'X'.                                 " hotspot.
    *column 10
      perform sub_populate_fieldcatalog using:
          'PSTYV'                             " field name
          'T_ITEM'                            " table name
          'ITEM CATEGORY'                     " column heading
          '8'                                 " column width
          ' '                                 " fix column?
          ' '                                 " key
          ' '                                 " no display
          ' '                                 " sum this column
          'X'                                 " do not sum
          ' '                                 " input allowed?
          ' '                                 " currenct type field name
          ' '                                 " data type
          'X'.                                " hotspot.
      perform sub_assign_events.
    Create a Layout for the ALV
      perform sub_layout.
    Define the key fields that links the header & item tables
      perform sub_define_key.
    dispaly list
      perform sub_call_list_display.
    endform.                    " sub_display_alv
    *&      Form  sub_populate_fieldcatalog
          text
         -->P_G_FIELDCAT  text
         -->P_0198   text
         -->P_0199   text
         -->P_0200   text
         -->P_0201   text
         -->P_0202   text
         -->P_0203   text
         -->P_0204   text
         -->P_0205   text
         -->P_0206   text
         -->P_0207   text
         -->P_0208   text
         -->P_0209   text
         -->P_0210   text
         -->P_0211   text
         -->P_0212   text
         -->P_0213   text
    form sub_populate_fieldcatalog  using
                                     l_fieldname
                                     l_tabname
                                     l_column_heading
                                     l_outputlen
                                     l_fix_column
                                     l_key
                                     l_no_out
                                     l_do_sum
                                     l_no_sum
                                     l_input
                                     l_cfieldname
                                     l_datatype
                                     l_hotspot.
      t_fieldcat-fieldname      = l_fieldname.
      t_fieldcat-tabname        = l_tabname.
      t_fieldcat-reptext_ddic   = l_column_heading.
      t_fieldcat-outputlen      = l_outputlen.
      t_fieldcat-fix_column     = l_fix_column.
      t_fieldcat-key            = l_key.
      t_fieldcat-no_out         = l_no_out.
      t_fieldcat-do_sum         = l_do_sum.
      t_fieldcat-no_sum         = l_no_sum.
      t_fieldcat-cfieldname     = l_cfieldname.
      t_fieldcat-datatype       = l_datatype.
      t_fieldcat-hotspot        = l_hotspot.
      append t_fieldcat.clear t_fieldcat.
    endform.                    " sub_populate_fieldcatalog
    *&      Form  sub_assign_events
          text
    -->  p1        text
    <--  p2        text
    form sub_assign_events.
      refresh t_event.
      call function 'REUSE_ALV_EVENTS_GET'
       exporting
         i_list_type           = 1
       importing
         et_events             = t_event[]
       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 the record for the top-of-page event
      read table t_event with key slis_ev_top_of_page.
      if sy-subrc = 0.
        t_event-form = g_formname.
        append t_event.
      endif.
    endform.                    " sub_assign_events
    *&      Form  SUB_LAYOUT
          text
    -->  p1        text
    <--  p2        text
    form sub_layout.
       clear x_layout.
    x_layout-f2code = 'QUOTE'.
      x_layout-zebra  = 'X'.
      x_layout-expand_fieldname = 'EXPCOL'. " Field for expand/collapse
    *Stat
      x_layout-colwidth_optimize = 'X'.
      x_layout-no_totalline = 'X'.   " 0001+
    endform.                    " SUB_LAYOUT
    *&      Form  SUB_DEFINE_KEY
          text
    -->  p1        text
    <--  p2        text
    form sub_define_key.
       clear x_keyinfo.
      x_keyinfo-header01 = 'VBELN'.
      x_keyinfo-item01   = 'VBELN'.
    endform.                    " SUB_DEFINE_KEY
    form top_of_page.
      write :/10 sy-datum, 20 sy-pagno, 30 sy-uname.
    endform.
    form sub_user_command using f_ucomm like sy-ucomm
                                f_selfield type slis_selfield.
      if f_ucomm = 'QUOTE'.
        if f_selfield-fieldname = 'VBELN'.
          Set Parameter id 'AUN' field f_selfield-value.
          call transaction 'VA03'.
        endif.
      endif.
    endform.
    *&      Form  sub_call_list_display
          text
    -->  p1        text
    <--  p2        text
    form sub_call_list_display.
      call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
      exporting
        i_callback_program             = g_repid
        i_callback_user_command        =  'SUB_USER_COMMAND '
        is_layout                      = x_layout
        it_fieldcat                    = t_fieldcat[]
        i_save                         = 'A'
        it_events                      = t_event[]
        i_tabname_header               = 'T_HEADER'
        i_tabname_item                 = 'T_ITEM'
        is_keyinfo                     = x_keyinfo
      tables
        t_outtab_header                = t_header[]
        t_outtab_item                  = t_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.                    " sub_call_list_display

Maybe you are looking for

  • PS CS6 HDR merge failed to output image.

    I started from Lightroom 4 and did a merge to HDR. All the images opened in Photoshop CS6 HDR. (Unlike CS5 there was only one tab called Untitled HDR) The HDR control panel opened up and I edited the highlights shadows and removed ghosts. I clicked t

  • How to use relative paths in Captivate 8 / Cómo usar URL's relativas en Captivate 8

    Hello, I have developed a bunch of courses which will be migrated to a new site and I am having trouble changing the absolute paths into relative URL's to resources such as PDF files inserted into the scorm packages. I cannot find information on how

  • Transaction RSKC

    Hello, What is the significance of entering the 'special characters' in transaction RSKC? Could someone pls help giving an example? Thanks. Regards, Suraj

  • Use REST API to query contacts with a field updated since certain time?

    Hello, Using the REST API and trying to figure out how I can query for contacts that have had a field updated since a specified time. I've tried using the "lastUpdatedAt" arg, but to me it seems like I'm getting back contacts that maybe haven't had a

  • Adobe LifeCycle Designer ES4 install error

    During install I am receiving an Error 1311.Source file not found:  I just downloaded and and now am running the install.   Why would this error occur