WORKFLOW Trigger WF from MIGO

Is there any way to trigger a WF from transaction MIGO? Trying to create a WF when MIGO is saved.

**********

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’ off the top of my head.

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.

**********

I first tested the function you suggested, but it seems doesn’t work. Maybe I misunderstood and am doing something wrong. Here it is:

SWE_EVENT_CREATE_FOR_UPD_TASK : I pass the MKPF as object type, a 50000000012003 object key, and the event assigned.

**********

The two obvious things that spring to mind are either that you’ve coded your function module exit incorrectly, or you haven’t activated the enchancement in CMOD.

Here’s some code I’ve used in past, which definitely works:

Code:

*———————————————————————-*
* INCLUDE ZXMBCU01 *
*———————————————————————-*

DATA: BEGIN OF KEY,
MBLNR LIKE MKPF-MBLNR,
MJAHR LIKE MKPF-MJAHR,
END OF KEY.

DATA: EVENT_CONTAINER LIKE SWCONT OCCURS 0.

DATA: OBJKEY LIKE SWEINSTCOU-OBJKEY.

READ TABLE XMKPF INDEX 1. “Check with MM Consultant that table will only have 1 line

MOVE: XMKPF-MBLNR TO KEY-MBLNR,
XMKPF-MJAHR TO KEY-MJAHR,
KEY TO OBJKEY.

CALL FUNCTION ‘SWE_EVENT_CREATE_FOR_UPD_TASK’ IN UPDATE TASK
EXPORTING
OBJTYPE = ‘MKPF’
OBJKEY = OBJKEY
EVENT = ‘CREATED’
* CREATOR = ‘ ‘
* TAKE_WORKITEM_REQUESTER = ‘ ‘
* START_WITH_DELAY = ‘ ‘
* START_RECFB_SYNCHRON = ‘ ‘
* DEBUG_FLAG = ‘ ‘
* IMPORTING
* EVENT_ID =
TABLES
EVENT_CONTAINER = EVENT_CONTAINER
EXCEPTIONS
OBJTYPE_NOT_FOUND = 1
OTHERS = 2.

As you can see, I created a custom event ‘created’ for a delegated subtype of MKPF, and am using that instead.

Advertisements
Categories: Workflow | Leave a comment

Post navigation

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: