Sei sulla pagina 1di 103

Live Expert Session for

SAP SRM 7.0

Workflow Advanced

Jijilal Ramachandran, Procurement RIG EMEA


Markus Frieske, Procurement RIG Americas
Masayuki Sekihara, Procurement RIG APJ

November 14, 2008


SRM 7.0 Workflow Advanced - Agenda

Overview : Customizing:

Business Overview Technical Configuration


Functions BRF Configuration

Changes Business Process Configuration

Migration decision

Further Reference
Extensions:
Architecture:
BRF Examples
Process-Controlled Workflow
BADI
Decision Type
Agent BADI Examples
Business Rule Framework
Migration
Runtime Flow

Covered by Basic Session on


November 10

© SAP 2008 / Page 2


SRM 7.0 Approval Framework
2 enablement possibilities

Application-Controlled Workflow Process-Controlled Workflow


Existed in SRM 5.0 and releases before Introduced in SRM 6.0
Application has control on the Business Modeled/Configured process has
workflow templates control on the process-flow

Development Strategy

• No new features and functions will be • In future releases new features and
developed functions will be developed
• Development effort will be only on bug- • Rolled-in new requirements from the
fixing customer will be developed
Positioning

• Not to be positioned to new customers • Workflow of choice


• Position to upgrade customers only if
there is a considerable effort to migrate

© SAP 2008 / Page 3


Basics of ‘How it works’

B
Consists of Many
U Process Step 1
Linked to many S Schema 1
I Process Step 2
N
E Process Step 3
BO Schema 2
S
R
Process Step 4
U
L
Schema 3 H
A
E
S

Sequence No
Process Type
Agent(s)
Business rule
Decision Type
Task id
Process-Controlled Workflow
Configuration Blocks

APL
Application Create SC Adjust (w. pot. Accept/Recall
Restart)
Approve/Reject
Event /SAPSRM/CL_WF_PDO. Approve/Reject
READY_FOR_WORKFLOW

BWF

Should not change


SAP Process Control Process Level
Business WS40000014 WS40000015
Workflow Completion Approval
WS40000017 WS40000016
PC
SRM
Process Process Responsible
Level
Level Process

Main Configuration
Decision Type
Scheme
Definition

BRF Event Event

BRF
Expression Expression
Expression Expression

© SAP 2008 / Page 5


Customizing – Technical Configuration

Customize SAP Business Workflow Automatically (Required)


Check Event Trigger Configuration (Option)
Check Event Type Linkage (Required)
Generalize Task (Required)
Check Task Generalization (Option)
Check Task Consistency (Option)
Copy BRF Objects (Required)

© SAP 2008 / Page 6


Solution Manager IMG Configuration

Solution Manager (SOLAR02)

IMG

BWF

BRF

PC
© SAP 2008 / Page 7
Customize SAP Business Workflow
Automatically (Required)
Execute the Automatic Workflow Customizing
Automatic Customizing for Runtime Environment are performed automatically
Make sure “Maintain Runtime Environment” is green

© SAP 2008 / Page 8


Start Verification Workflow (Option)

Select 3rd button. Start Verification Workflow


Go to inbox and execute the test workitem
Select “Execute background step immediately”. You will get 2 emails.

© SAP 2008 / Page 9


Check Event Trigger Configuration (Option)

Workflow = WS40000014
Menu: Goto -> Basic Data, Strart Events Tab.

© SAP 2008 / Page 10


Check Event Type Linkage (Required)

Transaction: SWETYPV

Object: /SAPSRM/CL_WF_PDO

Event: READY_FOR_WORKFLOW

Type Linkage = X

Check whether an entry has been added for the main


workflow and whether the linkage is active. This entry
should contain the following

© SAP 2008 / Page 11


Generalize Task (Required)

Task Group for 40000003 and 40000007

© SAP 2008 / Page 12


Check Task Generalization (Option)

Task Group for 40000003 and 40000007

Additonal Data -> Classification -> Detail

© SAP 2008 / Page 13


Check Task Consistency (Option)

Package: /SAPSRM/WF_CFG

© SAP 2008 / Page 14


Copy BRF Objects (Required)

Application Class: SRM_WF

Import Status: A

All Objects

Copy from client 000

Deselect Simulation flag

© SAP 2008 / Page 15


Copy BRF Objects – Check result (Option)

Transaction: BRF

You will see some object in SRM_WF BRF Object

© SAP 2008 / Page 16


Configuration Guide for Process-Controlled
Workflow generated by Solution Manager

For your handy reference, Configuration Guide is generated from Solution Manager.

Jump

© SAP 2008 / Page 17


SRM 7.0 Workflow Advanced - Agenda

Customizing:

Technical Configuration

BRF Configuration
Business Process Configuration

Offline Approval

Extensions:

BRF Examples
BADI

Agent BADI Examples


Migration

© SAP 2008 / Page 18


Customizing – BRF Configuration

Copy BRF objects (Required)


Check Pre-Defined Objects (Option)
Define Groups (Option)
Define Events (Option)
Define Expressions (Option)

© SAP 2008 / Page 19


Process-Controlled Workflow
Configuration Blocks

APL
Application Create SC Adjust (w. pot. Accept/Recall
Restart)
Approve/Reject
Event /SAPSRM/CL_WF_PDO. Approve/Reject
READY_FOR_WORKFLOW

