Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem in Move-Corresponding

Former Member
0 Likes
1,754

Hi

Move-corresponding is not working in the following coding.

after move lt_lipov-komau value is disappear. Rest of the fields OK. Pls help me

FORM get_vbrp_data.

SELECT * INTO CORRESPONDING FIELDS OF TABLE lt_vbrp

FROM vbrp WHERE vbeln IN s_invno.

ENDFORM. " get_vbrp_data

************************************************************************

FORM get_asn_data_invno.

SORT lt_vbrp BY vgbel.

LOOP AT lt_vbrp.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

EXPORTING

input = lt_vbrp-vgbel

IMPORTING

output = lt_vbrp-vgbel

.

  • Read in ASN

SELECT vbeln verur bolnr erdat ernam

FROM likp INTO TABLE it_likp

WHERE bolnr = lt_vbrp-vgbel.

IF it_likp[] IS NOT INITIAL.

READ TABLE it_likp WITH KEY bolnr = lt_vbrp-vgbel.

IF sy-subrc EQ 0.

lt_lipov-vbeln = it_likp-vbeln.

lt_lipov-bolnr = it_likp-bolnr.

lt_lipov-lddat = it_likp-erdat.

lt_lipov-ernam = it_likp-ernam.

ELSE. "No ASN records found for the invoice

CLEAR LT_REP-VBELN.

CLEAR LT_REP-LFDAT.

CLEAR LT_REP-VERUR.

CLEAR LT_REP-BOLNR.

LT_REP-KOMAU = IT_LIPS-KOMAU. "Inv no

LV_MESSAGE = TEXT-504.

PERFORM CREATE_REPORT_RECORD_LIN01.

LT_REP-LINE_COLOUR = 'C610'. " red Intensified

ENDIF.

lt_lipov-komau = lt_vbrp-vbeln.

APPEND lt_lipov.

CLEAR lt_lipov.

ENDIF.

ENDLOOP.

LOOP AT lt_lipov.

SELECT * FROM lips INTO

CORRESPONDING FIELDS OF TABLE it_lips

WHERE vbeln = lt_lipov-vbeln.

IF it_lips[] IS NOT INITIAL.

READ TABLE it_lips WITH KEY vbeln = lt_lipov-vbeln.

IF sy-subrc = 0.

lt_lipov1-vbeln = it_lips-vbeln.

lt_lipov1-posnr = it_lips-posnr.

lt_lipov1-matnr = it_lips-matnr.

lt_lipov1-lddat = it_lips-erdat.

lt_lipov1-lfimg = it_lips-lfimg.

lt_lipov1-ernam = it_lips-ernam.

lt_lipov1-werks = it_lips-werks.

lt_lipov1-vgbel = it_lips-vgbel.

lt_lipov1-vgpos = it_lips-vgpos.

lt_lipov1-bolnr = lt_lipov-bolnr.

APPEND lt_lipov1.

CLEAR lt_lipov1.

ENDIF.

ENDIF.

ENDLOOP.

LOOP AT LT_LIPOV1. "move records back to LT_LIPOV for further verification

REFRESH LT_LIPOV.

MOVE-CORRESPONDING LT_LIPOV1 TO LT_LIPOV.

APPEND LT_LIPOV.

ENDLOOP.

7 REPLIES 7
Read only

Former Member
0 Likes
1,055
LOOP AT LT_LIPOV1. "move records back to LT_LIPOV for further verification
REFRESH LT_LIPOV.  "this is wrong. use clear lt_lipov instead
MOVE-CORRESPONDING LT_LIPOV1 TO LT_LIPOV.
APPEND LT_LIPOV.
ENDLOOP
Read only

Former Member
0 Likes
1,055

Hi,

you overwrite it with space.

Try this.

data: dkomau like lt_lipov-komau.

LOOP AT LT_LIPOV1. "move records back to LT_LIPOV for further verification

dkomau = lt_lipov-komau.

REFRESH LT_LIPOV.

MOVE-CORRESPONDING LT_LIPOV1 TO LT_LIPOV.

lt-komau = dkomau.

clear dkomau.

APPEND LT_LIPOV.

ENDLOOP.

Regards

Nicole

Read only

Former Member
0 Likes
1,055

If you want to copy of a internal table to another table of same type the you do not need loop and move. Use the folloeing :


 LT_LIPOV[]  =  LT_LIPOV1[].

If you still want to follow your approach then use the following:


CLEAR : LT_LIPOV[].  
LOOP AT LT_LIPOV1. 
   MOVE-CORRESPONDING LT_LIPOV1 TO LT_LIPOV.
   APPEND LT_LIPOV.
   CLEAR :  LT_LIPOV,  LT_LIPOV1.
ENDLOOP

Read only

Former Member
0 Likes
1,055

You can do this also. move the refresh outof loop

REFRESH LT_LIPOV.  
LOOP AT LT_LIPOV1. "move records back to LT_LIPOV for further verification
MOVE-CORRESPONDING LT_LIPOV1 TO LT_LIPOV.
APPEND LT_LIPOV.
clear lt_lipov.
ENDLOOP

Read only

Former Member
0 Likes
1,055

Hi

Don't give refresh inside the loop.

LOOP AT LT_LIPOV1. "move records back to LT_LIPOV for further verification

MOVE-CORRESPONDING LT_LIPOV1 TO LT_LIPOV.

APPEND LT_LIPOV.

CLEAR LT_LIPOV.

ENDLOOP.

Reward points, if it is useful

Regards

Raja.

Read only

Former Member
0 Likes
1,055

If both the internal tables are of the same structure then no need of loop.

Just code it like:

REFRESH LT_LIPOV.

LT_LIPOV[] = LT_LIPOV1[].

Instead of :

LOOP AT LT_LIPOV1. "move records back to LT_LIPOV for further verification

REFRESH LT_LIPOV.

MOVE-CORRESPONDING LT_LIPOV1 TO LT_LIPOV.

APPEND LT_LIPOV.

ENDLOOP.

Read only

0 Likes
1,055

Hi

I tried all the solutions. But still not working. Anyone pls help me out.