Symptom
When attempting to configure a Purchase Order workflow using a "Created By User" condition in the Manage Workflows app, the following issues are observed:
-
The "Created By User" condition does not display a dropdown list or F4 search help for user selection.
-
The business requirement dictates that specific users responsible for creating Purchase Orders must be identified to route the first level of approval (or subsequent steps) based on the PO creator.
Environment
SAP S/4HANA Cloud Public Edition
Reproducing the Issue
- Open Manage Workflows for Purchase Orders and create or edit a workflow.
- Add a start condition and choose “Created By User”.
- Observe that no dropdown or F4/value help is available to select a user.
Cause
The custom BAdI implementations for defining and evaluating the “Created By User” condition (SWF_WORKFLOW_CONDITION_DEF and SWF_WORKFLOW_CONDITION_EVAL) were incorrect or incomplete, so the parameter’s value help was not provided and the evaluation logic did not work as intended.
Resolution
To resolve this issue and successfully trigger the creator-wise workflow, users must implement custom logic in both the Workflow Condition Definition and Workflow Condition Evaluation BAdIs.
Important Prerequisite: Ensure there is an active workflow scenario . It is strongly recommended to keep the "Automatic Release" feature active within your workflow configuration to ensure smooth processing once the custom conditions are met.
Apply the following ABAP code in the respective custom logic apps:
Step 1: Define the Workflow Condition
In the BAdI SWF_WORKFLOW_CONDITION_DEF (Providing additional conditions for scenarios), use the following code to define the condition and parameter input field for the Fiori app:
Ex:
" Define the condition visible in the Fiori 'Manage Workflows' app
ct_condition = VALUE #(
( id = 'id_userid'
subject = 'Purchase Order Created By User ID'(001) " Label shown in dropdown
type = if_swf_flex_ifs_condition_def=>cs_condtype-start_step )
).
" Define the parameter (input field) for the condition
ct_parameter = VALUE #(
( id = 'id_userid'
name = 'id_userid' " Technical name used for EVAL lookup
xsd_type = if_swf_flex_ifs_condition_def=>cs_xstype-string
service_path = '/sap/opu/odata/sap/API_USER_SRV'
entity = 'A_User'
property = 'UserID'
mandatory = abap_true )
).
Step 2: Evaluate the Workflow Condition
In the BAdI SWF_WORKFLOW_CONDITION_EVAL (Value evaluation of additional conditions for scenarios), use the following code to compare the configured user ID against the actual creator of the Purchase Order:
cv_is_true = abap_false.
" 1. Retrieve the parameter value by technical ID
READ TABLE it_parameter_value INTO DATA(ls_param) WITH KEY name = 'id_userid'.
IF sy-subrc <> 0 OR ls_param-value IS INITIAL.
RETURN.
ENDIF.
DATA(lv_target_user) = to_upper( ls_param-value ).
" 2. Get the actual PO Number from the workflow framework
DATA(lv_po_number) = is_sap_object_node_type-sont_key_part_1.
" 3. Fetch PO Creator using the correct variable
SELECT SINGLE CreatedByUser
FROM I_PurchaseOrderAPI01
WHERE PurchaseOrder = @lv_po_number
INTO @DATA(lv_po_creator).
" 4. Final Comparison
IF sy-subrc = 0 AND lv_target_user = to_upper( lv_po_creator ).
cv_is_true = abap_true.
ENDIF.
Step 3: Validation
Once both BAdIs are published, navigate back to the Manage Workflows app. The new condition "Purchase Order Created By User ID" will be available with the proper user selection binding, and the workflow will trigger correctly based on the PO creator.
Keywords
flexible workflow, purchase order, created by user, value help missing, people picker, dropdown not shown, creator-based approval, manage workflows for purchase orders, badi SWF_WORKFLOW_CONDITION_DEF, badi SWF_WORKFLOW_CONDITION_EVAL, API_USER_SRV, A_User, I_PurchaseOrderAPI01, F4 help, user-wise workflow , KBA , MM-FIO-PUR-PO-WFL-CL , Purchase Order Workflow (Public Cloud) , How To
SAP Knowledge Base Article - Public