on 2021 Oct 07 12:32 PM
I am trying to create Sales orders via OData API calls, by following the postman collections from this GitHub repo - https://github.com/SAP-samples/byd-api-samples/tree/main/Postman
In the request body, I noticed that there is an ItemScheduleLine array inside the Item array, but I am unable to add multiple ItemScheduleLine objects.
Request URL: https://{{TenantHostname}}/sap/byd/odata/cust/v1/khsalesorder/SalesOrderCollection
Method: POST
{
"Name": "Sales order test",
"DataOriginTypeCode": "1",
"DeliveryPriorityCode": "1",
"SalesUnitParty": {
"PartyID": "{{PartyID}}"
},
"Item": [
{
"ID": "10",
"ProcessingTypeCode": "TAN",
"FulfilmentPartyCategoryCode": "2",
"ItemProduct": {
"ProductID": "{{Material_ID}}"
},
"ItemScheduleLine": [
{
"Quantity": "2",
"unitCode": "EA"
},
{
"Quantity": "1",
"unitCode": "HUR"
}
]
}
]
}
Question:
Is the above request body valid? Can we have multiple schedule lines for a single item object? (As it is an array as per the request body)
Request clarification before answering.
Hi Srilekha,
Kindly try this below payload :
{
"Name": "Sales order test",
"DataOriginTypeCode": "1",
"DeliveryPriorityCode": "1",
"SalesUnitParty": [{ "PartyID": "PartyID" }],
"Item":
[{
"ID": "10",
"ProcessingTypeCode": "TAN",
"FulfilmentPartyCategoryCode": "2",
"ItemProduct":
[{
"ProductID": "Material_ID",
"ItemScheduleLine":
[{
"Quantity": "2",
"unitCode": "EA"
},
{ "Quantity": "1",
"unitCode": "HUR"
}]
}]
}]
}
Also, You can see a sample payload in the below blog :
Regards,
Palani.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi palu, Thanks for the reply.
I tried with the above request sample and got some errors. Providing "SalesUnitParty", "ItemProduct" as arrays instead of objects is resulting in a "Navigation property content for 'SalesUnitParty' has wrong cardinality" error.
Also, when I give "ItemScheduleLine" inside "ItemProduct" array, it is not recognising the "ItemScheduleLine" and throws "Property 'ItemScheduleLine' not found".
Please advise.
Hi palu, any advice on why OData API is not allowing me to use the arrays(as per your payload) and throwing an error for the wrong cardinality?
Also, how do we know the different ways(request payloads) for creating a sales order? Is there any doc referring to the same? Please help!
Thank you!
User | Count |
---|---|
93 | |
39 | |
8 | |
5 | |
3 | |
3 | |
3 | |
2 | |
2 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.