defining custom rules for use in sap workflow

3
Search Home Trainings Quiz Tips Tutorials Functional Cert Q's Interview Q's Jobs Testimonials Advertise Contact Us SAP Virtual/Onsite Trainings Document Categories: ABAP TM Adobe Forms ABAPHR ALE & IDocs ALV BAPI BASIS BSP Business Objects Business Workflow CRM NEW LSMW SAP Script/Smart Forms BI/BW eXchange Infrastructure (XI) Enterprise Portals (EP) eCATT Object Oriented Programming SAP Query Userexits/BADIs WebDynpro for Java/ABAP TM Others What's New? ABAP Test Cockpit HOT SAP ABAP Pragmas Understanding SE32 (ABAP Text Element Maintenance) Creating an IDoc File on SAP Application Server Understanding “Advance with dialog” option of SAP Workflow SAP Workflow Scenario: Maintenance Notification Approval Enhancements to a standard class Working with Floating Field in Adobe Forms Inserting data from Internal Table into the step “Send Mail” Display GL Account long text using enhancement framework Differences between polymorphism in JAVA and ABAP Passing multiline parameters from an ABAP Class event to a Workflow container Concept of Reevaluate agents for active work items in SAP Workflow Dynamic creation of component usage in ABAP WebDynpro Adobe Forms: Display symbols like copyright and others Deactivate Hold functionality in Purchase order (ME21N) Quiz on OOABAP Add fields in FBL5N using BADIs Tutorial on Wide casting Defining a Range in Module Pool Program Copy fields from one structure/table into another structure/table Side Panel Usage in NWBC Contribute? Sample Specs What's Hot? Defining Custom Rules for use in SAP Workflow By Raghava Vakada, Mouri Tech Solutions “I would like to explain about creating custom rules in SAP Workflow. The rules can be created or changed using the standard SAP transaction PFAC. Once the rules are created you can call these rules in any workflow via the rule container”. In this article I am creating a rule, which will find the users based on Position id. I have created a custom function module ZWF_FIND_USERS which will return me back a position under Asset Analyst (HRP1001SOBID). The custom function created should have the same interface as that of the SAP standard function module RH_GET_ACTORS. The following table parameters have to exist in the custom function module. “ACTOR_TAB STRUCTURE SWHACTOR” “AC_CONTAINER STRUCTURE SWCONT” Following is the function module code: FUNCTION ZWF_FIND_USERS. *"‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ *"*"Local Interface: *" TABLES *" ACTOR_TAB STRUCTURE SWHACTOR *" AC_CONTAINER STRUCTURE SWCONT *" EXCEPTIONS *" NOAGENT_FOUND *"‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ INCLUDE <CNTN01>. DATA : POSITION_ID LIKE ZBUSAREA‐OBJID, LT_HOLDERS TYPE STANDARD TABLE OF SWHACTOR, LWA_HOLDERS TYPE SWHACTOR, LWA_USERS TYPE STANDARD TABLE OF HRP1001, WA_USERS TYPE HRP1001, NUM_LINES TYPE I. *Read values assigned to the rule criteria SWC_GET_ELEMENT AC_CONTAINER 'POSITION_ID' POSITION_ID. SELECT * FROM HRP1001 INTO table LWA_USERS WHERE OBJID = POSITION_ID. IF NOT LWA_USERS IS INITIAL. REFRESH LT_HOLDERS[]. loop at LWA_USERS into WA_USERS. Condense WA_USERS‐SOBID. LWA_HOLDERS‐OTYPE = 'US'. LWA_HOLDERS‐OBJID = WA_USERS‐SOBID. APPEND LWA_HOLDERS TO LT_HOLDERS. APPEND LINES OF LT_HOLDERS TO ACTOR_TAB. endloop. ENDIF. DESCRIBE TABLE ACTOR_TAB LINES NUM_LINES. IF NUM_LINES IS INITIAL. RAISE NOAGENT_FOUND. ENDIF. ENDFUNCTION. Creating a rule using the PFAC Transaction Assign the function module ZWF_FIND_USERS in the "Rule Definition Tab" BHEL Openings August'15 Exp: 3 to 10 Yrs, Sal: 7L to 25L PA Apply Now & Get Multiple Interviews SAP Training by Atos Awarded No.1 SAP Education Partner. Over 200+ Courses Available. Enroll

Upload: ravibabu1620

Post on 07-Dec-2015

221 views

Category:

Documents


7 download

DESCRIPTION

hii

TRANSCRIPT

Page 1: Defining Custom Rules for Use in SAP Workflow

  Search

Home  • Trainings  • Quiz  • Tips  • Tutorials  • Functional   • Cert Q's  •  Interview Q's  • Jobs  • Testimonials  • Advertise  • Contact Us

SAP Virtual/OnsiteTrainings

Document Categories:

ABAPTM

Adobe FormsABAP­HRALE & IDocsALVBAPIBASISBSPBusiness Objects Business WorkflowCRM NEWLSMWSAP Script/Smart FormsBI/BWeXchange Infrastructure (XI)Enterprise Portals (EP)eCATTObject Oriented ProgrammingSAP QueryUserexits/BADIsWebDynpro for Java/ABAPTM

Others

What's New?

