Skip to Content
avatar image
Former Member

ALV Layout

Hi All,

how to find the tabix in the ALV layout when i select a row......

Thanks in Advance..

Dhavamani

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Dec 12, 2008 at 07:41 AM

    Hi Dhavamani,

    The procedure to find the selected row in ALV is no different from the procedure to find the selected row in an table ui element. If you are using leadSelection then you can get the index of the selected row by using the GET_LEAD_SELECTION_INDEX method of IF_WD_CONTEXT_NODE. Similarly you can use GET_SELECTED_ELEMENTS to get the selection values if you have removed the lead selection property & are making use of multiple selection.

    For example the below code segment gets the rows selected by the user in the ALV & deletes them.

    METHOD onactiondelete_rows .
      DATA:  wd_node TYPE REF TO if_wd_context_node,
             lt_node1 TYPE ig_componentcontroller=>elements_node,
             wa_temp  TYPE REF TO if_wd_context_element,
             lt_temp  TYPE wdr_context_element_set,
             row_number TYPE i VALUE 0.
    
    
      wd_node = wd_context->get_child_node( name = 'NODE' ).
    
      CALL METHOD wd_node->get_selected_elements
        RECEIVING
          set = lt_temp.
    
      LOOP AT lt_temp INTO wa_temp.
        wd_node->remove_element( EXPORTING element = wa_temp ).
      ENDLOOP.
    
      CALL METHOD wd_node->get_static_attributes_table
        EXPORTING
          from  = 1
          to    = 2147483647
        IMPORTING
          table = lt_node1.
    
      wd_node->bind_table( new_items = lt_node1 ).
    ENDMETHOD.

    Regards,

    Uday

    Add comment
    10|10000 characters needed characters exceeded