ALV tree: code is getting dumped............................

Hi all,
I want to display output using ALV tree. I havent worked on this before, So kindly provide me useful sample programs to display output using ALV tree.
Also i am creating field catalog using following code:
  data :  gt_fieldcatalog type lvc_t_fcat. "Fieldcatalog
get fieldcatalog
  call function 'LVC_FIELDCATALOG_MERGE'
       EXPORTING
            i_structure_name = 'TP_OUTTAB'
       CHANGING
            ct_fieldcat      = gt_fieldcatalog.
But its getting dumped and  "NO_FIELDCATALOG_AVAILABLE"  exception is raised.
Also strucure TP_OUTTAB is as:
TYPES: BEGIN OF tp_outtab,
       aufnr              TYPE    aufk-aufnr,  
       txt                TYPE    t003p-txt,     
       maktx              TYPE    makt-maktx,
       charg              TYPE    afpo-charg,    
       icon               TYPE    char4,         
       prueflos           TYPE    afko-prueflos,                     prueflos _ r              TYPE    icon-id,      
       ext_roses(5),                                   
      expt_roses         TYPE    icon-id,      
       zurl(8), "                               
       zurl_r             TYPE    icon-id,       
       crstat_t           TYPE    icon-id,     
       crstat             TYPE    icon-id,       
       adres              TYPE    cochp-adres,  
       END OF tp_outtab.
Kindly tell me why the code is getting dumped. Seems there is some problem with structure.
Regards,
Sachin

Hi,
try the following example.
TYPE-POOLS: SLIS.
DATA: BEGIN OF I_VBAK OCCURS 0,
      VBELN LIKE VBAK-VBELN,
      ERNAM LIKE VBAK-ERNAM,
      ERDAT LIKE VBAK-ERDAT,
      AUDAT LIKE VBAK-AUDAT,
      VAR1,
      END OF I_VBAK.
DATA: BEGIN OF I_VBAP OCCURS 0,
      VBELN LIKE VBAP-VBELN,
      POSNR LIKE VBAP-POSNR,
      MATNR LIKE VBAP-MATNR,
      CHARG LIKE VBAP-CHARG,
      END OF I_VBAP.
DATA: FLDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
      LAYOUT TYPE SLIS_LAYOUT_ALV,
      KEY TYPE SLIS_KEYINFO_ALV.
DATA: IT_HEADER1 TYPE SLIS_T_LISTHEADER.
DATA: WA_HEADER1 TYPE SLIS_LISTHEADER.
DATA: IT_EVE1 TYPE SLIS_T_EVENT,
      WA_EVE1 TYPE SLIS_ALV_EVENT.
SELECT VBELN ERNAM ERDAT AUDAT FROM VBAK
INTO CORRESPONDING FIELDS OF TABLE I_VBAK
UP TO 20 ROWS.
SELECT VBELN POSNR MATNR CHARG FROM VBAP
INTO CORRESPONDING FIELDS OF TABLE I_VBAP
UP TO 20 ROWS.
FLDCAT-FIELDNAME = 'VBELN'.
FLDCAT-TABNAME = 'I_VBAK'.
FLDCAT-REF_FIELDNAME = 'VBELN'.
FLDCAT-REF_TABNAME = 'VBAK'.
FLDCAT-SELTEXT_M = 'SALES DOC.'.
FLDCAT-COL_POS = 0.
FLDCAT-KEY = 'X'.
APPEND FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'ERNAM'.
FLDCAT-TABNAME = 'I_VBAK'.
FLDCAT-REF_FIELDNAME = 'ERNAM'.
FLDCAT-REF_TABNAME = 'VBAK'.
FLDCAT-SELTEXT_M = 'NAME OF PERSON'.
FLDCAT-COL_POS = 1.
APPEND FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'ERDAT'.
FLDCAT-TABNAME = 'I_VBAK'.
FLDCAT-REF_FIELDNAME = 'ERDAT'.
FLDCAT-REF_TABNAME = 'VBAK'.
FLDCAT-SELTEXT_M = 'RECORD DATE'.
FLDCAT-COL_POS = 2.
APPEND FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'AUDAT'.
FLDCAT-TABNAME = 'I_VBAK'.
FLDCAT-REF_FIELDNAME = 'AUDAT'.
FLDCAT-REF_TABNAME = 'VBAK'.
FLDCAT-SELTEXT_M = 'DOCUMENT DATE'.
FLDCAT-COL_POS = 3.
APPEND FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'POSNR'.
FLDCAT-TABNAME = 'I_VBAP'.
FLDCAT-REF_FIELDNAME = 'POSNR'.
FLDCAT-REF_TABNAME = 'VBAP'.
FLDCAT-SELTEXT_M = 'SALES DOC ITEM'.
FLDCAT-COL_POS = 4.
APPEND FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'MATNR'.
FLDCAT-TABNAME = 'I_VBAP'.
FLDCAT-REF_FIELDNAME = 'MATNR'.
FLDCAT-REF_TABNAME = 'VBAP'.
FLDCAT-SELTEXT_M = 'MATERIAL NO'.
FLDCAT-COL_POS = 5.
APPEND FLDCAT.
CLEAR FLDCAT.
FLDCAT-FIELDNAME = 'CHARG'.
FLDCAT-TABNAME = 'I_VBAP'.
FLDCAT-REF_FIELDNAME = 'CHARG'.
FLDCAT-REF_TABNAME = 'VBAP'.
FLDCAT-SELTEXT_M = 'BATCH NUMBER'.
FLDCAT-COL_POS = 6.
APPEND FLDCAT.
CLEAR FLDCAT.
LAYOUT-EXPAND_FIELDNAME = 'VAR1'.
KEY-HEADER01 = 'VBELN'.
KEY-ITEM01 = 'VBELN'.
  CLEAR WA_EVE1.
  WA_EVE1-NAME = 'TOP_OF_PAGE'.
  WA_EVE1-FORM = 'TOP-OF-PAGE1'.
  APPEND WA_EVE1 TO IT_EVE1.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
  EXPORTING
   I_CALLBACK_PROGRAM             = SY-REPID
   IS_LAYOUT                      = LAYOUT
   IT_FIELDCAT                    = FLDCAT[]
   IT_EVENTS                      = IT_EVE1[]
    I_TABNAME_HEADER               = 'I_VBAK'
    I_TABNAME_ITEM                 = 'I_VBAP'
    IS_KEYINFO                     = KEY
  TABLES
    T_OUTTAB_HEADER                = I_VBAK
    T_OUTTAB_ITEM                  = I_VBAP
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.
FORM TOP-OF-PAGE1.                                        WA_HEADER1-TYP = 'H'.
  WA_HEADER1-INFO = 'Hierarchical Display'.
  APPEND WA_HEADER1 TO IT_HEADER1.
  CLEAR WA_HEADER1.
  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      IT_LIST_COMMENTARY       = IT_HEADER1[].
  REFRESH IT_HEADER1.
ENDFORM.                    "TOP-OF-PAGE1
Reward points,if it is useful.
Thanks,
chandu.

