DATA lo_nd_it_mara TYPE REF TO if_wd_context_node.
DATA lt_it_mara TYPE wd_ this->elements_it_mara.
DATA ls_it_mara TYPE wd_ this->element_it_mara.
DATA it_mara_new TYPE wd_ this->elements_it_mara.
DATA ls_mara_new TYPE wd_ this->element_it_mara.
* navigate from <CONTEXT> to <IT_MARA> via lead selection
lo_nd_it_mara = wd_context-> get_child_node( name = wd_ this->wdctx_it_mara ).
lo_nd_it_mara->get_static_ attributes_table( IMPORTING ta ble = lt_it_mara ).
DATA: ld_element TYPE RE F TO if_wd_context_element,
it_rows TYPE wdr_ context_element_set,
wa_rows LIKE LINE OF it_rows.
DATA: ld_index TYPE i.
*** to get the lead selected values
ld_element = lo_nd_it_ mara->get_lead_selection( ).
it_rows = lo_nd_it_mara-> get_selected_elements( including_lead_selection = abap_true ).
LOOP AT it_rows INTO wa_ rows.
CALL METHOD wa_rows->get_ static_attributes
IMPORTING
static_attributes = ls_mara_new."wa_selrow.
READ TABLE lt_it_mara INTO ls_it_mara WITH KEY matnr = ls_mara_new-matnr.
ld_index = sy-tabix. " index of selected row
APPEND ls_it_mara TO it_ mara_new.
ENDLOOP.
IF it_mara_new IS NOT INITIA L.
DATA lo_nd_it_mara_new TYP E REF TO if_wd_context_node.
DATA lt_it_mara_new TYPE wd_this->elements_it_mara_new.
* navigate from <CONTEXT> to < IT_MARA_NEW> via lead selection
lo_nd_it_mara_new = wd_ context->get_child_node( name = wd_this->wdctx_it_mara_new ) .
SORT it_mara_new BY matnr.
lo_nd_it_mara_new->bind_ table( it_mara_new ).
ENDIF.
DATA lt_it_mara TYPE wd_
DATA ls_it_mara TYPE wd_
DATA it_mara_new TYPE wd_
DATA ls_mara_new TYPE wd_
* navigate from <CONTEXT>
lo_nd_it_mara = wd_context->
lo_nd_it_mara->get_static_
DATA: ld_element TYPE RE
it_rows TYPE wdr_
wa_rows LIKE LINE OF
DATA: ld_index TYPE i.
*** to get the lead selected values
ld_element = lo_nd_it_
it_rows = lo_nd_it_mara->
LOOP AT it_rows INTO wa_
CALL METHOD wa_rows->get_
IMPORTING
static_attributes =
READ TABLE lt_it_mara INTO
ld_index = sy-tabix. "
APPEND ls_it_mara TO it_
ENDLOOP.
IF it_mara_new IS NOT INITIA
DATA lo_nd_it_mara_new TYP
DATA lt_it_mara_new TYPE
* navigate from <CONTEXT> to <
lo_nd_it_mara_new = wd_
SORT it_mara_new BY matnr.
lo_nd_it_mara_new->bind_
ENDIF.
No comments:
Post a Comment