Binding from Task to Custom
Method
My workflow is largely based on template WS2000040 - Approve Trip. The standard is a two step approval process with 2 decision
tasks sent out
I've copied and changed the flow to have a slightly different
approval process again 2 decision tasks are sent out.
The workflow is based on business object BUS2089.
The FM has the following parameters
The code works correctly stand alone. I've tried to implement it in a similar manner to BUS2089-APPROVE.
My problem is that when called from the workflow the parameters for my method are always blank and the container of the method is also blank. This is a view of the flow (bottom up). 14:23:11 B STARTED TS90100002 Settle Trip
The informations I need is stored in element TRIP. The
fields that are key and the ones that I need passed through into my method
are
These fields are sucessfully passed from the workflow container into my role to determine the agent of task TS20000131 and subsequently task TS00008267. I'm pretty sure my problems relate to the binding between the task container and the method container. TS00008267 <-> ZBUS2089-ZTRIPSETTLE. And possibly my binding throughout the workflow template. I'm getting several binding errors that raise the following questions: 1) When I attempt to activate the workflow template I'm told some values are not used or some values are for read purposes only. I can see these values in my workflow container and when attempting to delete them from the workflow container I get the message: 'Inherited elements may not be deleted'. 2) As I mentioned I'm trying to implement this like BUS2089-APPROVE is implemented by SAP. When I click on my object binding within task TS90100002 I always see the key parameters to my function module called by my method ZBUS2089-ZTRIPSETTLE and I am unable to change this. However when I look at BUS2089-APPROVE it does not work like that and in the method code it takes it's values from object-key-employeenumber and object-key-tripnumber. I've tried using this method in my code and also using swc_get_element ac_container 'EmployeeTrip' z_tripno. swc_get_element ac_container 'EmployeeNumber' z_person but in both cases I have no values populated.
First thing to check is see if your method works on its own. you can do this from the swo1 transaction. click test, instantiate the object and execute the method. if it works correctly, then you will have to straighten out the binding betn the task and the method. While testing your method thru swo1, you can put a hard break-point in your method code and execute the method that way you can check if the values are being read by the method.
When I switch on container debugging I'm getting binding errors and my target container (the method) is empty. I realise there are binding problems but I don't know how to repair them. Primarily because of the error messages (re: original posting) I receive during my attempts to repair the binding.
It's definitely a binding problem - under no circumstances should the global data field 'object' be empty in your method code. In your workflow container, you should have an instantiated business object ('trip'?), which contains the fields you're interested in. What you need to do is bind this element from the workflow container to that of your standard task, which you do at the activity step level in the workflow builder. The container element 'trip' should be bound to the task element '_WI_OBJECT_ID'. Once that's in place, this should feed down into your method automatically, but by all means check this at PFTC standard task level. When you've done this correctly, you can access your element NOT through the workflow container using 'SWC_GET_ELEMENT', but through the business object key. i.e. object-key-pernr etc... Finally, make sure you're delegated your subtype 'ZBUS2089' system-wide to BUS2089 using SWO6 - you shouldn't be creating a standard task based on ZBUS2089, which can cause problems too. The standard task should be based on object type BUS2089, method ZTRIPSETTLE.
The business object is &TRIP& and is instantiated to begin with i.e. the value get's passed to the first task. I believe also to the second task as I'm writing those values out in the workitem line item text.
Resolution 1) 'The container element 'trip' should be bound to the
task element '_WI_OBJECT_ID'.'
Get help for your SAP WF problems
SAP Books
SAP WorkFlow Tips
Best regards,
All the site contents are Copyright © www.erpgreat.com
and the content authors. All rights reserved.
|