Demo On Building Workflow Using Custom Business Object .

2y ago
15 Views
3 Downloads
361.45 KB
18 Pages
Last View : 4d ago
Last Download : 3m ago
Upload by : Elise Ammons
Transcription

Demo on Building Workflow UsingCustom Business Object, Eventsand MethodsApplies to:SAP R/3 version 4.6c and onwards. For more information, visit the Business Process Modeling homepage.SummaryThe article describes the procedure to create a workflow with custom business object, having custommethods and custom events.Author:Saba SayedCompany: Larsen & Toubro Infotech LimitedCreated on: 07th August 2009Author BioSaba Sayed is SAP certified NetWeaver ABAP Consultant, working in Larsen & Toubro InfotechLimited. She has more than three years of SAP experience and has worked extensively inABAP, OO ABAP, Workflow, ALE / IDoc and SAP SRM.SAP COMMUNITY NETWORK 2009 SAP AGSDN - sdn.sap.com BPX - bpx.sap.com BOC - boc.sap.com1

Demo on building workflow using custom business object, events and methodsTable of Contents1.Scenario . 32.Flowchart . 33.Step-by-step procedure. 43.1Create business object . 43.2Create Event. 43.3Trigger Event . 53.4Create Method . 73.5Create Step . 93.5.1Activity Step-Display PO . 93.5.2User Decision Step - Provide Approve or Reject Option . 103.5.3Steps to Approve PO . 103.5.4Steps to Reject PO. 123.6Create Task . 123.7Code for Method . 133.8Workflow Completed . 143.9Test Workflow . 143.10Business Workspace . 153.11Workflow Log . 163.12Workflow Transactions . 163.13Purchase Order Transactions . 16Related Content . 17Disclaimer and Liability Notice . 18SAP COMMUNITY NETWORK 2009 SAP AGSDN - sdn.sap.com BPX - bpx.sap.com BOC - boc.sap.com2

Demo on building workflow using custom business object, events and methodsScenarioCreate a workflow having custom Business object referencing standard Business Object for Purchase Order(BUS2012). In this BO, create a custom method for displaying PO (PODisplayNew) similar to standardmethod „Display‟ and a custom event (POChanged) that should be raised whenever you save the PO.When the user approves/rejects the PO, a background task should run updating the custom [„Z‟] table withstatus of PO as approved/rejected respectively.1.FlowchartPO is changed and saved. Custom event forPO change should get triggered.Create a task with custom method fordisplaying the PO in user‟s SAP inbox.ApprovedAfter checking the PO, usershould get the screen toapprove or reject the PO.Update custom „Z‟ table with POstatus as approved.RejectedUpdate custom „Z‟ table with POstatus as rejected.End WorkflowSAP COMMUNITY NETWORK 2009 SAP AGSDN - sdn.sap.com BPX - bpx.sap.com BOC - boc.sap.com3

Demo on building workflow using custom business object, events and methods2.Step-by-step procedure2.1Create business objectCreate a custom business object referencing the standard business object „BUS2012‟ and customevent for changed PO.a. Copy the standard business object and create a new business object OR you can createbusiness object by creating standard business object as supertype and new one as subtype.Here I have created new BO that is a copy of standard BO „BUS2012‟.2.2Create Eventa. Create new event under the „Events‟ node by selecting „Events‟ and clicking on „Create‟button.b. Enter the required details for the event and click the green arrow.c.Check your event will be created under „Events‟ node.SAP COMMUNITY NETWORK 2009 SAP AGSDN - sdn.sap.com BPX - bpx.sap.com BOC - boc.sap.com4

Demo on building workflow using custom business object, events and methodsd. Change the status of Event as implemented and also change the status of businessobject as implemented „Edit Change release status Object type ToImplemented‟. Then generate the business object by clicking on red and white circle„Generate‟ on application toolbar. Now your business object will be available for use.2.3Trigger Eventa. To trigger your event when the PO is changed and saved,i. Create a workflow template from transaction „PFTC INS‟. Enter „BasicData‟.Go to „Container‟ tab and enter the elements required for your workflow. Note that inproperties select atleast one parameter.SAP COMMUNITY NETWORK 2009 SAP AGSDN - sdn.sap.com BPX - bpx.sap.com BOC - boc.sap.com5

