cancel
Showing results for 
Search instead for 
Did you mean: 

Get Entity Set whit input parameters?

oscar_rodriguez4
Discoverer
0 Kudos
1,112

I have the same problem that is presented here https://archive.sap.com/discussions/thread/3538309 and mention that the solution is to create a navigation to the same entity is the answer, could someone support me with the steps? Since I've tried, but without success ...

Accepted Solutions (0)

Answers (1)

Answers (1)

Ankit_Maskara
Product and Topic Expert
Product and Topic Expert
0 Kudos

Suppose your parent entity is SalesOrder and requirement is to get some other SalesOrders which are children to a single SalesOrder whose key you already have. You need to follow as below -

1. Create an entity SalesOrder.

2. Create a navigation -GetDependents from SalesOrder Entity to SalesOrder Entity referencing the keys and cardinality( should be 1 to N).

3. Trigger Call as

/sap/opu/odata/sap/my_service/SalesOrder('key_object_num_here')?$expand=GetDependents

-> GW Framework will First Read the Sales Order which matches the key provided and then get all the other SalesOrder and populate the data.

oscar_rodriguez4
Discoverer
0 Kudos

Thanks Ankit Maskara for the answer, I followed the steps above, but it says "Method 'get entity set' not implemented in data provider class" error. Now I have the following doubt, since my scenario is like this:

- If I run the function in ERP it has a pair of input parameters such as (Customer ID, Current Day) and as output, it is a table with several records
- If I implement the "Query" method, it does not give me any output. Because if I try to put the input (Key Property) that the function has defined, it shows the message "Key Property Does not Have an Output Mapping in Query", so I take one of the fields that is in the output table and map it in both directions, but it does not return data
- I decided to implement the "Read" method and it works correctly, but it only returns a record, this is normal as far as I know.

Is it possible to do the navigation to the same entity, without the "Query" method being implemented or in my case, do not return data? Or is there another solution?

I have followed examples like the following https://sapcodes.com/2016/09/21/odata-service-which-consumes-rfc/, and I see that the function from the tx se37 runs without inputs and therefore when implementing the "Query" method gets data, but in my case, the functions only bring data if you put the required fields.

Regards!

Ankit_Maskara
Product and Topic Expert
Product and Topic Expert
0 Kudos

You can try implementing GET_EXPANDED_ENTITY method.