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

/AFS/BAPI_GOODSMVT_CREATE BAPI-Goods Receipt

gowrinath_gundu
Participant
0 Likes
3,235

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,639

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

11 REPLIES 11
Read only

Former Member
0 Likes
2,639

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.

Read only

0 Likes
2,639

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?

Read only

0 Likes
2,639

Yes Gowrnath  that's right, Let me know if this works

Read only

0 Likes
2,639

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. 

Read only

0 Likes
2,639

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)

Read only

0 Likes
2,639

Hi Ramachandran,

Still GR is getting created for the same PO.

Thanks,

Gowrinath.

Read only

0 Likes
2,639

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" .

Read only

0 Likes
2,639

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.

Read only

Former Member
0 Likes
2,640

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

Read only

0 Likes
2,639

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.

Read only

0 Likes
2,639

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