Application Development 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: 

Foreground and Background

0 Kudos

In my application a program can executed either in foreground or in background. when the program is executed in

the foreground , I dont want to execute certain portion of the code. Similaly, when the job is executed as a background job,

I dont want to execute certain portion of the code. Is it possible? If yes, please share the details.

Thank you in advance.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Raja,

You could do as per your requirement.

There is a system table field known as sy-batch. this field is initial if the program is getting executed in foreground. if sy-batch is not initial then, it means that the program is getting executed in background.

so use a simple if condition.

if sy-batch is initial.

<portion of code to be run in foreground>.

else.

<portion of code to be executed in background>.

endif.

Reward points if this helps,

Kiran

7 REPLIES 7

JozsefSzikszai
Active Contributor
0 Kudos

hi Raja,

you can check sy-batch during runtime. If it is 'X' it means the program wuns in background.

hope this helps

ec

Former Member
0 Kudos

IF syst-batch = 'X'.

.....

ENDIF.

Regards,

John

Former Member
0 Kudos

Hi,

Check the portion with the system variable "sy-batch" .

This variable is 'X' when executing in background.

Jayant Sahu

Former Member
0 Kudos

Hi,

Possible. When a program is run in the background the system variable SY-BATCH is set to 'X'.

Hence by checking this variable you can segregate the code.

Regards,

Aditya

Former Member
0 Kudos

Hi Raja,

You could do as per your requirement.

There is a system table field known as sy-batch. this field is initial if the program is getting executed in foreground. if sy-batch is not initial then, it means that the program is getting executed in background.

so use a simple if condition.

if sy-batch is initial.

<portion of code to be run in foreground>.

else.

<portion of code to be executed in background>.

endif.

Reward points if this helps,

Kiran

Former Member
0 Kudos

Hi,

Check the below code...

IF sy-batch = 'X'.

Do back ground processing.

ELSE.

Do foreground processing.

ENDIF.

Rgds,

Bujji

Former Member
0 Kudos

also Func modules for uploading/downloading to/from appli server dosent work in background...........