2008 Apr 11 8:30 PM
Hi,
I trying to submit a program in BG using job_open, submit, job_close.
My submit has sy-uname, jobname, jobcount.
sy-subrc is 0 for sumit.
for job_close sy-subrc value is 5.
In debug when I went inside the job_close code...i found the below part
SELECT SINGLE * FROM tbtccntxt INTO wa_tbtccntxt
WHERE jobname = jobname AND
jobcount = jobcount AND
ctxttype = 'INTERCEPTED'.
IF sy-subrc = 0. "here the value is returned as '5'
AUTHORITY-CHECK OBJECT 'S_RZL_ADM'
ID 'ACTVT' FIELD '01'.
IF sy-subrc <> 0.
ret = err_no_authority.
RAISE job_close_failed.
ENDIF.
ENDIF.
ENDIF.
ENDIF.I did check the table tbtccntxt and it doen't have any entries.
Though I have given sy-uname it considers....it doen't have authorization and is raising the exception.
is there anything that I am missing?
2008 Apr 11 8:51 PM
How come, that when table has NO entries (return code = 4), it still does the authorization check. If no entries available, then NO authorization check. I'm a bit confused, as to what the problem really is?
If authorization check fails, then obviously you don't have the proper authorizations.
2008 Apr 11 8:51 PM
How come, that when table has NO entries (return code = 4), it still does the authorization check. If no entries available, then NO authorization check. I'm a bit confused, as to what the problem really is?
If authorization check fails, then obviously you don't have the proper authorizations.
2008 Apr 11 8:53 PM
Try to pass to X to strtimmed
call function 'JOB_CLOSE'
exporting
jobcount = v_jobcount
jobname = v_jobname
strtimmed = 'X' "<< pass X to this parameter
importing
job_was_released = v_job_released
exceptions
invalid_startdate = 01
jobname_missing = 02
job_close_failed = 03
job_nosteps = 04
job_notex = 05
lock_failed = 06
others = 99.
a®
2008 Apr 11 9:01 PM
I have passed start immediate as X already.
Below is how I have it...
CALL FUNCTION 'JOB_OPEN'
EXPORTING
JOBGROUP = JOBGROUP
JOBNAME = JOBNAME
IMPORTING
JOBCOUNT = JOBCOUNT
EXCEPTIONS
CANT_CREATE_JOB = 1
INVALID_JOB_DATA = 2
JOBNAME_MISSING = 3
OTHERS = 4
SUBMIT ZFS1239
USER SY-UNAME
VIA JOB JOBNAME
NUMBER JOBCOUNT
AND RETURN.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
JOBCOUNT = JOBCOUNT
JOBNAME = JOBNAME
STRTIMMED = 'X'
IMPORTING
JOB_WAS_RELEASED = VAR
* CHANGING
* 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
.variable var is ' ' and sy-subrc for job_close is 5.
submit works fine with sy-subrc value 0.
2008 Apr 11 9:19 PM
Hi,
JOB_OPEN will internally calls BP_JOB_CREATE that internally writes to table TBTCP & TBTCCNTXT
then after the submit
system calls JOB_CLOSE.
call function 'BP_JOB_READ'
exporting
job_read_jobname = jobname
job_read_jobcount = jobcount
job_read_opcode = btc_read_jobhead_only
importing
job_read_jobhead = global_job
tables
job_read_steplist = global_step_tbl " Dummy, wird hier
exceptions " nicht gebraucht
job_doesnt_exist = 1
others = 99.
case sy-subrc. "<<< Here system could not find you job name
when 0.
" o.K.
when 1.
perform deq_job using jobname jobcount 'N' rc.
raise job_notex.
when others.
perform deq_job using jobname jobcount 'N' rc.
raise job_close_failed.
endcase.
***** c5034979 XBP20, change *****
* Intercepted jobs are only released only if the current user
* has proper authorization.
data: wa_tbtccntxt like tbtccntxt.
get time.
if global_job-status = btc_scheduled and
(
( not dont_release is initial and
( sdlstrtdt < sy-datum or
( sdlstrtdt = sy-datum and sdlstrttm < sy-uzeit
)
)
) or
( dont_release is initial and not strtimmed is initial
)
).
if sy-subrc = 0.
select single * from tbtccntxt into wa_tbtccntxt
where jobname = jobname and
jobcount = jobcount and
ctxttype = 'INTERCEPTED'.
Please check the JOB_OPEN print parameters (that you are getting GET_PRINT_PARAMETERS fun call)
a®
2008 Apr 11 9:20 PM
I have the following code in one of my programs and it works fine. Please see if you can gain something by looking at this code.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = l_jobname
IMPORTING
jobcount = l_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE e398(00) WITH 'JOB_OPEN Failed:'(021) sy-subrc '' ''.
ENDIF.
SUBMIT (l_repid)
VIA JOB l_jobname NUMBER l_jobcount
TO SAP-SPOOL
WITH SELECTION-TABLE t_rsparams
DESTINATION 'LOCL'
IMMEDIATELY ' '
KEEP IN SPOOL 'X'
WITHOUT SPOOL DYNPRO
AND RETURN.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = l_jobcount
jobname = l_jobname
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
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE i398(00) WITH 'JOB_CLOSE Failed:'(022) sy-subrc '' ''.
CALL FUNCTION 'BP_JOB_DELETE'
EXPORTING
forcedmode = 'X'
jobcount = l_jobcount
jobname = l_jobname
EXCEPTIONS
OTHERS = 0.
ENDIF.
2008 Apr 11 9:20 PM
The problem probably is that you have forgotten the JOB_SUBMIT function module after JOB_OPEN.
2008 Apr 11 10:02 PM
Thanks guys for all the help.
ARS i checked the 'BP_JOB_READ'.
Sy-subrc value is 0.
Can something happen like I should get special authorizations from basis people?
What I am suprised is the table "tbtccntxt" has zero entries.....does this mean no one ever executed anything in background...which is silly to think.....
any other ideas....i know it's friday evening
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |