on 07-20-2017 1:07 PM
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Any ideas anyone?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Mike,
I have read it again and I finally managed to get it right. Thanks a bunch!
I've bought a book on workflows which turned out to be pretty bad ...
I've managed to instantiate the class in the binding! %/HRG/CD_WF_REL_REQ.GET_INSTANCE(IV_VALUE=&VALUE&)%
For other users that might need this, the method get_instance is static and the value variable is from the workflow container.
Thank you very much Mike.
Regards,
Ioan
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.