cancel
Showing results for 
Search instead for 
Did you mean: 

Create Supplier Invoice via API_SUPPLIERINVOICE_PROCESS_SRV reference to PO with multi assignment

jnestares
Participant
0 Kudos
656

error-m8416.png

body-supplier-invoice-with-reference-to-po-without.txtHi,

we are trying to create a supplier invoice with reference to a Purchase Order with multi account assignment via API. The Purchase Order has no GR based Invoice verification check. The error we are getting from Postman (when calling the API) is M8/416 (please see the attached documents, one with the error snapshot, another with the Body of the message to call the API to create the supplier invoice)

Would really appreciate your help, because we have only seen this error when the Purchase Order has check GR based Inv verification unflagged.

KR,

Jose

Accepted Solutions (1)

Accepted Solutions (1)

rodleo92
Participant
0 Kudos

SOLUTION PROVIDED:

Hello,

I am a colleague of Jose Antonio Nestares and we have found a solution to the error.

First of all, SAP found a bug in the API due to the error that occurred when sending all the cost allocation information in the section "to_SupplierInvoiceItmAcctAssgmt". This fix will be available from Release 2208.

Alternatively, to be able to create an invoice from a purchase order that has a cost allocation in the items and also has Goods Receipt, simply not reporting the fields referring to the cost objects will post. I.e. the following fields in the section "to_SupplierInvoiceItmAcctAssgmt" would have to be sent empty:

<CostCenter/>

<ControllingArea/>

<ProfitCenter/>

<FunctionalArea/>

<GLAccount/>

<WBSElement/>

This works both for orders with a single account assignment (a single Cost Centre or WBS Element) and for orders with multiple account assignment (various assignment to Cost Centre or WBS Element).

If the purchase order does not have Goods Receipt, you would have to send the information in these fields. In these cases, the API does not give error.

I hope this helps.

Regards.

lokesh2
Advisor
Advisor
0 Kudos

We helped you to accept the answer, since there were no updates after 7 days.

You can unaccept it anytime if the answer provided was not helpful enough and you have further questions.

Answers (4)

Answers (4)

jnestares
Participant
0 Kudos
jnestares
Participant
0 Kudos

Good evening,

we have tried to remake the payload in accordance to your comments, and we get the same error. Please find attached the new payload.

Looking forward to your reply,

Jose

Jerry_Lowery
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Jose,

I would recommend to create a ticket to see if you can get some more insight from development on the error. Could be something missing like reference doc or another field.

You can also make use of the "schedule an expert" feature that is now available in the support portal.

Would appreciate if you can reply back here with the ultimate solution.

Thank you

Jerry

Jerry_Lowery
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Jose,

I am unfortunately not an expert on this API - but looking at your payload, I think you have a structure problem.

You have two Supplier Invoice Items (1 and 2), but you do all the invoice item account assignments for 1 and 2 only under the node for invoice item 2.

Supplier Invoice 2 has a quantity of 2, however you nest the to_SupplierInvoiceItmAcctAssgmt node for both supplier invoice items under the node for supplier invoice item 2. In that node, there are account assignments for a total of 4 quantity. (even though you do specify the supplier invoice items 1 and 2).

Given the error is about the quantity/units not allowed, this may be the issue.

I would recommend to move the to_SupplierInvoiceItmAcctAssgmt node to the same level as the to_SuplrInvcItemPurOrdRef node, or create the acctassgmt for 1 under the ref for 1 and the acctassgmt for 2 under 2. I hope this makes sense.

    "to_SuplrInvcItemPurOrdRef": {
"results": [
{
"SupplierInvoiceItem": "1",
"PurchaseOrder": "4500001646",
"PurchaseOrderItem": "10",
"Plant": "",
"ReferenceDocument": "",
"ReferenceDocumentFiscalYear": "",
"ReferenceDocumentItem": "",
"TaxCode": "3L",
"DocumentCurrency": "EUR",
"SupplierInvoiceItemAmount": "20",
"PurchaseOrderQuantityUnit": "PC",
"QuantityInPurchaseOrderUnit": "2",
"PurchaseOrderPriceUnit":"PC",
"QtyInPurchaseOrderPriceUnit": "2",
"SupplierInvoiceItemText": "",
"ServiceEntrySheet": "",
"ServiceEntrySheetItem": ""
},
{
"SupplierInvoiceItem": "2",
"PurchaseOrder": "4500001646",
"PurchaseOrderItem": "20",
"Plant": "",
"ReferenceDocument": "",
"ReferenceDocumentFiscalYear": "",
"ReferenceDocumentItem": "",
"TaxCode": "3L",
"DocumentCurrency": "EUR",
"SupplierInvoiceItemAmount": "20",
"PurchaseOrderQuantityUnit": "PC",
"QuantityInPurchaseOrderUnit": "2",
"PurchaseOrderPriceUnit":"PC",
"QtyInPurchaseOrderPriceUnit": "2",
"SupplierInvoiceItemText": "",
"ServiceEntrySheet": "",
"ServiceEntrySheetItem": "",
"to_SupplierInvoiceItmAcctAssgmt": {
"results": [
{
"SupplierInvoiceItem": "1",
"OrdinalNumber": "1",
"CostCenter": "ES41117102",
"ControllingArea": "A000",
...
Please let us know if this solves your issue. If not, and no one else comments, I would recommend to create a ticket.Thank youJerry
Jerry_Lowery
Product and Topic Expert
Product and Topic Expert
0 Kudos

Indeed, if you check the help for the api, the structure diagram suggests to do the account assignment within the node for the item:

https://help.sap.com/viewer/bb9f1469daf04bd894ab2167f8132a1a/LATEST/en-US/7bc52558ef790a02e10000000a...

Jerry_Lowery
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Jose,

Could you let us know what you have already double checked?

For example, have you confirmed the unit of measure matches the pricing unit of measure?

Similar Community posts:

https://answers.sap.com/questions/10438909/bapiincominginvoicecreate-for-hes-error-units-of-m.html

https://answers.sap.com/questions/7519795/bapiincominginvoicecreate.html

thank you

Jerry

jnestares
Participant
0 Kudos

Hi Jerry,

thanks for your response.

In reply to your question, it is a yes. We have checked unit of measure matches the pricing unit of measure.

We are trying it from a S4Hana Cloud system.

KR,

Jose