Skip to Content
0
Former Member
Apr 14, 2007 at 08:42 AM

abap logic

10 Views

hi,

may i know if the logic is correct?

i only doubt is the last loop, where the select statement in the loop.

wa_report-vgbel and wa_report-vgpos, this combination is unique and no duplication. can the control in the select statement when meet endselect after process 1 record (the unique combination), will go to next record in the loop?

thanks

sort it_delivery by vbeln vgbel vgpos.

loop at it_delivery into wa_delivery.

move wa_delivery-vbeln to wa_report-vbeln.

move wa_delivery-vgbel to wa_report-vgbel.

move wa_delivery-vgpos to wa_report-vgpos.

move wa_delivery-matnr to wa_report-matnr.

move wa_delivery-charg to wa_report-charg.

move wa_delivery-lfimg to wa_report-lfimg.

collect wa_report into it_report.

endloop.

loop at it_report into wa_report.

v_tabix = sy-tabix.

select a~kwmeng

bvkorg bvtweg bspart bvbtyp

into (wa_report-kwmeng, wa_report-vkorg,

wa_report-vtweg, wa_report-spart, wa_report-vbtyp)

from vbap as a inner join vbak as b

on avbeln = bvbeln

where a~vbeln = wa_report-vgbel and

a~posnr = wa_report-vgpos.

if sy-subrc = 0.

SELECT SINGLE tknum FROM vttp INTO wa_report-tknum

WHERE vbeln = wa_delivery-vbeln.

SELECT SINGLE * FROM vbpa

WHERE vbeln = wa_report-vbeln AND

parvw = 'SH'.

READ TABLE it_customer WITH KEY kunnr = vbpa-kunnr.

IF sy-subrc = 0.

wa_report-kunnr = vbpa-kunnr.

endif.

wa_report-openqty = wa_report-kwmeng - wa_report-lfimg.

modify it_report from wa_report index v_tabix transporting

kwmeng vkorg vtweg spart vbtyp tknum kunnr.

endif.

endselect.

endloop.

endif.