cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to Execute Workflow From ABAP Program

vikash_pathak
Participant
0 Likes
3,838

Hi,

I have created a work flow which has three steps

1) will create a system using API

2) Decision : either approve or Reject

3) If Approved then Undeploy The System

and i have written creating and undeploy system codes

in Class and methods.

now my requirement is to trigger this workflow from ABAP program .

Please help me to complete this Requirement.

Accepted Solutions (0)

Answers (2)

Answers (2)

matt
Active Contributor
data(cnt) = cl_swf_cnt_factory=>create_event_container( 
im_objcateg = 'CL' im_objtype = class im_event = event ). "START Data(evt) = cl_swf_evt_event=>get_instance( im_objcateg = 'CL' im_objtype = class im_event = event im_objkey = objkey im_event_container = cnt ). TRY. evt->raise( ). ...

Or suchlike.

vikash_pathak
Participant
0 Likes

we are not adding Workflow task name here ? and how it will be called?

Sandra_Rossi
Active Contributor
0 Likes

vikash.pathak Why triggering the task only? (you told us that this task is one step among the three of your workflow definition)

vikash_pathak
Participant
0 Likes

Then how to trigger whole workflow that all steps could trigger through ABAP Report

bpawanchand
Active Contributor

Hi ,

If you do not have any events assigned to the workflow definition then use SAP_WAPI_START_WORKFLOW function module to start worklfow from a report. Pass the Workflow ID to this function module and pass abap_true to commit work parameter of the function module. It will start the workflow.

vikash_pathak
Participant
0 Likes

Hello Pavan,

Thanks for your suggestion , but this FM doesnot have Workflow id option rather it has TASK,

this function i am not sure will fullfill my requirement or not,

as i stated i have 3 steps in workflow , every steps has export container parameter which i have to show as abap report output too.

Thanks

bpawanchand
Active Contributor

Hi Vikash,

You are correct the task id is the parameter which you are suppose to pass workflow ID for instance the sample code is below

CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'
  EXPORTING
    task            = 'WS999999XX'
    language        = sy-langu
    do_commit       = 'X'
  IMPORTING
    return_code     = lv_re_code " Sy-subrc value or success  = 0
    workitem_id     = lv_wiid " top workitem id
  TABLES
    input_container = lt_cont. " If you want to pass some values from report to Workflow container

Regarding your requirement, once you start the workflow the export and import from workflow to task container is done within workflow binding definitions.

Regards

Pavan Bhamidipati