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

check if program is executed in background

Former Member
0 Likes
4,974

Hi all,

i have to perform certain selection option checks if the program is <b>executed in foreground only</b>..

For this i am checking SY-BATCH within start-of-selection and then perform the selection option checks .. If selection option checks are not satisfied i display error message...now this error message is not displayed at the selection screen since i have written the code within START-OF-SELECTION...

I need to display this error message at the selection screen..

If i write the code within AT-SELECTION-SCREEN i am unable to check whether the program is executed in background or foreground since SY-BATCH is not filled.

Thanks,

Swathi.

1 ACCEPTED SOLUTION
Read only

Former Member
2,157

Hi,

AT SELECTION-SCREEN.

CASE sy-ucomm.

WHEN 'ONLI'.

      • foreground processing

WHEN 'SJOB'.

      • background processing

ENDCASE.

I hope that it will work.

Svetlin

Message was edited by: Svetlin Rusev

10 REPLIES 10
Read only

Former Member
0 Likes
2,157

Hi Swathi,

Just have your checks in the ST SELECTION-SCREEN event. If the program is executed in foreground these checks will be performed. If it is executed in the background, the code within the AT SELECTION-SCREEN is not going to be executed anyways.

And you do not have to check for the SY-BATCH value at any point.

Does that clear the problem ?

Regards,

Anand Mandalika.

Read only

0 Likes
2,157

Hi Anand,

The checks in the SELECTION-SCREEN ST are performed irrespective of the program been executed in foreground or background.

Thanks,

Swathi.

Read only

0 Likes
2,157

Hi,

If the issue is to displaying the error message in selection screen, you can use leave list-processing the moment you give the error message after the validation in Start-of-selection event.

Hope this helps,

Rgds,

Read only

0 Likes
2,157

Hi,

The execution of program stops after the display of error message...So the command LEAVE LIST-PROCESSING is not executed.

if i use the command LEAVE LIST-PROCESSING before the message then how do i display the error message????

Thanks,

Swathi

Read only

0 Likes
2,157

Hi,

Please change the message type to 'S', this should help.

Rgds,

Read only

0 Likes
2,157

Hi,

user wants the message to be an error message...

thanks,

Swathi

Read only

0 Likes
2,157

As far as I understood this a normal report executed in foreground via 'Execute' button (F8). If I am right you can check the foreground processing through the triggered function code, instead of sy-batch, which for 'F8' is 'ONLI' ( sy-ucomm field ).

Read only

0 Likes
2,157

Hi,

As far as I know, then there is no other option than validating in at selection-screen on field event.

Rgds,

Read only

Former Member
2,158

Hi,

AT SELECTION-SCREEN.

CASE sy-ucomm.

WHEN 'ONLI'.

      • foreground processing

WHEN 'SJOB'.

      • background processing

ENDCASE.

I hope that it will work.

Svetlin

Message was edited by: Svetlin Rusev

Read only

Former Member
0 Likes
2,156

try this

In start-of-selection.

If <your condition>.

message s398(00) with text-001.

stop.

endif.