Unable to create Sales Order from UI5 app to API

Hi experts,

I am currently developing an app that should be able to create a Sales Order to the API_SALES_ORDER_SRV api through S/4H public cloud.

Create is working fine in postman with exact same payload, but from the app I keep getting response with the general error:

“Resource not found for segment ‘A_SalesOrderType”

Here is my code in ui5 (model is reachable and defined in manifest).

let oModel = this.getView().getModel(“salesorder”),
oEntry = {
SoldToParty: “1000000”,
RequestedDeliveryDate: “/Date(1738772151903)/”,
SalesDistrict: “”,
DistributionChannel: “10”,
OrganizationDivision: “00”,
SalesOrderType: “OR”,
SalesOrganization: “2500”,
OrganizationDivision: “00”,
PurchaseOrderByCustomer: “Created via OData Service”,
CustomerPaymentTerms: “”,
},
oContext = oModel.createEntry(“/A_SalesOrder”, { properties: oEntry });

oModel.setUseBatch(true);
oModel.submitChanges({
success: function (oData) {
console.log(oData);
},
error: function (oErr) {
console.log(oData);
}

});

 

Here is what the payload looks like:

–batch_abed-b87f-ecac
Content-Type: multipart/mixed; boundary=changeset_757e-c0e2-e142

–changeset_757e-c0e2-e142
Content-Type: application/http
Content-Transfer-Encoding: binary

POST A_SalesOrder HTTP/1.1
Content-Type: application/json
Content-ID: id-1739205903727-35
sap-contextid-accept: header
Accept: application/json
Accept-Language: nl
DataServiceVersion: 2.0
MaxDataServiceVersion: 2.0
X-Requested-With: XMLHttpRequest
x-csrf-token: VPWDWrsh1uH1G1iyMdq9vw==
Content-Length: 339

{“SoldToParty”:”1000000″,”RequestedDeliveryDate”:”/Date(1738772151903)/”,”SalesDistrict”:””,”DistributionChannel”:”10″,”OrganizationDivision”:”00″,”SalesOrderType”:”OR”,”SalesOrganization”:”2500″,”PurchaseOrderByCustomer”:”Created via OData Service”,”CustomerPaymentTerms”:””,”__metadata”:{“type”:”API_SALES_ORDER_SRV.A_SalesOrderType”}}
–changeset_757e-c0e2-e142–

–batch_abed-b87f-ecac–

 

Any suggestions on how to move forward? A create to for example business partner API does work fine.

Scroll to Top