cancel
Showing results for 
Search instead for 
Did you mean: 

Generated Odata for CDS view with parameter

0 Kudos

My test scenario is that I want select all the company codes belonging to a particular country using CDS view, generate Odata and expose it for external consumption for analytical purposes. I created a simple CDS view with parameter to select list of company codes from T001 for a particular company(parameter) with company code as key fields and used Odata.publish:true annotation to generate Odata service. After activating Odata service in gateway system I can see that there are two entitysets in the metadata. One entityset is (Zst_Test_T001) with input parameter as the key and the second entity set (Zst_Test_T001Set) with input parameter and the key field of the CDS views as key fields. I am able to get a single record when I pass both the parrameter value and key field in the URL(/sap/opu/odata/sap/ZST_TEST_T001_CDS/Zst_Test_T001Set(p_country='US',bukrs='0101')). But, I would like to get a list of records just liker when I test the CDS view in Eclipse after supplying the input parameter. What would my URL be if I want to get the same list of records?

cds-view.png

cds-input.png

cds-output.png

metadata.png

single-record.png

Jelena
Active Contributor
0 Kudos

Maybe you forgot MANDT?

Accepted Solutions (0)

Answers (1)

Answers (1)

cwolter90
Participant
0 Kudos

The Url could be:

/sap/opu/odata/sap/ZST_TEST_T001_CDS/Zst_Test_T001('US')/Set

The Zst_Test_T001 is the Set for the Parameter-Entity, which has a navigation prop to the Entity you want to query.

Best regards

Christian Wolter