Skip to Content

Binding between Task and Static Business Object Method - Get_Instance

Hello Gurus,

I'm developing a new workflow, class based. I'm trying to instantiate the business object(the class) using a first background task and a static business method(get instance) returning the reference of the class. My problem is that the binding between the TASK and the METHOD seems not to work. The method(get_instance) works fine, I've tested it!

After reading quite a lot on the internet and even trying to make the return parameter an exporting one, to use an explicit variable in the TASK container and even debugging the standard framework I still wasn't able to solve the problem. Please help.

Regards,

Ioan.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    Jul 21, 2017 at 10:18 AM

    First off, you should never ever ever touch task-method binding unless you really have a very very specific reason to do so. The system maintains this automatically based on your available elements, and I've never had to do anything custom in 15+ years of working with WF.

    The problem is that once you change something here, SAP stops maintaining it because it's now flagged as under your control. So don't touch that button. Ever.

    To reset it, create a new task.

    As to static functional methods, you can write these directly into bindings or assignment steps. Far better performance. Please refer to my answer to the very recent question Language Dependent Element in Workflow Container for the syntax.

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 21, 2017 at 07:32 AM

    Hi,

    There is two ways to achieve a class instanciation from workflow

    1- Using a specific task to instanciate it.

    2- using the WF System class_create

    So

    1- Using a specific task to instanciate it.

    You'll find the bidding I am doing to instanciate a PO Item class

    GO_WF_EKPO is defined in the container as a class (/cdlg/wf02_ekpo)

    The Step binding

    the task binding

    the signature in the method

    2- using the WF System class_create

    Now in more recent version you can also directly from a container create an instance of a class

    The result being the container class and the expression %_WFSYST.OBJECT.CREATE_CL(OBJTYPE= ;OBJKEY= )%

    You can use from the expression the create_class

    Then you can use the "wizard" to include the expression (access to your key and class from container value of your workflow)

    Add comment
    10|10000 characters needed characters exceeded

    • I've implemented it like in your first option but it seems the binding for the returning parameter is not working. Have you ever experienced this scenario? Import ok returning not ok.

      I'm calling the method in background and synchronous.

      Regards,

      Ioan.

  • Jul 24, 2017 at 09:19 AM

    binding.pngtest.pngHello and thank you for your answers,

    I have deleted the task and created it again like Mike suggested but unfortunately that didn't solve the problem.

    Stéphane, thank you very much for the screen shots. I'm using a specific task for the instantiation but like in your first example but it's not working :(

    Pavan, I'm starting without an event. I have implemented the task like in the example from Stéphane but when testing the task with SWUD I don't get the instance back in the task container from the method.

    Regards,

    Ioan.

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 21, 2017 at 07:13 AM

    Hi,

     I'm trying to instantiate the business object(the class) using a first background task and a static business method(get instance) returning the reference of the class. My problem is that the binding between the TASK and the METHOD seems not to work. The method(get_instance) works fine, I've tested it!

    How are you instantiating the workflow? Are you using an event or directly by using the start workflow functions. I would try to create start workflow by creating an event in this way you can avoid of explicitly instantiating the class and exporting back to the workflow.

    If there is no possiblity to do so, then make sure you need to always import and export the instance of the class in all the tasks defined in the workflow.

    Thanks,

    Pavan

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 25, 2017 at 11:13 AM

    Any ideas anyone?

    Add comment
    10|10000 characters needed characters exceeded

    • Oh dear, I hope it wasn't the SAP Press WF book??? ;-) Because that one contains exact examples of the above.

      The tiny edit box in the WF builder is a bit of a pain, you may find it easier to write/edit OO expressions like this in notepad and pasting them in. It's been on the suggestions list for SAP to make it a little friendlier, but so far no joy.