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 use at last/ at end of in this code

Former Member
0 Kudos
134

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 with final purchase order quantity and displaying the output, but i want sum of every line item and compare with final quantity(purchase order quantity)

********

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.

1 REPLY 1

Former Member
0 Kudos
70

Hi,

Try this:

define one more internal table it_final1 similar to i_final .

CLEAR:wa_final,wa_kopoo,wa_likpp1.

SORT it_kopoo BY ebeln ebelp.

LOOP AT it_kopoo INTO wa_kopoo.

move-corresponding wa_kopoo to wa_final.

COLLECT wa_final INTO it_final1.

CLEAR: wa_kopoo, wa_final.

ENDLOOP.

sort it_final1 by ebeln ebelp.

LOOP AT it_final1 INTO wa_final.

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 NE wa_likpp1-lfimg.

APPEND wa_final TO it_final.

ENDIF.

ENDIF.

ENDLOOP.

Regards,

Subramanian