cancel
Showing results for 
Search instead for 
Did you mean: 

Workflow triggering based on custom fields in sales order item level

SHRADDHA2
Explorer
0 Kudos
311

I have created a custom field "Status" in sales order item field in public cloud . I have given three dropdowns , "F" , "P" and "N" in custom field .Based on the certain selected value("F") in the dropdown I have to send the notification to approver (trigger the workflow) . 

I have used the BADI " SWF_WORKFLOW_CONDITION_DEF " to get new dropdown in the manage sales document workflow pre condition and I have used  "SWF_WORKFLOW_CONDITION_EVAL" for the value . I'm not able to trigger the workflow.

Is it possible to trigger the workflow using certain data of the custom field? 

Please help me with this .

Thanks & Regards

Shraddha Nayak

Accepted Solutions (0)

Answers (1)

Answers (1)

DequanXu
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello,

First, let's confirm the process highlighting key steps:

1. **Define Custom Field:** You've already created the custom field "Status" in the sales order item with dropdown values "F", "P", and "N".

2. **Define Preconditions with BAdI `SWF_WORKFLOW_CONDITION_DEF`:**
- Make sure that the custom field and its values are correctly integrated for the workflow conditions.
- Ensure that the implementation of the BAdI `SWF_WORKFLOW_CONDITION_DEF` correctly updates the list of conditions that should be available in the "Manage Sales Document Workflow" app.

3. **Evaluate Conditions with BAdI `SWF_WORKFLOW_CONDITION_EVAL`:**
- Ensure the evaluation logic within the BAdI implementation correctly evaluates the workflow start conditions based on the "Status" field value.
- Your implementation should correctly interpret the workflow condition based on the value selected ("F") in the custom field.

Here is a checklist to confirm your setup:

### Step-by-step Checklist:

1. **Custom Field Creation:**
- Ensure the custom field is properly created and available in the sales order item.
- Navigate to the "Custom Fields and Logic" app to confirm the field's existence and settings.

2. **Implementation of BAdIs:**
- **SWF_WORKFLOW_CONDITION_DEF:**
- Check that you've implemented logic to add your custom condition. This BAdI should include the definition for your custom field "Status" and an entry for "F".

- **SWF_WORKFLOW_CONDITION_EVAL:**
- Confirm the implementation of the evaluation logic where, upon getting 'Status' as 'F', the condition evaluates to TRUE.

3. **Assign Workflow Scenario IDs:**
- Ensure you have correctly assigned the workflow scenario IDs in your BAdI implementations.
- These IDs should filter and link to the relevant workflow scenarios.

4. **Workflow Configuration in SAP Fiori:**
- Use the "Manage Workflows for Sales Documents" app.
- Define the scenario and preconditions based on the custom field "Status" and its values.
- Ensure the workflow definition includes the precondition logic leading to the approval notification based on 'F'.

5. **Testing:**
- After implementing and configuring, test your setup by creating or simulating a sales order.
- Change the value of the custom field "Status" and check if it triggers the workflow as expected.

### Troubleshooting Steps:
- Review the code enhancements in the BAdIs to verify they include correct logic and fire based on your scenario.
- Verify that the newly defined conditions are active and correctly linked in the "Manage Workflows for Sales Documents" app.
- Use the debugging tools and logs to check for any issues in the BAdI implementations.

Best regards,

Dequan Xu