‎2011 Dec 02 1:29 PM
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.
‎2011 Dec 02 1:56 PM
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.
‎2011 Dec 02 1:42 PM
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
‎2011 Dec 02 1:56 PM
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.
‎2011 Dec 02 2:03 PM
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.
‎2011 Dec 02 2:12 PM
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.
‎2011 Dec 02 3:28 PM
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
‎2011 Dec 05 2:00 PM
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.
‎2011 Dec 06 7:22 AM
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.
‎2011 Dec 06 7:30 AM
Did the background job start running after the event ZCREATE is triggered?
‎2011 Dec 06 8:00 AM
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.
‎2011 Dec 06 8:01 AM
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
‎2011 Dec 06 8:56 AM
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.
‎2011 Dec 06 12:55 PM
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
‎2011 Dec 06 1:08 PM
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.
‎2011 Dec 12 8:01 AM
Thanks for all the replies..got the solution as directed by experts..this is helpful for starters...thanks again..