Process Control - Task Configuration

Overview

This page introduces the steps to create Task IDs in IMG and configure tasks for the Change Record context in BRF+.

  1. Task IDs are a unique concept introduced by XCM. In standard SAP Process Control, users typically create multiple process route templates to due a small variations in the process. This often leads to duplication of tasks across multiple templates.
  2. To address this, XCM provides a more flexible approach using Task IDs.
  3. With Task IDs, you define common tasks once and configure them based on various business conditions.
  4. This allows the same task to be reused across different CR statuses. In BRF+, these tasks can be maintained efficiently in a single rule line, incorporating all relevant conditions.

Restrict Tasks by Change Record Type and Reason for Change

Not every task fits every kind of change. A task can be assigned to the Change Record types it is valid for and, if needed, to specific reasons for change. XCM then uses only valid tasks:

  • When a task is added in the Process Builder, the value help offers only the tasks valid for the Change Record.
  • When the Process Builder is generated from BRF+, a task that is not valid for the Change Record is still shown, but with a red status and the message Task not valid for record type and reason of the Change Record.
  • When the process route is loaded, a task generated from BRF+ that is not valid is not created. Instead, a process exception task goes to the administrator to correct the customizing or the BRF+ rule.

The rule: a task is valid for a Change Record when it is assigned to the Change Record type and, if reasons are maintained for that type, the Change Record has one of those reasons.

  • A Change Record type without reasons: the task is valid for every reason of that type, and also when the Change Record has no reason.
  • A Change Record type with reasons: the task is valid only for the reasons listed.
  • A task without any Change Record type is valid for no Change Record and is never offered. Remember to assign Change Record types to every new task.

Note: This feature is available in XCM for SAP S/4HANA 2023 from release 2026.3.4. For SAP S/4HANA 2025 it is planned for a later release.

Steps to configure

1. After the import (mandatory): run the seeding report /XCM/PR_TASK_RT_SEEDING once with transaction SE38. It assigns every existing task to every Change Record type, without reasons, so all processes keep running as before. The report runs in test mode by default and lists what it would add; run it again without test mode and enter a customizing transport to record the assignments. It only adds missing assignments, so running it again is harmless.
[Screenshot to be added: seeding report with test mode and customizing transport]

2. Open the task customizing (view cluster /XCM/PR_VC_TASK, transaction SM34), select a task and open the level Record Types. Keep the Change Record types the task is valid for and remove the others. For a new task, add its Change Record types here.
[Screenshot to be added: record types of a task]

3. Optional: select a Change Record type of the task and open the level Reasons for Change. Add the reasons the task is valid for. The value help shows only the reasons of that Change Record type, with their descriptions. If you do not work with reasons for change, leave this level empty.
[Screenshot to be added: reasons for change of a record type]

4. Maintain the administrator for invalid tasks in the BRF+ administrator determination of your Process Control application: add a row for exception type IT and scenario 01, with the same administrator as for exception type PE. For details, see Exception Handling in Process Control.

5. Test: open the Process Builder of a Change Record and check that the Add Task value help offers only the valid tasks. Regenerate the Process Builder and check that every generated task shows a green status. A red task points to a missing Change Record type or reason in step 2 or 3; correct it and regenerate.

Note

  • The reason is read from the Change Record when the Add Task value help is opened. Tasks already on the process route are not removed when the reason changes later.
  • In the process route, the reason is read when the tasks of a status are created, so a changed reason applies from the next status onwards.
  • A task added in the Process Builder that is not valid for the Change Record is rejected, even if it was not selected from the value help.

Background Steps with Your Own Logic

A process route often needs a step that runs in the background and does something specific to your company, for example update a specification, send an e-mail, call a follow-up system or check data before the process continues.
XCM delivers one generic service class for such steps, /XCM/PR_BACKGROUND_SERVICE. You implement only the business logic of the step in a BAdI. XCM takes care of the rest: it writes the result to the workflow log, decides whether the step is completed or ends in error, and creates an exception task for an administrator when your logic asks for it.

Steps to configure

1. Define a service function with the service class /XCM/PR_BACKGROUND_SERVICE in the service definition of the process route (view /PLMB/V_PR_SRV_D), and use it in the XCM task that runs in the background. One service function can serve any number of background steps; each step is identified by its XCM task.
[Screenshot to be added: service function with class /XCM/PR_BACKGROUND_SERVICE]

2. Implement the BAdI /XCM/PR_EX_BACKGROUND_SRV in the IMG activity BAdI: Define Background Service Function for specific Task. Set the filter TASK_ID to the XCM task of the step, so that each background step has its own implementation.
[Screenshot to be added: BAdI implementation with filter TASK_ID]

