cancel
Showing results for 
Search instead for 
Did you mean: 

Need to trigger workflow based on change to one field in Warranty Claim

Former Member
0 Kudos

Hi All,

I have defined a workflow for the Warranty Claim system with triggering event as CHANGE in BO BUS2222. The workflow is triggerred and everything goes on smoothly. The only thing I need to address is this workflow should be triggerred ONLY when one particular field(CLERK) of the Warranty is changed. I have tried using the field restrictions in transaction SWEC for the Change Object but that doesnt seem to work and my workflow is triggerred on any change I make to the Warranty. Any pointers regarding this issue?

Regards,

Karthik

Accepted Solutions (1)

Accepted Solutions (1)

former_member186746
Active Contributor
0 Kudos

hi Karthik,

If this doesn;t work you can try creating a condition using swb_cond.

Kind regards, Rob Dielemans

Former Member
0 Kudos

Thanks for the link Rob.

I have tried this but was unable to figure out how do I give a start condition for my requirement. I need to check for a field whether its value has changed. How do I do this? Could you please give some pointers.

Former Member
0 Kudos

HI,

YOu can use check function module and assign that function module in transaction swetypv.

Do u need further help in how to write the code in check function module?

Former Member
0 Kudos

Yes Shweta.

If possible could you please provide me with the code.

Please note that I need to check whether a particular field's value has been changed. I have tried putting in a function module in the check function module but wasnt succesfull. I would be grateful if you can provide some input on this.

Former Member
0 Kudos

You will have to fetch the value based on your objectkey. I don't know what is your object key.

Declare: OBJTYPE like OBJTYPE

OBJKEY LIKE SWEINSTCOU-OBJKEY

EVENT LIKE SWETYPECOU-EVENT

RECTYPE LIKE SWETYPECOU-RECTYPE in the import parameter of your func module.

EVENT_CONTAINER like SWCONT in tables of func module.

In source code do these declarations apart from your other declarations which is required DATA: lv_object_key LIKE sww_contob-objkey ,

lv_event like SWETYPECOU-EVENT,

lv_objtype like SWETYPECOU-OBJTYPE,

Now say for an example your object key is sales order and you want only those orders for which order type is OR (standard sales order).

Then you can fetch the order type from any of the sales table and check if it is OR or not. Here your input will be lv_object_key.

eg: select order type from vbap where sales order =l v_object_key. Some logic like this.

If it is not OR then raise an error.

In this case when the required condtion is not satisfied the workflow won't be triggered.

Get back to me if you are facing problems

Thanks and Regards,

Shweta Verma

Former Member
0 Kudos

I read you post carefully and i think my answer is not relevant,

Former Member
0 Kudos

Hi Shweta,

Thanks for the code.

But I fear this will not help my cause.

I need to check whether a value of one particular field has been changed.

Let us say in the scenario presented below if Order Type has been changed from XX to YY i.e the order type field has been changed then I need to trigger the workflow.

Regards,

Karthik

former_member186746
Active Contributor
0 Kudos

It's strange that the change document doesnt work can you post the entries you made there?

Former Member
0 Kudos

Hi Rob,

I think I am missing some configuration/customization. I will take you through what I did. May be you can help me out.

In SWEC I created an entry for my BO.

WTY_CLAIM BOR Object BUS2222 CHANGED

In the field restrictions I gave the following conditions.

&PNWTYH_CLERK_OLD& <> &PNWTYH_CLERK_NEW&.

Can you please let me know now how do I link this event to trigger a workflow?

I guess creating a normal workflow and in the header mentioning the trigger event will trigger the workflow always. Am I right?

former_member186746
Active Contributor
0 Kudos

Well normally in SWEC,

there's a change doc BO event and the action, for instance

WTY_CLAIM BUS2222 CHANGED at change

then you double click that entry to create field restrictions:

so then you should see:

Table fieldname old value new value

so in your case:

table PNWTYH_CLERK * *

this should mean that only when this field is changed then the event changed of bus2222 is released. The next step should then be linking that event to a receiver (wf template), either in tab events of PFTC, or through SWE2.

Kind regards, Rob Dielemans

Former Member
0 Kudos

Hi Rob,

That is how I am defining my workflows in PFTC.

I have observed something strange which is happening.

When I chnage something else in the warranty the workflow is triggered. But when I change the field on which I have a restriction the workflow is trigerred twice. Does this give you any clues on this issue?

Regards,

Karthik

pokrakam
Active Contributor
0 Kudos

Hello,

You should create a custom event. CHANGED is already raised by SAP - either via change docs or internal code. So you should create a delegated subtype of your BO (there's plenty of info here how to do that) and use custom event ZCLERKCHANGED.

Once delegated, use BUS2222.ZCLERKCHANGED as your workflow trigger.

Cheers,

Mike

Former Member
0 Kudos

Hi Mike,

Thanks for the input. Any quick link to any such info would be of great help.

Regards,

Karthik

pokrakam
Active Contributor
0 Kudos

Former Member
0 Kudos

Hi Mike,

Thanks a lot. That almost solved my issue but for some minor corrections. Thanks for the clues.

Regards,

Karthik

Former Member
0 Kudos

Hi Shweta,

Can you pl explain me the procedure to write a chk fn mod( i need this asap for some urgent req)..

My requirement is to check if the Delivery block of a sales order is there or not and also to check if the concerned service order is created or not.

Please reply asap..

Thanks in advance

venu

Former Member
0 Kudos

Hi Venu,

Can you give a detailed description of what you need?

And as this thread was opened by me only I will get an email when you post any query.

Shweta wouldnt know that you are asking her a question.

Regards,

Karthik

Answers (0)