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 with logic

Former Member
0 Likes
573

Hi

following logic is not working pls help me

it_lips have line no(posnr), lt_lipov dont have POSNR.

i need to move all the records from it_lips to lt_lipov.

SELECT * FROM lips INTO

CORRESPONDING FIELDS OF TABLE it_lips

for all entries in lt_lipov

WHERE vbeln = lt_lipov-vbeln.

IF it_lips[] IS NOT INITIAL.

LOOP AT it_lips where vbeln = lt_lipov-vbeln.

*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-ebeln = it_lips-vgbel.

lt_lipov1-vgpos = it_lips-vgpos.

lt_lipov1-bolnr = lt_lipov-bolnr.

lt_lipov1-komau = lt_lipov-komau.

APPEND lt_lipov1.

CLEAR lt_lipov1.

*ENDIF.

ENDLOOP.

ENDIF.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
534

remove where condition in.

LOOP AT it_lips where vbeln = lt_lipov-vbeln.

it will work

4 REPLIES 4
Read only

Former Member
0 Likes
534

Hi Kumar,

Try using MOVE-CORRESPONDING inside the LOOP.

Hope this helps.

Benedict

Read only

Former Member
0 Likes
535

remove where condition in.

LOOP AT it_lips where vbeln = lt_lipov-vbeln.

it will work

Read only

Former Member
0 Likes
534

Hi Kumar,

in the select query, you are doing a For all entries in 'lt_lipov' in to internal table it_lips.

But you said you want to move data from table 'it_lips' to 'lt_lipov'.

SELECT * FROM lips INTO

CORRESPONDING FIELDS OF TABLE it_lips

for all entries in lt_lipov

WHERE vbeln = lt_lipov-vbeln.

So in effect, table 'lt_lipov' is blank when you are selecting data from the table lips in to internal table 'it_lips'.

This is the reason why the logic is not working.

did you check the sy-subrc status after the select query? is it zero???

Pls revert back in case it is still not working.

<removed_by_moderator>

Cheers,

Raghav.

Edited by: Julius Bussche on Jun 24, 2008 7:19 PM

Read only

Former Member
0 Likes
534

Hi,

I can suggest few steps and you can use which ever is appropriate to your requirement.

1)check if you really need POSNR, If no, declare a internal table with different structure with all fields of LIPS and lipov and move all the data to that internal table.

2)If you need posnr,check if you have POSNR in LIPOV table and fetch that too, and use POSNR too in WHERE condition of the loop.

These are suggestion, the one to chose depends on your requirement.

<removed_by_moderator>

Thanks,

Sandeep

Edited by: Julius Bussche on Jun 24, 2008 7:20 PM