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.
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.
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.
Property | Value |
Class | ZCL_CPT_ABAP1 |
Superclass | CL_RSPC_SIMPLE_PROCESS_TYPE |
Interface | IF_RSPC_SIMPLE_PROCESS_TYPE |
The implementation consists of two methods.
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.
Creating the Custom Process Type
After activating the implementation class, open the BW Bridge Cockpit and navigate to Custom Process Types.
Choose Create and maintain the required details.
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.
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.
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.
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 101 | |
| 43 | |
| 41 | |
| 40 | |
| 39 | |
| 39 | |
| 36 | |
| 34 | |
| 30 | |
| 23 |