In the first step we create a service description file and import it to the SAP Gateway backend system using the OData Channel Generation Tool, as follows:
Create an example OData edmx file with the content shown below and name it epm.xml:
<?xml version="1.0" encoding="utf-8" ?> <edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" xmlns:gp="http://www.sap.com/Protocols/SAPData/GenericPlayer" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:sap="http://www.sap.com/Protocols/SAPData"> <edmx:DataServices m:DataServiceVersion="2.0"> <Schema Namespace="GOODSISSUE" xmlns="http://schemas.microsoft.com/ado/2008/09/edm"> <EntityType Name="GoodsIssue" sap:content-version="1"> <Key> <PropertyRef Name="GoodsIssueKey" /> </Key> <Property Name="SalesOrderNumber" Type="Edm.String" Nullable="false" MaxLength="10" sap:label="Sales Order Number" sap:creatable="false" sap:updatable="false" sap:filterable="false" /> <Property Name="BuyerID" Type="Edm.String" Nullable="false" MaxLength="10" sap:label="Buyer ID" sap:creatable="false" sap:updatable="false" sap:filterable="false" /> <Property Name="BuyerName" Type="Edm.String" Nullable="false" MaxLength="80" sap:label="Buyer Name" sap:creatable="false" sap:updatable="false" sap:filterable="false" /> <Property Name="BuyerKey" Type="Edm.Guid" Nullable="false" sap:label="Buyer Key" sap:creatable="false" sap:updatable="false" sap:filterable="false" /> <Property Name="SalesOrderKey" Type="Edm.Guid" Nullable="false" sap:label="Sales Order Key" sap:creatable="false" sap:updatable="false" sap:filterable="false" /> <Property Name="GoodsIssueKey" Type="Edm.Guid" Nullable="false" sap:label="Goods Issue Key" sap:creatable="false" sap:updatable="false" sap:filterable="false" /> <Property Name="ChangedOn" Type="Edm.DateTime" Nullable="false" Precision="0" sap:label="Changed On" sap:creatable="false" sap:updatable="false" sap:filterable="false" m:FC_TargetPath="SyndicationUpdated" m:FC_KeepInContent="false" /> <Property Name="RootTitle" Type="Edm.String" Nullable="false" sap:label="Root Title" sap:creatable="false" sap:filterable="false" m:FC_TargetPath="SyndicationTitle" m:FC_KeepInContent="false" /> <Property Name="CreatedOn" Type="Edm.DateTime" Nullable="false" Precision="0" sap:label="Created On" sap:creatable="false" sap:updatable="false" sap:filterable="true" /> <NavigationProperty Name="goodsissueitem" Relationship="GOODSISSUE.goodsissueitem" FromRole="FromRole_GoodsIssue_GoodsIssueItem" ToRole="ToRole_GoodsIssueItem_GoodsIssue" /> </EntityType> <EntityType Name="GoodsIssueItem" sap:content-version="1> <Key> <PropertyRef Name="GoodsIssueKey" /> </Key> <Property Name="GoodsIssueKey" Type="Edm.Guid" Nullable="false" sap:creatable="false" sap:updatable="false" sap:filterable="false" /> <Property Name="GoodsIssueItemKey" Type="Edm.Guid" Nullable="false" sap:label="Goods Issue Item Key" sap:creatable="false" sap:updatable="false" sap:filterable="false" /> </EntityType> <Association Name="goodsissueitem" sap:content-version="1"> <End Type="GOODSISSUE.GoodsIssue" Multiplicity="1" Role="FromRole_GoodsIssue_GoodsIssueItem" /> <End Type="GOODSISSUE.GoodsIssueItem" Multiplicity="*" Role="ToRole_GoodsIssueItem_GoodsIssue" /> </Association> <EntityContainer Name="GOODSISSUE" m:IsDefaultEntityContainer="true"> <EntitySet Name="GoodsIssueCollection" EntityType="GOODSISSUE.GoodsIssue" sap:content-version="1" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:requires-filter="true" /> <EntitySet Name="GoodsIssueItemCollection" EntityType="GOODSISSUE.GoodsIssueItem" sap:content-version="1" sap:creatable="false" sap:updatable="false" sap:deletable="false" /> <AssociationSet Name="AssocSet_goodsissueitem" Association="GOODSISSUE.goodsissueitem" sap:content-version="1" sap:creatable="false" sap:updatable="false" sap:deletable="false"> <End EntitySet="GoodsIssueCollection" Role="FromRole_GoodsIssue_GoodsIssueItem" /> <End EntitySet="GoodsIssueItemCollection" Role="ToRole_GoodsIssueItem_GoodsIssue" /> </AssociationSet> </EntityContainer> </Schema> </edmx:DataServices> </edmx:Edmx>
Log on to your backend system and start transaction /IWBEP/IMPORT_MODEL by entering /N/IWBEP/IMPORT_MODEL in the command field.
The Select a model file for import screen is displayed.
Browse to the location of your service description file, created in step 1, and choose Open:
The mapping screen, Generate OData Channel Implementation is displayed.
The service description file is created and imported ready for you to confirm the mapping and generate the classes and interfaces.