Page 1 of 1

workflow call from ABAP program

Posted: Wed Mar 05, 2008 5:31 pm
by toms3501
I created a zbusiness object (ZPRODH)with
one key field product hierarchy,
one attribute level number and
one method display.

I tested that zobject and it is displaying it. now I created a workflow to display this and have to call it from one abap program.

In the abap program I am calling the funcion module, I need to pass the product hierarcy ( how can I pass it)
data: p_workitem LIKE SWR_STRUCT-WORKITEMID,
p_subrc like sy-subrc.

CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'
EXPORTING
TASK = 'WS99900007'
LANGUAGE = SY-LANGU
IMPORTING
RETURN_CODE = p_subrc
WORKITEM_ID = p_workitem
but it is not working, can anybody tell me what is the issue. this is my first workflow. so I am not sure I am missing anything for not. Please help me

Thanks in advance

Posted: Thu Mar 06, 2008 3:38 am
by bucka
Hi,

When you say not working what do you mean?
Is the workflow starting or is there errors after the Workflow fires off?

Posted: Thu Mar 06, 2008 3:45 am
by bucka
Hi,

You could also use the message Structure for debugging purposes...

TABLES
message_struct = lt_wf_error_tab.

workflow

Posted: Thu Mar 06, 2008 10:49 am
by toms3501
when I ran this report, it is going throug the workflow, and subrc coming as 0, but the workflow is not triggering it out. When I check the SBWP, it is not there

Posted: Fri Mar 14, 2008 11:59 am
by maorriyan
Have you check your workflow log?
Try to make "general task" in your workflow

Re: workflow call from ABAP program

Posted: Sun Mar 23, 2008 7:36 am
by ssii
Workflow should be started by triggering event.

so you should define an event in your Zobject et then trigger this event in your report. The workflow will start if it's linked to the event.

Re: workflow call from ABAP program

Posted: Sat Jan 31, 2009 2:20 pm
by new2sapfans
Sorry for resurrecting an old thread,
but I am in this exact situation.

I created a role to which an user was assigned (other than myself, or current sy-uname).
I want a workflow to be started by any user who executes a ABAP report, and then
the user assigned in the "role" to get a user decision in his Biz Workplace.

I created my first WF, which had nothing but a User Decision.

I tried to trigger the workflow from a ABAP report using SAP_WAPI_START_WORKFLOW, but it was giving
an error - WZ(713) You are not one of the possible agents of task '&1'

So, as per this thread I tried to create an event in my Z business object, and defined that as the Triggering event in my workflow header.
I programmatically triggered the event in my ABAP report via SAP_WAPI_CREATE_EVENT,
I get an event id back in my ABAP (and also WZ(736) Event created - at least one receiver found)
but now when I call SAP_WAPI_START_WORKFLOW, I get the same error WZ(713) You are not one of the possible agents of task '&1'


Can someone please help?

Re: workflow call from ABAP program

Posted: Tue Feb 03, 2009 10:35 pm
by new2sapfans
I got to triggering the WF using SWE_EVENT_CREATE, but now my first task (user decision) is ending in an error.
I had defined a new role using PFCG, and assigned one user to the role.
But SWI1 shows that my workflow ended in ERROR because "No Agent Available"

I even tried assigning the workflow initiator as the the Agent for my task, yet my SWI1 shows "No Agent Available" :-(

Can anyone pls help?

Re: workflow call from ABAP program

Posted: Sun Jan 10, 2010 11:50 pm
by harishkollipara
Even I tried using this the above mentioned Function module for calling a workflow through a report program.
When I give a sy-subrc after executing the FM,it is successful,but thw given workflow is not being triggered.
Please help.

Harish Kollipara