cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP ABAP Restful Application Programming - Only Key properties of entities are being set

0 Kudos
1,202

Hello,

I am trying to create an odata service by ABAP Restful application programming model, Unmananged Scenario. The service would perform operations such as Sales Order Create and Update.

I have implemented the method create and made a bapi call to create the sales order. Once the sales order is successfully created I am filling the 'Mapped' exporting parameter inside the create method.

The problem is the 'Mapped' structure only contains the key filled due to which in the response of odata service only the key properties are filled. Is there any way in which non key properties are also filled ?

For Example:-

Request Structure

<d:documentNumber></d:documentNumber>

<d:customerNumber>3000000</d:customerNumber>

<d:orderType>Z005</d:orderType>

<d:cutomerReference>Test</d:customerReference>

<d:creationDate></d:creationDate>

<d:totalCost></d:totalCost>

<d:currencyCode></d:currencyCode>

Response Structure

<d:documentNumber>123456</d:documentNumber>

<d:customerNumber>3000000</d:customerNumber>

<d:orderType>Z005</d:orderType>

<d:cutomerReference>Test</d:customerReference>

<d:creationDate></d:creationDate>

<d:totalCost></d:totalCost>

<d:currencyCode></d:currencyCode>

In the above response it is getting the Document Number from the mapped structure but I also want to show the properties Creation Date, Total Cost and Currency Code without a second get odata request.

Accepted Solutions (1)

Accepted Solutions (1)

Andre_Fischer
Product and Topic Expert
Product and Topic Expert

You have to implement the SAVE sequence and the framework will automatically read the newly created data and put it into the response.

Create Operation - SAP Help Portal

You can also check out week 4 of the openSAP course.

Welcome to Week 4 | Building Apps with the ABAP RESTful Application (sap.com)

Best regards,
Andre

0 Kudos

Hello Andre,

I tried implementing the save sequence and now the data is being fetched from the database it works.

But the user wants to simulate the order and verify the results before actually committing it on the database level, is there any way this can be achieved in the create method?

Thanks & Best Regards,

Shivam

Answers (2)

Answers (2)

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Kudos

You can build a simulation by implementing it in the CREATE method.
When the simulation fails you can fill the failed and reported structures.

0 Kudos

Yes, true but for us the challenge is to pass the simulated values back to the front end.

By verify I mean the user wants the values to be displayed in the front end

For example, to view the net value at the order level and item level, material description and edit or delete the line item before actually committing it to the database.

So we were thinking of 2 buttons on the UI the first button would be like to simulate the order which would actually display the simulated values and allow the user to make further changes and the second button would create the order.

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Kudos

What's the release you're using?

0 Kudos

S4HANA ON PREMISE 1909 FP01
ABAP PLATFORM 1909 01