Application Development 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: 

Execution of report in background and foreground

Former Member
0 Kudos

Hi all,

I have a report in which i have two radio buttons on selection screen.

1, Foreground

2. background

could you please tell how to do foreground and background execution of report depends on user selection.if you could send some sample code its really helpful.

thanks

1 REPLY 1

Former Member
0 Kudos

If the Background radio button is selected the you need to use the SUBMIT command to submit your program in background.

Example

Scheduling a submitable program as a background task with the number number in a background request name. After scheduling, the background task is completed by function module JOB_CLOSE and released immediately providing the user has the relevant authorization.

DATA: number TYPE tbtcjob-jobcount,

name TYPE tbtcjob-jobname VALUE 'JOB_TEST',

print_parameters TYPE pri_params.

...

CALL FUNCTION 'JOB_OPEN'

EXPORTING

jobname = name

IMPORTING

jobcount = number

EXCEPTIONS

cant_create_job = 1

invalid_job_data = 2

jobname_missing = 3

OTHERS = 4.

IF sy-subrc = 0.

SUBMIT submitable TO SAP-SPOOL

SPOOL PARAMETERS print_parameters

WITHOUT SPOOL DYNPRO

VIA JOB name NUMBER number

AND RETURN.

IF sy-subrc = 0.

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobcount = number

jobname = name

strtimmed = 'X'

EXCEPTIONS

cant_start_immediate = 1

invalid_startdate = 2

jobname_missing = 3

job_close_failed = 4

job_nosteps = 5

job_notex = 6

lock_failed = 7

OTHERS = 8.

IF sy-subrc <> 0.

...

ENDIF.

ENDIF.

ENDIF.

Cheers

VJ

Message was edited by:

Vijayendra Rao