Oo alv tree in background

can we schedule a oo alvtree report in background.
if cl_gui_alv_grid=>offline( ) is initial.
CREATE OBJECT g_container_object "cl_gui_docking_container
EXPORTING repid = gv_repid
dynnr = '100'
extension = '1500'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6 .
ENDIF.
CREATE OBJECT grid "cl_gui_alv_grid
EXPORTING
i_parent = g_container_object
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5
* create Event Receiver
  CREATE OBJECT tree_event_receiver.
* create tree control
  CREATE OBJECT tree1
    EXPORTING
        i_parent              = g_container_object
        i_node_selection_mode = cl_gui_column_tree=>node_sel_mode_single
        i_item_selection      = ''
        i_no_html_header      = ''
        i_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.
  ENDIF.
* fields for tree
  PERFORM create_fieldcatlg.
  gs_layout_tree-s_dragdrop-row_ddid = g_handle_tree.
  SORT it_ftable BY progm.
  DELETE ADJACENT DUPLICATES FROM it_ftable COMPARING progm line.
  LOOP AT it_ftable INTO wa_ftable.
    INSERT INTO zrlschg1 VALUES wa_ftable.
    IF sy-subrc <> 0.
      WRITE 'not inserted'.
    ENDIF.
  ENDLOOP.
  CALL METHOD tree1->set_table_for_first_display
    EXPORTING
      it_list_commentary = gt_header[]
*      i_background_id    = 'ALV_BACKGROUND'
      is_layout          = gs_layout_tree
    CHANGING
      it_sort            = gt_sort[]
      it_outtab          = it_ftable[]
      it_fieldcatalog    = gt_fieldcat_lvc[].
  PERFORM add_toolbar.
  PERFORM register_event_tree.
  SET HANDLER tree_event_receiver->handle_double_click FOR tree1.
  SET HANDLER tree_event_receiver->handle_on_drag FOR tree1.
is it right

no way
if you want to display a tree in a report (in the spool generated by the report, actually) you have to use RS_TREE_CONSTRUCT

