`
evangxli
  • 浏览: 230853 次
  • 性别: Icon_minigender_1
  • 来自: 大连
社区版块
存档分类
最新评论

转 Demo on Workflow using Classes

 
阅读更多

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.

http://www.saptechnical.com/Tutorials/OOPS/InWorkflow/page2.5.jpg

Next the pop up appears where we need to mention the detail as follows:

http://www.saptechnical.com/Tutorials/OOPS/InWorkflow/page2.6.jpg

Save it and the class is created.

Now the class is to implement IF_WORKFLOW interface. For this go to the  http://www.saptechnical.com/Tutorials/OOPS/InWorkflow/page2.7.jpg  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.

http://www.saptechnical.com/Tutorials/OOPS/InWorkflow/page2.8.jpg

The ZCL_TEST class now contains the existing methods of IF_WORKFLOW interface. 

http://www.saptechnical.com/Tutorials/OOPS/InWorkflow/page2.9.jpg

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 :


 

 

分享到:
评论

相关推荐

    workflow,微软工作流Demo

    微软工作流(Workflow)是微软技术栈中一个关键的概念,它是一种自动化业务流程的设计和执行方式,用于模拟和实现组织内的各种工作流程。在本Demo中,我们可以深入理解这一技术的应用和实现细节。 工作流(Workflow...

    Research on Workflow Patterns Based on jBPM and jPDL

    Research on Workflow Patterns Based on jBPM and jPDL

    workflow_springbootworkflow_workflowdemo_workflowspringBoot_work

    在本项目"workflow_springbootworkflow_workflowdemo_workflowspringBoot_work"中,开发者采用Spring Boot框架集成Activiti工作流引擎,构建了一个工作流的示例应用。接下来,我们将深入探讨这个项目的相关知识点。 ...

    demo of workflow

    本示例“demo of workflow”将展示如何通过Java语言实现一个工作流系统。Java作为一种广泛使用的编程语言,拥有丰富的库和框架来支持工作流的开发。 首先,让我们了解一下工作流(WF)的基本概念。工作流是指一系列...

    Research on the Workflow System of Collaborative Process Planning

    Research on the Workflow System of Collaborative Process Planning

    workflow-in-mvc-asyc-simple-demo

    本示例"workflow-in-mvc-asyc-simple-demo"展示了如何在ASP.NET MVC项目中集成这两种技术。 首先,让我们详细了解异步控制器。在ASP.NET MVC中,异步控制器允许开发者创建非阻塞操作,这意味着在等待某些操作完成时...

    Hands-on labs Workflow Service

    【标题】:“Hands-on labs Workflow Service” 【描述】:“Hands-on labs Workflow Service”是一系列实践性的学习资源,专为深入理解Workflow 4.0技术而设计。Workflow 4.0是微软.NET Framework的一个重要组成...

    workflow-in-mvc-simple-demo

    本项目"workflow-in-mvc-simple-demo"旨在提供一个简单的示例,展示如何将工作流集成到MVC应用中,以实现更加灵活和可维护的业务逻辑。 首先,让我们深入了解一下工作流(Workflow)。工作流是一系列按特定顺序执行...

    Workflow using class

    在IT领域,工作流(Workflow)是自动化业务过程的一种方法,它能够确保任务按照预定义的规则和顺序执行。在本文档中,我们将探讨如何利用面向对象编程(OOP)的概念,特别是通过自定义类来实现工作流,而不是依赖于...

    workflow-demo:工作流存储库的演示

    "workflow-demo"这个项目显然是为了演示如何在实际操作中应用工作流,特别是在Laravel框架下。Laravel是一款流行的PHP框架,它提供了丰富的功能来简化Web应用的开发。在这个"workflow-demo"中,我们能看到如何将工作...

    安卓抽奖转盘demo

    10. **版本控制与发布流程(Version Control and Release Workflow)**:项目开发中,使用Git等版本控制系统进行协作和版本管理,遵循一定的发布流程,如代码审查、打包签名,以及发布到Google Play或其他应用市场。...

    Using Domino Workflow

    ### 使用Domino Workflow的核心知识点解析 #### 一、Domino Workflow简介 - **定义与概述**:“Domino Workflow”是一种企业级工作流解决方案,旨在帮助组织优化业务流程管理。它集成于IBM Lotus Domino/Notes平台...

    workflow-restful-demo.rar

    通过泛微API接口 创建流程完整Demo通过泛微API接口 创建流程完整Demo通过泛微API接口 创建流程完整Demo通过泛微API接口 创建流程完整Demo通过泛微API接口 创建流程完整Demo通过泛微API接口 创建流程完整Demo通过泛微...

    Windows Workflow Foundation开发实战系列课程(2):源码

    Windows Workflow Foundation(WF)是微软开发的一个用于构建工作流应用程序的框架,它允许开发者通过图形化的方式设计业务流程,使得复杂的工作流程管理变得更为简单。本课程“Windows Workflow Foundation开发实战...

    asp workflow

    总的来说,ASP Workflow demo提供了一个全面的工作流管理系统示例,对于理解工作流的概念、开发和调试工作流应用具有很高的参考价值。开发者可以通过分析源代码,深入理解工作流在实际项目中的应用,从而提升自己的...

    Beginning WF: Windows Workflow in .NET 4.0

    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、工作流demo

    网络上找的flex3写的工作流设计器 可以做为参考 基本功能都有

    Hue-workflow配置流程

    Hue的Workflow(工作流)组件则是用于构建和管理复杂的Hadoop作业流程,允许用户通过拖拽操作来设计数据处理任务,而无需编写复杂的命令行脚本或Java代码。在本文中,我们将深入探讨如何使用Hue配置和运行一个...

Global site tag (gtag.js) - Google Analytics