Spend Management Blogs by Members
Check out community member blog posts about spend management and SAP Ariba, SAP Fieldglass, and SAP Concur solutions. Post or comment about your experiences.
cancel
Showing results for 
Search instead for 
Did you mean: 
konstantin_anikeev
Active Contributor

This post describes a universal approach to designing and building complex workflows for shopping carts.

Initial Customizing and activation of Workflow and BRF Objects are not described in this article. Main point is customization with development techniques.

Idea

Idea is to create a simple 2-Steps Workflow.

First approver is a requester of shopping cart, active only in case buy-on-behalf. ( Requester not equal to creator ). Requester can complete shopping cart.

Second approver is a free selected user from the system (for example own customer rule based on customer table). Approved can approve or reject shopping cart, but not allowed to change it. This step active only if shopping cart was created not by mentioned predefined user.

This Workflow will start only if free-text position exists, otherwise - no approval needed.

Common rules for evaluation can be represented as following.

Preparations

Created development package ZSRM_WF for all development object.

Group for own BRF objects

Start transaction BRF, then choose Utilities->Object Groups

Add a new entry

Save new entry and go back to transaction BRF. Now you can see new group.

New Workflow Tasks

You may need to define new workflow tasks. One per Workflow step.

Actually you need to copy them from the one of standard Tasks: Approval(TS40007953) or Completion (TS40007952).

So, first step is copied from TS40007952, second - from TS40007953.

To copy Workflow open transaction PFTC, enter template task and click "copy".

Enter ab abbrevation and step description (this description will be schown in Workflow preview for shopping cart).

After copying you need to generalize the task. Go in change mode and navigate via menu:

Then select generalization type (General Task)

The same should be done for the second step(copy from TS40007953)

Define Rules for responsible approvers determination.

For the definition of mentioned rules you need to go to transaction SPRO, then navigate to: SAP Implementation Guide->SAP Supplier Relationship Management->Cross-Application Basic Settings->Business Workflow->Process-Controlled Workflow->Process-Controlled Workflow->Define Filter Values for BAdI 'Define Agents'.

Here you should define 2 new rules - each for one step.

Define new Event/Expression for process level evaluation

Check, if process level relevant.

Step 1 - Requester in case buy on behalf

Create new expression.

New Expression is based on BRF Rules. Both expressions we need (CREATOR and REQUESTER) exist in Standard. So we create a new Expression type 0FB001 (SAP Formula Interpreter)

Go to transaction BRF and open customer group ZSRM.

Right click on Expressions and select New expression.

Enter type boolean and click on FormulaEditor.

Formula is just a comparison if creator not equal to requester

Go back and save an expression.

Create new event

Now it is time to create an event for created expression.

Select the type 0EVENT for event.

Enter description and save the event. After that open event in edit modus.

Add expression to the event and save the data

Now you are ready with event for first step.

Step 2 - Customer approver

For the second step a customer function will be used.

Create evaluation function

Create a new function group ZSRM_WF_EX for Workflow Expressions.

Create new function module ZSRM_WF_EX_CUST_APPR_REL (Custom Approval relevance) as a copy from BRF_CALL_FUNCTION_TEMPLATE

Create new expression.

Now a new expression with the call of created function module to be created.

Go to BRF transaction and create new expression

Enter type and fucntion module name.

Save the expression.

Create new event

Now it is time to create an event for created expression.

Now you are ready with event for the second step.

Link to the second part of this post: Custom Workflow - Developer view - Part 2 - Process Schema and Implementation

P.S.:  English language is not my native language, and any person is not insured from mistakes and typing errors. If you have found an error in the text, please let me know - I'll correct the post.

P.P.S.: If you have some ideas, how to correct/improve this post - please don't hesitate to leave a comment.

5 Comments