Skip to Content

Sometimes one needs to create Workflow forecast for the case if workflow must be restarted.

Want to share a solution, I found.

First you need to have a shopping cart header guid.

DATA lo_process     TYPE REF TO /sapsrm/if_wf_process.
lo_process = /sapsrm/cl_wf_process_manager=>get_process_by_document( header_guid ).

So you get a worflow process instance. Then you need to reinitialize process (simulate restart)

/sapsrm/cl_wf_process_manager=>reinitialize_process( lo_process ).

This call returns true, if re-initialization was successful.

So, it’s better to pack it in IF operator

IF abap_true = /sapsrm/cl_wf_process_manager=>reinitialize_process( lo_process ).

Now you are ready to simulate workflow

DATA ls_process_forecast TYPE /SAPSRM/S_WF_PROCESS.
    iv_document_guid       = header_guid
    iv_document_type       = /sapsrm/if_pdo_obj_types_c=>gc_pdo_shop
    iv_agent_id            = sc_header_created_by
    iv_language            = sc_header_language
    es_process             = ls_process_forecast ).

So, in ls_process_forecast you will get a workflow simulation for the restart case.

After processing of simulation you may need to rollback the work or clear workflow simulation cache.

/sapsrm/cl_wf_process_manager=>delete_runtime_config_cache( ).



P.S.:  English language is not my native language, and any person is not insured from mistakes and typing errors. If you have found an error in the text, please let me know – I’ll correct the post.

P.P.S.: If you have some ideas, how to correct/improve this post – please don’t hesitate to leave a comment.

To report this post you need to login first.


You must be Logged on to comment or reply to a post.

      1. Former Member

        Hi Konstantin,

        I have a requirement to restart a Shopping Cart workflow when it is resubmitted by requestor after rejection. Here I created a thread which will give more idea about the issue.

        Can I use your logic inside class /SAPSRM/CL_WF_PROCESS_MANAGER and method DETERMINE_PROCESS_RESTART to restart the SC workflow. will it work? Please advise.




Leave a Reply