cancel
Showing results for 
Search instead for 
Did you mean: 

Function module to restart workflow?

Former Member
0 Kudos

Hi..

Very urgent... Please suggest me the function modules to restart workflow...

thanks in advance..

regards,

jawahar

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Please try below executable code:

Data: lt_container type table of swr_cont ,

         ls_container type swr_cont,      

         INPUT_CONTAINER type  SWR_CONT,      

         MESSAGE_LINES type table of SWR_MESSAG,      

         MESSAGE_STRUCT  type table of SWR_MSTRUC,      

         AGENTS  type table of SWRAGENT,     

         RETURN_CODE type  SY-SUBRC,      

         WORKITEM_ID type SWR_STRUCT-WORKITEMID,      

         NEW_STATUS  TYPE  SWR_WISTAT.     

* Filling Agent

         ls_container-element = 'ACTOR'.     

         ls_container-value = 'TECHMDEV5'.     

       append ls_container to lt_container.     

        clear ls_container. 

        ls_container-element = 'ACTOR'.

        ls_container-value = 'TECHMDEV4'.

      append ls_container to lt_container.

       clear ls_container.

* Calling Custom Workflow

CALL FUNCTION 'SAP_WAPI_START_WORKFLOW' 

     EXPORTING    

        task                      = 'WS99900001'    

        LANGUAGE         = SY-LANGU    

        DO_COMMIT       = 'X'   

        USER                   = SY-UNAME

*      START_ASYNCHRONOUS        = ' '

*      DESIRED_START_DATE           =

*      DESIRED_START_TIME            =    

        DESIRED_START_ZONLO       = SY-ZONLO

*      IFS_XML_CONTAINER             =

IMPORTING  

       RETURN_CODE               = RETURN_CODE   

       WORKITEM_ID                 = WORKITEM_ID   

       NEW_STATUS                  = NEW_STATUS

TABLES  

      INPUT_CONTAINER           = lt_container   

      MESSAGE_LINES             = MESSAGE_LINES   

      MESSAGE_STRUCT            = MESSAGE_STRUCT   

     AGENTS                             = AGENTS.

if sy-subrc = 0.

* Your WORKITEM_ID carry your workflow start task id

endif.

former_member31961
Contributor
0 Kudos

Hi

Did you check FM 'SAP_WAPI_ADM_WORKFLOW_RESTART' to restart the workflow.

P.S: workitem id that you are going to give in this wapi is the workflow workitem id not the task workitem id.

Hope this helps,

Shrinivas

Former Member
0 Kudos

Hi shrini..

thanks for your response.. do this function module restarts the workflow immediately?

in SWPR transaction, there is check box "Restart immediately" and this function module has any impact of this?

my requirement is to restart the workflow immediately..

regards,

jawahar

former_member31961
Contributor
0 Kudos

Hi

It will start immediately. When i used this FM i didn't get any problem.

If you have any issues let me know.

Regards,

Shrinivas

Former Member
0 Kudos

ok shrini..

i will try out and let u know if any issues...

regards,

jawahar