cancel
Showing results for 
Search instead for 
Did you mean: 

New object attribute on start condition

glauco
Active Contributor
0 Kudos
377

Friends,

I need to configure a start condition for a custom workflow that is triggered by J1B1N (Object BUS2143).

But this WF is triggered even we don't need to work with it, because we need it to start only if the field J_1BNFDOC-DOCTYP = 3 or 5. But this field doesn't exists on the object.

How can I add and populate the field in the triggering event so I would create a start condition with this field ?

Release 46C.

View Entire Topic
Former Member
0 Kudos

Hello Glauco,

basically you need to extend the original business object BUS2143 with new attributes that you can then use in the event start condition for evaluation.

If you're not familiar with workiten on business objects and really need a quick solution, it is best to use a CHECK FUNCTION MODULE.

Get the signature from some other event coupling where you can find one. The import parameters that you would like to use is OBJKEY that provides the full primary key of the underlaying database table. Depending on what and when the application exactly raises the workflow event, you should find the entry on the db table and check the entry.

If you don't want the event to be processed, just raise any exception within that function module, which then will stop the event processing.

If you'd like a more elaborated solution, you should basically follow the following steps:

- Go into the object editor (SWO1) and create a new subtype of BUS2143, naming it e.g. ZBUS2143

- Edit this new object type and create new attributes as appropriate. You could use the wizard "database attribute" giving the primary key fields of the database table. If this is a 1:1 relationship to the object's key fields, the coding will work out found.

- Put your cursor on the new attribute and push the "program" button.

- The system asks you, if it should generate the neccessary coding here, and answer it with "yes".

- Now back in the overview set the attribute's status to "implemented" (somewhere in the menu).

- Generate the business object.

- To substitute the original BUS2143 with the one that you've just created, you have to create a system wide delegation for it: In the entry screen of the Object Builder (SWO1) use the menu for Delgation-->System wide, enter the object type BUS2143 and as it's delegate your newly created one.

For further information about how to create and maintain business objects I would like to advice to search the forum or the SAP help here, first.

Best wishes,

Florin

glauco
Active Contributor
0 Kudos

Hi Florin,

There is a misunderstood.

I know these steps to create, modify and delegate objects and I think I had wrote things wrong.

But the project here we needed to do on this way I had explained. e.g. the standard triggers the workflow.

My doubt is about the start condition, because there isn't a attribute I need and my object is a zObject and I know that we have to create this attribute on the object, but how can I create the start condition if there isn't this attribute filed on the moment the WF is triggered.

I think there isn't any way to do it with the way I used to trigger the WF, because the standard cod doesn't fill up the attribute that I need to put on start condition so I can put it on start condition logic.

I'm waiting for any help.

thanks,

Glauco

Former Member
0 Kudos

Hello Glauco,

if you have coded the attribute of your business object and you have delegated that one and you used this attribute in the start condition (by using the father's object type) your coding will be processed.

Mayhaps having an event parameter could solve your problem the same way, when you use the event-parameter function module on change-documents, if you're using this one, or you create the event in a user-exit or business add-in.

Best wishes,

Florin

former_member186746
Active Contributor
0 Kudos

Hi Glauco,

You are correcty.

If there's no way to get the value of the attribute when you instantiate the object you then can't use this in the condition editor.

But hen I don;t understand why the attribute exists in the first place.

Maybe you're doing it wrong?

In your subtype create a (virutal ) attribute which holds the data (very importantly: known at the moment of instantiation) after creating AND generating en releasing the attribute, you then check if the delegation is set up correctly. Now you can use this attrivute in SWB_COND for the standard event.

If, as I said the data is known after instantiation, you just have to create your custom workflow where the check is made.

Kind regards, Rob Dielemans

glauco
Active Contributor
0 Kudos

Hi Florin and Rob,

Thanks Florin, but I agree with Rob's solution when he said about virtual attribute but I have never tried it before.

I'll try it and give both of you a feedback. ok?

thanks,

Glauco

glauco
Active Contributor
0 Kudos

Rob,

I've just had tried your solution, created the start condition as doctype = 3 or 5, created the YSBUS2143 with attribute doctype and delegated it.

I've created doctype = 1, but WF started.

On SWEL I can see the attribute with value 1.

Anything I've forgot ?

former_member186746
Active Contributor
0 Kudos

Check in SWB_COND if the condition is active. and also if there are more event wf linkages in swe2.

Kind regards, Rob Dielemans

glauco
Active Contributor
0 Kudos

Yes Rob, the condition is active (green icon) on SWB_COND.

And the wf linkage is only for the standard object. I've created the zObject and delegate it only.

Exists only the link between wf and standard object.

former_member186746
Active Contributor
0 Kudos

hi,

in swb_cond you can also test the condition by providing the key of the business object.

Maybe the condition is always true (like if A NE 3 Or A NE 5, this is alway true)

Kind regards, Rob Dielemans

glauco
Active Contributor
0 Kudos

But how can I test a start condition ?

I'm testing on the transaction that starts this wf or directly on the object on swo1.

Now I've just copied the wf (because it has the standard object to the trigering event tab) to another and changed triggering object/event to zObject and I'll test now.

I'll giver you the test result as soon as possible.

glauco
Active Contributor
0 Kudos

It didn't work.

1-Now I have an zObject, delegated;

2-A WF with zObject/event configured on triggering event tab on pftc.

3-The link (zObject/new wf copied) is ok on SWE2.

But it's not working. On swel I only see the standard object triggered event without an receiver (because I deactivated the triggering event on the other wf, because I had copied to a new to do this test with the new zObject).

3-Do I have to back my configuration (with standard object/event on the old wf triggering event tab) ?

Rob, do you know another thing to test ?

Glauco

glauco
Active Contributor
0 Kudos

Rob,

I activated both of them (wf and its copy, link and its copy start condition and its copy).

These two WF's are the same but the second is a copy of another, but I'm using the xObject/event to triggering the wf.

A question. Why the second WF is configured with triggering event zObject/event but it isen't appearing on swel ???

I think the first has to work fine, but its starting to all DOCTYP values. But I want it to start only to 3 or 5.

Why can I test the start condition ?

If I test directly on SWO1, it works fine. But not when I use the transaction.

Message was edited by:

Glauco Kubrusly