Can we download output of alv tree ?

hi all,
   i have a requirement to download the output of alv tree when it is collapsed (detailed). Can we download that ? i am using cl_gui_alv_tree class.
    plz let me know asap.
regards
raghav

Standard Control does not give that Option . SO another  option is to go to Print preview of the Entire Hierarchy view , then click System -> list -> Save -> local file and save it as spreadsheet . This wa entire data gets downloaded in excel in tree format .
Thanks ,
-Kaustubha Tavildar

Similar Messages

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

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

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

  • Download from ALV Tree

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

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

  • ALV  tree download to excel

    Hi,
    i want to download the <b>alv tree output</b> as it displays to <b>excel</b>,means with expand collapse functions. how to achive this .
    rgds
    Madhu

    hi
    good
    go through this   code
    REPORT ZTH_TEST
    no standard page heading
    data:
    t_nodes like table of SNODETEXT with header line.
    start-of-selection.
    t_nodes-name = 'root node'.
    t_nodes-tlevel = 1.
    t_nodes-id = 1.
    t_nodes-parent = 0.
    append t_nodes.
    t_nodes-name = 'child node 1'.
    t_nodes-parent = 1.
    t_nodes-id = 2.
    t_nodes-tlevel = 2.
    append t_nodes.
    t_nodes-name = 'child node 2'.
    t_nodes-parent = 1.
    t_nodes-id = 3.
    t_nodes-tlevel = 2.
    append t_nodes.
    end-of-selection.
    CALL FUNCTION 'RS_TREE_CONSTRUCT'
    TABLES
    NODETAB = t_nodes
    EXCEPTIONS
    TREE_FAILURE = 1
    ID_NOT_FOUND = 2
    WRONG_RELATIONSHIP = 3
    OTHERS = 4
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    SET PF-STATUS 'ZTH_TREE'.
    CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
    EXPORTING
    CALLBACK_PROGRAM = 'zth_test'
    thanks
    mrutyun^

  • Traffic Lights in ALV Tree

    Hi Experts ,
    Could you suggest if we can use traffic lights in ALV tree Display and if possible  program(T-code ) you have gone thorugh.
    I already checked BCALV_TREE_06 , its totally different just showing icons .
    Regards,
    Karan
    Edited by: Karan_Chowdary on Dec 24, 2011 7:28 AM

    First in your output table for ALV.. add the light coloum.
    for example:
    DATA: BEGIN OF IMARA OCCURS 0,
    LIGHT(4) TYPE C,
    MATNR TYPE MARA-MATNR,
    MTART TYPE MARA-MTART,
    MAKTX TYPE MAKT-MAKTX,
    COLOR_LINE(4) TYPE C,
    TCOLOR TYPE SLIS_T_SPECIALCOL_ALV, "cell
    END OF IMARA.
    Then in the get data section, you have to put if-else class and upate that column as follows
    WRITE ICON_GREEN_LIGHT AS ICON TO IMARA-LIGHT.
    The use that light column in the catalog section
    Regards,
    Venkat

  • TRIAL BALANCE WITH  ALV TREE CONTROL

    Hi Friends,
    My manager wants to see trial balance with cost centers like ALV tree control display.
    Does SAP have any Std trial balance report which can show cost centers also for accounts and activities within those cost centers.
    Please help.
    Thanks

    Nelow message will appear and not possible technically
    Output option ALV Tree Control: Parameter Scaling set to 0/0
    Message no. FR098
    Diagnosis
    You selected output option ALV Tree Control. For technical reasons, only  the value 0/0 is possible for the parameter Scaling.
    System Response
    Parameter Scaling set to the value 0/0.
    Procedure
    If you want to compare the program output for output options ALV Tree Control and Classical list, you have to also set the parameter Scaling  to '0/0' when running the program with output option Classical list.

  • Output Data in Tree

    Hello Experts,
    I am displaying output as ALV Tree using CL_GUI_ALV_TREE.
    In output screen I have certain editable fields. After editing value I have one custom button as Save.
    Now I want whatever data I was able to see in screen after editing, I want all those data in my internal table while hitting save button.
    Can anybody will suggest me how I can get output table again while hitting SAVE Button?
    Regards,
    Neha

    Hi
    Check this
    Go to tcode DWDM>Controls->Tree Controls.
    you will find examples of program....
    (OR)
    Tcode SE83 -->Tree control....
    Reward points for useful Answers
    Regards
    Anji

  • Scaling in F.01 with ALV Tree Control

    Hi Experts,
    Is there any possibility of generating the financial statements in F.01 in ALV tree control with amount scaled to 3 or 5 zero's. When i try to use ALV with scaling, the scaling is reset to 0
    Thanks in Advance

    Nelow message will appear and not possible technically
    Output option ALV Tree Control: Parameter Scaling set to 0/0
    Message no. FR098
    Diagnosis
    You selected output option ALV Tree Control. For technical reasons, only  the value 0/0 is possible for the parameter Scaling.
    System Response
    Parameter Scaling set to the value 0/0.
    Procedure
    If you want to compare the program output for output options ALV Tree Control and Classical list, you have to also set the parameter Scaling  to '0/0' when running the program with output option Classical list.

  • ALV Tree/Grid: maximum columns

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

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

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

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

  • Double click in ALV tree output????

    Hi all,
    I am able to display output in tree format. But I want to add the double click functionality to some of the fields in output. Means if I double click on some value in output tree, it should call some transaction. Please help me with this issue of double clicking.
    Please tell how to handle events in this report tree display.
    For the following code its displaying output in tree format and in right way. But i need to add double click functionality to this.
    So provide me some sample program for this one....
    * create hierarchy
      CALL METHOD tree1->set_table_for_first_display
              EXPORTING
                   it_list_commentary   = lt_list_commentary
                   i_background_id      = 'ALV_BACKGROUND'
                   i_save               = 'A'
                   is_variant            = ls_variant
              CHANGING
                   it_sort              = gt_sort[]
                   it_outtab            = itab_outtab
                   it_fieldcatalog      = t_fieldcat. "gt_fieldcatalog.
    * 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.
    In grid ALV we can have double cilck functionality using code:
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_callback_program       = w_repid
                i_callback_pf_status_set = 'PF_STATUS'
                i_callback_user_command  = 'USER_COMMAND'
                is_layout                = ls_layout
                it_fieldcat              = gt_fc[]
    Here we can write subroutine for USER_COMMAND and handle the double click evenet. But tell me how to provide this in tree ALV.
    <REMOVED BY MODERATOR>
    Regards,
    Sachin
    Edited by: Alvaro Tejada Galindo on Feb 14, 2008 1:47 PM

    Hello Sachin
    The following sample report ZUS_SDN_ALV_TREE_DEMO demonstrates the crucial parts for double-click event handling (nodes & items) in ALV trees.
    *& Report  ZUS_SDN_ALV_TREE_DEMO
    *& Thread: double click in ALV tree output????
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="742412"></a>
    REPORT  zus_sdn_alv_tree_demo.
    CLASS cl_gui_column_tree DEFINITION LOAD.
    CLASS cl_gui_cfw DEFINITION LOAD.
    TYPE-POOLS: abap.
    TYPES: BEGIN OF ty_s_outtab.
    INCLUDE TYPE knvv AS data.
    TYPES: nkey       TYPE lvc_nkey.
    TYPES: parent_key TYPE lvc_nkey.
    TYPES: END OF ty_s_outtab.
    TYPES: ty_t_outtab    TYPE STANDARD TABLE OF ty_s_outtab
                          WITH DEFAULT KEY.
    DATA: gt_outtab    TYPE ty_t_outtab.
    DATA:
      gd_okcode        TYPE ui_func,
      gd_repid         TYPE syst-repid,
      gt_fcat          TYPE lvc_t_fcat,
      gs_layout        TYPE lvc_s_layo,
      gs_variant       TYPE disvariant,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_tree          TYPE REF TO cl_gui_alv_tree.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
        handle_node_double_click
          FOR EVENT node_double_click OF cl_gui_alv_tree
          IMPORTING node_key,
        handle_item_double_click
          FOR EVENT item_double_click OF cl_gui_alv_tree
          IMPORTING node_key
                    fieldname.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_node_double_click.
        message 'Event=Double-Click on Node' type 'I'.
        call transaction 'XD03'.
      ENDMETHOD.                    "handle_node_double_click
      METHOD handle_item_double_click.
        message 'Event=Double-Click on Item' type 'I'.
        call transaction 'VA03'.
      ENDMETHOD.                    "handle_item_double_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      PERFORM init_controls.
      gd_repid = syst-repid.
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = gd_repid
          dynnr                       = '0100'
    *      container                   =
        EXCEPTIONS
          cntl_error                  = 1
          cntl_system_error           = 2
          lifetime_dynpro_dynpro_link = 3
          OTHERS                      = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL SCREEN '0100'.
    ** NOTE: no elements on screen
    **  PROCESS BEFORE OUTPUT.
    **    MODULE STATUS_0100.
    **  PROCESS AFTER INPUT.
    **    MODULE USER_COMMAND_0100.
    END-OF-SELECTION.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      TRANSLATE gd_okcode TO UPPER CASE.
      CASE gd_okcode.
        WHEN 'BACK'  OR
             'EXIT'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
        WHEN 'REFRESH'.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  init_controls
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM init_controls .
    * Create docking container
      CREATE OBJECT go_docking
        EXPORTING
          parent = cl_gui_container=>screen0
          ratio  = 90
        EXCEPTIONS
          OTHERS = 6.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * create tree control
      CREATE OBJECT go_tree
        EXPORTING
            parent              = go_docking
            node_selection_mode = cl_gui_column_tree=>node_sel_mode_multiple
            item_selection      = 'X'  " required for double-click event on item
            no_html_header      = ''
            no_toolbar          = ''
        EXCEPTIONS
            cntl_error                   = 1
            cntl_system_error            = 2
            create_error                 = 3
            lifetime_error               = 4
            illegal_node_selection_mode  = 5
            failed                       = 6
            illegal_column_name          = 7.
      IF sy-subrc <> 0.
        MESSAGE x208(00) WITH 'ERROR'.                          "#EC NOTEXT
      ENDIF.
    * create Hierarchy-header
      DATA ls_hierarchy_header TYPE treev_hhdr.
      PERFORM build_hierarchy_header CHANGING ls_hierarchy_header.
      PERFORM build_fieldcatalog.
      PERFORM set_layout_and_variant.
    * create emty tree-control
      CALL METHOD go_tree->set_table_for_first_display
        EXPORTING
    **      i_structure_name     = 'KNVV'
          is_variant           = gs_variant
          i_save               = 'A'
    *      i_default            = 'X'
          is_hierarchy_header  = ls_hierarchy_header
    *      is_exception_field   =
    *      it_special_groups    =
    *      it_list_commentary   =
    *      i_logo               =
    *      i_background_id      =
    *      it_toolbar_excluding =
    *      it_except_qinfo      =
        CHANGING
          it_outtab            = gt_outtab
    *      it_filter            =
          it_fieldcatalog      = gt_fcat.
    * create hierarchy
      PERFORM create_hierarchy.
    * register events
      PERFORM register_events.
    * adjust column_width
      CALL METHOD go_tree->column_optimize.
    ENDFORM.                    " init_controls
    *&      Form  build_hierarchy_header
    *       build hierarchy-header-information
    *      -->P_L_HIERARCHY_HEADER  strucxture for hierarchy-header
    FORM build_hierarchy_header CHANGING
                                   p_hierarchy_header TYPE treev_hhdr.
      p_hierarchy_header-heading = 'Hierarchy Header'.          "#EC NOTEXT
      p_hierarchy_header-tooltip =
                             'This is the Hierarchy Header !'.  "#EC NOTEXT
      p_hierarchy_header-width = 30.
      p_hierarchy_header-width_pix = ''.
    ENDFORM.                               " build_hierarchy_header
    *&      Form  BUILD_FIELDCATALOG
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_fieldcatalog .
      REFRESH: gt_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
    *     I_BUFFER_ACTIVE              =
          i_structure_name             = 'KNVV'
    *     I_CLIENT_NEVER_DISPLAY       = 'X'
    *     I_BYPASSING_BUFFER           =
    *     I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = gt_fcat
        EXCEPTIONS
          inconsistent_interface       = 1
          program_error                = 2
          OTHERS                       = 3.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      DELETE gt_fcat FROM 8.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  SET_LAYOUT_AND_VARIANT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM set_layout_and_variant .
      CLEAR: gs_layout,
             gs_variant.
      gs_variant-report = syst-repid.
      gs_variant-handle = 'TREE'.
    ENDFORM.                    " SET_LAYOUT_AND_VARIANT
    *&      Form  create_hierarchy
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM create_hierarchy .
      DATA: ls_knvv    TYPE sflight,
            ls_outtab  TYPE ty_s_outtab,
            lt_outtab  TYPE ty_t_outtab.
    * get data
      SELECT * FROM knvv INTO CORRESPONDING FIELDS OF TABLE lt_outtab
                            UP TO 200 ROWS .                "#EC CI_NOWHERE
      SORT lt_outtab BY kunnr vkorg.
    * add data to tree
      DATA: ld_kunnr_key TYPE lvc_nkey,
            ld_vkorg_key TYPE lvc_nkey,
            ld_last_key  TYPE lvc_nkey.
      LOOP AT lt_outtab INTO ls_outtab.
        ON CHANGE OF ls_outtab-kunnr.
          PERFORM add_customer_line USING    ls_outtab-data
                                  CHANGING ld_kunnr_key.
        ENDON.
        ON CHANGE OF ls_outtab-vkorg.
          PERFORM add_salesorg_line USING    ls_outtab-data
                                             ld_kunnr_key
                                  CHANGING ld_vkorg_key.
        ENDON.
        PERFORM add_complete_line USING  ls_outtab-data
                                         ld_vkorg_key
                                CHANGING ld_last_key.
      ENDLOOP.
    * calculate totals
      CALL METHOD go_tree->update_calculations.
    * this method must be called to send the data to the frontend
      CALL METHOD go_tree->frontend_update.
    ENDFORM.                    " create_hierarchy
    *&      Form  add_customer_line
    *       add hierarchy-level 1 to tree
    *      -->P_LS_SFLIGHT  sflight
    *      -->P_RELEATKEY   relatkey
    *     <-->p_node_key    new node-key
    FORM add_customer_line USING     us_data TYPE ty_s_outtab-data
                                     ud_relat_key TYPE lvc_nkey
                         CHANGING  cd_node_key TYPE lvc_nkey.
      DATA: l_node_text TYPE lvc_value,
            ls_data TYPE ty_s_outtab-data.
    * set item-layout
      DATA: lt_item_layout TYPE lvc_t_layi,
            ls_item_layout TYPE lvc_s_layi.
      ls_item_layout-t_image = '@A0@'.  " icon_customer.
      ls_item_layout-fieldname = go_tree->c_hierarchy_column_name.
      ls_item_layout-style   =
                            cl_gui_column_tree=>style_intensifd_critical.
      APPEND ls_item_layout TO lt_item_layout.
    * add node
      l_node_text =  us_data-kunnr.
      DATA: ls_node TYPE lvc_s_layn.
      ls_node-n_image   = space.
      ls_node-exp_image = space.
      CALL METHOD go_tree->add_node
        EXPORTING
          i_relat_node_key = ud_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = l_node_text
          is_outtab_line   = ls_data
          is_node_layout   = ls_node
          it_item_layout   = lt_item_layout
        IMPORTING
          e_new_node_key   = cd_node_key.
    ENDFORM.                               " add_customer_line
    *&      Form  add_salesorg_line
    *       add hierarchy-level 1 to tree
    *      -->P_LS_SFLIGHT  sflight
    *      -->P_RELEATKEY   relatkey
    *     <-->p_node_key    new node-key
    FORM add_salesorg_line USING     us_data TYPE ty_s_outtab-data
                                     ud_relat_key TYPE lvc_nkey
                         CHANGING  cd_node_key TYPE lvc_nkey.
      DATA: l_node_text TYPE lvc_value,
            ls_data TYPE ty_s_outtab-data.
    * set item-layout
      DATA: lt_item_layout TYPE lvc_t_layi,
            ls_item_layout TYPE lvc_s_layi.
      ls_item_layout-t_image = '@DS@'.  " ICON_PARTNER_SALES_ACTIVITY
      ls_item_layout-fieldname = go_tree->c_hierarchy_column_name.
      ls_item_layout-style   =
                            cl_gui_column_tree=>style_intensifd_critical.
      APPEND ls_item_layout TO lt_item_layout.
    * add node
      l_node_text =  us_data-vkorg.
      DATA: ls_node TYPE lvc_s_layn.
      ls_node-n_image   = space.
      ls_node-exp_image = space.
      CALL METHOD go_tree->add_node
        EXPORTING
          i_relat_node_key = ud_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = l_node_text
          is_outtab_line   = ls_data
          is_node_layout   = ls_node
          it_item_layout   = lt_item_layout
        IMPORTING
          e_new_node_key   = cd_node_key.
    ENDFORM.                               " add_salesorg_line
    *&      Form  add_cmplete_line
    *       add hierarchy-level 3 to tree
    *      -->P_LS_SFLIGHT  sflight
    *      -->P_RELEATKEY   relatkey
    *     <-->p_node_key    new node-key
    FORM add_complete_line USING     us_data TYPE ty_s_outtab-data
                                     ud_relat_key TYPE lvc_nkey
                         CHANGING  cd_node_key TYPE lvc_nkey.
      DATA: l_node_text TYPE lvc_value.
    * set item-layout
      DATA: lt_item_layout TYPE lvc_t_layi,
            ls_item_layout TYPE lvc_s_layi.
      ls_item_layout-fieldname = go_tree->c_hierarchy_column_name.
      ls_item_layout-class   = cl_gui_column_tree=>item_class_checkbox.
    **  ls_item_layout-editable = 'X'.
      APPEND ls_item_layout TO lt_item_layout.
    **  CLEAR ls_item_layout.
    **  ls_item_layout-fieldname = 'PLANETYPE'.
    **  ls_item_layout-alignment = cl_gui_column_tree=>align_right.
    **  APPEND ls_item_layout TO lt_item_layout.
      l_node_text =  us_data-vtweg.
      DATA: ls_node TYPE lvc_s_layn.
      ls_node-n_image   = space.
      ls_node-exp_image = space.
      CALL METHOD go_tree->add_node
        EXPORTING
          i_relat_node_key = ud_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          is_outtab_line   = us_data
          i_node_text      = l_node_text
          is_node_layout   = ls_node
          it_item_layout   = lt_item_layout
        IMPORTING
          e_new_node_key   = cd_node_key.
    ENDFORM.                               " add_complete_line
    *&      Form  register_events
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM register_events.
    * define the events which will be passed to the backend
      DATA: lt_events TYPE cntl_simple_events,
            l_event TYPE cntl_simple_event.
    * define the events which will be passed to the backend
      l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
      APPEND l_event TO lt_events.
    **  l_event-eventid = cl_gui_column_tree=>eventid_checkbox_change.
    **  APPEND l_event TO lt_events.
    **  l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
    **  APPEND l_event TO lt_events.
    **  l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
    **  APPEND l_event TO lt_events.
    **  l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
    **  APPEND l_event TO lt_events.
    **  l_event-eventid = cl_gui_column_tree=>eventid_header_click.
    **  APPEND l_event TO lt_events.
    **  l_event-eventid = cl_gui_column_tree=>eventid_item_keypress.
    **  APPEND l_event TO lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_node_double_click.
      APPEND l_event TO lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_item_double_click.
      APPEND l_event TO lt_events.
      CALL METHOD go_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.
    * set Handler
      set handler:
        lcl_eventhandler=>handle_node_double_click for go_tree,
        lcl_eventhandler=>handle_item_double_click for go_tree.
    **  DATA: l_event_receiver TYPE REF TO lcl_tree_event_receiver.
    **  CREATE OBJECT l_event_receiver.
    **  SET HANDLER l_event_receiver->handle_node_ctmenu_request
    **                                                        FOR tree1.
    **  SET HANDLER l_event_receiver->handle_node_ctmenu_selected
    **                                                        FOR tree1.
    **  SET HANDLER l_event_receiver->handle_item_ctmenu_request
    **                                                        FOR tree1.
    **  SET HANDLER l_event_receiver->handle_item_ctmenu_selected
    **                                                        FOR tree1.
    **  SET HANDLER l_event_receiver->handle_checkbox_change FOR tree1.
    ENDFORM.                               " register_events
    Regards
      Uwe

  • How to download the datas of ALV tree without passing iternal table

    Hi,
      I want to download the values of ALV tree output in an Excel file without using any internal table.
    Please suggest your thoughts on the same.
    Regards,
    Shasiraj.C
    Edited by: Raj Shasi on Aug 1, 2008 8:44 AM

    There is one option -Export' in menu bar of ALV grid itself. Click on that and then click 'Local File'. Then choose 'Spreadsheet' option and provide local PC path for download.
    Regards,
    Aparna Gaikwad

  • How to download the blocked ALV output to PDF file.

    How to download the blocked ALV output to PDF file.
    I am able to download the BLocked ALV output in PDF format,
    but the each bolck in ALV is displaying different pages of PDF.
    In my report I have 4 block in 1 page, I am able to see the output in PDF but in different page.
    How to avoid the Page-break in PDF.
    Thanks,
    Ravi Yasoda.

    hi,
    I believe that your have 4 containers on the screen with individual ALV display. in this case, there is no way to get combined PDF output to my knowledge.
    However you can use Smartform/Sapscript as output which would allow you to display ALV in blocks and also print it in one.
    Regards,
    Nirmal

  • To download the Output of ALV to Excel file with Marco

    Hello Masters ,
    I m working on a ALV report in which either we can see the output or can download the ouptput and format that file before sending by mail..
    the following steps are currently used to download and format the ALV output .
    1. Save file form unix server
    2. Download the file to computer.
    3. Run a macro to format the execl file  and
    4. Send the file by mail.
    Apart from this I have to implement a new functionality by which we can directly send the result to spool so that it can be sent directly by mail .
    Can Anyone help me out????????
    Thanks & Regards
    Varlani Amit

    You will be having all data to be send in an internal table, same as your ALV internal table.
    you can provide a button or menu in alv screen to send directly without storing.
    for this you
    1. first write spool
    2. send it through mail.
    1. Writting a spool
    *Get the printer name from TVARVC table.
      select single low from tvarvc into l_destination
           where name = 'PRINTER'
             and type = 'P'
             and numb = '0000'.
      if sy-subrc ne 0.
         l_destination   = 'LOCL'.
      endif.
    *Get the print parameters.
      call function 'GET_PRINT_PARAMETERS'
        EXPORTING
          copies                 = 1
          department             = 'SYSTEM'
          destination            = l_destination
          expiration             = 2
          immediately            = ' '
          layout                 = 'X_65_255'
          line_count             = 65
          line_size              = 255
          list_name              = 'ABC'
          list_text              = 'XYZ
          mode                   = ' '
          new_list_id            = 'X'
          no_dialog              = 'X'
          receiver               = 'SAP*'
          release                = 'X'
          sap_cover_page         = 'X'
          user                   = sy-uname
        IMPORTING
          out_parameters         = l_params
        EXCEPTIONS
          archive_info_not_found = 1
          invalid_print_params   = 2
          invalid_archive_params = 3
          others                 = 4.
      case sy-subrc.
        when 1.
          raise get_print_info_not_found.
        when 2.
          raise get_print_invalid_prt_params.
        when 3.
          raise get_print_invalid_arch_params.
        when 4.
          raise get_print_others.
      endcase.
    *start spool writing.
      new-page print on parameters l_params no dialog.
      uline.
      skip.
      write: 27 text-022 centered. "report name
      skip.
      uline.
    Do formatting as you want.
      loop at ALV_OUTPUT_INTERNAL TABLE..
        write:/  ALV_OUTPUT_INTERNAL TABLE-fileds...
      endloop.
      uline.
    *end spool writing.
      new-page print off.
    2. Sending a mail.
    Use FM 'SO_DOCUMENT_SEND_API1' for sending a mail

Maybe you are looking for