Skip to Content
0

How to implement an odata create request with android and SMP SDK

Nov 11, 2016 at 02:49 PM

63

avatar image

There is a legacy function module we want to comsume with odata via SMP 3.0. This funcion module has some flat header data and, in additional to that, some importing tables. We are now writing the Android app and want to know how to add values to the importing table. The OData Service has defined the header data as content and has an assotiation to the table data. But how can I set the values for this table?

With SAP Gateway client, we have tested the create with this body:

<?xml version="1.0" encoding="utf-8"?> <entry xml:base="http://x15-ci.sap.db.de:8017/sap/opu/odata/sap/ZIIS_IHD_IN_MDG_SRV/" xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"> <id>http://x15-ci.sap.db.de:8017/sap/opu/odata/sap/ZIIS_IHD_IN_MDG_SRV/HeaderSet('')</id> <title type="text">HeaderSet('')</title> <updated>2016-11-11T09:30:04Z</updated> <category term="ZIIS_IHD_IN_MDG_SRV.Header" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> <link href="HeaderSet('')" rel="self" title="Header"/> <link href="HeaderSet('')/ToVer" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ToVer" type="application/atom+xml;type=feed" title="ToVer"> <m:inline> <feed xml:base="http://x15-ci.sap.db.de:8017/sap/opu/odata/sap/ZIIS_IHD_IN_MDG_SRV/"> <id>http://x15-ci.sap.db.de:8017/sap/opu/odata/sap/ZIIS_IHD_IN_MDG_SRV/HeaderSet('')/ToVer</id> <title type="text">VersionObjartSet</title> <updated>2016-11-11T09:30:04Z</updated> <author> <name/> </author> <link href="HeaderSet('')/ToVer" rel="self" title="VersionObjartSet"/> <entry> <id>http://x15-ci.sap.db.de:8017/sap/opu/odata/sap/ZIIS_IHD_IN_MDG_SRV/VersionObjartSet('')</id> <title type="text">VersionObjartSet('')</title> <updated>2016-11-11T09:30:04Z</updated> <category term="ZIIS_IHD_IN_MDG_SRV.VersionObjart" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> <link href="VersionObjartSet('')" rel="self" title="VersionObjart"/> <content type="application/xml"> <m:properties> <d:Objart/> <d:Version/> <d:Vcheck/> </m:properties> </content> </entry> </feed> </m:inline> </link> <link href="HeaderSet('')/ToStoer" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ToStoer" type="application/atom+xml;type=feed" title="ToStoer"> <m:inline> <feed xml:base="http://x15-ci.sap.db.de:8017/sap/opu/odata/sap/ZIIS_IHD_IN_MDG_SRV/"> <id>http://x15-ci.sap.db.de:8017/sap/opu/odata/sap/ZIIS_IHD_IN_MDG_SRV/HeaderSet('1')/ToStoer</id> <title type="text">StoerungSet</title> <updated>2016-11-11T09:30:04Z</updated> <author> <name/> </author> <link href="HeaderSet('')/ToStoer" rel="self" title="StoerungSet"/> <entry> <id>http://x15-ci.sap.db.de:8017/sap/opu/odata/sap/ZIIS_IHD_IN_MDG_SRV/StoerungSet('')</id> <title type="text">StoerungSet('')</title> <updated>2016-11-11T09:30:04Z</updated> <category term="ZIIS_IHD_IN_MDG_SRV.Stoerung" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> <link href="StoerungSet('')" rel="self" title="Stoerung"/> <content type="application/xml"> <m:properties> <d:Id/> <d:Text>Test Langtext</d:Text> <d:Posnr>01</d:Posnr> <d:Ordnr>000</d:Ordnr> <d:Fznr>618520-90208-0</d:Fznr> <d:Code>PZSM</d:Code> <d:Taetigkeit/> <d:Erledigt>X</d:Erledigt> <d:Ursache/> <d:Faktor/> <d:FzIndex>00</d:FzIndex> </m:properties> </content> </entry> </feed> </m:inline> </link> <link href="HeaderSet('')/ToFZ" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ToFZ" type="application/atom+xml;type=feed" title="ToFZ"> <m:inline> <feed xml:base="http://x15-ci.sap.db.de:8017/sap/opu/odata/sap/ZIIS_IHD_IN_MDG_SRV/"> <id>http://x15-ci.sap.db.de:8017/sap/opu/odata/sap/ZIIS_IHD_IN_MDG_SRV/HeaderSet('')/ToFZ</id> <title type="text">FahrzeugSet</title> <updated>2016-11-11T09:30:04Z</updated> <author> <name/> </author> <link href="HeaderSet('')/ToFZ" rel="self" title="FahrzeugSet"/> <entry> <id>http://x15-ci.sap.db.de:8017/sap/opu/odata/sap/ZIIS_IHD_IN_MDG_SRV/FahrzeugSet('')</id> <title type="text">FahrzeugSet('')</title> <updated>2016-11-11T09:30:04Z</updated> <category term="ZIIS_IHD_IN_MDG_SRV.Fahrzeug" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/> <link href="FahrzeugSet('618520-90208-0')" rel="self" title="Fahrzeug"/> <content type="application/xml"> <m:properties> <d:Fznr>618520-90208-0</d:Fznr> <d:Objart>R</d:Objart> </m:properties> </content> </entry> </feed> </m:inline> </link> <content type="application/xml"> <m:properties> <d:Id>1</d:Id> <d:Meldungsart>V</d:Meldungsart> <d:Datum m:null="true"/> <d:Uhrzeit>PT00H00M00S</d:Uhrzeit> <d:Modemkennung/> <d:Reihungsart>Z</d:Reihungsart> <d:Reihungsnummer/> <d:Werk>13CB</d:Werk> <d:Zugnummer>6</d:Zugnummer> <d:Rolle>W</d:Rolle> <d:Subrc>0</d:Subrc> </m:properties> </content> </entry>

But how can we implement this in Android?

10 |10000 characters needed characters left characters exceeded

Hello Christian,

Were you able to find solution for your issue?

Regards,

JK (Moderator)

0
* Please Login or Register to Answer, Follow or Comment.

0 Answers