cancel
Showing results for 
Search instead for 
Did you mean: 

Integrating new business object into existing workflow

former_member852447
Active Participant
0 Kudos

Our existing workflow notifies us of incoming sales orders correctly but we had an issue with incoming debit memos where the workflow was not converting the placeholders on the task description to the debit memo document numbers so the workflow notification became indecipherable to us in the case of debit memos. Our existing workflow in based on BUS2032 for sales orders. The recommendation was that a separate workflow task for object BUS2096 be used and integrated into the existing workflow. I am uncertain as to how this can be done for example do I need a new sub-type ZBUS2096 or is this unnecessary since we do not have a sub-type for BUS2032. Please advise.

Thank you

Accepted Solutions (0)

Answers (14)

Answers (14)

former_member852447
Active Participant
0 Kudos

hello Martin,

is it always necessary to instantiate a new object type to the workflow when making use of multiple object types. I have been looking at some standard SAP workflows to make sure that I am not missing something and noticed that they do not appear to use the object type SYSTEM GenericInstantiate but just refer to the various object types in the workflow container.Thank you for all the help so far I will award all the points.

former_member852447
Active Participant
0 Kudos

Hello Martin,

Workflow is now failing at the new activity created to instantiate the object with message 'Object with runtime number ' 0' not defined' which is an OL mesage type. I guess I must have completed one of parameters incorrectly.I completed them as follows:

Import parameters:

Objectkey: vbak-vbtyp (this is my key field)

Objecttype: ZBUS2096 (this is the object type I want to instantiate)

Export parameters:

Objectinstance: ZBUS2096 (this is exported to the workflow)

martin_nooteboom
Active Contributor
0 Kudos

Hi David,

Objecttype should be BUS2096 an dnot ZBUS2096. You container element in the workflow should also be of type BUS2096. This is where you bind the object instance to.

Regards,

Martin

former_member852447
Active Participant
0 Kudos

Martin,just one final question before I award points and close this workflow, would I enter the new object type that I want to introduce into the workflow in the element OBJECTINSTANCE in the container under data type reference object type .I am asking this question because I have been passing an expression &objectinstance& as an export parameter and the aim of this exercise is to instantiate a new object type so I just want to make sure that I am coding the new business type in the correct place.

Former Member
0 Kudos

Hi David

ObjectInstance is an export parameter of the method, it return the instantiated object, so yes you are right, your new element needs to bound to it. So you may find an element in your task with the same name that you need to bind to the method, to receive it, and then to the workflow to pass it. Your element in the workflow has to be the same type.

FYI

ObjectKey is an import parameter that defines the key for the ObjectType below.

ObjectType is the actual object id - BUS2096 in your case.

Let us know if you need any further input.

Regards

Ravi

former_member852447
Active Participant
0 Kudos

Thanks Martin, Sorry to sound so ignorant but I am new to workflow. I have the new task set up using SYSTEM method GenericInstantiate. The parameters of method Genericinstantiate are found in the menu path Goto/Binding/object method where the import parameters are Objectkey and Objecttype and export parameter is Objectinstance. The instantiated object would be the new object type to be introduced to the workflow which would flow to the container, right.

martin_nooteboom
Active Contributor
0 Kudos

Yep, that's it.

former_member852447
Active Participant
0 Kudos

hello ravi, Almost there but a road-block...when I create the new task at the top of the workflow, I insert object reference SYSTEM and I see that the new task has a method GENERICINSTANTIATE. However where do I insert the new business object into the workflow or does this object type SYSTEM and method GENERICINSTANTIATE allow any new object references without actually spelling them out. Thanks

martin_nooteboom
Active Contributor
0 Kudos

Hi David,

The method genericinstantiate has import and export parameters. Import parameters are the object type and key and export parameter is the instantiated object. You pass this to a container element in your workflow.

Regards,

Martin

former_member852447
Active Participant
0 Kudos

Hello Ravi,

Hope that this is not too ignorant a question but when instantiating the new object type into the workflow which I have done with the wizard, it asks for a business type and I have entered the business type to be introduced into the workflow. I noticed in looking at some other completed workflows that the business type SYSTEM and method GenericInstantiate was used and this confused me somewhat.

Former Member
0 Kudos

SYSTEM.GenericInstantiate, that I normally use in such situations, allows you to create an instance of another object type.

I think you are on the right path...just shout if you have any more doubts, you also need to pass the key..

Good Luck

Ravi

former_member852447
Active Participant
0 Kudos

Hello Ravi/Martin,

This is a change to a previous workflow. The previous workflow did not require a step to distinguish whether it was a sales order or debit memo but the changed workflow now requires this as a step. The changed workflow does not read this step and is consequently failing. I inherited this workflow from a colleague who could not get it to work.Using the wizard <include 'create object reference'> I will insert a step in the workflow before the step mentioned above is reached so the required business object(s) is instantiated into the workflow. Just one question when the workflow runs does it follow the graphical sequence or the navigation area sequence #'s because when I did the above in the sandbox it added the instantiation step at the bottom of the step list although on the graph it is at the top.

Former Member
0 Kudos

Hi David

You select the step before which you want to insert the new activity.

It will logically follow in the order displayed, taking in conditions, forks, etc.

Good Luck

Ravi

former_member852447
Active Participant
0 Kudos

Hello Martin/Ravi,

I have done this using the workflow wizard as you have recommended. Just one question, the standard task created by the wizard needs to be related to the triggering event which the workflow is related to, right.

Many thanks for the help so far. I will award full points once this thing works.