BWF

Should not change


SAP Process Control Process Level
Business WS40000014 WS40000015
Workflow Completion Approval
WS40000017 WS40000016
PC
SRM
Process Process Responsible
Level
Level Process

Main Configuration
Decision Type
Scheme
Definition

BRF Event Event

BRF
Expression Expression
Expression Expression

© SAP 2008 / Page 20


Copy BRF Objects (Required)

Application Class: SRM_WF

Import Status: A

All Objects

Copy from client 000

Deselect Simulation flag

© SAP 2008 / Page 21


Check Pre-Defined Objects (Option)

Transaction: BRF
BRF Objects: SRM_WF
Expression:
0B_CT_ISCHANGEVERS

SAP SRM delivers a number of expressions that you can use. These are listed and
explained in a document on SAP Service Marketplace at
http://service.sap.com/srm-inst

© SAP 2008 / Page 22


Define Groups (Option)

Groups are used to cluster BRF-Objects depending on their area and purpose
However, Groups are not required for an approval workflow

© SAP 2008 / Page 23


Define Expression (Option)

Expressions are used to determine whether or not a certain approval level is required. The
result of an expression can be compared with a concrete value. Generally, expressions
evaluate document fields
There are many Expression Types

© SAP 2008 / Page 24


Expression detail (Option)

Example for FM Type


Specify Result Type
Specify Length
FM name
and Parameters

© SAP 2008 / Page 25


Define Events (Option)

Create a new event, assign an Impl. Class, Appl.Class, Group (optional)

Events should have link to Expressions

Always select the One Instance Mode and Multiple Instance Modes fields

© SAP 2008 / Page 26


SRM 7.0 Workflow Advanced - Agenda

Customizing:

Technical Configuration
BRF Configuration

Business Process Configuration


Offline Approval

Extensions:

BRF Examples
BADI

Agent BADI Examples


Migration

© SAP 2008 / Page 27


Customizing
– Business Process Configuration

Activate BC Sets (Recommend)


Define Process Level (Option if BC Sets is activated)
Define Recipient of Notification (Option)
Define Deadline for Events (Option)
Define Filter Values for BADI Define Agent (Option)
Define Filter Values for BADI Define Reviewer (Option)

© SAP 2008 / Page 28


Activate BC Sets (Recommend)

BC Sets are available for quick start workflow implementation

Transaction: SCPR20

