I need to add new methods to BUS1001006. I see that it already has a subtype ADB1001006 which has 2 methods defined on it. Also BUS1001006 is delegated to ADB1001006.
My question is: Should I subtype BUS1001006 or ADB1001006?
I create a ZB1001006 and add my methods.
I see that for the workflow to be triggered using the CREATED event, I will have to delegate BUS1001006 to ZB1001006. Workflow does not get triggered without this delegation. I see I can change the delegation. Bus is this what I should do?
Advice is really appreciated.
Thomas Carruth replied
I come across this type of scenario often and solve it without Delegation by casting (in your case) BUS1001006 to ZB1001006.
Create a new Instance Independent method on ZB1001006 called CreateMe. Give it an Import parameter of Object Type BUS1001006 called ObjectIn and an Export parameter of Object Type ZB1001006 called ObjectOut.
Enter this code to the template created by SAP for the method.
DATA: local_object_key TYPE (enter the type of the key to BUS1001006 here).
SWC_GET_OBJECT_KEY ObjectIn local_object_key.
SWC_CREATE_OBJECT ObjectOut 'ZB1001006' local_object_key.
Start your workflow using BUS1001006.CREATED binding EVTOBJECT from the Event Container to an element of Object Type BUS1001006 in your Workflow Container. But since you need to use ZB1001006 here's how to create a reference to it.
Create a Standard (background) Task for ZB1001006.CreateMe.
Your WF Container should have elements for both BUS1001006 and ZB1001006.
For the first step in your WF call the Standard Task for ZB1001006.CreateMe that you just created above. Import Bind BUS1001006 from the WF Container to "OBJECTIN" of the Task Container. Export Bind "OBJECTOUT" from the Task Container to an element in your WF Container of Object Type ZB1001006.
For the remainder of your WF use the Workflow Container element that refers to ZB1001006.
Give it a try and Good Luck!