cancel
Showing results for 
Search instead for 
Did you mean: 

Create SupplierInvoice with OData doesn’t work

0 Kudos

Hello,

I want to create a SupplierInvoice in S/4 HANA Cloud with OData and SAP CPI. Unfortunately, I get this error: “The requested service is not supported by entity CDS~A_SUPPLIERINVOICE”.

The reason I am so confused is, that I have no problem to create a BusinessPartner with the Scenario SAP_COM_0008.

S/4 Scenario to create a SupplierInvoice: SAP_COM_0057

URL: https://myXXXXXX-api.s4hana.ondemand.com/sap/opu/odata/sap/API_SUPPLIERINVOICE_PROCESS_SRV

Body:

{

"SupplierInvoice": "51050101",

"FiscalYear": "2018",

"CompanyCode": "1010",

"DocumentDate": "/Date(1528070400000)/",

"PostingDate": "/Date(1528070400000)/",

"InvoicingParty": "10300001",

"DocumentCurrency": "EUR",

"InvoiceGrossAmount": "2023.00",

"UnplannedDeliveryCost": "0.00"

}

Thank you for your help

Best regards

Lars

Accepted Solutions (1)

Accepted Solutions (1)

PollyGan
Advisor
Advisor

Hi,

Can you check https://api.sap.com/api/API_SUPPLIERINVOICE_PROCESS_SRV/resource?tag=A_SupplierInvoice&path=post_A_S...

url = "https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap/API_SUPPLIERINVOICE_PROCESS_SRV/A_SupplierInvoice";

Kind regards,

Polly

Hello Polly Gan and Amith Nair,

thank you very much for your support.

I have reach the goal and created a SupplierInvoice successfully.

Best regards

Lars

Answers (1)

Answers (1)

Amith_Nair
Advisor
Advisor
0 Kudos

Hi lars.plm ,

I thought to add a couple of points that may find helpful to you and I have couple of remarks after reviewing the structure of the body. A supplier Invoice cannot be created with just those attributes you provided above as there are couple of other mandatory fields you might need to consider while creating Supplier Invoice and those mandatory fields include Accounting Document type (Header Level) and at the line item level you will need GL Account, Debit Credit Memo etc.

I would also recommend, if you can just try to create Supplier Invoice in the S4 System directly, that way you will be able to realize, what steps are needed essentially to create a Supplier Invoice.

Now, please note that, while you try to create a supplier Invoice directly in S4HC system, you will notice that you may run into many functional issues for example, company code (say) 1710 is blocked for posting, GL Account are relevant for tax cannot be used(with this combination), the Invoicing party selected cannot be used for this combination etc. So, it is important to know what values you enter against each of the components, as the system perform a (functional)validation internally to determine whether an invoice posting can be made or not. The problem using a Postman, is that you may not be able to determine those errors necessarily at a detail level.

After which, you may review them by deep diving into the help document (https://help.sap.com/viewer/b2405fab3b314f4ab5021b57231d553f/1811.500/en-US/7bc52558ef790a02e10000000a44147b.html) provided in the API hub(https://api.sap.com/api/API_SUPPLIERINVOICE_PROCESS_SRV/overview)

One another aspect to be considered is that each field has max length limit, for e.g. Supplier Invoice cannot have max length more than 12 characters, likewise, each field has max length defined, so it is important you familiarize with all of them (and many more). This is clearly defined in API Specification, which you can download.

I am also attaching a sample payload for your reference, if that helps;)

Sorry for being descriptive, but its not as simple as how you create Business Partner.

Thank you! Amith Nair

0 Kudos

Hello Amith Nair,

thank you very much for your detailed answer. I try it out and write back later.

The reason of my big confusion was the strange s4h response (in my opinion).

Best regards

Lars