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

Background scheduling a report

Former Member
0 Likes
647

2) Suppose i have aprogram i whould make the program to run only in background if any ones wants to execute it it should not run in foreground insted give erormessage , its not about raising a message but howto make a report to run only in background ??...............................................is there any system variable to do so

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
622

hi,

SY-BATCH is the system variable, using this we knows the program executing in background or not.

IF SY-BATCH = 'X' means program executing in background.

sample program.

tables: kna1.

parameters: p_kunnr like kna1-kunne.

data: begin of itab occurs 0,

kunnr like kna1-kunnr,

name1 like kna1-name1,

end of itab.

start-of-selection.

select kunnr name1 from kna1 into table itab

where kunnr = p_kunnr.

IF SY-BATCH = 'X'.

LOOP AT ITAB.

WRITE:/ ITAB-KUNNR,

ITAB-NAME1.

ENDLOOP.

ELSE.

MESSAGE A000 with 'execute in background only'.

**OR

LEAVE LIST-PROCESSING.

ENDIF.

regards,

Asgokreddy.

Message was edited by:

Ashok Reddy

2) Suppose i have aprogram i whould make the program to run only in background if any ones wants to execute it it should not run in foreground insted give erormessage , its not about raising a message but howto make a report to run only in background ??...............................................is there any system variable to do so

4 REPLIES 4
Read only

Former Member
0 Likes
622

check for sy-batch in the report. if it = 'X' run program else leave program.

Reward if helpful

Read only

0 Likes
622

Hey buddy

can you give me a small example please ...

thanks ahmed

Read only

Former Member
0 Likes
623

hi,

SY-BATCH is the system variable, using this we knows the program executing in background or not.

IF SY-BATCH = 'X' means program executing in background.

sample program.

tables: kna1.

parameters: p_kunnr like kna1-kunne.

data: begin of itab occurs 0,

kunnr like kna1-kunnr,

name1 like kna1-name1,

end of itab.

start-of-selection.

select kunnr name1 from kna1 into table itab

where kunnr = p_kunnr.

IF SY-BATCH = 'X'.

LOOP AT ITAB.

WRITE:/ ITAB-KUNNR,

ITAB-NAME1.

ENDLOOP.

ELSE.

MESSAGE A000 with 'execute in background only'.

**OR

LEAVE LIST-PROCESSING.

ENDIF.

regards,

Asgokreddy.

Message was edited by:

Ashok Reddy

Read only

0 Likes
622

Hi,

If sy-batch <> 'X'.

stop.

else.

  • write your program

endif.

Reward if helpful.