cancel
Showing results for 
Search instead for 
Did you mean: 

Issue in retriggering workflow when changes made for price field in PIR.

Former Member
0 Kudos

Hi Experts,

  There is an issue while automatic retriggering workflow for PIR. Actually there is a logic that if the price got changed in PIR then workflow needs to retrigger automatically to the approver. Now i have 2 PIR. Let say 51XXXXXX1 and 51XXXXXX2. For both PIR the same price got changed and the workflow was retriggered for the first PIR only. Not for the second PIR. Now my question is, why the second PIR was not retriggered eventhough the same price got changed for both PIR. Can you please guide where do i need to check why the workflow was not retriggered?. Because if it's triggered and then some problem means we can check via workflow log. But since it was not retriggered obviously it will be not there in workflow log right?. Thats what i wonder where to check why the retriggered was not happend for the second PIR. Kindly give your inputs if you have expereinced towards this problem. Many thanks in advance.

Regards,

Kavi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Kavi,

Is your event is standard one or customized one?

if it is a customized event, then you have to debug your code to check the issue.

Or if the event is standard, check the tables CDHDR and CDPOS. If the value of price changed it should update old and new values in this table.

Event trace using SWEL & SWELS are also needs to be checked to get some clues.

Thanks,

Vijay.

Answers (7)

Answers (7)

Former Member
0 Kudos

Hi All,

   For workaround, is it possible to restart that change event again with the old and new value which user used already?. Atleast It would be good we could do the restart the change event with same old and new value. Please give your ideas. Many thanks for all your valuable inputs.

Regards,

Kavi

I042439
Employee
Employee
0 Kudos

Hi Kavi

For triggering the event you will have to use transaction SWUE.

Please note that the Workflow Initiator will be the user triggering the event from SWUE. Also, if the workflow reads any data from DB, it will use the current (as on date) data. if there are any event container elements, you can still pass your values. However, I will advise you to do this in agreement with the business owner.

Regards,

Modak

SandySingh
Active Contributor
0 Kudos

Hello Kavi,

You can also use the transaction SWUS_WITH_REFERENCE. Refer to document below: Tammy Powlas has explained this transaction in details.

Regards

Sandy

Former Member
0 Kudos

Hi All,

   Finally got the way to debug that function module in DEV/Quality server. I dont see any issues. Because the change event is triggering. All the conditions are correct when debugged. When i checked in SWEL i could see the change event has been triggered. Then i compared the conditions with PRD(Production system). Seems everything okay with the given condition. But we never know whats the particular condition failed during that change in Production server right?. So i am not sure how to trace that in PRD. So is there any another way to trace the reason for not triggering the event. Many thanks for your inputs.

Regards,

Kavi

Former Member
0 Kudos

Hi All,

   1. All settings of SWED/SWEC for change event had been setted already.

   2. Actually changing event is triggering. But for this particular objecy key it was not triggered. So i need to find the reason for the particular object key why it was not triggered when changes made. If there is a problem in step after workflow triggered means, we can go via workflow log atleast can find what is the reason it was stopped. But in my case,since it was not triggered, i am struggling to find the reason.

3. I have checked in event trace alslo. There was no change event triggered on that time regarding PIR object type BUS3003 for changing document in SWEL.

4. Checked in SWEQBROWSER entires also. None of entires related to this.

4. Actually there is a customized function module where some conditions are applied before change event workflow triggering. In this,any condition could be failed. That should be reason it was stopped. But i wonder how to trace the which condition has failed while it was not triggered.

5. When i test in DEV/Quality server i just put the breakpoint in that cutomized function module. Then i done changes in PIR. But the breakpoint is not stopped. Pls give your ideas if you got related this. Many thanks in advance.

Regards,

Kavi

I042439
Employee
Employee
0 Kudos

That's what Kavi - where is that FM Plugged into? BADI? Config? Which Place???

Former Member
0 Kudos

Hi Kavi,

Some conditions might be failed before your custom function module.

Put where used list for the custom function module and put the break point in the first line itself.

In worst case, change the price and put /H and save. So that you can debug the entire code.

Thanks,

Vijay.

SandySingh
Active Contributor
0 Kudos

