Show TOC

Logging On as an Internet UserLocate this document in the navigation structure

Use

The logon page login.htm is openly accessible under the account of the INT_GUEST. The page contains a user name and password query. In OnInputProcessing of the page, the function module SUSR_INTERNET_USERSWITCH is called, which switches to the relevant user. All subsequent steps take place on the account of the logged on user.

Page Attribute

Attribute Name

Auto

Typing Kind

Reference Type

Description

err_msg

 

TYPE

STRING

Error message

Layout

<%@ page language="abap" %>
<html>
<body>

<%= err_msg %>

<form>
<table>
  <tr>
    <td>User</td>
    <td><input type=text name="username"></td>
    <td></td>
  </tr>
  <tr>
    <td>Password</td>
    <td><input type=password name="password"></td>
    <td><input type=submit name="OnInputProcessing" value="login"></td>
  </tr>
</table>
</form>
</body>
</html>

            

Eventhandler OnInputProcessing

data: usr type bapialias,
pwd type bapipwd.
data: return type table of bapiret2,
wa_return type bapiret2,
bname type USUSERNAME.

usr = request->get_form_field( 'username' ).

pwd = request->get_form_field( 'password' ).

CALL FUNCTION 'SUSR_INTERNET_USERSWITCH'
EXPORTING
ALIAS = usr
PASSWORD = pwd

IMPORTING
BNAME_AFTER_SWITCH = bname
TABLES
RETURN = return.
.
loop at return into wa_return.
err_msg = wa_return-message.
endloop.

if bname is not initial.
navigation->goto_page( 'userdata.htm' ).
endif.

            

After the logon is authenticated, the example again displays the initial page, this time called with the logged on user's account. If the logon is not authenticated, the page is displayed again where the error message from the return structure of the call can be displayed.