cancel
Showing results for 
Search instead for 
Did you mean: 

405 Error in POST call : SAP CPI Odata V2

akashcpi07
Member
0 Kudos

Hello Folks,

I have a scenario in CPI in which i need to read data from an excel file and POST a batch operation on S/4 Hana system.

For POST to S4 system i am using Purchase Contract API (Standard API from API business HUB)

Link : https://api.sap.com/api/API_PURCHASECONTRACT_PROCESS_SRV_0002/resource

Issue : While trying to do POST i am getting 405 method not allowed error. I amusing contetct type as multipart/mixed; boundary=batch

And payload is in below format :

--batch

Content-Type: multipart/mixed;boundary=changeset

--changeset

Content-Type: application/http

Content-Transfer-Encoding: binary

POST A_PurchaseContract HTTP/1.1

Content-Type: application/json

Accept: application/json

sap-context-accept: header

{ -sample body-}

--changeset--

--batch--

i checked that POST batch operations are allowed on the API. Can you please suggest what am i missing?

Martin-Pankraz
Active Contributor
0 Kudos

Are you using the OData Adapter in CPI? You shouldn't require to deal with payload scaffolding.

Make sure to check the right API. You linked S4 Hana Cloud not on-prem. In your case both flavors support the batch operation though, but there can be differences going forward.

Other than that I would recommend to test the integration with a REST client like Postman before implementing manual http handling in CPI.

KR

Martin

Accepted Solutions (0)

Answers (0)