How to Create your Own Rule in Workflow?

Similar documents
POWL: Infoset Generation with Web Dynpro ABAP

Triggering the Process Chains at Particular Date using Events

Easy Lookup in Process Integration 7.1

Integration of Web Dynpro for ABAP Application in Microsoft Share Point Portal

This article explains the steps to create a Move-in letter using Print Workbench and SAPScripts.

Limitation in BAPI Scheduling Agreement (SA) Create or Change

How to Create Top of List and End of List of the ALV Output in Web Dynpro for ABAP

Procedure to Trigger Events in Remote System Using an ABAP Program

Open Text DocuLink Configuration - To Access Documents which are Archived using SAP

How to Integrate Web Dynpro ABAP in Portal and Capture Portal Logon User Name

Material Master Archiving in Simple Method

SDN Community Contribution

Creation of Sets in SAP-ABAP, How to Read them INI SAP-ABAP Reports

Graphical Mapping Technique in SAP NetWeaver Process Integration

Freely Programmed Help- Web Dynpro

Linking Documents with Web Templates

SDN Community Contribution

How to Create and Schedule Publications from Crystal Reports

Customized Transaction to Trigger Process Chain from Failed Step

How to Default Variant Created for Report Developed In Report Painter/Writer

Creating, Configuring and Testing a Web Service Based on a Function Module

Using Radio Buttons in Web Template

Customizing Characteristic Relationships in BW-BPS with Function Modules

DB Connect with Delta Mechanism

A Simple Web Dynpro Application to Locate Employee s Location into Google Map

Custom Process types Remote Trigger and End Time

Table Row Popup in Web Dynpro Component

Standalone BW System Refresh

Routines in SAP BI 7.0 Transformations

SDN Community Contribution

MDM Syndicator: Custom Items Tab

Adding Files as Attachments to SAP Interactive Forms in the Java Environment

SAP BW Copy Existing DTP for Data Targets

Add /Remove Links on ESS Home Page in Business Package 1.5

Using Query Extract to Export Data from Business warehouse, With Pros and Cons Analyzed

How to Reference External JAR Files in Web Dynpro DC in SAP NW Portal 7.3

Complete Guide for Events in Workflows in SAP ECC 6.0

Internationalization in WebDynpro ABAP Applications

Reporting Duplicate Entries

Data Flow During Different Update Mode in LO Cockpit

How to use Boolean Operations in the Formula as Subsidiary for IF Condition

MDM Import Manager - Taxonomy Data (Attribute Text Values) Part 3

Web Dynpro ABAP: Dynamic Table

Step by Step Procedure for DSO Creation

Exception Handling in Web Services exposed from an R/3 System

E-Sourcing System Copy [System refresh from Production to existing Development]

A Step-by-Step Guide on IDoc-ALE between Two SAP Servers

SMT (Service Mapping Tool)

Step By Step Procedure to Implement Soap to JDBC Scenario

ecatt Part 6 System Data Container

Template Designer: Create Automatic PDF Documents for Attachment or Print Purpose

Displaying SAP Transaction as Internet Application in Portal

Adding Custom Fields to Contract Account Screen

List of Values in BusinessObjects Web Intelligence Prompts

Data Extraction & DS Enhancement in SAP BI Step by Step

Open Hub Destination - Make use of Navigational Attributes

Creating Custom SU01 Transaction Code with Display and Password Reset Buttons

Common Queries/Errors while working with Adobe Print PDF Forms

Exposing the XI monitoring functionality as a Web Service

Comparison Terms and SPL Check Logic

BAPI Execution in offline Adobe Form

How to Broadcast BEx Workbooks using BW Pre-calculation Server and through Process Chains

Recreating BIA Indexes to Address the Growth of Fact Index Table

About ITAB Duplicate_Key (SAP lrsaods) Runtime Error

Information Broadcasting Part 3 Scheduling the First Report

Fetching User Details from the Portal and Displaying it in Web Dynpro with Authentication in the Portal

Implementing Customer Exit Reporting Variables as Methods

Step by Step Guide for PI Server Start and Stop Procedure

Download SAP Query Output to Local/ Network Folders in Background

Step By Step: the Process of Selective Deletion from a DSO

Replacement Path: Explained with an Illustrated Example

