‎2006 Jul 19 9:04 PM
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
‎2006 Jul 19 9:10 PM
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!
‎2006 Jul 19 9:10 PM
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!
‎2006 Jul 19 9:21 PM
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
‎2006 Jul 19 9:33 PM
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
‎2006 Jul 19 9:37 PM
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
‎2006 Jul 19 9:45 PM
Hi Rich,
Ok i understood. The last reply cleared my doubt .
Thanks again and i am awarding full points .
Have a wonderful day
Kajol
‎2006 Jul 19 9:45 PM
‎2006 Jul 19 9:57 PM
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
‎2006 Jul 19 10:18 PM
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
‎2006 Jul 19 10:45 PM
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
‎2006 Jul 20 2:03 AM