Monday, 2 September 2019

Custom KPIs for Cross Project Overview and Multi Project Overview Fiori Applications

INTRODUCTION


This Enhancement is used to extend Cross Project Overview Application and Multi Project Overview Application in SAP S/4HANA Commercial Project Management. Here, the purpose is to display below Custom KPIs

◈ ZCFA – Capex
◈ ZTNP – Transaction price

Cross Project Overview:

The following steps are followed to display custom KPIs in Cross Project Overview:

1. Creation of required custom KPI IDs through customization in implementation guide (SPRO settings)
2. Implementation of BADI /CPD/PWSSE_MP_KPI to get the values for custom KPIs

Multi Project Overview: 

The following steps are followed to add custom KPIs in multi project Overview:

1. Creation of Required custom KPI IDs through customization in implementation guide (SPRO settings)
2. Extension of the standard application CPD_MASTERPROJECT_OVERVIEW through gateway service and web IDE
3. Implementation of BADI /CPD/PWSSE_MP_KPI to get the custom values for custom KPIs

STEP1: CUSTOMIZATION in SPRO

All custom KPIs that are maintained will appear in both cross project overview and multi project overview FIORI apps

1. The custom KPIs to be added are maintained at the SPRO setting

Path: Master data -> Commercial Project -> Define KPIs

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

2. Define the KPI name, sequence number and description.

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

STEP2: BADI IMPLEMENTATION


CROSS PROJECT APP

1. Create Implementation for BADI /CPD/PWSSE_MP_KPI
2. Execute Method

◈ Importing parameter IV_MP_GUID contains the project ID and IV_MP_KPI_ID contains KPI ID
◈ Corresponding Actual data and planned data are passed to exporting parameter EV_ACTUAL_DATA & EV_PLANNED_DATA.

3. GET_EXP_DATA_TYPES Method

◈ Exporting field EV_OUT_DATA_TYPE is populated with the type of the actual and planned data

MULTI PROJECT APP

BADI Implementation

1. Create Implementation for BADI /CPD/PWSSE_MP_KPI

2. Execute Method

◈ Importing parameter IT_MP_GUID contains all the project IDs and IV_MP_KPI_ID contains KPI ID which is common for all the projects
◈ Corresponding actual data planned data and variance data are passed to exporting parameter ET_DATA.

3. GET_EXP_DATA_TYPES Method

◈ Importing parameter IV_MP_KPI_ID contains KPI ID
◈ Exporting field EV_OUT_DATA_CHARACTERISTIC and EV_OUT_DATA_TYPE is populated with the type of the actual and planned data
◈ Based on KPI ID exporting field EV_ACTUAL_FIELD_NAME, EV_PLAN_FIELD_NAME and EV_VARIANCE_FIELD_NAME

STEP3: APP EXTENSION


MULTI PROJECT APP

Custom KPI fields are to be added in the data model and the fields are to be added in the UI layout through web IDE

Add fields in Data Model 

◈ Add role SAP_NW_APS_EXT_CFD & SAP_NW_APS_EXT_CFL_APP
◈ Log on to the SAP Fiori Launchpad with a user assigned with Business Catalog SAP_CORE_BC_EXT
◈ Select the app “Custom Fields and Logic”.

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

◈ Click the ‘+’ (plus sign) button to add a new field.

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

◈ When the popup opens, select the commercial project KPI Business Context(/CPD/MASTER_PROJECT_KPI) from the above table, Fill other necessary details like label, type etc

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

◈ Click “Create and Edit” button
◈ In the tab “UIs and Reports” enable Master project Header details for KPI and master project KPI and Click “Save” and “Publish” buttons.

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

◈ Once the extended field ZZ1_TEST_KPI is successfully published, it will be part of the metadata of the OData service and the corresponding database include

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

After adding above fields (Required KPI fields) , these fields are available in Layout without graph or color.

To display fields with chart and color, so changes are to be made in the layout

Steps to add fields /change fields in Layout

◈ In the WEBIDE Application, Extension project is created in the workspace folder

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

◈ In the select application dropdown box, SAPUI5 ABAP repository is selected

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

◈ The system and the name of the application is selected

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

◈ Extension Name and Version is provided if required

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

◈ The finish button is pressed to open the application in preview mode

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

◈ In the workspace, the Project will gets created with all required components but with an empty view

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

◈ The extensions are viewed in the extensibility mode

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

◈ In outline menu, Select show extension points to display all possible extension points

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

◈ In our Application we want to add custom fields in KPIs.

First extend header level

1. select header KPI and extend view/ Fragment
2. Click on create extended view to create the view

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

◈ After creating extension, view entry is to be added in MANIFEST.JSON with extended components

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

◈ Add below Code for Custom field header in KPIs

<Column
cd:p13nData="{columnKey:'TransactionPriceP', leadingProperty:'TransactionPrice', additionalProperty:'Currency,TransactionPrice,TransactionPriceV,CostColor'}"
hAlign="Center" vAlign="Middle" width="10rem" id="cpaKpiZTPC" visible="false">
<Text text="Transaction Price (Current Vs Last Month)" tooltip=""/>
</Column>

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

◈ Repeat above steps for extending items

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

◈ Copy below code for adding Custom KPI item

<l:VerticalLayout>
    <FlexBox height="5rem" width="10rem">
<suim:DeltaMicroChart isResponsive="true" size="Auto" title1="{i18n>KPI_PLAN}"      title2="{i18n>KPI_ACTUAL}"  
value1="{parts:['TrasactionPriceP'], 
formatter:'icd.cpa.commercial.projectss1.model.formatter.parseDecimalValue'}"
value2="{parts:['TransactionPrice'],  formatter:'icd.cpa.commercial.projectss1.model.formatter.parseDecimalValue'}"
displayValue1="{parts:['TransactionPriceP'], formatter:'icd.cpa.commercial.projectss1.model.formatter.formatCurrencyShort'}"
displayValue2="{parts:['TransactionPrice'], formatter:'icd.cpa.commercial.projectss1.model.formatter.formatCurrencyShort'}"
deltaDisplayValue="{parts:['TransactionPriceV'], formatter:'icd.cpa.commercial.projectss1.model.formatter.formatCurrencyShort'}"
color="{= ${CostColor} ? ${CostColor} : 'Neutral'}" press="_onChartPressed"/>
</FlexBox>
<Text text="{Currency}" width="100%" textAlign="End"/>
</l:VerticalLayout>

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

◈ Press save and run the application

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

◈ when run the application it will open default view open

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

◈ Press setting button to display all columns with custom fields

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

◈ Select required / custom field as seen in this case where the Capex/CFA field had been added in the only ODATA entity type and Transaction price had been added in UI5 extended layout and ODATA entity type

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

◈ Deploying application in Fiori App.

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

◈ Select project and deploy application as ABAP repository and select target system

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

◈ Provide App Name , Description and Package

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

◈ Provide transport request to move other systems.

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

◈ Once successfully deployed application then in project .dist folder will create as shown in below

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

Conclusion: After completing above steps Custom KPI will available in Multi project overview Page

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

SAP ABAP Certifications, SAP ABAP Learning, SAP ABAP Tutorials and Materials, SAP ABAP Guides, SAP ABAP Online Exam

No comments:

Post a Comment