Sie sind auf Seite 1von 18

Customer Demo: Integration between SAP Business Workflow and BRFplus

Applies to
Integration scenarios of SAP Business Workflow and Business Rule Framework plus (BRFplus) based on SAP NetWeaver 7.02 SP6 or above.

Summary
This document describes a demo which in detail demonstrates the different integration scenarios between SAP Business Workflow and Business Rule Framework plus (BRFplus). The demo shows how business logic defined in a BRFplus application can be used to control a workflow process. Furthermore, it demonstrates how existing workflow templates can be triggered out of a BRFplus application. Authors: Csaba Kornyi, Carsten Ziegler

Company: SAP AG Created on: 19 May 2011

About the Authors


Csaba Kornyi is an Integration Development Consultant with the focus areas SAP NetWeaver Folders Management, SAP Business Workflow, and Business Rule Framework plus. He has joined SAP in 2006. Since then he has been working in various internal and customer projects as application expert and project lead.

Carsten Ziegler is the Lead Architect and Product Owner of Business Rule Framework plus. He joined SAP in 2000. Since then he has been working in various projects as a developer, development architect and project lead.

SAP DEVELOPER NETWORK | sdn.sap.com 2011 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 1

Customer Demo: Integration between SAP Business Workflow and BRFplus

Table of Contents
Demo overview ................................................................................................................................................... 3 SAP Business Workflow.................................................................................................................................. 3 Business Rule Framework plus ...................................................................................................................... 3 System requirements ...................................................................................................................................... 3 Context of the demo ........................................................................................................................................ 3 The demo step-by-step ....................................................................................................................................... 5 Integration Aspects ........................................................................................................................................... 10 Integration of BRFplus into SAP Business Workflow .................................................................................... 10 Integration of SAP Business Workflow into BRFplus .................................................................................... 13 Recent functional extensions ............................................................................................................................ 16 Related Content ................................................................................................................................................ 17 Copyright........................................................................................................................................................... 18

SAP DEVELOPER NETWORK | sdn.sap.com 2011 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 2

Customer Demo: Integration between SAP Business Workflow and BRFplus

Demo overview
The demo described in this document gives an overview of the existing integration possibilities between SAP Business Workflow and Business Rule Framework plus (BRFplus). In the following section, we give a short introduction into these two technical frameworks. SAP Business Workflow SAP Business Workflow can be used to define business processes that are not yet mapped in the SAP system. These may be simple release or approval procedures, or more complex business processes such as creating a material master and the associated coordination of the departments involved. SAP Business Workflow is particularly suitable for situations in which work processes have to be run through repeatedly, or situations in which the business process requires the involvement of a large number of agents in a specific sequence. Business Rule Framework plus BRFplus is the business rules system of SAP NetWeaver ABAP. It is a comprehensive framework which helps business and IT users to model rules used for automatic decision support in business cases of all kinds. In addition, a flexible open API facilitates experienced IT users to extend the framework to their specific needs. Advanced features such as browser-based UI, traceability, and simulation eases the effort and time invested in implementing policies and rules. System requirements SAP NetWeaver 7.02 SP6 or above

Context of the demo The demo simulates a leave request of an employee who is member of a financials department. If the planned time of absence is less than 30 days, the absence of the employee will only be approved or rejected by the manager (one-step approval). (To keep the demo simple, the time of absence will be calculated in calendar days between the first day and the last day of absence without taking weekends or public holidays into account.) If the time of absence is 30 days or more, a two-step approval is needed. In this case, the leave request will first be sent to the supervisor of the employee. If the supervisor has approved, the leave request will be sent to the HCM department where a HCM clerk needs to make a second approval. If both the supervisor and the HCM department have approved the employee's leave request, and if the employee is working in the financials department, a second workflow will be triggered automatically with a message for the supervisor to take a temporary replacement of the employee into account. The workflow ends if the leave request of the employee has been approved successfully or if, in the course of the process, either the supervisor or the HCM department rejects the employee's leave request. In case of rejection, the leave request will be automatically deleted by the system and an appropriate message will be sent to the workflow inbox of the employee. In the following screenshots you can see the complete designs of the two mentioned workflows. First the main workflow, second the subworkflow for the temporary replacement message to the supervisor.

