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

ALV

Former Member
0 Likes
320

how to do background scheduling fro ALV Reports,Is there any function module to do so?

2 REPLIES 2
Read only

Former Member
0 Likes
300

Hi,

You can use job_open, Job_submit & Job_close function modules.

Ashven

Read only

Former Member
0 Likes
300

There are two approaches to this:

1. Write the code which you want to schedule and go to SM36 and create a background job with periodic attributes if you want to schedule for particular time periods or for one time don't give the periodic attribute and schedule the job with process immediately attribute for the start time.

2. Use the function modules for Scheduling the job:

*-----Data Declaration.

Data: v_job TYPE tbtcjob-jobname,

v_count(8) TYPE c.

v_job = 'My_Background_Job'.

Perform mm_job_open.

Perform mm_job_submit.

Perform mm_job_close.

FORM mm_job_open .

*-----Job open for downloading data in background schduling

CALL FUNCTION 'JOB_OPEN'

EXPORTING

jobname = v_job

jobclass = 'A'

IMPORTING

jobcount = v_count

EXCEPTIONS

cant_create_job = 1

invalid_job_data = 2

jobname_missing = 3

OTHERS = 4.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDFORM. " mm_job_open

FORM mm_job_submit .

*-----Submiting job for downloading data in background schduling

CALL FUNCTION 'JOB_SUBMIT'

EXPORTING

authcknam = sy-uname

jobcount = v_count

jobname = v_job "Job Name you want to create

language = sy-langu

report = 'ZMM_MASTER_XML' "Program Name

EXCEPTIONS

bad_priparams = 1

bad_xpgflags = 2

invalid_jobdata = 3

jobname_missing = 4

job_notex = 5

job_submit_failed = 6

lock_failed = 7

program_missing = 8

prog_abap_and_extpg_set = 9

OTHERS = 10.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDFORM. " mm_job_submit

FORM mm_job_close .

*-----Closing an opened job

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobcount = v_count

jobname = v_job

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

invalid_target = 8

OTHERS = 9.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDFORM. " mm_job_close

I hope that this will serve your purpose. Good luck,

Smiles from Miles,

Regards,

Amandeep Kumar