Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
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.
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.
Document History
Document Version
Description
Typographic Conventions
Icons
Type Style
Description
Icon
Example Text
Example text
Emphasized words or
phrases in body text, graphic
titles, and table titles
Example text
Example text
<Example text>
EXAMPLE TEXT
Description
Caution
Note or Important
Example
Recommendation or Tip
Table of Contents
1.
2.
3.
4.
1.2
Prerequisites ....................................................................................................................... 1
Architecture .......................................................................................................................... 2
2.1
Overview ............................................................................................................................ 2
2.2
Implementation .................................................................................................................... 6
3.1
Step 1 . Extend the OData Entity in the GW Model Provider by implementing BAdI
[ERP] .................................................................................................................................. 6
3.2
3.3
Step 3. Fill data to the custom fields in the GW Data Provider by implementing
BADI [ERP] .......................................................................................................................12
4.2
4.3
4.4
UI extensibility ................................................................................................................. 18
Adding custom fields to SAP Fiori apps in 3 steps. OData fields extensibility.
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.
1.1
Sample scenario
In this How to Guide we will show you how to add the Purchasing Group field in SAP Fiori Approve
Purchase Orders.
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
June 2013
Adding custom fields to SAP Fiori apps in 3 steps. OData fields extensibility.
2.
2.1
Architecture
Overview
It has Model Provider Class and Data Provider Class and methods have enhancement spots which
call BAdI (Business Add In) implementations.
June 2013
Adding custom fields to SAP Fiori apps in 3 steps. OData fields extensibility.
2.2
June 2013
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
Adding custom fields to SAP Fiori apps in 3 steps. OData fields extensibility.
5.
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
Adding custom fields to SAP Fiori apps in 3 steps. OData fields extensibility.
3.
Implementation
3.1
In the step , 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
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
Adding custom fields to SAP Fiori apps in 3 steps. OData fields extensibility.
3.2
In the step 2, you are going to implement a BAdI method which adds Purchasing Group property in
the Model Provider class.
8. Display Enhancement Spot
Transaction: SE18
Enhancement Spot: GBAPP_APV_PO
June 2013
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
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.
DATA: lo_property
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
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.
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.
DATA: lv_po_number TYPE ebeln.
FIELD-SYMBOLS: <ls_workflow_list> TYPE GBAPPS_PO_WORKFLOW_TASK.
LOOP AT CT_WORKFLOW_LIST ASSIGNING <ls_workflow_list>.
lv_po_number = <ls_workflow_list>-po_number.
SELECT SINGLE ekgrp FROM ekko INTO <ls_workflow_list>zzekgrp WHERE ebeln = lv_po_number .
ENDLOOP.
ENDMETHOD..
-------------------------------------------------------------------
June 2013
16
Adding custom fields to SAP Fiori apps in 3 steps. OData fields extensibility.
4.
4.1
4.2
When you changed the Model, you have to clear Gateway cache in both Gateway and ERP
backend.
Transaction: /IWFND/CACHE_CLEANUP on Gateway server
4.3
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