0% found this document useful (0 votes)
67 views20 pages

Manage Asset Retirement Setup Guide

Uploaded by

areeshahabib51
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views20 pages

Manage Asset Retirement Setup Guide

Uploaded by

areeshahabib51
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

SAP BUSINESS TECHNOLOGY PLATFORM | EXTERNAL

Setup Guide
Manage Asset Retirement using SAP Build Process
Automation or SAP Workflow Management
© 2022 SAP SE or an SAP affiliate company. All rights reserved.

1
Table of Contents

Contents
Table of Contents ..........................................................................................................................................................2

Overview .......................................................................................................................................................................3

Required SAP BTP Services ............................................................................................................................................4

Setup and Configuration ................................................................................................................................................5


Configure SAP Build Process Automation ........................................................................................................................ 5
Configure Process Automation Destination ..................................................................................................................................... 5
Configure OAuth2ClientCredentials SAP Build Process Automation Destination (Service Instance) ............................................... 5

Configure SAP Workflow Management ............................................................................................................................ 6


Configure Workflow Email Destination ............................................................................................................................................ 7
Configure OAuth2ClientCredentials Workflow Destination ............................................................................................................. 7
Configure OAuth2ClientCredentials Business Rules Destination ..................................................................................................... 7
Configure Destination to Enable Start & Step Conditions ................................................................................................................ 8
Configure OAuth2ClientCredentials Workflow Destination (Service Instance) ................................................................................ 9

Configure a Destination to SAP S/4HANA system ............................................................................................................ 9


Configure Cloud Integration Destination ......................................................................................................................... 9
Configure Cloud Connector ............................................................................................................................................ 10
Configure RFC Destination ............................................................................................................................................. 11
Configure SAP Central Fiori Launchpad Site for SAP Workflow Management ............................................................... 11
Importing Workflow Start UI Source Code ..................................................................................................................... 12
Add Custom UI Application (as Workflow Start UI) in Fiori Launchpad Site .................................................................. 12

Configure Status Profile & Notification User Status .....................................................................................................14

Configure Custom Function Modules ...........................................................................................................................17


Create Function Group ................................................................................................................................................... 17
Create Remote Enabled Function Module for Creation of Notification ‘INTL’ ............................................................... 17
Create Remote Enabled Function Module to get the Net Book Value ........................................................................... 18
Create Remote Enabled Function Module to Change the Notification Status ‘SUBM’ .................................................. 19
Create Remote Enabled Function Module to Change the Notification Status ‘REJC’ .................................................... 20

2
Overview
This document provides information about configuration steps to consume the workflow package
Manage Asset Retirement. The primary audience of this document is technical IT / system
administrators.
Manage Asset Retirement enables the customer to automate the deactivation of equipment, work
orders, notifications, maintenance plans and retirement of asset. Notification requests for asset
retirement is created from an UI5 application, post which is submitted for approval. After all the
approvals are completed, deactivation process begins. There is a provision to set up variants wherein
the levels of approval needed for the process can be configured. When a requestor creates a
notification request for asset retirement, a preconfigured process variant is triggere d in SAP Build
Process Automation or SAP Workflow Management based on configurable business conditions.
Salient features of this content package are:
• Easily deployable package from SAP BTP Workflow Management Service with minimal
developments in SAP S/4HANA.
• Configure multi-level approval based on various parameters like Company Code, Asset Net Book
value, Plant, Approval Level, Cost Center etc.
• Approvers are determined using a configurable business rule.
• Provisioned with a process admin flow which get triggered in case of process exceptions.
• Exception handling during the asset retirement process to notify the Requestor for corrective
measures.

Disclaimer: Please note that this content package is a template to facilitate custom build
extensions. A full-fledged master data management solution, with data quality management and
governance capabilities is available on SAP Business Technology Platform, please see SAP Master
Data Governance.

3
Required SAP BTP Services
The content package “Manage Asset Retirement” is intended to be used for applications on SAP
S/4HANA (1610 onwards) and requires the following services in SAP Business Technology Platform.
• SAP Build Process Automation or SAP Workflow Management to orchestrate the process.
• SAP Integration Suite to carry out deactivation/closure of workorders, notifications etc.
• SAP Connectivity service (cloud connector) to establish access to SAP S/4HANA on -Premise.
• SAP Cloud Portal service or SAP Launchpad service to access the apps that are involved in the
process.
• SAP Cloud Identity Services - Identity Authentication (optional).
• SAP Business Application Studio or SAP WebIDE to modify/deploy the SAPUI5 applications
(optional).
• SAP BTP Cloud Foundry runtime.

