SAP Knowledge Base Article - Public

2600276 - Exposing a CDS view with parameters as OData error code LCX_MISSING_PARAMETER


When trying to call an OData Service which exposed by a CDS view with parameters, the following error occurs:

<message>The caller violated a precondition for a method call</message>
<message>An exception was raised</message>

or the following error might occur

<message>The entity '*YY1_xxxxxxx' was not found</message>
<message>An exception was raised</message>




Reproducing the Issue

  1. Using your S/4HANA Cloud account, login to your Fiori Launchpad
    Expose a custom CDS view based on the standard view provided by SAP that has few parameters.
    Note: If the parameters are hidden, make them unhidden and republish your CDS view
  2. Create an OData communication arrangement scenario using the application Maintain Communication Arrangements
  3. Call your OData Service using for example POSTMAN as follow https://<URL>/sap/opu/odata/sap/YY1_<ODATA-SERVICE>
  4. User gets list of EntitySets
  5. Call any of the EntitySets error occurs


Calling an OData EntitySets with parameter like that, <URL>\YY1_<ODATA-SERVICE>\EntitySets is not correct. Refer to the resolution section


To call the correct Entitysets with parameter, do the following:

  1. Get the metadata first, <URL>\YY1_<ODATA-SERVICE>\$metadata
  2. In the metadata locate your EntitySets and check its Entity type, it will be something like this: 
     <EntitySet Name="YY1_<NAME>" EntityType="YY1_<ODATASERVICE>.YY1_<NAME>Parameters" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:pageable="false" sap:content-version="1"/>
  3. Then locate the the <EntityType Name="YY1_<NAME>Parameters" as shown below
    <EntityType Name="YY1_<NAME>Parameters" sap:semantics="parameters" sap:content-version="1">
                        <PropertyRef Name="P_1"/>
                        <PropertyRef Name="P_2"/>
  4. Under the Parameters EntityType find the following:
     <NavigationProperty Name="<RESULTSNAME>" .../>
  5. Now the user can form the URL as follow https://<URL>/sap/opu/odata/sap/YY1_<ODATA-SERVICE>/YY1_<NAME>(P_1='<WHATEVER-VALUE>',P_2='<WHATEVER-VALUE>')/<RESULTNAME>
    1. <RESULTNAME>: Whatever the name is from step 4
    2. YY1_<NAME> is the EntitySet Name from step 2
    3. P_1, P_2: Name of parameters from step 3, If the parameters list has X numbers of parameters, they need to be listed
  6. Note: If the result is very large, we can add $top=1 for testing purposes like that:


LCX_MISSING_PARAMETER CDS OData, OData with Parameter S/4HANA, CX_SADL_CONTRACT_VIOLATION, sy530, Entity, Parameter entity set, cannot be used for read, /IWFND/CM_MGW004, custom CDS view, API. , KBA , lcx_parameter_derivation_fail , lcx_missing_parameter , BC-SRV-APS-GKE , Generic CDS Key User Editor , Problem


SAP S/4HANA Cloud all versions