SAP DEVELOPER NETWORK | sdn.sap.com 2011 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 3

Customer Demo: Integration between SAP Business Workflow and BRFplus

Figure 1: Design of the main workflow

SAP DEVELOPER NETWORK | sdn.sap.com 2011 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 4

Customer Demo: Integration between SAP Business Workflow and BRFplus

Figure 2: Design of the subworkflow

The demo step-by-step


In this section, a high-level step-by-step description of the demo is given. 1. By using the transaction WF_BRF_LEAVE the employee creates a leave request.

Figure 3: Create Notification of Absence

SAP DEVELOPER NETWORK | sdn.sap.com 2011 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 5

Customer Demo: Integration between SAP Business Workflow and BRFplus

2. In the background, the system calculates the overall days of absence using BRFplus and decides whether a one-step or a two-step approval is needed for the request. (The integration of the BRFplus application and the defined decision table is described in the next section.)

Figure 4: BRFplus activity "Calculate Approval Steps"

3. The leave request is sent to the supervisor of the employee. The supervisor (agent of the workflow step) is determined using a standard workflow rule (ID 168).

Figure 5: Workflow activity for absence approval by manager

4. The supervisor of the employee opens his Workflow Inbox using transaction SBWP and receives the leave request as a work item.

Figure 6: Absence approval decision by manager

SAP DEVELOPER NETWORK | sdn.sap.com 2011 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 6

Customer Demo: Integration between SAP Business Workflow and BRFplus

After opening the work item, the supervisor can approve or reject the leave request. The long text of the work item provides all needed information (name of the employee, first and last day of absence, etc.). 5. If the supervisor rejects, the workflow ends and the request is deleted by the system. Additionally, an appropriate rejection message is sent to the employee's workflow inbox. If the supervisor approves, the next workflow step depends on the overall number of absence days, i.e. whether the workflow is in the one-step or in the two-step approval mode. 6. In case of a one-step approval process, a message is sent to the workflow inbox of the employee to let the requestor know that the supervisor has approved the request.

Figure 7: Absence approval message for employee after one-step approval

7. In case of a two-step approval process, a message is sent to the workflow inbox of the employee to let the requestor know that the supervisor (as the first approver) has approved the request and that the request has been forwarded to the HCM department for second approval.

Figure 8: 1st approval message for employee in two-step approval process

The responsible HCM agents are determined using the organizational unit of the HCM department defined in Organizational Management in the SAP system.

SAP DEVELOPER NETWORK | sdn.sap.com 2011 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 7

Customer Demo: Integration between SAP Business Workflow and BRFplus

Figure 9: Workflow activity for absence approval by HCM department

8. All HCM clerks assigned to the HCM department in Organizational Management receive the leave request as a work item. Based on the Workflow Standard, the first clerk opening the work item becomes the owner of the request and the work item is automatically deleted from the Workflow Inbox of all other clerks.

Figure 10: Absence approval decision by HCM department

After opening the work item, the HCM clerk can approve or reject the leave request. In the long text of the work item, all needed information is provided (name of the employee, first and last day of absence, etc.). There is also a remark in the message mentioning that the supervisor of the employee has already approved the request. 9. If the HCM clerk rejects, the workflow ends and the request will be deleted by the system. Additionally an appropriate rejection message is sent to the employee's workflow inbox. If the HCM clerk approves, a message is sent to the workflow inbox of the employee to let the requestor know that both the supervisor and the HCM department have approved the request.

SAP DEVELOPER NETWORK | sdn.sap.com 2011 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 8

Customer Demo: Integration between SAP Business Workflow and BRFplus

Figure 11: 2nd approval message for employee in two-step approval process

10. In the last step of the workflow, a second workflow using BRFplus is triggered if the employee works in the financials department. This workflow sends a message to the supervisor that recommends taking a temporary replacement into account. (The integration of the BRFplus application and the defined decision table is described in the next section.)

Figure 12: Additional management information about temporary replacement

SAP DEVELOPER NETWORK | sdn.sap.com 2011 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 9

Customer Demo: Integration between SAP Business Workflow and BRFplus