BC Sets name: /SAPSRM/*

© SAP 2008 / Page 29


Activate BC Sets (Recommend)

Activating BC Sets creates entries BRF and Process Level Definition tables

© SAP 2008 / Page 30


Activate BC Sets - Sequence

1. Complex example
/SAPSRM/TH_BO_600_001_SP04 Test Workflow Settings: All Business Objects
2. WithOut Approval
/SAPSRM/C_CO_600_000_SP04 Confirmation Without Approval
/SAPSRM/C_CT_600_000_SP04 Contract Without Approval
/SAPSRM/C_IN_600_000_SP04 Invoice Without Approval
/SAPSRM/C_PO_600_000_SP04 Purchase Order Without Approval
/SAPSRM/C_QT_600_000_SP04 RFx Response Without Approval
/SAPSRM/C_RQ_600_000_SP04 RFx Without Approval
/SAPSRM/C_SC_600_000_SP04 Shopping Cart Without Approval
3. 1-Step Approval by Manager
/SAPSRM/C_CO_600_001_SP04 Confirmation with One-Level Manager
/SAPSRM/C_CT_600_001_SP04 Contract with One-Level Manager Approval
/SAPSRM/C_IN_600_001_SP04 Invoice with One-Level Manager Approval
/SAPSRM/C_PO_600_001_SP04 Purchase Order with One-Level Manager
/SAPSRM/C_QT_600_001_SP04 RFx Response with One-Level Manager
/SAPSRM/C_RQ_600_001_SP04 RFx with One-Level Manager Approval
/SAPSRM/C_SC_600_001_SP04 SHopping Cart with One-Level Manager
The last activated BC Sets is active. This means all documents go 1-step approval by Manager.

© SAP 2008 / Page 31


Define Process Levels – Business Object
(Option if BC Sets is activated)

A Process Level is level within a completion or approval process.

Process Levels belong to a process schema which refers to a specific Business


Object, for example BUS2121 Shopping Cart

© SAP 2008 / Page 32


Define Process Levels – Evaluation ID
(Option if BC Sets is activated)

Second Step – Determine Evaluation ID, for example 9EV_SC_00S

The Evaluation ID specifies the ID of the event that triggers the workflow. The
specific events are defined in the Business Rule Framework (BRF).

© SAP 2008 / Page 33


Define Process Levels – Schema
(Option if BC Sets is activated)

Third Step – Schema Definition

You can create many Process Schema Definition. One of Schema name is
returned in the Process Schema Evaluation step.

© SAP 2008 / Page 34


Define Process Levels - Level
(Option if BC Sets is activated)

Process Level Configuration


Level Type (Completion, Approval, Automatic)
Evaluation ID (BRF Event)
Responsibility Resolver name (User, Role, Manager, …)
Task ID (predefined OR customer own)
Decision Type
Jump
Microsoft Excel
Example: Worksheet

Secretary approves shopping cart


Purchasing group member approves shopping cart, because event
(SC Value > 1,000.00 EUR) was exceeded
Manager approves shopping cart, because event (SC Value > 5,000.00 EUR) exceeded

© SAP 2008 / Page 35


Define Process Levels - Level
(Option if BC Sets is activated)

© SAP 2008 / Page 36


Other Options

You can set same way for

Defaults for Ad Hoc Process Level


Here you can define defaults for adhoc levels (manually inserted approvers).

Acceptance by Contact Person


You can determine whether the contact person (in most cases document creator)receives
a work item when the approval process is finished.

Reviewer
You can define rules based on which reviewers are added to the approval process.

© SAP 2008 / Page 37


Define Recipient for Notifications (Option)

You define which users receive notifications in which application scenarios when a
work item is approved, rejected, changed, or deleted. You select users according to
their functions in the workflow process, for example, 'workflow initiator' or 'approver'.

© SAP 2008 / Page 38


Define Deadline for Events (Option)

Deadline monitoring is a workflow runtime system function that monitors the start and
end deadlines for the processing of selected work items in an approval process.

The following deadlines are already considered in the workflow templates


WS40000016 (Approval Workflow) and WS40000017 (Completion Workflow):

Latest Start Date/Time

Requested End Date/Time

Latest End Date/Time

BADI is also available


/SAPSRM/BD_WF_DEADLINES

© SAP 2008 / Page 39


Define Filter Values for BADI Define Agent
(Option)

In this step, you specify the BAdI filter that enables you to determine the user to
be assigned to a workflow task in Define Process Levels.
There are 12 predefined samples.

© SAP 2008 / Page 40


Determine Processor

This Business Add-In (BAdI) is used in the SRM Workflow component


(SRM_EBP_WFL).

You can use this BAdI to assign SRM purchasing documents (or separate parts of
these documents) to agent groups for (parallel) approval. You can either display
existing Agents or perform an implementation enhancement by creating new Agents.

© SAP 2008 / Page 41


Define Filter Values for BADI Define Reviewer
(Option)

In this step, you specify the BAdI filter that enables you to determine the user to
be assigned to a workflow task in Define Process Levels.
There are 4 predefined samples.

© SAP 2008 / Page 42


SRM 7.0 Workflow Advanced - Agenda

Customizing:

Technical Configuration

BRF Configuration
Business Process Configuration

Extensions:

BRF Examples
BADI
Agent BADI Examples

Migration

© SAP 2008 / Page 43


Extensions – BRF Examples

1. Budget Workflow
2. Multi-step Approval with completion
3. Expression Type

© SAP 2008 / Page 44


Overview

Procedure for all examples


Preconditions:
You have already configured the basic SAP Business Workflow
BRF Initialization is done in current client

Use Transaction /SAPSRM/WF_PROCESS as shortcut to configuration.

Main steps
1. Define Process Scheme.
2. Creates/adjust BRF Expression to return name of Process Schema

© SAP 2008 / Page 45


2. Budget Workflow – Schema Name

Sample BC Sets: /SAPSRM/T_SC_600_000_SP04

Scenario:

Approval by Requester‘s Manager: Requester‘s User Budget (3000 EUR /


Monthly) Exceeded

© SAP 2008 / Page 46


2.1 Budget Workflow – Process Level

9EV_SC_006
checks user
budget

© SAP 2008 / Page 47


2.2 Budget Workflow – BRF Expression

9EV_SC_006 -> 9B_SC_LEVEL_006 ->


(0V_SC_USRBUDGTSPNT > 0V_SC_SPNDNGLMTFRQST)

© SAP 2008 / Page 48


2.3 Budget Workflow – BRF Expression

© SAP 2008 / Page 49


3. Multi-step Approval with Completion

Sample BC Sets: /SAPSRM/T_SC_600_000_SP04

If there is Free Text Entry, Secretary completes SC

Responsible Purchaser completes SC

Shopping Carts with value > 1,000 will be approved by the


manager of the requester

Shopping Carts with total value > 10,000 are assigned to a


second approval step by the manager of the manager

© SAP 2008 / Page 50


3.1 Define Process Level - Overview

Sample BC Sets: /SAPSRM/T_SC_600_000_SP04

© SAP 2008 / Page 51


3.2 Level 100 – If there is Free Text Entry

If there is Free Text item, Secretary can


change the SC and pass to next level

© SAP 2008 / Page 52


3.3 Level 200 – Completion by Res.Purchaser

Completion by Responsible Purchaser

© SAP 2008 / Page 53


3.4 Level 300 – Depends on Total Value

© SAP 2008 / Page 54


3.4 Level 300 – Depends on Total Value

© SAP 2008 / Page 55


3.5 Level 400 – Total Value >1,000

© SAP 2008 / Page 56


3.6 Level 500 – Total Value > 10,000

© SAP 2008 / Page 57


3.7 Level 600 – Always false

© SAP 2008 / Page 58


5. Expression Type

Expressions are BRF objects that return a definite result

Boolean Expressions form the „IF“ part of the Rule

Expressions can be of the following types: help.sap.com


• Constant - (0CN001)

• Field of a Structure (Data Source)

• Field of a line of an Internal table (Data Source) - (0TB001)

• Call Function Module / Method - (0CF001)

• Boolean Three-operand Arithmetic - (03O001)

• Simple Formula Interpreter - (0FR001)

• SAP Formula (as used in BADI implementations) - (0FB001)

• Truth Table – Pattern Matching - (0PM001)

• Random Number Generator - (0RV001)

• Date Interval - (0DI001)

© SAP 2008 / Page 59 • Case expression - (0CE001)


5.1 General Function Module

FM /SAPSRM/WF_BRF_0EXP000 is provided to access document attributes

This expression returns TRUE


if SC has CC or AS account
assignment category

First parameter is SC object

Second Parameter is method

3rd and 4th are CC and AS

© SAP 2008 / Page 60


5.2 Function Module Type

You can create own FM but Import/Export parameter must be the same

Copy the FM /SAPSRM/WF_BRF_0EXP000

© SAP 2008 / Page 61


5.3 Case Type example

BUS2121 is linked to Eval. ID Eval. ID = Event calls Expression

Expression
ZSC_CASE_SCHEMA
determines process
schema depending on the
organizational unit

© SAP 2008 / Page 62


5.4 SAP Formula example

You can build own logic in Formula Editor without programming

© SAP 2008 / Page 63


5.5 Truth Table example

© SAP 2008 / Page 64


BRF Namespaces

SAP Application classes prefixes:


0 to 9 (such as 0FLIGHT)
A to W

Partner/Customer Application classes prefixes:


X to Z
Namespace prefix /MY_COMPANY/

SAP BRF event prefixes:


0 to 9
A to W

Partner/Customer BRF events prefixes


X to Z

All other SAP BRF object prefixes


0 to 9

All other Partner/Customer BRF object prefixes


A to Z

© SAP 2008 / Page 65


Over 230 expressions are delivered

http://service.sap.com > SAP Solutions > Solution Details > Business Solutions and
Applications > SAP Business Suite > SAP Supplier Relationsship Management >
SAP SRM 2007 - for RU Customers Only

-> Links - SRM Guides: Master, Upgrade Master, Solution Operati

-> Workflow in SAP SRM 2007


Jump

© SAP 2008 / Page 66


Business Rule Framework

help.sap.com -> SAP ERP -> SAP ERP Central Compornent -> SAP ERP
Central Compornent -> Cross-Application Services -> Business Rule Framework

© SAP 2008 / Page 67


SRM 7.0 Workflow Advanced - Agenda

Customizing:
Technical Configuration

BRF Configuration
Business Process Configuration

Offline Approval

Extensions:

BRF Examples

BADI list
Agent BADI Examples

Migration

© SAP 2008 / Page 68


BADI – Process-Controlled Workflow

Define Agennts - /SAPSRM/BD_WF_RESP_RESOLVER


You can use this Business Add-In to assign SAP SRM purchasing documents (or separate parts of these documents) to agent
groups for (parallel) approval

Define Deadlines for Events - /SAPSRM/BD_WF_DEADLINE


You can use this Business Add-In (BAdI) to calculate the different deadlines that are used in a completion or approval
process

Configure Process Levels - /SAPSRM/BD_WF_PROCESS_CONFIG


You can use the BAdI to build your own runtime version of the process schema on the basis of the design time process
schema as defined in Customizing

Manage Process Restarts- /SAPSRM/BD_WF_PROCESS_RESTAR


You can use this BAdI to avoid a complete process restart after a document change

Determine Shopping Cart Value for Purchasing Budget Workflow - BBP_SC_VALUE_GET


This BAdI allows you to implement your own method for determination of the value of a shopping cart

Adjust Search Help for Ad Hoc Agent - /SAPSRM/BD_WF_ADHOC_AGENT_F4


Enables you to filter the available users to be inserted

Adjust Search Help for Reviewers - /SAPSRM/BD_WF_REVIEWER_F4


Enables you to filter the available users to be inserted

Define Reviewers - /SAPSRM/BD_WF_REVIEWER_RULE


Assign SRM purchasing documents to agent groups for review

Customer enhancement of Offline Approval - BBP_OFFLINE_APP_BADI

© SAP 2007
2008 / Page 69
BADI Guide

Please check the BADI guide for Process-Controlled Workflow.

Jump

© SAP 2008 / Page 70


SRM 7.0 Workflow Advanced - Agenda

Customizing:
Technical Configuration

BRF Configuration

Business Process Configuration


Offline Approval

Extensions:

BRF Examples

BADI list

Agent BADI Examples


Migration

© SAP 2008 / Page 71


Agenda – Agent BADI examples

Filter Value
BADI
Method example – Area
Method example - Map

© SAP 2008 / Page 72


Define Filter values for business Add-In

There are 12 predefined samples.

BADI Definition /SAPSRM/BD_WF_RESP_RESOLVER

© SAP 2008 / Page 73


Enhancement Implementation

Shopping cart: /SAPSRM/BD_WF_AGENTS_SC

Purchase order: /SAPSRM/BD_WF_AGENTS_PO

Purchase contract: /SAPSRM/BD_WF_AGENTS_CTR

Confirmation: /SAPSRM/BD_WF_AGENTS_CONF

Invoice: /SAPSRM/BD_WF_AGENTS_INV

Request for quotation /RFQ: /SAPSRM/BD_WF_AGENTS_RFQ

Supplier quotation: /SAPSRM/BD_WF_AGENTS_QTE

In addition, there is an internal enhancement implementation:


/SAPSRM/BD_WF_AGENTS

© SAP 2008 / Page 74


Business Add-In: Define Agents

/SAPSRM/BD_WF_SC_AGENTS

© SAP 2008 / Page 75


Determining Responsible Agents

1. GET_AREA_TO_ITEM_MAP
An area of responsibility is assigned to the items. All items with the same area of
responsibility form a decision set. An area of responsibility can be, for example, a
department, a product category or a cost center. For each decision set, a new
sub-workflow is started.
Area GUID is saved to the database table /SAPSRM/D_WF_012.

2. GET_APPROVERS_BY_AREA_GUID
For each area of responsibility, the agents for the approval tasks are determined.
All agents found in this step get a work item. If the area of responsibility is a
department, for example, all employees belonging to that department could be
returned as agents. If the area of responsibility is a cost center, the person
responsible for the cost center could be returned as agent.

3. GET_FALLBACK_AGENTS
If no agent was found for an area of responsibility, fallback agents can be
provided to avoid the workflow getting stuck.

© SAP 2008 / Page 76


Agent BADI methods

Example for Responsible Purchasing Group

• Item 1 – Product Category 1100


• Item 2 – Product Category 1200 Area 1

• Item 3 – Product Category 1120 • Responsible P-Group 001

• item 4 – Product Category 2000 Area 2 • Responsible P-Group 002

• item 5 – Product Category 2010 • Responsible P-Group 003

• item 6 – Product Category 3020 Area 3

© SAP 2008 / Page 77


Method

/SAPSRM/IF_EX_WF_RESP_RESOLVER~GET_AREA_TO_ITEM_MAP:
This method assigns areas of responsibility to the items in a document. This method is called in
the approval workflow when the document is split into decision sets (Task TS40007938 in
workflow template WS40000015).
/SAPSRM/IF_EX_WF_RESP_RESOLVER~GET_APPROVERS_BY_AREA_GUID:
This method determines the agents for a given area of responsibility for each decision set in the
document. This method is called in task TS40007943.
/SAPSRM/IF_EX_WF_RESP_RESOLVER~GET_FALLBACK_AGENTS:
This method is optional and can be used to define default agents if no others were determined
in method GET_APPROVERS_BY_AREA_GUID. The default agents can approve or reject the
items in a document. In addition, the work item can be forwarded to another processor.
/SAPSRM/IF_EX_WF_RESP_RESOLVER~GET_RESP_RESOLVER_PARAMETER_F4:
This method is optional, and can be used to provide an F4 help for the field RESP. RESOLVER
PARAMETER in the customizing view “Process level configuration” in the IMG step “Define
process levels” of the new workflow.
/SAPSRM/IF_EX_WF_RESP_RESOLVER~CHECK_RESP_RESOLVER_PARAMETER:
This method is also optional, and can be used to check the user input for the field as described
in the previous method. If a value is required for the field “Responsibility Resolver Parameter”,
implement the check here.

© SAP 2008 / Page 78


Ex8. Implement Custom Agent BADI (30 min)

Describe your custom scenario.

A customer wants to implement a commodity( Product category ) based approval.

The company assigns purchasers as category managers. When a shopping cart is


created , an item level approval should be implemented where a shopping cart item is
send to the category manager for approval

Procedure

A Z table will be maintained with the details of the category and the corresponding
category manager.

A implementation of Custom agent BADI will be created which will read the
approver based on the category of the item.

© SAP 2008 / Page 79


Ex8. Implement Custom Agent BADI
Solution Part 2

Step 3

Define Filter values for BADI ‘Define Agents’


Go to IMG->SRM Supplier Relationship Management->SRM Server->Cross Application
Business settings->Business Workflow->Process Controlled Workflow->Business process
configuration->Define Filter values for BADI ‘Define Agents’

Click on ‘New Entry’ and create a new filter value with name ‘Z##_CATMAN’

© SAP 2008 / Page 80


Ex8. Implement Custom Agent BADI
Solution Part 3 - Explanation

/SAPSRM/CL_WF_AREA Identify
uniqueness of the
Area

Create subclass Z##_CL_WF_AREA_CATMAN by


copying class /SAPSRM/CL_WF_AREA_PURCH_GRP
Identify
Approvers for the
Area

Code method GET_RESPONSIBLE_APPROVERS

© SAP 2008 / Page 81


Ex8. Implement Custom Agent BADI
Solution Part 3

Step 4

Create an subclass of class /SAPSRM/CL_WF_AREA.


Go to transaction SE24( Class Builder ).

You can create a new class or copy an standard class for example
/SAPSRM/CL_WF_AREA_PURCH_GRP .

Create a new class or a copy as explained above with name Z##_CL_WF_AREA_CATMAN.

Implement the method /SAPSRM/IF_WF_AREA~GET_RESPONSIBLE_APPROVERS with the


logic to find out the approvers for each area. Each area will have a leading id which will be the
category id

© SAP 2008 / Page 82


Ex8. Implement Custom Agent BADI
Solution Part 3

Step 4 – Sample code – Part1


method /SAPSRM/IF_WF_AREA~GET_RESPONSIBLE_APPROVERS
This part of the code is the data declarations and the checks

*----------------------------------------------------------------------*
* Area of responsibility corresponds to a category;
* managers of that category are returned as agents
*----------------------------------------------------------------------*
DATA lv_category_id TYPE COMT_CATEGORY_ID.
DATA lt_manager_id TYPE hrbcitb_user.
DATA lr_manager_id TYPE REF TO hrbciuser.
DATA ls_approver TYPE /sapsrm/s_wf_approver.

Data : begin of catman,


CATEGORY type COMT_CATEGORY_ID,
MANAGER(12),
end of catman.
data : tcatman like standard table of catman.
*----------------------------------------------------------------------*
* (1) Get identifier of area's leading object
*----------------------------------------------------------------------*
lv_category_id = me->/sapsrm/if_wf_area~get_leading_object_id( ).
ASSERT ID /sapsrm/wf_core CONDITION ( NOT lv_category_id IS INITIAL ).
© SAP 2008 / Page 83
Ex8. Implement Custom Agent BADI
Solution Part 3

Step 4 – Sample code – Part2


This part of the code is for the finding the approvers for each area

*----------------------------------------------------------------------*
* (2) Return all dependent users assigned to that category
*----------------------------------------------------------------------*
refresh tcatman[].
clear catman.
refresh rt_approver[].
select category manager from Z##_CATMAN appending table
tcatman where category = lv_category_id.

LOOP AT tcatman INTO catman.


ls_approver-approver_ot = /sapsrm/if_wf_process_c=>gc_otype_user.
ls_approver-approver_id = catman-manager.
APPEND ls_approver TO rt_approver.
ENDLOOP.
if rt_approver[] is initial.
ls_approver-approver_ot = /sapsrm/if_wf_process_c=>gc_otype_user.
ls_approver-approver_id = 'de_manager'.
APPEND ls_approver TO rt_approver.

endif.
© SAP 2008 / Page 84
Ex8. Implement Custom Agent BADI
Solution Part 4 - Explanation

/SAPSRM/IF_EX_WF_RESP_RESOLVER Implements the


interface

Create subclass Z##_CL_IM_WF_Z##_CATMAN Splits item into


areas and sets a
area type and
leading object id
for each area

Code method GET_AREA_TO_ITEM_MAP


Finds approvers
for each area by
calling get
approvers
method of the
specific area
Code method GET_APPROVERS_BY_AREA_GUID

© SAP 2008 / Page 85


Ex8. Implement Custom Agent BADI
Solution Part 4

Step 5

Create an implementation of the interface /SAPSRM/IF_EX_WF_RESP_RESOLVER.


Go to transaction SE24( Class Builder ).

You can create a new class or copy an standard class for example
/SAPSRM/CL_IM_WF_RR_MANAGER .

Create a new class or a copy as explained above with name Z##_CL_IM_WF_Z##_CATMAN.

Implement the method GET_AREA_TO_ITEM_MAP with the logic to splits item into areas and
sets a area type and leading object id for each area

Implement the method GET_APPROVERS_BY_AREA_GUID with the logic to find approvers


for each area by calling get approvers method of the specific area

© SAP 2008 / Page 86


Ex8. Implement Custom Agent BADI
Solution Part 4

Step 5 – Sample code – Method GET_APPROVERS_BY_AREA_GUID

DATA lo_area TYPE REF TO /sapsrm/if_wf_area.


Constants : LC_AREA_TYPE_CATMAN type SWF_CLSNAM value 'Z##_CL_WF_AREA_CATMAN'.

* Input checks
ASSERT ID /sapsrm/wf_cfg CONDITION ( NOT is_area IS INITIAL ).
IF is_area IS INITIAL.
RETURN.
ENDIF.

* Activate fallback agents


IF is_area-area_guid = /sapsrm/if_wf_process_c=>gc_nil_guid.
RETURN.
ENDIF.

* Get responsibility area reference for given area GUID


lo_area = /sapsrm/cl_wf_area=>/sapsrm/if_wf_area~get_instance_by_guid(
iv_area_type = LC_AREA_TYPE_CATMAN
iv_area_guid = is_area-area_guid ).

* Return all responsible users assigned to that area


rt_approver = lo_area->get_responsible_approvers( ).

© SAP 2008 / Page 87


Ex8. Implement Custom Agent BADI
Solution Part 4

Step 5 – Sample code – Method GET_AREA_TO_ITEM_MAP

Package

LOOP AT lt_item_to_cat_map REFERENCE INTO lr_item_to_cat_map.

AT NEW category_id.
* Create responsibility area (corresponding to the category)
lo_area = /sapsrm/cl_wf_area=>/sapsrm/if_wf_area~create_instance(
* iv_area_type = /sapsrm/if_wf_process_c=>GC_AREA_TYPE_CATMAN
iv_area_type = 'Z##_CL_WF_AREA_CATMAN'
iv_leading_object_id = lr_item_to_cat_map->category_id
).
ls_area_to_item_map-area_guid = lo_area->get_guid( ).
ENDAT.

ls_area_to_item_map-item_guid = lr_item_to_cat_map->item_guid.
APPEND ls_area_to_item_map TO rt_item_to_area_map.
ENDLOOP.
© SAP 2008 / Page 88
Ex8. Implement Custom Agent BADI
Solution Part 5

Step 6

Implement BADI Define agents.


Go SPRO->SAP Supplier Relationship Management->SRM Server->Business Ad-ins-
>Business Workflow-> Process Controlled Workflow->Define Agents

Enhancement implementation name = Z##_CATMAN_BD_WF_AGENTS_SC

BADI implementation name = Z##_CATMAN_BADI .

Implementation class = Z##_CL_IM_WF_Z##_CATMAN created in the earlier step as the


implementation class

BADI Definition = /SAPSRM/BD_WF_RESP_RESOLVER

© SAP 2008 / Page 89


Ex8. Implement Custom Agent BADI
Solution Part 5

Define Filter.
Create a filter value for the implementation with Document Type = BUS212 and
RESP_RESOLVER_NAME = Z##_CATMAN.

© SAP 2008 / Page 90


Ex8. Implement Custom Agent BADI
Solution Part 5

Activate the Enhancement Implementation.

© SAP 2008 / Page 91


Ex8. Implement Custom Agent BADI
Solution Part 6

Step 7 – Create Process Step


Create a process schema Z00_SCHEMA_SC2

Add a process step and specify your Z00_CATMAN Responsible Resolver

© SAP 2008 / Page 92


SRM 7.0 Workflow Advanced - Agenda

Customizing:
Technical Configuration

BRF Configuration

Business Process Configuration


Offline Approval

Extensions:

BRF Examples

BADI list
Agent BADI Examples

Migration

© SAP 2008 / Page 93


Agenda

SRM Workflow with the different releases


Select Workflow Framework ( No Migration)
Start Condition migration (for Migration)
Restart workitem (for Migration)

© SAP 2008 / Page 94


SRM7.0 Positioning

SRM 5.0 – Application-Controlled Workflow with ITS UI

SRM 6.0 – Process-Controlled Workflow with WebDynpro UI

SRM 7.0 - Application-Controlled Workflow with WebDynpro UI


AND Process-Controlled Workflow with WebDynpro UI

New Customer
Process Controlled Workflow recommended

Upgrade Customer
Can choose Application-Controlled Workflow or Process-Controlled Workflow

© SAP 2008 / Page 95


Select Workflow Framework (No Migration)

Customer have the option to decide whether he wants to use Process Controlled Workflow or
Application Controlled Workflow via customizing.

Default setting for workflow framework in SRM 7.0 is to use Process Controlled Workflow. The
customer can switch to Application controlled workflow via customizing.

In SRM 7.0 BC sets are delivered which on activation enables out-of-the-box simple approval
scenarios on process controlled framework like ‘One Step Manager Approval’.

© SAP 2008 / Page 96


Select Workflow Framework (No Migration)

Note: Upgrade customer can use current productive use workflow templates in
Application-Controlled workflow. In this case customer must set flag “AC”.
The default workflow framework setting is the Process-Controlled Workflow “PC”.

/SAPSRM/C_WF_100 – System Default

/SAPSRM/C_WF_101 – Customer Default

/SAPSRM/C_WF_102 – User Level Default

© SAP 2008 / Page 97


Start condition migration (for Migration)

If you decided to migrate SRM50 or earlier workflow to “Process-Controlled


Workflow, you can use start condition migration to BRF expression.
Report /SAPSRM/WF_COND_MAPPING
Reads start conditions (/nSWB_COND) from SRM 5.0 Workflow and transfers
them into SRM 7.0 BRF Expression Formulas
(e.g. 1- and 2-step Approval, Spending Limit and SC Completion, also for Contracts,
Purchaser Order etc.)

Uses entries from the Process Level table /SAPSRM/C_WF_MAP with one
Completion Approval and two Approval steps

© SAP 2008 / Page 98


Restart Workitem – Step1 (for Migration)

If you decided to migrate SRM50 or earlier workflow to “Process-Controlled


Workflow, you should migrate “Iive” workitem.

All your running workflows need to be stopped and restarted using the Process-
Controlled Workflow framework.

Note:
You must have completed the process level configuration and test the workflow once.

Run the report /SAPSRM/PR_WF_MIGRATION_CFG


„Set Toggle“ option

© SAP 2008 / Page 99


Workitem Migration – Step2 (for Migration)

Note: Before you start migrating open work items, you must execute a test to make
sure that the new workflow works properly.

© SAP 2008 / Page 100


Workitem Migration – Step3 (for Migration)

This action will stop your open work items and start new work items.

This report searches for workitems, sets them to CANCELLED and starts the respective
new workitem (with the GUID of the old workitem document).

© SAP 2008 / Page 101


Questions

* Workflow Basics session was on November 10.

Please join SDN SRM Forum. Community members will help solving your issues.

http://sdn.sap.com -> Forums -> SRM - Workflow & User/Vendor/Org.


Management

© SAP 2008 / Page 102


Copyright 2008 SAP AG
All Rights Reserved
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed
without prior notice.
Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.
SAP, R/3, xApps, xApp, SAP NetWeaver, Duet, SAP Business ByDesign, ByDesign, PartnerEdge and other SAP products and services mentioned herein as well as their respective logos are
trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world.
Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius and other Business Objects products and services mentioned
herein as well as their respective logos are trademarks or registered trademarks of Business Objects S.A. in the United States and in several other countries. Business Objects is an SAP
Company. All other product and service names mentioned and associated logos displayed are the trademarks of their respective companies. Data contained in this document serves
informational purposes only. National product specifications may vary.
The information in this document is proprietary to SAP. No part of this document may be reproduced, copied, or transmitted in any form or for any purpose without the express prior written
permission of SAP AG. This document is a preliminary version and not subject to your license agreement or any other agreement with SAP. This document contains only intended strategies,
developments, and functionalities of the SAP® product and is not intended to be binding upon SAP to any particular course of business, product strategy, and/or development. Please note that
this document is subject to change and may be changed by SAP at any time without notice. SAP assumes no responsibility for errors or omissions in this document. SAP does not warrant the
accuracy or completeness of the information, text, graphics, links, or other items contained within this material. This document is provided without a warranty of any kind, either express or
implied, including but not limited to the implied warranties of merchantability, fitness for a particular purpose, or non-infringement.
SAP shall have no liability for damages of any kind including without limitation direct, special, indirect, or consequential damages that may result from the use of these materials. This limitation
shall not apply in cases of intent or gross negligence.
The statutory liability for personal injury and defective products is not affected. SAP has no control over the information that you may access through the use of hot links contained in these
materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Web pages.

Weitergabe und Vervielfältigung dieser Publikation oder von Teilen daraus sind, zu welchem Zweck und in welcher Form auch immer, ohne die ausdrückliche schriftliche Genehmigung durch
SAP AG nicht gestattet. In dieser Publikation enthaltene Informationen können ohne vorherige Ankündigung geändert werden.
Einige von der SAP AG und deren Vertriebspartnern vertriebene Softwareprodukte können Softwarekomponenten umfassen, die Eigentum anderer Softwarehersteller sind.
SAP, R/3, xApps, xApp, SAP NetWeaver, Duet, SAP Business ByDesign, ByDesign, PartnerEdge und andere in diesem Dokument erwähnte SAP-Produkte und Services sowie die
dazugehörigen Logos sind Marken oder eingetragene Marken der SAP AG in Deutschland und in mehreren anderen Ländern weltweit. Business Objects und das Business-Objects-Logo,
BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius und andere im Text erwähnte Business-Objects-Produkte und -Dienstleistungen sowie die entsprechenden
Logos sind Marken oder eingetragene Marken der Business Objects S. A. in den USA und anderen Ländern weltweit. Business Objects ist ein Unternehmen der SAP. Alle anderen in diesem
Dokument erwähnten Namen von Produkten und Services sowie die damit verbundenen Firmenlogos sind Marken der jeweiligen Unternehmen. Die Angaben im Text sind unverbindlich und
dienen lediglich zu Informationszwecken. Produkte können länderspezifische Unterschiede aufweisen.
Die in dieser Publikation enthaltene Information ist Eigentum der SAP. Weitergabe und Vervielfältigung dieser Publikation oder von Teilen daraus sind, zu welchem Zweck und in welcher Form
auch immer, nur mit ausdrücklicher schriftlicher Genehmigung durch SAP AG gestattet. Bei dieser Publikation handelt es sich um eine vorläufige Version, die nicht Ihrem gültigen Lizenzvertrag
oder anderen Vereinbarungen mit SAP unterliegt. Diese Publikation enthält nur vorgesehene Strategien, Entwicklungen und Funktionen des SAP®-Produkts. SAP entsteht aus dieser
Publikation keine Verpflichtung zu einer bestimmten Geschäfts- oder Produktstrategie und/oder bestimmten Entwicklungen. Diese Publikation kann von SAP jederzeit ohne vorherige
Ankündigung geändert werden.
SAP übernimmt keine Haftung für Fehler oder Auslassungen in dieser Publikation. Des Weiteren übernimmt SAP keine Garantie für die Exaktheit oder Vollständigkeit der Informationen, Texte,
Grafiken, Links und sonstigen in dieser Publikation enthaltenen Elementen. Diese Publikation wird ohne jegliche Gewähr, weder ausdrücklich noch stillschweigend, bereitgestellt. Dies gilt u. a.,
aber nicht ausschließlich, hinsichtlich der Gewährleistung der Marktgängigkeit und der Eignung für einen bestimmten Zweck sowie für die Gewährleistung der Nichtverletzung geltenden Rechts.
SAP haftet nicht für entstandene Schäden. Dies gilt u. a. und uneingeschränkt für konkrete, besondere und mittelbare Schäden oder Folgeschäden, die aus der Nutzung dieser Materialien
entstehen können. Diese Einschränkung gilt nicht bei Vorsatz oder grober Fahrlässigkeit.
Die gesetzliche Haftung bei Personenschäden oder Produkthaftung bleibt unberührt. Die Informationen, auf die Sie möglicherweise über die in diesem Material enthaltenen Hotlinks zugreifen,
unterliegen nicht dem Einfluss von SAP, und SAP unterstützt nicht die Nutzung von Internetseiten Dritter durch Sie und gibt keinerlei Gewährleistungen oder Zusagen über Internetseiten
Dritter ab.
Alle Rechte vorbehalten.
© SAP 2008 / Page 103

Potrebbero piacerti anche