cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a workflow from a program

Former Member
0 Kudos

Hello All,

I am calling a workflow using FM 'SAP_WAPI_START_WORKFLOW' from se38 abap program.

My workflow consists of simple user decision to approve and reject.

From my t.code SWDD if I execute the workflow, it will take me to test workflow screen and there again I have to execute once more to see the mail with approve and reject button in my inbox of bussiness workplace.

But when I call the worflow using the above FM it does not work.

CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'

EXPORTING

task = 'WS99000093'

language = sy-langu

IMPORTING

return_code = p_subrc

workitem_id = p_workitem.

It doesn't get triggerred I guess. Is there something to do with the double execution as above which takes place when we do it manually ( one normal execution of workflow and another test workflow).

Help Appreciated.

Regards,

Mac

Accepted Solutions (1)

Accepted Solutions (1)

former_member185167
Active Contributor
0 Kudos

Hello,

Have you set WS99000093 to General Task? Do a search if you don't know how to do this.

By the way, the recommended approach is to not start workflows directly, if it can be avoided.

Use SAP_WAPI_CREATE_EVENT instead to create an event which triggers the workflow.

regards

Rick Bakker

Hanabi Technology

Answers (3)

Answers (3)

Former Member
0 Kudos

solved myself

former_member185167
Active Contributor
0 Kudos

Solved how?

Former Member
0 Kudos

I think you can just debug and check what message is being thrown from the Function Module.

Just run the Function module from SE37 itself and check what message is thrown.

Thanks

Arghadip

Former Member
0 Kudos

Hi,

Just put a breakpoint to the code and check what error message the SAP_WAPI_START_WORKFLOW returns. Probably you can solve the problem then by yourself, and if not, post the error message here.

Some probable reasons:

-WS99000093 has not been set as "general task" (check this in PFTC in "Agent assignment").

-something wrong in the agent determination?

Regards,

Karri