3. In the method EXECUTE, carry out the work of the step and return:

  • Severity – success, information or warning when the step did its work; error when it did not.
  • Message – one message that describes the result.
  • Exception scenario – only together with severity error, and only when an administrator should resolve the problem.

4. If your step returns an exception scenario, maintain the exception rule in the Process Control BRF+ application for exception type PE and that scenario, with the task and the agents who resolve it. For details, see Exception Handling in Process Control.

5. Test the step: set a Change Record to the status that creates the background task and check the result in the workflow log of the work item.

What happens with the result

  • The message is always written to the workflow log of the work item.
  • Success, information or warning: the step is completed and the process route continues.
  • Error with an exception scenario: XCM creates the process exception task for the scenario, with the agents from BRF+. The step is completed and the process continues through the exception task.
  • Error with an exception scenario, but no exception task can be created (no BRF+ rule for the scenario, or no agent found): the work item ends in error with a message naming the exception type and scenario.
  • Error without an exception scenario: the work item ends in error with your message, so it can be analysed and restarted.
  • An abort severity is treated like an error.
  • Configuration missing: if no XCM task is found for the step, or no BAdI implementation exists for the task, the work item ends in error with a message saying so, instead of completing without having done anything.

Note: A work item that ends in error is not repeated automatically. An administrator analyses it and restarts it in the workflow.

XCM BAdI Usage

Enhancement Spot /XCM/PR_ES_BACKGROUND_SRV
BAdI /XCM/PR_EX_BACKGROUND_SRV
Interface /XCM/PR_IF_BACKGROUND_SRV
Filter TASK_ID

Description: Supplies the business logic of a background step that runs with the generic service class /XCM/PR_BACKGROUND_SERVICE. See Background Steps with Your Own Logic above for the set-up and for how XCM handles the result.
The method EXECUTE receives the object ID and object type of the change record together with the route ID, the position, the work item and the task ID of the step being processed.
The implementation performs the activity and reports the outcome back through SEVERITY, ERROR_MESSAGE and EXCEPTION_SCENARIO. An error with an exception scenario creates a process exception task; an error without a scenario ends the work item in error.

Signature for reference

METHODS execute
  IMPORTING object_id   TYPE /plmb/gos_internal_key OPTIONAL
            object_type TYPE /plmb/gos_object_type OPTIONAL
            actarea     TYPE srmactar OPTIONAL
            route_id    TYPE /plmb/process_route_id OPTIONAL
            posid       TYPE /plmb/pr_posid OPTIONAL
            posid_wiid  TYPE /plmb/pr_item_wii OPTIONAL
            task_id     TYPE /xcm/pr_task_id OPTIONAL
  CHANGING  exception_scenario TYPE /xcm/pr_exception_scenario
            error_message      TYPE swf_t100ms
            severity           TYPE /plmb/spi_msg_severity .

Enhancement Spot /XCM/PR_ES_TASK_CREATION
BAdI /XCM/PR_EX_TASK_CREATION
Interface /XCM/PR_IF_TASK_CREATE_EXIT

Description: The list of tasks determined for a status can be adjusted before the tasks are created, where the required task cannot be expressed through the decision table alone.
The method MODIFY_TASKS_FOR_CREATION receives the object type and object ID of the change record, an indicator whether the process was started from the Process Builder, and the process route. The task list determined so far is supplied in TASK_FOR_CREATION.
The implementation can add tasks, remove tasks or change the business parameter values of a task in TASK_FOR_CREATION. The list returned is the one that XCM uses to create the tasks. The tasks returned are also checked against the Change Record type and reason restriction described above.

This exit is called for every task determination, including the runs triggered from the Process Builder. Kindly keep the implementation restricted to the change record types where the adjustment is required.

Signature for reference

class-methods MODIFY_TASKS_FOR_CREATION
  importing
    !OBJECT_TYPE        type /PLMB/GOS_OBJECT_TYPE
    !OBJECT_ID          type /PLMB/GOS_INTERNAL_KEY
    !IS_PROCESS_BUILDER type BOOLE_D optional
    !PROCESS_ROUTE      type /PLMB/S_PROCESS_ROUTE_WI_SP optional
  changing
    !TASK_FOR_CREATION  type /XCM/PR_TASKS_WITH_PARAM_VALUE .

See Also

IMG Customization
BRF Customization
Advanced Process Control Framework
Exception Handling in Process Control
Process Builder

Keywords

Process Route, Process Control, Task IDs, Agent Determination, BRF+, Task Restriction, Record Type, Reason for Change, Seeding Report, Exception Type IT, Background Service, Background Task, /XCM/PR_BACKGROUND_SERVICE, /XCM/PR_EX_BACKGROUND_SRV

Prerequisites

BRF+ Generation - Process Control