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

Similar Messages

  • Suppressing empty nodes in ALV tree grid

    Hi,  I'm writing an ALV tree report with financial data broken down by cost element hierarchy. We've determined that the maximum number of levels in our hierarchy is seven so have to build the program to accept seven node levels. Most times when it runs it will find fewer than seven nodes.  Is there an easy to to suppress empty columns in the report so that the end user does not not see a bunch of empty nodes in the report?

    Expand or Collapse Branches or Hide Areas
    You are able to expand and collapse the branches of the tree structure individually or together. Beyond that you are able to make a node or an item completely invisible.
    Methods
    Function                                       Class                                   Method
    Expand individual branch               CL_SALV_NODE                  EXPAND 
    Collapse individual branch                                                        COLLAPSE
    Expand all branches                    CL_SALV_NODES                EXPAND_ALL
    Collapse all branches                                                              COLLAPSE_ALL
    Change visibility of a node            CL_SALV_NODE                  SET_VISIBLE
    Check whether the node is visible                                             IS_VISIBLE
    Change visibility of an item             CL_SALV_ITEM                 SET_VISIBLE
    Check whether the item is visible                                             IS_VISIBLE

  • 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

  • ALV Tree Grid...

    How can I make a ALV grid like the one I created with REUSE_ALV_GRID_DISPLAY but with tree structure..
    I saw a few examples but almost all of them are like text output.. And the ones with graphical looking outputs are like SAP's menü, and doesn't seem like grid at all.
    Well, I hope there is any way to do this.

    If you are looking for a FM like REUSE_ALV_GRID_DISPLAY, no.   But the class is very easy to use. you can look into BCALV_TEST_SIMPLE_TREE or if you are newer release of SAP, you can also look into SALV_DEMO_TREE_SIMPLE.
    Albert

  • 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

  • Report with ALV tree and ALV list?

    I need to create a report with layout as same as this one
    [http://trangiegie.com/MyFile/output.JPG]
    It looks like a report with combination of ALV tree and list. The tree works like a navigation bar. Wonder if there are any demo programs like this. Will appreciate any help.

    For Tree alone - You can check program : BCALV_TREE_02
    Program Name                   Report title
    BCALV_GRID_DND_TREE            ALV Grid: Drag and Drop with ALV Tree
    BCALV_GRID_DND_TREE_SIMPLE     ALV GRID: Drag and drop with ALV tree (simple)
    BCALV_TEST_COLUMN_TREE         Program BCALV_TEST_COLUMN_TREE
    BCALV_TEST_SIMPLE_TREE         Program BCALV_TEST_SIMPLE_TREE
    BCALV_TREE_01                  ALV Tree Control: Build Up the Hierarchy Tree
    BCALV_TREE_02                  ALV Tree Control: Event Handling
    BCALV_TREE_03                  ALV Tree Control: Use an Own Context Menu
    BCALV_TREE_04                  ALV Tree Control: Add a Button to the Toolbar
    BCALV_TREE_05                  ALV Tree Control: Add a Menu to the Toolbar
    BCALV_TREE_06                  ALV tree control: Icon column and icon for nodes/items
    BCALV_TREE_DEMO                Demo for ALV tree control
    BCALV_TREE_DND                 ALV tree control: Drag & Drop within a hierarchy tree
    BCALV_TREE_DND_MULTIPLE        ALV tree control: Drag & Drop within a hierarchy tree
    BCALV_TREE_EVENT_RECEIVER      Include BCALV_TREE_EVENT_RECEIVER
    BCALV_TREE_EVENT_RECEIVER01
    BCALV_TREE_ITEMLAYOUT          ALV Tree: Change Item Layouts at Runtime
    BCALV_TREE_MOVE_NODE_TEST      Demo for ALV tree control
    BCALV_TREE_SIMPLE_DEMO         Program BCALV_TREE_SIMPLE_DEMO
    BCALV_TREE_VERIFY              Verifier for ALV Tree and Simple ALV Tree

  • Editable Field in ALV Tree Control

    Hello All,
    Can anyone tell me how can i make a field editable in an Alv Tree grid. I have tried with fiedcatalog-edit = 'X'. but that doesn't work. 
    also please provide a piece of code to be clear ...
    Thanks,
    Ravi Aswani

    hI ,
    Data : LI_fieldcat  type lvc_t_fcat,
              ls_fcat type lvc_s_fcat.
    IF OKCODE = 'MAIN'.
          CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
        I_BUFFER_ACTIVE              =
          i_structure_name             = 'ZCUS'
        I_CLIENT_NEVER_DISPLAY       = 'X'
        I_BYPASSING_BUFFER           =
        I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = LI_fieldcat[]            .
      LOOP AT LI_FIELDCAT INTO LS_FCAT.
        CASE ls_fcat-fieldname.
          WHEN 'KUNNR'.
            ls_fcat-col_pos = 1.
          WHEN 'NAME1'.
            ls_fcat-edit = 'X'.
            ls_fcat-col_pos = 2.
          WHEN 'ORT01'.
            ls_fcat-edit = 'X'.
            ls_fcat-col_pos = 3.
            ls_fcat-drdn_hndl = '1'.
            ls_fcat-outputlen = 20.
          WHEN 'LAND1'.
            ls_fcat-edit = 'X'.
            ls_fcat-col_pos = 4.
        ENDCASE.
        MODIFY LI_fieldcat FROM ls_fcat.
      ENDLOOP.
    ENDIF.
    With this The internal Table contains 4 fields Kunnr Name1 Ort01 Land1 Here Kunnr is the Key field so , it is not editable , reaming fields are Editable.
    There u must write the Modify statement.
    check it once
    Regards
    Krishna

  • 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

  • How to 'grid' an ALV tree

    hi there,
    i have a program with ALV tree.
    is it possible to 'grid' the columns ? i mean to put vertical lines between each field like it is in standard-alv-grid ?
    reg, Martin

    Hi,
    *****HIERRACHIAL ALVS FOR KNA1 AND VBAK
    *& Report  ZJE_ALV_HIERRACHIAL1
    REPORT  zje_alv_hierrachial1.
    TYPE-POOLS: slis.
    TABLES: kna1, vbak ,vbap.
    TYPES: BEGIN OF ty_kna1,
             kunnr LIKE kna1-kunnr,
             land1 LIKE kna1-land1,
             name1 LIKE kna1-name1,
             ort01 LIKE kna1-ort01,
             var1,
           END OF ty_kna1.
    TYPES: BEGIN OF ty_vbak,
             KUNNR LIKE VBAK-KUNNR,
             vbeln LIKE vbak-vbeln,
             erdat LIKE vbak-erdat,
             ernam LIKE vbak-ernam,
             netwr LIKE vbak-netwr,
           END OF ty_vbak.
    TYPES: BEGIN OF ty_vbap,
             vbeln LIKE vbap-vbeln,
             posnr LIKE vbap-posnr,
             matnr LIKE vbap-matnr,
           END OF ty_vbap.
    DATA: it_kna1 TYPE STANDARD TABLE OF ty_kna1,
          wa_kna1 TYPE ty_kna1.
    DATA: it_vbak TYPE STANDARD TABLE OF ty_vbak,
          wa_vbak TYPE ty_vbak.
    DATA: it_vbap TYPE STANDARD TABLE OF ty_vbap,
          wa_vbap TYPE ty_vbap.
    DATA: kinfo TYPE slis_keyinfo_alv.
    DATA: wa_layout TYPE slis_layout_alv,
          it_fieldcat TYPE slis_t_fieldcat_alv,
          wa_fieldcat TYPE slis_fieldcat_alv,
          it_event_kna1 TYPE slis_t_event,
          wa_event_kna1 TYPE slis_alv_event,
          it_event_vbak TYPE slis_t_event,
          wa_event_vbak TYPE slis_alv_event,
          it_event_vbap TYPE slis_t_event,
          wa_event_vbap TYPE slis_alv_event.
    SELECT-OPTIONS: s_kunnr FOR kna1-kunnr DEFAULT 1000 TO 1500.
    INITIALIZATION.
      PERFORM layout.
      PERFORM fieldcat.
      kinfo-header01 = 'KUNNR'.
      kinfo-item01 = 'KUNNR'.
    START-OF-SELECTION.
      PERFORM datafetch_kna1.
      PERFORM datafetch_vbak.
      PERFORM display.
    *&      Form  fieldcat
          text
    FORM fieldcat .
      REFRESH it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = 'KUNNR'.
      wa_fieldcat-seltext_l = 'CUSTOMER NUMBER'.
      wa_fieldcat-datatype = 'CHAR'.
      wa_fieldcat-outputlen = 30.
      wa_fieldcat-tabname = 'IT_KNA1'.
      wa_fieldcat-key = 'X'.
      wa_fieldcat-hotspot = 'X'.
      wa_fieldcat-emphasize = 'C21'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = 'LAND1'.
      wa_fieldcat-seltext_l = 'COUNTRY CODE'.
      wa_fieldcat-datatype = 'CHAR'.
      wa_fieldcat-outputlen = 30.
      wa_fieldcat-tabname = 'IT_KNA1'.
      wa_fieldcat-hotspot = 'X'.
      wa_fieldcat-emphasize = 'C31'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = 'NAME1'.
      wa_fieldcat-seltext_l = 'CUSTOMER NAME'.
      wa_fieldcat-datatype = 'CHAR'.
      wa_fieldcat-outputlen = 35.
      wa_fieldcat-tabname = 'IT_KNA1'.
      wa_fieldcat-hotspot = 'X'.
      wa_fieldcat-emphasize = 'C71'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = 'ORT01'.
      wa_fieldcat-seltext_l = 'COUNTRY '.
      wa_fieldcat-datatype = 'CHAR'.
      wa_fieldcat-outputlen = 30.
      wa_fieldcat-tabname = 'IT_KNA1'.
      wa_fieldcat-hotspot = 'X'.
      wa_fieldcat-emphasize = 'C51'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = 'VBELN'.
      wa_fieldcat-seltext_l = 'SALES ORDER'.
      wa_fieldcat-datatype = 'CHAR'.
      wa_fieldcat-outputlen = 30.
      wa_fieldcat-tabname = 'IT_VBAK'.
      wa_fieldcat-key = 'X'.
      wa_fieldcat-hotspot = 'X'.
      wa_fieldcat-emphasize = 'C11'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = 'ERDAT'.
      wa_fieldcat-seltext_l = 'CREATED ON'.
      wa_fieldcat-datatype = 'DATS'.
      wa_fieldcat-outputlen = 35.
      wa_fieldcat-tabname = 'IT_VBAK'.
      wa_fieldcat-hotspot = 'X'.
      wa_fieldcat-emphasize = 'C61'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = 'ERNAM'.
      wa_fieldcat-seltext_l = 'CREATED BY'.
      wa_fieldcat-datatype = 'CHAR'.
      wa_fieldcat-outputlen = 35.
      wa_fieldcat-tabname = 'IT_VBAK'.
      wa_fieldcat-hotspot = 'X'.
      wa_fieldcat-emphasize = 'C21'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = 'NETWR'.
      wa_fieldcat-seltext_l = 'NET VALUE'.
      wa_fieldcat-datatype = 'CURR'.
      wa_fieldcat-outputlen = 30.
      wa_fieldcat-tabname = 'IT_VBAK'.
      wa_fieldcat-hotspot = 'X'.
      wa_fieldcat-emphasize = 'C41'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
    ENDFORM.                    "fieldcat
    *&      Form  layout
          text
    -->  p1        text
    <--  p2        text
    FORM layout .
      wa_layout-zebra = 'X'.
    wa_layout-colwidth_optimize = 'X'.
    wa_layout-totals_text = 'GRAND_TOTAL'.
    wa_layout-subtotals_text = 'SUB_TOTAL'.
    wa_layout-Box_fieldname = 'X'.
      wa_layout-expand_fieldname  = 'VAR1'.
    ENDFORM.                    "layout
    *&      Form  DATAFETCH_KNA1
          text
    -->  p1        text
    <--  p2        text
    FORM datafetch_kna1 .
      SELECT   kunnr land1 name1 ort01
               FROM kna1
               INTO TABLE it_kna1
               WHERE kunnr IN s_kunnr.
    ENDFORM.                    " DATAFETCH_KNA1
    *&      Form  DATAFETCH_VBAK
          text
    -->  p1        text
    <--  p2        text
    FORM datafetch_vbak .
      SELECT  KUNNR vbeln erdat ernam netwr
             FROM vbak
             INTO TABLE it_vbak
             FOR ALL ENTRIES IN it_kna1
             WHERE kunnr = it_kna1-kunnr.
    ENDFORM.                    " DATAFETCH_VBAK
    *&      Form  DISPLAY
          text
    -->  p1        text
    <--  p2        text
    FORM display .
      CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
        EXPORTING
      I_INTERFACE_CHECK              = ' '
         i_callback_program             = sy-repid
      I_CALLBACK_PF_STATUS_SET       = ' '
      I_CALLBACK_USER_COMMAND        = ' '
         is_layout                      = wa_layout
         it_fieldcat                    = it_fieldcat
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
         i_screen_start_column          = 5
         i_screen_start_line            = 1
         i_screen_end_column            = 150
         i_screen_end_line              = 35
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     =
      IT_EVENTS                      =
      IT_EVENT_EXIT                  =
          i_tabname_header               = 'IT_KNA1'
          i_tabname_item                 = 'IT_VBAK'
      I_STRUCTURE_NAME_HEADER        =
      I_STRUCTURE_NAME_ITEM          =
          is_keyinfo                     = kinfo
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                =
      IR_SALV_HIERSEQ_ADAPTER        =
      IT_EXCEPT_QINFO                =
      I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
        TABLES
          t_outtab_header                = it_kna1
          t_outtab_item                  = it_vbak
       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.                    " DISPLAY
    Regards,
    Jagadish

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

  • Problem with same layout (variant) for two ALV Grid and ALV Tree

    Hello!
    I have two docking containers on the screen. On the left i have cl_gui_alv_tree, on the right cl_salv_table.
    When a user set a default layout for ALV Grid (or ALV Tree), raport starts and sets this layout in both objects (tree and grid).
    How to avoid this?

    Hi,
    Take Two radio buttons.
    First radion button display the two containers in grid format,
    second radio button display the two containers in tree format base on user selection.
    CREATE OBJECT G_DOCING_CONTAINER
        EXPORTING PARENT = G_CUSTOM_CONTAINER."G_CONTAINER.
    DISPLAY THE DATA IN GRID FORMATA
    CREATE OBJECT r_grid
        EXPORTING
          i_parent          = G_DOCING_CONTAINER
    CALL METHOD g_docing_container->set_width
          EXPORTING
            width      = 1300.
    DISPLAY THE GRID DATA IN SECOND CONTAINER
    CREATE OBJECT r_grid1
        EXPORTING
          i_parent          = G_DOCING_CONTAINER
    CALL METHOD g_docing_container->set_width
          EXPORTING
            width      = 1300.
    OTHERWISE WE CAN DISPLAY THE TWO CONTAINERS DATA IN A GRID FORMAT
    CREATE OBJECT g_tree
        EXPORTING
          parent                = g_docing_container"g_custom_container
    IF R1 = 'X'.  "FOR GRID DISPLAY
    CALL METHOD r_grid1->set_table_for_first_display
    CALL METHOD r_grid2->set_table_for_first_display
    ELSE.
    ************TREE DISPLAY
    ENDIF.
    regards,
    muralii

  • 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

  • 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

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

Maybe you are looking for

  • Best iCloud setup when I have two apple ID's

    Ok so I have two apple ID's---One is a yahoo email address, and that is what I began using forever ago with iTunes, so I have a bunch of purchased music and apps with that username. Since that is my ITUNES username, that is what my iphone has been se

  • Apple Restore Bricked my iPodTouch

    I attempted to clear my iPodTouch of all data and settings by using Restore. It downloaded some S/W and then half did something and then fell over. "Could not Restore etc etc " with the final error code : 0xE800006c was the result. The item is sittin

  • Need help for Flash quiz with score and timer

    Greetings, I need to urgently create a flash game with 10 questions, 3 answers per question. At the end of the quiz I need to get the time the quiz was completed for, what answers the player answered correctly and the time its completed into a databa

  • Where to get plugins?

    Please let me know where to get SQL Server 2000 plugin?? I spent an hour trying to find it to no avail. I appreciate your help.

  • [SOLVED] Udev missing MD raid devices

    I have a non-root raid partition that is not being detected during boot-up. The problem is that udev is not creating the /dev/md/0 mount point. I can use mknod to create the mount point, but it will disappear after the next init. So, how can I force