ABAP Test Cockpit HOTSAP ABAP PragmasUnderstanding SE32 (ABAP TextElement Maintenance)Creating an IDoc File on SAPApplication ServerUnderstanding “Advance withdialog” option of SAP WorkflowSAP Workflow Scenario:Maintenance NotificationApprovalEnhancements to a standardclassWorking with Floating Field inAdobe FormsInserting data from Internal Tableinto the step “Send Mail”Display GL Account long textusing enhancement frameworkDifferences betweenpolymorphism in JAVA andABAPPassing multiline parametersfrom an ABAP Class event to aWorkflow containerConcept of Re­evaluate agentsfor active work items in SAPWorkflowDynamic creation of componentusage in ABAP WebDynproAdobe Forms: Display symbolslike copyright and othersDeactivate Hold functionality inPurchase order (ME21N)Quiz on OOABAPAdd fields in FBL5N using BADIsTutorial on Wide castingDefining a Range in Module PoolProgramCopy fields from onestructure/table into anotherstructure/tableSide Panel Usage in NWBC

Contribute?

Sample Specs

What's Hot?

Defining Custom Rules for use in SAP Workflow

By Raghava Vakada, Mouri Tech Solutions 

“I would like to explain about creating custom rules in SAP Workflow. The rules can be created orchanged using the standard SAP transaction PFAC. Once the rules are created you can call theserules in any workflow via the rule container”.

In this article I am creating a rule, which will find the users based on Position id. I have created acustom  function module  ZWF_FIND_USERS which  will  return me  back  a  position  under  AssetAnalyst (HRP1001­SOBID). The custom function created should have the same interface as thatof the SAP standard function module RH_GET_ACTORS. The following table parameters have toexist in the custom function module.

“ACTOR_TAB STRUCTURE SWHACTOR”

“AC_CONTAINER STRUCTURE SWCONT”  

Following is the function module code:  

FUNCTION ZWF_FIND_USERS.*"‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*"*"Local Interface:*"  TABLES*"      ACTOR_TAB STRUCTURE  SWHACTOR*"      AC_CONTAINER STRUCTURE  SWCONT*"  EXCEPTIONS*"      NOAGENT_FOUND*"‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐

  INCLUDE <CNTN01>.  DATA : POSITION_ID LIKE ZBUSAREA‐OBJID,         LT_HOLDERS TYPE STANDARD TABLE OF SWHACTOR,         LWA_HOLDERS TYPE SWHACTOR,         LWA_USERS TYPE STANDARD TABLE OF HRP1001,         WA_USERS TYPE  HRP1001,         NUM_LINES TYPE I.*Read values assigned to the rule criteria  SWC_GET_ELEMENT AC_CONTAINER 'POSITION_ID' POSITION_ID.

  SELECT * FROM HRP1001 INTO table LWA_USERS  WHERE OBJID = POSITION_ID.  IF NOT LWA_USERS IS INITIAL.    REFRESH LT_HOLDERS[].

    loop at LWA_USERS into WA_USERS.

      Condense WA_USERS‐SOBID.      LWA_HOLDERS‐OTYPE = 'US'.      LWA_HOLDERS‐OBJID = WA_USERS‐SOBID.      APPEND LWA_HOLDERS TO LT_HOLDERS.      APPEND LINES OF LT_HOLDERS TO ACTOR_TAB.    endloop.

  ENDIF.  DESCRIBE TABLE ACTOR_TAB LINES NUM_LINES.  IF NUM_LINES IS INITIAL.    RAISE NOAGENT_FOUND.  ENDIF.

ENDFUNCTION.

Creating a rule using the PFAC Transaction

Assign the function module ZWF_FIND_USERS in the "Rule Definition Tab" 

BHEL OpeningsAugust'15

Exp: 3 to 10 Yrs, Sal: 7L to 25LPA Apply Now & Get MultipleInterviews

SAPTrainingby AtosAwardedNo.1 SAPEducationPartner.Over 200+CoursesAvailable.Enroll

Page 2: Defining Custom Rules for Use in SAP Workflow

Web Dynpro for ABAP Tutorials 

Join the Mailing List

Enter name and email address below:Name: 

Email: 

Subscribe   Unsubscribe GO

Go to the "Container Tab" and create a container element for the “Position id” which will be passedto the function module 

  Our  rule  is  created  now.  You  can  test  the  rule  within  the  PFAC  transaction  by  clicking  the"Simulation" button on  the application  toolbar. Now  this  rule  is  ready  to be used  in any workflowaccording to your requirement via the rule container of the workflow. 

 Enter the Position Id, which is created in (PPOCW) 

Page 3: Defining Custom Rules for Use in SAP Workflow

 It displays Asset Analysts (users) in the “Rule resolution result”

 Now you can use this rule in any of your workflow definitions.

Please send us your feedback/suggestions at [email protected] 

Home • Contribute • About Us • Privacy • Terms Of Use • Disclaimer • Safe • Companies: Advertise on SAPTechnical.COM | Post Job • Contact Us  

©2006­2007 SAPTechnical.COM. All rights reserved.All product names are trademarks of their respective companies. SAPTechnical.COM is in no way affiliated with SAP AG.

SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver, and and any other SAP trademarks are registered trademarks of SAP AG in Germany and in several other countries.Every effort is made to ensure content integrity. Use information on this site at your own risk.

Graphic Design by Round the Bend Wizards

Exec Program inAnalytics

SAS, R,Hadoop & BigDataTechnology. SDAbocconi,Europe's Top university