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

Exception in SUSR_INTERNET_USERSWITCH

Former Member
0 Likes
1,188

Hi Folks,

I was trying to use the Function Module SUSR_INTERNET_USERSWITCH to perfrom a user switch. I have two users, one which is of type service and the other of type dialog. When I test the function module in se37 or by writing a report, I get an exception like

more than one external mode => switch not possible

RAISE MORE_THAN_ONE_MODE

This exception is due to the call at line # 233 in the FM.

  • actuall 'delayed logon' (switch from 'anonymous' to 'named'):

CALL 'INTERNET_USER_LOGON' ID 'UNAME' FIELD USERID

ID 'PASSW' FIELD PASSWORD

ID 'TICKET' FIELD TICKET

ID 'PASSFLAG' FIELD PWDSTATE.

Is there any way I can get around this issue?

Regards,

Gaurav

Hi Folks,

I was trying to use the Function Module SUSR_INTERNET_USERSWITCH to perfrom a user switch. I have two users, one which is of type service and the other of type dialog. When I test the function module in se37 or by writing a report, I get an exception like

more than one external mode => switch not possible

RAISE MORE_THAN_ONE_MODE

This exception is due to the call at line # 233 in the FM.

  • actuall 'delayed logon' (switch from 'anonymous' to 'named'):

CALL 'INTERNET_USER_LOGON' ID 'UNAME' FIELD USERID

ID 'PASSW' FIELD PASSWORD

ID 'TICKET' FIELD TICKET

ID 'PASSFLAG' FIELD PWDSTATE.

Is there any way I can get around this issue?

Regards,

Gaurav

4 REPLIES 4
Read only

Former Member
0 Likes
1,042

Try this one

CALL FUNCTION 'SUSR_INTERNET_USERSWITCH' "

EXPORTING

  • alias = " bapialias Internet User Alias

  • username = " bapibname-bapibname User Name

password = " bapipwd SAP user password

IMPORTING

bname_after_switch = " ususername

pwdstate = " xupwdstate Status of the User Password

  • TABLES

  • return = " bapiret2 Return parameter

EXCEPTIONS

CURRENT_USER_NOT_SERVICETYP = 1 "

MORE_THAN_ONE_MODE = 2 "

INTERNAL_ERROR = 3 " Internal Error

.

Read only

0 Likes
1,042

Thanks Rahul. Thats what I trying.

Read only

0 Likes
1,042

lv_user_before = sy-uname.

CALL FUNCTION 'SUSR_INTERNET_USERSWITCH'

EXPORTING

alias = lv_alias

password = lv_password

  • IMPORTING

  • BNAME_AFTER_SWITCH =

  • PWDSTATE =

  • PWD_CHANGE_SSO =

TABLES

return = lt_return

EXCEPTIONS

current_user_not_servicetyp = 3

more_than_one_mode = 2

internal_error = 1

OTHERS = 4

.

IF sy-subrc > 1

OR ( sy-subrc = 1 AND sy-uname = lv_user_before ).

  • Error during User Switch

ELSE.

  • everything OK

ENDIF.

Read only

0 Likes
1,042

I think I did not put my question across v clearly. Its not that I do not know how to handle the exception. Its just that I want to know why the exception is happening and get rid of it so that the user switch happens succesfully.

Regards,

Gaurav