转 Call instance method from workflow using class

Call instance method from workflow using class

By Rakesh Dhudipala from Link

Scenario:

Below document explains how to call instance Method from Workflow task  

Prerequisites:

ABAP objects  

Step by step Procedure:  

Go to SE24, create a class by name ZCL_TEST_WORKFLOW.  

Implement interface IF_WORKFLOW in the class.

Create one instance method called GET_RESULT

Define below attributes in the Attributes TAB

Create below methods in the methods tab.

1)     Constructor:

Define with below parameters.

In the 'Constructor' write the below code.

method CONSTRUCTOR.

  m_lpor-INSTID = i_id.
  m_lpor-CATID = 'CL'.
  m_lpor-TYPEID = 'ZCL_TEST_WORKFLOW'.
endmethod.

2)     GET_RESULT:

Method contains below parameters.

 

Write the below code in the GET_RESULT method.

method GET_RESULT.
  p3 = p1 * p2.
endmethod.  

3)    Create:

Create method contains below parameters.

Write the below logic in the CREATE method.

method CREATE.
  CREATE OBJECT e_instance
    TYPE
      zcl_test_workflow
    EXPORTING
      i_id              = i_id.
endmethod.

In BI_PERSISTENT~FIND_BY_LPOR interface method write the below code

method BI_PERSISTENT~FIND_BY_LPOR.
  CREATE OBJECT result
    TYPE
      zcl_test_workflow
    EXPORTING
      i_id              = lpor-instid(10).
endmethod.

In the BI_PERSISTENT~LPOR method write the below code

method BI_PERSISTENT~LPOR.
  result = me->M_Lpor.
endmethod.

Go to SWDD transaction and create new workflow.  

Create new activity  

Create new task and enter the CREATE method


This will map the below parameters  

Create one more task and enter the get_result method in the task like below  

 

Now container mapping with the below parameters

Assign the agents to the task  

 

Make task as general task

Now if we run the workflow it will executes the instance method.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值