cancel
Showing results for 
Search instead for 
Did you mean: 

Batch-Job SY-BATCH

balu99
Explorer
0 Kudos

Hi Friends,
I have Question ,

1) I had created a report and set batch job for that , batch-job run daily at 08:40 am. When i execute the report, in the output it should show that which batch-job had run i.e Foreground/Background.

I had written a logic , but it was showing Foreground when report was executed.
IF SY-BATCH = 'X'.
WRITE: 'BACKGROUND'.
ELSE.
WRITE: 'FOREGROUND'.
ENDIF.

2) While Batch-job is running , Does my system need to should active at that time ?

AlexGourdet
Product and Topic Expert
Product and Topic Expert
0 Kudos

Thank you for visiting SAP Community to get answers to your questions.

As you're looking to get most out of your community membership, please consider include a profile picture to increase user engagement & additional resources to your reference that can really benefit you:

I hope you find this advice useful, and we're happy to have you as part of SAP Community!

All the best,

Alex

touzik_itc
Active Participant

Some code can be executed in a dialog process instead of batch process, if it is scheduled as a job. SY-BATCH is set in a batch process only. In particular

CALL FUNCTION func STARTING NEW TASK task DESTINATION IN GROUP

uses dialog processes.

TamasFodor
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

We helped you to accept the answer, since there were no updates after 7 days. You can unaccept it anytime if you have further questions.

Kind regards,

Tamas

Accepted Solutions (1)

Accepted Solutions (1)

Sandra_Rossi
Active Contributor

If you have created a very simple executable program (A.K.A. "report") as below, activated it, submitted it as a "background job", that you can see in SM37, then it should generate a spool request with content "BACKGROUND".

REPORT zprogram.
IF SY-BATCH = 'X'.
  WRITE: 'BACKGROUND'.
ELSE.
  WRITE: 'FOREGROUND'.
ENDIF.

If not, you are not in the exact situation described above.

Answers (0)