‎2006 Aug 07 5:25 PM
Dear all,
I have the following question.
The abap program should check queue, the database and //do something, after the defined time intervals. For example two times daily.
I would do it with a thread (demon) in Java. That will sleep and wake when it is necessary to perform some operations.
Is there any possibility to write a program in ABAP for SAP, that will do the same?
To sleep, wake up - check something, send something and to sleep again.
Thanks in advance.
‎2006 Aug 07 10:52 PM
You can define a job based on an event in the start condition in SM36.
Use transaction SM62 to define a user event.
Trigger the event using function module BP_EVENT_RAISE from another abap program
or
you can trigger the event from operation system using sap provided executable program SAPEVT in unix dir UNIX: /usr/sap/<R/3 System ID>/SYS/exe/run.
Add SAPEVT to cron daemon.
Refer to the following link to use events in the background processing
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/fa/096e2a543b11d1898e0000e8322d00/frameset.htm">Using Events to Trigger Job Starts</a>
Regards
Sridhar
‎2006 Aug 07 5:50 PM
You can schedule a program in SAP which will run at a specified time. You have options like scheduling it everyday, once a week, etc.
The report output will be generated as a spool which can be checked.
Have a look a transaction SM36. The first button, 'Start condition', 'Steps' etc should give you an idea.
You can check on the status of your job in SM37.
Hope this helps.
Sudha
‎2006 Aug 07 7:31 PM
Hello Sudha, thanks for your help.
Is there a possibility to start an abap-program from the other one and from this program to execute some functions for example twice a day and then to stop execution if something happens.
It seems to me, that with this SM36 transaction we have to do all manually. And we can't start and stop it if something happens.
‎2006 Aug 07 7:39 PM
Hi,
We can do dynamic job scheduling from a ABAP program as well. You will have call the function modules JOB_OPEN / JOB_SUBMIT / JOB_CLOSE to do the same and you have a background job on the run.
However, you would still need the base program to be scheduled twice a day and then internally it will kick off the other program depending on your condition.
Regards,
Ravi
Note :Please mark all the helpful answers
‎2006 Aug 07 9:36 PM
Hello Ravikumar,
thanks for your help.
do you have any code sample (Report - Programm), how to do this dynamic job from an ABAP program. I am interested in an update twice a day.
>However, you would still need the base program to be >scheduled twice a day and then internally it will kick >off the other program depending on your condition.
You meant I need a program that will set a job twice a day? Why do I need a base program, if I can set a job dynamically and this program will execute all what I want and set next job in 12 hours?
Thanks in advance.
‎2006 Aug 07 9:59 PM
Here is a example of JOB_SUBMIT
http://help.sap.com/saphelp_nw04/helpdata/en/fa/096d4d543b11d1898e0000e8322d00/frameset.htm
You just need to call the JOB_OPEN, get the job number and pass that to JOB_SUBMIT.
At the end you call JOB_CLOSE.
If you already have a program that is going to schedule the jobs, then you don't need a base program.
Regards,
Ravi
Note :Please mark all the helpful answers and close the thread if your issue is resolved.
‎2006 Aug 07 10:16 PM
Thanks for the fast answer.
The last question.
I looked at the sample, so I JOB_OPEN, get the job number etc. But where should I put the code, that will be executed by this job (my program ZWPROG_TEST1)?
I have an ABAP-Program (ZWPROG_JOBS_FOR_TEST1) and make the following calls:
CALL FUNCTION 'JOB_OPEN'
...
CALL FUNCTION 'JOB_SUBMIT'
...
CALL FUNCTION 'JOB_CLOSE'
Where should I define the time and set the ZWPROG_TEST1 that will be executed?
‎2006 Aug 07 10:52 PM
You can define a job based on an event in the start condition in SM36.
Use transaction SM62 to define a user event.
Trigger the event using function module BP_EVENT_RAISE from another abap program
or
you can trigger the event from operation system using sap provided executable program SAPEVT in unix dir UNIX: /usr/sap/<R/3 System ID>/SYS/exe/run.
Add SAPEVT to cron daemon.
Refer to the following link to use events in the background processing
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/fa/096e2a543b11d1898e0000e8322d00/frameset.htm">Using Events to Trigger Job Starts</a>
Regards
Sridhar