This is the second part of a tutorial series about how to build your own SAP Fiori Approve Purchase Order app.
The purpose of this tutorial is to show you step-by-step how to build your own SAP Fiori Approve Purchase Orders app and provides additional insights into why certain aspects have been developed as they are.
Good to know
One app = one dedicated OData service
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="1.0"
xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:sap="http://www.sap.com/Protocols/SAPData">
<edmx:Reference Uri="./IWFND/CATALOGSERVICE;v=2/Vocabularies(TechnicalName='%2FIWBEP%2FVOC_COMMON',Version='0001',SAP__Origin='LOCAL')/$value"
xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
<edmx:Include Namespace="com.sap.vocabularies.Common.v1" Alias="Common"/>
</edmx:Reference>
<edmx:DataServices m:DataServiceVersion="2.0">
...
</edmx:DataServices>
</edmx:Edmx>
edmx:DataServices
tags.<Schema Namespace="Z_PO_TUTORIAL_SRV" xml:lang="de" sap:schema-version="1"
xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
...
</Schema>
</edmx:DataServices>
schema
tags.<EntityType Name="Z_C_PurchaseorderType" sap:content-version="1">
<Key>
<PropertyRef Name="POId"/>
</Key>
<Property Name="POId" Type="Edm.String" Nullable="false" MaxLength="10" sap:display-format="UpperCase" sap:label="Bestell-ID" sap:creatable="false" sap:updatable="false"/>
<Property Name="DeliveryAddress" Type="Edm.String" MaxLength="129" sap:display-format="UpperCase" sap:label="Delivered To"/>
<Property Name="GrossAmount" Type="Edm.Decimal" Precision="16" Scale="3" sap:unit="CurrencyCode" sap:label="Gross Amount"/>
<Property Name="CurrencyCode" Type="Edm.String" MaxLength="5" sap:label="Währungscode" sap:semantics="currency-code"/>
<Property Name="ItemCount" Type="Edm.Int32"/>
<Property Name="SupplierName" Type="Edm.String" MaxLength="80" sap:label="Firma"/>
<Property Name="OrderedByName" Type="Edm.String" MaxLength="81" sap:display-format="UpperCase" sap:label="Ordered By"/>
<Property Name="DeliveryDateEarliest" Type="Edm.DateTimeOffset" Precision="7" sap:label="Delivery Date"/>
<Property Name="LaterDelivDateExist" Type="Edm.Int32"/>
<Property Name="ChangedAt" Type="Edm.DateTimeOffset" Precision="7" sap:label="Changed at" sap:creatable="false" sap:updatable="false"/>
<NavigationProperty Name="to_PurchaseOrderItems" Relationship="Z_PO_TUTORIAL_SRV.assoc_ECD2BAA0F8BF5B8410B95699E8ED23A2" FromRole="FromRole_assoc_ECD2BAA0F8BF5B8410B95699E8ED23A2" ToRole="ToRole_assoc_ECD2BAA0F8BF5B8410B95699E8ED23A2"/>
</EntityType>
<EntityType Name="Z_C_PurchaseorderitemType" sap:content-version="1">
<Key>
<PropertyRef Name="POId"/>
<PropertyRef Name="POItemPos"/>
</Key>
<Property Name="POId" Type="Edm.String" Nullable="false" MaxLength="10" sap:display-format="UpperCase" sap:label="Bestell-ID" sap:creatable="false" sap:updatable="false"/>
<Property Name="POItemPos" Type="Edm.String" Nullable="false" MaxLength="10" sap:display-format="UpperCase" sap:label="Zeile der Position"/>
<Property Name="GrossAmount" Type="Edm.Decimal" Precision="16" Scale="3" sap:unit="GrossAmountCurrency" sap:label="Gross Amount"/>
<Property Name="GrossAmountCurrency" Type="Edm.String" MaxLength="5" sap:label="Währungscode" sap:semantics="currency-code"/>
<Property Name="Quantity" Type="Edm.Decimal" Precision="13" Scale="3" sap:unit="QuantityUnit" sap:label="Quantity"/>
<Property Name="QuantityUnit" Type="Edm.String" MaxLength="3" sap:label="Maßeinheit" sap:semantics="unit-of-measure"/>
<Property Name="DeliveryDate" Type="Edm.DateTimeOffset" Precision="7" sap:label="Delivery Time"/>
<Property Name="Price" Type="Edm.Decimal" Precision="16" Scale="3" sap:unit="PriceCurrency" sap:label="Price"/>
<Property Name="PriceCurrency" Type="Edm.String" MaxLength="5" sap:label="Währungscode" sap:semantics="currency-code"/>
<Property Name="Product" Type="Edm.String" MaxLength="255" sap:display-format="UpperCase" sap:label="Product Name"/>
</EntityType>
EntityType
tag.<ComplexType Name="FunctionImportResult">
<Property Name="Success" Type="Edm.Boolean" Nullable="false" sap:label="boolsche Variable (X=true, -=false, space=unknown)" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
</ComplexType>
<Association Name="assoc_ECD2BAA0F8BF5B8410B95699E8ED23A2" sap:content-version="1">
<End Type="Z_PO_TUTORIAL_SRV.Z_C_PurchaseorderType" Multiplicity="1" Role="FromRole_assoc_ECD2BAA0F8BF5B8410B95699E8ED23A2"/>
<End Type="Z_PO_TUTORIAL_SRV.Z_C_PurchaseorderitemType" Multiplicity="*" Role="ToRole_assoc_ECD2BAA0F8BF5B8410B95699E8ED23A2"/>
<ReferentialConstraint>
<Principal Role="FromRole_assoc_ECD2BAA0F8BF5B8410B95699E8ED23A2">
<PropertyRef Name="POId"/>
</Principal>
<Dependent Role="ToRole_assoc_ECD2BAA0F8BF5B8410B95699E8ED23A2">
<PropertyRef Name="POId"/>
</Dependent>
</ReferentialConstraint>
</Association>
Association
tag. <EntityContainer Name="Z_PO_TUTORIAL_SRV_Entities" m:IsDefaultEntityContainer="true" sap:supported-formats="atom json xlsx">
<EntitySet Name="Z_C_Purchaseorder" EntityType="Z_PO_TUTORIAL_SRV.Z_C_PurchaseorderType" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1"/>
<EntitySet Name="Z_C_Purchaseorderitem" EntityType="Z_PO_TUTORIAL_SRV.Z_C_PurchaseorderitemType" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1"/>
<AssociationSet Name="assoc_ECD2BAA0F8BF5B8410B95699E8ED23A2" Association="Z_PO_TUTORIAL_SRV.assoc_ECD2BAA0F8BF5B8410B95699E8ED23A2" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1">
<End EntitySet="Z_C_Purchaseorder" Role="FromRole_assoc_ECD2BAA0F8BF5B8410B95699E8ED23A2"/>
<End EntitySet="Z_C_Purchaseorderitem" Role="ToRole_assoc_ECD2BAA0F8BF5B8410B95699E8ED23A2"/>
</AssociationSet>
<FunctionImport Name="ApprovePurchaseOrder" ReturnType="Z_PO_TUTORIAL_SRV.FunctionImportResult" m:HttpMethod="POST">
<Parameter Name="Note" Type="Edm.String" Mode="In" MaxLength="255"/>
<Parameter Name="POId" Type="Edm.String" Mode="In" MaxLength="10"/>
</FunctionImport>
<FunctionImport Name="RejectPurchaseOrder" ReturnType="Z_PO_TUTORIAL_SRV.FunctionImportResult" m:HttpMethod="POST"/>
</EntityContainer>
EntityContainer
tag.<atom:link rel="self" href="./sap/Z_PO_TUTORIAL_SRV/$metadata"
xmlns:atom="http://www.w3.org/2005/Atom"/>
<atom:link rel="latest-version" href="./sap/Z_PO_TUTORIAL_SRV/$metadata"
xmlns:atom="http://www.w3.org/2005/Atom"/>
<?xml version="1.0" encoding="utf-8"?/>
<edmx:Edmx Version="1.0"
xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:sap="http://www.sap.com/Protocols/SAPData"/>
<edmx:Reference Uri="./IWFND/CATALOGSERVICE;v=2/Vocabularies(TechnicalName='%2FIWBEP%2FVOC_COMMON',Version='0001',SAP__Origin='LOCAL')/$value"
xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"/>
<edmx:Include Namespace="com.sap.vocabularies.Common.v1" Alias="Common"/>
</edmx:Reference/>
<edmx:DataServices m:DataServiceVersion="2.0"/>
<Schema Namespace="Z_PO_TUTORIAL_SRV" xml:lang="de" sap:schema-version="1"
xmlns="http://schemas.microsoft.com/ado/2008/09/edm"/>
<EntityType Name="Z_C_PurchaseorderType" sap:content-version="1"/>
<Key/>
<PropertyRef Name="POId"/>
</Key/>
<Property Name="POId" Type="Edm.String" Nullable="false" MaxLength="10" sap:display-format="UpperCase" sap:label="Bestell-ID" sap:creatable="false" sap:updatable="false"/>
<Property Name="DeliveryAddress" Type="Edm.String" MaxLength="129" sap:display-format="UpperCase" sap:label="Delivered To"/>
<Property Name="GrossAmount" Type="Edm.Decimal" Precision="16" Scale="3" sap:unit="CurrencyCode" sap:label="Gross Amount"/>
<Property Name="CurrencyCode" Type="Edm.String" MaxLength="5" sap:label="Währungscode" sap:semantics="currency-code"/>
<Property Name="ItemCount" Type="Edm.Int32"/>
<Property Name="SupplierName" Type="Edm.String" MaxLength="80" sap:label="Firma"/>
<Property Name="OrderedByName" Type="Edm.String" MaxLength="81" sap:display-format="UpperCase" sap:label="Ordered By"/>
<Property Name="DeliveryDateEarliest" Type="Edm.DateTimeOffset" Precision="7" sap:label="Delivery Date"/>
<Property Name="LaterDelivDateExist" Type="Edm.Int32"/>
<Property Name="ChangedAt" Type="Edm.DateTimeOffset" Precision="7" sap:label="Changed at" sap:creatable="false" sap:updatable="false"/>
<NavigationProperty Name="to_PurchaseOrderItems" Relationship="Z_PO_TUTORIAL_SRV.assoc_ECD2BAA0F8BF5B8410B95699E8ED23A2" FromRole="FromRole_assoc_ECD2BAA0F8BF5B8410B95699E8ED23A2" ToRole="ToRole_assoc_ECD2BAA0F8BF5B8410B95699E8ED23A2"/>
</EntityType/>
<EntityType Name="Z_C_PurchaseorderitemType" sap:content-version="1"/>
<Key/>
<PropertyRef Name="POId"/>
<PropertyRef Name="POItemPos"/>
</Key/>
<Property Name="POId" Type="Edm.String" Nullable="false" MaxLength="10" sap:display-format="UpperCase" sap:label="Bestell-ID" sap:creatable="false" sap:updatable="false"/>
<Property Name="POItemPos" Type="Edm.String" Nullable="false" MaxLength="10" sap:display-format="UpperCase" sap:label="Zeile der Position"/>
<Property Name="GrossAmount" Type="Edm.Decimal" Precision="16" Scale="3" sap:unit="GrossAmountCurrency" sap:label="Gross Amount"/>
<Property Name="GrossAmountCurrency" Type="Edm.String" MaxLength="5" sap:label="Währungscode" sap:semantics="currency-code"/>
<Property Name="Quantity" Type="Edm.Decimal" Precision="13" Scale="3" sap:unit="QuantityUnit" sap:label="Quantity"/>
<Property Name="QuantityUnit" Type="Edm.String" MaxLength="3" sap:label="Maßeinheit" sap:semantics="unit-of-measure"/>
<Property Name="DeliveryDate" Type="Edm.DateTimeOffset" Precision="7" sap:label="Delivery Time"/>
<Property Name="Price" Type="Edm.Decimal" Precision="16" Scale="3" sap:unit="PriceCurrency" sap:label="Price"/>
<Property Name="PriceCurrency" Type="Edm.String" MaxLength="5" sap:label="Währungscode" sap:semantics="currency-code"/>
<Property Name="Product" Type="Edm.String" MaxLength="255" sap:display-format="UpperCase" sap:label="Product Name"/>
</EntityType/>
<ComplexType Name="FunctionImportResult"/>
<Property Name="Success" Type="Edm.Boolean" Nullable="false" sap:label="boolsche Variable (X=true, -=false, space=unknown)" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
</ComplexType/>
<Association Name="assoc_ECD2BAA0F8BF5B8410B95699E8ED23A2" sap:content-version="1"/>
<End Type="Z_PO_TUTORIAL_SRV.Z_C_PurchaseorderType" Multiplicity="1" Role="FromRole_assoc_ECD2BAA0F8BF5B8410B95699E8ED23A2"/>
<End Type="Z_PO_TUTORIAL_SRV.Z_C_PurchaseorderitemType" Multiplicity="*" Role="ToRole_assoc_ECD2BAA0F8BF5B8410B95699E8ED23A2"/>
<ReferentialConstraint/>
<Principal Role="FromRole_assoc_ECD2BAA0F8BF5B8410B95699E8ED23A2"/>
<PropertyRef Name="POId"/>
</Principal/>
<Dependent Role="ToRole_assoc_ECD2BAA0F8BF5B8410B95699E8ED23A2"/>
<PropertyRef Name="POId"/>
</Dependent/>
</ReferentialConstraint/>
</Association/>
<EntityContainer Name="Z_PO_TUTORIAL_SRV_Entities" m:IsDefaultEntityContainer="true" sap:supported-formats="atom json xlsx"/>
<EntitySet Name="Z_C_Purchaseorder" EntityType="Z_PO_TUTORIAL_SRV.Z_C_PurchaseorderType" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1"/>
<EntitySet Name="Z_C_Purchaseorderitem" EntityType="Z_PO_TUTORIAL_SRV.Z_C_PurchaseorderitemType" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1"/>
<AssociationSet Name="assoc_ECD2BAA0F8BF5B8410B95699E8ED23A2" Association="Z_PO_TUTORIAL_SRV.assoc_ECD2BAA0F8BF5B8410B95699E8ED23A2" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1"/>
<End EntitySet="Z_C_Purchaseorder" Role="FromRole_assoc_ECD2BAA0F8BF5B8410B95699E8ED23A2"/>
<End EntitySet="Z_C_Purchaseorderitem" Role="ToRole_assoc_ECD2BAA0F8BF5B8410B95699E8ED23A2"/>
</AssociationSet/>
<FunctionImport Name="ApprovePurchaseOrder" ReturnType="Z_PO_TUTORIAL_SRV.FunctionImportResult" m:HttpMethod="POST"/>
<Parameter Name="Note" Type="Edm.String" Mode="In" MaxLength="255"/>
<Parameter Name="POId" Type="Edm.String" Mode="In" MaxLength="10"/>
</FunctionImport/>
<FunctionImport Name="RejectPurchaseOrder" ReturnType="Z_PO_TUTORIAL_SRV.FunctionImportResult" m:HttpMethod="POST"/>
</EntityContainer/>
<atom:link rel="self" href="./sap/Z_PO_TUTORIAL_SRV/$metadata"
xmlns:atom="http://www.w3.org/2005/Atom"/>
<atom:link rel="latest-version" href="./sap/Z_PO_TUTORIAL_SRV/$metadata"
xmlns:atom="http://www.w3.org/2005/Atom"/>
</Schema/>
</edmx:DataServices/>
</edmx:Edmx/>
Code example
Application Settings
Field | Value | Description |
Type | App for SAP Fiori Launchpad | Specifies whether we want to build a SAP Fiori App running in Fiori Launchpad or a standalone App. |
Title | Approve Purchase Orders | Title of your application that is displayed in the header area of the window. |
Namespace | acme.purchaseorder | Unique namespace of your application. Since all SAP Fiori apps share the same Javascript VM on the same shared web page, a unique namespace is mandatory. |
Description | Approve Purchase Orders | Short description of your application |
Field | Value | Description |
Object Collection | Z_C_Purchaseorder | The main entity set that will be displayed in the app. In our case, it’s in the list on the left hand side of the screen. This may vary in case you have created your own OData service with different CDS view names than used in this tutorial. Use the name of the Purchase Order CDS view. |
Object Collection ID | POId | Key that is used to uniquely identify the object collection, in our case the ID of the purchase order. |
Object Title | SupplierName | Name of the item that is displayed in the list |
Object Numeric Attribute | GrossAmount | Number displayed next to the main object |
Object Unit of Measure | CurrencyCode | Unit of measure of the numeric attribute. |
Data Binding- Line Item
Field | Value | Description |
Line Item Collection | to_PurchaseOrderItems | Entity that will be displayed in the detail section on the right hand side of the screen. This may vary in case you have created your own OData service with different CDS view names than used in this tutorial. Use the Name our Purchase Order Item CDS view. |
Line Item Collection ID | POItemPos | Unique key that is used to identify the object collection. |
Line Item Title | Product | Item title that will be displayed in the table |
Line Item Numeric Attribute | GrossAmount | Numeric attribute of the line item |
Line Item Unit of Measure | GrossAmountCurrency | Unit of measure of the numeric attribute. |
Overview of project folders and files
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
37 | |
25 | |
17 | |
13 | |
7 | |
7 | |
7 | |
6 | |
6 | |
6 |