07-26-2012 10:15 AM
Hello,
Requirement: Schedule a job only when file exist on specified path. If file does not exist on particular day then job should not trigger. and as soon as File exist it should trigger a job.
I read few blogs on EVENT but not sure how to use those events.
Anybody worked on this kind of requirement?
Appreciate your help. Thank you.
Regards,
Saurabh
07-26-2012 10:41 AM
Hi Saurabh,
Does the process of creating a file in the application server trigger an event? Is the file created from a program or is it a manual upload?
If its programmatic, then you can write code to raise an event as soon as the file is downloaded in the server.
You can use CALL METHOD cl_batch_event=>raise or BP_EVENT_RAISE to raise the event.
http://help.sap.com/saphelp_nw70/helpdata/en/fa/096e5e543b11d1898e0000e8322d00/content.htm
You can see an example in SAPTechnical->Tutorials->ABAP->Scheduling a background job by triggering an event
Also, You can create the concept of Daemon process to handle this.
Create a job which will be active all the time or for a specific time of a day.
For eg: I will create a background job which checks the whether the file is present in the application server or not.
Say your Job should run at 10 AM, this daemon job which check the application server for the file and schedule a job using SUBMIT or JOB_OPEN. If the file is not available it will check the server every 0 minutes or so and when it finds the file it schedules the job.
Thanks,
Shambu
07-26-2012 10:41 AM
Hi Saurabh,
Does the process of creating a file in the application server trigger an event? Is the file created from a program or is it a manual upload?
If its programmatic, then you can write code to raise an event as soon as the file is downloaded in the server.
You can use CALL METHOD cl_batch_event=>raise or BP_EVENT_RAISE to raise the event.
http://help.sap.com/saphelp_nw70/helpdata/en/fa/096e5e543b11d1898e0000e8322d00/content.htm
You can see an example in SAPTechnical->Tutorials->ABAP->Scheduling a background job by triggering an event
Also, You can create the concept of Daemon process to handle this.
Create a job which will be active all the time or for a specific time of a day.
For eg: I will create a background job which checks the whether the file is present in the application server or not.
Say your Job should run at 10 AM, this daemon job which check the application server for the file and schedule a job using SUBMIT or JOB_OPEN. If the file is not available it will check the server every 0 minutes or so and when it finds the file it schedules the job.
Thanks,
Shambu