Skip to content

Trigger Process Chain with Macro

April 11, 2014

Somebody asked me how to do this the other day, and so I thought this would make a good post…

If you run into a situation where you need to start a process chain by clicking on a button in the data view, well – this is how I would do it:
NOTE: You can click on any image to enlarge it!

    1. Create an event in SM64 (example: ‘START_MIX’)
    2. Create a report that raises an event in SE38
    3. This is the code, that raises an event: (the event name is hard coded in RED)

Process_Chain1

REPORT Z_TRIGGER_EVENT_FCST_ZSW_1000.

 

 

DATA:

p_eventid   TYPE btceventid,

p_eventparm TYPE btcevtparm,

p_server   TYPE btcserver.

 

p_eventid   = ‘START_MIX‘.

 

 

CALL METHOD cl_batch_event=>raise

EXPORTING

i_eventparm           = p_eventparm

i_server             = p_server

i_eventid             = p_eventid

EXCEPTIONS

excpt_raise_failed   = 1

excpt_raise_forbidden = 3

excpt_unknown_event   = 4

excpt_no_authority   = 5

OTHERS               = 6.

CASE sy-subrc.

WHEN 0.

 

 

4. Create your process chain and in the start routine, specify your event and set it to “periodic” so that you will not need to keep scheduling it.

Process_Chain2

Process_Chain3

Process_Chain4

5. Lastly: Create a macro like this, which will not work if the data is not in display mode (and so the user gets an error if it is not in display mode), and that calls your report:

Process_Chain5

If you have a better idea, please comment.
Thanks.

 

From → APO Macros

Leave a Comment

Leave a comment