Alv  in hr abap

hi,
In alv display i need to display column headings vertically,Is it possible ,if so how to do it? please help if u have solution
Thanks in advance,
Kavitha

Hi , 
Try this......
Goto transaction SE38.
Enter BCALV* and click on F4.
All ALV programs will be listed with whatevr scenarios u want.
Use hierarchial alv display
U can do it with sort table in alv ..check the below sample code
ALV data declarations
data: it_sortcat type slis_sortinfo_alv occurs 0,
wa_sort like line of it_sortcat.
perform build_sortcat.
*& Form build_sortcat
Build Sort catalog
FORM build_sortcat .
wa_sort-spos = 1.
wa_sort-fieldname = VBELN'.
APPEND wa_sort TO it_sortcat.
This function module is used for displaying the ALV report
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = SY-repid
it_fieldcat = i_fieldcat
it_sort = iT_sortcat
TABLES
t_outtab = i_final
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.
Reward if useful.
Regards,
Harish

Similar Messages

  • How to use traffic lights concept in alv in webdynpro abap

    Hai ,
              How to use traffic lights concept for alv in webdynpro abap. If possible give me some code.

    Hi Ravi,
    You can create ICON  to get traffic light.
    Go through this step by step.. in this example
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/1190424a-0801-0010-84b5-ef03fd2d33d9?quicklink=index&overridelayout=true
    Please go through this...
    Re: Display ICON in the ALV table column
    Re: Image in ALV
    cheers,
    Kris.

  • How to use selection buttons in an ALV created without abap objects?

    Hi, I use an alv created without ABAP Objects to show some information. Can I introduce inside the alv, the top buttons to select all rows / none row? And the second question, how may I introduce lateral buttons in the ALV to select indidividual rows?
    Thanks!

    HI
    i think you use REUSE_ALV_LIST_DISPLAY or REUSE_ALV_GRID_DISPLAY FMs.
    Try to calling the function in this way
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
    *      I_INTERFACE_CHECK              = ' '
    *      I_BYPASSING_BUFFER             =
    *      I_BUFFER_ACTIVE                = ' '
           i_callback_program             = 'YOURREPORT'
           i_callback_pf_status_set       = 'SET_PF_STATUS'
           i_callback_user_command        = 'USER_COMAND'
    *      I_STRUCTURE_NAME               =
           is_layout                      =  ls_layout
           it_fieldcat                    =  fieldcat
    *      IT_EXCLUDING                   =
    *      IT_SPECIAL_GROUPS              =
    *      IT_SORT                        =
    *      IT_FILTER                      =
    *      IS_SEL_HIDE                    =
    *      I_DEFAULT                      = 'X'
           i_save                         = 'A'
          is_variant                     = gt_variant
          it_events                      = event_tab
    *      IT_EVENT_EXIT                  =
    *      IS_PRINT                       =
    *      IS_REPREP_ID                   =
    *      I_SCREEN_START_COLUMN          = 0
    *      I_SCREEN_START_LINE            = 0
    *      I_SCREEN_END_COLUMN            = 0
    *      I_SCREEN_END_LINE              = 0
    *    IMPORTING
    *      E_EXIT_CAUSED_BY_CALLER        =
    *      ES_EXIT_CAUSED_BY_USER         =
           TABLES
             t_outtab                     = tb_output
          EXCEPTIONS
            program_error                  = 1
            OTHERS                         = 2.
    ENDFORM.                    " LISTA
    where
    'SET_PF_STATUS'
    'USER_COMAND'
    are two form like this.
    FORM set_pf_status USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZSTANDARD'. " EXCLUDING rt_extab.
    ENDFORM.                               " SET_PF_STATUS
    FORM user_comand USING r_ucomm     LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
      CASE r_ucomm.
        WHEN '&CPR'.
        WHEN 'YOUR CODE FUNCTION'
    endcase.
    I hope it can help you.
    Bye
    enzo

  • Can we hide the lines between the columns and rows of an alv in wd abap

    HI all ,
      I know that we can colour cell/column/row in an alv in wd abap.
       but, can we hide the lines between the columns and rows of an alv in wd abap.
         i have checked this link [hiding lines b/n rows and columns of an  alv|http://help.sap.com/saphelp_nw04/helpdata/en/91/e7eb40c4f8712ae10000000a155106/content.htm]
         but didn't  understand, can please anybody provide some example or any material..? it will be very helpful.
                                                                         THANK  YOU.
    Edited by: arfat111 on Feb 15, 2010 7:05 AM

    Code some like this in the WDDOINIT method of your view which defines the ALV component as used component.
    instansiate the ALV component
    data lo_cmp_usage type ref to if_wd_component_usage.
    lo_cmp_usage = wd_this->wd_cpuse_usage_alv().
    if lo_cmp_usage->has_active_component() is initial.
       lo_cmp_usage->create_component().
    endif.
    data lo_interfacecontroller type ref to iwci_salv_wd_table.
    lo_interfacecontroller = wd_this->wd_cpifc_usage_alv().
    data lo_value type ref to cl_salv_wd_config_table.
    lo_value = lo_interfacecontroller->get_model().
    hide the grid lines
    lo_value->if_salv_wd_table_settings~SET_GRID_MODE( value = '01' ).
    Thanks,
    Abhishek

  • List header for alv grid using abap objects

    Hai all,
          I have displayed alv grid in container control using abap objects i.e. using method set_table_for_first_display.
    now i need to display list header for this alv grid.
    please help me how to create with a sample coding.
    Thanks and regards,
    Prabu S.

    Create a splitter using CL_GUI_EASY_SPLITTER_CONTAINER with a top and bottom half.  Put the alv grid in the bottom half.  Use cl_dd_document (documented in help.sap.com )  to build the header in the top half.  Use events on CL_GUI_ALV_GRID to handle the top-of-list printing.
    Or, if available, use CL_SALV_TABLE, and read the documentation on that.  When I needed a header for my report, that's what I did.  There's plenty of good documentation about if you'll search for it.
    matt

  • Calling smartform and displaying ALV grid in ABAP WEBDYNPRO

    Hi all,
    I am new to ABAP web dynpro.I ahve few custom reports which are simple ALV list reports which I now need to convert to ABAP web dynpro application .
    For one particular report,based on the selection screen input,I need to display the ALV list and when I select the records from the ALV list,I need to call a smartform on clik of a push button.
    My questions:
    1. Im using 'REUSE_ALV_GRID_DISPLAY' FM  to display the o/p in my report.Is there any similar FM in webdynpro ABAP which will display my list in ALV GRID in my web dynpro application??/
    2. How to call a smartfrm in ALV grid in web dynpro??
    Edited by: abap_1000 on Jan 9, 2011 6:09 PM

    Hi,
    You can search SDN, there are several posts available. Just to get some idea, you can check --
    [Beginneru00B4s questions on WDA ALV;
    [Reg ALV Display;
    For clicking event on ALV --
    [Reg Row Data fetching on click in ALV;
    For ALV display on WDA --
    [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/101df93f-4b5c-2910-14aa-9eb0338c2110?quicklink=index&overridelayout=true]
    Thanks.
    Kumar Saurav.

  • ALV Reports using Abap Objects ?

    <b>Hi All,
    I am trying to print the values in my internal table using ALV, using ABAP classes and objects. Here i am able to get the total succesfully. but i need to get subtotals also, like based on the carrid in table sflight i need subtotal of price for every carrid like 'LH' , 'SQ'.
    here is my code:</b>
    REPORT znav_report.
    DATA: alv TYPE REF TO cl_salv_table,
    value1 TYPE REF TO cl_salv_aggregations,
    value2 TYPE REF TO cl_salv_aggregation.
    DATA: BEGIN OF itab_flight OCCURS 0,
    carrid LIKE sflight-carrid,
    connid LIKE sflight-connid,
    fldate LIKE sflight-fldate,
    price LIKE sflight-price,
    paymentsum LIKE sflight-paymentsum,
    currency LIKE sflight-currency,
    END OF itab_flight.
    SELECT carrid
    connid
    fldate
    price
    paymentsum
    currency
    FROM sflight INTO TABLE itab_flight
    WHERE carrid = 'LH' OR carrid = 'SQ'.
    cl_salv_table=>factory( IMPORTING r_salv_table = alv
    CHANGING t_table = itab_flight[] ).
    CALL METHOD alv->get_aggregations
    RECEIVING
    value = value1.
    CALL METHOD value1->add_aggregation
    EXPORTING
    columnname = 'PAYMENTSUM'
    aggregation = if_salv_c_aggregation=>total
    RECEIVING
    value = value2.
    alv->display( ).
    <b>here how to get subtotals for every different carrid.
    regards,
    Navneeth.K</b>

    Hi,
    Make use of one of these statement,,,,
    <b>Either</b>
    <b>(a)</b>  select carrid connid fldate price currency planetype into table itab_flight from sflight.
    <b>or</b>
    <b>(b)</b>  select * into corresponding fields of table itab_flight from sflight.
    <b>(a)</b> is better in performace than<b> (b)</b>
    <b>But before that, please note some performance related issues with OO Context...</b>
    1. When defining an Internal table, avoid occurs specification, It is Obsolete,Make use of Initial Size n.
    2. Declare Workarea separately,since Internal table defined along with header line is Obsolete in OO Context.Its better and more robust to fill the itab and fetch the values from itab using a separate Workarea rather than the header line... So avoid header lines...
    3. When defining an internal table, follow this way ....
          Define a Linetype (Field String) using the TYPES Statement
          TYPES: begin of ty_line,
                      f1 type i,
                      f2 type i,
                      end of ty_line.
          Then define a Table type using TYPES Statement...
         TYPES: ty_lines type standard table of ty_line with default key.   
      "there is differnnce between line and lines..... make it clear..."
        Then after, define the internal table and its work area using DATA statement... as shown below..
    DATA: i_lines type ty_lines,
              wa_lines like line of i_lines
    <b>This is the standard way of defining the internal table under OO Context.,,..
    Your definition is creating a default header line....that should be avoided...</b>
    Thanks for ur patience,
    Regards..
    Mohammed Anwar..

  • How to process Line Selection on ALV Table in ABAP WebDynpro

    Hi there,
    I have a view with an ALV table whose context node retrieves its data from a Service Call for a method.
    The method provides certain data of a database table which the ALV displays.
    Now I would like to be able to select one row of that ALV table and after pressing a button or doubleclicking on the row or whatever a different view (as for me it is also ok on the same view) should appear to display the details of that selection.
    I only need to know how to retrieve the selected data.
    Or its index within the internal table.
    I am already looking for hours for a useful thread and actually there is one which obviously is about a similar issue apart from the multiple selection part: 
    How to process multiple row selection in ALV table in Wendynpro ABAP? Help!
    but i am afraid that i don't understand it. Or at least I misunderstand it since it does not work with me.
    The system example mentioned in the thread does not help me either because it somehow does not correspond to my needs, does it?
    It would be GREAT if somebody could help me with that. Please keep it simple for I am not an expert in webdynpro yet (obviously ^^) and also please explain in detail what I have to do with the context nodes since I am not sure whether the selection is stored in my already existing node or whether I need a special one for that.
    Thanks!!
    christina

    Hi Christina,
    If you just want to get one column data of the line that user clicked, use the Web Dynpro Code Wizard to Read Context of attibute you needed, then you will get code as follow:
    * Define data for read attribute
        node_alv TYPE REF TO if_wd_context_node,
        elem_alv TYPE REF TO if_wd_context_element,
        stru_alv TYPE if_view_display=>element_alv ,
        item_column_name  LIKE stru_alv-column_name.
    * navigate from <CONTEXT> to <ALV> via lead selection
      node_alv = wd_context->get_child_node( name = if_view_display=>wdctx_alv ).
    * get element via lead selection
      elem_alv = node_alv->get_element(  ).
    * get single attribute
      elem_alv->get_attribute(
        EXPORTING
          name =  `COLUMN_NAME'
        IMPORTING
          value = item_column_name ).
    The value of column_name is stored in item_column_name.
    If you need the index that the user clicked, try this:
    * Definition of field symbol for index
      FIELD-SYMBOLS : <fs_index> TYPE data.
    * Get the selected index
      ASSIGN r_param->index->* TO <fs_index>.
    The index of clicked line is stored in field symbol <fs_index>.
    Hope it will help.
    Best Regards,
    Stephanie

  • Drop down in ALV for Webdynpro ABAP

    Hi Experts,
    I was trying to implement one Web dynpro ABAP application that will show one ALV and ALV will content one dropdown so that user can select data from the drop down. Addtion to that, my dropdown should have data based on another column of ALV.
    I have followed one article which is available in Net.
    At the end of development, ALV is displayed with dropdown. Also dropdown has data binded. However, no data is visible in dropdown.
    I have created one context node having four dictionary element and one elemt for dispplaying the dropdown.
    In the DoInit method of view, i have written below code:
    Data Declaration
      DATA:
            lo_node_cskt  TYPE REF TO if_wd_context_node,
            lo_el_cskt    TYPE REF TO if_wd_context_element,
            ls_cskt       TYPE wd_this->element_cskt,
            lt_cskt       TYPE wd_this->elements_cskt,
            lo_cmp_usage  TYPE REF TO if_wd_component_usage,
            lv_value      TYPE REF TO cl_salv_wd_config_table,
            lr_column     TYPE REF TO cl_salv_wd_column,
            lr_drdn       TYPE REF TO cl_salv_wd_uie_dropdown_by_idx,
            ls_value_set  TYPE wdr_context_attr_value,
            lv_tabix      TYPE sy-tabix,
            lv_count(2)  TYPE c,
            lo_interfacecontroller TYPE REF TO iwci_salv_wd_table.
    Navigate from <CONTEXT> to <CSKT> via lead selection:
      lo_node_cskt = wd_context->get_child_node( name = wd_this->wdctx_cskt ).
    get element via lead selection
      lo_el_cskt = lo_node_cskt->get_element( ).
    Get Data:
      SELECT kokrs kostl datbi ktext FROM cskt  INTO CORRESPONDING FIELDS OF TABLE lt_cskt.
      lv_count = 0.
    Populate value set
      LOOP AT lt_cskt INTO ls_cskt.
        lv_tabix = sy-tabix.
        CLEAR ls_cskt-ktext.
        DO 3 TIMES.
          lv_count = lv_count + 1.
          CONCATENATE 'TEST' lv_count INTO ls_value_set-text.
          CONCATENATE 'TEST' lv_count INTO ls_value_set-value.
          if lv_tabix = 2.
           if sy-index = 2.
             EXIT.
           endif.
          endif.
          APPEND ls_value_set TO ls_cskt-valueset.
        ENDDO.
        MODIFY lt_cskt FROM ls_cskt INDEX lv_tabix TRANSPORTING ktext valueset.
      ENDLOOP.
    Bind data
      lo_node_cskt->bind_table( lt_cskt ).
    Instantiate ALV
      lo_cmp_usage = wd_this->wd_cpuse_alv( ).
      IF lo_cmp_usage->has_active_component( ) IS INITIAL.
        lo_cmp_usage->create_component( ).
      ENDIF.
      lo_interfacecontroller = wd_this->wd_cpifc_alv( ).
    Bind Data to Interface Controller Node
       lo_interfacecontroller->set_data(
            r_node_data = lo_node_cskt
    Get ALV reference table
       lv_value = lo_interfacecontroller->get_model( ).
    Make KTEXT column as drop down
       CALL METHOD lv_value->if_salv_wd_column_settings~get_column
       EXPORTING
         id = 'KTEXT'
       RECEIVING
         value = lr_column.
    Create Object for Drop down
      CREATE OBJECT lr_drdn
       EXPORTING
         selected_key_fieldname = 'KTEXT'.
      CALL METHOD lr_drdn->set_valueset_fieldname
      EXPORTING
        value = 'VALUESET'.
      CALL METHOD lr_drdn->set_type
      EXPORTING
        value = IF_SALV_WD_C_UIE_DRDN_BY_INDEX=>TYPE_KEY_CONVERT_TO_VALUE.
      CALL METHOD lr_column->set_cell_editor
      EXPORTING
        value = lr_drdn.
      CALL METHOD  lv_value->if_salv_wd_table_settings~set_read_only
      EXPORTING
        value = abap_false.
    I am still finding the answer why data in drop down is not visible. However, I can select by clicking dropdown and blank elements (since data is not visible) can be selected.

    Hey
    i am using  the same code except i have just modified little bit the select statement to restrict the number of entries.
    and also besides writing the code in wddoinit i have added the compenent usage of alv component and added the node
    having the structure ckst and after that deleting the dictionary reference to add the attribute valueset in both places
    component controller and view controller and mapped them and mapped the data node of interface controller of comp
    usage to this node in comp contrlr.
    and adding the view container and embeding table view of alv comp there.
    that's it
    and here is the code which is almost same as yours except small change in select statement.
    method WDDOINIT .
      DATA:
    lo_node_cskt TYPE REF TO if_wd_context_node,
    lo_el_cskt TYPE REF TO if_wd_context_element,
    ls_cskt TYPE wd_this->element_cskt,
    lt_cskt TYPE wd_this->elements_cskt,
    lo_cmp_usage TYPE REF TO if_wd_component_usage,
    lv_value TYPE REF TO cl_salv_wd_config_table,
    lr_column TYPE REF TO cl_salv_wd_column,
    lr_drdn TYPE REF TO cl_salv_wd_uie_dropdown_by_idx,
    ls_value_set TYPE wdr_context_attr_value,
    lv_tabix TYPE sy-tabix,
    lv_count(2) TYPE c,
    lo_interfacecontroller TYPE REF TO iwci_salv_wd_table.
    * Navigate from <CONTEXT> to <CSKT> via lead selection:
    lo_node_cskt = wd_context->get_child_node( name = wd_this->wdctx_cskt ).
    * get element via lead selection
    lo_el_cskt = lo_node_cskt->get_element( ).
    * Get Data:
    SELECT kokrs kostl datbi ktext FROM cskt INTO CORRESPONDING FIELDS OF TABLE lt_cskt up to 10 rows .
    lv_count = 0.
    * Populate value set
    LOOP AT lt_cskt INTO ls_cskt.
    lv_tabix = sy-tabix.
    CLEAR ls_cskt-ktext.
    DO 3 TIMES.
    lv_count = lv_count + 1.
    CONCATENATE 'TEST' lv_count INTO ls_value_set-text.
    CONCATENATE 'TEST' lv_count INTO ls_value_set-value.
    if lv_tabix = 2.
    if sy-index = 2.
    EXIT.
    endif.
    endif.
    APPEND ls_value_set TO ls_cskt-valueset.
    ENDDO.
    MODIFY lt_cskt FROM ls_cskt INDEX lv_tabix TRANSPORTING ktext valueset.
    ENDLOOP.
    * Bind data
    lo_node_cskt->bind_table( lt_cskt ).
    * Instantiate ALV
    lo_cmp_usage = wd_this->wd_cpuse_alv( ).
    IF lo_cmp_usage->has_active_component( ) IS INITIAL.
    lo_cmp_usage->create_component( ).
    ENDIF.
    lo_interfacecontroller = wd_this->wd_cpifc_alv( ).
    * Bind Data to Interface Controller Node
    lo_interfacecontroller->set_data(
    r_node_data = lo_node_cskt
    * Get ALV reference table
    lv_value = lo_interfacecontroller->get_model( ).
    * Make KTEXT column as drop down
    CALL METHOD lv_value->if_salv_wd_column_settings~get_column
    EXPORTING
    id = 'KTEXT'
    RECEIVING
    value = lr_column.
    * Create Object for Drop down
    CREATE OBJECT lr_drdn
    EXPORTING
    selected_key_fieldname = 'KTEXT'.
    CALL METHOD lr_drdn->set_valueset_fieldname
    EXPORTING
    value = 'VALUESET'.
    CALL METHOD lr_drdn->set_type
    EXPORTING
    value = IF_SALV_WD_C_UIE_DRDN_BY_INDEX=>TYPE_KEY_CONVERT_TO_VALUE.
    CALL METHOD lr_column->set_cell_editor
    EXPORTING
    value = lr_drdn.
    CALL METHOD lv_value->if_salv_wd_table_settings~set_read_only
    EXPORTING
    value = abap_false.
    endmethod.
    thanks
    sarbjeet

  • ALV in WD ABAP

    .Hi Guys,
    I am new to ABAP . If any one of you could help me then below are the few queries of me :-
    1. What are ALVs ?
    2. How to use them ?
    3. When and where should it be used ?

    Hi
    Go through this link.
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/74/fd4142646ab46be10000000a155106/frameset.htm
    i hope it will resolve all your issues.

  • Sample ALV Tree in ABAP Wed Dynpro

    Hi Guys,
    I tried to create a ALV with TREE column in ABAP Web Dynpro.
    Do you have any sample for this?
    Thanks.
    Tee

    Following 2 things are the most important steps
    "A) identify the table as hierarchy table:
    wd_this->go_table->if_salv_wd_table_settings~set_display_type( if_salv_wd_c_table_settings=>display_type_hierarchy).
    (wd_this->go_table is the reference to wd alv object:)
    "B) mark the columns you want to have as nodes with following statement:
    ls_col-r_column->if_salv_wd_column_hierarchy~set_hierarchy_column( value = abap_true ).
    (ls_col is reference to the column)
    Also you can check standard component salv_wd_demo_table_tree
    Radhika

  • Regarding ALV Reporting in ABAP

    Hi All,
    I have some clarifications related to <b>ALV Reporting</b> in ABAP.
    <b>Actually i have to create ALV report with Structure Length/Each record length is around 300 characters.</b>
    Is it possible to create a ALV Report with <b>300</b> length for each record!
    If possible which is the best<b>[ALV]</b> method for the same!
    Can anybody give me the solution!
    Thanks in advance.
    Thanks & Regards,
    Prasad.

    Hai Prasad
    Check with the code
    *& Report  ZALV_PRAKASH_SAMP                                           *
    REPORT  ZALV_PRAKASH_SAMP .
    TABLES: MARA.
    TYPE-POOLS : SLIS.
    Data declaration
    DATA: BEGIN OF I_MARA OCCURS 0.
            INCLUDE STRUCTURE MARA.
    DATA: END OF I_MARA.
    DATA: V_REPID LIKE SY-REPID.
    selection-screen
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
      SELECT-OPTIONS : S_MATNR FOR MARA-MATNR.
      PARAMETERS: P_MTART LIKE MARA-MTART DEFAULT 'ROH'.
    SELECTION-SCREEN END OF BLOCK B1.
    initialisation
    INITIALIZATION.
    S_MATNR-LOW = '1400'.
    S_MATNR-HIGH = '1500'.
    APPEND S_MATNR.
    V_REPID = SY-REPID.
    start-of-selection
    START-OF-SELECTION.
    SELECT * FROM MARA
        INTO TABLE I_MARA
        WHERE MATNR IN S_MATNR AND
              MTART = P_MTART.
      CHECK SY-SUBRC = 0.
    end of selection
    END-OF-SELECTION.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
      I_CALLBACK_PROGRAM             = ' '
      I_CALLBACK_PF_STATUS_SET       = ' '
      I_CALLBACK_USER_COMMAND        = ' '
       I_STRUCTURE_NAME               = 'MARA'
      IS_LAYOUT                      =
      IT_FIELDCAT                    =
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     =
      IT_EVENTS                      =
      IT_EVENT_EXIT                  =
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
      TABLES
        T_OUTTAB                       = I_MARA
    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.
    loop at i_mara.
    write:/ i_mara.
    endloop.
    Thanks & Regards
    Sreenivasulu P

  • ALV Reports versus ABAP drilldown or high volume data

    Which is better with regards to performance? An ALV grid or an ABAP drilldown ?
    I am very concerned about performance given the high volume of data and therefore not sure if I should use ALV?
    input is appreciated
    J

    hi JJ,
    ALV reporting is always having lot of advantages over abap reproting in many ways,
    performace increases due to the use of
    object oriented cocepts like classes, objects and methods
    by using the line type and row type internable declarations..
    and user friendly out put
    Regards,
    GUDURI

  • ALV Tree using ABAP Objects

    Can anyone tell me how to Copy a node on an ALV Tree using context menu ?

    Hello Vidya
    The sample report ZUS_SDN_ALVTREE_CTXMENU demonstrates how to copy nodes on an ALV tree.
    Before showing the entire coding I would like to point out a few crucial parts of the coding:
    (1) Defintion of OUTTAB list
    TYPES: BEGIN OF ty_s_outtab.
    INCLUDE  TYPE vbak.
    TYPES: nkey     TYPE lvc_nkey.
    TYPES: ntype    TYPE lvc_value.  " 'VKORG' / 'VTWEG' / 'SPART' / leaf
    TYPES: END OF ty_s_outtab.
    TYPES: ty_t_outtab    TYPE STANDARD TABLE OF ty_s_outtab
                          WITH DEFAULT KEY.
    The OUTTAB list contains two additional fields holding the tree key (LVC_NKEY) and the node type.
    (2) The main logic of the report is implemented in event handler method handle_node_ctxmenu_sel.
          WHEN 'COPY_SUBTREE'.
            CALL METHOD go_alvtree->get_subtree
              EXPORTING
                i_node_key       = node_key
              IMPORTING
                et_subtree_nodes = lt_subtree.
            CALL METHOD go_alvtree->get_parent
              EXPORTING
                i_node_key        = node_key
              IMPORTING
                e_parent_node_key = ld_parent_key.
            LOOP AT lt_subtree INTO ld_node_key.
              READ TABLE gt_outtab INTO ls_outtab
                   WITH KEY nkey = ld_node_key.
              APPEND ls_outtab TO lt_outtab.
            ENDLOOP.
            READ TABLE lt_outtab INTO ls_outtab INDEX 1.
            ld_ntype = ls_outtab-ntype.
            DELETE lt_outtab WHERE ( vbeln IS INITIAL ).  " hierarchy nodes
            CASE ld_ntype.
              WHEN 'VKORG'.
                ld_top_key = ld_parent_key.
              WHEN 'VTWEG'.
                ld_vkorg_key = ld_parent_key.
              WHEN 'SPART'.
                ld_vtweg_key = ld_parent_key.
              WHEN 'LEAF'.
                ld_spart_key = ld_parent_key.
            ENDCASE.
    "       Note: similar logic like in routine CREATE_HIERARCHY
            SORT lt_outtab BY vkorg vtweg spart kunnr audat.
            LOOP AT lt_outtab INTO ls_outtab.
    *& Report  ZUS_SDN_ALVTREE_CTXMENU
    *& Based on: BCALV_TREE_03
    REPORT  zus_sdn_alvtree_ctxmenu.
    TYPES: BEGIN OF ty_s_outtab.
    INCLUDE  TYPE vbak.
    TYPES: nkey     TYPE lvc_nkey.
    TYPES: ntype    TYPE lvc_value.  " 'VKORG' / 'VTWEG' / 'SPART' / leaf
    TYPES: END OF ty_s_outtab.
    TYPES: ty_t_outtab    TYPE STANDARD TABLE OF ty_s_outtab
                          WITH DEFAULT KEY.
    DATA:
      gd_repid      TYPE syst-repid,
      gd_okcode     TYPE ui_func,
      go_docking    TYPE REF TO cl_gui_docking_container,
      go_alvtree    TYPE REF TO cl_gui_alv_tree.
    DATA:
      gt_outtab     TYPE ty_t_outtab,  " Sales Document
      gt_fcat       TYPE lvc_t_fcat.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
    * §2. Define an event handler method to build up a context menu
    *     (postfix of event name: _CONTEXT_MENU_REQUEST).
    * This event is fired each time the user klick with the right
    * mouse button on a node.
        CLASS-METHODS:
          handle_node_ctxmenu_req
          FOR EVENT node_context_menu_request OF cl_gui_alv_tree
            IMPORTING
              node_key
              menu,
    * §3. Define an event handler method to respond to a function code
    *     triggered by your menu (postfix: _CONTEXT_MENU_SELECTED).
    * This event is fired when the user selects an entry of the
    * build up context menu.
          handle_node_ctxmenu_sel
          FOR EVENT node_context_menu_selected OF cl_gui_alv_tree
            IMPORTING
              node_key
              fcode
              sender.
    * 'sender' is an implicit event parameter that is provided by
    * ABAP Objects runtime system. It contains a reference to the
    * object that fired the event. You may directly use it to
    * call methods of this instance.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
    * §4. Implement your event handler methods.
      METHOD handle_node_ctxmenu_req.
    * Event parameter 'menu' holds a reference to the standard context
    * menu of ALV Tree (functions 'Expand'/'Collapse' on nodes).
    * You may either append your own functions (separated by a line)
    * or clear the menu if you do not want to allow standard functions.
    * In this case the standard menu is cleared.
        CALL METHOD menu->clear.
    * The next line defines one line of the context menu.
        CALL METHOD menu->add_function
          EXPORTING
            fcode = 'DEL_SUBTREE'
            text  = 'Delete Subtree'(901).        "Delete Subtree
        CALL METHOD menu->add_function
          EXPORTING
            fcode = 'COPY_SUBTREE'
            text  = 'Copy Subtree'(902).        "Copy Subtree
      ENDMETHOD.                    "handle_node_ctxmenu_req
      METHOD handle_node_ctxmenu_sel.
    * At this point of execution, the user selected a menu entry of the
    * menu build up in event handler method handle_node_cm_req.
    * Query your own function codes and react accordingly.
        DATA:
          l_rc TYPE c,
          ld_ntype      TYPE lvc_value,
          ld_parent_key TYPE lvc_nkey,
          ld_node_key   TYPE lvc_nkey,
          lt_subtree    TYPE lvc_t_nkey,
          ls_outtab     TYPE ty_s_outtab,
          ls_last       TYPE ty_s_outtab,
          lt_outtab     TYPE ty_t_outtab.
        DATA:
          ld_vkorg_key   TYPE lvc_nkey,
          ld_vtweg_key   TYPE lvc_nkey,
          ld_spart_key   TYPE lvc_nkey,
          ld_last_key    TYPE lvc_nkey,
          ld_top_key     TYPE lvc_nkey.
        CASE fcode.
          WHEN 'DEL_SUBTREE'.
            CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
                 EXPORTING
                      textline1      = 'Do you really want to delete'(902)
                    textline2      = 'this node and all its subnodes?'(903)
                      titel          = 'Confirmation'(904)
                      cancel_display = ' '
                 IMPORTING
                      answer         = l_rc.
            IF l_rc EQ 'J'.
              CALL METHOD sender->delete_subtree
                EXPORTING
                  i_node_key = node_key.
    * Do not forget to refresh the display when you change the contents
    * of your list.
              CALL METHOD sender->frontend_update.
            ENDIF.
          WHEN 'COPY_SUBTREE'.
            CALL METHOD go_alvtree->get_subtree
              EXPORTING
                i_node_key       = node_key
              IMPORTING
                et_subtree_nodes = lt_subtree.
            CALL METHOD go_alvtree->get_parent
              EXPORTING
                i_node_key        = node_key
              IMPORTING
                e_parent_node_key = ld_parent_key.
            LOOP AT lt_subtree INTO ld_node_key.
              READ TABLE gt_outtab INTO ls_outtab
                   WITH KEY nkey = ld_node_key.
              APPEND ls_outtab TO lt_outtab.
            ENDLOOP.
            READ TABLE lt_outtab INTO ls_outtab INDEX 1.
            ld_ntype = ls_outtab-ntype.
            DELETE lt_outtab WHERE ( vbeln IS INITIAL ).  " hierarchy nodes
            CASE ld_ntype.
              WHEN 'VKORG'.
                ld_top_key = ld_parent_key.
              WHEN 'VTWEG'.
                ld_vkorg_key = ld_parent_key.
              WHEN 'SPART'.
                ld_vtweg_key = ld_parent_key.
              WHEN 'LEAF'.
                ld_spart_key = ld_parent_key.
            ENDCASE.
            SORT lt_outtab BY vkorg vtweg spart kunnr audat.
            LOOP AT lt_outtab INTO ls_outtab.
              IF ( ld_ntype = 'VKORG' ).
                "   new sales organisation
                IF ( ls_outtab-vkorg = ls_last-vkorg ).
                ELSE.
                  PERFORM add_sales_org
                                    USING
                                       ls_outtab
                                       ld_top_key
                                 CHANGING
                                       ld_vkorg_key.
                  ls_outtab-nkey   = ld_vkorg_key.
                  ls_outtab-ntype = 'VKORG'.
                  DESCRIBE TABLE gt_outtab.  " fill sy-tfill
                  MODIFY gt_outtab FROM ls_outtab INDEX syst-tfill
                    TRANSPORTING nkey ntype.
                ENDIF.
              ENDIF.
              IF ( ld_ntype = 'VKORG'  OR
                   ld_ntype = 'VTWEG' ).
                "   new distribution channel
                IF ( ls_outtab-vkorg = ls_last-vkorg  AND
                     ls_outtab-vtweg = ls_last-vtweg ).
                ELSE.
                  PERFORM add_distrib_chan
                                    USING
                                       ls_outtab
                                       ld_vkorg_key
                                 CHANGING
                                       ld_vtweg_key.
                  ls_outtab-nkey = ld_vtweg_key.
                  ls_outtab-ntype = 'VTWEG'.
                  DESCRIBE TABLE gt_outtab.  " fill sy-tfill
                  MODIFY gt_outtab FROM ls_outtab INDEX syst-tfill
                    TRANSPORTING nkey ntype.
                ENDIF.
              ENDIF.
              IF ( ld_ntype = 'VKORG'  OR
                   ld_ntype = 'VTWEG'  OR
                   ld_ntype = 'SPART' ).
                "   new channel
                IF ( ls_outtab-vkorg = ls_last-vkorg  AND
                     ls_outtab-vtweg = ls_last-vtweg  AND
                     ls_outtab-spart = ls_last-spart ).
                ELSE.
                  PERFORM add_division
                                    USING
                                       ls_outtab
                                       ld_vtweg_key
                                 CHANGING
                                       ld_spart_key.
                  ls_outtab-nkey = ld_spart_key.
                  ls_outtab-ntype = 'SPART'.
                  DESCRIBE TABLE gt_outtab.  " fill sy-tfill
                  MODIFY gt_outtab FROM ls_outtab INDEX syst-tfill
                    TRANSPORTING nkey ntype.
                ENDIF.
              ENDIF.
    * Leaf:
              PERFORM add_complete_line
                                USING
                                   ls_outtab
                                   ld_spart_key
                             CHANGING
                                   ld_last_key.
              ls_outtab-nkey = ld_last_key.
              ls_outtab-ntype = 'LEAF'.
              DESCRIBE TABLE gt_outtab.  " fill sy-tfill
              MODIFY gt_outtab FROM ls_outtab INDEX syst-tfill
                  TRANSPORTING nkey ntype.
              ls_last = ls_outtab.
            ENDLOOP.
            CALL METHOD cl_gui_cfw=>set_new_ok_code
              EXPORTING
                new_code = 'REFRESH_TREE'
    *          IMPORTING
    *            RC       =
        ENDCASE.
      ENDMETHOD.                    "handle_node_ctxmenu_sel
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      PERFORM init_controls.
    * Link the docking container to the target dynpro
      gd_repid = syst-repid.
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = gd_repid
          dynnr                       = '0100'
    *      CONTAINER                   =
        EXCEPTIONS
          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 screen elements, ok_code -> gd_okcode
    **    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.  " facilitate manual entries
      CASE gd_okcode.
        WHEN 'BACK' OR
             'EXIT'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
      when 'REFRESH_TREE'.
        CALL METHOD go_alvtree->update_calculations
    *      EXPORTING
    *        NO_FRONTEND_UPDATE =
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  INIT_CONTROLS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM init_controls .
      DATA:
        ls_hierarchy_header TYPE treev_hhdr.
    * 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.
      CALL METHOD go_docking->set_extension
        EXPORTING
          extension  = 99999 " full-size screen
        EXCEPTIONS
          cntl_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.
    * create tree control
      CREATE OBJECT go_alvtree
        EXPORTING
            parent              = go_docking
            node_selection_mode = cl_gui_column_tree=>node_sel_mode_single
            item_selection      = ' '
            no_html_header      = 'X'
            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.
      PERFORM build_hierarchy_header CHANGING ls_hierarchy_header.
    * Hide columns and sum up values initially using the fieldcatalog
      PERFORM build_fieldcatalog.
    * IMPORTANT: Table 'gt_sflight' must be empty. Do not change this table
    * (even after this method call). You can change data of your table
    * by calling methods of CL_GUI_ALV_TREE.
    * Furthermore, the output table 'gt_outtab' must be global and can
    * only be used for one ALV Tree Control.
      CALL METHOD go_alvtree->set_table_for_first_display
        EXPORTING
          is_hierarchy_header = ls_hierarchy_header
        CHANGING
          it_fieldcatalog     = gt_fcat
          it_outtab           = gt_outtab. "table must be empty !
      PERFORM init_tree.
    ENDFORM.                    " INIT_CONTROLS
    *&      Form  INIT_TREE
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM init_tree .
      PERFORM create_hierarchy.
      PERFORM register_events.
    * Update calculations which were initially defined by field DO_SUM
    * of the fieldcatalog. (see build_fieldcatalog).
      CALL METHOD go_alvtree->update_calculations.
    * Send data to frontend.
      CALL METHOD go_alvtree->frontend_update.
    ENDFORM.                    " INIT_TREE
    *&      Form  build_hierarchy_header
    *       text
    *      <--P_LS_HIERARCHY_HEADER  text
    FORM build_hierarchy_header
         CHANGING
               cs_hierarchy_header TYPE treev_hhdr.
      cs_hierarchy_header-heading =
            'SalesOrg/DistChannel/Division'(300).
      cs_hierarchy_header-tooltip = 'Customer: Master Sales Data'(400).
      cs_hierarchy_header-width = 45.
      cs_hierarchy_header-width_pix = ''.
    ENDFORM.                    " build_hierarchy_header
    *&      Form  build_fieldcatalog
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_fieldcatalog .
    * define local data
      DATA:
        ls_fcat    TYPE lvc_s_fcat.
      REFRESH: gt_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
    *     I_BUFFER_ACTIVE              =
         i_structure_name             = 'VBAK'
    *     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.
      LOOP AT gt_fcat INTO ls_fcat.
        CASE ls_fcat-fieldname.
          WHEN 'VBELN'  OR
               'AUDAT'  OR
               'AUART'  OR
               'WAERK'  OR
               'VKORG'  OR
               'VTWEG'  OR
               'SPART'  OR
               'BSTNK'  OR
               'KUNNR'.
          WHEN 'NETWR'.
            ls_fcat-do_sum = 'X'.
            ls_fcat-h_ftype = 'SUM'.  " or: 'MAX' / 'AVG'
          WHEN OTHERS.
            ls_fcat-tech = 'X'.
        ENDCASE.
        MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
      ENDLOOP.
    ENDFORM.                    " build_fieldcatalog
    *&      Form  create_hierarchy
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM create_hierarchy .
    * define local data
      DATA:
        ls_outtab    TYPE ty_s_outtab,
        ls_last      TYPE ty_s_outtab,
        lt_outtab    TYPE ty_t_outtab.
      DATA:
        ld_vkorg_key   TYPE lvc_nkey,
        ld_vtweg_key   TYPE lvc_nkey,
        ld_spart_key   TYPE lvc_nkey,
        ld_last_key    TYPE lvc_nkey,
        ld_top_key     TYPE lvc_nkey.
      " Select data
      SELECT * FROM  vbak INTO CORRESPONDING FIELDS OF TABLE lt_outtab
        UP TO 1550 ROWS.
      " sort table according to conceived hierarchy
      SORT lt_outtab BY vkorg vtweg spart kunnr audat.
    * Define one top node. In this way it is possible to calculate
    * values for the whole hierarchy.
      CALL METHOD go_alvtree->add_node
        EXPORTING
          i_relat_node_key = ''
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = 'Sales Documents'
        IMPORTING
          e_new_node_key   = ld_top_key.
      CLEAR: ls_outtab.
      ls_outtab-nkey  = ld_top_key.
      ls_outtab-ntype = 'ROOT'.
      MODIFY gt_outtab FROM ls_outtab INDEX 1
            TRANSPORTING nkey ntype.
      LOOP AT lt_outtab INTO ls_outtab.
        "   new sales organisation
        IF ( ls_outtab-vkorg = ls_last-vkorg ).
        ELSE.
          PERFORM add_sales_org
                            USING
                               ls_outtab
                               ld_top_key
                         CHANGING
                               ld_vkorg_key.
          ls_outtab-nkey   = ld_vkorg_key.
          ls_outtab-ntype = 'VKORG'.
          DESCRIBE TABLE gt_outtab.  " fill sy-tfill
          MODIFY gt_outtab FROM ls_outtab INDEX syst-tfill
            TRANSPORTING nkey ntype.
        ENDIF.
        "   new distribution channel
        IF ( ls_outtab-vkorg = ls_last-vkorg  AND
             ls_outtab-vtweg = ls_last-vtweg ).
        ELSE.
          PERFORM add_distrib_chan
                            USING
                               ls_outtab
                               ld_vkorg_key
                         CHANGING
                               ld_vtweg_key.
          ls_outtab-nkey = ld_vtweg_key.
          ls_outtab-ntype = 'VTWEG'.
          DESCRIBE TABLE gt_outtab.  " fill sy-tfill
          MODIFY gt_outtab FROM ls_outtab INDEX syst-tfill
            TRANSPORTING nkey ntype.
        ENDIF.
        "   new channel
        IF ( ls_outtab-vkorg = ls_last-vkorg  AND
             ls_outtab-vtweg = ls_last-vtweg  AND
             ls_outtab-spart = ls_last-spart ).
        ELSE.
          PERFORM add_division
                            USING
                               ls_outtab
                               ld_vtweg_key
                         CHANGING
                               ld_spart_key.
          ls_outtab-nkey = ld_spart_key.
          ls_outtab-ntype = 'SPART'.
          DESCRIBE TABLE gt_outtab.  " fill sy-tfill
          MODIFY gt_outtab FROM ls_outtab INDEX syst-tfill
            TRANSPORTING nkey ntype.
        ENDIF.
    * Leaf:
        PERFORM add_complete_line
                          USING
                             ls_outtab
                             ld_spart_key
                       CHANGING
                             ld_last_key.
        ls_outtab-nkey = ld_last_key.
        ls_outtab-ntype = 'LEAF'.
        DESCRIBE TABLE gt_outtab.  " fill sy-tfill
        MODIFY gt_outtab FROM ls_outtab INDEX syst-tfill
            TRANSPORTING nkey ntype.
        ls_last = ls_outtab.
      ENDLOOP.
    ENDFORM.                    " create_hierarchy
    *&      Form  ADD_SALES_ORG
    *       text
    *      -->P_LS_OUTTAB  text
    *      -->P_LD_TOP_KEY  text
    *      <--P_LD_VKORG_KEY  text
    FORM add_sales_org
                   USING
                      value(us_outtab)     TYPE ty_s_outtab
                      value(ud_relat_key)  TYPE lvc_nkey
                CHANGING
                      cd_node_key          TYPE lvc_nkey.
    * define local data
      DATA:
       ld_nodetext    TYPE lvc_value,
       ls_outtab      TYPE ty_s_outtab.
      ld_nodetext = us_outtab-vkorg.
      " add node
      CALL METHOD go_alvtree->add_node
        EXPORTING
          i_relat_node_key = ud_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = ld_nodetext
          is_outtab_line   = ls_outtab
        IMPORTING
          e_new_node_key   = cd_node_key.
    ENDFORM.                    " ADD_SALES_ORG
    *&      Form  add_DISTRIB_CHAN
    *       text
    *      -->P_LS_OUTTAB  text
    *      -->P_LD_VKORG_KEY  text
    *      <--P_LD_VTWEG_KEY  text
    FORM add_distrib_chan
                   USING
                      value(us_outtab)     TYPE ty_s_outtab
                      value(ud_relat_key)  TYPE lvc_nkey
                CHANGING
                      cd_node_key          TYPE lvc_nkey.
    * define local data
      DATA:
       ld_nodetext    TYPE lvc_value,
       ls_outtab      TYPE ty_s_outtab.
      ld_nodetext = us_outtab-vtweg.
      " add node
      CALL METHOD go_alvtree->add_node
        EXPORTING
          i_relat_node_key = ud_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = ld_nodetext
          is_outtab_line   = ls_outtab
        IMPORTING
          e_new_node_key   = cd_node_key.
    ENDFORM.                    " add_DISTRIB_CHAN
    *&      Form  add_division
    *       text
    *      -->P_LS_OUTTAB  text
    *      -->P_LD_VTWEG_KEY  text
    *      <--P_LD_SPART_KEY  text
    FORM add_division
                   USING
                      value(us_outtab)     TYPE ty_s_outtab
                      value(ud_relat_key)  TYPE lvc_nkey
                CHANGING
                      cd_node_key          TYPE lvc_nkey.
    * define local data
      DATA:
       ld_nodetext    TYPE lvc_value,
       ls_outtab      TYPE ty_s_outtab.
      ld_nodetext = us_outtab-spart.
      " add node
      CALL METHOD go_alvtree->add_node
        EXPORTING
          i_relat_node_key = ud_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = ld_nodetext
          is_outtab_line   = ls_outtab
        IMPORTING
          e_new_node_key   = cd_node_key.
    ENDFORM.                    " add_division
    *&      Form  add_complete_line
    *       text
    *      -->P_LS_OUTTAB  text
    *      -->P_LD_SPART_KEY  text
    *      <--P_LD_LAST_KEY  text
    FORM add_complete_line
                   USING
                      value(us_outtab)     TYPE ty_s_outtab
                      value(ud_relat_key)  TYPE lvc_nkey
                CHANGING
                      cd_node_key          TYPE lvc_nkey.
    * define local data
      DATA:
       ld_nodetext    TYPE lvc_value,
       ls_outtab      TYPE ty_s_outtab.
      WRITE us_outtab-kunnr TO ld_nodetext+0  NO-ZERO.
      WRITE us_outtab-audat TO ld_nodetext+20 DD/MM/YYYY.
      CONDENSE ld_nodetext.
      " add node
      CALL METHOD go_alvtree->add_node
        EXPORTING
          i_relat_node_key = ud_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = ld_nodetext
          is_outtab_line   = us_outtab    " !!!
        IMPORTING
          e_new_node_key   = cd_node_key.
    ENDFORM.                    " add_complete_line
    *&      Form  register_events
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM register_events .
      DATA:
        lt_events TYPE cntl_simple_events,
        ls_event TYPE cntl_simple_event.
    * The following four tree events registers ALV Tree in the constructor
    * method itself.
    *    - cl_gui_column_tree=>eventid_expand_no_children
    * (needed to load data to frontend when a user expands a node)
    *    - cl_gui_column_tree=>eventid_header_context_men_req
    * (needed for header context menu)
    *    - cl_gui_column_tree=>eventid_header_click
    * (allows selection of columns (only when item selection activated))
    *   - cl_gui_column_tree=>eventid_item_keypress
    * (needed for F1-Help (only when item selection activated))
    * Nevertheless you have to provide their IDs again if you register
    * additional events with SET_REGISTERED_EVENTS (see below).
    * To do so, call first method  GET_REGISTERED_EVENTS (this way,
    * all already registered events remain registered, even your own):
      CALL METHOD go_alvtree->get_registered_events
        IMPORTING
          events = lt_events.
    * (If you do not these events will be deregistered!!!).
    * You do not have to register events of the toolbar again.
    * Register additional events for your own purposes:
    * §5. Register first context menu event on frontend (with postfix
    *     (_REQUEST). The second is registered automatically.
      ls_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
      APPEND ls_event TO lt_events.
    * register events on frontend
      CALL METHOD go_alvtree->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.
    * §6. Register both context menu events on backend (ABAP Objects
    *    event handling).
      SET HANDLER:
        lcl_eventhandler=>handle_node_ctxmenu_req  FOR go_alvtree,
        lcl_eventhandler=>handle_node_ctxmenu_sel  FOR go_alvtree.
    ENDFORM.                    " register_events
    Regards,
      Uwe

  • Hierarchical sequential display in ALV for webdynpro ABAP

    Hello,
    I am doing an ALV report WebDynpro for abap. I have a situation where I have to display Open Items and all the partial payments in the ALV report. In short. In summary, I have to display a Hierarchical Table of data which two different structures of data, but linked and displayed together.
    The only information I have to go about this is [Table as Hierarchy|http://help.sap.com/saphelp_nw2004s/helpdata/EN/3e/904b2624534e0db707c7314a5e1e9d/frameset.htm] in SAP Help.
    If you have any pointers for programming a Hierarchical Sequential report in Webdynpro alv that would be great. Any classes, methods etc I can use or , how I can do bindings to the context etc...
    Thank you for all your help.
    Sumit.

    Hello,
    I am doing an ALV report WebDynpro for abap. I have a situation where I have to display Open Items and all the partial payments in the ALV report. In short. In summary, I have to display a Hierarchical Table of data which two different structures of data, but linked and displayed together.
    The only information I have to go about this is [Table as Hierarchy|http://help.sap.com/saphelp_nw2004s/helpdata/EN/3e/904b2624534e0db707c7314a5e1e9d/frameset.htm] in SAP Help.
    If you have any pointers for programming a Hierarchical Sequential report in Webdynpro alv that would be great. Any classes, methods etc I can use or , how I can do bindings to the context etc...
    Thank you for all your help.
    Sumit.

  • Set color alv output cell abap webdynpro

    Hi Guys ,
    i wanted to set the color of some cells in alv output to red in ABAP WebDynpro.
    i am using the salv_wd_table.
    any piece of code is appreciated.
    thanks,
    Bobby.

    Bobby,
    If let's say you are build a ALV table to output 'SFLIGHT' table, and you want PLANETYPE '747-400' to be displayed in green, and PLANETYPE '146-200' displayed in red.
    Also, let's just say, you already had a context node 'SFLIGHT_NODE' that is mapped to the external node 'DATA' of your ALV.
    Now:
    1.  you need to modify the context node 'SFLIGHT_NODE' to add an attribute -- say 'CELL_COLOR' of type 'WDY_UIE_LIBRARY_ENUM_TYPE' -- to the SFLIGHT_NODE (note, you need to delete 'DICTIONARY structure' that is bind to the 'SFLIGHT_NODE' node, otherwise, you will not be able to create addition attributes)
    After, you will have something like this for your context node .
      CONTEXT
        --> SFLIGHT_NODE  
    > CARRID
    > CONNID
    > FLDATE
    > PRICE
    > PLANETYPE
    > <and any other attributes you had pulled from SFLIGHT)
    > CELL_COLOR (TYPE WDY_UIE_LIBRARY_ENUM_TYPE)
    2.  In your supply function to the 'SFLIGHT_NODE', you now need to supply the data to this newly added attribute:
    METHOD supply_sflight_node .
    ** data declaration
      DATA:
        itab_sflight_node            TYPE if_componentcontroller=>elements_sflight_node,
        stru_sflight_node            LIKE LINE OF itab_sflight_node.
    ** read sflight data
      SELECT * FROM sflight INTO CORRESPONDING FIELDS OF TABLE itab_sflight_node.
    ** populate the 'CELL_COLOR' field
      LOOP AT itab_sflight_node INTO stru_sflight_node .
        IF stru_sflight_node-planetype = '747-400'.
          stru_sflight_node-cell_color = CL_WD_TABLE_COLUMN=>E_CELL_DESIGN-GOODVALUE_DARK .
         ELSEIF stru_sflight_node-planetype = '146-200'.
          stru_sflight_node-cell_color = CL_WD_TABLE_COLUMN=>E_CELL_DESIGN-BADVALUE_DARK .  
        ELSE.
          stru_sflight_node-cell_color = CL_WD_TABLE_COLUMN=>E_CELL_DESIGN-STANDARD .
        ENDIF.
        modify itab_sflight_node from stru_sflight_node.
      ENDLOOP.
    ** bind all the elements
      node->bind_table(
        new_items =  itab_sflight_node
        set_initial_elements = abap_true ).
    ENDMETHOD.
    3. Now, you need to obtain the configuration model of the ALV and config it before display.  (say you have an method does this 'init_alv_table_settings', and it is called from your view's wddoinit() method)
    METHOD init_alv_table_settings .
      DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage.
      l_ref_cmp_usage =   wd_this->wd_cpuse_alv_table( ).
      IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
        l_ref_cmp_usage->create_component( ).
      ENDIF.
      DATA: l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table .
      l_ref_interfacecontroller =   wd_this->wd_cpifc_alv_table( ).
      DATA:
      node_sflight_node                   TYPE REF TO if_wd_context_node .
      node_sflight_node = wd_context->get_child_node( name = if_flights_view=>wdctx_sflight_node ).
      CALL METHOD l_ref_interfacecontroller->set_data
        EXPORTING
          r_node_data = node_sflight_node.
    **  get ConfigurationModel from ALV Component
      DATA:    lr_table TYPE REF TO cl_salv_wd_config_table.
      lr_table = l_ref_interfacecontroller->get_model( ).
    ** change the color of the cell
      DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings.
      DATA: lr_column TYPE REF TO cl_salv_wd_column.
      lr_column_settings ?= lr_table.
      lr_column = lr_column_settings->get_column( 'PLANETYPE' ).
      DATA: lr_input_field TYPE REF TO cl_salv_wd_uie_input_field.
      CREATE OBJECT lr_input_field EXPORTING value_fieldname = 'PLANETYPE'.
      lr_column->set_cell_editor( lr_input_field ).
      lr_column->set_cell_design_fieldname( value = 'CELL_COLOR' ).
    ENDMETHOD.
    Compile and activate your code.
    Regards,
    Tina Yang
    Message was edited by: Tina Yang

Maybe you are looking for