cancel
Showing results for 
Search instead for 
Did you mean: 

Moving data from one ITAB to another with different structure

0 Kudos

Hi,

I have 2 ALVs in a view where i need to add the selected data from ALV1 to ALV2 when i press ADD button and remove the selected data from ALV2 to ALV1 when i click REMOVE button.

The problem is ALV2 has an extra field.

STEP 1: I use GET_SELECTED_ELEMENTS from ALV1 and push it to an ITAB1,

STEP 2: I need to loop at ITAB1 and pass individual data to ITAB2 as ITAB2 has an extra field.

How do i achieve step 2. What will be the work area type? I cannot use work_area1 like like of ITAB1.

Please help.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi guys,

Thanks for your input. However, as mentioned earlier the declaration of itab and workarea when they are refering context nodes, cannot be declared the same way as we do in core abap. This is my understanding.

data: itab type wd_this->elements_zzz,

*        ls_itab like line of wd_this->elements_zzz "is wrong. instead the below line has to be used

        ls_itab type wd_this->element_zzz "note that here its element and for itab its elements.

This way, the program is working whilst earlier when i tried the same it wasnt working. I may have missed something.

Answers (1)

Answers (1)

Former Member
0 Kudos

If you are on or above ABAP 7.40 SP05, you can move the contents of one internal table to another


MOVE-CORRESPONDING ITAB1 TO ITAB2.