cancel
Showing results for 
Search instead for 
Did you mean: 

SRM Process Controlled Workflow - Re-start using FM BBP_PD_SC_UPDATE

Former Member
0 Kudos

Hi All,

We are upgrading from SRM4.0 to SRM7.0 SP07 in classic scenario. We switched to Process Controlled Workflow.

We have a CUSTOM application where the requisition items are entered and a Shopping Cart is created in SRM through Function Module BBP_PD_SC_CREATE. When the Shopping Cart is created in SRM , the Process Controlled Worflow is triggered successfully.

In the custom application , we allow users to do changes to the requisition that are awaiting approval.The changes are updated in SRM Shopping Cart through function module BBP_PD_SC_UPDATE. It is noticed that the workflow process levels are not re-started after the shopping cart is updated through FM BBP_PD_SC_UPDATE.

However , the process levels are re-started when the change is directly done to the Shopping Cart in SRM POWL. We want the process levels to be re-started even when the changes are done through BBP_PD_SC_UPDATE. The users are used do changes to the requisition through the custom application. We also noticed that system does not go through BAdI /SAPSRM/BD_WF_PROCESS_RESTART when changes are done to the SC through BBP_PD_SC_UPDATE.

Is there any way that we can trigger process level re-start when SC is changed through FM BBP_PD_SC_UPDATE

Thanks

Sukumar

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

HI,

I'm working on SAP SRM 7.0 Process controlled workflow.

My requirement is to retrigger the PO only when there is a change in the value of PO by threshold limit.

The standard Process retriggers the PO when i click on Edit button, when the status of PO is Awaiting approval or approved.

Please let me know how to achieve this.

Thanks and Regards,

Hema HT

masa_139
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

How about disabling the Edit/Change button in POWL? User should use custom application and not use standard application in your case. Or you can enhance your custom application to recall the workitem before edit/change like standard application.

Regards,

Masa

Former Member
0 Kudos

Thank you all for the responses.

We are using the custom application only for creation / changes to the Shopping Cart. The approval of the Shopping Cart will take place in SRM. Also the custom application is being used only in North America while Europe users will continue to use SRM for creation / change / approval of Shopping cart.

The User-Id of the person that is changing the Shopping Cart in the custom application is used to call FM BBP_PD_SC_UPDATE.

Our development team is checking if submit action can be called after BBP_PD_SC_UPDATE. We are in SRM7.0 SP07.

Thanks

Sukumar

Former Member
0 Kudos

Hi,

how do you solve your problem?

I need to restar the approval circuit and if I edit a shopping cart on the browser works fine, but if I use the FM BBP_PD_SC_UPDATE, does not work...

thank you

Former Member
0 Kudos

Hi,

you can force to restart the workflow.... check /SAPSRM/CL_WF_PROCESS_MANAGER~DETERMINE_PROCESS_RESTART is been called when you change the sc through your custom application,, if yes then you can use the restart badi to restart the workflow..just try...

Saravanan

Former Member
0 Kudos

Thanks Saravanan for your reply.

The /SAPSRM/CL_WF_PROCESS_MANAGER~DETERMINE_PROCESS_RESTART method is not called when I update and save my shopping cart. And BADI is not triggered.

I'm calling the followinf FM in my custom program:

1. BBP_PD_SC_GETDETAIL

2. BBP_PD_SC_UPDATE

3. BBP_PD_SC_SAVE

4. BBP_PD_SC_COMMIT

5. BBP_PROCDOC_RESET_BUFFER

In any of these steps the BADI or 'Determine_process_restart' method are called.

Do you have any ideia what I need to do to restart the workflow?

I do not need to edit the Shopping Cart itself, I only need to restart the approval Workflow.

P.S.: Even if I try to call the 'Determine_process_restat" method on my custom program, the workflow does not restart.

thanks

Edited by: PCabrita on Jul 5, 2011 5:47 PM

Former Member
0 Kudos

HI ,

This is not the correct way of updating the SC. please check the below process...

first you try to get the SC document in Edit mode and this can be done only SY-UNAME should requester of the SC or( user who are changing the SC should be in the Org structure ). ( This point why i mentioned is you mentioned that your editing through custom application ).

note : use try and endtry and catch the exception when u get the SC document in Edit mode.

DATA: lo_pdo_sc TYPE REF TO /sapsrm/cl_pdo_bo_sc_adv.

"Instance SC PDO Layer

lo_pdo_sc ?= /sapsrm/cl_pdo_factory_sc_adv=>get_instance( iv_header_guid = p_guid "ps_shopping_cart-guid

iv_mode = /sapsrm/if_pdo_constants_gen_c=>gc_mode_edit ).

now you do what ever changes to the document. I mentioned points below.

"Get Item Details

lo_pdo_sc->/sapsrm/if_pdo_bo_sc~get_item_detail

do changes to the items of the SC.

"Update SC Items

lo_pdo_sc->/sapsrm/if_pdo_bo_sc~update_items

"Submit Update

lo_pdo_sc->/sapsrm/if_pdo_base~submit_update