Integration Aspects
In this section, the integration aspects used in the demo between SAP Business Workflow and BRFplus is described in detail. Integration of BRFplus into SAP Business Workflow With SAP NetWeaver 7.02 SP6 or above, a workflow developer can create BRFplus activities in the workflow model. Generally, the workflow tasks behind BRFplus activities are automatically created by the system and are defined for background processing. Using this integration scenario, a BRFplus application can be inserted into the workflow logic within transaction SWDD (Workflow Builder). In step 2 of the workflow process described above, a BRFplus activity is used to calculate the overall number of absence days and thus to decide whether the workflow will continue with the one-step or the two-step approval process. In section "Context of the demo" you have the full overview of the workflow, where you can see that in the two-step approval branch additional steps for the second approval will be performed.

Figure 13: BRFplus activity "Calculate approval steps" within the workflow logic

SAP DEVELOPER NETWORK | sdn.sap.com 2011 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 10

Customer Demo: Integration between SAP Business Workflow and BRFplus

To accomplish this, the following workflow container elements are imported into and exported from the particular BRFplus application:

Figure 14: Data binding for BRFplus activity "Calculate approval steps"

SAP DEVELOPER NETWORK | sdn.sap.com 2011 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 11

Customer Demo: Integration between SAP Business Workflow and BRFplus

Within the BRFplus application, the overall number of absence days is calculated with a custom formula "Days of Absence". Within this formula, the standard formula function for calculating time duration in days (DT_DURATION_DIFF_INT_DAYS) will be used as shown in the screenshot below.

Figure 15: BRFplus formula "Days of Absence"

SAP DEVELOPER NETWORK | sdn.sap.com 2011 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 12

Customer Demo: Integration between SAP Business Workflow and BRFplus

This formula is then used in the custom decision table "Approval Steps" of the BRFplus application to define whether a one-step or a two-step approval is needed for the current leave request.

Figure 16: BRFplus decision table "Approval Steps"

Depending on the value of the returning parameter "Steps", the workflow continues with the branch for the one-step or for the two-step approval. Integration of SAP Business Workflow into BRFplus The integration between SAP Business Workflow and BRFplus also works the other way around. This is shown in the demo as well. It is possible to trigger an existing workflow from a BRFplus application using the standard BRFplus action type "Start Workflow". In the demo, a workflow which informs the supervisor about the possible need of a temporary replacement is triggered after both parties (the supervisor and the HCM department) have approved the employee's leave request and if the employee is working in the financials department. To accomplish this, a BRFplus activity is included in step 10 of the workflow process described above. This activity is used to export the department information of the employee and the instance information (InstID, TypeID, CatID) of the corresponding leave request object into the BRFplus application.

SAP DEVELOPER NETWORK | sdn.sap.com 2011 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 13

Customer Demo: Integration between SAP Business Workflow and BRFplus

Figure 17: BRFplus activity "Trigger subworkflow" within the workflow logic

The following workflow container elements are imported into and exported from the BRFplus application:

Figure 18: Data binding for BRFplus activity "Trigger subworkflow"

SAP DEVELOPER NETWORK | sdn.sap.com 2011 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 14

Customer Demo: Integration between SAP Business Workflow and BRFplus

Within the BRFplus application, a custom Start Workflow action "Trigger subworkflow" is defined where the ID and the needed interface data of the second workflow (hiring information for manager) is defined.

Figure 19: BRFplus starts workflow activity "Trigger subworkflow"

In the custom decision table "Trigger subworkflow", this action is triggered if the employee is working in the financials department.

Figure 20: BRFplus decision table "Trigger subworkflow"

SAP DEVELOPER NETWORK | sdn.sap.com 2011 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 15

Customer Demo: Integration between SAP Business Workflow and BRFplus

Recent functional extensions


