Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

JOB_CLOSE and Background Job Process a FM

HI Guys,

I have my code like this:

data: jobname like tbtcjob-jobname value

'TESTJOB'.

data: jobcount like tbtcjob-jobcount,

host like msxxlist-host.

data: begin of starttime.

include structure tbtcstrt.

data: end of starttime.

data: starttimeimmediate like btch0000-char1.

  • Job open

call function 'JOB_OPEN'

exporting

delanfrep = ' '

jobgroup = ' '

jobname = jobname

sdlstrtdt = sy-datum

sdlstrttm = sy-uzeit

importing

jobcount = jobcount

exceptions

cant_create_job = 01

invalid_job_data = 02

jobname_missing = 03.

if sy-subrc ne 0.

"error processing

endif.

data: lv_weekday type WEEK_DAY.

CALL FUNCTION 'DATE_TO_DAY'

EXPORTING

DATE = sy-datum

IMPORTING

WEEKDAY = lv_weekday.

  • Close job

starttime-sdlstrtdt = sy-datum.

starttime-sdlstrttm = SY-UZEIT.

call function 'JOB_CLOSE'

exporting

event_id = starttime-eventid

event_param = starttime-eventparm

event_periodic = starttime-periodic

jobcount = jobcount

jobname = jobname

laststrtdt = starttime-laststrtdt

laststrttm = starttime-laststrttm

prddays = 1

prdhours = 0

prdmins = 0

prdmonths = 0

prdweeks = 0

sdlstrtdt = starttime-sdlstrtdt

sdlstrttm = starttime-sdlstrttm

strtimmed = 'X' "starttimeimmediate

  • targetsystem = host

exceptions

cant_start_immediate = 01

invalid_startdate = 02

jobname_missing = 03

job_close_failed = 04

job_nosteps = 05

job_notex = 06

lock_failed = 07

others = 99.

if sy-subrc eq 0.

"error processing

endif.

This is the Program I want the Batch Job to Execute a BAPI Function Module in the Place of DATE_TO_DAY function module. Is it Possible ??????

And also I get an error at the JOB_CLOSE Function Module with SY-SUBRC = 5.

Can anyone know why this is happening and what should be done to overcome this.

Thanks & Regards,

YJR.

Tags:
Not what you were looking for? View more on this topic or Ask a question