Extracting Missing Fields of Data Source Which Are Present In Their Extract Structure

Using Customer Exit Variables in BW/BI Reports: Part - 14

Material Listing and Exclusion

Upload Image file from system in Web dynpro view

Maintaining Roles and Authorizations in BI7.0 - RSECADMIN

Errors while Sending Packages from OLTP to BI (One of Error at the Time of Data Loads through Process Chains)

Explore to the Update Tab of Data Transfer Process in SAP BI 7.0

Applies To:...1. Summary...1. Table of Contents...1. Procedure..2. Code... Error! Bookmark not defined.0

Dynamically Enable / Disable Fields in Table Maintenance Generator

Restricting F4 (Input Help) Values While Running a SAP BW Query

How to Configure User Status in mysap SRM

Complete Guide to Learn ALE Error Handling Through Workflow and Implementation

Custom BADI Using Function Module UJQ_RUN_AXIS_QUERY

How to Create View on Different Tables and Load Data through Generic Datasource based on that View

Load Info Cube in SCM 5.0 (BI 7.0)

Purpose of Goods Receipt Message indicator in Purchase Orders

Database Statistics During ODS Activation

Xcelsius Tricks Part 5 Create a Loading Bar in SAP Crystal Dashboard and Presentation Design (Xcelsius 2008)

Creation of Alert Data Service VC model for the BI query exception using Information Broadcasting

Using Rule Group in SAP-BI. Part - 1

Validity Table in SAP BW/BI

Administrating ABAP+JAVA and SLD Problems of SAP PI 7.1

Function Module to Create Logo

Using Customer Exit Variables in BW/BI Reports Part - 1

Web Dynpro: Coloring Table Conditionally

Extraction of Hierarchy into Flat File from R/3 and Loading in BW System

How to Create and Execute Dynamic Operating System Scripts With XI

Table Properties and Table Popin

BPM Multi Line Container in Integration Process

Transcription:

How to Create your Own Rule in Workflow? Applies to: SAP NetWeaver / ABAP, Workflow. Summary The article emphasis the rule creation in workflow, the rule is used to pick the right agent at the runtime. From this document the viewer can learn how to create a Rule in workflow for process the Work-item. Author: P. Surjith Kumar Company: Enteg Infotech,3rd Floor Maruthi Towers, 3/4, Hosur Main Road, Madiwala Extension, Bangalore-560068 Created on: 23 rd April 2008 Author Bio I am P.Surjith Kumar a Workflow Consultant working with Enteg InfoTech, Bangalore for the Past Couple of Years. Currently I am working in Workflow for the past one and half years prior to that I worked in ABAP Report and Upgrade. And My Company Enteg Infotech is a SAP Services Partner Company with a strong vision to deliver solutions that provide enduring value to our customers. Our goal is simple: help our customers realize and exceed their stakeholders expectations. 2008 SAP AG 1

Table of Contents Rule PFAC...3 Business Scenario...4 Rule Creation Step by Step...4 Related Content...17 2008 SAP AG 2

Rule PFAC In the Workflow, Agent is person who receives and processes the workitem, this agent can be picked in one of the following ways. 1) Role 2) Rule 3) Organizational Unit 4) Job 5) Position 6) Work Center 7) User 8) Expression 9) Workflow initiator (expression) In the above mention ways using the RULE how the agent is picked is explained in detail. In the Rule there are various categories available that are mentioned below, in this article Agent Determination : Function to be Executed category of the RULE demonstrated. The RULE is Created or Changed in the Transaction Code PFAC. The possible Categories in Rule definition are 1) Agent Determination : Responsibilities 2) Agent Determination : Organizational Data 3) Agent Determination : Function to be Executed 4) Agent Determination : Function to be Executed asynchronously 5) Agent Determination : Organizational Model 6) Webflow : Specification of URL 7) Webflow : XML Format 8) Webflow : Authentication 9) Webflow : Send 10) Webflow : Determine Format (if Group) 11) Webflow : Signature 2008 SAP AG 3