4
Setup and Configuration
The Manage Asset Retirement content package requires SAP Build Process Automation or SAP
Workflow Management subscription or a CPEA contract. Based on which service you plan to use, follow
the appropriate section to configure either SAP Build Process Automation or SAP Workflow
Management.

Configure SAP Build Process Automation


Follow the setup and configuration section of SAP Build Process Automation:
1. Subscribe to SAP Build Process Automation (Standard Plan)
2. Configure Destinations for Live Process Projects
a. Import Package Destination
b. Business Rules Destination to support start and step conditions
3. [Optional] Configure SAP Launchpad Service for SAP Build Process Automation

Configure Process Automation Destination

A HTTP destination is required in the BTP subaccount where SAP Build Process Automation is
subscribed. Create a destination with name “sap_process_automation_service” with the following
configuration if it doesn’t exist already. Please refer how to create a HTTP destination OAuth 2.0
Authentication (client credentials).

Name sap_process_automation_service
Type HTTP
Proxy Type Internet
Authentication OAuth2ClientCredentias
URL <”endpoints”.”api”>
Client ID <"uaa":"clientis”>
Client Secret <"uaa":"clientsecret”>
Token Service URL <"uaa":"url">/oauth/token

Note: While creating the service instance for SAP Build Process Automation service, make sure that at
least the required scopes are assigned (help documentation to enable technical authentication to
access the SAP Build Process Automation APIs). If the scopes are not assigned, you can also update the
service instance with the required scopes.

Configure OAuth2ClientCredentials SAP Build Process Automation Destination (Service


Instance)

Ignore this step if there is already a destination using SAP Build Process Automation service instance

5
created.

Create new destination to call SAP Build Process Automation APIs using a service route from SAP UI5
component. For more details, follow the help document:
https://help.sap.com/viewer/cca91383641e40ffbe03bdc78f00f681/Cloud/en-
US/685f383cebb54c009b2fac633b32c90f.html.

Configure SAP Workflow Management


Follow the setup and configuration section of SAP Workflow Management.
https://help.sap.com/viewer/6f55baaf330443bd8132d071581bbae6/Cloud/en-
US/d7910e2bf7f64afc9d0eb21b0cc9e84d.html
Note: While creating the service instance for Workflow service, make sure that at least the following
scopes are assigned (help documentation to enable technical authentication to access the workflow
APIs). If the scopes are not assigned, you can also update the service instance with the following scopes.
• WORKFLOW_INSTANCE_GET
• WORKFLOW_INSTANCE_START
• WORKFLOW_INSTANCE_CANCEL

6
Configure Workflow Email Destination

Configure workflow email destination to automatically send email notification to the involved parties .
For more information on configuring the destination, see configure workflow email destination.

Configure OAuth2ClientCredentials Workflow Destination

Use an existing or create a new Workflow service instance with at least the following authorities
(scopes):

WORKFLOW_INSTANCE_START
WORKFLOW_INSTANCE_GET

Please refer to the documentation on how to Enable Technical Authentication with specific authorities.
Configure a destination with the following parameters:

Name Workflow
Type HTTP
Proxy Type Internet
Authentication Oauth2ClientCredentials
URL https://api.workflow.<region-
host>.hana.onedemand.com/workflow-
service/rest
Client ID ******
Client Secret **********
Token Service URL <”uaa”:’’url”>/oauth/token

Please refer help documentation -> how to get URL, Client ID , Client Secret and Token Service URL
Determine Service Configuration Parameters
For more information refer to how to create a HTTP destination-> Create HTTP Destinations and how
to use Workflow APIs-> Using Workflow APIs s

Configure OAuth2ClientCredentials Business Rules Destination

Business Rules destination with the following parameters:

Name BUSINESS_RULES
Type HTTP
Description
URL https://bpmrulesruntime.<region-host>.hana.onedemand.com/rules-
service

7
Proxy Type Internet
Authentication Oauth2ClentCredentials
Use MTLS for token Not checked
retrieval
Client ID <clientid>
Client Secret <clientsecret>
Token Service URL Type Dedicated
Token Service URL <uaa.url>/oauth/token
Token Service User
Token Service Password

Please refer help documentation Please refer help documentation -> how to get URL, Client ID , Client
Secret and Token Service URL Determine Service Configuration Parameters
For more information refer to how to Create HTTP Destinations Determine Service Configuration
Parameters Access Business Rules Capability APIs Using OAuth 2.0 Authentication (Client Credentials)

