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: 

i need Function module to schedule my job in background

Former Member
0 Kudos

Hi everybody,

i need Function module to schedule my job in background,

which should take all the values as input which i keyin when i schedule a job in background using tcode se36 by jobwizard method.

7 REPLIES 7

Former Member
0 Kudos

JOB_OPEN

JOB_SUBMIT

JOB_CLOSE

Former Member
0 Kudos

Also take a look at the BPJOB function modules in SE37.

Sudha

Former Member
0 Kudos

Hi Avinash,

Try this program.

PROGRAM ZTRIGGER NO STANDARD PAGE HEADING

LINE-SIZE 132

MESSAGE-ID ZS.

  • There is a single TRIGGER program. A Variant will be created for

  • every job to be run.

CONSTANTS: C_A TYPE C VALUE 'A'.

PARAMETER: P_EVENT LIKE TBTCO-EVENTID DEFAULT ' ',

P_PARAM LIKE TBTCO-EVENTPARM DEFAULT ' '.

  • Raise event to initiate background job

CALL FUNCTION 'BP_EVENT_RAISE'

EXPORTING

EVENTID = P_EVENT

EVENTPARM = P_PARAM

EXCEPTIONS

BAD_EVENTID = 1

EVENTID_DOES_NOT_EXIST = 2

EVENTID_MISSING = 3

RAISE_FAILED = 4

OTHERS = 5.

  • This function should never fail. Abend program if it does.

IF SY-SUBRC NE 0.

MESSAGE ID SY-MSGID TYPE C_A NUMBER SY-MSGNO WITH P_EVENT.

ENDIF.

Hope this will help u.

Cheers

Sunny

Rewrd points, if found helpful

Former Member
0 Kudos

hi

FM BP_JOB_CREATE .

thanks,

priya

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Check this sample code which I got from this forum and kindly reward points if it helps.

report zrich_0004 .

data: sdate type sy-datum,

stime type sy-uzeit,

l_valid,

ls_params like pri_params,

l_jobcount like tbtcjob-jobcount,

l_jobname like tbtcjob-jobname.

start-of-selection.

  • Get Print Parameters

call function 'GET_PRINT_PARAMETERS'

exporting

no_dialog = 'X'

importing

valid = l_valid

out_parameters = ls_params.

  • Open Job

l_jobname = 'ZRICH_0005'.

call function 'JOB_OPEN'

exporting

jobname = l_jobname

importing

jobcount = l_jobcount.

  • Submit report to job

submit zrich_0005

via job l_jobname

number l_jobcount

to sap-spool without spool dynpro

spool parameters ls_params

and return.

  • Kick job off 30 seconds from now.

sdate = sy-datum.

stime = sy-uzeit + 30.

  • Schedule and close job.

call function 'JOB_CLOSE'

exporting

jobcount = l_jobcount

jobname = l_jobname

sdlstrtdt = sdate

sdlstrttm = stime

  • strtimmed = 'X'

.

arthur_sehn
Employee
Employee
0 Kudos

Hi,

you can also try this FM below. you only have to provide the values of the parameters and the report name.

Best regards,

Arthur

_______

DATA:

l_jobname LIKE kaba01-jname,

l_convert_low LIKE rsparams-low,

l_repid LIKE sy-repid.

DATA:

lt_selektionen LIKE kaba00 OCCURS 0 WITH HEADER LINE.

l_convert_low = p_dispo.

lt_selektionen-field = 'P_DISPO'.

lt_selektionen-sign = 'I'.

lt_selektionen-option = 'EQ'.

lt_selektionen-low = l_convert_low.

lt_selektionen-type = 'P'.

APPEND lt_selektionen.

l_convert_low = p_batch.

lt_selektionen-field = 'P_BATCH'.

lt_selektionen-sign = 'I'.

lt_selektionen-option = 'EQ'.

lt_selektionen-low = l_convert_low.

lt_selektionen-type = 'P'.

APPEND lt_selektionen.

l_jobname = 'MATMASCOPY_'.

CONCATENATE l_jobname p_obj_d '_' sy-timlo(4) sy-datlo INTO l_jobname.

l_repid = sy-repid.

CALL FUNCTION 'K_BATCH_REQUEST'

EXPORTING

par_dialg = 'X'

par_jname = l_jobname

par_print = 'X'

par_rname = l_repid

par_sdmsg = 'X'

TABLES

tab_selpa = lt_selektionen.

Former Member
0 Kudos

Hi

For simple job scheduling use

'BP_JOBVARIANT_SCHEDULE'

For this you have create a variant for that program.thats

mandatory

Regards

Viswanath Babu