Professional Documents
Culture Documents
Adding Custom Fields To Sap Fiori Apps in 3 Steps. Odata Fields Extensibility
Adding Custom Fields To Sap Fiori Apps in 3 Steps. Odata Fields Extensibility
SAP Fiori Approve Purchase Orders/ SAP Fiori Approve Purchase Requisitions
Applicable Releases:
SAP Fiori Approve Purchase Orders 1.0
SAP Fiori Approve Purchase Requisitions 1.0
SAP NetWeaver Gateway 2.0 SP 06
Version 1
June 2013
All other produc t and s er vic e names mentioned ar e the trademar ks of their res pecti ve c ompani es. Data c ontai ned i n this document s er ves i nfor mati onal pur poses onl y. National pr oduct specific ati ons may var y.
The infor mation i n this document is pr oprietar y to SAP. N o part of this doc ument may be reproduc ed, c opi ed, or trans mitted i n any form or for any purpose without the expres s prior written per mission of SAP AG.
This doc ument is a preli minar y versi on and not subj ect to your lic ens e agreement or any other agreement with SAP. T his doc ument c ontai ns onl y intended s trategies , develop ments, and func tionalities of the SAP® pr oduc t and is not i ntended to be bi ndi ng upon SAP to any parti cular course of busi ness, pr oduct str ateg y, and/or development. Pleas e note that this doc ument is s ubjec t to c hang e and may be c hanged by SAP at any time without notice.
SAP ass umes no r esponsibility for err ors or omissi ons in this doc ument. SAP does not warrant the ac cur ac y or c ompl eteness of the infor mation, text, graphics , links, or other items contained within thi s materi al. T his document is provi ded without a warranty of any kind, either ex press or i mplied, i ncl udi ng but not li mited to the i mpli ed warr anties of merc hantabil ity, fitnes s for a partic ular purpos e, or non-infri ngement.
SAP s hall have no li ability for damages of any ki nd including without li mitation direc t, s pecial, indirec t, or c onsequenti al damages that may res ult from the us e of thes e materi als. T his li mitati on shall not appl y i n c as es of i ntent or gross negligenc e.
The statutor y liability for personal inj ur y and defec ti ve pr oduc ts is not affec ted. SAP has no c ontrol over the infor mation t hat you may acc ess thr oug h the use of hot links c ontai ned i n these materi als and does not endors e your us e of thir d-party Web pages nor provi de any warranty whatsoever rel ating to third-party Web pages.
Business Objects and the Business Objects logo, BusinessObjects, Crystal practical business context, it is not implied that those features and
Reports, Crystal Decisions, Web Intelligence, Xcelsius, and other Business procedures are the only approach in solving a specific business problem
Objects products and services mentioned herein as well as their respective using SAP NetWeaver. Should you wish to receive additional information,
logos are trademarks or registered trademarks of Business Objects clarification or support, please refer to SAP Consulting.
Software Ltd. Business Objects is an SAP company. Any software coding and/or code lines / strings (“Code”) included in this
Sybas e and Adapti ve Ser ver, i Anywhere, Sybas e 365, SQL Anywher e, and other Sybase pr oduc ts and s er vic es mentioned herei n as well as their r es pec ti ve logos ar e tra demar ks or registered trademar ks of Sybase, Inc. Sybas e is an SAP c ompany.
Disclaimer
Some components of this product are based on Java™. Any code change
in these components may cause unpredictable and severe malfunctions
and is therefore expressively prohibited, as is any decompilation of these
components.
Any Java™ Source Code delivered with this product is only to be used by
SAP’s Support Services and may not be modified or altered in any way.
Document History
Document Version Description
2. Architecture .......................................................................................................................... 2
2.1 Overview ............................................................................................................................ 2
2.2 Test OData services [Gateway] ....................................................................................... 3
3. Implementation .................................................................................................................... 6
3.1 Step 1 . Extend the OData Entity in the GW Model Provider by implementing BAdI
[ERP] .................................................................................................................................. 6
3.2 Step 2 . Extend the corresponding ABAP DDIC Structure by Append Structure
[ERP] .................................................................................................................................. 6
3.3 Step 3. Fill data to the custom fields in the GW Data Provider by implementing
BADI [ERP] .......................................................................................................................12
1. Business scenario
Adding custom fields in SAP Fiori apps UI is common requirement from customers. Customers have
custom fields in ERP backend applications. You are a consultant to enable those customer fields in
SAP Fiori apps.
There are 2 how to guides for adding custom fields.
Part 1: Adding custom fields to SAP Fiori apps in 3 steps. OData fields extensibility.
Part 2: Adding custom fields to SAP Fiori apps. UI fields extensibility.
Steps are also same for SAP Fiori Approve Purchase Requisitions.
Note: The standard delivered BADI is different in each app. Please look at the Installation and
Configuration Guide in the http://help.sap.com/fiori and also look at details in the transaction SE18 and
SE80
1.2 Prerequisites
- SAP Fiori Approve Purchase Order is up and running.
- You have ABAP programming knowledge.
June 2013 1
Adding custom fields to SAP Fiori apps in 3 steps. OData fields extensibility.
2. Architecture
2.1 Overview
The OData components are installed on SAP Business Suite backend.
It has Model Provider Class and Data Provider Class and methods have enhancement spots which
call BAdI (Business Add In) implementations.
June 2013 2
Adding custom fields to SAP Fiori apps in 3 steps. OData fields extensibility.
June 2013 3
Adding custom fields to SAP Fiori apps in 3 steps. OData fields extensibility.
4. Get a workitem ID
/sap/opu/OData/SAP/GBAPP_POAPPROVAL/WorkflowTaskCollection?$filter=TaskType eq
'TS20000166'&$top=1
/sap/opu/OData/SAP/GBAPP_POAPPROVAL/Wor kfl owTas kColl ecti on?$filter=T as kT ype eq 'TS20000166'&$top= 1
June 2013 4
Adding custom fields to SAP Fiori apps in 3 steps. OData fields extensibility.
At the end of this How to Guide, you see Purchasing Group data in here. It means the OData
service provides Purchasing Group value and HTML5 UI can consume it.
June 2013 5
Adding custom fields to SAP Fiori apps in 3 steps. OData fields extensibility.
3. Implementation
3.1 Step 1 . Extend the corresponding ABAP DDIC Structure by
Append Structure [ERP]
In the step 1, you are going to add the field „Purchasing Group“ in the structure of entity.
1. Open the structure
Transaction: SE80
Structure: GBAPPS_PO_HEADER_DETAILS and GBAPPS_PO_WORKFLOW_TASK
June 2013 6
Adding custom fields to SAP Fiori apps in 3 steps. OData fields extensibility.
6. Activate the Append Structure. You should see the ZZEKGRP in the Structure
GBAPPS_PO_HEADER_DETAILS.
June 2013 7
Adding custom fields to SAP Fiori apps in 3 steps. OData fields extensibility.
June 2013 8
Adding custom fields to SAP Fiori apps in 3 steps. OData fields extensibility.
You have option for copying the sample class. In this guide, we copy the sample class.
June 2013 9
Adding custom fields to SAP Fiori apps in 3 steps. OData fields extensibility.
13. Go to change mode and add “ZPurchasingGroup” property in both entity “WorkflowTask” and
“HeaderDetail”.
The UI screenshot helps you to understand why you handle 2 entity types.
Remember that you have looked at the meta deta definition in the section 2.2.
June 2013 10
Adding custom fields to SAP Fiori apps in 3 steps. OData fields extensibility.
Program Code:
-------------------------------------------------------------------
METHOD if_gbapp_ex_apv_po_mdp~enhance_gw_service_entity_mdp.
IF iv_entity_type_name = 'HeaderDetail' OR
iv_entity_type_name = 'WorkflowTask'.
lo_property = io_entity_type-
>create_property( iv_property_name = 'ZPurchasingGroup' iv_abap_fieldname = 'ZZEKGRP' ).
lo_property->set_nullable( abap_true ).
ENDIF.
ENDMETHOD.
-------------------------------------------------------------------
June 2013 11
Adding custom fields to SAP Fiori apps in 3 steps. OData fields extensibility.
3.3 Step 3. Fill data to the custom fields in the GW Data Provider
by implementing BADI [ERP]
In the step 3, you are going to implement a BAdI method which fills “Purchasing Group” value in the
Data Provider class.
1. Open the Enhancement Spot.
Transaction: SE18
Enhancement Spot: GBAPP_APV_PO
You have option for copying the sample class. In this guide, we copy the sample class.
June 2013 12
Adding custom fields to SAP Fiori apps in 3 steps. OData fields extensibility.
June 2013 13
Adding custom fields to SAP Fiori apps in 3 steps. OData fields extensibility.
6. Check the Method definition and find the field you have to fill the value.
Select the menu Goto -> Method Definition.
June 2013 14
Adding custom fields to SAP Fiori apps in 3 steps. OData fields extensibility.
ZZEKGRP is there.
lv_po_number = cs_header_details_x-po_number.
ENDMETHOD..
-------------------------------------------------------------------
June 2013 15
Adding custom fields to SAP Fiori apps in 3 steps. OData fields extensibility.
Program Code:
-------------------------------------------------------------------
METHOD IF_GBAPP_EX_APV_PO_RDP~CHANGE_WORKFLOW_TASK_API.
ENDMETHOD..
-------------------------------------------------------------------
June 2013 16
Adding custom fields to SAP Fiori apps in 3 steps. OData fields extensibility.
June 2013 17
Adding custom fields to SAP Fiori apps in 3 steps. OData fields extensibility.
4.4 UI extensibility
The next step is you are going to display the Purchasing Group field in the UI. Please refer to the
separate How to Guide “Adding custom fields to SAP Fiori apps. UI fields extensibility”.
June 2013 18
Adding custom fields to SAP Fiori apps in 3 steps. OData fields extensibility.
June 2013 19
www.sap.com/contactsap
www.sdn.sap.com/irj/sdn/howtoguides