Demo on building workflow using custom business object, events and methodsFinally in the „Triggering Events‟ tab, enter the event details, do the binding andactivate the event line item.This completes your event creation process in workflow. Now for raising andtriggering the event follow step ii.Check in „Workflow builder‟ [click on „Workflow builder‟ button in „Basic Data‟ tab orgo to „SWDD‟ transaction and enter the workflow template id] you will see the eventis created.ii. Find out the user exit that is available for PO in case of „Save‟ event.Please note that only when the PO is saved the event should gettriggered. In this case the exit is EXIT SAPMM06E 013 that is invokedprior to “commit work”. Create and raise the event for POChanged in theabove mentioned exit. [Include ZXM06U44]SAP COMMUNITY NETWORK 2009 SAP AGSDN - sdn.sap.com BPX - bpx.sap.com BOC - boc.sap.com6

Demo on building workflow using custom business object, events and methodsb. Now whenever a PO is changed and saved, the above custom event will betriggered.2.4Create Methoda. Creating custom method to display the PO.b. Create method in the similar way as that of event creation i.e. select „Methods‟ and click oncreate. It will ask you „Create with function module as template?‟ then select „No‟ as we want tocreate a „Dialog‟ and „Synchronous‟ method for displaying the PO. Change the status of methodas implemented.SAP COMMUNITY NETWORK 2009 SAP AGSDN - sdn.sap.com BPX - bpx.sap.com BOC - boc.sap.com7

Demo on building workflow using custom business object, events and methodsc.Select the method and click on „Program‟ button. It will ask you if you want to generate atemplate automatically for the missing section. Click on „Yes‟. It will navigate you to program withbegin and end of method block. Write the code for the method in this block.d. Once this is done click on „Generate‟ button. Now this method could be used in the workflowtask.SAP COMMUNITY NETWORK 2009 SAP AGSDN - sdn.sap.com BPX - bpx.sap.com BOC - boc.sap.com8

Demo on building workflow using custom business object, events and methods2.5Create Step2.5.1Activity Step-Display POa. Go to workflow builder and double click to add a new step. Select the step as „Activity‟as we just want to display the PO whenever the event is triggered.b. Create a new task in the step and enter the business object details in it. Save it.c.Do the binding. Once binding is done you can see green color.d. Assign the agents as workflow initiator or any user whose inbox this display PO activityshould go.e. In „Task Properties‟, set the attribute of „Agent Assignment‟ as „General Task‟ by clickingred button next to it.SAP COMMUNITY NETWORK 2009 SAP AGSDN - sdn.sap.com BPX - bpx.sap.com BOC - boc.sap.com9

Demo on building workflow using custom business object, events and methods2.5.2User Decision Step - Provide Approve or Reject OptionUser can approve or reject the PO.a. Create „User decision‟ step with title „Kindly Approve or Reject the Purchase Order‟. Assign agentwho will approve or reject the PO. In this case, I have entered as workflow initiator. Enter the„Decision Texts‟ and its „Outcome Names‟. Decision texts will appear as buttons on the screen whereagents can approve or reject the PO while the outcome names will appear as the step text in theworkflow logs.b. After creation of above step, you will find 2 options one as approve and other as reject.2.5.3Steps to Approve POa. Double click to create a step for approve option. Select this step as „Activity‟ *[Updatecustom table with approve/reject]. Note that we need to create a background step that willupdate the custom „Z‟ table with status as either approved/rejected. For this we will have tofirst create a new method „UpdateTable‟ under „Methods‟ node in „ZCUST PO‟ businessobject. In order to create task as background, note that the method should not be a dialogmethod i.e. uncheck „Dialog‟ in method properties.b. Create a „Z‟ database table with fields‟ mandt, po number, date, time, status and description.c. To get the value of approval or rejection from User Decision (UD) step, you will have tocreate additional step between UD step and approval activity step. This step could becreated by double clicking [or right click and create] *‘PO Approved’ i.e. the outcome nameas highlighted below. Select this step as „ContainerOperation‟ *[zapp po]. After creation ofthis step your workflow will look like as given below:[P.S.: * indicates check the below screenshot for step information]SAP COMMUNITY NETWORK 2009 SAP AGSDN - sdn.sap.com BPX - bpx.sap.com BOC - boc.sap.com10

