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: 

Generate Background job

Former Member
0 Kudos

Hi,

In my scenario a report is getting displays which gives the complete details based on the input.Instead of dispalying as a report i have to schedule a background job,in which job log gives the details of the report.How to do it?Plz post some sample code

1 ACCEPTED SOLUTION

GauthamV
Active Contributor
0 Kudos

After giving your inputs in Selection screen of report pree F9 it will ask for details.

Give the details and create a background job with immediately option.

you can see the report output in SM37 transaction.

7 REPLIES 7

GauthamV
Active Contributor
0 Kudos

After giving your inputs in Selection screen of report pree F9 it will ask for details.

Give the details and create a background job with immediately option.

you can see the report output in SM37 transaction.

Former Member
0 Kudos

Am doing this in an interactive report.The first report is generated there once i click a button a background job has to be scheluled at once which should give the info of the report.How to do it?

0 Kudos

In the at user-command section of your report, you shold call the following FMs in sequence to create a background job.

1) call FM JOB_OPEN

2) Submit the report name in background mode

3) JOB_CLOSE

Sample code:

CALL FUNCTION 'JOB_OPEN'

EXPORTING

JOBNAME = JOBNAME

JOBGROUP = 'FIEB'

IMPORTING

JOBCOUNT = JOBCOUNT

EXCEPTIONS

CANT_CREATE_JOB = 01

INVALID_JOB_DATA = 02

JOBNAME_MISSING = 03.

IF SY-SUBRC NE 0.

MESSAGE E015 RAISING SESSION_NOT_PROCESSABLE.

ENDIF.

SUBMIT RSBDCSUB AND RETURN

USER SY-UNAME

VIA JOB JOBNAME NUMBER JOBCOUNT

  • with mappe = group

WITH MAPPE = BI-NAME

WITH VON = SY-DATUM

WITH BIS = SY-DATUM

WITH Z_VERARB = 'X'.

BDCSTRTDT = SY-DATUM.

BDCSTRTDT = SPACE.

BDCSTRTTM = SPACE.

BDCIMMED = 'X'.

  • bdcstrttm = runtime.

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

JOBNAME = JOBNAME

JOBCOUNT = JOBCOUNT

STRTIMMED = BDCIMMED

SDLSTRTDT = BDCSTRTDT

SDLSTRTTM = BDCSTRTTM

EXCEPTIONS

CANT_START_IMMEDIATE = 01

JOBNAME_MISSING = 02

JOB_CLOSE_FAILED = 03

JOB_NOSTEPS = 04

JOB_NOTEX = 05

LOCK_FAILED = 06.

IF SY-SUBRC NE 0.

MESSAGE E015 RAISING SESSION_NOT_PROCESSABLE.

ENDIF.

CLEAR BDCIMMED.

BDCSTRTDT = SPACE.

BDCSTRTTM = SPACE.

Former Member
0 Kudos

Hi,

You can use the below fuction module to to create a job in back ground but for that you need to create another report which will take input from this report.

JOB_OPEN

SUBMIT program...

JOB_CLOSE

In the program you can write "write statement to create the job log".

Br/Manas

0 Kudos

After using the job_open,submit and job_close how to write the contents of the report in the job log.Please help

0 Kudos

once the job is completed you can see the log in SP01 Tr.

Former Member
0 Kudos

Hi,

What I guess the job log would be no of records pass, no of successful records , no of records skipped.

So you can take the nos from the corresponding internal tables and by using "Write Statement" you can populate the job log.

BR/Manas