Similar Messages

  • Can we schedule oo alv tree in background?

    hi all
    can we schedule oo alv tree in background?
    Thanks
    venkat

    Hi,
    We can schedule OO ALV in background.
    follow this link  ALV Tree in Background
    Regards,
    Pravin

  • ALV Tree in Background

    Is it possible to run an ALV Tree report in background? I tried using these codes:
    IF cl_gui_alv_grid=>ontrol
        EXPORTING container_name = 'CONTAINER_1'.
      CREATE OBJECT l_grid
        EXPORTING i_parent = l_control.
    ELSE.
      CREATE OBJECT l_grid
        EXPORTING i_parent = l_dock.
    ENDIF.
    But I'm getting an error. Is there a way on how I can run this report in background?
    Thanks in advance!
    Beth

    Hi Beth
    These controls require frontend to function. However, as I can remember if you pass a dummy container you can still instantiate the control object. Following is an ALV grid example.
    <u>e.g.</u>
    DATA: g_dock TYPE REF TO cl_gui_docking_container,
          g_grid TYPE REF TO cl_gui_alv_grid.
    IF cl_gui_alv_grid=>offline( ) is initial.
        CREATE OBJECT g_dock.
    ENDIF.
    CREATE OBJECT g_grid
        EXPORTING I_PARENT = g_dock.
    You can also check whether it is a background task with the system parameter <b>"sy-batch"</b>.
    Hope these may helpyou to construct a similar procedure for ALV Tree.
    Kind Regards
    *--Serdar
    [email protected]

  • MiniSAP 6.20: ALV tree not working in background

    Good day!
    SAP provides a sample ALV tree program, BCALV_TREE_DEMO, which could be submitted in the background.
    However, it does not work in MiniSAP 6.20. It's kind of bizarre as it works in our Test system.
    Does anyone has any idea what's happening.

    Good day!
    The ALV tree report is submitted in the background.
    By right, it should produce an ALV tree report in the print spool.
    However, it does not seem to work. I checked the program and found there is a logic to check whether it's a background job or not. If it is, it would not create the container.
    It's bizarre that it does not work in MiniSAP 6.20 but it works in 6.10

  • Header background in ALV Tree

    Hello,
    I'm using ALV Tree with HTML commentary header. I found in example only one background for that header.
    me->mo_tree->set_table_for_first_display(
        EXPORTING
          is_hierarchy_header = ls_hierarchy_hdr
          it_list_commentary  = lt_commentary
          i_background_id      = 'ALV_BACKGROUND'
        CHANGING
          it_outtab           = mt_tree_data
          it_fieldcatalog     = lt_fcat ).
    The background is called ALV_BACKGROUND. Do you know some other background images in standard SAP? Where can I find that? Some db table or transaction?
    Thanks and best regards,
    Marcin

    use TC : se78
    Reward points if helpful
    Regards
    Nilesh

  • 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

  • Runtime Error in ALV Tree Output

    Dear All, I am trying to create a ALV Tree using Class cl_gui_alv_tree. The Report Shows the Output with the first Node but when i try to expand it is dumping with a runtime error GETWA_NOT_ASSIGNED in class CL_ALV_TREE_BASE and method SET_ITEMS_FOR_COLUMN. The Reason being the data which was copied in the initial node display to mt_outtab is getting refreshed.
    Can any one of you help me the reason for the table getting refreshed. Do i need to pass any data.
    I am doing the following steps.
    1. Create Container,
    2. Create Tree Class object
    3. Generate the Field Catalog.
    4. Set table for first display  " With empty internal table
    5. Generate the Hierarchy
    6. Call the Method Frontend Update.
    Let me know if i had missed any steps in the process.
    Thank you,
    Regards,
    Swaroop Patri

    One reason for getting this error is using local defined tables for it_outtab parameter in the below code:
    To get rid of the dump, define two distinct output tables globally: one is an empty table which you will pass to the below method, other one is your real output table whose size increases dependently.
      CALL METHOD go_tree->set_table_for_first_display
          EXPORTING
            is_hierarchy_header = ls_hier_header
          CHANGING
            it_outtab           = gt_data_e "Empty table
            it_fieldcatalog     = gt_fcat_tree.

  • 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

  • Problem in ALV Tree

    Hello Friends,
    I am using ALV Tree to display a report.
    In this report for a particular input.2 nodes are cerated.
    On clicking on the 2nd node the details for the same are shown .
    However on clicking the 1st node , the system automatically logs off closing all the SAP sessions and even the SAP Logon pad.
    Suppose i am on executing the program on development server,even the sessions of test server are closed.
    Can anyone please help me in this.....
    its a bit urgent.
    i am attaching my code for reference.
    REPORT  ZPRPROUTOPERATIONS1                     .
    tables : mapl,t001w,zroutpromast.
    TYPE-POOLS: slis,kkblo.
    include <icon>.
    data : it_zrouteledtl like zrouteledtl occurs 0 with header line.
    data : it_zeledtl type zeledtl occurs 0 with header line.
    data : conv_sec(5) type c value '0.036'.
    types : begin of it_output2,
           Srno like zrouteledtl-srno,
           srno1 type p decimals 8,
           subgid like zrouteledtl-subgid,
           subopn like zrouteledtl-subopn,
           movetype type zeledtl-movetype,
           DESC type zeledtl-description,
           Add_desc like zrouteledtl-DESCRIPTION,
           Freq type p decimals 2,
           div_freq type p decimals 2,
           men type p decimals 2,
           offline(3),
           CT type p decimals 2,
           CW type p decimals 2,
           Ideal_ct type p decimals 2,
           ideal_cw type p decimals 2,
           A_trg type p decimals 2,
           b_Trg type p decimals 2,
           g_Trg type p decimals 2,
           p_Trg type p decimals 2,
           m_Trg type p decimals 2,
           t_Trg type p decimals 2,
           i_Trg type p decimals 2,
           Autocycle type p decimals 2,
           online_time type p decimals 2,
           offline_time type p decimals 2,
           online_p_time type p decimals 2,
           offline_p_time type p decimals 2,
           end of it_output2.
    *types : begin of it_output3,
          Srno like zrouteledtl-srno,
          mop_gid like zroutdetails-MOP_GID,
          MOp_opn like zroutdetails-MOP_OPN,
          sub_gid like zpromast-subgid,
          subopn like zpromast-subopn,
          DESC like zpromast-description,
          Add_desc like zroutdetails-ADD_INFO,
          Freq type p decimals 2,
          batch type p decimals 2,
          mix type p decimals 2,
          offline(3),
          CT type p decimals 2,
          CW type p decimals 2,
          Ideal_ct type p decimals 2,
          ideal_cw type p decimals 2,
          A_trg type p decimals 2,
          b_Trg type p decimals 2,
          g_Trg type p decimals 2,
          p_Trg type p decimals 2,
          m_Trg type p decimals 2,
          t_Trg type p decimals 2,
          i_Trg type p decimals 2,
          Autocycle type p decimals 2,
          online_time type p decimals 2,
          offline_time type p decimals 2,
          online_p_time type p decimals 2,
          offline_p_time type p decimals 2,
          end of it_output3.
    data : it_output type it_output2 occurs 0 with header line,
           it_output1 type it_output2 occurs 0 with header line,
           it_emptytab type standard table of it_output2 INITIAL SIZE 0.
    data : a_trg type f,b_trg type f,g_trg type f,p_trg type f,m_trg type f,t_trg type f,i_trg type f,
           autocycle type f,online_p_time type f,offline_p_time type f.
    data : ch1 type c,ch2.
    DATA: ok_code like sy-ucomm,           "OK-Code
          save_ok like sy-ucomm.
    data : ct_fieldcat type KKBLO_T_FIELDCAT.
    *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: gd_tree_container_name(30) TYPE c,
          gd_custom_container        TYPE REF TO cl_gui_custom_container.
    *data mr_toolbar type ref to cl_gui_toolbar.  "Add to top include
    selection-screen begin of block start with frame title text-001.
    select-options: p_gid for zroutpromast-mop_gid obligatory no-extension no intervals,
                    p_opn for zroutpromast-mop_opn obligatory no-extension no intervals,
                    p_werks for t001w-werks obligatory no-extension no intervals.
    selection-screen end of block start.
    *selection-screen begin of block detail with frame title text-002.
    *parameter : radio1 radiobutton group dept default 'X',
               radio2 radiobutton group dept.
    *selection-screen end of block detail.
    include ZTEST_TOOLBAR_EVENT_RECEIVER.
    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
          text
    -->  p1        text
    <--  p2        text
    FORM data_retrieval .
      select * from zrouteledtl into table it_zrouteledtl where mop_gid in p_gid and
                                                                  mop_opn in p_opn
                                                                  and werks in p_werks.
      if sy-subrc ne 0.
      message i001(0) with 'No Records Found'.
      leave program.
      endif.
      select * from zeledtl into table it_zeledtl for all entries in it_zrouteledtl
                                                          where subgid = it_zrouteledtl-subgid
                                                          and subopn = it_zrouteledtl-subopn
                                                          and werks = it_zrouteledtl-werks.
      loop at it_zeledtl.
        it_output1-srno = it_zeledtl-srno.
        it_output1-srno1 = it_zeledtl-srno.
        it_output1-subgid = it_zeledtl-subgid.
        it_output1-subopn = it_zeledtl-subopn.
        it_output1-movetype = it_zeledtl-movetype.
        it_output1-desc = it_zeledtl-DESCRIPTION.
        it_output1-freq = it_zeledtl-frequency.
        it_output1-div_freq = it_zeledtl-div_freq.
        it_output1-men = it_zeledtl-men.
        it_output1-offline = it_zeledtl-offline1.
        it_output1-ct = it_zeledtl-cy_time * conv_sec.
        it_output1-cw = it_zeledtl-wc_time * conv_sec.
        it_output1-ideal_ct = it_zeledtl-cy_trg_time * conv_sec.
        it_output1-ideal_cw = it_zeledtl-wc_trg_time * conv_sec.
        if it_zeledtl-men = 0.
        it_output-autocycle = it_zeledtl-cy_time * conv_sec.
        endif.
        if it_zeledtl-men ne 0 and it_zeledtl-offline1 eq 'NO'
              and ( it_zeledtl-movetype eq 'A' or it_zeledtl-movetype eq 'C' ).
        case it_zeledtl-movetype.
              when 'A'.
                if it_zeledtl-SIM_AUTO = 'TRUE'.
                  ch2 = 0.
                else.
                  ch2 = 1.
                endif.
                it_output-online_p_time = ( it_zeledtl-autocycle * ch2 * conv_sec ) * it_zeledtl-frequency / it_zeledtl-div_freq.
              when 'C'.
                if it_zeledtl-sim5 = 'TRUE'.
                  ch1 = 0.
                else.
                  ch1 = 1.
                endif.
                it_output-online_p_time =  ( it_zeledtl-index5 * it_zeledtl-par_freq5 * ch1
    it_zeledtl-frequency * 10 ) / it_zeledtl-div_freq  .
            endcase.
          elseif it_zeledtl-men ne 0 and it_zeledtl-offline1 eq 'YES'
                  and ( it_zeledtl-movetype eq 'A' or it_zeledtl-movetype eq 'C' ).
            case it_zeledtl-movetype.
              when 'A'.
                if it_zeledtl-SIM_AUTO = 'TRUE'.
                  ch2 = 0.
                else.
                  ch2 = 1.
                endif.
                it_output1-offline_p_time = ( it_zeledtl-autocycle * ch2 * conv_sec ) * it_zeledtl-frequency / it_zeledtl-div_freq.
              when 'C'.
                if it_zeledtl-sim5 = 'TRUE'.
                  ch1 = 0.
                else.
                  ch1 = 1.
                endif.
                it_output-offline_p_time =  ( it_zeledtl-index5 * it_zeledtl-par_freq5 * ch1
    it_zeledtl-frequency * 10 ) / it_zeledtl-div_freq  .
            endcase.
          endif.
          it_output1-a_trg = it_zeledtl-TARGET_A * conv_sec.
          it_output1-b_trg = it_zeledtl-target_B * conv_sec.
          it_output1-g_trg = it_zeledtl-TARGET_G * conv_sec.
          it_output1-p_trg = it_zeledtl-TARGET_P * conv_sec.
          it_output1-M_trg = it_zeledtl-TARGET_M * conv_sec.
          it_output1-t_trg = it_zeledtl-TARGET_T * conv_sec.
          it_output1-i_trg = it_zeledtl-TARGET_I * conv_sec.
        append it_output1.
      endloop.
      sort it_output1 ascending by subgid subopn srno1.
      clear ch1.
      loop at it_zrouteledtl.
        move-corresponding it_zrouteledtl to it_output.
        select single description from zpromast into it_output-desc
                                      where subgid = it_zrouteledtl-subgid and
                                      subopn = it_zrouteledtl-subopn and
                                      werks in p_werks.
        it_output-add_desc = it_zrouteledtl-description.
        it_output-freq = it_zrouteledtl-frequency.
        it_output-div_freq = it_zrouteledtl-div_freq.
        it_output-men = it_zrouteledtl-men.
        it_output-ct = it_zrouteledtl-cy_time * conv_sec.
        it_output-cw = it_zrouteledtl-wc_time * conv_sec.
        it_output-ideal_ct = it_zrouteledtl-cy_trg_time * conv_sec.
        it_output-ideal_cw = it_zrouteledtl-wc_trg_time * conv_sec.
        if it_zrouteledtl-offline1 = '1'.
          it_output-offline = 'No'.
        else.
          it_output-offline = 'Yes'.
        endif.
        append it_output.
      endloop.
      loop at it_output.
        if it_output-offline = 'Yes'.
        ch1 = 0.
        else.
        ch1 = 1.
        endif.
        loop at it_output1 where subgid = it_output-subgid and
                                 subopn = it_output-subopn.
          a_trg = A_trg + it_output1-A_trg.
          b_Trg = b_Trg + it_output1-b_Trg.
          g_Trg = g_Trg + it_output1-g_Trg.
          p_Trg = p_Trg + it_output1-p_Trg.
          m_Trg = m_Trg + it_output1-m_Trg.
          t_Trg = t_Trg + it_output1-t_Trg.
          i_Trg = i_Trg + it_output1-i_Trg.
          autocycle = autocycle + it_output1-Autocycle.
          online_p_time = online_p_time + it_output1-online_p_time.
          offline_p_time = offline_p_time + it_output1-offline_p_time.
        endloop.
          it_output-autocycle = ( autocycle * ch1 * it_output-freq ) / it_output-div_freq / it_output-men.
          it_output-a_trg = ( a_trg * ch1 * it_output-freq ) / it_output-div_freq / it_output-men.
          it_output-b_trg = ( b_trg * ch1 * it_output-freq ) / it_output-div_freq / it_output-men.
          it_output-g_trg = ( g_trg * ch1 * it_output-freq ) / it_output-div_freq / it_output-men.
          it_output-p_trg = ( p_trg * ch1 * it_output-freq ) / it_output-div_freq / it_output-men.
          it_output-m_trg = ( m_trg * ch1 * it_output-freq ) / it_output-div_freq / it_output-men.
          it_output-t_trg = ( t_trg * ch1 * it_output-freq ) / it_output-div_freq / it_output-men.
          it_output-i_trg = ( i_trg * ch1 * it_output-freq ) / it_output-div_freq / it_output-men.
          it_output-online_time = ( it_output-ct - it_output-autocycle ) * ch1.
          it_output-offline_time = ( it_output-ct - it_output-cw ) + it_output-autocycle.
          it_output-online_p_time = ( online_p_time * ch1 * it_output-freq ) / it_output-div_freq / it_output-men.
          it_output-offline_p_time = ( offline_p_time * ch1 * it_output-freq ) / it_output-div_freq / it_output-men.
          clear : a_trg,b_trg,g_trg,p_trg,m_trg,t_trg,i_trg,online_p_time,offline_p_time,ch1,ch2,it_zeledtl,
                  autocycle,online_p_time,offline_p_time,zroutpromast.
        modify it_output.
      endloop.
    ENDFORM.                    " data_retrieval
    *&      Form  build_fieldcatalog
          text
    -->  p1        text
    <--  p2        text
    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.
      DATA: COL_POS TYPE I VALUE 0.
      fieldcatalog-fieldname   = 'SRNO'.
      fieldcatalog-SCRTEXT_L   = 'Sr No.'.
      fieldcatalog-SCRTEXT_m   = 'Sr No.'.
      fieldcatalog-SCRTEXT_s   = 'Sr No.'.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-col_pos     = COL_POS.
      APPEND fieldcatalog TO gd_fieldcat..
      CLEAR  fieldcatalog.
      COL_POS = COL_POS + 1.
      fieldcatalog-fieldname   = 'SUBGID'.           "Field name in itab
      fieldcatalog-SCRTEXT_L   = 'Sub Opn GID'.  "Column text
      fieldcatalog-SCRTEXT_m   = 'Sub Opn GID'.  "Column text
      fieldcatalog-SCRTEXT_s   = 'Sub Opn GID'.  "Column text
      fieldcatalog-col_pos     = COL_POS.     "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.
      COL_POS = COL_POS + 1.
      fieldcatalog-fieldname   = 'SUBOPN'.
      fieldcatalog-SCRTEXT_L   = 'Sub Opn'.
      fieldcatalog-SCRTEXT_m   = 'Sub Opn'.
      fieldcatalog-SCRTEXT_s   = 'Sub Opn'.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-col_pos     = COL_POS.
      fieldcatalog-emphasize   = 'X'.               "Emphasize  (X or SPACE)
      fieldcatalog-key         = 'X'.               "Key Field? (X or SPACE)
      APPEND fieldcatalog TO gd_fieldcat..
      CLEAR  fieldcatalog.
      COL_POS = COL_POS + 1.
      fieldcatalog-fieldname   = 'MOVETYPE'.
      fieldcatalog-SCRTEXT_L   = 'Movetype'.
      fieldcatalog-SCRTEXT_m   = 'Movetype'.
      fieldcatalog-SCRTEXT_s   = 'Movetype'.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-col_pos     = COL_POS.
      APPEND fieldcatalog TO gd_fieldcat..
      CLEAR  fieldcatalog.
      COL_POS = COL_POS + 1.
      fieldcatalog-fieldname   = 'DESC'.
      fieldcatalog-SCRTEXT_L   = 'Description'.
      fieldcatalog-SCRTEXT_m   = 'Description'.
      fieldcatalog-SCRTEXT_s   = 'Description'.
      fieldcatalog-outputlen   = 600.
      fieldcatalog-col_pos     = COL_POS.
      APPEND fieldcatalog TO gd_fieldcat..
      CLEAR  fieldcatalog.
      COL_POS = COL_POS + 1.
      fieldcatalog-fieldname   = 'ADD_DESC'.
      fieldcatalog-SCRTEXT_L   = 'Add. Description'.
      fieldcatalog-SCRTEXT_m   = 'Add. Description'.
      fieldcatalog-SCRTEXT_s   = 'Add. Description'.
      fieldcatalog-outputlen   = 100.
      fieldcatalog-col_pos     = COL_POS.
      APPEND fieldcatalog TO gd_fieldcat..
      CLEAR  fieldcatalog.
      COL_POS = COL_POS + 1.
      fieldcatalog-fieldname   = 'FREQ'.
      fieldcatalog-SCRTEXT_L   = 'Frequency'.
      fieldcatalog-SCRTEXT_m   = 'Frequency'.
      fieldcatalog-SCRTEXT_s   = 'Frequency'.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-col_pos     = COL_POS.
      APPEND fieldcatalog TO gd_fieldcat..
      CLEAR  fieldcatalog.
      COL_POS = COL_POS + 1.
      fieldcatalog-fieldname   = 'DIV_FREQ'.
      fieldcatalog-SCRTEXT_L   = 'Div Freq'.
      fieldcatalog-SCRTEXT_m   = 'Div Freq'.
      fieldcatalog-SCRTEXT_s   = 'Div Freq'.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-col_pos     = COL_POS.
      APPEND fieldcatalog TO gd_fieldcat..
      CLEAR  fieldcatalog.
      COL_POS = COL_POS + 1.
      fieldcatalog-fieldname   = 'MEN'.
      fieldcatalog-SCRTEXT_L   = 'Men'.
      fieldcatalog-SCRTEXT_m   = 'Men'.
      fieldcatalog-SCRTEXT_s   = 'Men'.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-col_pos     = COL_POS.
      APPEND fieldcatalog TO gd_fieldcat..
      CLEAR  fieldcatalog.
    COL_POS = COL_POS + 1.
    fieldcatalog-fieldname   = 'BATCH'.
    fieldcatalog-SCRTEXT_L   = 'Batch/Div Freq'.
    fieldcatalog-SCRTEXT_m   = 'Batch/Div Freq'.
    fieldcatalog-SCRTEXT_s   = 'Batch/Div Freq'.
    fieldcatalog-outputlen   = 15.
    fieldcatalog-col_pos     = COL_POS.
    APPEND fieldcatalog TO gd_fieldcat.
    CLEAR  fieldcatalog.
      COL_POS = COL_POS + 1.
      fieldcatalog-fieldname   = 'OFFLINE'.
      fieldcatalog-SCRTEXT_L   = 'Offline'.
      fieldcatalog-SCRTEXT_m   = 'Offline'.
      fieldcatalog-SCRTEXT_s   = 'Offline'.
      fieldcatalog-outputlen   = 6.
      fieldcatalog-col_pos     = COL_POS.
      APPEND fieldcatalog TO gd_fieldcat.
      CLEAR  fieldcatalog.
      COL_POS = COL_POS + 1.
      fieldcatalog-fieldname   = 'CT'.
      fieldcatalog-SCRTEXT_L   = 'Cycle Time'.
      fieldcatalog-SCRTEXT_m   = 'Cycle Time'.
      fieldcatalog-SCRTEXT_s   = 'Cycle Time'.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-col_pos     = COL_POS.
      fieldcatalog-do_sum      = 'X'.
      APPEND fieldcatalog TO gd_fieldcat.
      CLEAR  fieldcatalog.
      COL_POS = COL_POS + 1.
      fieldcatalog-fieldname   = 'CW'.
      fieldcatalog-SCRTEXT_L   = 'Work Content'.
      fieldcatalog-SCRTEXT_m   = 'Work Content'.
      fieldcatalog-SCRTEXT_s   = 'Work Content'.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-col_pos     = COL_POS.
      fieldcatalog-do_sum      = 'X'.
      APPEND fieldcatalog TO gd_fieldcat.
      CLEAR  fieldcatalog.
      COL_POS = COL_POS + 1.
      fieldcatalog-fieldname   = 'IDEAL_CT'.
      fieldcatalog-SCRTEXT_L   = 'Ideal CT'.
      fieldcatalog-SCRTEXT_m   = 'Ideal CT'.
      fieldcatalog-SCRTEXT_s   = 'Ideal CT'.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-col_pos     = COL_POS.
      fieldcatalog-do_sum      = 'X'.
      APPEND fieldcatalog TO gd_fieldcat.
      CLEAR  fieldcatalog.
      COL_POS = COL_POS + 1.
      fieldcatalog-fieldname   = 'IDEAL_CW'.
      fieldcatalog-SCRTEXT_L   = 'Ideal CW'.
      fieldcatalog-SCRTEXT_m   = 'Ideal CW'.
      fieldcatalog-SCRTEXT_s   = 'Ideal CW'.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-col_pos     = COL_POS.
      fieldcatalog-do_sum      = 'X'.
      APPEND fieldcatalog TO gd_fieldcat.
      CLEAR  fieldcatalog.
      COL_POS = COL_POS + 1.
      fieldcatalog-fieldname   = 'A_TRG'.
      fieldcatalog-SCRTEXT_L   = 'Target A'.
      fieldcatalog-SCRTEXT_m   = 'Target A'.
      fieldcatalog-SCRTEXT_s   = 'Target A'.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-col_pos     = COL_POS.
      fieldcatalog-do_sum      = 'X'.
      APPEND fieldcatalog TO gd_fieldcat.
      CLEAR  fieldcatalog.
      COL_POS = COL_POS + 1.
      fieldcatalog-fieldname   = 'B_TRG'.
      fieldcatalog-SCRTEXT_L   = 'Target B'.
      fieldcatalog-SCRTEXT_m   = 'Target B'.
      fieldcatalog-SCRTEXT_s   = 'Target B'.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-col_pos     = COL_POS.
      fieldcatalog-do_sum      = 'X'.
      APPEND fieldcatalog TO gd_fieldcat.
      CLEAR  fieldcatalog.
      COL_POS = COL_POS + 1.
      fieldcatalog-fieldname   = 'G_TRG'.
      fieldcatalog-SCRTEXT_L   = 'Target G'.
      fieldcatalog-SCRTEXT_m   = 'Target G'.
      fieldcatalog-SCRTEXT_s   = 'Target G'.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-col_pos     = COL_POS.
      fieldcatalog-do_sum      = 'X'.
      APPEND fieldcatalog TO gd_fieldcat.
      CLEAR  fieldcatalog.
      COL_POS = COL_POS + 1.
      fieldcatalog-fieldname   = 'P_TRG'.
      fieldcatalog-SCRTEXT_L   = 'Target P'.
      fieldcatalog-SCRTEXT_m   = 'Target P'.
      fieldcatalog-SCRTEXT_s   = 'Target P'.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-col_pos     = COL_POS.
      fieldcatalog-do_sum      = 'X'.
      APPEND fieldcatalog TO gd_fieldcat.
      CLEAR  fieldcatalog.
      COL_POS = COL_POS + 1.
      fieldcatalog-fieldname   = 'M_TRG'.
      fieldcatalog-SCRTEXT_L   = 'Target M'.
      fieldcatalog-SCRTEXT_m   = 'Target M'.
      fieldcatalog-SCRTEXT_s   = 'Target M'.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-col_pos     = COL_POS.
      fieldcatalog-do_sum      = 'X'.
      APPEND fieldcatalog TO gd_fieldcat.
      CLEAR  fieldcatalog.
      COL_POS = COL_POS + 1.
      fieldcatalog-fieldname   = 'T_TRG'.
      fieldcatalog-SCRTEXT_L   = 'Target T'.
      fieldcatalog-SCRTEXT_m   = 'Target T'.
      fieldcatalog-SCRTEXT_s   = 'Target T'.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-col_pos     = COL_POS.
      fieldcatalog-do_sum      = 'X'.
      APPEND fieldcatalog TO gd_fieldcat.
      CLEAR  fieldcatalog.
      COL_POS = COL_POS + 1.
      fieldcatalog-fieldname   = 'I_TRG'.
      fieldcatalog-SCRTEXT_L   = 'Target I'.
      fieldcatalog-SCRTEXT_m   = 'Target I'.
      fieldcatalog-SCRTEXT_s   = 'Target I'.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-col_pos     = COL_POS.
      fieldcatalog-do_sum      = 'X'.
      APPEND fieldcatalog TO gd_fieldcat.
      CLEAR  fieldcatalog.
      COL_POS = COL_POS + 1.
      fieldcatalog-fieldname   = 'AUTOCYCLE'.
      fieldcatalog-SCRTEXT_L   = 'AutoCycle'.
      fieldcatalog-SCRTEXT_m   = 'AutoCycle'.
      fieldcatalog-SCRTEXT_s   = 'AutoCycle'.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-col_pos     = COL_POS.
      fieldcatalog-do_sum      = 'X'.
      APPEND fieldcatalog TO gd_fieldcat.
      CLEAR  fieldcatalog.
      COL_POS = COL_POS + 1.
      fieldcatalog-fieldname   = 'ONLINE_TIME'.
      fieldcatalog-SCRTEXT_L   = 'Online Time'.
      fieldcatalog-SCRTEXT_m   = 'Online Time'.
      fieldcatalog-SCRTEXT_s   = 'Online Time'.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-col_pos     = COL_POS.
      fieldcatalog-do_sum      = 'X'.
      APPEND fieldcatalog TO gd_fieldcat.
      CLEAR  fieldcatalog.
      COL_POS = COL_POS + 1.
      fieldcatalog-fieldname   = 'OFFLINE_TIME'.
      fieldcatalog-SCRTEXT_L   = 'Offline Time'.
      fieldcatalog-SCRTEXT_m   = 'Offline Time'.
      fieldcatalog-SCRTEXT_s   = 'Offline Time'.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-col_pos     = COL_POS.
      fieldcatalog-do_sum      = 'X'.
      APPEND fieldcatalog TO gd_fieldcat.
      CLEAR  fieldcatalog.
      COL_POS = COL_POS + 1.
      fieldcatalog-fieldname   = 'ONLINE_P_TIME'.
      fieldcatalog-SCRTEXT_L   = 'Online Process Time'.
      fieldcatalog-SCRTEXT_m   = 'Online Process Time'.
      fieldcatalog-SCRTEXT_s   = 'Online Process Time'.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-col_pos     = COL_POS.
      fieldcatalog-do_sum      = 'X'.
      APPEND fieldcatalog TO gd_fieldcat.
      CLEAR  fieldcatalog.
      COL_POS = COL_POS + 1.
      fieldcatalog-fieldname   = 'OFFLINE_P_TIME'.
      fieldcatalog-SCRTEXT_L   = 'Offline Process Time'.
      fieldcatalog-SCRTEXT_m   = 'Offline Process Time'.
      fieldcatalog-SCRTEXT_s   = 'Offline Process Time'.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-col_pos     = COL_POS.
      fieldcatalog-do_sum      = 'X'.
      APPEND fieldcatalog TO gd_fieldcat.
      CLEAR  fieldcatalog.
    ENDFORM.                    " build_fieldcatalog
    *&      Form  build_layout
          text
    -->  p1        text
    <--  p2        text
    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
          text
         <--P_GD_HIERARCHY_HEADER  text
    FORM build_hierarchy_header CHANGING
                                        p_hierarchy_header TYPE treev_hhdr.
      p_hierarchy_header-heading = 'Drill Down For Detail'(022).
      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
          text
         -->P_GD_REPORT_TITLE  text
         -->P_GD_LOGO  text
    FORM build_report_title  using
                     pt_report_title  TYPE slis_t_listheader
                     pa_logo TYPE sdydo_value.
      DATA: ls_line TYPE slis_listheader,
            ld_date(10) TYPE c,
            string1 type string,string2 type string.
    List Heading Line(TYPE H)
    concatenate 'Material: ' p_matnr-low into string1 separated by space.
      CLEAR ls_line.
      ls_line-typ  = 'H'.
      ls_line-key  = 'MOST Operation'.
      concatenate p_gid-low p_opn-low into string2 separated by space.
      ls_line-info = string2.
      APPEND ls_line TO pt_report_title.
      ls_line-typ  = 'S'.
      ls_line-key  = 'Text'.
      select single DESCRIPTION from zroutpromast into string1 where mop_gid = p_gid-low
                                                               and mop_opn = p_opn-low
                                                               and werks = p_werks-low.
      ls_line-info = string1.
      APPEND ls_line TO pt_report_title.
    ls_line-typ  = 'S'.
    ls_line-key  = 'Routing Counter:'.
    ls_line-info = counter.
    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.                    " build_report_title
    *&      Form  build_variant
          text
    -->  p1        text
    <--  p2        text
    FORM build_variant .
      gd_variant-report = sy-repid.
    ENDFORM.                    " build_variant
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'STATUS1'.
      SET TITLEBAR 'ZTITLE'.
      IF gd_tree IS INITIAL.
    Create ALVtree (must be performed within screen PBO module)
        PERFORM create_alvtree_container.
        PERFORM create_object_in_container.
        PERFORM create_empty_alvtree_control.
        perform change_toolbar.
        PERFORM create_alvtree_hierarchy.
      ENDIF.
      CALL METHOD cl_gui_cfw=>flush.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
      case sy-ucomm.
        when 'EXIT' or 'BACK' or 'CANC'.
          call method gd_tree->free.
          leave program.
        when others.
          call method cl_gui_cfw=>dispatch.
      endcase.
      clear ok_code.
      call method cl_gui_cfw=>flush.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  create_alvtree_container
          text
    -->  p1        text
    <--  p2        text
    FORM create_alvtree_container .
      gd_tree_container_name = 'SCREEN_CONTAINER'.
      create object gd_custom_container
          exporting
                container_name = gd_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'.
      endif.
    ENDFORM.                    " create_alvtree_container
    *&      Form  create_object_in_container
          text
    -->  p1        text
    <--  p2        text
    FORM create_object_in_container .
      create object gd_tree
          exporting
              parent              = gd_custom_container
              node_selection_mode = cl_gui_column_tree=>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'.
      endif.
    ENDFORM.                    " create_object_in_container
    *&      Form  create_empty_alvtree_control
          text
    -->  p1        text
    <--  p2        text
    FORM create_empty_alvtree_control .
      CLEAR: it_emptytab.
      REFRESH: it_emptytab.
      CALL METHOD gd_tree->set_table_for_first_display
         EXPORTING
                   is_hierarchy_header  = gd_hierarchy_header
                   it_list_commentary   = gd_report_title
                  i_logo               = gd_logo
                  i_background_id      = 'ALV_BACKGROUND'
                   i_save               = 'A'
                   is_variant            = gd_variant
         CHANGING
                   it_outtab            =  it_emptytab      "Must be empty
                   it_fieldcatalog      =  gd_fieldcat.
    ENDFORM.                    " create_empty_alvtree_control
    *&      Form  create_alvtree_hierarchy
          text
    -->  p1        text
    <--  p2        text
    FORM create_alvtree_hierarchy .
      data: ls_sflight type sflight,
              lt_sflight type sflight occurs 0.
      data: ld_mop_gid_key type lvc_nkey,
            ld_mop_opn_key type lvc_nkey.
      loop at it_output.
        perform add_ekko_node using      it_output
                                changing ld_mop_gid_key.
        loop at it_output1 where subgid eq it_output-subgid
                                 and subopn eq it_output-subopn.
          perform add_ekpo_line using      it_output1
                                           ld_mop_gid_key
                                  changing ld_mop_opn_key.
        endloop.
      endloop.
    calculate totals
      call method gd_tree->update_calculations.
    this method must be called to send the data to the frontend
      call method gd_tree->frontend_update.
    ENDFORM.                    " create_alvtree_hierarchy
    *&      Form  add_ekko_node
          text
         -->P_IT_OUTPUT  text
         -->P_2478   text
         <--P_LD_MOP_GID_KEY  text
    FORM add_ekko_node  USING  ps_output like it_output
                               VALUE(p_relate_key)
                        CHANGING p_node_key.
      data: ld_node_text type lvc_value,
             ls_sflight type sflight.
      data : text128(128).
    Set item-layout
      concatenate ps_output-subgid ps_output-subopn into text128 separated by space.
      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 = gd_tree->c_hierarchy_column_name.
      ls_item_layout-style     = cl_gui_column_tree=>style_default.
      ld_node_text             = text128.
      append ls_item_layout to lt_item_layout.
    Add node
      call method gd_tree->add_node
        exporting
              i_relat_node_key = p_relate_key
              i_relationship   = cl_gui_column_tree=>relat_last_child
              i_node_text      = ld_node_text
              is_outtab_line   = ps_output
              it_item_layout   = lt_item_layout
           importing
              e_new_node_key = p_node_key.
    ENDFORM.                    " add_ekko_node
    *&      Form  add_ekpo_line
          text
         -->P_IT_OUTPUT1  text
         -->P_LD_MOP_GID_KEY  text
         <--P_LD_MOP_OPN_KEY  text
    FORM add_ekpo_line  USING    Ps_OUTPUT1 like it_output1
                                 value(p_relate_key)
                        CHANGING p_node_key.
    data: ld_node_text type lvc_value,
          ls_sflight type sflight.
    data : text128(128).
    concatenate ps_output1-srno ps_output1-movetype into text128 separated by space.
    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 = gd_tree->c_hierarchy_column_name.
      ls_item_layout-style     = cl_gui_column_tree=>style_default.
      ld_node_text             = text128.
      append ls_item_layout to lt_item_layout.
    Add node
      call method gd_tree->add_node
        exporting
              i_relat_node_key = p_relate_key
              i_relationship   = cl_gui_column_tree=>relat_last_child
              i_node_text      = ld_node_text
              is_outtab_line   = ps_output1
              it_item_layout   = lt_item_layout
           importing
              e_new_node_key = p_node_key.
    ENDFORM.                    " add_ekpo_line
    *&      Form  change_toolbar
          text
    -->  p1        text
    <--  p2        text
    FORM change_toolbar .
    get toolbar control
      call method gd_tree->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     = 'EXPORT'           "Function code of button
                  icon      = '@49@'             "Icon ID (see )
                  butn_type = cntb_btype_button  "Button type
                  text      = ''                 "Button text
                  quickinfo = 'Download To Excel'.  "Quick info text
    add Dropdown Button to toolbar (for Insert Line)
    call method mr_toolbar->add_button
             exporting
                 fcode     = 'INSERT_LC'         "Function code of button
                 icon      = '@17@'              "Icon ID (see )
                 butn_type = cntb_btype_dropdown "Button type
                 text      = ''                  "Button text
                 quickinfo = 'Insert Line'.      "Quick info text
    set event-handler for toolbar-control
      data: toolbar_event_receiver type ref to lcl_toolbar_event_receiver.
      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
    Edited by: Darshan Shah on Jan 2, 2008 1:31 PM

    Gui patch was not available on my pc

  • How to set selected row on startup of an alv tree build with cl_salv_tree

    HI,
    I have a cl_salv_tree and want the tree structure to open a specific node when starting the report. My coding is something like that:
      DATA: lr_selections       TYPE REF TO cl_salv_selections_tree,
            lr_nodes            TYPE REF TO cl_salv_nodes,
            lr_node             TYPE REF TO cl_salv_node,
            lv_node_index(12)   TYPE c,
            lt_nodes            TYPE salv_t_nodes,
            ls_nodes            TYPE salv_s_nodes,
            lr_item             TYPE REF TO cl_salv_item.
    lr_selections = lr_tree->get_selections( ).
    lt_nodes = lr_selections->get_selected_nodes( ).
    lr_item = lr_selections->get_selected_item( ).
    IF lr_item IS NOT BOUND.
      lr_nodes = lr_tree->get_nodes( ).
      lr_node = lr_nodes->get_node( lv_node_index ).  "lv_node_index is the index of the node i want to be open on startup
      ls_nodes-key = lv_node_index.
      ls_nodes-node = lr_node.
      APPEND ls_nodes TO lt_nodes.
      lr_selections->set_selected_nodes( lt_nodes ).
    ELSE.
      ls_nodes-node = lr_item->get_node( ).
      ls_nodes-key = ls_nodes-node->get_key( ).
      APPEND ls_nodes TO lt_nodes.
      lr_selections->set_selected_nodes( lt_nodes ).
    ENDIF.
    This coding is also used, when the report is running and someone clicks an a row. So thats why I check if a item is marked
    or the total row.
    But the tree always starts without opening the node.
    Do I use the right methods or am I totally wrong ????
    Thx for your help in advance
    dinodini
    Edited by: dinodini on Nov 16, 2010 6:51 PM

    What you are looking for is the similar functionality which could be achieved by the method EXPAND_NODE of the ALV Tree created using CL_GUI_ALV_TREE. In SALV Tree, you can use the method EXPAND of the class CL_SALV_NODE to show all the subnodes of that node, not by using the SELECTION.
    Once you add the Node using the method ADD_NODE, you should call the method EXPAND to expand that subtree.
                lr_nodes  = lr_tree->get_nodes( ).
                lr_node =  lr_nodes->ADD_NODE( ... )
                lr_node->EXPAND( COMPLETE_SUBTREE = 'X' ).
    Regards,
    Naimesh Patel

  • Download from ALV Tree

    Dear All,
    Do anybody know how to download data from ALV tree into local PC. For example transaction O3O_MT10. Can we download it?
    Thanks
    Regards
    Hadi

    Thank a lot Rainer,
    It's definitely answer the question. I think I learn something new in here.
    Regards
    Hadi

  • Edit a field in ALV tree in a subscreen of a module pool

    Hi
    I want to make a field editable in the ALV tree based on some condtions in a subscreen of a module pool.  I used the edit = 'X' field in the fieldcatalog still it  is showing the field as display and not edit.
    Please help me to get the field as editable and save it to the database table.
    Please not this is ALV TREE
    Regards,
    Mozila

    Hi Mayank,
    Thanks for the reply
    I am using oops method.
    I tried making the field which is to be made editable  as wa_fieldcatalog-edit = 'X'. But its not working. I didnt get you when you said  edit in layout object.
    I also went through the demo programs but these programs are not having editable fields.
    My code is as follows:
    IF tree4 IS INITIAL.
    * create container for alv-tree
      l_tree_container_name = 'TREE4'.
      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.
    * create tree control
      CREATE OBJECT tree4
        EXPORTING
          i_parent                    = l_custom_container
          i_node_selection_mode       = cl_gui_column_tree=>node_sel_mode_multiple
          i_item_selection            = 'X'
          i_no_html_header            = 'X'
          i_no_toolbar                = 'X'
        EXCEPTIONS
          cntl_error                  = 1
          cntl_system_error           = 2
          create_error                = 3
          lifetime_error              = 4
          illegal_node_selection_mode = 5
          failed                      = 6
          illegal_column_name         = 7.
    * create hierarchy
      CALL METHOD tree4->set_table_for_first_display
        EXPORTING
          is_layout       = s_layo
        CHANGING
          it_sort         = it_sort
          it_outtab       = it_final
          it_fieldcatalog = it_fieldcat.
    ELSE.
      CALL METHOD tree4->refresh_table_display
        EXPORTING
          it_sort           = it_sort
        EXCEPTIONS
          program_error     = 1
          failed            = 2
          cntl_system_error = 3
          others            = 4
      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.

  • Double click on the node,ALV tree, subscreen

    Hi,
    I have a small requirement in ALV Tree
    left side i get a tree and when i double click on one of it , i'm trying to display the subscreen. even though i am setting the paramaters to the screen but i'm unable to get those values in the subscreen.
    example
    Name        Description                                                subscreen 0101
    xyz           xyz desc (double click on this)                  name    = XYZ
    ABC         abs desc                                                      descrip = xyz desc
    This is what the requirement is:
    Please help me out with the solution.
    Bhavana

    Hi Bhavana,
    Register your double click event in the ALV Tree program. Then call the respective subscreen using sy-ucomm value.
    IF NOT r_ucomm IS INITIAL.
        CASE r_ucomm.
          WHEN '&F03'.
            SET SCREEN 100.
            LEAVE SCREEN.
    endif.
    Refer the below code for setting the registering the event.
      CALL METHOD tree->get_registered_events
        IMPORTING
          events = l_events_s.
      l_event-eventid = cl_gui_column_tree=>eventid_item_double_click.
      APPEND l_event TO l_events_s.
      CALL METHOD tree->set_registered_events
        EXPORTING
          events                    = l_events_s
        EXCEPTIONS
          cntl_error                = 1
          cntl_system_error         = 2
          illegal_event_combination = 3.
      CREATE OBJECT l_events_receiver.
      SET HANDLER l_events_receiver->handle_item_click FOR tree.
    CLASS lcl_events_receiver DEFINITION.                       "#EC *
      PUBLIC SECTION.
        METHODS:
        handle_item_click FOR EVENT item_double_click OF cl_gui_alv_tree
            IMPORTING node_key fieldname.
    ENDCLASS.                    "lcl_handle_events DEFINITION
    CLASS lcl_events_receiver IMPLEMENTATION.
      METHOD handle_item_click.
        PERFORM employee_data USING node_key fieldname.
        CALL SCREEN 300.
      ENDMETHOD.                    "HANDLE_ITEM_DOUBLE_CLICK
    ENDCLASS.                    "lcl_events_receiver IMPLEMENTATION
    Thanks.
    Ganesh R K
    Edited by: Ganesh.rk83 on Jun 23, 2011 11:21 AM

  • Runtime error while i add a node in ALV Tree in oops

    i am adding a node to alv tree using oop am passing a work area and when i execute it is going for a dump and it says UC_OBJECTS_NOT_CONVERTIBLE
    and the below where it is bold and italic it is where the dump is occuring
    METHOD ADD_NODE.
    FIELD-SYMBOLS: <TAB1> TYPE standard TABLE,
    <wa> type any.
    assign mt_outtab->* to <tab1>.
    insert line in outtab
    DATA: L_INDEX TYPE SY-TABIX.
    if is_outtab_line is initial.
    create initial line
    data l_dref_wa type ref to data.
    create data l_dref_wa like line of <tab1>.
    assign l_dref_wa->* to <wa>.
    l_index = 0.
    append <wa> to <Tab1>.
    else.
    APPEND IS_OUTTAB_LINE TO <TAB1>. endif.
    L_INDEX = SY-TABIX.
    add node to model
    CALL METHOD ME->ADD_MODEL_NODE
    EXPORTING
    I_RELAT_NODE_KEY = I_RELAT_NODE_KEY
    I_RELATIONSHIP = I_RELATIONSHIP
    IS_NODE_LAYOUT = IS_NODE_LAYOUT
    IT_ITEM_LAYOUT = IT_ITEM_LAYOUT
    I_NODE_TEXT = I_NODE_TEXT
    I_INDEX_OUTTAB = L_INDEX
    IMPORTING
    E_NEW_NODE_KEY = E_NEW_NODE_KEY.
    ENDMETHOD.

    HI Mohsin,
    please refer to the below ....
    might be helpful for u .....
    https://scn.sap.com/thread/2050188
    http://scn.sap.com/message/6407195
    http://r0005001.benxbrain.com/de%28bD1lbiZjPTAwMQ==%29/index.do?onInputProcessing=brai_thread&001_thread_id=1759814%20&001_temp=R3TR|PROG|RCSBI010||P01|
    Hope thiw will help ....
    Regards,
    AKS

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

