SY-BATCH is the variable to check if your program is running in the background or not. If it carries the value ‘X’, this means that the program is running in the background.
SY-BINPT is the variable to check if your program is being processed in a batch input session or not. If it carries the value ‘X’, this means that you have a case of a batch input.
Having SY-BINPT = ‘X’ doesn’t necesserily mean that SY-BATCH will also equal ‘X’. It’s a good idea to be careful about this distinction and check both if you want a code snippet to be processed only if the program is executed in the foreground. Sample code:
check sy-batch is initial and
sy-binpt is initial.
First line makes sure that the program is not being executed in the background. Second line makes sure that the program is not being processed in a batch input session.
Leave a Reply