‎2013 Nov 06 6:01 PM
Hi All,
We are using /AFS/BAPI_GOODSMVT_CREATE BAPI to create Goods Receipt againt PO in MB01 through processing an inbound idoc.It is working fine.
But when I post the same idoc Goods receipt is again creating for the same PO. As I am ABAP technical I am not much aware of functional. My question
is will the Goods receipt will be created for the same PO again or is there anything like we need to close PO once Goods Receipt is created
for that particular PO?.
Thanks,
Gowrinath.
‎2013 Nov 14 4:07 AM
Hi,
I would like to clarify your question.
For example you are created the PO with a Material and Quantity 10. May be the goods can be delivered multiple times against the same quantity. I mean you can create the multiple GR's with the same PO against the quantity 10.
PO(1) - xxxx( material) ----10 qty
GR - against PO(1) - 5 qty received - material document 1
GR -against PO(2) -5 qty received - material document 2.
Once the PO quantity is delivered the PO will be updated with the check delivery quantity is completed.
you can check this information in PO under the tab of purchase order history.
Thanks,
Kiran
‎2013 Nov 06 6:34 PM
Hi gowrinath
I am not sure in the AFS Function module, but in the General FM BAPI_GOODSMVT_CREATE
There will be a Field called "NO_MORE_GR" (Delivery COmpleted Indicator) in the Tables
Parameter "GOODSMVT_ITEM" . If you set that it will not allow you to create Multiple GR.
‎2013 Nov 06 6:59 PM
Hi Ramachandran,
Thanks for your quick reply. I can see the same field for this BAPI. So when I set field tNO_MORE_GR to 'X' no more Goods Receipt will be created for the PO for the second time right?
‎2013 Nov 06 7:13 PM
‎2013 Nov 06 7:17 PM
Thanks, When a Good receipt is performed is there any number that is generated like receipt number..I want to display the number in the idoc status message record. If it it is generated please let me know the field name.
‎2013 Nov 06 7:36 PM
A Material Document Number will be generated for the Goods Receipt .
If you goto SE37 and see the "Export" Parameters ,You will see MaterialDocument and Matdocumentyear, the Document number and Year respectively.
Its in TABLE mkpf (the Header Table)
‎2013 Nov 06 8:27 PM
Hi Ramachandran,
Still GR is getting created for the same PO.
Thanks,
Gowrinath.
‎2013 Nov 06 8:36 PM
Are you able to view the Material Document Number in MB03? i.e is the Document actually posting ? ??
If not , you would need to use "BAPI_TRANSACTION_COMMIT" .
‎2013 Nov 14 3:38 AM
Hi Ramachandran,
I can see the material document created in MB03. I was told by the functional people like until all the existing quantity becomes zero goods receipt will get created. Is that correct? If it is correct please let me know the fields where I have to check.
Thanks,
Gowrinath.
‎2013 Nov 14 4:07 AM
Hi,
I would like to clarify your question.
For example you are created the PO with a Material and Quantity 10. May be the goods can be delivered multiple times against the same quantity. I mean you can create the multiple GR's with the same PO against the quantity 10.
PO(1) - xxxx( material) ----10 qty
GR - against PO(1) - 5 qty received - material document 1
GR -against PO(2) -5 qty received - material document 2.
Once the PO quantity is delivered the PO will be updated with the check delivery quantity is completed.
you can check this information in PO under the tab of purchase order history.
Thanks,
Kiran
‎2013 Nov 26 8:48 AM
Hi Kiran,
I am performing goods receipt through BADI /AFS/BAPI_GOODSMVT_CREATE . Now GR for all quantities has been done. But still idoc is getting posted without throwing an error. I am unable to post manually through MB01. Is there any field that needs to be set in BADI. Please let me know.
‎2013 Nov 27 6:57 AM
Hi,
Its a good question!
I have also tried and the BAPI is not restricting the quantity.
I have checked, you can use this below logic before passing the quantity to the BAPI.
* check the booked quantity first ( it means already GR done for the PO)
select sum( bstmg ) from mseg
into gv_menge
where ebeln eq ekpo-ebeln
and ebelp eq ekpo-ebelp
and ( bwart eq '101'
or bwart eq '911'
or bwart eq '903' ).
*check the reversal GR's against PO ( it means any reversal movements are happened for the PO and item)
select sum( bstmg ) from mseg
into gv_menge1
where ebeln eq ekpo-ebeln
and ebelp eq ekpo-ebelp
and ( bwart eq '102'
or bwart eq '912'
or bwart eq '904' ).
*select the total quantity of the PO and item
select single menge from ekpo
into gv_menge2
where ebeln eq ekpo-ebeln
and ebelp eq ekpo-ebelp.
* account amount
gv_menge3 = gv_menge - gv_menge1.
gv_menge4 = gv_menge2 - gv_menge3.
if BAPI-menge > gv_menge4. ( CHECK THE PASSING QUANITY WITH THE MENGE4)
* amount bigger order amount
call function 'BALW_BAPIRETURN_GET2'
exporting
type = 'E'
cl = ' message class'
number = message number
importing
return = et_return.
append et_return.
endif.
Thanks,
Kiran