cancel
Showing results for 
Search instead for 
Did you mean: 

Web dynpro ALV table copy selected row

Former Member
0 Kudos

How to copy a selected row into new row with same values.

Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Have you got any button for COPY...If yes, then in this copy button handler,

get the element that is selected..using the GET_SELECTED_ELEMENTS if selection is 1:N

if you have single lead selection then you can use the get_lead_selection that returns the row selected..

Now, get the added row number element instance and using the set_static_attributes you can pass the above record to this method..

Regards,

Lekha.

Former Member
0 Kudos

can you please give the full code for this one. thanks

Former Member
0 Kudos

Hi,

I assume that there is a COPY buttonand there is a single lead seecltion for your alv table.

Now,

data:
  lr_node type ref to if_wd_context_node,
  lr_element type ref to if_wd_context_element,
  lr_element1 type ref to if_wd_context_element,
  ls_table type vbak,
 ls_table1 type vbak.

lr_node = wd_context->get_chaild_node ( 'FLIGHT ' ).

if lr_node is not initial.
lr_element = lr_node->get_lead_selection ( ).
lr_elemnet1 = lr_node->get_element( index = 4). "supose the index of new row is 4
* you can use the get_element_count to know the record number
endif.

if lr_element is not initial.

lr_element->get_statitc_attributes
importing
static_attributes = ls_table
endif.
if lr_element1 is not initial.
lr_element1->set_staitc_attributes
exporting
STATIC_ATTRIBUTES = ls_table.
endif.

Assume that you have already created a new row...

use code wizard.

Regards,

Lekha.