Application Development and Automation 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: 
Read only

Introduction

Former Member
1,342

Hi all,

Iam kajol and i have registered today.

does anybody have the code written to retrieve the ordered quantity and delivery quantity of a po .

please do send it to me at

kajolsindi@yahoo.com

Kajol

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,312

Hi. Welcome to SDN!. You can get these values from the PO Tables. The order quantity can be found in table EKPO field MENGE. You can get the delivery qty from the PO history table EKBE. You will need to get all records per PO/item, only records that have BEWTP = E. These are the GR. Loop at these records and add up the MENGE field. This is the delivery qty.

Regards,

Rich Heilman

PS.

Put yourself on the SDN world map (http://sdn.idizaai.be/sdn_world/sdn_world.html) and earn 25 points.

Spread the wor(l)d!

10 REPLIES 10
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,313

Hi. Welcome to SDN!. You can get these values from the PO Tables. The order quantity can be found in table EKPO field MENGE. You can get the delivery qty from the PO history table EKBE. You will need to get all records per PO/item, only records that have BEWTP = E. These are the GR. Loop at these records and add up the MENGE field. This is the delivery qty.

Regards,

Rich Heilman

PS.

Put yourself on the SDN world map (http://sdn.idizaai.be/sdn_world/sdn_world.html) and earn 25 points.

Spread the wor(l)d!

Read only

0 Likes
1,312

Here is some sample code.




report zrich_0001.

data: iekbe type table of ekbe with header line.
data: xekpo type ekpo.
data: qty_delivered type ekbe-menge.

parameters: p_ebeln type ekpo-ebeln,
            p_ebelp type ekpo-ebelp.


start-of-selection.

  clear xekpo.
  select single * from ekpo into xekpo
              where ebeln = p_ebeln
                and ebelp = p_ebelp.


  clear iekbe. refresh iekbe.
  select  * from ekbe into table iekbe
    where ebeln = p_ebeln
      and ebelp = p_ebelp
      and bewtp = 'E'
      and bwart in ('101', '102').
  loop at iekbe.
    if iekbe-bwart = '102'.
      iekbe-menge = iekbe-menge * -1.
    endif.
    qty_delivered  = qty_delivered + iekbe-menge.
  endloop.


  write:/ 'Po Number/Item:', xekpo-ebeln, xekpo-ebelp.
  write:/ 'Order Qty:', xekpo-menge.
  write:/ 'Qty Delivered:', qty_delivered .

Regards

Rich Heilman

Read only

0 Likes
1,312

Hi Rich,

I would like to thank you for your reply.

But i have question as you said

Loop at these records and add up the MENGE field. This is the delivery qty.

then the value of menge is that off all items or single item.

Iam retriving menge based on po and item no from ekbe

***delivery quantity

select menge into table itab_ekbe

from ekbe

where ebeln = itab_req-ebeln

and ebelp = itab_req-ebelp.

do i need to loop at itab_ekbe.iam confused because itab_ekbe would have only one value right.

Please let me know what iam thinking is on right lines.

Thanks

Read only

0 Likes
1,312

You can have multiple reciepts against a PO line item. Say the order quantity was for 10, you receive 1 each day for the next 10 days, you would do 10 different reciepts against this, this means that there would be 10 records for this po line item in the EKBE table. This is why i am saying to get all the records for the po line item and add them up. You must take into account any reversals. See the sample code above.

Regards,

Rich Heilman

Read only

0 Likes
1,312

Hi Rich,

Ok i understood. The last reply cleared my doubt .

Thanks again and i am awarding full points .

Have a wonderful day

Kajol

Read only

0 Likes
1,312

Since you are new, now is a good time to sign the SDN World map, you get 25 points for it!

Put yourself on the SDN world map (http://sdn.idizaai.be/sdn_world/sdn_world.html) and earn 25 points.

Regards,

Rich Heilman

Read only

0 Likes
1,312

Hi Rich,

i would definetly register.

Ihave one more doubt whats the BWART movement 101 and 102 and why do we need to subtract menge of movement type 102 from to quantity.

Thanks in advance

Read only

0 Likes
1,312

Hi kajol,

Movement Type 101 is for GR (Goods Receipt) and 102 is used for GR PO reversal. If there is a reversal, in that case we need to subtract the menge with movement type of 102.

Thanks!

Suresh G

Read only

0 Likes
1,312

Hi Suresh,

Thanks for your input.

can you tell me the transaction for GR PO reversal i.e for movement type 102.

what does PO history category E MEAN.

Thanks in advance.

Kajol

Read only

0 Likes
1,312

You can do a reversal from MIGO as well as the GR(101) The PO History Category E means that it is a GR.

Regards,

Rich Heilman