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

SUBMIT with different USER.

Former Member
0 Likes
11,279

Hi,

I am currently executing a report in background using JOB_OPEN SUBMIT and JOB_CLOSE. My cureent user-iD is 'NAXDD', but i am submitting the job using another user-ID.

For example : v_user is defined as follows :

data : v_user TYPE sy-uname VALUE 'PATPA'.

No I submit the job using v_user but the sy-subrc value that is returned is 8

but when i execute with my user id NAXDD, then it works fine.

SUBMIT ABC_analysis AND RETURN

USER v_user

VIA JOB p_c_a_corfor

NUMBER jobnummer

WITH jobnr = p_c_a_corfor.

Is it a problem with the v_user declaration? Or what could be the possible reasons? Please help....Points to be awarded to the best answer...

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
5,822

while defining that job p_c_a_corfor, in sm37, on the screen which u give the program name and variant etc, try changing user to PATPA.

i am sure, it will work perfect if that job is scheduled... not sure, what happens, when such a job is called using submit... .. just give a try

11 REPLIES 11
Read only

Former Member
0 Likes
5,822

I think it basically work with Log in User name...

You can log in with another user name and then give ur own user name..then also it won't work..

PRa

Read only

Former Member
0 Likes
5,822

Does the other user have the same permissions as you? It is possible that he or she does not have authorization to submit programs in that client.

- April King

Read only

Former Member
0 Likes
5,822

Hi,

April King : The other user has the same authorization as mine.

Praneet : So how do we schdule with a specific user then? Is there any method to go about this as this is what our requirement is.

Read only

0 Likes
5,822

Instead of doing a SUBMIT, have you tried using the function modules JOB_OPEN, JOB_SUBMIT, and JOB_CLOSE? You can pass the user name to JOB_SUBMIT using field AUTHCKNAM.

- April

Read only

Former Member
0 Likes
5,823

while defining that job p_c_a_corfor, in sm37, on the screen which u give the program name and variant etc, try changing user to PATPA.

i am sure, it will work perfect if that job is scheduled... not sure, what happens, when such a job is called using submit... .. just give a try

Read only

Former Member
0 Likes
5,822

Hi debaprasad,

1. Ideally the user syntax should not create any problem.

2. The problem may be with the normal job scheduling,

using JOB_OPEN, Submit and JOB_CLOSE

3. Just remove the USER V_USER

(from your submit and then try)

regards,

amit m.

Read only

Former Member
0 Likes
5,822

SUBMIT ABC_analysis AND RETURN

with logall = 'X'

USER v_user

VIA JOB p_c_a_corfor

NUMBER jobnummer

WITH jobnr = p_c_a_corfor.

Use above query ,you will get it now

Reward Points if it is helpful

Thanks

Seshu

Read only

Former Member
0 Likes
5,822

I tried with the JOB_SUBMIT FM, here too it gives a sy-subrc = 8. Also i tried with the logall = 'X'. But still it gives a sy-subrc = 8.

I think Praneet might be right, only that user can submit the job, although I am not very sure. (after trying all these options)...If there are please let me know so that I can try a few more.

Read only

0 Likes
5,822

I saw the Function module code ,

they are comparing sy-uname with ur passing user name..

if both are same then it will trigger

otherwise it gives error message

Read only

0 Likes
5,822

Try this..........

DATA: P_JOBCNT LIKE TBTCJOB-JOBCOUNT,

L_RELEASE(1) TYPE c.

CALL FUNCTION 'JOB_OPEN'

EXPORTING

JOBNAME = 'ZTST1'

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 ZNTEST VIA JOB 'ZTST1' NUMBER P_JOBCNT

USER 'ELIGETV'

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 = 'ZTST1'

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.

Read only

Former Member
0 Likes
5,822

Hi,

If the User does not have the authorization to execute other USERS, then he cannot submit jobs on their behalf.

Thus one should have the sufficient athorization to submit jobs (using one user ID) to execute with another USER. This setting can be taken care by the Basis guys.