08-10-2013 2:51 PM
Hi,
I am trying to create a program in which i want to login as a different user.
I will run this program as user X and than want to create a new GUI session for another user Y.
I should have options for password.
I am aware of 2 types of user session :
GUI
RFC.
Currently i am using SYSTEM_REMOTE_LOGIN for creating a RFC session but want to change this to GUI logon.
I wasn't able to find any FM or code for GUI logon.
Thanks in advance for your help!
Regards,
Deepak Duhan
08-11-2013 6:13 AM
SAP Login Inside a login !! I dont think such standard feature available. However you can achieve this by using custom screens and validating User~password from custom table.
08-11-2013 10:50 AM
Hi Satya,
As i mentioned we can use SYSTEM_REMOTE_LOGIN to login. But my issue with this is that all the stats recoded with this type of logon shows RFC in report column of the stat table. I want to check what all reports were executed via the second login.
Regards,
Deepak
08-11-2013 11:09 AM
Hi Deepak,
Try using the Function Module TH_CREATE_FOREIGN_MODE or TH_CREATE_MODE..
Regards,
AyyamPerumal
08-11-2013 12:31 PM
Another option is to write a wrapper around this standard SYSTEM_REMOTE_LOGIN function and use submit statement with user as parameter.
regards,
Bartek
08-19-2013 8:35 PM
Bartek, a bit confused about using Submit. Please provide some code example how can i submit a FM using the SUBMIT statement.
Just for info: i am using a TRUSTED RFC created for the specific user(second user) i am trying to login with. This was to skip any password check.
08-19-2013 8:36 PM
Ayyam, i can use TH_CREATE_FOREIGN_MODE only for creating a new session for my user. If i specify any other user id, it raises no NO_AUTHORITY exception. With TH_CREATE_MODE i don't have the option of providing user id.
08-20-2013 8:49 AM
This is some solution hope you will find it usefull:
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = 'ZMYJOB'
IMPORTING
jobcount = l_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc = 0.
SUBMIT zsomereport [WITH parameter = x]
USER username VIA JOB 'ZMYJOB' NUMBER l_jobcount AND RETURN.
IF sy-subrc = 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = l_jobcount
jobname = 'ZMYJOB'
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
invalid_target = 8
OTHERS = 9.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDIF.
ENDIF.