Application Development and Automation 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: 
Read only

Triggering an EVENT

Former Member
0 Likes
3,333

Dear Experts,

I need to trigger an event when the following event occurs.

In a table there are 2 fields,when ever those two fields are filled a program should start automatically trigger.Can any one please let me know the step by step approach.

Thanks in advance,

Kartheek.

1 ACCEPTED SOLUTION
Read only

antony_paul2
Active Participant
0 Likes
3,252

What I suggest is to create a event using SM62. This event should be raised by the program which inserts data to the mentioned table using the FM BP_EVENT_RAISE.

And the program which contains the logic of further processing should be scheduled in SM37 so that it listens to the created event.

14 REPLIES 14
Read only

Former Member
0 Likes
3,252

Hi,

Could you please share some more details.

Is it a custom table ? if yes create a maintenance generator.

if it is standard...check if you have any table maintenance generator available.

Try to use those table maintenance events.

-Keerthi

Read only

antony_paul2
Active Participant
0 Likes
3,253

What I suggest is to create a event using SM62. This event should be raised by the program which inserts data to the mentioned table using the FM BP_EVENT_RAISE.

And the program which contains the logic of further processing should be scheduled in SM37 so that it listens to the created event.

Read only

0 Likes
3,252

Thanks all for the reply,lemme make it more clear.

I have a custom table which has 2 fields and its filled by some another program, basically the 2 fields are check boxes. so whenver these 2 fields are filled i need to run a program automatically.

So how to acheive this,hope i m clear enough or let me know.

Thanks in advance,

Kartheek.

Read only

0 Likes
3,252

You can use the below steps.

1. Create a Custom Event using transaction SM62.

2. In the first program which saves the data to the custom table. Call Function Module BP_EVENT_RAISE to raise the event created in step 1, after INSERT statement & COMMIT WORK.

3. Then the 2nd progam which you will be creating/created to do further processing should be scheduled in SM37. Here you can assign the event created in Step 1 as the starting event for the program while scheduing.

Read only

0 Likes
3,252

For further clarification, the actual change in the database does not trigger an event that you could link the execution of an ABAP program to (to my best knowledge, not sure about Workflow possibilities, if any). That's why you have to tackle this in a different way, e.g. as explained by Antony.

Thomas

Read only

0 Likes
3,252

Hi kartheek,

You can do this in both ways with or without the use of work flows, But If the table is a custom table.

Create the table maintainace generator menu, enviornment->Modification->Events , create a form routine and set condition like when the logic of form routine wil be executed(before data save or after new data saved) , there submit your program in the routine logic.

So as soon as table contents changes->Your form routine starts executing->Your program will be executed.

In other way , create a work flow having a step with your code logic, bind it to an event of your custom class/BOR and trigger the event from the sam eform routine code. But this is bit complex than the previsous solution.

Thanks.

Read only

0 Likes
3,252

Dear All,

Thanks a lot for all ur replies.

Dear Antony,

Thanks for ur solution.Lemme tell you wat i have done.

I have created a event in t.code SM64,which i have used in the function module

CALL FUNCTION 'BP_EVENT_RAISE'

EXPORTING

eventid = 'ZCREATE'

EXCEPTIONS

bad_eventid = 1

eventid_does_not_exist = 2

eventid_missing = 3

raise_failed = 4

OTHERS = 5.

COMMIT WORK.

In the t.code sm36 i have defined a background job with after event selection,so whenever the event is raised the job will run and the required reporting should continue.

But here i m facing a small problem, even is getting raised perfectly but i m facing problem with back ground job as it is not running properly.

can any body help.

Regards,

Kartheek.

Read only

0 Likes
3,252

Did the background job start running after the event ZCREATE is triggered?

Read only

0 Likes
3,252

Just a small update, after event has been raised the background job started running.

But a small problem i m facing,everytime i need to schedule the job with the start condition as "AFTER EVENT"...cant this be scheduled pemanently.

Regards,

Kartheek.

Read only

Former Member
0 Likes
3,252

Please follow the below steps (WorkFlow):

<copy/pasted text removed by moderator>

Let me know if you still face any issues.

Regards

Rajesh

Moderator message: never copy/paste without credit!

Edited by: Thomas Zloch on Dec 6, 2011 1:56 PM

Read only

0 Likes
3,252

Thanks rajesh,but i was doing it programmatically and its almost done according to me but got stuck up in creating background job with start condition as "After event" permanently.

could any 1 help.

Regards,

Kartheek.

Read only

0 Likes
3,252

If you check the "periodic" option when scheduling a job, it will reschedule itself everytime it starts running, thus listening to the same event again. Is that what you want?

Thomas

Read only

0 Likes
3,252

For the scheduling part you can follow what Thomas has rightly suggested.

Regarding the code you have provide I would suggest to call the COMMIT WORK first & then raise the event using the FM.

Read only

Former Member
0 Likes
3,252

Thanks for all the replies..got the solution as directed by experts..this is helpful for starters...thanks again..