Skip to Content
0
Former Member
Dec 20, 2012 at 06:31 AM

Background Job not getting Released

387 Views

Hi all,

I am trying to schedule a background job but i am facing a problem it is getting scheduled instead of Starting Immediately. How to Release it. I have searched the forum but could not get a working solution for my case. I used the following Code.

call function 'JOB_OPEN'

exporting

* DELANFREP = ' '

* JOBGROUP = ' '

jobname = jobname

sdlstrtdt = sy-datum

sdlstrttm = sy-uzeit

jobclass = 'C'

importing

jobcount = jobcount

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.

call function 'GET_PRINT_PARAMETERS'

EXPORTING

IMMEDIATELY = 'X'

NO_DIALOG = C_TRUE

RELEASE = 'X'

USER = SY-UNAME

IMPORTING

* OUT_ARCHIVE_PARAMETERS =

OUT_PARAMETERS = parameters

VALID = valid

.

if sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

submit (program_name) using selection-set variant via job jobname number jobcount to sap-spool without spool dynpro

spool parameters parameters and return.

sdlstrtdt = sy-datum .

sdlstrttm = sy-uzeit.

do.

call function 'JOB_CLOSE'

exporting

jobcount = jobcount

jobname = jobname

sdlstrtdt = sdlstrtdt

sdlstrttm = sdlstrttm

strtimmed = 'X'

importing

job_was_released = released

changing

ret = ret

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.

exit.

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

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

endif.

enddo.

but i am getting exception invalid Start Date on execution of Job_Close FM Since the job did not start and has been Scheduled