cancel
Showing results for 
Search instead for 
Did you mean: 

API Sales Order /A_SalesOrder('XXX')/to_Item

lmonteroquero
Explorer
0 Kudos

Hi experts, 

Previously, we have an sales order and we would like to insert new line items to this sales order, so we use API

https://myXXXXXX.s4hana.ondemand.com:443/sap/opu/odata/sap/API_SALES_ORDER_SRV/A_SalesOrder('103')/to_Item

The problem we have is we are not able to create more than one line position by API call.. May someone assure this point ? or maybe I am doing something wrong ?   Thanks for helping.

Attached body example I´m trying to : 

{

"Material": "P121000",

"RequestedQuantity": "1",

"RequestedQuantityUnit": "PC",

"SalesOrder": "103",

"to_PricingElement": {

"results": [{

"ConditionType": "PMP0",

"ConditionRateValue": "150.00",

"ConditionCurrency": "EUR"

}

]

}

},

{

"Material": "P122000",

"RequestedQuantity": "1",

"RequestedQuantityUnit": "PI",

"SalesOrder": "103",

"to_PricingElement": {

"results": [{

"ConditionType": "PMP0",

"ConditionRateValue": "300.00",

"ConditionCurrency": "EUR"

}

]

}

}

Accepted Solutions (1)

Accepted Solutions (1)

cdias
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Luis,

If you want to add multiple items to the already existing SO in one single call you need to consider the usage of the $batch operation.

Information can be found here: https://help.sap.com/viewer/635f557c455d42eaae20f169d9c43d9b/1902.500/en-US/00d244581efca007e1000000...

Best regards,

/cd

lmonteroquero
Explorer
0 Kudos

Hi. thanks for info.. I´m try to learn how to do it, but I don´t know what I´m doing wrong.. Could you help me ? Thanks

Trying to do Post..

https://myXXXX.s4hana.ondemand.com:443/sap/opu/odata/sap/API_SALES_ORDER_SRV/$batch

Headers

authorization basic authorization.. user and password

content-type multipart/mixed; boundary=batch_mybatch

xcsrf-token token given

body

--batch_mybatch

Content-Type: multipart/mixed; boundary=changeset_mychangeset1

--changeset_mychangeset1

Content-Type: application/http

Content-Transfer-Encoding: binary

POST A_SalesOrder HTTP/1.1

Content-Type: application/json

{

"SalesOrderType": "OR",

"SalesOrganization": "2410",

"DistributionChannel": "10",

"OrganizationDivision": "01",

"SoldToParty": "CUSTOMER-1",

"TransactionCurrency": "EUR",

"SDDocumentReason": "Z01",

"to_Item": {

"results": [

{

"Material": "P121000",

"RequestedQuantity": "1",

"RequestedQuantityUnit": "PI",

"to_PricingElement": {

"results": [{

"ConditionType": "PMP0",

"ConditionRateValue": "150.00",

"ConditionCurrency": "EUR"

}

]

}

},

{

"Material": "P122000",

"RequestedQuantity": "1",

"RequestedQuantityUnit": "PI",

"to_PricingElement": {

"results": [{

"ConditionType": "PMP0",

"ConditionRateValue": "180.00",

"ConditionCurrency": "EUR"

}

]

}

}

]

}

}

--changeset_mychangeset1

--batch_mybatch--

when sending, get this message error

"The Data Services Request could not be understood due to malformed syntax"

Answers (0)