martin_nooteboom
Active Contributor
0 Kudos

Hi David,

No you don't need to relate this task to a starting event. This tasks makes sure you have all the attributes of the BOR available in your workflow. So all the specifics of are available. The workflow will still be started by the other event and BOR.

Regards,

Martin

Former Member
0 Kudos

Hi David

I think you are a bit lost and need to take a few steps back to where you created the TS task to create an instance of the credit memo Business Object.

Use this task to insert an activity before the step where you require it - where you defined a new element to bind this instance.

There is no need to define a triggerring event for the new TS task as this will be inserted in the existing workflow.....

Let me know if this unclear.

former_member852447
Active Participant
0 Kudos

Hello Martin,

Thanks for the help so far. I feel that this will shortly be resolved.

The issue that still troubles me is how does the new task created for object BUS2096 get related to the my existing workflow. I already have one workflow task created from BUS2032 for the sales order. I assume that the new task will be created from BUS2096 and will have a triggering event which will be the same the task created from BUS2032 so when the workflow is triggered by event INPUTFINISHED both tasks are now triggered.

Thanks

martin_nooteboom
Active Contributor
0 Kudos

Hi David,

You don't create a new workflow, only a new task in the existing workflow. This task will instantiate BUS2096, and in this way it is available in the existing workflow.

Regards,

Martin

Former Member
0 Kudos

Hi David

You need to add the new task to your existing workflow, preferably just before you use in the step, so that the data is available for use within your texts/notifications. You do not need to create a separate workflow for this..

Regards

Ravi

former_member852447
Active Participant
0 Kudos

Hello Martin,

If I can avoid creating a new method and a subtype then this is the way I want to go. The client is already hysterical. Do I understand crrectly that by instantiating BUS2096 into my workflow that object BUS2096 needs its own task and this task needs to be integrated into my existing workflow. Am I correct in assigning BUS2096 to event linkage using transaction SWETYPV. Would the key of the instance be the key field of the incoming sales order so the workflow can distinguish whether it is a sales order or debit memo.

Thanks

martin_nooteboom
Active Contributor
0 Kudos

Hi David,

Almost, you need to create a task to instantiate object BUS2096 in your workflow. When you use the wizard a task will be created in your workflow which will instantiate BUS2096.

You couldn't assign BUS2096 in the event linkage because the event is not raised for this object (right?). If the key field of BUS2096 (debit memo right?) is the same one as for the object of the PO, then yes you can use this to instantiate BUS2096. As I don't have access to a system at this time I couldn't check anything for you.

Regards,

Martin

former_member852447
Active Participant
0 Kudos

hello Arghadip,

Do you mean adding the key fields to the existing workflow container and then create a subtype of BUS2096 and then create a method to this subtype which includes macro SWC_CREATE_OBJECT. Subtype would then have to be included in the workflow container with parameters import/export in place of BUS2096 and the the subtype would need to be added to the event linkages.

thanks

former_member852447
Active Participant
0 Kudos

Hello All,

I have created an element 'debit_memo' and added this to the workflow container of the workflow element and activated the import/export parameters. Under data type reference in the workflow container I have added the object type BUS2096' which is the other BO which I want to integrate into my workflow. The macro SWC_CREATE_OBJECT" is found in the method 'Custdebitmemorequest- Create'. BUS2096 has been added to event linkages using transaction SWETYPV but still I do not catch the incoming debit memo...obviously I must have missed something.

Thanks

Former Member
0 Kudos

You have to pass the key fields and then you have to use the SWC_CREATE_Object in a different method. NMow this method needs to be executed to get the Business object inside your workflow.

Do not use other methods. Create your won in your custom BO.

You can create another Business object inside a different business object method.

Thanks

Arghadip

martin_nooteboom
Active Contributor
0 Kudos

Hi David,

You need to instantiate the object BUS2096 in your workflow. For doing this SAP provided a workflow wizard which helps you create a task. The only thing is, you need to know the key of the instance you want in the workflow.

If you don't want to use the wizard, you can also create a task with object SYSTEM and method GenericInstantiate to instantiate the object.

No need to build a method and use the SWC_CREATE_OBJECT macro.

Regards,

Martin

former_member852447
Active Participant
0 Kudos

Hello Ravi,

In answer to your question:

1. The existing workflow would be fine if we could get it to work. We have implemented BUS2096 as import/export attributes in the workflow container

2 The existing task works for the sales order but for the debit memo we get SAP variables which tell the user nothing. The binding I think is the issue so could you give me some indication as to what to check.

Thank you sir

Former Member
0 Kudos

You need to create a similar element in the task as well and then bind it from the w/f and back...You can then use the new element in the task.

Good Luck

Ravi

Former Member
0 Kudos

First you need to instantiate the business Object which you wish to show in your existing Wflow. By instantiation I mean to say you create a method that will catch the key field of the other BO and you will create a object.

Use Macro SWC_CREATE_OBJECT.

Once this method is created you need to associate this with a task and then you can pass the Business object value into the Wflow template by binding.

Thanks

Arghadip

martin_nooteboom
Active Contributor
0 Kudos

@ Arghadip,

Why create your own method for instantiating a BOR when SAP offers a standard solution? You have the method GenericInstantiate of the BOR SYSTEM which can be used, or even the wizard which SAP provides which makes it even easier.

Former Member
0 Kudos

Hi David

Could you clarify,

1. Would the existing workflow suffice or do you need a separate workflow for the different BO?

2. If there is an existing task with meaningless text, wouldn't it be better to use the same and just bind it correctly.

Regards

Ravi