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

USER ID change at runtime

Former Member
0 Likes
2,516

Hi All,

I have got a requirement in which the user name(sy-uname) should get changed before executing a function module.I tried hardcoding it but i find that the name changes with every execution of a statement.

How to run a function module ina nother user name(system user)

Points will be assigned

1 ACCEPTED SOLUTION
Read only

former_member195383
Active Contributor
0 Likes
1,534

Hi..

try declaring a variable of type sy-uname say wf_uname, and then assign the desired userid value to that variable...pass that variable inside the FM, before which u want the userid value to change...

and where ever u are using the sy-uname inside the FM, try using the vriable wf_uname now..in that place..

Hope it helps..

5 REPLIES 5
Read only

Former Member
0 Likes
1,534

THe only way i can think of where we can change the username is by submitting a program in background with a different user ID. You can see the addition in the SUBMIT statement.

You can try creating a wrapper program for your FM and then submit a job for this program with a different ID.

Read only

0 Likes
1,534

Hi Thanks for the reply.

I understand that i need to create a job for my current program in SM36 and schedule it by using the 'submit' syntax with the user ID correct?

Prathish.

Read only

former_member195383
Active Contributor
0 Likes
1,535

Hi..

try declaring a variable of type sy-uname say wf_uname, and then assign the desired userid value to that variable...pass that variable inside the FM, before which u want the userid value to change...

and where ever u are using the sy-uname inside the FM, try using the vriable wf_uname now..in that place..

Hope it helps..

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,534

Hello,

Can you tell which FM you want to use ? Or be more specific abt ur requirement?

BR,

Suhas

Read only

Former Member
0 Likes
1,534

Hello Pratish,

Try this FM,

/SAPAPO/OM_LCCHECK_MULTIUSER

Regards

Indu.