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

How run a report in background process ?

Former Member
0 Likes
1,198

Hi Experts,

I wrote a code in which I am have multiple selection screens....means in first screen there will 3 radio buttons.

So, depending upon the radio button selected, the other selction screen will be displayed...

So, here i want to run a report in background process...But in menubar im not able to find 'program'.

So, please help me this to run my report in background process.. with any simple code...

Thanks,

Rocky.

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
1,173

First create variant in the report with input values and save the variant

SE38 --> type the report name > select from top menu -> program -> execute> background

Hi Experts,

I wrote a code in which I am have multiple selection screens....means in first screen there will 3 radio buttons.

So, depending upon the radio button selected, the other selction screen will be displayed...

So, here i want to run a report in background process...But in menubar im not able to find 'program'.

So, please help me this to run my report in background process.. with any simple code...

Thanks,

Rocky.

8 REPLIES 8
Read only

former_member194669
Active Contributor
0 Likes
1,174

First create variant in the report with input values and save the variant

SE38 --> type the report name > select from top menu -> program -> execute> background

Read only

0 Likes
1,173

Hi

Thanks for u reply, but my question is that...in my selection screen in menu bar there is no 'program'.

There are 'selection' 'edit' 'goto' etc.

Since it is the second selection screen in the same program...

So, please help what i have to do in this report....

Thanks,

Rocky.

Read only

0 Likes
1,173

Hi Rocky,

Did you try thru SM36..

Just create a variant and schedule in SM36.

To create a variant just enter values in the selection screen and save it.

Go to SM36 create a job, assign a program name, choose a variant and select either date/time or immediate.

Mubeen

Read only

0 Likes
1,173

Hi Mubeen,

Thanks for u r explanation. But i want the background process to be done, by writing any code in my report itself.

Im user want an option in the selection screen itself as weather to run the report in background or foreground.

So, please help me with any coding.

Thanks,

Santosh.

Read only

0 Likes
1,173

Hi,

Try to see this example and adapt it for your case:

constants : c_jobname like tbtcjob-jobname value 'ZRFC_CM_38',

c_jobclass like tbtcjob-jobclass value 'A',

c_x type c value 'X',

c_msgclass type arbgb value 'ZXXXSD',

c_error type bapi_mtype value 'E',

c_status type bapi_mtype value 'S',

c_msg1 type msgnr value '177',

c_msg2 type msgnr value '178'.

data : v_jobcount like tbtcjob-jobcount.

ranges:

r_auart for vbak-auart,

r_wbstk for vbuk-wbstk,

r_mtart for mara-mtart,

r_reswk for ekko-reswk,

r_vtweg for vbak-vtweg.

call function 'JOB_OPEN'

exporting

jobname = c_jobname

importing

jobcount = v_jobcount

exceptions

cant_create_job = 1

invalid_job_data = 2

jobname_missing = 3

others = 4.

if sy-subrc = 0.

  • Assignment of Ranges

append lines of:

distribution_channel to r_vtweg,

order_type_range to r_auart,

status_range to r_wbstk,

material_type_range to r_mtart,

plant_range to r_reswk.

  • Submit program in background

submit z_beve_salesorder_list

with p_spart = division

with p_file = file_name

with p_land1 = country

with s_vtweg in r_vtweg

with s_auart in r_auart

with s_wbstk in r_wbstk

with s_mtart in r_mtart

with s_reswk in r_reswk

via job c_jobname

number v_jobcount

and return.

  • Close the Job

call function 'JOB_CLOSE'

exporting

jobcount = v_jobcount

jobname = c_jobname

strtimmed = c_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

invalid_target = 8

others = 9.

if sy-subrc = 0.

  • Status Message

return-type = c_status.

message id c_msgclass

type c_status

number c_msg1

into return-message

with c_jobname

sy-datum

sy-uzeit.

else.

  • Error Message

return-type = c_error.

message id c_msgclass

type c_error

number c_msg2

into return-message

with c_jobname.

endif.

endif.

Regards.

Read only

0 Likes
1,173

Hi,

Give a button on the selection screen.

When the user clicks on it, set the SY-UCOMM = 'SJOB'.

SJOB is the ucomm when we execute in background.

This will help!!

Regards,

Prashant

Read only

Former Member
0 Likes
1,173

hi,

1. Go to SE38 give the program name and then from Menu path Program->Execute->Background. You need create the variant for selection screen

2. Go to SE38 give the program name and then execute on the selection screen goto Menu path Program->Execute->Background

<<list of links removed. If you want links - search>>

and one thing

using SM36 we can schedule the program and sm37 view the job.

Regards,

Madhu

Edited by: Matt on Jan 29, 2009 2:25 PM

Read only

Former Member
0 Likes
1,173

Hello Rocky,

First create a variant then go to SM36 and schedule a background job.

Select Date / Time if you want to execute it on a selected date.

If you want to execute immediately select IMMEDIATE, CHECK it and SAVE it.

Go to SM37 and check the status.

Let me know if you want to do it in different way.

Mubeen