2010 Mar 10 11:57 PM
Dears,
I had a requirement to create a program that creates a job ( + its jobsteps ) by copy of another job.
The program developed it is already doing this fine, but now the new requirement is to change the user on the job steps.
Is that even possible without modifying directly standard tables on db?
Imagine my reference job:
JOB A: user of the job: "Adam"
JOBSTEP A1: user of the jobstep: "Adam"
I have copied it and reschedule it successfully, but see details of my job:
JOB B: user of the job: "Me"
JOBSTEP B1: user of the jobstep: "Me" -> I want this to be "Adam"
I have tried BP_JOB_MODIFY and JOB_SUBMIT, both have a field with username, but both or ignored my new username assignment, or caused a dump.
Has anyone already done something similar? Preferentially not modifying directly the standard tables...
Thanks in advance
Edited by: João Pedro Cabrita on Mar 11, 2010 12:58 AM
2010 Mar 11 12:12 AM
Hi João,
Check out the documentation for SUBMIT - VIA JOB statement, which also contains an example. If you use the statement you can simply specify the user ID which should execute the given step.
Please note though, that in a production system this might be an issue, because there is an authorization check if a user is allowed to schedule jobs with other user ID's (obviously a risk).
Cheers, harald
p.s.: If you want to know in detail which possibilities you have, check out the good SAP documentation Programming with the Background Processing System.
Dears,
I had a requirement to create a program that creates a job ( + its jobsteps ) by copy of another job.
The program developed it is already doing this fine, but now the new requirement is to change the user on the job steps.
Is that even possible without modifying directly standard tables on db?
Imagine my reference job:
JOB A: user of the job: "Adam"
JOBSTEP A1: user of the jobstep: "Adam"
I have copied it and reschedule it successfully, but see details of my job:
JOB B: user of the job: "Me"
JOBSTEP B1: user of the jobstep: "Me" -> I want this to be "Adam"
I have tried BP_JOB_MODIFY and JOB_SUBMIT, both have a field with username, but both or ignored my new username assignment, or caused a dump.
Has anyone already done something similar? Preferentially not modifying directly the standard tables...
Thanks in advance
Edited by: João Pedro Cabrita on Mar 11, 2010 12:58 AM
2010 Mar 11 12:12 AM
Hi João,
Check out the documentation for SUBMIT - VIA JOB statement, which also contains an example. If you use the statement you can simply specify the user ID which should execute the given step.
Please note though, that in a production system this might be an issue, because there is an authorization check if a user is allowed to schedule jobs with other user ID's (obviously a risk).
Cheers, harald
p.s.: If you want to know in detail which possibilities you have, check out the good SAP documentation Programming with the Background Processing System.
2010 Mar 11 8:44 AM
Hi Harald,
Good suggestion but still unsolved, everytime I try to use a different user(uname) that mine while using statement:
SUBMIT ZPROGRAM USER uname
VIA JOB newjobnam NUMBER newjobcon
AND RETURN.
I get this shortdump:
-
Runtime Errors RAISE_EXCEPTION
Date and Time 11.03.2010 09:42:21
Short text
Exception condition "JOB_NOSTEPS" raised.
What happened?
The current ABAP/4 program encountered an unexpected
situation.
Error analysis
A RAISE statement in the program "SAPLBTCH" raised the exception
condition "JOB_NOSTEPS".
Since the exception was not intercepted by a superior
program, processing was terminated.
Short description of exception condition:
Job Specified Does Not Contain Any Steps
For detailed documentation of the exception condition, use
Transaction SE37 (Function Library). You can take the called
function module from the display of active calls.
(...)
-
And I dont think in this case the dump refelect the real cause of the dump, because when I use my user the dump does not occur, I think this has something to do with authorizations, could it be?
Imagine, its a bit dangerous that I have authorization to schedule a job under your name, isnt it?
More suggestions?
Thanks
2010 Mar 11 8:55 AM
Hhhmmm, interesting. You could try an authorization trace or simply try scheduling manually a job with a different user ID. If you cannot do that, then most likely that's also causing trouble in your program.
By the way, the authorization object relevant for granting access to scheduling jobs for different users is [S_BTCH_NAM|http://help.sap.com/saphelp_nw04/helpdata/EN/5f/ff2138faeb3807e10000009b38f889/frameset.htm]. So you could also add a check for that within your program.
2010 Mar 11 2:09 PM
Hey Harald,
I think this might be the key to my problem, when I have time to go through this authorization assignments I'll probably set this thread as solved!
Once again, thank you very much
BR
João Cabrita
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |