Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

OData V4: Forced expand for navigation property

andreas_furtjes
Discoverer
0 Kudos
1,821
  • SAP Managed Tags:

Dear All,

I have recently started using OData V4 to provide REST services for SAP-external systems.

The service should provide the call to a validation function with a given set of input parameters and should return the input structure plus a 'VALIDE' parameter and a table with potential messages.

I have chosen use to the ‚action import‘ mechanism and created a navigation property to the message structure in the model definition.

The expected result should look like this, a table with ‚Meldungen‘ should be reported:

Unfortunately, the message table representing the navigation property is not created:

How do I enforce the expanded view of the result? Unfortunately, an explicit ‚expand‘ in the URI is not permitted for POST methods.

Any help is highly appreciated!

4 REPLIES 4

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Kudos
1,171
  • SAP Managed Tags:

How have you built your OData V4 services ? Have you used a V4 Service Binding and the ABAP RESTful Application Programming Model ?

Or are you using a code based implementation using the SAP Gateway OData V4 framework API's?

What is the release you are working on ?

NW 7.5<x> SP <YY> , SAP S/4HANA 20<xx> FSP<Y>

ceterum censeo RAP esse utendam

andreas_furtjes
Discoverer
0 Kudos
1,171
  • SAP Managed Tags:

I am using the code based implementention.

Basis-Release is 7.50 SP 13.

Thank you for your support!

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Kudos
1,171
  • SAP Managed Tags:

This feature is available as of SAP NetWeaver AS ABAP 7.55 SP00.

According to the following note it is also available in SAP NetWeaver AS ABAP 7.52 SP09, but has unfortunately not been downported to 750.

2512479 - SAP Gateway Foundation Support Package Stack Definition - SAP ONE Support Launchpad

You can test this in a system with the appropriate release by using a POST request on the following URL

/sap/opu/odata4/iwbep/tea/default/iwbep/tea_busi/0001/ChangeTeamBudgetByID?$expand=TEAM_2_EMPLOYEES

and using the following payload:

{
"TeamID" : "TEAM_01",
"Budget" : 700.00
}
ceterum censeo RAP esse utendam

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Kudos
1,171
  • SAP Managed Tags:

Since the feature is not available in your release you could try to use a $batch request where the POST request to your action import and a subsequent read request to the entity are combined in one POST request.

ceterum censeo RAP esse utendam