cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

UI5 Fiori Query Request / Call with Parameters (RAP) ODATA V4

lgrabow7
Discoverer
0 Kudos
886

Hi Community, 

we have created an ODATA V4 in ABAP via the RAP process, which works without any problems and a CDS data query and action call is possible.

We have also implemented a query with parameters, which is to be called with the parameters and returns a list which is sorted in the ABAP backend and the parameter "menge" is used to decide how many data records (lines) are returned.

in eclipse with "service bindings" in the preview this works exactly as desired and the abap code is processed

lgrabow7_0-1718888104650.png

lgrabow7_1-1718888236079.png

We have defined the query in this way:

 

@EndUserText.label: 'MM: Data Model Bestandsübersicht'
@ObjectModel.query.implementedBy: 'ABAP:ZCL_MM_BESTAND_PGMVT_LITE'
define root custom entity ZMM_I_BESTAND_PGMVT_LITE
  with parameters
    matnr : matnr,
    werks : werks_d,
    menge : zmm_de_menge_dec
{
  key charge  : charg_d;
  key mhd     : vfdat;
      @Semantics.quantity.unitOfMeasure : 'ZMM_I_BESTAND_PGMVT_LITE.EINHEIT'
      bestand : labst;
      einheit : meins;


}

 

i have tried to work with the examples that can be found in the following link:

Parameters - Documentation - Demo Kit - SAPUI5 SDK (ondemand.com)

With the help of this documentation, however, I have not even managed to send a request to the abap backend, it always goes to an error in the browser console.

 

How can I call the query with parameters which I pass to the backend and get back a list as seen in the eclipse preview?

Metadata:

 

 

<EntityType Name="BESTANDType">
                <Key>
                    <PropertyRef Name="charge"/>
                    <PropertyRef Name="mhd"/>
                </Key>
                <Property Name="charge" Type="Edm.String" Nullable="false" MaxLength="10"/>
                <Property Name="mhd" Type="Edm.Date" Nullable="false"/>
                <Property Name="bestand" Type="Edm.Decimal" Nullable="false" Precision="13" Scale="3"/>
                <Property Name="einheit" Type="Edm.String" Nullable="false" MaxLength="3"/>
                <NavigationProperty Name="Parameters" Type="com.sap.gateway.srvd.zmm_ui_pgmvt_lite.v0001.BESTANDParameters" Nullable="false"/>
            </EntityType>
            <EntityType Name="BESTANDParameters">
                <Key>
                    <PropertyRef Name="matnr"/>
                    <PropertyRef Name="werks"/>
                    <PropertyRef Name="menge"/>
                </Key>
                <Property Name="matnr" Type="Edm.String" Nullable="false" MaxLength="40"/>
                <Property Name="werks" Type="Edm.String" Nullable="false" MaxLength="4"/>
                <Property Name="menge" Type="Edm.Decimal" Nullable="false" Precision="13" Scale="3"/>
                <NavigationProperty Name="Set" Type="Collection(com.sap.gateway.srvd.zmm_ui_pgmvt_lite.v0001.BESTANDType)" Partner="Parameters" ContainsTarget="true"/>
            </EntityType>

 

many thanks in advance!

 

Best regards, 

Lukas

 

 

 

 

Accepted Solutions (0)

Answers (0)