Quick and Simple steps to instantiate multiple objects in a Workflow
This is just a simple example of creating multiple objects to be used in a workflow. In some occasions we may want to incorporate different processes which uses other business objects and methods. For this simple example, assumption that the workflow is a PR approval workflow, the workflow would have been triggered from an event and the object BUS2009 for item approval would have been instantiated. Since in the workflow there is only 1 Object defined, we want to add more additional objects.
1. Firstly, you can create a task for “Instantiating Generic Objects” if there is no reusable task. Create the Task in transaction PFTC: Set the Object Type as SYSTEM, and Method as GENERICINSTANTIATE, and remember to check on background processing.
2. In your workflow, at the workflow container, define the new container elements for the additional objects. If the object type is T024, then define as T024 object type, if object type is BUS1001 then define the object type as BUS1001.
3. Once the new workflow container elements have been created, proceed to create a new STEP in the workflow of the new task created TS999xxxx in 1.
When prompted below, you may allow the elements to be automatically created.
4. Defined the bindings. This step is to instantiate the object with values. Make sure the binding for OBJECTINSTANCE is passed back to your workflow container element. If this step is to instantiate object T024, then make sure the correct object is exported to the workflow container element. As for the import part, OBJECTKEY would be the key for T024, e.g. “100” and OBJECTTYPE = T024.
You can define another workflow step to assign the variable for OBJECTKEY and OBJECTTYPE as well. Repeat the steps for all other additional objects.
5. If you want the objects to appear together with the task, you can assign multiple objects to the Dialog Task. Under Binding of workflow container to task container, assign the object element to the _ADHOC_OBJECTS. Click on the arrow key at the binding and change it to “Append to Table” so that the existing values in _ADHOC_OBJECTS will not be overwritten.
6. Testing the workflow. In the dialog step, under objects and attachments, you will be able to see all the objects assigned. When user clicked on the link, it will execute the default methods defined under basic data – Defaults tab of the object.
Hello,
Note that there is already a standard task to call GENERICINSTANTIATE, and this is: TS01200205.
I'm not sure what the benefit is of putting all these objects into one container element.
regards
Rick
Hi Rick,
Thanks.
Yes, we normally don't have to create a new task if there are already existing ones. One way is to use where used list in Business Object Builder and find out if there are already any existing task that we can reuse.
For the last part, normally when the workflow agent executes the dialog task it will bring them to a specific dialog screen (transaction code/reports etc) to perform some activity or actions. In the task step, we can also specify which Object and method to be called as a secondary method in the tab Methods, but this will run before, after or concurrently.
If we have those additional objects assigned to "_Adhoc_Objects" container, this will allow the defaults methods of those objects to be called if required only by the workflow agent before actually executing the task. For the instance above, before executing the decision, the workflow agent can click on the link of Material to view the material master (default method for BUS1001 is DISPLAY), purchasing Organization or the Purchasing Group; depending on what are the objects passed in.
Regards,
Shane
Hi Shane,
TS01200205 will work for any BOR object.
You are correct that it is handy to have multiple object instances in the workflow container but I don't see the added benefit of having them all in the same workflow container element.
regards
Rick
Hi Shane,
I just got a request to add multiple object instances to workflow for validation before approval. This will aid me in fulfilling the request.
Thanks for sharing.
Regards,
Fruzzie