Demo on building workflow using custom business object, events and methodsd. To capture the status of PO create container element status. In properties, check import andexport parameter.e. Now in the „ContainerOperation‟ step for approval, enter the following details:SAP COMMUNITY NETWORK 2009 SAP AGSDN - sdn.sap.com BPX - bpx.sap.com BOC - boc.sap.com11

Demo on building workflow using custom business object, events and methods2.5.4Steps to Reject POFollow the same steps as of step 5.3. The only difference would be the „Expression‟ value, which willbe „R‟ instead of „A‟.2.6Create Taska. Now for the main background step i.e. for updating the table, create a new task in this step withfollowing details:Select execution method as background as we want the update should happen in background.In the task container, create container as „Status‟ so that you can bind this task container element withthe container operation step‟s Status value.Do the binding for the tasklinking status of workflow container with the statusof task container. (Note that datatype and length of both the container elements should be the sameotherwise binding will not happen.)b. Do the same for rejection activity also. Take the same task name as created for approvedactivity. No need to create a new task as the properties of both the tasks will be same.SAP COMMUNITY NETWORK 2009 SAP AGSDN - sdn.sap.com BPX - bpx.sap.com BOC - boc.sap.com12

Demo on building workflow using custom business object, events and methods2.7Code for Methoda. Finally we need to write code for „UpdateTable‟ method. It is said that the table should beupdated on the value received from UD step.Write the above code in business object program. Above we are declaring a variable „Status‟ to acceptapprove/reject i.e. A or R value. Next get the value of „Status‟ [container element declared in task]. This willcontain the value that will be obtained from „ContainerOperation‟ step from the workflow container element„Status‟ [as we have done binding for task container and workflow container].[In the command, “SWC GET ELEMENT CONTAINER „STATUS‟ STATUS”, container is the container forthe element, first „status‟ is the element name and second status is the field/variable that you have declaredin the method.]It could be seen that in the method, we are calling F.M „ZPO UPDATE TABLE‟. It will have the followingcode in it:SAP COMMUNITY NETWORK 2009 SAP AGSDN - sdn.sap.com BPX - bpx.sap.com BOC - boc.sap.com13

Demo on building workflow using custom business object, events and methods2.8Workflow CompletedNow your workflow is completed. Save it and activate it.2.9Test WorkflowTest the workflow. Go to transaction ME22N or ME22. Enter the PO number „4500016119‟ andchange the quantity and save it. As soon as the PO is saved, a workitem will appear in your inbox(as we have kept the agent as workflow initiator).SAP COMMUNITY NETWORK 2009 SAP AGSDN - sdn.sap.com BPX - bpx.sap.com BOC - boc.sap.com14

Demo on building workflow using custom business object, events and methods2.10Business Workspacea. Go to SBWP to check the workitem. „Inbox Workflow‟ path. You will see the task descriptionon the right hand side.b. Select this workitem and click on execute button next to refresh button on right hand side or justdouble click „Display new PO‟. It will take you to the PO display screen.c.When you come out of this transaction by clicking on any of these buttons, it will call next screenfor PO approval or rejection.d.When you select „Approve‟ it will update database table with status as „A‟ and if you „Reject‟then status will be „R‟. In this case, I have approved the PO.Check the table ZAPP REJ, to see if the values are reflected correctly in the table.e.This completes our workflow.SAP COMMUNITY NETWORK 2009 SAP AGSDN - sdn.sap.com BPX - bpx.sap.com BOC - boc.sap.com15

