cancel
Showing results for 
Search instead for 
Did you mean: 

How to return a large number of messages in an OData service?

0 Kudos
1,981

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.

View Entire Topic
RalfHandl
Product and Topic Expert
Product and Topic Expert

Hi Michael,

Your conclusions are correct, the only workaround currently is

C2) You model a separate entity type for messages, a to-n navigation property from your root type to the message type, and then you deep-insert with a dummy message. That way you can return messages because the message structure is part of the request and thus the response.

We are working on a revamped message transport mechanism for services using OData V4, but please apply the usual disclaimers here: I never said, suggested, or implied that anyone at SAP ever even considered releasing this at any time in any form of product 🙂

Hope this helps

Ralf

0 Kudos

Hi Ralph,

Thank you for your answer and help. I'm glad to be confirmed that I am not all wrong. I will discuss your suggestion for a workaround with my colleagues.

Regarding OData V4, I heard nothing and I know nothing 😉

Thanks

Michael