Configure Destination to Enable Start & Step Conditions

To enable the usage of start conditions and step conditions on a process variant, create a destination
for business rules with the configuration as mentioned in the following help document:
Configure SAP Workflow Management Destinations

8
Configure OAuth2ClientCredentials Workflow Destination (Service Instance)

Ignore this step if there is already a destination using Workflow service instance created.
Create new Destination from the workflow service instance to call Workflow APIs using a service route
from SAP UI5 Component. For more details, follow the official help document: Destinations Pointing to
Service Instances

Configure a Destination to SAP S/4HANA system


Create a destination to connect to SAP S/4HANA in the tenant where you have subscribed to SAP
Workflow Management.
Configure a destination with the name as “S4HANA”, with Type as HTTP, Proxy Type as Internet, URL as
hostname of your SAP S/4HANA, and authentication as BasicAuthentication.
Please refer to Create HTTP Destinations

Name S4HANA
Type HTTP
Description S/4 HANA Cloud tenant for LP content
URL https://****api.s4hana.ondemand.com
Proxy Type OnPremise
Authentication Basic Authentication
User *****
Password *******

Additional Property Value


sap-client <client number of the backend>
HTML5.DynamicDestination true
WebIDEEnabled true
WebIDEUsage ui5_execute_abap,odata_gen,odata_abap,dev_abap,bsp_execute
WebIDESystem <id of the backend system>

Configure Cloud Integration Destination


To call an integration flow, a HTTP destination is required in the SAP BTP tenant where the SAP Build
Process Automation or SAP Workflow Management is subscribed. Create a destination called CPI with
either Basic Authentication or OAuth2ClientCredentials.

9
Destination with Basic Authentication

Name CPI
Type HTTP
Proxy Type Internet
Authentication Basic Authentication
URL <runtime.url>
Username <user>
Password <password>
Note: For the UI application Asset Retirement, Destination of Basic Auth. Is needed.

Destination with OAuth2ClientCredentials Authentication

Name CPI
Type HTTP
Proxy Type Internet
Authentication OAuth2ClientCredentials
URL <runtime.url>
Client Id <client ID>
Client Secret <client secret>
Token Service URL <oauth.url.for.clientCredentials>

Configure Cloud Connector


For SAP S/4HANA on-premise landscape, configure cloud connector to enable secure tunnel to SAP BTP
tenant. Please refer the help documentation to configure Cloud Connector.
Services/Resources that need to be exposed from SAP S/4HANA on-premise using Cloud Connector are
as mentioned below:

Resource Protocol Use


EAM_OBJPG_TECHNICALOBJECT_SRV HTTP Fetch Equipment, work order, list of
notification, maintenance plans details
EAM_OBJPG_MAINTNOTIFICATION_SRV HTTP Fetch the notification details
ZARTWF_ALM_NOTIF_CHANGEUSRTA RFC Used to change the notification user status
BAPI_ALM_NOTIF_CLOSE RFC Closing the Notification

10
ZARTWF_BAPI_ALM_NOTIF_CREATE RFC Create Maintenance Notification
IBAPI_EQUI_SET_INACTIVE RFC Deactivate Equipment
BAPI_ALM_ORDER_MAINTAIN RFC Deactivate Work Order
MPLAN_DEACTIVATE RFC Deactivate Maintenance Plan
TH_GET_VIRT_HOST_DATA RFC Fetch Host and port of SAP S/4HANA system
ZARTWF_FIAA_NBV_SHOW RFC Get Asset NBV
ZARTWF_ALM_NOTIF_CHANGEUSRSTA RFC Used to change the notification user status
to REJC
BAPI_ASSET_RETIREMENT_POST RFC Retire the Asset

Configure RFC Destination


Configure a RFC destination to connect with SAP S/4HANA on-premise. Below is a destination
configuration for SAP S/4HANA on-premise
Note: This destination is required by Cloud Platform Integration.
Name <RFC_DESTINATION_NAME>
Type RFC
Proxy Type OnPremise
User <ONPREMISE_USER>
Password <ONPREMISE_PASSWORD>
Repository User <ONPREMISE_USER>
Repository Password <ONPREMISE_PASSWORD>

jco.client.ashost <host name configured in cloud


connector>
jco.client.client <client number>
jco.client.lang <system language>
jco.client.sysnr <system number>

