Application Development 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: 

how to implement the logic in the code

Former Member
0 Kudos

Hi,

i want to do sum for each and every line item of the delivery quantity and compare it with final purchase order quantity if it is equal do not display in the output.(how to use at last/at end of ) in this code,

********

below code wat i have ritten is only comparing first record quantity (not total line items quantity )with final purchase order quantity and displaying the output, but i want sum of each and every line item of the delivery quantity (total)and compare with final quantity(purchase order quantity) and which are greater than final purchase order quantity those wil be displayed in the output.

********

if possible try modify this code

clear:wa_final,wa_kopoo,wa_likpp1.

loop at it_kopoo into wa_kopoo.

move wa_kopoo-ebeln to wa_final-ebeln.

move wa_kopoo-ebelp to wa_final-ebelp.

move wa_kopoo-matnr to wa_final-matnr.

move wa_kopoo-txz01 to wa_final-txz01.

move wa_kopoo-menge to wa_final-menge.

move wa_kopoo-meins to wa_final-meins.

move wa_kopoo-werks to wa_final-werks.

move wa_kopoo-matkl to wa_final-matkl.

move wa_kopoo-reswk to wa_final-reswk.

move wa_kopoo-aedat to wa_final-aedat.

move wa_kopoo-ekgrp to wa_final-ekgrp.

move wa_kopoo-EINDT to wa_final-EINDT.

read table it_likpp1 into wa_likpp1 with key vgbel = wa_final-ebeln

vgpos = wa_final-ebelp.

if sy-subrc eq 0.

if wa_final-menge > wa_likpp1-LFIMG.

else.

continue.

endif.

endif.

append wa_final to it_final.

clear:wa_final,wa_kopoo,wa_likpp1.

endloop.

endif.

Thanks in Advance

2 REPLIES 2

Former Member
0 Kudos

Try this



sort it_kopoo by ebeln ebelp.
clear:wa_final,wa_kopoo,wa_likpp1.
loop at it_kopoo into wa_kopoo.
move wa_kopoo-ebeln to wa_final-ebeln.
move wa_kopoo-ebelp to wa_final-ebelp.
move wa_kopoo-matnr to wa_final-matnr.
move wa_kopoo-txz01 to wa_final-txz01.
move wa_kopoo-menge to wa_final-menge.
move wa_kopoo-meins to wa_final-meins.
move wa_kopoo-werks to wa_final-werks.
move wa_kopoo-matkl to wa_final-matkl.
move wa_kopoo-reswk to wa_final-reswk.
move wa_kopoo-aedat to wa_final-aedat.
move wa_kopoo-ekgrp to wa_final-ekgrp.
move wa_kopoo-EINDT to wa_final-EINDT.

at end of ebelp.
read table it_likpp1 into wa_likpp1 with key vgbel = wa_final-ebeln
vgpos = wa_final-ebelp.

if sy-subrc eq 0.
if wa_final-menge > wa_likpp1-LFIMG.
else.
continue.
endif.
endif.
endat.
append wa_final to it_final.

clear:wa_final,wa_kopoo,wa_likpp1.
endloop.
endif.

always use code format while pasting the code. it will be easy for reading

//Kothand

Former Member
0 Kudos

Hi hema latha ,

Try this logic,,it will help u,,,

loop at it_kopoo.

At end of ebelp.

read table it_likpp1 into wa_likpp1 with key vgbel = it_final-ebeln

vgpos = wa_final-ebelp.

if sy-subrc eq 0.

if wa_final-menge > wa_likpp1-LFIMG.

else.

continue.

endif.

endif.

end at.

endloop.

Hope this helps you

Regards,

T.Durai murugan.