cancel
Showing results for 
Search instead for 
Did you mean: 

Workflow object creation

Former Member
0 Kudos
100

Hi All,

Can nebody plz explain me how the business object is instantiated in workflow.

For example: a workflow is started for the business object BUSXXXX, the workflow template has got a task which uses a instance method of a different business object BUSYYYY. So when does the object BUSYYYY gets created. Becuase without the object, the method can not be executed. i believe.

At what point, the BUSYYYY instance gets created and what are the atrributes to be binded between the wf template and the task containers which uses BUSYYYY.

Thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Manikyalarao,

you will need some piece of coding that says

swc_create_object busXXXX 'BUSXXXX' primary_key.

and this is passed back to the workflow (in a separate step) before the call may happend. This is usually done in an istance-independant method of any object.

You may also use the instance-creation wizard if you have the primary key already available in a container elelemtn.

Alternatively the appropriate business object instance has some link between the one you have and the one you need (e.g. the vendor-object in an invoice-verification object BUS2081): Then it may be well implemented as a virtual attribute instead (with kinda the same coding behind the scenes).

Best wishes,

Florin

Former Member
0 Kudos

Hi Florin,

I think i forgot to provide the following information.

WF triggered by BUSXXXX evnt changed

Task T1 method: BUSXXXX approve [standard ]

Task T2 method: BUSXXXX check [standard ]

Task T3 method: BUSYYYY processing1 [custom ]

Task T4 method: BYSYYYY Processing2 [custom ]

how does the instance dependent method of processing1 gets executed? When does the BUSYYYY object gets created in the life cycle of the current workflow, at which step?

BUSYYYY is a subtype of BUSXXXX. Do we need to do any extra binding between the two objects?

Thanks and advance

ramki_maley
Active Contributor
0 Kudos

Hi,

You need to delegate your BUSYYYY subtype to BUSXXXX. The custom methods then will become available by referring to the super type BUSXXXX. It is a good practice to always delegate and refer to the super type in the task and workflow definitions. In your case there is no need to instantiate the object. Click SAP help on delegation. https://www.sdn.sap.com/irj/sdn?rid=/webcontent/uuid/e7b06b5c-0501-0010-3c80-f82a07c9838a">here [original link is broken] [original link is broken]for the points system.

Former Member
0 Kudos

Hi Ramki,

Thanks for the reply, I just got this doubt. Is there any other way to acheive this,I am not sure, plz correct me if I am wrong. becuase for every subtype if we keep on delegating, i think it might lead to some kinda chaios at some point in future. Is it really advisable to delegate in normal object and its subtype senario. plz suggest.

ramki_maley
Active Contributor
0 Kudos

Hi,

This is the recommended way. You are free to create as many subtypes to a supertype as you want but you can only delegate one subtype to its supertype. I have so far not come across a situation where there is a need to create multiple subtypes to a supertype. Could you be more specific on what kind of chaos it might lead to? In fact it will be more inconvenient not to delegate.

Please search the SDN, SAP-WUG as well as SAPFANS for more information on delegation.

Cheers,

Ramki

Former Member
0 Kudos

Thank you very much Ramki. Sounds logical and perfect solution.

But there is still some missing link in my mind. Previously I haven't deligated the subtype but used its method in one of the tasks. The wf was working fine without giving ne trouble. How come the sybtype specific method [ task infact ]got executed without having the subtype instance created. In the wf-tsk binding i assigned supertype obj ref to subtype obj refer. Do you think it did the magic?

ramki_maley
Active Contributor
0 Kudos

<i>i assigned supertype obj ref to subtype obj refer. Do you think it did the magic?</i>

It might have. You must have used the subtype and its method in the task definition. When you delegate, you reference your custom method using the supertype. One of the advantages of doing this for instance, if your task needs a terminating event, it may have already been defined and triggered for the supertype by the system and you can use this. Just like you used the Supertype event to trigger your workflow.

Cheers,

Ramki.

Answers (0)