Configure SAP Central Fiori Launchpad Site for SAP Workflow


Management
If you plan to use SAP Launchpad service, then configure SAP Central Fiori Launchpad Site with
Workflow Applications using help documentation

11
Importing Workflow Start UI Source Code
The Manage Asset Retirement process content package requires a SAPUI5 application in order to initiate
the asset retirement. The UI application is automatically deployed in the SAP BTP tenant when the
content package is imported.
To make changes to the UI application to suit any requirement (for example, to support a notification
type that is different from the default - ZA), the source code of the SAPUI5 application can be
downloaded from the sources tab of the Manage Content Package application. Once the source code is
imported into SAP Business Application Studio or SAP WEB IDE, the changes can be performed and
deployed to the SAP BTP tenant. Ex, the Notification type is maintained in the configuration.json as
shown below.

Add Custom UI Application (as Workflow Start UI) in Fiori Launchpad Site
• Open SAP Launchpad site manager application.
• Select Content Manager and Content Explorer.
• Search com.sap.content.AssetRetirement and select SAP UI5 component.
• Click Add to My Content button to include the UI5 component .

12
• Select My Content tab and search Everyone.
• Click Everyone from the result and navigate to the details.

Click Edit button to enable all users to access the new Start UI tile.
• In Assignments section on right, search for text info and select Asset Retirement from the Results.
• Click the + button and click Save.
• Under My Content tab, click New button and select Group.
• Add a Title for e.g.: Asset Retirement under PROPERTIES.
• In the Assignments section on right, search for text info and select Asset retirement from the Results.
• Click + button and Save button.
Please refer help documentation to know more about Create Custom Start UI Tiles on the Central
Launchpad

13
Configure Status Profile & Notification User Status
Perform the following actions in SAP S/4HANA to create the status profile and notification user status.
1. Go the transaction OK02.
2. Press the “New entry” from the Menu.

3. Provide the Status Profile as Z_ART, Text and Maintenance Language. Click Continue

Note: The status profile is later used in the function module ZARTWF_ALM_NOTIF_CHANGEUSRSTA.

4. Double click on the entry

5. Enter the Status number, Status and Short description along with Lowest status number, Highest
Status number, Position and Priority.
Note: These user statuses are used in the function modules created in the next section. The

14
approval level user statuses are used in the process variant as a step property (refer to the
configuration guide for this content package).

6. Save the entry.


7. Assign Object Type by press the Yes.

8. Click the Object Types. Then Save the entry.

15
9. Provide the Transport request number and continue.

16
Configure Custom Function Modules

Create Function Group


Create a Custom Function group ‘ZSWW_SRV’ and save it to a package and transport request. Use this
package and transport request in the next sections in creating function modules.

Create Remote Enabled Function Module for Creation of Notification


‘INTL’
1. Go to the transaction SE37.
2. Create an RFC enabled function module ZARTWF_BAPI_ALM_NOTIF_CREATE and Provide the
Function group as ZSWW_SRV and the short description.
3. Save it.
4. Assign the Importing parameters.

Parameter Name Typing Associated Type Pass by Value Short text


NOTIF_TYPE TYPE QMART Yes Notification Type
BAPI Service Notification
NOTIFHEADER TYPE BAPI2080_NOTHDRI Yes Header for creation
5. Assign the Exporting parameters.

Parameter Name Typing Associated Type Pass by Value Short text


NOTIFHEADER_EXPORT TYPE BAPI2080_NOTHDRE Yes BAPI Service Notification Header
MAINTACTYTYPE_EXPORT TYPE ILA Yes Maintenance activity type
ET_MESSAGE TYPE BAPI_MSG Yes Message Text
Database updated (x) or not
Y_DB_UPDATE TYPE REGEN-DB_UPDATE Yes (SPACE)

Copy the code snippet from SAP Note 3157262 and paste it in the Source code section of the Function
Module ZARTWF_BAPI_ALM_NOTIF_CREATE. Then Save and Activate it.

17
Create Remote Enabled Function Module to get the Net Book Value
1. Go to the transaction SE37.
2. Create an RFC enabled function module Create an RFC enabled function module
ZARTWF_FIAA_NBV_SHOW and Provide the Function group as ZSWW_SRV and the short
description.
3. Save it.

4. Assign the Importing parameters.

Parameter Name Typing Associated Type Pass by Value Short text


