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

转 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.

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics