trigger email send immediately without SOST

If you have read send email with attachment from an ABAP program post you will see how to send a mail with an attachment. Using SAP mail server and Business Communication Service namely CL_BCS we can send mails from SAP. These sent mails drop into a pool and wait to be executed by a background program. You can monitor all mails and communication related requests in SOST . The background job that executes waiting request according to period configuration by basis team. Duration period can be 15 minutes or 1 hour or any custom number according to your companys need.

stop background job if there is an already running job with the same name

SAP does not provide a functionality to prevent dublicate background job scheduling. Therefore if you schedule a background job more frequent than the run time of background job, there will be surely dublicate jobs running parallely. In order to prevent this i have written a check routine inside of my ABAP program that stops the program when there is an already running job with the same name.

debugging active and finished background jobs

As you know SM37 shows status, logs and many information about background jobs. What about run time information of already executed background job or an active job? For example which select-options or parameters are selected in background selection screen with which values. Of course the easiest way is to debug the related program somehow. Here we can separate the case to two conditions. First one is active jobs and the second one is finished jobs.

submit background job with date selection

As mentioned in earlier submit report versions post you can make use of SUBMIT statement from your ABAP program in order to schedule any other ABAP program in background. However recently i have met a situation where user wants to decide the date and frequency of this background program. Therefore you may want to populate some fields in JOB_CLOSE of scheduling background job using an interface. BP_START_DATE_EDITOR provides this interface by collecting required information from the user.

read SM37 logs of background jobs

Recently i had a requirement to trigger a background job from my custom program. Background job had a standard SAP report as step and report was processing a business logic. After this business process has been completed after execution of background job, system creates an application log in SM37. I needed to read this log , because some times background job was failing because of a business problem like lock situations. I have used BP_JOBLOG_READ to achieve this requirement. You can adapt below code according to your requirement.