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

JOB_CLOSE function module

Former Member
0 Likes
1,159

Hi Experts,

I am calling the function module 'JOB_CLOSE' as follows passing 3 (job name, job count, start immediately) parameters.But it is failing and the sy-subrc value is 4 (job_close_failed = 4). Please tell me how to correct this.

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobcount = v_jobcount

jobname = v_jobname

strtimmed = 'X'

IMPORTING

job_was_released = v_ok

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 .

Thanks,

neethu.

4 REPLIES 4
Read only

Former Member
0 Likes
797

Hi,

Please check in SM37 why the job is getting failed.

Regards,

Ankur Parab

Read only

0 Likes
797

Hi All,

The following message is coming in the job log. " Spool request 0 no longer exists

Job cancelled after system exception ERROR_MESSAGE ".

Read only

0 Likes
797

Hi,

Please check in ST22 if you have any dump by the same error.

analyse it and try to investigate.

Regards,

Ankur Parab

Read only

Former Member
0 Likes
797

Hi,

Please refer the sample code

ATA: P_JOBCNT LIKE TBTCJOB-JOBCOUNT,

L_RELEASE(1) TYPE c.

CALL FUNCTION 'JOB_OPEN'

EXPORTING

JOBNAME = 'ZTEMP2'

IMPORTING

JOBCOUNT = P_JOBCNT

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.

SUBMIT ZTEMP2 VIA JOB 'ZTEMP2' NUMBER P_JOBCNT

TO SAP-SPOOL WITHOUT SPOOL DYNPRO

WITH DESTINATION = 'HPMISPRT'

WITH IMMEDIATELY = SPACE

WITH KEEP_IN_SPOOL = 'X' AND RETURN.

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

JOBCOUNT = P_JOBCNT

JOBNAME = 'ZTEMP2'

STRTIMMED = 'X'

PRDMINS = 15

IMPORTING

JOB_WAS_RELEASED = L_RELEASE

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.

Hope it helps

Regards

Sumana