Skip to Content
avatar image
Former Member

when we use the sy-batch statement

hi ,

when we use the sy-batch statement.

regards,

venkat.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • avatar image
    Former Member
    Nov 07, 2007 at 03: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*

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 07, 2007 at 03: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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 07, 2007 at 03: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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 07, 2007 at 03: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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 07, 2007 at 03: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

    Add comment
    10|10000 characters needed characters exceeded