Manage Asset Retirement Setup Guide
Manage Asset Retirement Setup Guide
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
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.
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.
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.
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.
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
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)
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
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 *******
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.
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>
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
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.
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).
15
9. Provide the Transport request number and continue.
16
Configure Custom Function Modules
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.
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.
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.
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