Demo on building workflow using custom business object, events and methods2.11Workflow LogYou can check the workflow log through transaction „SWI1‟. Enter the task as workflow template IDand execute. You will get the complete overview of the steps, container elements and agents fromthis log.2.122.13Workflow TransactionsTransaction CodeDescriptionPFTCGeneral Task MaintenancePFTC DISDisplay TaskPFTC CHGMaintain TaskPFTC INSCreate TaskSWDDWorkflow DefinitionSBWPSAP InboxSWO1Object BuilderSWI1Selection reports for WorkflowPurchase Order TransactionsTransactionCodeDescriptionME21N/ME21PO CreateME22N/ME22PO ChangeME23N/ME23PO DisplaySAP COMMUNITY NETWORK 2009 SAP AGSDN - sdn.sap.com BPX - bpx.sap.com BOC - boc.sap.com16

Demo on building workflow using custom business object, events and methodsRelated SAP Business /SAP Workflow EVENTSFor more information, visit the Business Process Modeling homepage.SAP COMMUNITY NETWORK 2009 SAP AGSDN - sdn.sap.com BPX - bpx.sap.com BOC - boc.sap.com17

Demo on building workflow using custom business object, events and methodsDisclaimer and Liability NoticeThis document may discuss sample coding or other information that does not include SAP official interfaces and therefore is notsupported 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 orcode sample, including any liability resulting from incompatibility between the content within this document and the materials andservices offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of thisdocument.SAP COMMUNITY NETWORK 2009 SAP AGSDN - sdn.sap.com BPX - bpx.sap.com BOC - boc.sap.com18

Custom Business Object, Events and Methods Applies to: SAP R/3 version 4.6c and onwards. For more information, visit the Business Process Modeling homepage. Summary The article describes the procedure to create a workflow with custom business object, having custom methods and custom events. Author: Saba Sayed Company: Larsen & Toubro Infotech .

Related Documents:

Figure 4: Create a Workflow in Nintex Workflow 2. Select the Library Ribbon, click on Workflow Settingsand then Create a Workflow in Nintex Workflow. This will open the Nintex Workflow Designer. To initiate the workflow, we will configure the workflow to add a menu item to the context menu in the workspace.

Workflow template The business process flow is implemented as a workflow definition within a workflow template. You can find this workflow template in your R/3 System. Workflow Template AF_process (Process Notification of Absence) [Page 1

5. Create a Workflow Template 6. How to Set Workflow Template Options 7. Approve a PO with a Workflow Template Purchase Orders – Approve w/ Workflow In this lesson, you will learn how to create a PO workflow template, create and delete Team Members, and approving a PO with a workflow template. Topics inclu

The Workflow Builder provides a graphical view of the workflow definition. The Workflow Builder screen is divided into the following frames (see Figure 1 as well), which can be resized: Workflow You can insert new steps into the workflow definition and process existing ones. Double-clicking on a step will display the associated step definition .

10450155 Leica M80 optics carrier 10 1,542.31 Demo 10450168 LED 5000 coaxial 3 1,712.88 Demo 10450169 LED 3000 Near Vertical 1 971.85 Demo 10450195 Filter Set mCherry f/M-series 1 1,311.31 Demo 10450196 Spare eyecup for M-series eyepieces (pair) 4 24.31 Demo 10450207 Revolving nosepiece M165 FC 1 727.79 Demo

The 71M6533 IC on the demo board is pre-programmed with default calibration factors. Since current sensors are not part of the Demo Kit, the demo board is tested but not calibrated at the factory. 1.2 SAFETY AND ESD NOTES Connecting live voltages to the demo board system will result in potentially hazardous voltages on the demo board.

Connect your ATS with LinkedIn Recruiter to access candidate information, boost collaboration, and view more applicant data in both Recruiter and Lever without having to switch . JeanTTocco@demo.com LupitaFillmore@demo.com dan.porter@demo.com d.burrow@demo.com brandon.m@demo.com tam.johnson@demo.com Step 3 of 4 Link Lever seats. b c

Workflow 2007 is Nintex's second- generation SharePoint workflow product. Nintex Workflow 2007 extends Microsoft SharePoint 2007 technologies including Microsoft Office SharePoint Server (MOSS) 2007 and Microsoft Windows SharePoint Services (WSS) 3.0. Nintex Workflow 2007 provides advanced workflow capabilities via a graphical web-