Expert Guided Implementation for SAPUI5 App Development with OData and SAP Web IDE Day 2 Support from Experts for developing OData and SAPUI5 applications Expert Guided Implementation for SAPUI5 App Development with OData and SAP Web IDE Day 1 Day 2 Day 3 Day 4 Empowering lesson SAP expert introduces NetWeaver Gateway, its architecture and deployment options and gives an introduction to OData Empowering lesson Step-by-step guide to OData service development with SAP Netweaver Gateway Service Builder Empowering lesson Introduction to advanced Gateway topics: -System Aliases -Multiple Backend Support Empowering lesson Step-by-step guide of the creation of an SAPUI5 application to consume an OData service using SAP Web IDE (Web session, 2 h. in the morning) (Web session, 2 h. in the morning) Execution by customer Customer reviews an OData service (Remote support in the afternoon) Goal of the day Customer understands the architecture, deployment options and development capabilities of SAP Netweaver Gateway (Web session, 2 h. in the morning) (Web session, 2 h. in the morning) Execution by customer Customer develops their own OData service based on the EPM example application (Remote support in the afternoon) Execution by customer Customer reviews advanced topics Goal of the day Customer enabled to develop an OData service and understands the different development options within the Gateway Service Builder tool Goal of the day Customer gains insight into advanced features of SAP Netweaver Gateway © 2016 SAP SE or an SAP affiliate company. All rights reserved. (Remote support in the afternoon) Execution by customer Customer develops an SAPUI5 application to consume the example Gateway Service (Remote support in the afternoon) Goal of the day Customer enabled to create simple SAPUI5 application to consume an OData Service Final goal Customer has the knowledge to develop mobile applications that meet their business needs Customer 2 Overview Service Development How to build a service using code based implementation using Service Builder Data Model Definition Entity Type Entity Set Service Implementation (code based) Query --> Test Read --> Test Update --> Test Service Registration © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 3 Overview Service Generation How to generate a service using the RFC/BOR generator using Service Builder Data Model Definition Entity Types Entity Sets Association Navigation Property Service Implementation Mapping GET_ENTITYSET of SalesOrder Mapping GET_ENTITY of SalesOrder Mapping GET_ENTITYSET of SalesOrderItnems Mapping Get_ENTITYSET of SalesOrderLineItems © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 4 The NetWeaver Enterprise Procurement Model The NetWeaver Enterprise Procurement Model - Links The NetWeaver Enterprise Procurement Model - An Introduction http://scn.sap.com/docs/DOC-31458 Gateway Setup for Enterprise Procurement Model http://scn.sap.com/docs/DOC-41819 Quick Starter Configuration Guide - SAP NetWeaver Gateway http://scn.sap.com/docs/DOC-41416 © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 6 Introduction – Service creation Service Development & Service Generation Service Builder - Development flow Service Definition Service Development Service Generation Gateway Backend (SEGW) Service Registration and Hub Activation © 2016 SAP SE or an SAP affiliate company. All rights reserved. Gateway Server (/IWFND/MAINT_SERVICE) Customer 8 Service Development Service Builder – Service development Service Definition Data Model Definition Service Generation Service Implementation (Code based) Service Implementation (Mapping) Service Registration and Hub Activation © 2016 SAP SE or an SAP affiliate company. All rights reserved. Gateway Backend (SEGW) Gateway Server (/IWFND/MAINT_SERVICE) Customer 10 Overview - Service development 1. Create a project 2. Create a data model 3. Generate runtime objects 4. Add and activate the service 5. Implementation © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 11 Create a project - SEGW Empty project structure Data Model Service Implementation Runtime Artifacts Service Maintenance © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 12 Service Development Create a project in transaction SEGW Empty project structure Data Model Service Implementation Runtime Artifacts Service Maintenance © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 14 Data model definition Service Builder – Data model definition OData Service Definition in SEGW Data Model Definition (MPC) Service Implementation (DPC) Declarative Model Definition* Import Data Model (EDMX) Code-Based Implementation* Code-Based Extensions* Service Maintenance © 2016 SAP SE or an SAP affiliate company. All rights reserved. Import DDIC/ RFC/BOR Interface* Map RFC/BOR Operation* Service Registration and Hub Activation Redefine Data Source Include Service Gateway Service (GenIL, SPI, Generation Service* BW Easy Query, MDX) * Repeatable within one service Gateway Backend (SEGW) Gateway Server (/IWFND/MAINT_SERVICE) Customer 16 Entity Data Model – Overview An Entity Data Model (EDM) describes the organisation and relationship of the data resources within a particular business scenario. Entity Sets are instances of entity types and can be accessed as follows: • http://<host>/<ServiceRoot>/SalesOrderItems • http://<host>/<ServiceRoot>/<Products At least one property must be nominated as a key field Entity Type: EDM basic building block. Represents specific business object Navigation implements an association © 2016 SAP SE or an SAP affiliate company. All rights reserved. Association: Relationship between two entity types An Entity Type is built from one or more properties Customer 17 The OData type system Function Import Entity Container * * Entity Set * Association * Service Document * 2 Entity Key * Entity Type 1 Entity Describes structure of 1 1..* 1 Navigation Property * 1..* Property * 1 Type 1..* Complex Type © 2016 SAP SE or an SAP affiliate company. All rights reserved. Simple Type Customer 18 Create a data model using SEGW - Overview Mandatory • Entity Types • Entity Sets Optional • Complex Types • Associations • Association Sets • Function Imports © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 19 Create a data model - Create an entity type Entity Types can be created from: • DDIC structures • RFC/BOR interfaces Complete models can be created from: • EDMX files © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 20 Create a data model - Create an entity type from DDIC structure Entity type name and property names will be derived from DDIC structure Entity type name and property names can be beautified EDM data types are derived from standard mapping Label information is derived from DDIC descriptions © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 21 Create a data model - Create an entity set Entity sets are created based on existing entity types An entity type can be used by several entity sets Example: Entity type: Person Entity sets: Contacts, Employees, … © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 22 Runtime artifacts Model Provider Class Data Provider Class Model Service Service Builder – Service implementation OData Service Definition in SEGW Data Model Definition (MPC) Service Implementation (DPC) Declarative Model Definition* Import Data Model (EDMX) Code-Based Implementation* Code-Based Extensions* Service Maintenance © 2016 SAP SE or an SAP affiliate company. All rights reserved. Import DDIC/ RFC/BOR Interface* Map RFC/BOR Operation* Service Registration and Hub Activation Redefine Data Source Include Service Gateway Service (GenIL, SPI, Generation Service* BW Easy Query, MDX) * Repeatable within one service Gateway Backend (SEGW) Gateway Server (/IWFND/MAINT_SERVICE) Customer 24 Generate runtime artifacts ABAP classes for Model definition Base Class Implementation Class Service implementation Base Class Implementation Class Service registration in the backend Model Service © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 25 Generate runtime artefacts – Result ERP or Business Suite External Service Name Registered Service Name Data Provider Class Extension Class Registered Model Name Model Provider Class Extension Class Gateway Service © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 26 Registration and Activation Hub Gateway Service Builder – Service Implementation OData Service Definition in SEGW Data Model Definition (MPC) Service Implementation (DPC) Declarative Model Definition* Import Data Model (EDMX) Code-Based Implementation* Code-Based Extensions* Service Maintenance © 2016 SAP SE or an SAP affiliate company. All rights reserved. Import DDIC/ RFC/BOR Interface* Map RFC/BOR Operation* Service Registration and Hub Activation Redefine Data Source Include Service Gateway Service (GenIL, SPI, Generation Service* BW Easy Query, MDX) * Repeatable within one service Gateway Backend (SEGW) Gateway Server (/IWFND/MAINT_SERVICE) Customer 28 Register and activate Gateway service on the hub SEGW has created a • Data Provider Class and a • Model Provider Class • plus extension classes These classes must be • registered and • activated in the Hub system © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 29 Service Development Prerequisite for “Service Maintenance” in the Gateway Service Builder The SAP Gateway systems in which you want to register the service must be configured under the following path: SPRO > SAP NetWeaver > SAP Gateway Service Enablement > Backend OData Channel > Connection Settings to SAP Gateway > SAP Gateway Settings © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 30 Register and activate service A custom Gateway Service is always developed on top of the Gateway backend AddOns. In order to expose our new Gateway Service to the outside world, we must create an entry in the Service Catalogue on the Gateway Hub server. Gateway Hub External Name ERP or Business Suite External Name Gateway Service Catalogue Gateway Server AddOns © 2016 SAP SE or an SAP affiliate company. All rights reserved. Registered Service Data Provider Class Registered Model Model Provider Class Gateway Service Gateway Backend AddOns Customer 31 Maintain service on the hub /IWFND/MAINT_SERVICE © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 32 Test the Gateway service on the hub The registered service can be tested using the • Gateway Client • Browser © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 33 Test the Gateway service using the Gateway Client – Service document Gateway client supports all http methods • GET • POST • PUT • PATCH • DELETE • and other http options © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 34 Service Development – Step-by-step Create a new project Create entity type “Product” by DDIC structure import Service Development To get started go to transaction /nSEGW This launches the SAP NetWeaver Gateway Service Builder © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 36 Service Development Click on the “Create Project” icon to create a new project Enter a project name and a description Leave the default values for “Project Type” and “Generation Strategy” Click on “Local Object” © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 37 Service Development Import DDIC Structure to create the entity - Product Right click on Data Model and select Import -> DDIC structure © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 38 Service Development Enter -“Product” as the name for our new Entity -“BAPI_EPM_PRODUCT_HEADER” in the ABAP Structure field Note the default selections for “Entity Type” and “Create Default Entity Set” © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 40 Service Development We can now select the fields of the structure which we want to include in our new Product entity type. Click the highlighted box beside the structure name to select all of the fields in the structure be included in the new Product entity. Click next to continue © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 42 Service Development On this screen we can define the key fields of the entity type and alter the property names or labels as required. Designate the PRODUCT_ID as a key field by clicking the “Is Key” box shown Entity type name and property names will be derived from DDIC structure Entity type name and property names can be beautified EDM data types are derived from standard mapping Label information is derived from DDIC descriptions © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 43 Service Development Click “Finish” to create the new Entity type Product with our selections. © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 44 Service Development You should see a success message as shown on this screenshot © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 45 Service Development We can now see our newly created Entity type under the path >Data Model >Entity Types © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 46 Service Development Note that a default entity set “ProductSet” was created automatically for us based on our selection on the initial screen of the Import from DDIC wizard. Double click on the entity set name “ProductSet” © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 47 Service Development Enter “Products” for the name of the Entity Set © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 48 Service Development Ensure the Addressable option is set for the entity type and click save © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 49 Service Development Click on the Generate icon to generate the runtime objects(Data Provider and Model Provider classes) Leave the default values and click continue © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 50 Service Development Choose Local Object © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 51 Service Development Ensure the runtime objects have been generated successfully © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 52 Service Development Register and activate the service Expand the Service Maintenance folder and click on the Gateway Hub system*, in our case GW HUB 702, where you wish to register and activate the service. *See next slides for information on GW Hub maintenance © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 53 Service Development The Service Maintenance offers the following functions: Registering the service in an SAP Gateway system. Viewing all the SAP Gateway systems in which the service is registered. Navigating to SAP Gateway Client from Service Builder Viewing the error log of the service in the registered SAP Gateway systems Viewing the service activation status of the service in the registered SAP Gateway systems. © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 54 Service Development Prerequisite for “Service Maintenance” in the Gateway Service Builder The SAP Gateway systems in which you want to register the service must be configured under the following path: SPRO > SAP NetWeaver > SAP Gateway Service Enablement > Backend OData Channel > Connection Settings to SAP Gateway > SAP Gateway Settings © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 55 Service Development The screenshots below show how the details in Service Maintenance in the Service Builder are taken from the SPRO customizing settings SERVICE BUILDER © 2016 SAP SE or an SAP affiliate company. All rights reserved. SPRO SETTINGS Customer 56 Service Development Select your Hub system and click on Register © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 57 Service Development Press F4 in the System Alias field to get a list of available aliases for selection Select your alias and continue See next slides for information on where the alias is maintained. © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 58 Service Development In transaction SPRO open the SAP Reference IMG and navigate to: SAP NetWeaver >SAP Gateway >OData Channel >Configuration >Connection Settings >SAP Gateway to SAP System >Manage SAP System Aliases © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 59 Service Development Select your alias and continue In our example we select the alias “LOCAL” and click the green tick to continue © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 60 Service Development SPRO on the Gateway 1. System Alias Configuration /IWFND/MAINT_SERVICE 2. 3. 1. System aliases, maintained in SPRO on the Gateway, are pointers from the HUB to the backend systems 2. All OData services registered on the Gateway are maintained against an Alias 3. The alias determines in which backend system the OData service is to be executed © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 61 Service Development Leave the default values and enter $tmp as the package and choose Enter Note the technical service name here – this will be used in the URL to call the OData service from the Gateway Client or in a browser © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 62 Service Development Verify the service has been registered and activated successfully © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 63 Service Development To test the service click on “SAP Gateway Client” to open the Gateway client on the Hub system from the current system © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 64 Service Development The URI for our service “/sap/opu/odata/sap/ZGW_ODATA_PROJECT_SRV/?$format=xml” is entered in the Request URI field – Press Execute to display the service document of our newly created service © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 65 Service Development Note: ZGW_ODATA_PROJECT is the External Service Name that was registered before. © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 66 Service implementation Query - GET_ENTITY_SET Read - GET_ENTITY Create - CREATE_ENTITY Update - UPDATE_ENTITY Delete - DELETE_ENTITY Service Builder – Service implementation OData Service Definition in SEGW Data Model Definition (MPC) Service Implementation (DPC) Declarative Model Definition* Import Data Model (EDMX) Code-Based Implementation* Code-Based Extensions* Service Maintenance © 2016 SAP SE or an SAP affiliate company. All rights reserved. Import DDIC/ RFC/BOR Interface* Map RFC/BOR Operation* Service Registration and Hub Activation Redefine Data Source Service (GenIL, BOL, SPI, BW Easy Query, MDX) Include Gateway Service* * Repeatable within one service Gateway Backend (SEGW) Gateway Server (/IWFND/MAINT_SERVICE) Customer 68 Implementation The following methods have been generated for each entity set: Create CREATE_ENTITY Delete DELETE_ENTITY Read GET_ENTITY Query GET_ENTITYSET Update UPDATE_ENTITY © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 69 Implementation The following methods have been generated for each entity set: Create CREATE_ENTITY Delete DELETE_ENTITY Read GET_ENTITY Query GET_ENTITYSET Update UPDATE_ENTITY © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 70 Service ImplementationStep by step Code based implementation Service Implementation Implementing the Data Provider Class – GetEntitySet( Query ) In the Service Builder expand the node Service Implementation, then the Entity Set Products and right click on the entry GetEntitySet (Query) Choose Go to ABAP Workbench © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 72 Service Implementation Implementing the Data Provider Class – GetEntitySet( Query ) Confirm the warning that the method PRODUCTS_GET_ENTITYSET has not yet been implemented. Alternatively expand the node Runtime Artifacts and double-click on ZCL_ZGW_ODATA_PROJECT_DPC_EXT © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 73 Service Implementation Implementing the Data Provider Class – GetEntitySet( Query ) In the workbench we now see the list of methods automatically generated from the Odata Channel APIs. These can be redefined for your own use as required. For more information on each of these classes see help.sap.com> SAP Gateway Foundation> SAP Gateway Foundation Developer Guide> APIs and Coding> OData Channel APIs © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 74 Service Implementation Implementing the Data Provider Class – GetEntitySet( Query ) Now redefine the method PRODUCTS_GET_ENTITY_SET -First activate change mode, -Select PRODUCTS_GET_ENTITY_SET -Click Redefine © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 75 Service Implementation Implementing the Data Provider Class – GetEntitySet( Query ) Here in comments you see the sample code provided © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 76 Service Implementation Implementing the Data Provider Class – GetEntitySet( Query ) method PRODUCTS_GET_ENTITYSET. Enter the following code* DATA: lt_return TYPE TABLE OF bapiret2, ls_return TYPE bapiret2, err_msg TYPE string. DATA: ls_message TYPE scx_t100key. CALL FUNCTION 'BAPI_EPM_PRODUCT_GET_LIST' TABLES HEADERDATA = et_entityset RETURN = lt_return. IF lt_return IS NOT INITIAL. The code is provided in the daily material loop at lt_return into ls_return. err_msg = ls_return-message . endloop. ls_message-msgid = 'SY'. ls_message-msgno = '002'. ls_message-attr1 = err_msg. RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception EXPORTING textid = ls_message. ENDIF. endmethod. © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 77 Service Implementation Implementing the Data Provider Class – GetEntitySet( Query ) Perform a syntax check and activate the method © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 78 Service Implementation Implementing the Data Provider Class – GetEntitySet( Query ) Click the back arrow to return to the service builder to access the Gateway Client and test the implementation © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 79 Service Implementation Implementing the Data Provider Class – GetEntitySet( Query ) Click on Service Implementation and then click on “SAP Gateway Client” Alternatively you can go to transaction /n/IWFND/GW_CLIENT in the Gateway Hub system © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 80 Service Implementation Implementing the Data Provider Class – GetEntitySet( Query ) To test the implementation provide the following URI to get the Product Collection: /sap/opu/odata/sap/Z GWODATA_PROJECT _SRV/Products Now we see the list of all of the Products returned © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 81 Service Implementation Implementing the Data Provider Class – GetEntity( Read ) In the Service Builder expand the node Service Implementation, drill down to the entity set Products and expand the same. Right click on the GetEntity method and select Go to ABAP Workbench © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 82 Service Implementation Implementing the Data Provider Class – GetEntity( Read ) Confirm the message “Operation PRODUCTS_GET_ENTITY has not yet been implemented” © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 83 Service Implementation Implementing the Data Provider Class – GetEntity( Read ) Scroll down to the method PRODUCTS_GET_ENTITY Switch to the edit mode Choose redefine © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 84 Service Implementation Implementing the Data Provider Class – GetEntity( Read ) Enter the following code* Perform a syntax check and activate your code *Provided in daily download content © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 85 Service Implementation Implementing the Data Provider Class – GetEntity( Read ) To test the GetEntity method run the service using the Gateway client to retrieve the details of the product with the ID 'AD-1000'. To do so enter the following URL in the Gateway Client /sap/opu/odata/sap/ZGW_ODATA_PROJECT_SRV/Products('AD-1000') © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 86 Service Implementation Implementing the Data Provider Class – GetEntity( Read ) © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 87 Service Implementation Implementing the Data Provider Class – UPDATE In SEGW right click on the Update method and choose Go to ABAP Workbench © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 88 Service Implementation Implementing the Data Provider Class – UPDATE Scroll down to the method PRODUCTS_GET_EN TITY Switch to the edit mode Choose redefine © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 89 Service Implementation Implementing the Data Provider Class – UPDATE Enter the following code* Perform a syntax check and activate your code *Code provided in daily materials © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 90 Service Implementation Implementing the Data Provider Class – UPDATE To test the Update method in the Gateway client use the results of the newly created Product GetEntity as source, so -Firstly perform a GET with the URL /sap/opu/odata/sap/ZGW_ODATA_PROJECT_SRV/Products('AD-1000') -Select Use as request -Change the description -Select Http method PUT Click Execute © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 91 Service Implementation Implementing the Data Provider Class – UPDATE Perform a GET to get product details Select Use as Request Edit description Choose HTTP Method PUT Click Execute © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 92 Service Implementation Implementing the Data Provider Class – UPDATE A HTTP return code 204 (No Content) is returned A GET request must be performed to test the changed content © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 93 Service Implementation Implementing the Data Provider Class – UPDATE Perform a GET again to see the results: The new description is displayed © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 94 Data model definition Service Builder – Data model definition OData Service Definition in SEGW Data Model Definition (MPC) Service Implementation (DPC) Declarative Model Definition* Import Data Model (EDMX) Import DDIC/ RFC/BOR Interface* Service Implementation Code-Based Implementation* Map RFC/BOR Code-Based Operation* (Code Extensions* based or mapping) Service Maintenance © 2016 SAP SE or an SAP affiliate company. All rights reserved. Service Registration and Hub Activation Redefine Data Source Service Include (GenIL, SPI, Generation Gateway Service Service* BW Easy Query, MDX) * Repeatable within one service Gateway Backend (SEGW) Gateway Server (/IWFND/MAINT_SERVICE) Customer 96 Data Model Definition Define Data Model via RFC/BOR Interface import In SEGW right click on Data Model, choose Import and RFC/BOR Interface © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 97 Data Model Definition Define Data Model via RFC/BOR Interface import Enter the following values in the wizard and then choose Next: Entity Type Name: SalesOrder Target System: Local Data Source Type: Remote Function Calls Data Source Name:BAPI_EPM_SO_GET_LIST Note a default Entity set will be created for us automatically © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 99 Data Model Definition Define Data Model via RFC/BOR Interface import Expand the SOHEADERDATA node © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 100 Data Model Definition Define Data Model via RFC/BOR Interface import Expand the SOHEADERDATA node and select the following fields: SO_ID, NOTE, BUYER_ID, BUYER_NAME, CURRENCY_CODE, GROSS_AMOUNT, NET_AMOUNT, TAX_AMOUNT © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 101 Data Model Definition Define Data Model via RFC/BOR Interface import In the first line, SO_ID, select the field Is Key and choose Finish: © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 102 Data Model Definition Define Data Model via RFC/BOR Interface import The new entity type SalesOrder is now available in the project © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 103 Data Model Definition Define Data Model via RFC/BOR Interface import To create the SalesOrderItem entity type right click on Data Model and choose Import then RFC/BOR Interface © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 104 Data Model Definition Define Data Model via RFC/BOR Interface import Enter the following values in the wizard and then choose Next: Entity Type Name: SalesOrderItem Target System: Local Data Source Type: Remote Function Calls Data Source Name:BAPI_EPM_SO_GET_LIST © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 105 Data Model Definition Define Data Model via RFC/BOR Interface import Expand the SOITEMDATA node and select the following fields: SO_ID, SO_ITEM_POS, PRODUCT_ID, NOTE, CURRENCY_CODE, GROSS_AMOUNT, NET_AMOUNT, TAX_AMOUNT, QUANTITY, QUANTITY_UNIT © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 106 Data Model Definition Define Data Model via RFC/BOR Interface import In the first and second line, SO_ID, SO_ITEM_POS, select the field Is Key and choose Finish: © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 107 Data Model Definition Define Data Model via RFC/BOR Interface import The newly created SalesOrderItem entity type in now available © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 108 Data Model Definition Define Data Model via RFC/BOR Interface import To beautify the entity sets for the previously created entity types expand the node data model and double click on Entity Sets Edit the names as shown in the slide and click save The Addressable field must be selected to create the metadata required by the GWPA plugin © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 109 Data Model Definition Define Data Model via RFC/BOR Interface import To generate the runtime objects choose the Generate pushbutton © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 110 Data Model Definition Define Data Model via RFC/BOR Interface import Check the metadata of the service in the Gateway client to see the new entity sets by executing the URI /sap/opu/odata/sap/ZGW_ODATA_PROJECT_SRV/$metadata © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 112 Data Model Definition Define Data Model via RFC/BOR Interface import You can use the “Add URI Option” $metadata to add different URI options like “sap-dsdebug=true” or “$metadata” easily to the service root URI as shown © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 113 Service implementation Mapping RFC / BOR interfaces to OData model Gateway Service Builder OData Service Definition in SEGW Data Model Definition (MPC) Service Implementation (DPC) Declarative Model Definition* Import Data Model (EDMX) Code-Based Implementation* Code-Based Extensions* Service Maintenance © 2016 SAP SE or an SAP affiliate company. All rights reserved. Import DDIC/ RFC/BOR Interface* Map RFC/BOR Operation* Service Registration and Hub Activation Redefine Data Source Service (GenIL, BOL, SPI, BW Easy Query, MDX) Include Gateway Service* * Repeatable within one service Gateway Backend (SEGW) Gateway Server (/IWFND/MAINT_SERVICE) Customer 115 Service Implementation Map fields of the RFC interface to the Sales Order Query operation Expand the node Service Implementation SalesOrderCollection and right-click GetEntitySet (Query) and select Map to Data Source: © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 116 Service Implementation Map fields of the RFC interface to the Sales Order Query operation In the map to data source window, enter the following values and choose Enter: Target System: Local Data Source Type: Remote Function Call Data Source Name:BAPI_EPM_SO_GET_LIST Note this function module returns a list of results hence it is used for the GetEntitySet(Query) operation © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 117 Service Implementation Map fields of the RFC interface to the Sales Order Query operation Click on Propose Mapping which will complete the mapping with the correct details as the data model has been built based on the same RFC interface © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 118 Service Implementation Map fields of the RFC interface to the Sales Order Query operation Choose the Check pushbutton to verify that the mapping is correct and everything is consistent: © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 119 Service Implementation Map fields of the RFC interface to the Sales Order Read operation Right-click GetEntity (Read) and select Map to Data Source: © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 120 Service Implementation Map fields of the RFC interface to the Sales Order Read operation In the Map to Data Source dialog box, enter the following values and choose Enter: Target System: Local Data Source Type: Remote Function Call Data Source Name:BAPI_EPM_SO_GET_DETAIL Note this function module returns a single result hence it is used for the GetEntity(Read) operation © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 121 Service Implementation Map fields of the RFC interface to the Sales Order Read operation Click on propose mapping and check the data source parameters are correct © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 122 Service Implementation Map fields of the RFC interface to the Sales Order Read operation To create the mapping for an input parameter required by the RFC first choose the append row pushbutton © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 123 Service Implementation Map fields of the RFC interface to the Sales Order Read operation On the new line press F4 to select the entity set property. Doubleclick SoId to select the entry: © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 124 Service Implementation Map fields of the RFC interface to the Sales Order Read operation Expand the SO_ID node from the tree on the right-hand side: © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 125 Service Implementation Map fields of the RFC interface to the Sales Order Read operation This performs the mapping on the input parameter (Sales Order ID to fetch the Sales Order details): Note the arrow direction indicates whether the parameter is an input or export parameter © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 126 Service Implementation Map fields of the RFC interface to the Sales Order Read operation Press the Check pushbutton to verify that the mapping settings are correct and consistent: © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 127 Service Implementation Map fields of the RFC interface to the Sales Order Item Query operation Expand the node Service Implementation SalesOrderItemCollecti on and right-click GetEntitySet (Query) and select Map to Data Source: © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 128 Service Implementation Map fields of the RFC interface to the Sales Order Item Query operation In the Map to Data Source dialog box, enter the following values and choose Enter: Target System: Local Data Source Type: Remote Function Call Data Source Name:BAPI_EPM_SO_GET_DETAIL © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 129 Service Implementation Map fields of the RFC interface to the Sales Order Item Query operation Click on Propose Mapping and check the data source parameters are correct © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 130 Service Implementation Map fields of the RFC interface to the Sales Order Item Query operation Now create an input parameter for the SoID required by the RFM to identify the Sales Order Item Choose the Append row button © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 131 Service Implementation Map fields of the RFC interface to the Sales Order Item Query operation From the input help, select SoId for the new line: © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 132 Service Implementation Map fields of the RFC interface to the Sales Order Item Query operation Expand the SO_ID node from the righthand tree: © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 133 Service Implementation Map fields of the RFC interface to the Sales Order Item Query operation Drag&drop the RFC field SO_ID (from node SO_ID) to the newly created line: © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 134 Service Implementation Map fields of the RFC interface to the Sales Order Item Query operation Choose the Check pushbutton to verify that all mapping settings are correct and consistent: © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 135 Service Implementation Generate runtime objects and test service Choose the Generate pushbutton: © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 136 Service Implementation Generate runtime objects and test service Verify that the runtime objects have been generated successfully: © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 137 Service Implementation Generate runtime objects and test service Start the Gateway Client (Tx /IWFND/GW_CLIENT) in a separate window to run the service. Provide the following URI to get the Sales Order Collection: /sap/opu/odata/sap/ZGW_ODATA_PROJECT_SRV/SalesOrderCollection Tip: Use the “EntitySet” button to easily select the available entity set for your service without typing © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 138 Service Implementation Generate runtime objects and test service Execute the Get request to test the service © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 139 © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 140 Service Implementation Generate runtime objects and test service Choose any sales order entry and use the URI to navigate to the sales order detail, for example: /sap/opu/odata/sap/ZGWODATA_PROJECT_SRV/SalesOrderCollection('500000001') © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 141 Service Implementation Generate runtime objects and test service Get the related sales order line items via the following URL: /sap/opu/odata/sap/ZGWODATA_PROJECT_SRV/SalesOrderItemCollection/?$filter=SoId eq '500000001' © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 142 Service Implementation Model Association and Navigation properties To enable navigation between the sales order header data and the related line item information an association must be created between the two entities Double-click Associations: © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 143 Service Implementation Model Association and Navigation properties Choose the Create pushbutton: Enter the following values and click save: Name: SalesOrderSalesOrderItems Principal Entity: SalesOrder Principal Entity Cardinality: 1 Dependent Entity: SalesOrderItem Dependent Entity Cardinality: M © 2016 SAP SE or an SAP affiliate company. All rights reserved. (or select from input help) (or select from input help) (or select from input help) (or select from input help) Customer 144 Service Implementation Model Association and Navigation properties Double click on Referential Constraints © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 145 Service Implementation Model Association and Navigation properties Choose the Create pushbutton Enter the following values and choose Save: Principal Key: SoId (or select from input help) Dependent Property: SoId (or select from input help) © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 146 Service Implementation Model Association and Navigation properties To create a Navigation Properties expand the Sales Order Entity type and double click on Navigation Properties © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 147 Service Implementation Model Association and Navigation properties Choose the Create pushbutton: Enter the following values and choose Save: Name: SalesOrderItems Relationship Name: SalesOrderSalesOrderItems © 2016 SAP SE or an SAP affiliate company. All rights reserved. (or select from input help) Customer 148 Service Implementation Model Association and Navigation properties Generate the runtime objects and test the service © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 149 Service Implementation Model Association and Navigation properties Verify that the runtime objects have been generated successfully: © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 150 Service Implementation Model Association and Navigation properties Start the Gateway Client (Tx /IWFND/GW_CLIENT) in a separate window to run the service. Provide the following URI to get the metadata for the service: /sap/opu/odata/sap/ZGW_ODATA_PROJECT_SRV/$metadata © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 151 Service Implementation Model Association and Navigation properties Now the navigation link /SalesOrderItems can be used to navigate to the line items. /sap/opu/odata/sap/ZGW_ODATA_PROJECT_SRV/SalesOrderCollection('500000001')/Sal esOrderItems © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 152 Service Implementation Consume the service via browser Double click on Service Maintenance and then click on Maintain © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 153 Service Implementation Consume the service via browser Select the service and choose Call Browser © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 154 Service Implementation Consume the service via browser Select Allow this one time and choose Ok: © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 155 Service Implementation Consume the service via browser Enter the login details and click Log In © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 156 Service Implementation Consume the service via browser Adjust the URI to consume the SalesOrderCollection followed by the parameter sap-ds-debug=true /sap/opu/odata/sap/ ZGW_ODATA_PROJECT_SRV/SalesOrderCollection adding the parameter sap-ds-debug=true © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 157 Service development Data model definition using EDMX Import Gateway Service Builder – outside in approach OData Service Definition in SEGW Data Model Definition (MPC) Service Implementation (DPC) Declarative Model Definition* Import Data Model (EDMX) Code-Based Implementation* Code-Based Extensions* Service Maintenance © 2016 SAP SE or an SAP affiliate company. All rights reserved. Import DDIC/ RFC/BOR Interface* Map RFC/BOR Operation* Service Registration and Hub Activation Redefine Data Source Service (GenIL, BOL, SPI, BW Easy Query, MDX) Include Gateway Service* * Repeatable within one service Gateway Backend (SEGW) Gateway Server (/IWFND/MAINT_SERVICE) Customer 160 Import a data model Prequisite: - Create ab EDMX file using Visual Studio - Use an $metadata file of an existing OData service All nodes in SEGW will be populated with the OData artifacts available in the EDMX file: • Entity Types • Entity Sets • Complex Types • Associations • Association Sets • Function Imports © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 161 Expert Guided Implementation: Checkpoint Day 2 Day 2 Empowering lesson SAP expert demonstrates how to create OData services with SAP Netweaver Gateway Service Builder What has been covered by the SAP Expert in the Empowering session: SAP expert demonstrates service development step by step using the SAP Netweaver Gateway Service Builder (Web session, 2 h. in the morning) Execution by customer Customer uses the Gateway Service builder to build their own example OData service (Remote support in the afternoon) Goal of the day Customer enabled for Service Development using Gateway Service Builder © 2016 SAP SE or an SAP affiliate company. All rights reserved. What has been achieved after Empowering session : Customer enabled to develop services using the Gateway Service Builder Customer 162 Expert Guided Implementation How to get help How to get help Customer brendan.conroy@sap.com +35314717198 SAP Expert During the execution part you have direct access to the Expert via telephone number to solve questions quickly. © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 163 Thank You! © 2016 SAP SE or an SAP affiliate company. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP SE or an SAP affiliate company. SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) in Germany and other countries. Please see http://global12.sap.com/corporate-en/legal/copyright/index.epx for additional trademark information and notices. Some software products marketed by SAP SE and its distributors contain proprietary software components of other software vendors. National product specifications may vary. These materials are provided by SAP SE or an SAP affiliate company for informational purposes only, without representation or warranty of any kind, and SAP SE or its affiliated companies shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP SE or SAP affiliate company products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty. In particular, SAP SE or its affiliated companies have no obligation to pursue any course of business outlined in this document or any related presentation, or to develop or release any functionality mentioned therein. This document, or any related presentation, and SAP SE’s or its affiliated companies’ strategy and possible future developments, products, and/or platform directions and functionality are all subject to change and may be changed by SAP SE or its affiliated companies at any time for any reason without notice. The information in this document is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. All forwardlooking statements are subject to various risks and uncertainties that could cause actual results to differ materially from expectations. Readers are cautioned not to place undue reliance on these forward-looking statements, which speak only as of their dates, and they should not be relied upon in making purchasing decisions. © 2016 SAP SE or an SAP affiliate company. All rights reserved. Customer 165