You wrote:

 Actually changing event is triggering. But for this particular objecy key it was not triggered. So i need to find the reason for the particular object key why it was not triggered when changes made. 
  • Ensure that change document object is linked to custom event via Transaction SWEC

        Select On Change as the Trigger Event and check if there are any "Field restrictions" maintained. This might be stopping the second event to get triggered(may be there is a condition that second record don't satisfy ).


Regards

Sandy

SandySingh
Active Contributor
0 Kudos

Hello Kavi,

Looks like the  function module is called in update task when change document changes are committed to database. To debug this function module , refer to link below.

Regards

sandy

Former Member
0 Kudos

Hi Modak Gupta,

  1.  Issue is in Production system. There is a entry in SWETYPV(Event type linkage) that if the event is WEPURCHASEINFORECORDCHANGED for the object type BUS3003 then check that customized FM and the Receiver FM is SWW_WI_CREATE_VIA_EVENT_IBF. By the way, Is it possible to find the failed condition during the change event triggered for the particular PIR object key. 

2. And also, Is it possible to retrigger/restart the same PIR number with same old and new values which User made changed. Many thanks in advance.

Regards,

Kavi

Former Member
0 Kudos

Hi All,

  Thanks for your valuable response. Below are my analysis after checked all suggestions.


1. PIR means Purchase Info Record where the pricing is maintaining for the combination of material and vendor according to purchase organization.

2. Yes it's the customized workflow. This change event needs to be triggered during the price changes happend in PIR.

3. I have checked in CDHDR/CDPOS tables where i could see the price changed from old value to new value.

4. Finally i am still facing difficulties in debugging the workflow. Because i just want to debug a function module where some conditions are applied for some cases for triggering the change event. But i am unable to stop there when changing the price value. Pls anyone advise on the debugging process?

5. Actually this problem is in PRD system. Since it's very difficult to find in PRD i am trying in DEV/Quality server to check this issue.

6. Then, In SWELS there is already Event trace is ON(Means it shows as OFF). But eventhough event trace is ON, the change event had not been triggered. So i need to find the reason why the change event is not trigggered though the document has changed. Please guide me on this.  Many thanks in advance.

Regards,

Kavi

former_member185167
Active Contributor
0 Kudos

Hello,

What are your settings in SWEC, has it been set up to create an event when those values are changed?

regards

Rick

SandySingh
Active Contributor
0 Kudos

Hello Kavi

So you are using "Change Document" configuration to trigger the event and you arr not raising the custom event via FM SAP_WAPI_CREATE_EVENT

  • Ensure that  Change Document Object with the Business Object via SWED . Ensure "action:change" checkbox is ticked


  • Ensure that change document object is linked to custom event via Transaction SWEC

        Select On Change as the Trigger Event and check if there are any "Field restrictions" maintained. This might be stopping the second event to get triggered(may be there is a condition that second record don't satisfy ). Ensure that BOR object is delegated correctly. You would have created a subtype of SAP standard BOR to add custom event.


Inline images 1

Regards

Sandy


I042439
Employee
Employee
0 Kudos

Hi Kavi

Which function module are you trying to debug? Where is it actually plugged into your process?

Regards,

Modak

anjan_paul
Active Contributor
0 Kudos

Hi,

  Also check  is there any entries in the SWEQBROWSER or   not

I042439
Employee
Employee
0 Kudos

Hi Kavi

What is your triggering process? How is the workflow triggered? Event by code? By Change Documents?

If based on events - check the event trace:

SWELS will display "Switch ON" if the trace is OFF - Just click on it once (if the trace in ON, it will display "Switch Off" - no need to click that. Remove all restrictions , if any, in SWELS.

Now your workflow trace is ON

make a change to the PIR (by-the-way, what is a PIR ? Which System?)

Check SWEL - the event trace - see what event is triggered - do we have a green light or red light - or blank? What workflow has started (WSxxxxxxxx)? If yes, double click that line, then click on the "Work Item" Button on the top...check Log to see if there are errors.

Screen shots will help.

Regards,
Modak


SandySingh
Active Contributor
0 Kudos

Hello Kavi,

You are triggering a custom event using SAP_WAPI_CREATE_EVENT via some BADI or User Exit.

Looks like there is an issue with commit work when two PIR are changed at the same time. May be your are using a COMMIT work for this first object while raising the event and it is stopping the trigger of event for second object. This FM has commit work set to default X.

I suggest call  FM SAP_WAPI_CREATE_EVENT in update task and see if this issue is resolved.




CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'IN UPDATE TASK

       EXPORTING

         object_type             = object_type

         object_key              = object_key

         event                   = event

*       COMMIT_WORK             = 'X'

*       EVENT_LANGUAGE          = SY-LANGU

*       LANGUAGE                = SY-LANGU

*       USER                    = SY-UNAME

*       IFS_XML_CONTAINER       = IFS_XML_CONTAINER

*     IMPORTING

*       RETURN_CODE             = RETURN_CODE

*       EVENT_ID                = EVENT_ID

*     TABLES

*       INPUT_CONTAINER         = INPUT_CONTAINER

*       MESSAGE_LINES           = MESSAGE_LINES

*       MESSAGE_STRUCT          = MESSAGE_STRUCT


Also debug the code from BADI

Regards

Sandy

Former Member
0 Kudos

Hi Vijay,

  Thanks for your quick response.

1. Yes, It's a customized one. So far my concern is, it's very difficult to debug the workflow as per our convenience right!!!. If you have any ideas towards this debugging process, pls guide the steps to debug. Because even if we put the break point over there in coding part, it will not be stop as it's the background process.

2. I checked in CDHDR and CDPOS table. It is updated new and old values correctly.

3. Can you say how can we trace via SWEL and SWELS?

Many thanks in advance.

Regards,

Kavi

Former Member
0 Kudos

Hi Kavi,

Go to SE37 and enter the FM name as 'SAP_WAPI_CREATE_EVENT' and click on 'Where used List'.

It will display many programs/class's and in that list search for custom objects starting with 'Z'.

If you got any put breakpoints over there and try to execute your transaction. Workflow is background process but the triggering point should be a foreground process.

My guess is some condition failed before calling the event create function module, so the event didn't triggered for some cases.

Since the event is custom, you no need to put event trace.

Thanks,

Vijay.