Maybe you are looking for

  • Setting up multiple devices on one apple id

    I've purchased a new Ipad with the intent of setting it up under my pre-existing apple id.  The apple id already has 2 other Ipads on it (this will be 3).  I set everything up today and went to download an app and was met with the 'Your Apple ID has

  • IdM 8.1: Problems to provision Solaris 10 with non root user.

    Hello When IdM 8.1 tries to create a user into Solaris 10 I got this Error: com.waveset.util.WavesetException: An error occurred adding user 'testSolaris' to resource 'Test_Solaris'. com.waveset.util.WavesetException: Script failed waiting for "_,)#(

  • My online number is always "busy" even when its no...

    I have troubleshooted and posted on here and changed privacy settings and upgraded to the latest Skype version and have been in a continuous online feedback loop w/ Skype desperately looking for answers.  MAD!  My 3 month online number does NOT work,

  • MTS Recovery Service Terminates on Time-Out - Need to Restart Server

    Has anyone encountered this error before? We have an Oracle9i Release 2 Database Server (patched 9.2.0.8) installed on a Windows 2000 Server (latest service pack). Once in while we get this haphazard error that pops up in the Windows Event Viewer: MT

  • Newbie having trouble

    I'm new to Flash, Have got the new Flash 8 Pro. I'm trying to start at the beginning with tutorials to learn how to use flash. The first tutorial under the "getting started with flash" area is "building your first flash application" I have gone throu