Professional Documents
Culture Documents
CustomerClassitication. +9 ma com aPe aed Blnane + Gata Model | © Totus > Chery Types » Ciasocatine » Gaenaty sat > Clasocatin s © Giserce ingen * ep cistome > etnvciel it » Coruntne art ar Caseveenn MPIDEStaSeuce | '25.Select Business Entity as Type and DDIC~Z¥_CDS_cUST as Name. '26.Provide the Elements mapping to the properties. Note: This information is case sensitive, so please use capital letters or just use the F4 help to select the elements from the given list. 27.Save the project and (re-)generate the runtime objects. This generates the necessary getter method. If you're interested on the implementation details, have look at the methods CUSTOMERCLASSIFI_GET § NTITY and CUSTOMERCLASSIFI_GET_E NDITYSET of class 2CL_2E2B_CUST_INFO_DPC (use shorteut ctrI+shi: 36Ey Gateway OData Service to open the class or have a look at the classes in the ‘STP package) Note: You could now savely ‘switch back to the gateway project tab in your HANA Studio (no more need for the additional internal mode created in step 23), but you ‘can as well continue with the “detachted’ SAPGui window. 28.We need two more implementations, ie. the GevEntity method for Customerinfos and the Getentityset method for Invoiceinfos. Navigate to the implementations, via select Go to ABAP Workbench trom the context menu of Service Implementation > Customerinfos > GetEntitySet (Query) [Rt ae DEVLOPEREN £2 © dH e@e@)[ phe Asterina ateniey, Sones cuales, (DG) ss G) els = Q mz cor_nro ‘i Grd 2nd GW Sera » GData Model + Clseceinplentation am Gstomerchssfcatere > so ctemerintes + BcotentrySot —Oeslay + Bupbte a9 a » Chsonvce Martenance Dotals 29.Confirm the information that you didn't implement the method yet. 37Gateway OData Service }30-The ABAP class editor opens |" erysain secretin @ antzr ZEN. LOGE 1 including the class definition ‘Finws 2¢h_2824_CUST_INVO_DPC_EXT definition and impiomentation skelotons |; auton men 4 wx crave we for class creme en 2CL_ZE2E_CUST_INFO_DPC Se, _EXT, whish you'll enhance = with the two missing implementations in the _ following steps. ‘soc 3 In the protected section of the class, define the two methods as redefinitions, PROTECTED SECTION. METHODS invoiceinfos_get_entityset REDEFINITION. METHODS customerinfos_get_entity REDEFINITION. 32.Use the quick-fix to add the unimplemented methods, ie. click on the light-bulb icon and choose Add 2 unimplemented methods. a= '33.Implement the customerinfos_get_entity method: Code snippet: customerinfos_get_entity NETHOD custonerinfos_get_entity. “Entity can only be accessed via the navigation property ToCustonerInfo “of entity type CustonerClassification and if the key CustomerID is provided IF Ay_source_name <> z¢l_ze2e_cust_info_mpe=>ge_custonerclassification. RAISE EXCEPTION TYPE /inbep/cx_mgw_tech_exception. ENDIF. READ TABLE it_key_t IF sy-subre <> 0. RAISE EXCEPTION TYPE /inbep/cx_mgw_busi_exception EXPORTING ‘textid = /inbep/ex_mga_busi_exception= ENDIF. fab INTO DATA(1s_key) WITH KEY name -filter_not_supported. DATA 1v_custoner_id filter TYPE snwd_partner_id. “apply the conversion of snad_partner_id (domain D_ePH_ID) CALL FUNCTION "CONVERSION_EXIT_ALPHA_INPUT" ‘EXPORTING input = 1s key-value "CustomerID" ##NO_TEXT. 38Ey Gateway OData Service TTRPORTING ‘output = lv_custoner_id filter. “create an instance of class zcl_customer_open invoices aTA(1e_cust_info) = NEW zel_customer_open_invoices( ). all the ABAP managed DB procedure respectively the “aBAP class method get_custoner_info lo_cust_info->get_customer_info( EXPORTING iv_client = sy-mande ivibupaid = 1v_customer_id filter IMPORTING et_bpinfo = DATA(It_entity) p “only one line is expected to be retrieved IF lines( It_entity ) © 1. RAISE EXCEPTION TYPE /inbep/cx_mgw_busi_exception EXPORTING message_unlinited = | Problem in Custoner Info { lines( 1t_entity ) } 1 | textid = /Abep/ex_mgu_busi_exception=>business_error_unlinited. ENDIF. “map the first row of 1tentity to the output erentity = It_entity[ 2]. ENONETHOD. 34.Implement the invoiceinfos_get_entityset method: Code snippet: invoiceinfos_get_entityset NETHOD invoiceinfos_get_entityset. ntityset can only be accessed via the navigation property ToInvoicelnfo “of entity type CustonerClassification and if the key CustomerID is provided IF iy_source_nane <> zel_ze2e_cust_info_mpe=>ge_custonerclassification. RATSE EXCEPTION TYPE /iubep/ex_mgu_tech exception. ENDIF. READ TABLE St key tab INTO DATA(Is_key) WITH KEY name = ‘CustomerID’ ##N0_TEXT. IF sy-subre <> 0. RAISE EXCEPTION TYPE /Awbep/cx_mgw_busi_exception EXPORTING ‘textid = /ihbep/ex_mgw_busi_exception=>filter_not_supported. ENDIF. \TA 1v_eustomer_id_filter TVPE snnd_partner_id. “apply the conversion of snwd_partner_id (domain 0_EPM_xD) ‘CALL FUNCTION "CONVERSTON_EXIT_ALPHA_INPUT" EXPORTING input = 1s_key-value IMPORTING ‘output = 1v_custoner_id filter. “create an instance of class zcl_customer_open_invoices aTA(1e_cust_info) = NEW zel_customer_open_invoices( ). all the ABAP managed DB procedure respectively the “ABAP class method get_invoice_info 1o_cust_info->get_invoice_info( EXPORTING 39Gateway OData Service et_invinfo: “provide the resultset of “tabular output parameter et_entityset ENONETHOD. DATA(It_entityset) It_entityset. ‘the NDP to the tabular '35.Save and activate the class (shortcuts cev1+s, ctrl+r3), If you'd like to format / apply the pretty printer remember shortcut Shi ft+Fi ©. inwsAMm.peROPELEN — @ Wes ZH.CUTT MOOREA WF eee ae on, sce 36.Last step is to register the ‘OData service. Go back to transaction SEcw (you might stil have the tab open or use ALt+Fs to open it again). Double-click on Service Maintainance and then on Register. fowl © «eee ipaq ante acta muatey Disw Mis) c= wey aw (nei) we once mmoR ee 0 — Fae freee '37.Confirm the Warning Fer Regier, Mantan ard cr Leg opratons, you wl be xt the slocted system, Do you want to contre?Ey Gateway OData Service /38.Provide the package ST§MP to which the OData service will be added. indicator. /39.f everything went fine you (BIE) i) amet poeta} (eg) can see the registration status ee — insted by me green stats | ile oz aGateway OData Service Would you like to test the GW service? If yes, this can be done in several ways. Ill tell you how to use the Gateway client (transaction /IWEND/GW_CLIENT). information dialog (maybe even with the remember my decision functionality ©). 4. One option how you can | wiaeisor navigate to the gateway mn] © 748 C@@ Ome ONSf BHO client transaction is to click | | SAeMetitemer Gateway Ls. —— on the Maintain icon Delsiela\e)2) Bisies Retin) (es) sesame cain = te ve oe 2. Inthe service maintainance | r= = display, select the service from the service catalog and Glick on the Gateway Client button in the lower right part of the view. 3. Confirm the SAP GUI security Deyouwnte gotten elie yaa cc? or 42Ey Gateway OData Service 4. Check the Request URI (/sap/opa/odata/252E_C UST_INVO_SRV/?$format= smi) and execute (F8) '5. Several more SAP GUI Security information windows | PRESS tetanee teeta eerie appear. Read them carefully | = © or just click allow (and now, | 7" =" _— please remember my ea ree decision!) 6. If everything went fine, you should see a successful HTTP Response (status code 200) and the xml result of the ‘OData request. 7. Repeat the test for the Request URIs: * /sap/opu/odata/sap/28: Metadata of the OData service # /sap/opa/odata/sap/22: 'FO_SRV/Smetadata on: List of Customer Classifications, .e. query on the CDS view (get entity set method of 'FO_SEU/C onerClassi fications CustomerCtassitication) * /sap/opa/odata/sap/2 stomerIngo {Query the customer information for customar ID 100000000 (SAP AG), tachnically executing the customer information AMOP. © /sap/opa/odata/eap/28: voicento {Query the list of sales order invoice information for customer ID 100000000 (SAP AG), technically executing the invoice information AMDP- 25 INFO_sRV/Custonerclassi fications ("100000000") /Tocu oui 'FO_SRV/CustomerClassi fications (*100000000") /rozn 43Gateway OData Service Ey Well done, you finished the implementation and testing of the SAP NetWeaver Gateway Data Service and hence the second to last step on our journey to the Fiori-like application. If you would like to learn more about SAP NetWeaver Gateway and/or contact the experts, please visit htto://scn.sap.com/community/netweaver-gateway.Ey Fiori-like Application 8 Fiori-like Application a WEST .anapnangeie a casi -“ DD». i D>». Gj >=» Ready for the final step? You'll now create a Fior-like application to display the list of Customer Classification Information and to do a drill-down on the detailed customer and open sales order information Technically, the Fiori-ike application is a so-called split application (sap.m.SplitApp - see https://sapuiS. netweaver,ondemand.com/sdk/#content/Overview htm! for details on available Controls, API references, etc.) targeted for mobile devices. In the following, you'll create and develop SAPUIS application locally, where locally means you develop a SAPUIS application in you Eclipse installation. The local SAPUIS application will then be imported to the ABAP backend using the SAPUIS repository team provider. Having provided the application to the ABAP backend, you're ready to run and test your Fiorisike application in the browser. Local SAPUI5 Application Development 1. Right-olick in the Project Explorer view and select New > Other from the context menu. 45Fioriclike Application 2. In the new project wizard, select SAPUIS Application Development > Application Project (to filter for 2.9. sapui eases the search for the corresponding entry). 3. Provide the necessary information for the new application project: ‘+ Project name: 2526 PIORT « Target Device: Mobile ‘+ Options: Create an Initial View (checkbox) 4, Provide the information for the initial view: ‘* Name: Master '* Development Paradigm: XML (radio-button)Ey Fiori-like Application '5. The SAPUIS develoment project is created. You're redirected to the Java EE perspective and the three development artefacts are opened, namely the troller view xm] 6. Implement the inciex htm! file (best thing is to copy/paste everything © Code snippet: index. html <1DOCTYPE HTHL> «script? UI Define path of the ODat var sODataServiceUrl "/sap/opu/odata/sap/ze2e_cust_info_srv"s var o0datatiodel sap.ui model .odata..ODatatiodel (s0DataServicelrl) ; oObataliodel.attachRequestFailed(function() { alert("ODats Request Failed!" ); backend service Ds sap.ui.getCore().setHodel (o0Dataltodel) /{ Tell the Application uhere to find the /1 local resources sap.ui.localResources("ze2=_ Fiori"); / Master & Detail pages vor oftasterPage = sap.ui-view({ id: “idiastert", viewiane : "ze2e fiori.Master", type : sap.ui.core.mve.ViewType. XL Ds Var oDetailPage = sap.ui.view({ “idDetaill", me : "ze2e fiori.Detsil", sap-ui.core.mve, ViewType. XL Ds /1 Split Application Var eSplitapp = new sap.m.Splitapp(); 47