Skip to Content
avatar image
Former Member

Not able to catch class instantiation in a task.

Hi Gurus,

Some how my workflow is driving me nuts. need your expert advise again.

I am trying to instantiate a class to display default method under 'objects and assignment' in a user decision step of WF. i have a Zclass with 3 attributes: 2 key fileds(Instance and public) and one MS_LPOR(instance & public).

Have a method called 'instantiate_CL' importing document no from workflow task. this document no is then passed to constructor and instance of the class is created as required.

My code for instantiation

CREATE OBJECT cl_instance
iv_irdoc = iv_doc
iv_year = iv_gjahr.
CATCH cx_bo_error.

instance of above code

i have to catch this back in workflow task. some how i am not able to get this instance properly in workflow task.

CL_INSTANCE value in workflow task.

your inputs would be higly helpfull in resolving this.

wf-v-1.png (32.7 kB)
wf-v-2.png (41.7 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Dec 01, 2017 at 11:15 AM

    Firstly, you don't need a task to instantiate a class. Just call a static method in a container operation.

    %zcl_name.get_instance( i_year = &YEAR& i_docno = &DOCNO& )%

    Secondly, as Anjan already suggested, I don't think your LPOR/FIND_BY_LPOR is working correctly. Make sure that FIND_BY_LPOR returns your object instance. Post your code if it doesn't work / not sure.

    PS. Tags are for tagging things to make them searchable. It does not alert anyone. Putting someone's name in a tag only means someone looking for Sandra Rossi will find this post. As I already know my name, I do not usually search SCN for it.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Sandra,

      Able to resolve the issue this morning.

      Its the issue with code written in constructor. i have explained the reason below.

      Thanks a lot Sandra for your time. your inputs were really helpful through out this WF development.

      METHOD constructor.
          DATA: lv_id TYPE char14.
          CONCATENATE iv_irdoc iv_year INTO lv_id.
          me->gv_irdoc = iv_irdoc.
          me->gv_year = iv_year.
          me->ms_lpor-instid = lv_id.
          me->ms_lpor-catid = 'CL'.
      Below line is the cause of error. My class name is start with '/ETSA*' but i have hard coded as '/ESTA'. so find_by_LPOR is not able to catch the instance created. it's all fixed now. 
          me->ms_lpor-typeid = '/ESTA/CL_WF_AP_PAYBLOCK'.
  • Dec 01, 2017 at 06:39 AM


    You have to first check two things. Is the class uses if_workflow interface. And LPOR and Find_by_lpor method properly implemented or not


    Add comment
    10|10000 characters needed characters exceeded