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

WebDynpro Switch the User: SUSR_INTERNET_USERSWITCH

szymon_bolek
Participant
0 Likes
1,273

Hello:)

have a guestions about the user swich.

The requirement I would like to fulfill:

1) log in anonymously, without the login page, to the web dynpro app

2) in the 'login form' enter a name and password, press ENTER and switch to another user.

So what I found is:

I) logging in as an anonymous user: in SICF i go to my node and set user, password,language, etc...

After I executed my WebDynpro App, login page was gone

II) a FM SUSR_INTERNET_USERSWITCH with which I can switch the users, but the documentation says, that it's from SERVICE to DIALOG.

My Questions:

1) Is the my scenario possible at all. And it it is, is that what I found useful?

2) Can I use SUSR_INTERNET_USERSWITCH for SERVICE to SERVICE switch??

3) any other solutions??

5 REPLIES 5
Read only

athavanraja
Active Contributor
Read only

0 Likes
813

Thanks for the reply!

Yes, I have seen this one. But this is for BSP, and I do not know if I can use it 1:1 in WD for ABAP, and it still does not say if it works with SERVICE ot SERVICE user switching. I doesn't say it doesn't as well, but still.

best regards

Simon:)

Read only

0 Likes
813

both BSP and WD ABAP runs from ICF (internet communication frmae work) and its very much relevant for ABAP WD as well.

did you check the source of this FM

as per the source these are the exception.

call 'INTERNET_USER_LOGON'  id 'UNAME'    field userid
                              id 'PASSW'    field password
                              id 'TICKET'   field ticket
                              id 'PASSFLAG' field pwdstate.

* SUBRC:
*       -3  switch not possible (multi-mode session: side-effects)
*       -2  current user is no SERVICE user but named user
*       -1  parameter error (missing / wrong length)
*        0  OK                               (USER_OK)
*        1  wrong password or not valid      (USER_NOT_ALLOWED)
*        2  user is locked                   (USER_LOCKED)
*        3  to many login tries              (STOP_SESSION)
*        6  CUA master record (no login)     (CUA_MASTER_RECORD)
*        8  user out of validity time period (USER_NOT_VALID)
*       10  secure connection required       (SNC_REQUIRED)
*       11  service user not in USRACLEXT    (SNC_NAME_NOT_IN_ACL)
*       12  X.509-submitter is not trusted   (SNC_SYST_NOT_IN_ACL)
*       50  password logon disabled          (PASSWORD_LOGON_DISABLED)
*       51  initial password expired         (INITIALPASSWORD_EXPIRED)
*       52  user has no password             (USER_HAS_NO_PASSWORD)

if time permits, i will simulate your case and get back.

Raja

Read only

0 Likes
813

many thanks Raja,

I did checked the source code and You're right, it should work for my case. I want to check it this weekend too, but I do not know if I'll have time for it. I'll post my results as soon as i'm done. If You'll simulate this, please do post your results as well.

best regards

Simon:)

Read only

0 Likes
813

so my friends:)

it works:


...
  DATA:
    ls_bname    TYPE ususername,
    lt_ret      TYPE TABLE OF bapiret2,
    lv_user     TYPE xubname,
    lv_password TYPE bapipwd.

  lv_user = item_user. " string
  lv_password = item_password. "string

  CALL FUNCTION 'SUSR_INTERNET_USERSWITCH'
    EXPORTING
      username                    = lv_user
      password                    = lv_password
    IMPORTING
      bname_after_switch          = ls_bname
    TABLES
      return                      = lt_ret
    EXCEPTIONS
      current_user_not_servicetyp = 1
      more_than_one_mode          = 2
      internal_error              = 3
      OTHERS                      = 4.
...

However, now after this call I am logged in as a Dialog user. So if I wanted to switch to another user I would get

<i>current_user_not_servicetyp</i>

How could I do that??

I'll post it here as soon as I find out.

best regards

Simon:)