cancel
Showing results for 
Search instead for 
Did you mean: 

How to trigger the workflow from RFC

Former Member
0 Kudos

Hi,

I need to trigger a workflow from a RFC.How can I call the event and start my workflow?

How can i do this?

please advice.

Thanks,

Anand

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

got the solution... thanks!

Former Member
0 Kudos

Hi Anand,

You need to use FM: SAP_WAPI_CREATE_EVENT.

This is RFC function module and will serve your purpose.

Search this forum for this FM or for SWE_EVENT_CREATE and you will also get sample code for how to populate the parameters and call this FM.

Regards,

Akshay

Former Member
0 Kudos

Hi Anand,

you can trigger the workflow even using the FM SWF_CREATE_EVENT.

This is part of the code taht i had used from an RFC to trigger the workflow

  • Object Key

l_v_objkey = paymentrequest_id.

  • Trigger the work flow by giving the key as the PR number and

  • the event ProcessPaymentRequest

CALL FUNCTION 'SWF_CREATE_EVENT'

EXPORTING

object_type = c_objtype

object_key = l_v_objkey

event = c_event1

xml_container = l_xml_container

xml_size = l_xml_size

commit_work = 'X'

user = sy-uname

IMPORTING

return_code = l_v_return.

IF l_v_return NE 0.

wa_return-type = c_error.

wa_return-message = 'Work flow triggering Failed'(e27).

APPEND wa_return TO i_return.

CLEAR wa_return.

ENDIF.

Former Member
0 Kudos

Hello Anand,

Goto swetypv transaction.Mention the abap class/bor object with the corresponding event.

In the receiver type, just mention some unique name.In the receiver function module mention the async RFC.

Mention the SENDER TYPE SIBFLPORB Local Persistent Object Reference - BOR Compatible

EVENT TYPE SIBFEVENT Event

RECTYPE TYPE SWFERECTYP Name of Receiver Type

HANDLER TYPE SIBFLPORB Local Persistent Object Reference - BOR Compatible

EXCEPTIONS_ALLOWED TYPE SWEFLAGS-EXC_OK SPACE Checkbox

XML_SIZE TYPE SWF_XMLSIZ Size in Bytes

EVENT_CONTAINER TYPE SWF_XMLCNT Container as XML Stream of Fixed Width

So that the guid can be used inorder to identify the instance.

you can use : "sap_wapi_start_workflow" fn module.

Hope this helps.

Best Regards,

Saujanya

Former Member
0 Kudos

Hi saujanya,

This is correct but how we can activate the event inside the RFC that will trigger the workflow finally.

the fm "sap_wapi_start_workflow" has no field in its import parameter which take the event as an input parameter.I want the RFC function module trigger the workflow through the event.Is there any function module which will take the event as an import parameter and return the workitem id.

also Can u please tell me the config. u mention is an standard one or requirement dependent??

waiting for ur positive response.

Thanks

Anand

Former Member
0 Kudos

Hello Anand,

This is a standard one.

coz if u want to trigger a workflow apart from the usual way.Then u can trigger the event of the bor object using the rfc and then inturn call the "sap_wapi...".

But if you want to trigger dependent on the event, then use the standard way.configure it in swetypv , the bor/abap class with the workflow . coz there 's no standard wapi which will trigger the workflow dependent on the event as far i know.

Hope this helps.

Best Regards,

Saujanya.