Business Scenario When a Travel Request is created using the Transaction TRIP a workflow get triggered and an approvals request is sent to the approvers for Approval. Approver (Agent) Picking: The approver should be the User Responsible of the Creator s (Employee) Cost Center. Logic Used: The Creator s (Employee) Cost Center has to find in the table FTPT_REQ_ACCOUNT based on the Employee number and the Trip Number. Then using the Same Cost Center the User Responsible has to Picked from the Table CSKS. And the Travel Approval Request is sent to the respective person User Responsible of the Cost Center. Rule Creation Step by Step The following seven steps are necessary to create a Rule for a workflow. 1) PFAC - Transaction to Create Rule 2) Select the category Agent Determination: Function to be Executed in the rule. 3) Create a Function Module to Pick the Agent 4) Include the Function module and save it 5) Create the Rule elements for rule container 6) Simulate and Check the Rule 7) Include the Rule inside the Workflow 2008 SAP AG 4

1) PFAC - Transaction to Create Rule a) Enter the Rule Name and Click Create b) Then you will see the following screen, give the Description and select the Category 2008 SAP AG 5

2) Give the Description Select the category Agent Determination: Function to be Executed in the rule. 3) Create a Function Module to Pick the Agent 2008 SAP AG 6

FUNCTION ysurjith_rule. *"------------------------------------------------------------------- *"*"Local Interface: *" TABLES *" AC_CONTAINER STRUCTURE SWCONT *" ACTOR_TAB STRUCTURE SWHACTOR *" EXCEPTIONS *" APPROVER_NOT_FOUND *" EMPNO_NOT_FOUND *" TRIPNO_NOT_FOUND *"------------------------------------------------------------------- ********************************************************************* * Created by: P SURJITH KUMAR, Enteg Infotech, Bangalore * Version : 1.0 * Purpose : Agent Resolution for Travel Workflow ********************************************************************* INCLUDE <cntn01>. DATA : lv_pernr TYPE pa0001-pernr, lv_reinr TYPE ftpt_req_account-reinr, wa_actor TYPE swhactor, lv_kostl TYPE ftpt_req_account-kostl, " Cost Center local value declaration lv_verak_user TYPE csks-verak_user, " Travel Request Cost Assignment Table num_lines TYPE i. * read Employee Number elements out of container swc_get_element ac_container 'EMPNO' lv_pernr. 2008 SAP AG 7

IF sy-subrc <> 0. RAISE empno_not_found. ENDIF. * read Trip Number elements out of container swc_get_element ac_container 'TRIPNO' lv_reinr. IF sy-subrc <> 0. RAISE tripno_not_found. ENDIF. SELECT SINGLE kostl INTO lv_kostl FROM ftpt_req_account WHERE pernr = lv_pernr AND reinr = lv_reinr. IF sy-subrc = 0. SELECT SINGLE verak_user INTO lv_verak_user FROM csks WHERE kostl = lv_kostl. " Get data based on Cost Centre " Get the Approver and store it in this internal Table wa_actor-otype = 'US'. wa_actor-objid = lv_verak_user. APPEND wa_actor TO actor_tab. ENDIF. * Checking the Approver found or not, if not found RAISE an Exception DESCRIBE TABLE actor_tab LINES num_lines. IF num_lines IS INITIAL. RAISE approver_not_found. ENDIF. ENDFUNCTION. 2008 SAP AG 8

4) Give Function module Name and save the Rule then the Rule number will be generated automatically. 2008 SAP AG 9

5) Create the Rule elements for rule container 2008 SAP AG 10

Simulate and Check the Rule Click the Simulation button and provide the necessary inputs and press Enter 2008 SAP AG 11

Click this Simulation button in the Rule a small S ill b l Enter the input and Press Enter 2008 SAP AG 12

Enter the input for the Rule and Press ENTER button. Then the Output is appeared as below. 2008 SAP AG 13

Include the Rule inside the Workflow Give the Rule Number and generate the binding in the Workflow 2008 SAP AG 14

Select the RULE and give the Rule number as below Generate the Binding and test the Workflow 2008 SAP AG 15

Save and activate the workflow then test it. 2008 SAP AG 16

Related Content http://help.sap.com/saphelp_47x200/helpdata/en/ef/3dc9529bbe11d189470000e8216659/frameset.htm http://www.saptechnical.com/tutorials/workflow/rules/create.htm https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/5557 2008 SAP AG 17

Disclaimer and Liability Notice This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade. SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk. SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document 2008 SAP AG 18