03-14-2019 5:06 AM - edited 02-04-2024 12:32 AM
Hi, experts
Trying to do Post with batching functionality.. https://myXXXX.s4hana.ondemand.com:443/sap/opu/odata/sap/API_SALES_ORDER_SRV/$batch
I get this error when sending "The Data Services Request could not be understood due to malformed syntax".. What am I doing wrong ?
Headers
authorization basic authorization.. user and password
content-type multipart/mixed; boundary=batch_mybatch
xcsrf-token token given body
body payload
--batch_mybatch
Content-Type: multipart/mixed; boundary=changeset_mychangeset
--changeset_mychangeset
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--
Hi Luis
Can you please review SAP Note 1869434 https://launchpad.support.sap.com/#/notes/1869434 ? It provides details on the exact spacing required for your payload in terms of carriage returns and other items. It's not clear from your post if you actually have the carriage returns but it looks like you don't. $batch format is extremely picky with regards to syntax. Also, how are you passing this batch call? Using Postman?
Thanks,
Marty
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Luis,
To help you get this sorted I have attached an a example of a $batch request for the Purchase Order OData service. The payload structure is the same so you can use it for your sales orders operation. Like Marty said the format is very sensitive to spaces and carriage returns. So please make sure you have all in the right place.
Thanks.
hI.. finally I achieved it !!! thanks , guys.. I really appreciate 🙂
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Carriage return means press the enter key. For example, the end of your payload looks like this:
--changeset_mychangeset1
--batch_mybatch--
But if you look at the note you are missing the trailing dashes on changeset line and a return. Should be something like this:
---changeset_mychangeset1--
--batch_mybatch--
Thanks,
Marty
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Marty, and thanks for your help.. after reviewing your comments and SAP note, I think I´ve fixed "syntax" issues, but now I get this new message error" ( unknow internal server error ?? ).. any suggestion ?
https://myXXXXX.s4hana.ondemand.com:443/sap/opu/odata/sap/API_SALES_ORDER_SRV/$batch
I attached my file with sent payload if helps..
xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
0050569259751EE4BA9710043F8A5115
xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
Hi, sorry, I dont understand "carriage" matter.. and dont know how to check it if I have all of them.. I´m a desperate man 🙂
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.