Skip to Content
avatar image
Former Member

Generated Odata for CDS view with parameter

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

cds-view.png (17.0 kB)
cds-input.png (16.8 kB)
cds-output.png (16.8 kB)
metadata.png (143.0 kB)
single-record.png (75.3 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Mar 23, 2017 at 11:34 AM

    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


    Add comment
    10|10000 characters needed characters exceeded