cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger background job after an event - After receiving a file

former_member199632
Participant
0 Kudos

Hi all,

Needs to trigger a background job, after receiving a file

Scenario is like this;

Server-A will send a file that contains data.(file1.txt) , to Server-B (to location /usr/sap/trans/mydata)

Once file1.txt, receives to Server-B , needs to execute a background job.

This file (file1.txt) can come either in 1hr/2hr/30min/10seconds or anytime. Each time Server-B receives this file, it needs to execute a background job with t-code ZS01 , with that file data as variant.

Is it possible to do some thing like this, in sm36 job scheduling or with using OS commands.

looking forward for your guidance.

Server-B O/S - Linux , DB - Oracle , Netweaver 7.0

regards,

zerandib

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Yes, using standard functionality it is not possible.

Try to schedule a job with duration so that it is simple and can be managed easily.

Ex: Server A sends file anytime, just schedule a job in SAP every hour/30 minutes to read the folder and do the job. Add move/remove command as last step of the job so that it removes/moves the file from folder to another folder such that next job will look only at the new files.

Regards,

Nick Loy

Reagan
Advisor
Advisor
0 Kudos

Once file1.txt, receives to Server-B , needs to execute a background job.

This file (file1.txt) can come either in 1hr/2hr/30min/10seconds or anytime. Each time Server-B receives this file, it needs to execute a background job with t-code ZS01 , with that file data as variant.

Is it possible to do some thing like this, in sm36 job scheduling or with using OS commands.

As there is no specific time when the file will be transferred, I believe this can be achieved (possibly) with the help of a shell script which checks the existence of file1.txt in the /usr/sap/trans/mydata file system or directory and then trigger a background job and once the job finishes successfully move/rename/delete the file1.txt.

The other option I can think of is by using external or third party schedulers like IBM TWS, CA Autosys or SAP CPS Redwood. Not sure whether they have such capabilities but you can check here for CPS.

http://scn.sap.com/community/cps-by-redwood

Regards

RB

former_member188883
Active Contributor
0 Kudos

Hi Zerandib,

On Server A:

Write an ABAP code to generate the flat file as well as execute OS command ftp to push the file to

Server B.

Guidelines in the link

Working with FTP Server - ABAP Development - SCN Wiki

ServerB:

Write an ABAP program to pick the file from the location and execute desired transaction .

You may schedule this ABAP program in background post testing.

Regards,

Deepak Kori

former_member199632
Participant
0 Kudos

Thanks Deepak.

On ServerB:

What is the minimum periodic duration , that can provide in a background job?

Can we schedule a background job to execute with in 10 seconds - 10 seconds etc, likwwise

Coz, as and when the file receives to serverB, background job should be execute.

In that case, i guess regular checking is necessary

regards,

Zerandib

divyanshu_srivastava3
Active Contributor
0 Kudos

Hi,

I think the minimum duration that you can give on any OS is a minute. For eg, in case of a cron.

However, to run a job from OS using seconds you have to use a custom scanning method using OS time command to filter out second and re-run automatically using later principle. In short, the OS cron to check should run from the time system is booted to call an script to scan the location and trigger appropriate function in applications, using seconds as a logical deciding factor.

Divyanshu