Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Finding index of row , for which event is to be trigered.

Hi All,

We have a delete icon in one column of a tableview.

As soon as the row is selected,the icon becomes visible.Below is the code for it:

      IF p_edit_mode IS NOT INITIAL.
DATA col_image TYPE REF TO cl_htmlb_image.
col_image = c l _ h t m l b _ i m a g e = > f a c t  o r y (   i d   =   p_ c e l l _ i d   s rc   =   ' . . / z _ e c a r _n e w u i / d e l e t e _ i c o n . j p g '   
 a l t   =   ' d e l e t e   r o w '   on c l ic k  =  ' d e l e t e ' ) . 
   p_ r e p l a c e m e n t _ b e e   =   c o l _ i m a g e . 
   E N D I F .

Code in OnInputProcessing:

IF event IS NOT INITIAL AND event->event_name = htmlb_events=>image .
*  tv_event ?= event .
  CASE event->event_server_name.

**Delete icon in tableview.

    WHEN 'delete'.
      DATA: cell_id_del(20).

      DATA: total_rows TYPE i.
      DATA: BEGIN OF wa_matnr,
              matnr TYPE bbp_ws_oci_item_s-matnr,
            END OF wa_matnr.
      DATA: it_matnr LIKE TABLE OF wa_matnr.

*      GET PARAMETER ID cell_id_del  FIELD cell_id_del.
      LOOP AT itab_row_idx INTO wa_row_idx.
        READ TABLE new_item INTO wa_item INDEX wa_row_idx-row_idx.
        wa_matnr-matnr = wa_item-matnr.
        APPEND wa_matnr TO it_matnr.


      LOOP AT it_matnr INTO wa_matnr.
        DELETE new_item WHERE matnr = wa_matnr-matnr.

      DESCRIBE TABLE new_item LINES total_rows.
      rowcount = total_rows
      request = request
      id = 'mat_final'
      check = ' '
      ) .

Now suppose there are 5 rows in the tableview,user selects first three rows ,so all three rows are editable now and delete icon is visible for these rows .Now if the user click delete icon of second row, how can i find out that delete icon on second row is pressed?



Edited by: Anubhav Jain on Oct 9, 2008 10:47 AM

Former Member replied

IF you have a reference to the interface if_htmlb_data in the DO_HANDLE_EVENT, all the values should be in the reference.

The value would be in either of these variables.




0 View this answer in context

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question