cancel
Showing results for 
Search instead for 
Did you mean: 

Post invoice for return delivery in Goods-Receipt-Based Invoice Verification

ec1
Active Participant
0 Kudos

Hi all,

I received the following error trying to post an invoice for return delivery using BAPI_INCOMINGINVOICE_CREATE1 and Goods-Receipt based Invoice Verification is activated.

M8 376 Enter goods receipt data only when working with GR-based IV

M8 375 Fill in mandatory field REF_DOC, REF_DOC_YEAR, REF_DOC_IT (table parameter ITEMDATA, row 000001)

I know to fix the error is to populate

ITEMDATA-REF_DOC,

ITEMDATA-REF_DOC_YEAR,

ITEMDATA-REF_DOC_IT

with material document that was used to post goods receipt


My question is following:

1. I'm not sure which material document to choose. I have two GR entries available, one is with movement type 101 and the other one is with movement type 122.

2. If there were multiple Goods Receipts, how do I submit them to the bapi ?

Do I need to submit two records in ITEMDATA parameter for the same PO line with different Goods-Receipt reference?

3. If there were multiple Goods Receipts, how do I know if an vendor credit invoice has been created for the Goods Receipt document in the past?


I have attached how the PO looks like in this posting.


Anyhelp would be appreciated.

Accepted Solutions (1)

Accepted Solutions (1)

former_member183424
Active Contributor
0 Kudos

As per your PO history , why an invoice should be posted ? You have posted goods receipt first , then invoice for this receipt , then you have posted a return delivery (system allowed that because of your configuration). Now you may need cancel the invoice as per standard business process.

May I know why you wanna post another invoice ?

ec1
Active Participant
0 Kudos

Hi Dibyendu,

Sorry if I haven't used the correct term because I'm not familiar with FI area.

I'm trying to post credit vendor invoice for return scenario. Maybe I should say I'm trying to post credit memo

Here is reference to what I want to do.

Return Delivery in Goods-Receipt-Based Invoice Ver - Inventory Management and Physical Inventory (MM...

This is my code:

...

CLEAR: headerdata-INVOICE_IND.                " Post Credit Memo

headerdata-doc_type = 'RE'.                  " doc type

headerdata-REF_DOC_NO = it13_vbrp-vbeln.     " reference (inv num)

...

  CALL FUNCTION 'BAPI_INCOMINGINVOICE_CREATE1'

    EXPORTING

      HEADERDATA          = headerdata

*     ADDRESSDATA         =

*     INVOICESTATUS       = '5'

    IMPORTING

      INVOICEDOCNUMBER    = lv_invoicedocnumber

      FISCALYEAR          = lv_fiscalyear

    TABLES

      ITEMDATA            = t_itemdata

      ACCOUNTINGDATA      = t_accountingdata

      GLACCOUNTDATA       = t_glaccountdata

      MATERIALDATA        = t_materialdata

      TAXDATA             = t_taxdata

      WITHTAXDATA         = t_withtaxdata

      VENDORITEMSPLITDATA = t_vendoritemsplitdata

      RETURN              = t_return

      EXTENSIONIN         = t_extensionin

      EXTENSIONOUT        = t_extensionout

      TM_ITEMDATA         = t_tm_itemdata.

jagdeepsingh83
Active Contributor
0 Kudos

What you are passing in Invoice indicator ?

  • INVOICE_IND- If you are posting a credit memo it should have value as 2.

1. I'm not sure which material document to choose. I have two GR entries available, one is with movement type 101 and the other one is with movement type 122.

I think only use 122 when Invoice is not posted. You post credit memo for movement type 161 which with reference to return po created separately.

If you still want to post credit memo Invoice_Ind = 2.

But what you will do the material document that have 102 in it ?-- that is cancellation of 101 document ?

101- You can post invoice with Invoice_ind=1

2. If there were multiple Goods Receipts, how do I submit them to the bapi ?

Do I need to submit two records in ITEMDATA parameter for the same PO line with different Goods-Receipt reference?


Do you have GR-IR Indicator checked in the PO - then I would recommend one document at a time..

Do you try to post multiple even you do not have GR-IR indicator checked. This will make easy to trouble shoot and document mapping.


3. If there were multiple Goods Receipts, how do I know if an vendor credit invoice has been created for the Goods Receipt document in the past?


You can check PO history table EKBE. It have various You have to pass indicator as 2- Invoice receipt. When you validate indicator -SHKZG= H .. means that number is credit memo .. in RSEG table of invoice number you find material document number -LFBNR and LFGJA as well as LFPOS

ec1
Active Participant
0 Kudos

1. I will try to post credit memo with reference to movement type 122

1.1. I think you mean INV_TRAN

For creating credit memo, INVOICE_IND should be blank.

headerdata-INV_TRAN = '2'.                   " Transaction: Credit Memo


2. GR-Bsd IV is set. Ok, I will speak to the business if they want multiple Goods Receipts to be separated or not.


3. I think this is what I'm looking for.


Thanks for making the effort to answer all my questions and we need more people like you on scn. I appreciate it.


Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Steve,

As per my understanding with your purchase order's scenario, a goods receipt(movement type 101) and invoice was posted first before the return delivery(movement type 122). Since you are suppose to create a Credit Memo(CM) with respect to your return delivery , kindly check your parameter if you are referring to the correct document type in your Invoice.

Regards,

Harvey

ec1
Active Participant
0 Kudos

Hi Harvey,

What document type should I use ?

This is part of upgrade from 4.7 to ECC6 and I'm trying to replace bdc for transaction MRHG with BAPI_INCOMINGINVOICE_CREATE1.

The BDC is populated with document type 'RE'.

This is the current code.

...

CLEAR: headerdata-INVOICE_IND.                " Post Credit Memo

headerdata-doc_type = 'RE'.                  " doc type

headerdata-REF_DOC_NO = it13_vbrp-vbeln.     " reference (inv num)

...

  CALL FUNCTION 'BAPI_INCOMINGINVOICE_CREATE1'

    EXPORTING

      HEADERDATA          = headerdata

*     ADDRESSDATA         =

*     INVOICESTATUS       = '5'

    IMPORTING

      INVOICEDOCNUMBER    = lv_invoicedocnumber

      FISCALYEAR          = lv_fiscalyear

    TABLES

      ITEMDATA            = t_itemdata

      ACCOUNTINGDATA      = t_accountingdata

      GLACCOUNTDATA       = t_glaccountdata

      MATERIALDATA        = t_materialdata

      TAXDATA             = t_taxdata

      WITHTAXDATA         = t_withtaxdata

      VENDORITEMSPLITDATA = t_vendoritemsplitdata

      RETURN              = t_return

      EXTENSIONIN         = t_extensionin

      EXTENSIONOUT        = t_extensionout

      TM_ITEMDATA         = t_tm_itemdata.

The old BDC code:

* Screen 1. Enter invoice: initial screen

  ecs_bdc_begin 'SAPMM08R' '0100'.

...

  ecs_bdc_field 'BKPF-BLART'                " doc type

                'RE'.

CALL TRANSACTION 'MRHG'...

Former Member
0 Kudos

I think that what you want to do is to cancel de invoice that was already posted.

If that is the case, then check BAPI BAPI_BILLINGDOC_CANCEL1

regards. Mauro

former_member183424
Active Contributor
0 Kudos

This bapi can't be used to cancel a vendor invoice. It is used for customer invoice in SD billing.