SAP received a lot of positive feedback concerning the integration of BRFplus into the Business Workflow. However, we also got some requirements to further extend this functionality for better usability. Due to these requirements, the following extensions have been provided: 1. Once you created a BRFplus activity in the workflow, the signature of the underlying function cannot be changed any more (or at least it should not be changed any more). However, sometimes you notice only after you spent a lot of time with maintaining your BRFplus function that some information from the workflow container is missing. A new functionality in the workflow activity now allows you to create a new BRFplus task with reference to a previous one. During the creation of this new task, you can adopt the signature of the BRFplus function according to your needs (for example, add a new container element). On BRFplus side a new function is created as deep copy of the referenced one. The deep copy ensures that as much BRFplus content as possible is copied and that the new function is (depending on your changes) already executable. The referenced function and workflow task remain unchanged and thus stay executable. 2. Another new feature is that you can create a BRFplus task in a workflow activity based on an already existing BRFplus function. Notice that for using this feature all BRFplus data objects used in the signature of this BRFplus function need to be bound to DDIC objects. Moreover, the function needs to be a system function. And finally the workflow template and the BRFplus function should either both be local entities or both be transportable. If you use this feature, the BRFplus function is not changed at all by the system. The creation of the workflow task works very similar as the regular task creation without existing function. The major difference is that new container elements might be proposed by the system, if no existing container elements have been found for appropriately binding the data objects from the function signature. Both extensions can be applied via note into a system on 702 SP6 or higher. The note for the first extension is 1555984, the note of the second one is 1591233.

SAP DEVELOPER NETWORK | sdn.sap.com 2011 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 16

Customer Demo: Integration between SAP Business Workflow and BRFplus

Related Content
Thomas Albrecht, Carsten Ziegler, BRFplus Business Rule Management for ABAP Applications, SAP Press, http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/22373 Carsten Ziegler, How to Create Formula Functions, http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10e9c96f-0c8b-2b10-6885f00adbeb314b Tibor Molnr, Christian Auth, How to trigger SAP Business Workflows out of BRFplus, http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/005960a2-9018-2d10-3eadf984bb331b3f Sudhir Sangani Rao, Sreekanth Marella Reddy, Using BRFplus with Third-Party Rules Engine, https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0b66eba-0a8b-2b10-23a8f47907feb517 Rajagopalan Narayanan, Business Rules and Software Requirements, https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/70c669d8-3ac2-2a10-0e96c7c3786168f0 Rajagopalan Narayanan, Five Reasons to Build Agile Systems Using Business Rules Management Functionality, https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/504486eb-43c22a10-f5a7-e84ef3fd45be Online Help: http://help.sap.com/saphelp_nw70ehp1/helpdata/en/cc/85414842c8470bb19b53038c4b5259/frames et.htm

SAP DEVELOPER NETWORK | sdn.sap.com 2011 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 17

Customer Demo: Integration between SAP Business Workflow and BRFplus

Copyright
2011 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. Microsoft, Windows, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. IBM, DB2, DB2 Universal Database, OS/2, Parallel Sysplex, MVS/ESA, AIX, S/390, AS/400, OS/390, OS/400, iSeries, pSeries, xSeries, zSeries, System i, System i5, System p, System p5, System x, System z, System z9, z/OS, AFP, Intelligent Miner, WebSphere, Netfinity, Tivoli, Informix, i5/OS, POWER, POWER5, POWER5+, OpenPower and PowerPC are trademarks or registered trademarks of IBM Corporation. Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems Incorporated in the United States and/or other countries. Oracle is a registered trademark of Oracle Corporation. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc. HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C, World Wide Web Consortium, Massachusetts Institute of Technology. Java is a registered trademark of Sun Microsystems, Inc. JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. MaxDB is a trademark of MySQL AB, Sweden. SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, 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. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary. These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty. These materials are provided as is 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 not be liable for damages of any kind including without limitation direct, special, indirect, or consequential damages that may result from the use of these materials. SAP does not warrant the accuracy or completeness of the information, text, graphics, links or other items contained within these materials. 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. Any software coding and/or code lines/strings (Code) included in this documentation are only examples and are not intended to be used in a productive system environment. The Code is only intended better explain and visualize the syntax and phrasing rules of certain coding. SAP does not warrant the correctness and completeness of the Code given herein, and SAP shall not be liable for errors or damages caused by the usage of the Code, except if such damages were caused by SAP intentionally or grossly negligent.

SAP DEVELOPER NETWORK | sdn.sap.com 2011 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 18

Das könnte Ihnen auch gefallen