"Save SC

lo_pdo_sc->/sapsrm/if_pdo_base~save

or order the SC again.

COMMIT WORK AND WAIT.

regards,

Devi

Former Member
0 Kudos

Thank Devi.

I'm trying to change the SC like you said, but I'm always getting a /SAPSRM/CX_PDO_WF_RECALL_RQ exception when I try to get a SC instance:


"Instance SC PDO Layer
lo_pdo_sc ?= /sapsrm/cl_pdo_factory_sc_adv=>get_instance( iv_header_guid = 'E0A328B64EBE63F18A2D005056A378ED'
iv_mode = /sapsrm/if_pdo_constants_gen_c=>gc_mode_edit ).

Do you have any ideia why ?

thank you in advance.

Former Member
0 Kudos

HI ,

please let me know whether your trying to change the SC which is ordered and approved ?.

regards,

Devi

Former Member
0 Kudos

HI,

The shopping cart is ordered only.

He still is in approval process.

Former Member
0 Kudos

Hi,

I used the code above but to make it work I need to change the line:

 iv_mode = /sapsrm/if_pdo_constants_gen_c=>gc_mode_edit

for

iv_mode = /sapsrm/if_pdo_constants_gen_c=>gc_mode_display

and add

lo_pdo_sc->/sapsrm/if_pdo_adv_base~edit( ).

Even using the methods you indicated, the approval workflow is not restarted after updating the Shopping Cart.

Someone know why ? And how can I restart it ?

Thank you.

Former Member
0 Kudos

Hi ,

As per standard SAP

after creating SC and if it waiting for approval requester cannot edit the SC document.

if approver rejects the SC then only you can change the SC and then workflow will restart automatically.

...this is the Standard procedure thats why yesterday if you try to get the SC document in edit mode then you got Workflow exception.

as per your requirement.

after creating SC and if SC is waiting for approval and still you want to edit the document means that is wrong process.

As per standard if the SC is under approval you cannot change the SC until approval rejects that SC.

I tried to replicate your requirement i am also not succeeded.

question from my side .What is the requirement to change the SC if it is under approval.

Regards,

Devi

Former Member
0 Kudos

What I really want is restart the Approval Workflow when he is "waiting for approval" (for some reason).

The n-step approval workflow is different based on material, price, etc.

For example, if I put a lower price the SC is IN budget and should be approved by the USER1 and USER2.

If the SC is OFF budget it should be approved by USER3 and USER4.

So, if I create a SC and it is OFF budget, the workflow is under approval on USER3 , then I load some budget for the cost center used and restart the workflow for SC go to USER1.

And I checked that when I Edit the shopping cart on SRM Portal, the workflow is restarted, but if I edit the SC on my custom program, it is not.

Former Member
0 Kudos

Not sure whether you have achieved your solution yet. But my two cents...

Option 1: I would rather create a RFC enabled FM and pass on the SC number on it.

1. Use FM BBP_PD_SC_GETDETAIL to get the document guid of the SC

2. Use the following methods to force the retrigger of Approval Process (works only if the cart is in Awaiting Approval Status - I1015)

CALL METHOD /sapsrm/cl_wf_adv_facade=>cancel_process_for_restart

EXPORTING

iv_document_type = 'BUS2121'

iv_document_guid = <document_guid>

iv_agent_id = <sc creator>.

CALL METHOD /sapsrm/cl_wf_process_manager=>start_process

EXPORTING

iv_document_guid = <document_guid>

iv_document_type = 'BUS2121'

iv_agent_id = <sc_creator>.

As soon as I call the BBP_PD_SC_UPDATE in the external application, I will call this custom RFC enabled FM to force the retrigger of the workflow.

Option 2: Create the Wrapper RFC enabled FM in SRM for FM BBP_PD_SC_UPDATE, and do the following

1. Call FM BBP_PD_SC_UPDATE

2. Call FM BBPU_COMMIT_AND_WAIT

3. Call the two methods as mentioned above, if BBP_PD_SC_UPDATE is successful.

Former Member
0 Kudos

HI

See what is the difference between the way you are calling your SRM system while Creating the Cart (BBP_PD_SC_CREATE) and while updating the cart.

BBP_PD_SC_UPDATE seems to be directly updating the cart at table level, and control is not going to workflow at all. Your Function module update seems to be the culprit here.

One more thing, once the SC is created in SRM, how it is being taken to an external application for approval. Cant you get the approval action done in SRM Portal itself.

Which Support pack level you are on, in SRM 7

Regards

Virender Singh

Former Member
0 Kudos

One more thing,

The id which is calling SRM Application seems to be your RFC id. Is the Approver id used to call the FM BBP_SC_UPDATE?

Regards

Virender Singh

Former Member
0 Kudos

When you process SC changes via custom application, which user ID you using??

Also looks like BBP_PD_SC_UPDATE is not creating any action (like Submit) which may lead not to trigger the workflow BADI..

Try to create (Like events we do in webdynpro) an submit action when you call BBP_PD_SC_UPDATE... Just a suggestion..

Thanks!!

Bharath