2024 May 01 8:58 AM - edited 2024 Aug 02 9:31 AM
Hello Guys,
I am working on a RAP Service type: "Unmanaged Implementation"
And I would like to modify the ENTITIES values in the respond. Below my POSTMAN request, when I execute it (POST), I want to fill the parameter: "RESERVATION" in the RESPOND.
Here my Service Exposition and Method:
Here my Business Definition:
Here my CDS:
Here my Behavior Class:
I added the code:
And when I execute the request, i have an issue:
It's normal because ENTITIES is defined as IMPORTING parameter.
How can I do specify ENTITIES as CHANGING ?
Any idea?
Best regards,
Rachid
2024 Aug 02 3:47 AM
Hi Rachid! hope you are doing fine. I'm facing a similar issue, were you able to find a solution to change the response? Thanks!
2024 Aug 02 9:05 AM - edited 2024 Aug 02 9:09 AM
Hi Nicmon,
Hope you are doing well too.
In fact, it is not possible to execute 2 actions simultaneously in a web service. This is part of the general architecture of web services.
You cannot update data (POST) and retrieve data (GET) in a single action.
It's like in a car, you can't shift into one gear with a manual transmission and expect to move forward (GET) and reverse (POST) at the same time.
You need to perform 2 actions separately: POST and after the GET method.
Best regards,
Rachid
2024 Aug 02 1:27 PM
Hi! Thanks for the answer!
But for example how does the API_SALESORDER_SIMULATE works?
It seems to be a RAP service you can call as a POST with some basic sales order data and then in the response you can have extended details like Items, Partners, etc (even if they are not in the BODY of the Request).
We are trying to do something similar but can’t find a way to edit that response.
Thanks!
2024 Aug 02 10:09 PM - edited 2024 Aug 02 10:10 PM
Hi,
I just told you that it is not possible to update the response in the JSON when updating data in SAP.
SAP does not allow modifying the return data during a POST request.
So, if you choose to update the data via the POST method, you will need to send afterwards a GET request to retrieve the extended details such as items, partners, etc...
Regards,
Rachid