Similar Messages

  • Double Click in ALV TREE doesn't get triggered

    Hello All,
    Double click event on item in a alv tree report doesn't get triggered. I thought I was doing everything right. Please help me out.
    Look at the code below and tell me what else I need to do.
    <b>FORM register_events .
    Event registration: tell ALV Tree which events shall be passed
    from frontend to backend.
      DATA: lt_events TYPE cntl_simple_events,
            l_event TYPE cntl_simple_event,
            l_event_receiver TYPE REF TO lcl_tree_event_receiver.
    Frontend registration:  get already registered tree events
      CALL METHOD g_alv_tree->get_registered_events
        IMPORTING
          events = lt_events.
    Frontend registration: add additional event ids
      l_event-eventid = cl_gui_column_tree=>eventid_node_double_click.
      APPEND l_event TO lt_events.
    Frontend registration: provide new event table to alv tree
      CALL METHOD g_alv_tree->set_registered_events
        EXPORTING
          events                    = lt_events
        EXCEPTIONS
          cntl_error                = 1
          cntl_system_error         = 2
          illegal_event_combination = 3.
      IF sy-subrc <> 0.
        MESSAGE x208(00) WITH 'ERROR'.                          "#EC NOTEXT
      ENDIF.
    Register events on backend (ABAP Objects event handling)
      CREATE OBJECT l_event_receiver.
      SET HANDLER l_event_receiver->node_double_click FOR g_alv_tree.
      SET HANDLER l_event_receiver->item_double_click FOR g_alv_tree.
      SET HANDLER l_event_receiver->on_function_selected FOR g_toolbar.
    ENDFORM.                    " register_events</b>
    When I double click on item on the report double click event doesnt trigger. what could be the problem? Any sample programs?
    Thanks,
    Chandni

    Hi,
    Here is a sample code for you.
    report ztree.
    TABLES : vbak.
    DATA: BEGIN OF mylist OCCURS 50. " Internal table hierarchy
    INCLUDE STRUCTURE snodetext.
    DATA: END OF mylist.
    DATA: f15 TYPE c.
    DATA :
    BEGIN OF gt_sales OCCURS 0,
    vbeln LIKE vbak-vbeln,
    kunnr LIKE vbak-kunnr,
    matnr LIKE vbap-matnr,
    arktx LIKE vbap-arktx,
    END OF gt_sales.
    SELECT-OPTIONS : s_vbeln FOR vbak-vbeln.
    START-OF-SELECTION.
    SET PF-STATUS 'ZTREE1'.
    SET TITLEBAR 'T1'.
    Fill internal table with pseudo-data
    PERFORM fill_itab.
    Hierarchy output
    PERFORM main.
    *& Form FILL_ITAB
    text
    --> p1 text
    <-- p2 text
    FORM fill_itab .
    *Fill the gt_sales table
    SELECT vkvbeln vkkunnr vpmatnr vparktx INTO CORRESPONDING FIELDS OF
    TABLE gt_sales
    FROM ( vbak AS vk INNER JOIN vbap AS vp ON vkvbeln = vpvbeln )
    WHERE vk~vbeln IN s_vbeln.
    SORT gt_sales BY vbeln kunnr.
    *Fill the root
    mylist-name = 'Report Tree List'.
    mylist-color = 1.
    mylist-intensiv = '1'.
    mylist-text = 'Report Tree List'.
    mylist-tlength = 16.
    mylist-tlevel = 1.
    mylist-tcolor = 1.
    mylist-tintensiv = '1'.
    mylist-text1 = 'using "RS_TREE_CONSTRUCT" function'.
    mylist-tlength1 = 50.
    mylist-tcolor1 = 2.
    mylist-tintensiv1 = '0'.
    APPEND mylist.
    LOOP AT gt_sales.
    ON CHANGE OF gt_sales-vbeln.
    mylist-name = 'level1'.
    mylist-color = 0.
    mylist-intensiv = '0'.
    mylist-text = 'Sales Document no:'.
    mylist-tlength = 20.
    mylist-tlevel = 2.
    mylist-tcolor = 7.
    mylist-tintensiv = '1'.
    mylist-text1 = gt_sales-vbeln.
    mylist-tlength1 = 30.
    mylist-tcolor1 = 2.
    mylist-tintensiv1 = '0'.
    APPEND mylist.
    ENDON.
    ON CHANGE OF gt_sales-kunnr.
    mylist-name = 'level2'.
    mylist-color = 0.
    mylist-intensiv = '0'.
    mylist-text = 'Customer no:'.
    mylist-tlength = 20.
    mylist-tlevel = 3.
    mylist-tcolor = 5.
    mylist-tintensiv = '1'.
    mylist-text1 = gt_sales-kunnr.
    mylist-tlength1 = 30.
    mylist-tcolor1 = 3.
    mylist-tintensiv1 = '0'.
    APPEND mylist.
    ENDON.
    mylist-name = 'level3'.
    mylist-color = 0.
    mylist-intensiv = '0'.
    mylist-text = gt_sales-matnr.
    mylist-tlength = 15.
    mylist-tlevel = 4.
    mylist-tcolor = 4.
    mylist-tintensiv = '0'.
    mylist-text1 = gt_sales-arktx.
    mylist-tlength1 = 30.
    mylist-tcolor1 = 2.
    mylist-tintensiv1 = '0'.
    APPEND mylist.
    ENDLOOP.
    ENDFORM. " FILL_ITAB
    *& Form MAIN
    text
    --> p1 text
    <-- p2 text
    FORM main .
    PERFORM hierarchy. " construct & draw the tree
    ENDFORM. " MAIN
    *& Form HIERARCHY
    text
    --> p1 text
    <-- p2 text
    FORM hierarchy .
    PERFORM build_tree.
    PERFORM draw_tree.
    ENDFORM. " HIERARCHY
    FORM BUILD_TREE *
    Builds the tree from internal table *
    Uses the Function module RS_TREE_CONSTRUCT *
    FORM build_tree.
    CALL FUNCTION 'RS_TREE_CONSTRUCT'
    TABLES
    nodetab = mylist
    EXCEPTIONS
    tree_failure = 1.
    ENDFORM. "build_tree
    FORM DRAW_TREE *
    Builds the tree from internal table *
    Uses the Function module RS_TREE_DISPLAY *
    FORM draw_tree.
    sy-lsind = 0.
    CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
    EXPORTING
    callback_program = 'ZREPORT_TREE'
    callback_user_command = 'NODE_SELECT'
    IMPORTING
    f15 = f15.
    ENDFORM. "draw_tree
    FORM NODE_SELECT *
    Handles selection of nodes *
    FORM node_select TABLES knoten STRUCTURE seucomm
    USING command
    CHANGING exit
    list_refresh.
    Processing of commands for hierarchy list
    CASE command.
    WHEN 'DISP'.
    CASE knoten-id.
    WHEN '000002'.
    *Display Sales Order
    SET PARAMETER ID 'AUN' FIELD knoten-text1.
    CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
    WHEN '000003'.
    *Display Customer
    SET PARAMETER ID 'KUN' FIELD knoten-text1.
    CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
    ENDCASE.
    ENDCASE.
    list_refresh = 'X'.
    ENDFORM. "node_select

  • ALV tree  not getting refreshed

    Hi
    I have 2 fields A and B in the main screen and a tabstrip with 4 tabs.
    Each tab contains a ALV tree
    Now when I open the main screen for the first time the ALV tree data is coming properly as per the default values of A and B.
    But when I change the values of A or B the ALV tree does not get refreshed. The final table has the changed data but the ALV shows only the old data.
    I am doing the ALV tree for the first time in module pool. Please provide some sample code to refresh the ALV tree.
    Regards,

    Hi
    Alv tree is now getting refreshed.The subscreen refresh problem is solved
    we have to use REFRESH_TABLE_DISPLAY method to do it.
    if tree1 is initial
       create object
       create container
      call method set_table_for_first display
    else.
      call method refresh_table_display.
    endif.
    Regards,
    Mozila

  • Mt_outtab error in ALV tree node expantion

    I ahve made tree ALC n get dump in the follwing code when I expand any node
    ASSIGN mt_outtab->* TO <tab1>.
      " assign local copy of initial line of <tab1> to <wa>.
      CREATE DATA l_dref_wa LIKE LINE OF <tab1>.
      ASSIGN l_dref_wa->* TO <wa>.
    this is because mt_outtab->*  does no have values which is my table
    dont know how its freed on expanding the node
    I made a same prog from a system program n thats working fine but i cannot get the diffrence???
    plz help

    hi,
    dinamic table create is like this, how can you create your mt_outtab->* table;
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog           = lt
        IMPORTING
          ep_table                  = <fs_data>
        EXCEPTIONS
          generate_subpool_dir_full = 1
          OTHERS                    = 2.
      IF sy-subrc <> 0.
      ENDIF.
    Assign Dyn Table To Field Sumbol
      ASSIGN <fs_data>->* TO <tab1>.
      CREATE DATA l_dref_wa LIKE LINE OF <tab1>.
      ASSIGN l_dref_wa->* TO <wa>.

  • ALV Tree dumps permanently

    Hello!
    This below listed code dumps all over the time.
    I checked the whole code and its almost impossible to find
    out the problem. Hopefully has somebody an idea.
    Reagrds
    Ilhan
    class cl_gui_column_tree definition load.
    class cl_gui_cfw definition load.
    data tree1  type ref to cl_gui_alv_tree_simple.
    INCLUDE /G2A/ZTREE_ICON.
    INCLUDE /G2A/ZTREE_EVENT.
    data: gt_sflight      type sflight occurs 0,      "Output-Table
          gt_fieldcatalog type lvc_t_fcat, "Fieldcatalog
          gt_sort         type lvc_t_sort, "Sortiertabelle
          ok_code         like sy-ucomm.   "OK-Code
    data itab type  ZQMCOMP occurs 0.
    data wa type ZQMCOMP.
    * Struktur Feldkatalog
    data lw TYPE  lvc_s_fcat.
    * interne Tabelle  Feldkatalog
    data  gt  TYPE lvc_t_fcat.
    * Layoutstruktur
    data wa_layout TYPE lvc_s_layo.
    start-of-selection.
    end-of-selection.
      call screen 100.
    *&      Form  BUILD_FIELDCATALOG
    *       text
    form build_fieldcatalog.
    ** get fieldcatalog
    *  call function 'LVC_FIELDCATALOG_MERGE'
    *       exporting
    *            i_structure_name = 'wa'
    *       changing
    *            ct_fieldcat      = gt.
    ** change fieldcatalog
    *  data: ls_fieldcatalog type lvc_s_fcat.
    *  loop at gt_fieldcatalog into ls_fieldcatalog.
    *    case ls_fieldcatalog-fieldname.
    *      when 'CARRID' or 'CONNID' or 'FLDATE'.
    *        ls_fieldcatalog-no_out = 'X'.
    *        ls_fieldcatalog-key    = ''.
    *      when 'PRICE' or 'SEATSOCC' or 'SEATSMAX' or 'PAYMENTSUM'.
    *        ls_fieldcatalog-do_sum = 'X'.
    *    endcase.
    *    modify gt_fieldcatalog from ls_fieldcatalog.
    *  endloop.
    * ================================================
    *                FELDKATALOG
    * ================================================
    CLEAR: lw.
        lw-fieldname = 'QMNUM'.
        lw-tabname   = 'wa'.
        lw-col_pos  = 1.
        lw-EMPHASIZE = 'C711'.
        APPEND lw TO gt.
    CLEAR: lw.
        lw-fieldname = 'QMART'.
        lw-tabname   = 'wa'.
        lw-col_pos  = 2.
        lw-EMPHASIZE = 'C711'.
        APPEND lw TO gt.
    CLEAR: lw.
        lw-fieldname = 'POSNR'.
        lw-tabname   = 'wa'.
        lw-col_pos  = 3  .
        lw-EMPHASIZE = 'C711'.
        APPEND lw TO gt.
    CLEAR: lw.
        lw-fieldname = 'REFNR'.
        lw-tabname   = 'wa'.
        lw-col_pos  = 4.
        lw-EMPHASIZE = 'C711'.
        APPEND lw TO gt.
    CLEAR: lw.
        lw-fieldname = 'KUNDE'.
        lw-tabname   = 'wa'.
        lw-col_pos  = 5.
        lw-EMPHASIZE = 'C711'.
        APPEND lw TO gt.
    CLEAR: lw.
        lw-fieldname = 'DUNS'.
        lw-tabname   = 'wa'.
        lw-col_pos  = 6.
        lw-EMPHASIZE = 'C711'.
        APPEND lw TO gt.
    endform.                               " BUILD_FIELDCATALOG
    *&      Form  BUILD_OUTTAB
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form build_outtab.
    *  select * from sflight into table gt_sflight.
      select * from ZQMCOMP into table itab.
    *              up to 1 rows.
    endform.                               " BUILD_OUTTAB
    *&      Form  BUILD_SORT_TABLE
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form build_sort_table.
      data ls_sort_wa type lvc_s_sort.
    * create sort-table
      ls_sort_wa-spos = 1.
      ls_sort_wa-fieldname = 'CARRID'.
      ls_sort_wa-up = 'X'.
      ls_sort_wa-subtot = 'X'.
      append ls_sort_wa to gt_sort.
      ls_sort_wa-spos = 2.
      ls_sort_wa-fieldname = 'CONNID'.
      ls_sort_wa-up = 'X'.
      ls_sort_wa-subtot = 'X'.
      append ls_sort_wa to gt_sort.
      ls_sort_wa-spos = 3.
      ls_sort_wa-fieldname = 'FLDATE'.
      ls_sort_wa-up = 'X'.
      append ls_sort_wa to gt_sort.
    endform.                               " BUILD_SORT_TABLE
    *&      Module  PBO  OUTPUT
    *       text
    module pbo output.
      if tree1 is initial.
        perform init_tree.
      endif.
      set pf-status 'MAIN100'.
    endmodule.                             " PBO  OUTPUT
    *&      Module  PAI  INPUT
    *       text
    module pai input.
      case ok_code.
        when 'EXIT' or 'BACK' or 'CANC'.
          perform exit_program.
        when others.
          call method cl_gui_cfw=>dispatch.
      endcase.
      clear ok_code.
    endmodule.                             " PAI  INPUT
    *&      Form  exit_program
    *       free object and leave program
    form exit_program.
      call method tree1->free.
      leave program.
    endform.                               " exit_program
    *&      Form  register_events
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form register_events.
    * define the events which will be passed to the backend
      data: lt_events type cntl_simple_events,
            l_event type cntl_simple_event.
    * define the events which will be passed to the backend
      l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_header_click.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_item_keypress.
      append l_event to lt_events.
      call method tree1->set_registered_events
        exporting
          events = lt_events
        exceptions
          cntl_error                = 1
          cntl_system_error         = 2
          illegal_event_combination = 3.
    * set Handler
      data: l_event_receiver type ref to lcl_tree_event_receiver.
      create object l_event_receiver.
      set handler l_event_receiver->on_add_hierarchy_node
                                                            for tree1.
    endform.                               " register_events
    *&      Form  build_header
    *       build table for html_header
    *  -->  p1        text
    *  <--  p2        text
    form build_comment using
          pt_list_commentary type slis_t_listheader
          p_logo             type sdydo_value.
      data: ls_line type slis_listheader.
    * LIST HEADING LINE: TYPE H
      clear ls_line.
      ls_line-typ  = 'H'.
      ls_line-info = 'METZELER OEM-BEANSTANDUNGEN'.
      append ls_line to pt_list_commentary.
      clear ls_line.
      ls_line-typ  = 'S'.
      ls_line-key  = 'Datum'.
      ls_line-info = sy-datlo.
      append ls_line to pt_list_commentary.
    *  ls_line-key  = 'time'.
    *  ls_line-info = '00.00 pm'.
    *  append ls_line to pt_list_commentary.
    ** ACTION LINE: TYPE A
    *  clear ls_line.
    *  ls_line-typ  = 'A'.
    ** LS_LINE-KEY:  NOT USED FOR THIS TYPE
    *  ls_line-info = 'up-to-date data'.
    *  append ls_line to pt_list_commentary.
      p_logo = 'ENJOYSAP_LOGO'.
    endform.
    *&      Form  init_tree
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM init_tree.
      perform build_fieldcatalog.
      perform build_outtab.
    *  perform build_sort_table.
    * create container for alv-tree
      data: l_tree_container_name(30) type c,
            l_custom_container type ref to cl_gui_custom_container.
      l_tree_container_name = 'TREE1'.
      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 tree1
        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      = ''
            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.
    * create info-table for html-header
      data: lt_list_commentary type slis_t_listheader,
            l_logo             type sdydo_value.
      perform build_comment using
                     lt_list_commentary
                     l_logo.
    * repid for saving variants
      data: ls_variant type disvariant.
      ls_variant-report = sy-repid.
    * register events
      perform register_events.
    * create hierarchy
      call method tree1->set_table_for_first_display
              exporting
                   it_list_commentary   = lt_list_commentary
    *               i_logo               = l_logo
                   i_background_id      = 'ALV_BACKGROUND'
                   i_save               = 'A'
                   is_variant            = ls_variant
              changing
    *               it_sort              = gt_sort
                   it_outtab            = itab
    *               it_fieldcatalog      = gt_fieldcatalog.
                   it_fieldcatalog      = gt.
    * expand first level
      call method tree1->expand_Tree
             exporting
                 i_level = 1.
    * optimize column-width
      call method tree1->column_optimize
               exporting
                   i_start_column = tree1->c_hierarchy_column_name
                   i_end_column   = tree1->c_hierarchy_column_name.
    ENDFORM.                    " init_tree

    sorry this the english version
    ABAP runtime errors    GETWA_NOT_ASSIGNED
           Occurred on     09.03.2007 at 15:35:20
    >> Short dump has not been completely stored. It is too big.
    Field symbol has not yet been assigned.
    What happened?
    The current ABAP/4 program "CL_GUI_ALV_TREE_SIMPLE========CP " had to be
    terminated because
    one of the statements could not be executed.
    This is probably due to an error in the ABAP/4 program.
    What can you do?
    Note the actions and input that caused the error.
    Inform your SAP system administrator.
    You can print out this message by choosing "Print". Transaction ST22
    allows you to display and manage termination messages, including keeping
    them beyond their normal deletion date.
    Error analysis
    You attempted to access an unassigned field symbol
    (data segment 32771).
    This error occurs:
    - if you address a typed field symbol before it has been set with
      ASSIGN or
    - if you address a field symbol that has been reset with UNASSIGN
      or pointed to a local field that no longer exists, or
    - if you address a field symbol that pointed to a line of an internal
      table that has now been deleted, or
    - if you address a global function interface partameter, even
      though the relevant function module is not active,
      i.e. it is not in the list of active calls. You can get the list
      of active calls from the this short dump.
    How to correct the error
    If the error occurred in a non-modified SAP program, you may be
    able to find a solution in the SAP note system.
    If you have access to the note system yourself, use the following
    search criteria:
    "GETWA_NOT_ASSIGNED"
    "CL_GUI_ALV_TREE_SIMPLE========CP " or "CL_GUI_ALV_TREE_SIMPLE========CM00J "
    "SET_NODES"
    If you cannot solve the problem yourself, please send the
    following documents to SAP:
    1. A hard copy print describing the problem.
       To obtain this, select the "Print" function on the current screen.
    2. A suitable hardcopy prinout of the system log.
       To obtain this, call the system log with Transaction SM21
       and select the "Print" function to print out the relevant
       part.
    3. If the programs are your own programs or modified SAP programs,
       supply the source code.
       To do this, you can either use the "PRINT" command in the editor or
       print the programs using the report RSINCL00.
    4. Details regarding the conditions under which the error occurred
       or which actions and input led to the error.
    System environment
    SAP Release.............. "46C"
    Application server....... "s96as822"
    Network address.......... "53.71.198.54"
    Operating system......... "SunOS"
    Release.................. "5.8"
    Hardware type............ "sun4u"
    Database server.......... "s96as822"
    Database type............ "ORACLE"
    Database name............ "G2E"
    Database owner........... "SAPR3"
    Character set............ "en_US"
    SAP kernel............... "46D"
    Created on............... "Nov 27 2005 20:48:26"
    Created in............... "SunOS 5.7 Generic_106541-05 sun4u"
    Database version......... "OCI_816_64__OCI_7_API "
    Patch level.............. "2162"
    Patch text............... " "
    Supported environment....
    Database................. "ORACLE 8.0.5.., ORACLE 8.0.6.., ORACLE
    8.1.6.., ORACLE 8.1.7.., ORACLE 9.2.0.."
    SAP database version..... "46D"
    Operating system......... "SunOS 5.6, SunOS 5.7, SunOS 5.8, SunOS 5.9, SunOS
    5.10, , System build information:, -
    , LCHN
    : 794995"
    User, transaction...
    Client.............. 112
    User................ "ASIKOGLU"
    Language key........ "E"
    Transaction......... "SEU_INT "
    Program............. "CL_GUI_ALV_TREE_SIMPLE========CP "
    Screen.............. "/G2A/ZTREE 0100"
    Screen line......... 2
    Information on where termination occurred
    The termination occurred in the ABAP/4 program
    "CL_GUI_ALV_TREE_SIMPLE========CP " in
    "SET_NODES".
    The main program was "/G2A/ZTREE ".
    The termination occurred in line 210
    of the source code of program "CL_GUI_ALV_TREE_SIMPLE========CM00J " (when
    calling the editor 2100).
    Source code extract
    001800       m_current_node_key = l_node_key.
    001810       raise event ON_ADD_HIERARCHY_NODE
    001820               exporting
    001830                   grouplevel    = ls_sort_wa-fieldname
    001840                   index_outtab  = l_index_outtab.
    001850
    001860   *   stack last key
    001870       insert l_node_key into lt_parent_stack index 1.
    001880
    001890   *   set parameters for next loop.
    001900       l_prev_level = <ls_grouplevels_wa>-level.
    001910       l_index_from = <ls_grouplevels_wa>-index_from.
    001920       l_index_to = <ls_grouplevels_wa>-index_to.
    001930     endloop.
    001940
    001950   * complete last nodes from outtab
    001960     loop at it_outtab assigning <wa> from l_index_from to l_index_to.
    001970       l_index = sy-tabix.
    001980   *   get relation-key
    001990       read table lt_parent_stack into l_relat_key index 1.
    002000       l_relationship = cl_tree_control_base=>relat_last_child.
    002010       assign component l_last_level of structure <wa> to <h_key>.
    002020   *   read and format output-data
    002030       call method cl_gui_alv_grid=>CELL_Display
    002040            exporting
    002050                 is_data     = <wa>
    002060                 i_int_value = <h_key>
    002070            importing
    002080                 e_ext_value = l_node_text
    002090            changing
    >                 cs_fieldcat = ls_fieldcatalog_wa.
    002110       condense l_node_text.
    002120
    002130   *   set layout
    002140       clear ls_node_layout.
    002150       clear lt_item_layout[].
    002160       call method me->set_layout
    002170                   exporting
    002180                       i_grouplevel   = l_last_level
    002190                   importing
    002200                       es_node_layout = ls_node_layout
    002210                       et_item_layout = lt_item_layout
    002220                   changing
    002230                       is_outtabline = <wa>.
    002240
    002250       call method me->add_model_node
    002260                   exporting
    002270                       i_relat_node_key = l_relat_key
    002280                       i_relationship   = l_relationship
    002290                       i_node_text      = l_node_text
    Contents of system fields
    SY field contents..................... SY field contents.....................
    SY-SUBRC 4                             SY-INDEX 0
    SY-TABIX 1                             SY-DBCNT 1
    SY-FDPOS 1                             SY-LSIND 0
    SY-PAGNO 0                             SY-LINNO 1
    SY-COLNO 1

  • Getting dump when using do_sum in alv field cat in the output of the report

    Dear Freinds,
                 Iam getting the alv report when i click on the segma field (Sum) on my salary
    field iam getting dump. and also if i try to print my alv output iam getting dump , only
    happening to my custom report.
    i have used the following code pleae correct me .
    This perform is used for Layout settings
      perform st_layout_build  using gs_layout.
    form st_layout_build  using  st_ls_layout type slis_layout_alv.
       st_ls_layout-no_input          = 'X'.
      st_ls_layout-colwidth_optimize = 'X'.
    st_ls_layout-zebra             = 'X'.
    st_ls_layout-detail_popup      = 'X'.
    endform.                    " st_layout_build
    Field Catalog details
    perform st_fieldcat_init changing gt_fieldcat.
    form st_fieldcat_init  changing  fp_i_fieldcat type slis_t_fieldcat_alv.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 1.
      ls_fieldcat-fieldname    = 'ORGUNIT'.
      ls_fieldcat-seltext_l    = 'Orgunit'.
    ls_fieldcat-no_out       = 'X'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 2.
      ls_fieldcat-fieldname    = 'ORGTEXT'.
      ls_fieldcat-seltext_l    = 'Orgdesc'.
    ls_fieldcat-no_out       = 'X'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-fieldname    = 'SALARY'.
      ls_fieldcat-seltext_l    = 'Salary'.
      ls_fieldcat-col_pos      = 3.
      ls_fieldcat-outputlen   = 15.
      ls_fieldcat-do_sum       = 'X'.
      ls_fieldcat-datatype     = 'CURR'.    "CURR
      append ls_fieldcat to fp_i_fieldcat.
    endform.
    Variant
      perform st_variant_init  using gs_variant g_repid.
    form st_variant_init   using  st_gs_variant type disvariant
                                 st_repid      like sy-repid.
      clear st_gs_variant.
      st_gs_variant-report = st_repid.
    endform.                    " st_variant_init
      g_repid = sy-repid.
      perform st_comment_build  using gt_list_top_of_page[].
    form st_comment_build  using   st_lt_top_of_page type slis_t_listheader.
      data: ls_line type slis_listheader.
    Listenüberschrift: Typ H
      clear ls_line.
      ls_line-typ  = 'H'.
    LS_LINE-KEY:  not used for this type
      ls_line-info = text-000.
      append ls_line to st_lt_top_of_page.
    endform.                    " st_comment_build
         call function 'REUSE_ALV_GRID_DISPLAY'
          exporting
             i_buffer_active        = 'X'
            i_callback_top_of_page = 'TOP_OF_PAGE'
            i_callback_program     = g_repid
            is_layout              = gs_layout
            it_fieldcat            = gt_fieldcat[]
           i_structure_name       = 'i_final'   "c_i_final "'objec'
           i_save                 = g_save
            is_variant             = gs_variant
          tables
            t_outtab               = fp_i_pyrol_final
          exceptions
            program_error          = 1
            others                 = 2.
        if sy-subrc ne 0.
          message e018. " Displaying the ALV GRID has failed
        endif.
    Please could any  one let me know why iam getting dump when iam clicking for total
    on my salary field.
    Regards
    latha

    Dear Chandu,
    my code iam giving in details
    types : begin of ty_output_data,
            staffno     type pernr_d,
            staffname   type emnam,
            grade       type stell,
            orgunit     type orgeh,
            orgtext     type hr_mcstext,
            psgroup     type trfgr,      " Pay Scale Group
            salary      type maxbt,       "PAD_AMT7S,
            rrefunded   type pad_amt7s,
            leavepay    type pad_amt7s,
            mshortfal   type pad_amt7s,   " Medical Shortfall
            echkshfal   type pad_amt7s,   " Execute checkup shortfall
            ofindeduc   type pad_amt7s,   " Other Finance Deduction
            mtyprem     type pad_amt7s,   " maternity premium
            vpbonus     type pad_amt7s,   " VP/Bonus
            gratuity    type pad_amt7s,   " Gratuity
            vpay        type pad_amt7s,   " Variable pay
            mallowance  type pad_amt7s,   " Meal Allowance
            overtime    type pad_amt7s,   " overtime
            other       type  pad_amt7s,  "  OTHER
            pfundeecon  type pad_amt7s,   " PFund Employee's Contribution
            banktrnsfer type pad_amt7s,   " Bank Transfer
            count       type i,
            end of ty_output_data.
    data : i_final         type standard table of ty_output_data.
    iam getting all my data in the internal table  I_FINAL.
    perform get_final_alv  using  i_final.
    form get_final_alv  using   fp_i_pyrol_final type ty_t_output_data.
    *local variable declarations
      data : l_v_idx      type sy-tabix.
    *local work areas
      data : l_wa_final type ty_output_data.
      g_save = 'A'.
    This perform is used for Layout settings
      perform st_layout_build  using gs_layout.
    Field Catalog details
      perform st_fieldcat_init changing gt_fieldcat.
    Variant
      perform st_variant_init  using gs_variant g_repid.
      g_repid = sy-repid.
      perform st_comment_build  using gt_list_top_of_page[].
      if not fp_i_pyrol_final is initial.
        delete adjacent duplicates from fp_i_pyrol_final comparing all fields.
        call function 'REUSE_ALV_GRID_DISPLAY'
          exporting
             i_buffer_active        = 'X'
            i_callback_top_of_page = 'TOP_OF_PAGE'
            i_callback_program     = g_repid
            is_layout              = gs_layout
            it_fieldcat            = gt_fieldcat[]
           i_structure_name       = 'i_final'   "c_i_final "'objec'
           i_save                 = g_save
            is_variant             = gs_variant
          tables
            t_outtab               = fp_i_pyrol_final
          exceptions
            program_error          = 1
            others                 = 2.
        if sy-subrc ne 0.
          message e018. " Displaying the ALV GRID has failed
        endif.
      endif.
    endform.                    " get_final_alv
    form st_layout_build  using  st_ls_layout type slis_layout_alv.
       st_ls_layout-no_input          = 'X'.
      st_ls_layout-colwidth_optimize = 'X'.
    st_ls_layout-zebra             = 'X'.
    st_ls_layout-detail_popup      = 'X'.
    endform.                    " st_layout_build
    form st_fieldcat_init  changing  fp_i_fieldcat type slis_t_fieldcat_alv.
      data: ls_fieldcat type slis_fieldcat_alv.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 1.
      ls_fieldcat-fieldname    = 'ORGUNIT'.
      ls_fieldcat-seltext_l    = 'Orgunit'.
    ls_fieldcat-no_out       = 'X'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 2.
      ls_fieldcat-fieldname    = 'ORGTEXT'.
      ls_fieldcat-seltext_l    = 'Orgdesc'.
    ls_fieldcat-no_out       = 'X'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 5.
      ls_fieldcat-fieldname    = 'STAFFNAME'.
    ls_fieldcat-no_out       = 'X'.
      ls_fieldcat-seltext_l    = 'StaffName'.
      append ls_fieldcat to fp_i_fieldcat.
       clear ls_fieldcat.
      ls_fieldcat-col_pos      = 4.
      ls_fieldcat-fieldname    = 'STAFFNO'.
    ls_fieldcat-no_out       = 'X'.
      ls_fieldcat-seltext_l    = 'StaffNo.'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 6.
      ls_fieldcat-fieldname    = 'GRADE'.
      ls_fieldcat-seltext_l    = 'Grade'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 3.
      ls_fieldcat-fieldname    = 'COUNT'.
      ls_fieldcat-seltext_l    = 'Headcount'.
      append ls_fieldcat to fp_i_fieldcat.
    if the field name is 'Salary' then do a sum on this field.
    IF  fp_fname = c_betrg.
        l_wa_fieldcat-do_sum    = c_x.
    ENDIF.
    NOTE : IAM GETTING PROBLEM IN THE BELOW SALARY.
    IAM JUST CHECKING ITSELF NOT ALLOWING ME TO EXECUTE
      clear ls_fieldcat.
      ls_fieldcat-fieldname    = 'SALARY'.
      ls_fieldcat-seltext_l    = 'Salary'.
      ls_fieldcat-col_pos      = 7.
      ls_fieldcat-outputlen   = 20.
      ls_fieldcat-do_sum       = 'X'.
      ls_fieldcat-datatype     = 'CURR'.    "CURR
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 9.
      ls_fieldcat-fieldname    = 'LEAVEPAY'.
      ls_fieldcat-seltext_l    = 'Leave Pay'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 10.
      ls_fieldcat-fieldname    = 'MSHORTFAL'.
      ls_fieldcat-seltext_l    = 'Med.Sfall'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 11.
      ls_fieldcat-fieldname    = 'ECHKSHFAL'.
      ls_fieldcat-seltext_l    = 'EX.Chckup.Sfall'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 12.
      ls_fieldcat-fieldname    = 'OFINDEDUC'.
      ls_fieldcat-seltext_l    = 'Oth.Fin.Deduction'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 13.
      ls_fieldcat-fieldname    = 'MTYPREM'.
      ls_fieldcat-seltext_l    = 'Mat.Premium'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 14.
      ls_fieldcat-fieldname    = 'VPBONUS'.
      ls_fieldcat-seltext_l    = 'VP/Bonus'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 15.
      ls_fieldcat-fieldname    = 'GRATUITY'.
      ls_fieldcat-seltext_l    = 'Gratuity'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 16.
      ls_fieldcat-fieldname    = 'VPAY'.
      ls_fieldcat-seltext_l    = 'Variable Pay'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 17.
      ls_fieldcat-fieldname    = 'MALLOWANCE'.
      ls_fieldcat-seltext_l    = 'Meal.Allowance'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 18.
      ls_fieldcat-fieldname    = 'OVERTIME'.
      ls_fieldcat-seltext_l    = 'Overtime'.
      append ls_fieldcat to fp_i_fieldcat.
        clear ls_fieldcat.
      ls_fieldcat-col_pos      = 19.
      ls_fieldcat-fieldname    = 'OTHER'.
      ls_fieldcat-seltext_l    = 'Other'.
      append ls_fieldcat to fp_i_fieldcat.
    pfundeecon
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 20.
      ls_fieldcat-fieldname    = 'P FUND EMPLOYEES CONTRIBUTION'.
      ls_fieldcat-seltext_l    = 'P.Fund.Emp.Contrib'.
      append ls_fieldcat to fp_i_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-col_pos      = 21.
      ls_fieldcat-fieldname    = 'BANKTRNSFER'.
      ls_fieldcat-seltext_l    = 'Payment'.
      append ls_fieldcat to fp_i_fieldcat.
    endform.                    " st_fieldcat_init
    form st_variant_init   using  st_gs_variant type disvariant
                                 st_repid      like sy-repid.
      clear st_gs_variant.
      st_gs_variant-report = st_repid.
    endform.                    " st_variant_init
    form st_comment_build  using   st_lt_top_of_page type slis_t_listheader.
      data: ls_line type slis_listheader.
    Listenüberschrift: Typ H
      clear ls_line.
      ls_line-typ  = 'H'.
    LS_LINE-KEY:  not used for this type
      ls_line-info = text-000.
      append ls_line to st_lt_top_of_page.
    endform.                    " st_comment_build
          FORM TOP_OF_PAGE                                              *
    form top_of_page.
      data: l_i_detailheader type slis_t_listheader.
    To get the header for ALV
      perform detail_header changing l_i_detailheader.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
        exporting
          it_list_commentary = l_i_detailheader.
    endform.                    "top_of_page
    form detail_header  changing fp_i_detailheader type slis_t_listheader.
      data: l_wa_header       type slis_listheader,
            l_v_time         type slis_edit_mask,
            l_v_date         type slis_edit_mask,
            l_v_abkrs        type char5,
            l_v_pabrj        type char8,
            l_v_pagno        type char10.
    Local Constants
      constants: l_c_h type char1 value 'H',
                 l_c_1  type i     value '1',
                 l_c_edit type char10 value '__.__.____',
                 l_c_slash  type c value '/'. " constant for slash
    To display the report Header
      l_wa_header-typ = l_c_h.
    WRITE sy-repid TO l_wa_header-info LEFT-JUSTIFIED.
      write text-014  to l_wa_header-info left-justified.
      append l_wa_header to fp_i_detailheader.
      clear l_wa_header.
    To display the Page no
      l_v_pagno =   sy-pagno + l_c_1.
      l_wa_header-typ = c_s.
      l_wa_header-key = text-008. " Page No:
      l_wa_header-info =  l_v_pagno.
      append l_wa_header to fp_i_detailheader.
      clear l_wa_header.
    To Display the User ID
      l_wa_header-typ = c_s.
      l_wa_header-key = text-009. " User ID
      l_wa_header-info = sy-uname.
      append l_wa_header to fp_i_detailheader.
      clear l_wa_header.
    To Display the Date/Time
      l_wa_header-typ = c_s.
      l_wa_header-key = text-010. " Date/Time:
      l_v_time = sy-uzeit.
      l_v_date = sy-datum.
      write: sy-uzeit to l_v_time.
      write sy-datum to l_v_date using edit mask l_c_edit.
      concatenate l_v_date
                  l_c_slash
                  l_v_time into l_wa_header-info+0(25) separated by space.
      append l_wa_header to fp_i_detailheader.
      clear: l_wa_header, l_v_date.
    To Display the Report Description
      l_wa_header-typ = c_s.
      l_wa_header-key = text-011.                " Report Description
      l_wa_header-info = text-012.
      append l_wa_header to fp_i_detailheader.
      clear l_wa_header.
      append l_wa_header to fp_i_detailheader.
    endform.                    " detail_header
    I will be greatful if any one can please help me in removing me the dump.
    REGARDS
    LATHA.

  • ALV report code dumping

    Hello gurus,
    I am trying to write a simple ALV report code. I pasted the code below.
    The program is getting dumped. I am unable to find where the error is.
    Please help me out.
    Thanks in advance.
    Regards,
    Balu
    REPORT  YBP_ALV1                                .
    TABLES  : MARA.
    DATA    : BEGIN OF itab OCCURS 500,
              matnr LIKE mara-matnr,
              ersda LIKE mara-ersda,
              ernam LIKE mara-ernam,
              END OF itab.
    DATA i_repid LIKE sy-repid.
    DATA i_lines LIKE sy-tabix.
    TYPE-POOLS  : slis.
    DATA int_fcat TYPE SLIS_T_FIELDCAT_ALV.
    SELECT-OPTIONS  : s_matnr for mara-matnr matchcode object mat1.
    START-OF-SELECTION.
    select * FROM mara into CORRESPONDING FIELDS OF itab WHERE  matnr in s_matnr.
    ENDSELECT.
    end-of-SELECTION.
    i_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    I_PROGRAM_NAME               = i_repid
    I_INTERNAL_TABNAME           = 'ITAB'
    I_INCLNAME                   = i_repid
    CHANGING
    CT_FIELDCAT                  = int_fcat
    EXCEPTIONS
    INCONSISTENT_INTERFACE       = 1
    PROGRAM_ERROR                = 2
    OTHERS                       = 3.
    IF SY-SUBRC <> 0.
      WRITE: / 'RETURNCODE', sy-subrc, 'from function reuse_alv_fieldcatalog_merge'.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM  = i_repid
    IT_FIELDCAT                    = int_fcat
    I_SAVE                         = 'A'
    TABLES
    T_OUTTAB                       = itab
    EXCEPTIONS
    PROGRAM_ERROR                  = 1
    OTHERS                         = 2.
    IF SY-SUBRC <> 0.
      WRITE :/ 'Returncode', sy-subrc, 'from function reuse_alv_list_display'.
    ENDIF.
    Edited by: Balu on Jan 3, 2008 12:27 PM

    Rich,
    my code after the suggested changes -
    REPORT  YBP_ALV1                                .
    TABLES  : MARA.
    DATA    : BEGIN OF xtab,
              matnr LIKE mara-matnr,
              ersda LIKE mara-ersda,
              ernam LIKE mara-ernam,
              END OF xtab,
              itab LIKE STANDARD TABLE OF xtab WITH HEADER LINE.
    DATA i_repid LIKE sy-repid.
    DATA i_lines LIKE sy-tabix.
    TYPE-POOLS  : slis.
    DATA int_fcat TYPE SLIS_T_FIELDCAT_ALV.
    SELECT-OPTIONS  : s_matnr for mara-matnr matchcode object mat1.
    START-OF-SELECTION.
    select * FROM mara into CORRESPONDING FIELDS OF itab WHERE
      matnr in s_matnr.
    ENDSELECT.
    describe TABLE itab LINES i_lines.
    *if i_lines lt 1.
    write: / 'no material found'.
    exit.
    *endif.
    *clear i_lines.
    end-of-SELECTION.
    i_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
       I_PROGRAM_NAME               = i_repid
       I_INTERNAL_TABNAME           = 'XTAB'
       I_INCLNAME                   = i_repid
      CHANGING
        CT_FIELDCAT                  = int_fcat
    EXCEPTIONS
       INCONSISTENT_INTERFACE       = 1
       PROGRAM_ERROR                = 2
       OTHERS                       = 3.
    IF SY-SUBRC <> 0.
      WRITE: / 'RETURNCODE', sy-subrc, 'from function reuse_alv_fieldcatalog_merge'.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM             = i_repid
       IT_FIELDCAT                    = int_fcat
       I_SAVE                         = 'A'
      TABLES
        T_OUTTAB                       = itab
    EXCEPTIONS
       PROGRAM_ERROR                  = 1
       OTHERS                         = 2.
    IF SY-SUBRC <> 0.
      WRITE : / 'Returncode', sy-subrc, 'from function reuse_alv_list_display'.
    ENDIF.
    The dump analysis is as below. Sorry I pasted the wrong analysis before -
    An exception occurred. This exception is dealt with in more detail below
    . The exception, which is assigned to the class 'CX_SY_READ_SRC_LINE_TOO_LONG',
    was neither
    caught nor passed along using a RAISING clause, in the procedure
    "K_KKB_FIELDCAT_MERGE" "(FUNCTION)"
    Since the caller of the procedure could not have expected this exception
    to occur, the running program was terminated.
    The reason for the exception is:
    You tried to read the program "YBP_ALV1" from the database. The READ REPORT
    statement allows you to copy a program's source code into an internal
    table. The lines of source code must not be longer than the width of the
    internal table. The internal table is 72 characters wide. The source
    code line is 80 wide.
    Regards,
    Balu

  • Get cursor field in ALV Tree

    Hello all,
    How do I get a cursor field on ALV Tree report? I have output with po number, vendor no etc. When I double click PO, i shuold display ME23N and on vendor no 'XK03' etc. Double click event is triggered, but how do I check which field is clicked? Anybody pls suggest me.
    Thanks,
    Chandni

    Hi,
    you can use method to get the select lines:
      CALL METHOD TREE->GET_SELECTED_NODES
       CHANGING
         CT_INDEX_OUTTAB   = SELECTED_NODES
        EXCEPTIONS
          CNTL_SYSTEM_ERROR = 1
          DP_ERROR          = 2
          FAILED            = 3
          OTHERS            = 4.
    or in double click:
        METHODS HANDLE_DOUBLE_CLICK
          FOR EVENT ITEM_DOUBLE_CLICK OF CL_GUI_ALV_TREE_SIMPLE
          IMPORTING FIELDNAME INDEX_OUTTAB GROUPLEVEL.
    just read tables with index_outttab
    READ TABLE GT_TAB INTO IGT_TAB INDEX INDEX_OUTTAB.
    to check which  field is clicked use the FIELDNAME field.
    regards

  • Getting Dump   GETWA_NOT_ASSIGNED, In ALV

    Hi Experts,
    Once ALV report is generated then when I am downloaing to xls, I am getting dump
    GETWA_NOT_ASSIGNED.
    Please advice.
    Regards,
    IFF

    Possibly the field catalog and output table is not synch.
    Try to create the field catalog automatically (LVC_FIELDCATALOG_MERGE). and not by mannual ( hardcoded)
    If you mentioned any coloring in alv , for testing purpose (just comment the coloring part) and try

  • Get Node Key Multiple Items Selected  from ALV tree

    Hello Experts,
    I'm having a problem in getting Node keys for the items displayed as ALV tree.
    I'm able to get Node key, when only ONE record (Item) is selected.
    But, when I select multiple items under a Single node am not able to read(get) the node keys for all the selected items.
    I'm using the classCL_GUI_ALV_TREE.
    I have tried using the method GET_CHECKED_ITEMS, but not getting the keys.
    method GET_SELECTED_ITEM is giving node for a single item. I need it for multiple items selected.
    Thank you for your time.
    -SANGAR

    Hi,
    You need to use checkbox concept. and use method GET_CHECKED_ITEMS get selected items
    please check this tread.
    CL_GUI_ALV_TREE and Checkboxes
    aRs

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

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

  • Getting Dump while Mapping data source.

    Hi Expert,
    Am getting below DUMP while trying to map data source in SEGW transaction.
    Could you please suggest what could be possible cause for this?
    Category               ABAP Programming Error
    Runtime Errors         SYNTAX_ERROR
    ABAP Program           CL_SADL_GW_UI_ALV_SADL_MAPPINGCP
    Application Component  BC-ESI-ESF-GW
    Date and Time          28.07.2014 18:30:59
    Short Text
         Syntax error in program "CL_SADL_GW_UI_ALV_SADL_MAPPINGCP        ".
    What happened?
         Error in the ABAP Application Program
         The current ABAP program "CL_SADL_GW_UI_PLUG============CP" had to be
          terminated because it has
         come across a statement that unfortunately cannot be executed.
         In include "CL_SADL_GW_UI_ALV_SADL_MAPPINGCM005     ", in line 14 of program
          "CL_SADL_GW_UI_ALV_SADL_MAPPINGCP        ", the following syntax errors
         have occurred:
    Thanks & Regards,
    Girdhari

    Thanks Jasmin for the reply.
    Yes.. Am following the E2E guide.
    I tried by opening another external window by executing ok-code osegw but still getting same dump.
    Below is the complete dump info.
    Category               ABAP Programming Error
    Runtime Errors         SYNTAX_ERROR
    ABAP Program           CL_SADL_GW_UI_ALV_SADL_MAPPINGCP
    Application Component  BC-ESI-ESF-GW
    Date and Time          29.07.2014 15:44:03
    |Short Text                                                                                        |
    |    Syntax error in program "CL_SADL_GW_UI_ALV_SADL_MAPPINGCP        ".                           |
    |What happened?                                                                                    |
    |    Error in the ABAP Application Program                                                         |
    |                                                                                                  |
    |    The current ABAP program "CL_SADL_GW_UI_PLUG============CP" had to be                         |
    |     terminated because it has                                                                    |
    |    come across a statement that unfortunately cannot be executed.                                |
    |    In include "CL_SADL_GW_UI_ALV_SADL_MAPPINGCM005     ", in line 14 of program                  |
    |     "CL_SADL_GW_UI_ALV_SADL_MAPPINGCP        ", the following syntax errors                      |
    |    have occurred:                                                                                |
    |    "CS_TABLE_LAYOUT" is not type-compatible with formal parameter "CS_TAB                        |
    |    LE_LAYOUT".                                                                                   |
    |                                                                                                  |
    |                                                                                                  |
    |                                                                                                  |
    |    Author and last person to change the include are:                                             |
    |    Author         SAP                                                                            |
    |    Last changed by "SAP         "                                                                |
    |Error analysis                                                                                    |
    |    The following syntax error has occurred in program                                            |
    |     CL_SADL_GW_UI_ALV_SADL_MAPPINGCP        :                                                    |
    |    "CS_TABLE_LAYOUT" is not type-compatible with formal parameter "CS_TAB                        |
    |    LE_LAYOUT".                                                                                   |
    |                                                                                                  |
    |    " "                                                                                           |
    |Trigger Location of Runtime Error                                                                 |
    |    Program                                 CL_SADL_GW_UI_PLUG============CP                      |
    |    Include                                 CL_SADL_GW_UI_PLUG============CM002                   |
    |    Row                                     11                                                    |
    |    Module Type                             (METHOD)                                              |
    |    Module Name                             /IWBEP/IF_SBUI_PLUGIN~CREATE_VIEW                     |
    |Source Code Extract                                                                               |
    |Line |SourceCde                                                                                   |
    |    1|  METHOD /iwbep/if_sbui_plugin~create_view.                                                 |
    |    2|    CASE iv_name.                                                                           |
    |    3|      WHEN if_sadl_gw_ui_c=>gc_dialog-mapping_container. " custom container for the ALV Grid|
    |    4|        CREATE OBJECT ro_view TYPE cl_sadl_gw_ui_map_ds_sadl_c                              |
    |    5|          EXPORTING                                                                         |
    |    6|            io_controller = io_controller                                                   |
    |    7|            iv_plugin     = if_sadl_gw_ui_c=>gc_ui_plugin                                   |
    |    8|            iv_name       = iv_name.                                                        |
    |    9|                                                                                            |
    |   10|      WHEN if_sadl_gw_ui_c=>gc_dialog-entity_set_prop_map_alv_grid. " ALV GRID mapping table|
    |>>>>>|        CREATE OBJECT ro_view TYPE cl_sadl_gw_ui_alv_sadl_mapping                           |
    |   12|          EXPORTING                                                                         |
    |   13|            io_controller = io_controller                                                   |
    |   14|            iv_plugin     = if_sadl_gw_ui_c=>gc_ui_plugin                                   |
    |   15|            iv_name       = iv_name.                                                        |
    |   16|                                                                                            |
    |   17|      WHEN if_sadl_gw_ui_c=>gc_dialog-entity_set_assoc_map_alv_grid. " ALV GRID mapping tabl|
    |   18|        CREATE OBJECT ro_view TYPE cl_sadl_gw_ui_alv_map_assoc                              |
    |   19|          EXPORTING                                                                         |
    |   20|            io_controller = io_controller                                                   |
    |   21|            iv_plugin     = if_sadl_gw_ui_c=>gc_ui_plugin                                   |
    |   22|            iv_name       = iv_name.                                                        |
    |   23|                                                                                            |
    |   24|      WHEN if_sadl_gw_ui_c=>gc_dialog-data_source_tree. " SADL entity ALV tree              |
    |   25|        CREATE OBJECT ro_view TYPE cl_sadl_gw_ui_tree_ds_sadl_c                             |
    |   26|          EXPORTING                                                                         |
    |   27|            io_controller = io_controller                                                   |
    |   28|            iv_plugin     = if_sadl_gw_ui_c=>gc_ui_plugin                                   |
    |   29|            iv_name       = iv_name.                                                        |
    |   30|    ENDCASE.                                                                                |
    |Active Calls/Events                                                                               |
    |No.   Ty.          Program                             Include                             Line   |
    |      Name                                                                                        |
    |   23 METHOD       CL_SADL_GW_UI_PLUG============CP    CL_SADL_GW_UI_PLUG============CM002    11  |
    |      CL_SADL_GW_UI_PLUG=>/IWBEP/IF_SBUI_PLUGIN~CREATE_VIEW                                       |
    |   22 METHOD       /IWBEP/CL_SBUI_SETUP==========CP    /IWBEP/CL_SBUI_SETUP==========CM00E     7  |
    |      /IWBEP/CL_SBUI_SETUP=>/IWBEP/IF_SBUI_SETUP_FACTORY~CREATE_COMPONENT_VIEW                    |
    |   21 METHOD       /IWBEP/CL_SBUI_VIEW_COMPOSITE=CP    /IWBEP/CL_SBUI_VIEW_COMPOSITE=CM004     6  |
    |      /IWBEP/CL_SBUI_VIEW_COMPOSITE=>CREATE_COMPONENT_VIEW                                        |
    |   20 METHOD       CL_SADL_GW_UI_MAP_DS_SADL_C===CP    CL_SADL_GW_UI_MAP_DS_SADL_C===CM00B     2  |
    |      CL_SADL_GW_UI_MAP_DS_SADL_C=>_ADD_COMPONENT_VIEW                                            |
    |   19 METHOD       CL_SADL_GW_UI_MAP_DS_SADL_C===CP    CL_SADL_GW_UI_MAP_DS_SADL_C===CM008    11  |
    |      CL_SADL_GW_UI_MAP_DS_SADL_C=>DO_SETUP_INSTANCE                                              |
    |   18 METHOD       /IWBEP/CL_SBUI_VIEW===========CP    /IWBEP/CL_SBUI_VIEW===========CM003    58  |
    |      /IWBEP/CL_SBUI_VIEW=>/IWBEP/IF_SBUI_COMMAND_HANDLER~EXECUTE_COMMAND                         |
    |   17 METHOD       /IWBEP/CL_SBUI_SETUP==========CP    /IWBEP/CL_SBUI_SETUP==========CM00E    12  |
    |      /IWBEP/CL_SBUI_SETUP=>/IWBEP/IF_SBUI_SETUP_FACTORY~CREATE_COMPONENT_VIEW                    |
    |   16 METHOD       /IWBEP/CL_SBUI_SETUP==========CP    /IWBEP/CL_SBUI_SETUP==========CM00I    17  |
    |      /IWBEP/CL_SBUI_SETUP=>CREATE_FRAMESET_EDITOR                                                |
    |   15 METHOD       /IWBEP/CL_SBUI_SETUP==========CP    /IWBEP/CL_SBUI_SETUP==========CM00G    59  |
    |      /IWBEP/CL_SBUI_SETUP=>/IWBEP/IF_SBUI_SETUP_FACTORY~CREATE_ELEMENT_EDITOR                    |
    |   14 METHOD       /IWBEP/CL_SBUI_CONTROLLER=====CP    /IWBEP/CL_SBUI_CONTROLLER=====CM015    22  |
    |      /IWBEP/CL_SBUI_CONTROLLER=>GET_ASSIGNED_EDIT_TOOL                                           |
    |   13 METHOD       /IWBEP/CL_SBUI_CONTROLLER=====CP    /IWBEP/CL_SBUI_CONTROLLER=====CM00A    33  |
    |      /IWBEP/CL_SBUI_CONTROLLER=>/IWBEP/IF_SBUI_CONTROLLER~ON_NAVIGATION_REQUESTED                |
    |   12 METHOD       /IWBEP/CL_SBUI_DP_CMD_CREA_MA=CP    /IWBEP/CL_SBUI_DP_CMD_CREA_MA=CM001    53  |
    |      /IWBEP/CL_SBUI_DP_CMD_CREA_MA=>DO_EXECUTE_COMMAND                                           |
    |   11 METHOD       /IWBEP/CL_SBUI_COMMAND========CP    /IWBEP/CL_SBUI_COMMAND========CM002     4  |
    |      /IWBEP/CL_SBUI_COMMAND=>/IWBEP/IF_SBUI_COMMAND_HANDLER~EXECUTE_COMMAND                      |
    |   10 METHOD       /IWBEP/CL_SBUI_CONTROLLER=====CP    /IWBEP/CL_SBUI_CONTROLLER=====CM00E     9  |
    |      /IWBEP/CL_SBUI_CONTROLLER=>HANDLE_COMMAND_OF_PLUGIN                                         |
    |    9 METHOD       /IWBEP/CL_SBUI_CONTROLLER=====CP    /IWBEP/CL_SBUI_CONTROLLER=====CM00Y    97  |
    |      /IWBEP/CL_SBUI_CONTROLLER=>HANDLE_COMMAND                                                   |
    |    8 METHOD       /IWBEP/CL_SBUI_CONTROLLER=====CP    /IWBEP/CL_SBUI_CONTROLLER=====CM00C   138  |
    |      /IWBEP/CL_SBUI_CONTROLLER=>/IWBEP/IF_SBUI_CONTROLLER~ON_COMMAND_REQUESTED                   |
    |    7 METHOD       /IWBEP/CL_SBUI_SCREEN=========CP    /IWBEP/CL_SBUI_SCREEN=========CM001    18  |
    |      /IWBEP/CL_SBUI_SCREEN=>ON_PAI_COMMAND                                                       |
    |    6 MODULE (PAI) /IWBEP/SAPLFG_SBUI_SB_MAIN          /IWBEP/LFG_SBUI_SB_MAINI01             14  |
    |      PAI_0100_COMMAND                                                                            |
    |    5 METHOD       /IWBEP/SAPLFG_SBUI_SB_MAIN          /IWBEP/LFG_SBUI_SB_MAINCI1             34  |
    |      LCL_SCREEN_0100=>DO_CALL_SCREEN                                                             |
    |    4 METHOD       /IWBEP/CL_SBUI_SCREEN=========CP    /IWBEP/CL_SBUI_SCREEN=========CM003    17  |
    |      /IWBEP/CL_SBUI_SCREEN=>START_SCREEN                                                         |
    |    3 METHOD       /IWBEP/CL_SBUI_CONTROLLER=====CP    /IWBEP/CL_SBUI_CONTROLLER=====CM00U    50  |
    |      /IWBEP/CL_SBUI_CONTROLLER=>START_SCREEN                                                     |
    |    2 METHOD       /IWBEP/CL_SBUI_CONTROLLER=====CP    /IWBEP/CL_SBUI_CONTROLLER=====CM004    33  |
    |      /IWBEP/CL_SBUI_CONTROLLER=>/IWBEP/IF_SBUI_SERVICE_BUILDER~START                             |
    |    1 EVENT        /IWBEP/R_SBUI_SERVICE_BUILDER       /IWBEP/R_SBUI_SERVICE_BUILDER          19  |
    |      START-OF-SELECTION                                                                          |
    Thanks,
    Girdhari

  • ALV tree - run time error.

    I'm trying to creat an ALV tree with the format exactly the same as BCalv_tree_simple_demo program, except adding one more node. I create a database table in se11 and exporting this table to ALV. However when i run it, it showed run time error that "Field symbol has not yet been assigned".
    Trigger Location of Runtime Error                                               
        Program                                 CL_GUI_ALV_TREE_SIMPLE========CP    
        Include                                 CL_GUI_ALV_TREE_SIMPLE========CM01G 
        Row                                     13                                  
        Module type                             (METHOD)                            
        Module Name                             SET_HIERARCHY_DATA                  
    This is a part of my code
    FORM build_fieldcatalog.
    * get fieldcatalog
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'ZTRANG'                """
        CHANGING
          ct_fieldcat      = gt_fieldcatalog.
    * change fieldcatalog
      DATA: ls_fieldcatalog TYPE lvc_s_fcat.
      LOOP AT gt_fieldcatalog INTO ls_fieldcatalog.
        CASE ls_fieldcatalog-fieldname.
          WHEN 'ZTELCO' OR 'ZVP' OR 'ZDEPT' OR 'ZKOSTL'.
            ls_fieldcatalog-no_out = 'X'.
            ls_fieldcatalog-key    = ''.
          WHEN 'ZDESC' OR 'ZMONTH1' OR 'ZMONTH2' OR 'ZMONTH3'.
            ls_fieldcatalog-do_sum = 'X'.
        ENDCASE.
        MODIFY gt_fieldcatalog FROM ls_fieldcatalog.
      ENDLOOP.
    ENDFORM.                               " BUILD_FIELDCATALOG
    *&      Form  BUILD_OUTTAB
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_outtab.
      SELECT * FROM ztrang INTO TABLE gt_tree.
    *              up to 1 rows.
    ENDFORM.                               " BUILD_OUTTAB
    *&      Form  BUILD_SORT_TABLE
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_sort_table.
      DATA ls_sort_wa TYPE lvc_s_sort.
    * create sort-table
      ls_sort_wa-spos = 1.
      ls_sort_wa-fieldname = 'ZTELCO'.
      ls_sort_wa-up = 'X'.
      ls_sort_wa-subtot = 'X'.
      APPEND ls_sort_wa TO gt_sort.
      ls_sort_wa-spos = 2.
      ls_sort_wa-fieldname = 'ZVP'.
      ls_sort_wa-up = 'X'.
      ls_sort_wa-subtot = 'X'.
      APPEND ls_sort_wa TO gt_sort.
      ls_sort_wa-spos = 3.
      ls_sort_wa-fieldname = 'ZDEPT'.
      ls_sort_wa-up = 'X'.
      ls_sort_wa-subtot = 'X'.
      APPEND ls_sort_wa TO gt_sort.
      ls_sort_wa-spos = 4.
      ls_sort_wa-fieldname = 'ZKOSTL'.
      ls_sort_wa-up = 'X'.
    *  ls_sort_wa-subtot = 'X'.
      APPEND ls_sort_wa TO gt_sort.
    ENDFORM.                               " BUILD_SORT_TABLE
                                                                                    Do you have any clues for this? Thanks.
    Edited by: trangie on Apr 13, 2009 5:13 PM

    Hello,
    Please check the dumps in ST22 and search for applicable notes based on your version of installation.
    Regards,
    Gowrinadh

  • 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

Maybe you are looking for