‎2007 Nov 07 2:57 PM
‎2007 Nov 07 3:01 PM
You would use SY-BATCH any time you want to know if the current program is running in the background. For example, say you have a function module which downloads a file to the frontend, but we know that we can't do this in background, so you could code something in the functino module which would not allow the user to do it, something like.
if sy-batch = 'X'.
raise exception cannot_call_in_background.
endif.Regards,
Rich Heilman
‎2007 Nov 07 3:05 PM
Pandu,
SY-BATCH is used to check whether the Transaction or report are executed in frontend or background as batch job.
IF SY-BATCH EQ 'X'.
"do this......
ENDIF.Chandra.
‎2007 Nov 07 3:09 PM
Hi,
another reason to use it is in ALV.
IF SY-BATCH = ' '.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
...
ELSE.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
...
Regards, Dieter
‎2007 Nov 07 3:43 PM
Hi Dieter,
this is not necessary because ALV Grid is running in batchmode. There is no need to differ like you did. Did you ever tried to run a ALV GRid report in backgrind. Its working well.
‎2007 Nov 07 3:53 PM
‎2007 Nov 07 4:22 PM
Hi Rainer,
thanks for this Info. i have test it and it works with grid in background.
We have changed to ECC6, and the Report are written under 4.6C perhaps
that's the reason why i have checked sy-batch?
Thanks again, also to rich.
Regards, Dieter
‎2007 Nov 07 4:29 PM
We started using the ALV Grid in 4.6C and investigated on that and therefore we dont have any report using the list-variant of ALV.
So it must be before 4.6c and i'm sure in the beginning you have to differ.
‎2007 Nov 07 3:12 PM
sy-batch is a system field and is an identifier whether report s run in background
sy-batch = 'X' means ---> execution in back ground.
This can be used to avoid GUI operations while running in back ground.
if sy-batch is not initial.
call function 'GUI_UPLOAD'
else
open dataset 'cxxxx'
endif.
*reward if useful*
‎2007 Nov 07 3:29 PM
some of the programs should run only background so we keep condition like'
if not sy-batch = 'X'.
error message " Please run the program only in background".
endif.
Thanks
Seshu