Skip to Content
0
Apr 18, 2010 at 02:53 AM

Joining table VBEP and VBAP

2040 Views

I am creating a report for BOL. My requirement

If u201CFixed date and qtyu201D field in checked and line NOT confirmed in Schedule line tab in the sales order, my report should display that line item. In my report I am using these table VBAP, VBUP, VBAK, VBUK.

Here is the code for schedule line confirmed qty in my report

data: lv_ETENR like VBEP-ETENR.

CLEAR: ZCONFQTY, lv_ETENR.

SELECT SINGLE BMENG MAX( ETENR )

into (ZCONFQTY, lv_ETENR)

from VBEP

where VBELN = VBAP-VBELN

and POSNR = VBAP-POSNR

GROUP BY BMENG.

My report working fine if a line item is confirmed fully. HOWEVER, it is not working if a line items qty splits into two different schedule lines and one is confirmed and others are unconfirmed. For example: Sales order line item qty is for 60. Two schedule line

Delivery Order qty Rounded qty confirmed qty

05/10/2010 10 10 0

05/15/2010 50 50 50

Do I need to change my code to catch multiple schedule line? If yes, can you please give me the code? Thank you so much....

VBEP (ETENR, POSNR, BMENG) VBAP-VBELN