Technology Blog Posts by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
anilkumarauce
Product and Topic Expert
Product and Topic Expert
0 Likes
57

Executing Custom ABAP Programs in SAP BW Bridge Process Chains Using Custom Process Types

Introduction

One of the common questions while working with SAP Datasphere, BW Bridge is how to execute custom ABAP programs as part of a Process Chain. Developers familiar with SAP BW or SAP BW/4HANA are accustomed to executing ABAP programs directly from Process Chains (shown below) for validations, prerequisite checks, or custom processing.

anilkumarauce_0-1784898734347.png

SAP BW Bridge provides a supported extensibility framework through Custom Process Types, allowing developers to integrate customer-specific ABAP logic into Process Chains. By implementing a simple ABAP class and registering it as a Custom Process Type, the Process Chain framework can execute custom logic as part of its normal execution flow.

In this blog, we'll walk through the complete implementation using a simple business scenario. We'll develop the ABAP implementation, register it as a Custom Process Type, and execute it within a Process Chain.

Business Scenario

Let's assume you have two dependent Process Chains.

The first Process Chain loads and activates data into an ADSO. The second Process Chain performs downstream activities such as report generation or additional data processing.

Before starting the second Process Chain, we want to verify that today's ADSO activation completed successfully. If the validation succeeds, the Process Chain continues as expected. Otherwise, it stops and informs the administrator that the prerequisite load has not completed successfully.

We'll implement this validation by executing a custom ABAP program through a Custom Process Type.

Solution Overview:

The following diagram illustrates the overall solution.

anilkumarauce_1-1784898734359.png

When the Process Chain reaches the Custom Process Type, the BW Bridge framework invokes the ABAP implementation class. The class executes the custom validation logic and returns the execution status back to the Process Chain. Depending on the returned status, the Process Chain either continues with the next step or follows its configured error path.

Developing the ABAP Implementation:

Every Custom Process Type is backed by an ABAP implementation class. Create a new global ABAP class with the following properties.

anilkumarauce_2-1784898734360.png

Property

Value

Class

ZCL_CPT_ABAP1

Superclass

CL_RSPC_SIMPLE_PROCESS_TYPE

Interface

IF_RSPC_SIMPLE_PROCESS_TYPE

The implementation consists of two methods.

  • CLASS_CONSTRUCTOR – Registers the implementation class with the Custom Process Type framework.
  • EXECUTE – Contains the custom ABAP logic that is executed during the Process Chain run.

The CLASS_CONSTRUCTOR method associates the technical process type with the implementing ABAP class. Ensure the values assigned to c_type and c_class match the values maintained later while creating the Custom Process Type.

  METHOD class_constructor.

    c_type = 'ZCPT_ABAP1'.

    c_class = 'ZCL_CPT_ABAP1'.

  ENDMETHOD.

The EXECUTE method contains the business logic executed by the Process Chain.

For this example, the implementation validates whether the ADSO activation completed successfully on the current day by reading the Process Chain execution log (RSPCPROCESSLOG).

 "Get current system date

 DATA(lv_date) = cl_abap_context_info=>get_system_date( ).

 " Get details of the ADSO activation today

 SELECT *

   FROM rspcprocesslog

   WHERE type = 'ADSOACT'

   AND state = 'G'

   AND batchdate = @LV_date

   AND variante = 'ZAKADSO2ACT' " ADSO Activation variant name

   INTO TABLE @DATA(lt_reccount).

If the validation succeeds, the process returns a successful status. Otherwise, it returns a failure status together with an informative runtime message displayed in the Process Chain monitor.

The execution status is controlled using the E_FAILED parameter.

e_failed = ' '.     " Set process step status to GREEN

e_failed = 'X'.     " Set process step status to RED

Messages returned through ET_MESSAGE are displayed directly in the Process Chain monitor, making it easy for administrators to understand the execution result.

The complete implementation is shown below.

anilkumarauce_3-1784898734364.png

Creating the Custom Process Type

After activating the implementation class, open the BW Bridge Cockpit and navigate to Custom Process Types.

anilkumarauce_4-1784898734365.png

Choose Create and maintain the required details.

anilkumarauce_5-1784898734366.png

anilkumarauce_6-1784898734367.png

anilkumarauce_7-1784898734368.png

After saving, the Custom Process Type becomes available in the Process Chain editor.

Creating the Process Chain:

Create a new process chain, provide the required technical name and description.

anilkumarauce_8-1784898734369.png

anilkumarauce_9-1784898734371.png

Insert the newly created Process Variant. Connect it to the appropriate predecessor and successor steps. The Custom Process Type now behaves like any standard Process Chain step and participates in the normal execution flow.

anilkumarauce_10-1784898734375.png

Executing the Process Chain:

Failed Execution

If no successful ADSO activation is found, the validation fails and the Process Chain follows its configured error path.

The following message is displayed in the Process Chain log.

Data NOT loaded to ADSO ZAKADSO2 today. Please verify the prerequisite Process Chain.

anilkumarauce_11-1784898734378.png

Successful Execution

If the ADSO activation is found for the current day, the validation succeeds and the Process Chain continues with the subsequent steps. The following message is displayed in the Process Chain log.

Data successfully loaded to ADSO ZAKADSO2 today.

anilkumarauce_12-1784898734380.png

Conclusion

Custom Process Types provide a flexible and SAP-supported way to execute customer-specific ABAP programs within SAP BW Bridge Process Chains.

In this blog, we developed an ABAP implementation class, registered it as a Custom Process Type, and incorporated it into a Process Chain to validate a prerequisite ADSO activation. Although the example demonstrates a simple dummy validation scenario, the same implementation pattern can be adapted to execute a wide range of customer-specific ABAP programs within the BW Bridge Process Chain framework.