Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

System Variable to identify background job

Former Member
0 Likes
12,289

Hi,

I have a requirement where i need to display classical report with interaction when i run the report in froeground. But i need to display the report in ALV Block List when the user runs the same report in background.I want to put a IF condition for my subroutines so that i can meet my requirement.

Kindly suggest what is the system variable i need to use (may be SY-BATCH i suppose,but not sure)

and what value i need to pass in the system variable .

In short what i want is , if there is any system variable to indicate that my job is running in foreground

or background. If so what value i need to pass so that i can put a check on it.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
4,706

There are two way to do that.. you can use sy-ucomm = 'SJOB' (function code for F9 button) and sy-batch = 'X' (jbs run on back ground)..

9 REPLIES 9
Read only

Former Member
0 Likes
4,706

Hi Murali,

You are correct, do not hesitate use SY-BATCH.

if it doesn't serve your purpose we will think other options, be aggressive while implementing your ideas/

Best Regards

Ramchander Rao.K

Read only

0 Likes
4,706

hi ramachander,

thanks for ur reply butv what value i need to pass in sy-batch.

Read only

0 Likes
4,706

Hi Murali,

It takes only two values either 'X' (true) or ' ' ( false)

Best Regards

Ramchander Rao.K

Read only

0 Likes
4,706

By changing the Value of Sy-batch = 'X' we cannot set The execution in Background.

But If the Execution is set to Background the value of Sy-batch = 'X' ,in forground Sy-batch = ' ' .

in short We can only check the values of Sy-batch with either X or Blank.

Read only

Former Member
0 Likes
4,706

Use SY-BATCH EQ 'X'.--- For if program is running in the background.

Read only

Former Member
0 Likes
4,706

Hi,

U can use SY-BATCH check.

If sy-batch = 'X' this means the program is runnign in the background.

sy-batch NE 'X' runs in foreground.

Hope this helps.

Regards,

Judith

Read only

Former Member
0 Likes
4,707

There are two way to do that.. you can use sy-ucomm = 'SJOB' (function code for F9 button) and sy-batch = 'X' (jbs run on back ground)..

Read only

Former Member
0 Likes
4,706

Thaks to all

Read only

KN-Nampoothiry
Active Participant
0 Likes
4,706

Hi Murali,

As told above, SY-BATCH is a deciding parameter and u cannot use it to make a Job run in Background. This proves useful when a report which is also run in foreground is used for a background job as well and in those cases you need some other input screen suitable for variants etc.

To schedule u knw its SM36.

Thanks,

Narayanan K N