cancel
Showing results for 
Search instead for 
Did you mean: 

Can one MBT service (Mobile Backend Tools) map entities to many different HTTP destinations ?

Momen_Allouh
Product and Topic Expert
Product and Topic Expert
0 Kudos
308

I am planning to use MBT service for caching data in SAP HANA and to use with offline MDK app , the results of each entity may be from ECC ODATA or HANA DB or another HTTP ODATA.

In Mobile Backend Tools, Can I map the service entities to many different HTTP destinations ? or one MBT service use only one backend destination (source of the results).

like in this e.g. can I use the HTTP.Destination to define from where each entity should be loaded into my MBT service.

<EntityType Name="CashDecreaseType">
    <Annotation Term="HTTP.Destination" String="ECC_ODATA_1"/>
    <Key>
        <PropertyRef Name="StoreNumber"/>
        <PropertyRef Name="PurityCode"/>
    </Key>
    <Property Name="StoreNumber" Type="Edm.String" Nullable="false" MaxLength="3"/>
    <Property Name="PurityCode" Type="Edm.String" Nullable="false" MaxLength="3"/>
    <Property Name="CashDecrease" Type="Edm.Decimal"  Precision="13" Scale="3"/>
    <Property Name="DecreaseUom" Type="Edm.String" MaxLength="3"/>
    <Property Name="LastChangedBy" Type="Edm.String" MaxLength="12"/>
    <Property Name="LastChangedAt" Type="Edm.DateTimeOffset" Precision="7"/>
</EntityType>


<EntityType Name="CustomerType" >
    <Annotation Term="HTTP.Destination" String="ECC_ODATA_2"/>
    <Key>
        <PropertyRef Name="CustomerID"/>
    </Key>
    <Property Name="CustomerID" Type="Edm.String" Nullable="false" MaxLength="6" sap:display-format="NonNegative" sap:text="LastName" sap:label="Customer ID" sap:quickinfo="Flight Reference Scenario: Customer ID"/>
    <Property Name="FirstName" Type="Edm.String" MaxLength="40" sap:label="First Name" sap:quickinfo="Flight Reference Scenario: First Name"/>
    <Property Name="LastName" Type="Edm.String" MaxLength="40" sap:label="Last Name" sap:quickinfo="Flight Reference Scenario: Last Name"/>
    <Property Name="Title" Type="Edm.String" MaxLength="10" sap:label="Title" sap:quickinfo="Flight Reference Scenario: Title"/>
    <Property Name="Street" Type="Edm.String" MaxLength="60" sap:label="Street" sap:quickinfo="Flight Reference Scenario: Street"/>
    <Property Name="PostalCode" Type="Edm.String" MaxLength="10" sap:display-format="UpperCase" sap:label="Postal Code" sap:quickinfo="Flight Reference Scenario: Postal Code"/>
    <Property Name="City" Type="Edm.String" MaxLength="40" sap:label="City" sap:quickinfo="Flight Reference Scenario: City"/>
    <Property Name="CountryCode" Type="Edm.String" MaxLength="3" sap:display-format="UpperCase" sap:label="Country/Region Key" sap:value-list="standard"/>
    <Property Name="PhoneNumber" Type="Edm.String" MaxLength="30" sap:display-format="UpperCase" sap:label="Phone No." sap:quickinfo="Flight Reference Scenario: Phone Number"/>
    <Property Name="EMailAddress" Type="Edm.String" MaxLength="256" sap:label="E-Mail Address" sap:quickinfo="Flight Reference Scenario: Email Address"/>
</EntityType><br>

Accepted Solutions (1)

Accepted Solutions (1)

evanireland
Product and Topic Expert
Product and Topic Expert

Yes you can. If you check vocabularies/com.sap.cloud.server.odata.cache.v1.xml, and look for the HttpDestination term, you can see the "AppliesTo" permits this.

Momen_Allouh
Product and Topic Expert
Product and Topic Expert
0 Kudos

it AppliesTo EntityType also EntitySet, where do you think is better to add the annotation in EntityType or both ?

Answers (1)

Answers (1)

evanireland
Product and Topic Expert
Product and Topic Expert

I would say EntityType.

OData allows the same EntityType to be used by multiple EntitySet definitions, although we wouldn't often rely on that capability.

In such cases, setting an annotation on the entity type would mean that the same annotation is used for all the entity sets using that type.

Momen_Allouh
Product and Topic Expert
Product and Topic Expert
0 Kudos

Thanks Evan, thats helpful.