cancel
Showing results for 
Search instead for 
Did you mean: 

Function Module (ENQUEUE_ES_PROG) not working in Background

Former Member
0 Kudos

I scheduled a job which runs every 15 mins in the the background to fetch data from an external system,depending on the data volume ,the program can sometimes run for over 15 minutes.To avoid data conflict I used a function module ENQUEUE_ES_PROG on the program to first check if the job started is still running before another job gets kicked.The problem I have is the fact that this function module does not seem to work in the background but in the looks perfect in foreground. Does anyone have a clue on how to use this FM for background job?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Instead, why don't you query the table TBTCO for the jobname and status = 'R' for active job to be really sure.

This will work in foreground and background.

You are likely to have more than one background process on the app server so this will safeguard against that.

Kind regards

colin

Former Member
0 Kudos

Hi everybody,

Thanx for the positive response I received from all of you.I used Colin's Idea of quering the table TBTCO and TBTCP for jobname ,progname and jobstatus = 'R' and it works very well.

Thank you all once again.

Mochabo

Former Member
0 Kudos

Hi,

If that is the case, can you please reward me the points ? So few people actually do

Thanks

Colin.

Answers (3)

Answers (3)

ramki_maley
Active Contributor
0 Kudos

If you have any implicit or explicit COMMITs in your program, all locks will be released. HTH

Ramki.

nablan_umar
Active Contributor
0 Kudos

Hi Mochabo,

What do you mean that it does not work in background. What error did you get. What are the parameters you pass to this function module.

This function looks the same as all other enqueue functions. Enqueue works in background.

Former Member
0 Kudos

Hello Mochabo,

Consider the following scenario:

Your job is running for more than 15 minutes. Since it is running in the background, it will be executed by a work-process of type BACKGROUND. If there's only one BACKGROUND work process configured for your application server, then the second job will have to be waiting till the first one finishes and releases the background work process.

But when you are executing this in the foreground, the DIALOG work-process does the processing. So you are not finding any problem.

So, to my knowledge, there will be a problem when there's only one BACKGROUND work process. Please go to transaction SM50 and see how many of them are configured for the current application server.

Also, in case there's only one BACKGROUND work-process, you will not have toworry that the second job will start before the first has finished. It simply can't. It has got to wait.

Hope this explanation helps.

Regards,

Anand Mandalika.