‎2009 Nov 15 8:13 AM
How to trigger a job in background ,while new contracts are created. I have created a program to sent contract details by email. I want to trigger the program after any new contract is created in the system.Is it possible to create an event in sm62 for this purpose?
‎2009 Nov 15 9:22 AM
Hi
The transaction SM62 is used to create a user event, i.e the evet user creates and trigers himself. If this is the case, u can try this. Or else try to schdule it in SM 36.
Regards
Gaurav
‎2009 Nov 15 12:04 PM
i will be scheduling in SM36 only.But i want the start condition as after creation of a new contract. how can i specify the 'After event' start condition for this
‎2009 Nov 15 12:29 PM
Hi Misha,
there are two ways to create an event driven job.
1. In the program where you are generating success message, after that call function module BP_RAISE_EVENT.
you can get more detail on this function module by going to the below link :
http://help.sap.com/saphelp_sm32/helpdata/EN/fa/096e5e543b11d1898e0000e8322d00/content.htm
eg: you can Create a Event in the SM62
but you need to raise this event in a program using the function BP_RAISE_EVENT
The following example may help:
eventid = 'ZSUCCESS.(name of the event)
eventparm = 'SUCCESS'.(identification of the event)
FORM RAISE_EVNT.
CALL FUNCTION 'BP_EVENT_RAISE'
EXPORTING
EVENTID = EVENTID
EVENTPARM = EVENTPARM
TARGET_INSTANCE = ' '
EXCEPTIONS
BAD_EVENTID = 1.
ENDFORM. " RAISE_EVNT
Once an event is created, you can schedule
background jobs to wait for the event to be triggered.
1. Now you can directly go to sm36 ans there after creation of jobs you can specify the condition over there.
May be the above solution will be helpful to you.
Sourabh Batwara
‎2009 Nov 16 5:26 AM
thx for your reply Sourabh,
But my doubt is how will i recognize ,one new contract is created or not?
‎2009 Nov 16 5:34 AM
Hi,
When you create the user contact ther should be table which will be updated. Check if the table is updated with a new contact then call the FM to raise the event.
Regards,
Aditya
‎2009 Nov 16 6:08 AM
thx for your reply Sourabh,
But my doubt is how will i recognize ,one new contract is created or not?
‎2009 Nov 16 6:08 AM
thx for your reply Sourabh,
But my doubt is how will i recognize ,one new contract is created or not?
‎2009 Nov 16 2:43 PM
hi Mishi,
you must be passing some success message after creation of a contract and if not then do some debugging and find out the place where your program is creating the contract. there you can use the piece of code written in my last post.
Regards,
Sourabh Batwara