on 2018 Feb 15 9:00 AM
We are using an OData service to call BAPI_SALESORDER_SIMULATE. For very large orders (1000+ lines) many messages can be returned in the parameter table MESSAGETABLE. We would like to return these messages to the consumer/caller of the service but how can we do that for so many messages?
Since there is no UPDATE_DEEP_ENTITY (PUT) we are using CREATE_DEEP_ENTITY (POST).
We have looked into the following options:
A) We return the messages in the http-header parameter sap-messages. This doesn't work as apparently there is a limit to what this parameter can contain.
B) Someone suggested using a Complex Type - but apparently there is a 1:1 relationship between this and the entity which in this case is SalesOrder. Which means we cannot return more than one message.
C) Then we wanted to create a seperate entity for messages and return this in the response body. But it looks like it is not possible to return any entities that wasn't in the request to begin with.
Am I wrong about the conclusions of A, B and C - maybe I have missed or misunderstood something?
If I am correct that the problem cannot be solved using neither A, B nor C, how can this problem then be solved?
Our solution/workaround for now is that when more than 100 messages are returned from the BAPI we simply return a single message to the requestor saying "too many messages. cannot be displayed" (or something like that).
Thanks in advance.
Request clarification before answering.
The approach C should be modified a bit as under.
1. Model as below. Here have a three level navigation. Dummy Entity to Sales Order to Message Table. The underlined properties denote key fields in below JSON model.
{
"DummyKey": "XXXXXX",
"SalesOrders": [{
"DummyKey": "XXXXXX",
"SalesOrderID": "1",
"Attribute1": "<value 1>",
"Messages": [{
"DummyKey": "XXXXXX",
"SalesOrderID": "1",
"MessageId": "1",
"MessageType": "E",
"MessageText": "This is an error message for Sales Order 1"
},
{
"DummyKey": "XXXXXX",
"SalesOrderID": "1",
"MessageId": "2",
"MessageType": "E",
"MessageText": "This is an another error message for Sales Order 1"
}
]
}]
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bodhisattwa,
If you want to follow above approach then it assumes that the HTTP call will be successful and the Deep Create will return a 200 code. Then only the payload can be returned whose structure was mentioned in my previous answer.
Else, you can return a single message in HTTP header and set the status code suitably to some error like 500.
Thanks and Regards.
User | Count |
---|---|
53 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 | |
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.