cancel
Showing results for 
Search instead for 
Did you mean: 

Offline Kapsel App reads single entry from SMP Odata service

0 Kudos
144

Hello All,

I have been working on Offline Kapsel based application for iOS simulator with SMP 3.0 SP 07

I have configured below OData service of SAP Netweaver Gateway in SMP

(http://gatewayserver:portno/sap/opu/odata/APLX/HT_VENDOR_LIST/ht_vendor_listCollection)

and my iOS simulator has got successfully registered in SMP through my kapsel app.

my Gateway Odata service gives vendor list collection of 2000 row entries

When I do OData.read with URI generated from SMP I am getting all 2000 entries successfully. But when I do Odata.read after creating Offline store,

var properties = {

                "name": "VendorOffline",

                "host": "<<smpserver>>",

                "port": "8080",

                "https": "false",

                "serviceRoot""http://<<smpserver>>:8080/<<appid>>/",

               

                "definingRequests" : {

                    "VendorList" : "/ht_vendor_listCollection"

                }

            };

           

            store = sap.OData.createOfflineStore(properties);

           

            //var options = {};

            store.open(openStoreSuccessCallback, errorCallback/*, options*/);

I got store opened successfully and my OData.read returns only 1 row entry. It should have returned all 2000 row entries to offline store.

Is there any one faced this scenario? any solution for this?

Accepted Solutions (1)

Accepted Solutions (1)

midhun_vp
Active Contributor
0 Kudos

Hi Mohanasundaram,

This should not happen. I am wondering whether this is related to the primary key you defined in Odata service. What is the primary key of the Odata service ? Is the value of it is unique for all 200 entries?

Regards,Midhun

SAP Technology RIG

0 Kudos

Hello Midhun,

Thanks for your immediate reply.

There is no key field defined in Gateway and so be with SMP too.

Is primary key mandatory to maintain all the data in Offline store?

My Odata service from SMP says below metadata.

<edmx:Edmx Version="1.0">

<edmx:DataServices m:DataServiceVersion="2.0">
<Schema Namespace="HT_VENDOR_LIST" xml:lang="en">
<EntityType Name="ht_vendor_list" sap:content-version="1">
<Key>
<PropertyRef Name="i_bukrs"/>

</Key>

<Property Name="i_field5" Type="Edm.String" MaxLength="40" sap:label="Char" sap:creatable="false" sap:updatable="false"/>

<Property Name="field5" Type="Edm.String" MaxLength="40" sap:label="Char" sap:creatable="false" sap:updatable="false"/>

<Property Name="field4" Type="Edm.String" MaxLength="40" sap:label="Char" sap:creatable="false" sap:updatable="false"/>

<Property Name="i_field3" Type="Edm.String" MaxLength="40" sap:label="Char" sap:creatable="false" sap:updatable="false"/>

<Property Name="i_field2" Type="Edm.String" MaxLength="40" sap:label="Char" sap:creatable="false" sap:updatable="false"/>

<Property Name="lifnr" Type="Edm.String" MaxLength="10" sap:label="Vendor" sap:creatable="false" sap:updatable="false"/>

<Property Name="field3" Type="Edm.String" MaxLength="40" sap:label="Char" sap:creatable="false" sap:updatable="false"/>

<Property Name="bukrs" Type="Edm.String" MaxLength="4" sap:label="Company Code" sap:creatable="false" sap:updatable="false"/>

<Property Name="field1" Type="Edm.String" MaxLength="40" sap:label="Char" sap:creatable="false" sap:updatable="false"/>

<Property Name="field2" Type="Edm.String" MaxLength="40" sap:label="Char" sap:creatable="false" sap:updatable="false"/>

<Property Name="i_field1" Type="Edm.String" MaxLength="40" sap:label="Char" sap:creatable="false" sap:updatable="false"/>

<Property Name="i_lifnr" Type="Edm.String" MaxLength="10" sap:label="Vendor" sap:creatable="false" sap:updatable="false"/>

<Property Name="i_bukrs" Type="Edm.String" Nullable="false" MaxLength="4" sap:label="Company Code" sap:creatable="false" sap:updatable="false"/>

<Property Name="name1" Type="Edm.String" MaxLength="35" sap:label="Name" sap:creatable="false" sap:updatable="false"/>

<Property Name="i_field4" Type="Edm.String" MaxLength="40" sap:label="Char" sap:creatable="false" sap:updatable="false"/>

</EntityType>
<EntityContainer Name="HT_VENDOR_LIST" m:IsDefaultEntityContainer="true">

<EntitySet Name="ht_vendor_listCollection" EntityType="HT_VENDOR_LIST.ht_vendor_list" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1"/>

</EntityContainer>

<atom:link rel="self" href= "http://###:8000/sap/opu/odata/APLX/HT_VENDOR_LIST/$metadata" />

<atom:link rel="latest-version" href= "http://####:8000/sap/opu/odata/APLX/HT_VENDOR_LIST/$metadata" />

</Schema>
</edmx:DataServices>

</edmx:Edmx>

midhun_vp
Active Contributor
0 Kudos

Hi Mohanasundaram,

I believe that according to Odata standard a primary key is mandatory. Could you please define a primary key and try.

Regards,Midhun

SAP Technology RIG

0 Kudos

Hello Mithun,

Problem is solved now. I could able to get all data. As you said, defining PK makes things do well.

Thanks for all your help!!!

Answers (1)

Answers (1)

agentry_src
Active Contributor
0 Kudos

Discussion successfully moved from SAP for Mobile to SMP Developer Center as the more appropriate venue for this question.

Regards, Mike (Moderator)

SAP Technology RIG