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.