Skip to Content
author's profile photo Former Member
Former Member

how to pass instance of class to workflow container

Hi Guys:

i want to pass the instance of ZCLASS to my workflow container, I use FM SWW_WI_START to start my workflow template directly,when I try to use SWC_ELEMENT_SET to pass instance to container table, i get exception type_conflict = 1, pls help me, and i don't want to use EVENT way to trigger WF, bcs i almost finish the trigger WF FM by this way.

the following the a part of code in my FM.

DATA lo_wf TYPE REF TO CL_PT_REQ_WF_ATTRIBS.

DATA swconttab TYPE swconttab.

CREATE OBJECT lo_wf.

CALL FUNCTION 'SWC_ELEMENT_SET'

EXPORTING

element = 'ZBMW_CL_WORKFLOW'

field = lo_wf

TABLES

container = swconttab

EXCEPTIONS

type_conflict = 1

OTHERS = 2.

Edited by: lizhong deng on Aug 24, 2011 2:07 PM

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 24, 2011 at 12:47 PM

    I am actually interested how you expect that your lo_wf is instantiated properly since you don't give the request id for the constructor? And how you expect that you can just turn CL_PT_REQ_WF_ATTRIBS into ZBMW_CL_WORKFLOW (or is the type of ZBMW_CL_WORKFLOW same as CL_PT_REQ_WF_ATTRIBS?)?

    I don't even know if you can write an ABAP class into a container? You can try this, but I would perhaps try it with SAP_WAPI_WRITE_CONTAINER instead of the function that you try to use. But I actually doubt that it will work since you should give the object in simple_container and I am not sure whether it can take ABAP classes...

    I would probably create a step for instantiating the class in workflow. Just simple "create object" statemenent in a method. But really the best way probably would be to start the WF with an event of your class if that is possible.

    Regards,

    Karri

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Karri:

      thanks.

      it's just for testing, - so I just hard code field lpor-instid = '123465' in constructor. and class ZBMW_CL_WORKFLOW is

      a customizing class, it's different from CL_PT_REQ_WF_ATTRIBS , but also inherited IF_WORKFLOW interface.

      and i already find a example (CL_DEF_IM_PT_GEN_REQ->IF_EX_PT_GEN_REQ~START_WF), we can put the instance of class into if_swf_cnt_container, and then conver it to simple container by method if_swf_cnt_container->to_simple_container.

      I think 'instantiating class in WF' is way, just like BO 'system'. thank you!

  • Posted on Aug 24, 2011 at 10:46 PM

    Hello,

    "i don't want to use EVENT way to trigger WF, bcs i almost finish the trigger WF FM by this way."

    There's a unique reason to do something the wrong way.

    Use SAP_WAPI* functions and DO use an event to start your workflow.

    As for the class, I would do it inside the workflow as Karri suggests. Just pass the key as an event parameter (if necessary).

    regards

    Rick Bakker

    hanabi technology

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.