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: 

Calculate Open Quantity for each schedule line in VA32

Former Member
0 Kudos

Hi Folks,

How can I get open quantity for each schedule line in VA32. Is there any function module to calculate the open quantity for each schedule line?

If function module doesn't exists please advise how to calculate the open quantity for each schedule line in VA32(Schedule agreement).

Thanks,

Vijay.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

just check this and verify from the tables .

declare a table as

DATA : BEGIN OF itm_sales OCCURS 0,

vbeln LIKE vbap-vbeln,

posnr LIKE vbap-posnr,

matnr LIKE vbap-matnr,

kwmeng like vbap-kwmeng, "for open qty

lfsta LIKE vbup-lfsta,

lfgsa LIKE vbup-lfgsa,

fksta LIKE vbup-fksta,

fksaa LIKE vbup-fksaa,

gbsta LIKE vbup-gbsta,

END OF itm_sales.

select a~vbeln

a~posnr

a~matnr

a~kwmeng

b~lfsta

b~lfgsa

b~fksta

b~fksaa

b~gbsta

INTO TABLE itm_sales

FROM vbap AS a JOIN vbup AS b

ON avbeln EQ bvbeln "sales order

AND aposnr EQ bposnr "item

AND b~gbsta NE 'C' . "overall processing status

"processing status should be <> 'C' means open order

once fetch .

IF NOT itm_sales IS INITIAL.

LOOP AT itm_sales.

at end of vbeln .

sum.

v_openqty = itm_sales-kwmeng. "sum the open quantity

endat.

WRITE:/5 itm_sales-vbeln,

itm_sales-posnr,

itm_sales-matnr,

itm_sales-kwmeng,

itm_sales-lfsta,

itm_sales-lfgsa,

itm_sales-fksta,

itm_sales-fksaa,

itm_sales-gbsta.

ENDLOOP.

ENDIF.

skip 2.

write:/ 'open Quantity for the order is ', v_openqty .

hope this helps ,

regards,

vijay

Message was edited by:

Vijay

5 REPLIES 5

Former Member
0 Kudos

hi,

pls check VBEP Table entries

0 Kudos

In VBEP table we have fields like order quantity in sales units, confirmed quantity, and required quantity for each schedule line but not the open quantity.

My requirement is to have the open quantity for each schedule line. Help me to resolve the issue.

Thanks,

Vijay.

0 Kudos

For that u need to query the sales order number in tabke VBUK and check the field GBSTK ne C then it will be an open order .

u can look in table VBAKUK for this ..

This is nothing but a Join of VBAK and VBUK entries. u can eliminate a join if u fetch it from VbakUk

Now once it is confirmed that it is open then fetch the entries from VBAP..

regards,

vijay

Former Member
0 Kudos

Hi,

You'll get all the data related to a schedule line in table EKET.

Former Member
0 Kudos

just check this and verify from the tables .

declare a table as

DATA : BEGIN OF itm_sales OCCURS 0,

vbeln LIKE vbap-vbeln,

posnr LIKE vbap-posnr,

matnr LIKE vbap-matnr,

kwmeng like vbap-kwmeng, "for open qty

lfsta LIKE vbup-lfsta,

lfgsa LIKE vbup-lfgsa,

fksta LIKE vbup-fksta,

fksaa LIKE vbup-fksaa,

gbsta LIKE vbup-gbsta,

END OF itm_sales.

select a~vbeln

a~posnr

a~matnr

a~kwmeng

b~lfsta

b~lfgsa

b~fksta

b~fksaa

b~gbsta

INTO TABLE itm_sales

FROM vbap AS a JOIN vbup AS b

ON avbeln EQ bvbeln "sales order

AND aposnr EQ bposnr "item

AND b~gbsta NE 'C' . "overall processing status

"processing status should be <> 'C' means open order

once fetch .

IF NOT itm_sales IS INITIAL.

LOOP AT itm_sales.

at end of vbeln .

sum.

v_openqty = itm_sales-kwmeng. "sum the open quantity

endat.

WRITE:/5 itm_sales-vbeln,

itm_sales-posnr,

itm_sales-matnr,

itm_sales-kwmeng,

itm_sales-lfsta,

itm_sales-lfgsa,

itm_sales-fksta,

itm_sales-fksaa,

itm_sales-gbsta.

ENDLOOP.

ENDIF.

skip 2.

write:/ 'open Quantity for the order is ', v_openqty .

hope this helps ,

regards,

vijay

Message was edited by:

Vijay