SAP EHS Task Management Handling Custom Workflow while Upgrading to S/4 HANA 2020
May 10, 2022

1. Issue / Problem Statement

There has been a considerable renovation in SAP EHS (Environment, Health, and Safety) module from S/4 HANA 1809 onwards, and also in its Task Management Workflows.
EHS Task Management has been significantly renewed (new data model, new coding) and moved to Fiori (new user interface)

For some reason, if you have custom workflows for EHS Task Management that are copied from a standard template and adapted, or which uses standard class, events, and methods then those need to be adapted and actioned during the upgrade.

In our case: We had custom workflow copied from WS00500001 (Incident Lifecycle) and adapted with custom steps for agent determination and task action

1.1 Impacted Process Area

  1. Incident Management
    1. Standard incident actions
    2. Standard investigation step actions
    3. Plant maintenance notifications
    4. Change requests in SAP Management of Change
    5. Incident lifecycle workflow
    6. Notify HR (absence) administrator workflow
    7. HR absence maintained workflow
    8. Report generation workflow (removed)
    9. Report shipment workflow (removed)
    10. Report approval workflow (removed)
  2. Health and Safety Management
    1. Standard risk assessment actions
    2. Control actions
    3. Plant maintenance notifications
    4. Change requests in SAP Management of Change
  3. Environment Management
    1. Standard compliance scenario actions

1.2 Workflow discussed in this blog

This blog is about the Incident Lifecycle Workflow of Incident Management

SystemWorkflow TemplateClassEvent
S/4 HANA 1709 and priorWS00500001CL_EHHSS_PCO_INC_LCCREATED
S/4 HANA 1809 and higherWS00500001
(Template is changed significantly)
CL_EHHSS_INC_WF_ADAPTERCREATED

<< To Top

In S/4 HANA 2020 there is an option to choose between Automatic or Manual Mode.
Settings can be maintained using SM30 and maintaining S4SIC_PARAM
If there is a modification to standard processes or actions then better go for Manual Option
SAP Note 2927227 – SI-Check – Renovation Task Management parameter in table S4SIC_PARAM

  • Key Name: S4SIC_TASK_MGMT_CHECK_WFF_RESTART_MANUAL 
  • Key-Value:
    • A‘ for Automatic Mode
    • M‘ for Manual Mode
Key/Value Parameter for SI-Check Framework

2.1 Automatic Mode

The following migration steps will run automatically:

  • CL_SDM_EHFNDD_WFF_RESTART_MIGR – This migration step recreates tasks that were in process before the system upgrade. It also migrates open action definitions to task definitions.
  • CL_SDM_EHFNDD_WFF_CLOSED_MIGR – This migration step relinks tasks that were closed before the system upgrade. It also migrates closed action definitions to task definitions.
  • CL_SDM_EHFNDD_TASK_PLAN_MIGR – This migration step does updates in the following tables with the new Planned instances created in them – EHFNDD_TDEF_ROOT, EHFNDD_TASK_PLAN.
  • CL_SDM_EHFNDD_WFF_STEP_MIGR – This migration step works on task instances that were created from action tasks that were in process. It repeats the steps that were taken in the action tasks before migration.

In case of errors during the automatic run of those migration steps, check the Application Log (SLG1) for object SDMI_MIGRATION and external ID – the name of the step you want to check. If some entries failed to migrate, you can retry to migrate them, using report R_EHFND_WFF_RESTART_PROCESSES after solving the issues listed in the Application Log.
SAP Note: 2975797 – Automatic task migration as part of conversion/upgrade to 2020 (or higher) release in SAP EHS Management

2.2 Manual Mode

The migration is done using the R_EHFND_XPRA_WFF_MIGRATION program, which runs automatically, and the R_EHFND_WFF_RESTART_PROCESSES program, which is run manually in each relevant client.

  • The R_EHFND_XPRA_WFF_MIGRATION program cancels all active tasks from lower versions and prepares them for the next step of migration.
  • The R_EHFND_WFF_RESTART_PROCESSES program has two steps. In step Restart Workflow Processes, it recreates all tasks and workflows canceled by the R_EHFND_XPRA_WFF_MIGRATION program and migrates action definitions. The Migrate Closed Instances step adapts closed work items to the new task management, making them available in applications.

In 1809, task instances exist only as work items, while in 1909 some of the task instance data is stored outside of the work items. In order to generate this data for task instances created before the upgrade to the 1909 release, you have to do the following:

  • Manually run the R_EHFND_WFF_RESTART_PROCESSES program with the Migrate Planned Task Instances option.

Without this migration, task instances created before the upgrade will not be visible on the UI and the ones in status Scheduled will not generate work items.
SAP Note 2905234 – Task migration from 1709 (or lower) to 1809 release in SAP EHS Management
SAP Note 2903938 – Task migration from 1809 to 1909 release in SAP EHS Management

<< To Top

3. Steps followed for Custom Workflow

3.1 Pre-Existing Active Workflows are canceled after upgrade

Active workflows existing before are canceled after the upgrade you can view them in SWIA or SWI1
You can get the list of impacted ones from table EHHSSD_PIL_ROOT with STAUS_REMARK as MIGRATION IN PROCESS

3.2 Adapting Custom Workflow

Custom Workflow existing in the system was a copy of the previous standard template WS00500001 with replaced steps for Agent Determination and Task actions. Since there was a significant change in the standard template it was better to copy the updated template and adapt previous custom changes

3.3 Updating Event Linkage

Update the Event Linkage using transaction SWETYPV
We have to deactivate the previous linkage and activate the new one.

Deactivated Linkage
Activated Linkage

3.4 Migrating pre-existing Incident Lifecycle Workflow

Execute program R_EHFND_WFF_RESTART_PROCESSES via SE38
Chose option Restart Workflow Processes and Execute
This will re-trigger the corresponding new active workflows
Recommended to run in Test Mode first

<< To Top

Base SAP Note for EHS Task Management Updates: 2612110 – S4TWL – Renovation of task management