Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to create an EVENT when defining a JOB

Former Member
0 Kudos

Hi,

I would like to run an abap program in background after a process order has been saved (transactions COR1-COR2).

In the save exit (EXIT_SAPLCOZV_001) of the process order, I create the job that will run the abap program. after the process order is saved

I created an event with SM62 but I do not know how to set it up.

Or may be there is another solution.

Thanks for your help.

7 REPLIES 7

Vinod_Chandran
Active Contributor
0 Kudos

You can use the function module BP_EVENT_RAISE to raise the event. This can be called inside your user exit.

First create an event in SM62.

Now go to SM36 and create the job and give the ABAP program name you want to execute. Under START DATE select option AFTER EVENT. Then enter your SAP event name. After entering other information save the job.

Please see this site for more info.

http://www.sapfans.com/sapfans/sapfaq/robert.htm

Events are mainly used to trigger from outside SAP.

Thanks

Vinod

Message was edited by: Vinod C

Former Member
0 Kudos

Hello Mrs Tobal,

hoping that I didn't misunderstood your problem:

In the save-exit you release the event you created using the most common standard function SWE_EVENT_CREATE.

The ABAP-programm you want to start when this event has been sent is embedded in a background job the starting option of which is the event.

regards

Andreas Flügel

0 Kudos

Hi,

If I understand well the FM SWE_EVENT_CREATE creates an event like transaction SM62.

I assume that in my user exit: 1)I create the event, 2)raise the event (BP_RAISE_EVENT) and create the background job.

But I do not want that my job starts before the save process has been completed.

Thanks.

0 Kudos

I think you have to control this in your ABAP program. This is because even if the transaction is finished the commit work may take some time to update database. So better to have a some delay in your program.

Former Member
0 Kudos

Hi,

When we use a function module to raise an event (Ex. SWE_EVENT_CREATE) we have to give a COMMIT WORK statement after the fm call. SAP will take care to raise the EVENT only after the LUW is finished.

So in your case also you can use a commit work after the FM Call and try using it.

Hope this will help you.

Rgds,

Anji

0 Kudos

Thanks everybody,

I will try and let you know.

0 Kudos

Nadine,

Please follow Vinod's first reply. SWE_EVENT_CREATE is only useful in a worklfow context. Also if you are implementing a user exit, you should not ever issue your own commiit as this can cause db inconsistency.

In order for the DB update to be complete, create your own FM Z_BP_EVENT_RAISE that calls the BP_EVENT_RAISE as a V2 update module and call it from the user exit.

One more thing to add to Vinod's reply, I think your job should be defined as a repeating job.

Cheers,

Ramki Maley.