Skip to Content
avatar image
Former Member

Trigger WF Programatically

Hi All,

Could any one out there please tell me if there is a way to start/trigger the WF programmatically. My WF is triggering well through the triggering events but i want to trigger the WF in the user exit. I am not sure how to do this. Please advice.

Thanks,

Karuna\.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Apr 16, 2007 at 01:44 PM

    You have to raise an event from inside the user exit.

    To do this use FM SWE_EVENT_CREATE

    You can also generate a change document and attach the event from there.

    pls. reward if helpful

    Roberto

    here a code sample:

    INCLUDE <CNTAIN>. " Definizione MACRO

    DATA: KEY LIKE SWEINSTCOU-OBJKEY.

    Key(18) = rmmg1-matnr.

    key+18(4) = marc-werks.

    key+22(2) = stato.

    SWC_CONTAINER T_SWCONT.

    SWC_SET_ELEMENT T_SWCONT 'Codice' rmmg1-matnr.

    SWC_SET_ELEMENT T_SWCONT 'Plant' marc-werks.

    SWC_SET_ELEMENT T_SWCONT 'Stato' stato.

    CALL FUNCTION 'SWE_EVENT_CREATE'

    EXPORTING

    OBJTYPE = 'businessobject'

    OBJKEY = KEY

    EVENT = 'eventname'

    TABLES

    EVENT_CONTAINER = T_SWCONT

    EXCEPTIONS

    OBJTYPE_NOT_FOUND = 1

    OTHERS = 2.

    endif.

    commit work.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Roberto,

      Thank you very much for the quick response. I will try the code and get back.

      Thanks again,

      Karuna.

  • avatar image
    Former Member
    Apr 16, 2007 at 06:37 PM

    There's a user exit which is called after the material document is posted, but just before the 'commit work' takes place. I think it's 'EXIT_SAPLMBMB_001.

    Raise your workflow event programmatically there using 'SWE_EVENT_CREATE_FOR_UPD_TASK' in update task. You'll have the material document number/year in the MKPF structure by then, so you should be well equipped for any subsequent workflow.

    Reward points if it helps

    regards

    Biju

    Add comment
    10|10000 characters needed characters exceeded