Demo on Workflow using Classes
By Richa Gupta, Sparta Consulting from Link
Purpose
To develop workflow using OOPS concept instead of using standard Business Object.
NOTE: Before following this document, one must have a basic knowledge of OOPS Concepts.
Steps to follow to use Classes in Workflow
How to Create Custom Class
Here we will be creating a custom class for MATERIAL.
Go to transaction SE24 and create a customized class.
Next the pop up appears where we need to mention the detail as follows:
Save it and the class is created.
Now the class is to implement IF_WORKFLOW interface. For this go to the tab and declare the IF_WORKFLOW as the interface there and press Enter; two sub-interfaces appear: BI_OBJECT and BI_PERSISTENT. Save the Class.
The ZCL_TEST class now contains the existing methods of IF_WORKFLOW interface.
Also, 2 new interfaces will be automatically added once you add IF_WORKFLOW interface in the class as shown below:
Each method of the IF_WORKFLOW Interface has its distinct functionality, which is discussed below.
BI_PERSISTENT~FIND_BY_LPOR Method:
Here, to create object, constructor of class needs to be implemented as follows:
Here, SET_ATTRIBUTES method is called which will be implemented as follows :
BI_PERSISTENT~LPOR Method:
BI_PERSISTENT~REFRESH Method:
If we do not need the method in our class, then we need only to carry out a “dummy” implementation (without further coding) to avoid program errors when the system calls the method.
BI_OBJECT~DEFAULT_ATTRIBUTE_VALUE Method:
BI_OBJECT~EXECUTE_DEFAULT_METHOD Method:
BI_OBJECT~RELEASE Method:
Now, the attributes need to be developed to implement above methods are as follows:
To trigger the workflow using event of class, we must also create an event of the class. To do this, go to EVENTS tab, and there create a new event CREATED as shown below :
Before implementing above methods, a local type needs to be created. To do this, click on LOCAL TYPES as shown below:
Now write the below code :
How to use Class in a Workflow
Here, the workflow needs to be triggered as soon as a material is created. And then a workitem should go to initiator to edit the same material.
Go to SWDD to create a new workflow.
Click on Basic Data Tab :
Give an abbreviation and Short Description to workflow as follows :
Now click on START EVENTS tab and specify the following standard event of the standard class :
Now go back and right click in between the WORKFLOW STARTED and WORKFLOW COMPLETED.
Select CREATE. A list of available step types will be displayed as follows:
Select ACTIVITY from this list. The following screen will appear:
Specify the following details here:
Click on Binding tab. Binding will be as follows:
Click on task description. Automatically following details will show :
Click on the green button for binding above and confirm the bindings must be as follows :
SET AGENT ASSIGNMENT:
Click on yellow button coming besides Agent Assignment :
Click on ATTRIBUTES:
Select General Task and click on TRANSFER
How to trigger event of Class
To trigger event of a class, we need to call method RAISE of standard class CL_SWF_EVT_EVENT. This method can be called in a user exit, BAdi, or a custom report depending on the requirement.
In our case, we are calling the method in a BAdi ‘BADI_MATERIAL_CHECK’.
The method in which event will be raised is CHECK_DATA.
Create a new custom method RAISE_EVENT in the class implemented for BAdi.
Following method will be called to raise event:
Activate class and go back.
Now go in CHECK_DATE method and write the below code:
Output
Create a new material. To do this, go to MM01.
Press Enter and the following screen will appear :
Specify the above details and press Enter. On the next screen, enter the following details :
Click on SAVE button.
As soon as the material gets created, the workflow will trigger as shown below in the workflow log :
相关推荐
微软工作流Demo,workflow,微软工作流Demo,workflow,微软工作流Demo,workflow
Research on Workflow Patterns Based on jBPM and jPDL
一个基于springboot+ acitviti的工作流demo
Research on the Workflow System of Collaborative Process Planning
Using Domino Workflow
worklflow Demo by java
在.net mvc中使用异步控制器和工作流workflow
Hands-on labs Workflow Service,学习workflow 4.0必备
在.NET MVC中使用workflow的例子
该文档使用面是向对象类来触发工作流的一个实例
工作流演示 这是一个示例 Laravel 应用程序,其目的是展示使用的优势。 旨在加快 Laravel 项目新功能的开发,同时创建可维护和可扩展的结构。
为SharePoint 2010 Workflow 开发 Custom Workflow Activity(Develop Custom Workflow Activity for SharePoint 2010 Workflow). SharePoint2010提供了很多有用的开箱即用的Activity(活动action),我们可以在...
This book is perfectly suited to anyone using or considering Microsoft's Windows Workflow Foundation. It describes what WF can do for you and how to quickly learn the basic concepts needed to be ...
网络上找的flex3写的工作流设计器 可以做为参考 基本功能都有
workflow hello world demo
Research and Design of Document Flow Model Based on JBPM Workflow Engine
Windows Workflow Foundation (WF), which is part of .NET 3.0, has been highly touted as being a technology which could help solve this problem. One of the many patterns where WF is mentioned as a good ...
Windows Workflow Foundation开发实战系列课程(2):源码
回想自己学习Domino Workflow的经历,也算有些坎坷,因为这方面的资料很少,Domino Workflow的帮助库虽然比较完整,但是缺乏一个主线,而且没有一些实用技巧的介绍。心中一直有一个想法,就是将自己掌握的Domino ...