I_BUKRS TYPE BUKRS Company Code
I_AFABE TYPE AFABE Real depreciation area
I_BZDAT TYPE BZDAT Asset Value Date
Indicator: Type of change to
I_DIALOG TYPE ANUPD table
I_ANLN1 TYPE ANLN1 Main Asset Number
I_ANLN2 TYPE ANLN2

5. Assign the Exporting parameters.

Parameter Name Typing Associated Type Pass by Value Short text


Cumulative Acquisition and
E_NBV TYPE KANSW Yes Production Costs
Database updated (x) or not
Y_DB_UPDATE TYPE REGEN-DB_UPDATE Yes (SPACE)
EXCEPTION_REASON TYPE BAPIRET2 Yes Message Text
CURR_KEY TYPE WAERS Yes Currency Key
ET_MESSAGE TYPE BAPI_MSG Yes Message Text

Copy the code snippet from SAP Note 3157262 and paste it in the Source code section of the Function
Module ZARTWF_FIAA_NBV_SHOW. Then Save and Activate it.

Once the Asset Retirement request has been created then further it will go for submission and update
the status of Asset and Status of Notification to Submitted (SUBM) by calling an RFC Enabled Function
Module BAPI_ALM_NOTIF_CHANGEUSRSTAT. After successful submission it will go for multiple
Approvals. Here define the multiple Approvals Levels and Approver Agent Id in the Workflow. After
successful approval, corresponding user status maintained is updated in SAP S/4HANA by making an
integration flow call to BAPI_ALM_NOTIF_CHANGEUSRSTAT.

18
Create Remote Enabled Function Module to Change the Notification
Status ‘SUBM’
1. Go to the transaction SE37.
2. Create an RFC enabled function module Create an RFC enabled function module
ZARTWF_ALM_NOTIF_CHANGEUSRSTA and Provide the Function group as ZSWW_SRV and the
short description.
3. Save it.

4. Assign the Importing parameters.

Parameter Name Typing Associated Type Pass by Value Short text


NUMBER TYPE QMNUM Yes Notification Number
BAPI Service notification user
USR_STATUS TYPE BAPI2080_NOTUSRSTATI Yes status

5. Assign the Exporting parameters.

Parameter Name Typing Associated Type Pass by Value Short text


BAPI2080_NOTADT-
SYSTEMSTATUS TYPE SYSTATUS Yes System Status for Notification
BAPI2080_NOTADT-
USERSTATUS TYPE USRSTATUS Yes Field displaying user status
Database updated (x) or not
Y_DB_UPDATE TYPE REGEN-DB_UPDATE Yes (SPACE)
ET_MESSAGE TYPE BAPI_MSG Yes Message Text

Copy the code snippet from SAP Note 3157262 and paste it in the Source code section of the Function
Module ZARTWF_ALM_NOTIF_CHANGEUSRSTA. If the status profile is different than Z_ART, then the
same needs to be updated in the function module for the variable lc_z_art. Then Save and Activate it.

After Submit the request a Workflow will gets trigger, and it will go for multiple Approvals. If
Approver rejects the request, then update the status of Asset and Status of Notification to Rejected
(REJC) by calling an RFC Enabled Function Module BAPI_ALM_NOTIF_CHANGEUSRST AT. This process is
defined in the Integration Flow.

19
Create Remote Enabled Function Module to Change the Notification
Status ‘REJC’
1. Go to the transaction SE37.
2. Create an RFC enabled function module Create an RFC enabled function module
ZARTWF_ALM_NOTIF_CHANGEUSRSTA and Provide the Function group as ZSWW_SRV and the
short description.
3. Save it.

4. Assign the Importing parameters.

Parameter Name Typing Associated Type Pass by Value Short text


NUMBER TYPE QMNUM Yes Notification Number
BAPI Service notification user
USR_STATUS TYPE BAPI2080_NOTUSRSTATI Yes status

5. Assign the Exporting parameters.

Parameter Name Typing Associated Type Pass by Value Short text


BAPI2080_NOTADT-
SYSTEMSTATUS TYPE SYSTATUS Yes System Status for Notification
BAPI2080_NOTADT-
USERSTATUS TYPE USRSTATUS Yes Field displaying user status
Database updated (x) or not
Y_DB_UPDATE TYPE REGEN-DB_UPDATE Yes (SPACE)
ET_MESSAGE TYPE BAPI_MSG Yes Message Text

Copy the code snippet from SAP Note 3157262 and paste it in the Source code section of the Function
Module ZARTWF_ALM_NOTIF_CHANGEUSRSTA. Then Save and Activate it.

20

You might also like