We implemented a custom BAdI to validate tooling requests in our SAP PLM 2020 system. The BAdI was activated in SE19 and works correctly during the initial submission phase. However, workflows now get stuck at the approval step and never progress to the next stage.
The BAdI logic checks tooling availability and cost thresholds:
We verified the workflow event linkage in SWETYPV, but approvals still hang indefinitely. The workflow log shows the approval step is triggered but never completes. This is causing significant tooling delays across our manufacturing operations. Has anyone encountered workflow container population issues after custom BAdI implementation?
Thanks for the pointer. I checked SWI1 and you’re right - the container element APPROVAL_DECISION is empty. The workflow definition expects this to be populated by the BAdI, but our implementation only sets the approval_required flag. How do we properly pass the approval decision back to the workflow container? Is there a specific container element we need to set in the BAdI?
Adding to the previous comments - you also need to verify the event linkage in SWETYPV is configured for the approval completion event, not just the initiation event. I’ve seen cases where the BAdI triggers the workflow start but there’s no event receiver configured for the approval response. This creates a one-way communication where the workflow sends the approval task but never receives the response back.
The workflow container population is the missing piece. Your BAdI needs to explicitly set the workflow binding parameters. In tooling management workflows, you typically need to populate both the decision flag AND the routing information. The workflow template in PFTC should define which container elements are required. Without these, the workflow engine doesn’t know how to route the approval task. Check your workflow template configuration - there’s usually a binding definition that maps BAdI output parameters to workflow container elements.
Here’s the complete solution addressing all three key areas:
1. BAdI Activation in SE19:
Your BAdI implementation needs to include the workflow callback interface. Modify your BAdI class to implement IF_TOOLING_APPROVAL_CALLBACK:
CLASS zcl_tooling_badi DEFINITION PUBLIC
FINAL CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES: if_ex_tooling_check,
if_tooling_approval_callback.
ENDCLASS.
2. Workflow Event Linkage in SWETYPV:
You need TWO event linkages, not just one:
Event: TOOLING_REQUEST_CREATED → Workflow initiation (you have this)
Go to SWETYPV and create the second event linkage:
Business Object: BUS2105 (Tooling Request)
Event: APPROVAL_COMPLETED
Receiver Type: Workflow Template
Receiver: Your workflow template ID
3. Workflow Container Population:
In your BAdI method, populate the workflow container explicitly:
METHOD if_ex_tooling_check~validate_request.
DATA: lo_callback TYPE REF TO if_tooling_approval_callback.
IF request-cost > 50000.
approval_required = abap_true.
" Get callback interface instance
lo_callback = me.
" Populate workflow container
lo_callback->set_container_element(
EXPORTING
element_name = 'APPROVAL_DECISION'
element_value = 'PENDING' ).
lo_callback->set_container_element(
EXPORTING
element_name = 'APPROVAL_LEVEL'
element_value = 'MANAGER' ).
" Trigger workflow event when approval completes
lo_callback->register_completion_handler(
EXPORTING
handler_method = 'HANDLE_APPROVAL_COMPLETE' ).
ENDIF.
ENDMETHOD.
METHOD handle_approval_complete.
" Called when approval task is completed
DATA: lv_decision TYPE string.
" Get approval decision from work item
lv_decision = approval_workitem->get_result( ).
" Update workflow container with final decision
lo_callback->set_container_element(
EXPORTING
element_name = 'APPROVAL_DECISION'
element_value = lv_decision ).
" Trigger workflow continuation event
RAISE EVENT approval_completed
EXPORTING
decision = lv_decision
request_id = request-id.
ENDMETHOD.
Additional Configuration:
In transaction PFTC, open your workflow template
Go to “Binding” tab and verify these container elements exist:
APPROVAL_DECISION (Type: STRING)
APPROVAL_LEVEL (Type: STRING)
REQUEST_ID (Type: TOOLING_REQUEST_ID)
Add them if missing
Testing:
After implementing these changes:
Reactivate the BAdI in SE19
Test with a new tooling request
Monitor in SWI1 - you should now see container elements populated
The workflow should progress automatically after approval
The key issue was that your BAdI was validating but not communicating results back to the workflow engine. The callback interface and proper event linkage create the bidirectional communication channel needed for workflow continuation.
Thanks everyone. After reviewing all the suggestions, I found we were missing the callback implementation entirely. Here’s what we had to add to resolve it.
Check if your BAdI is implementing the callback interface correctly. For tooling workflows in SAP PLM 2020, the BAdI should implement IF_TOOLING_APPROVAL_CALLBACK which provides methods to set workflow container elements. Without this interface, your approval decisions exist only within the BAdI scope and never reach the workflow engine. The interface has methods like SET_CONTAINER_ELEMENT and TRIGGER_WORKFLOW_EVENT that you need to call explicitly.
I’ve seen this exact behavior before. The issue is typically that your BAdI is setting flags but not properly populating the workflow container with the approval decision. The workflow waits for a container element that never gets set. Check transaction SWI1 to examine the workflow container contents when it’s stuck.