Start of Content Area

Background documentation Creating New Users  Locate the document in its SAP Library structure

You create new users with the page create.htm . A check performed at page initialization ensures that this page can only be called by an administrator.

Note

The authorization check performed at function call already ensures that no unauthorized user can create a new Internet User, but it makes sense that unauthorized users should not even be able to display the Create page.

You enter the required user data for a new user on this page.

The figure below displays the screen on which you create a new Internet user:

This graphic is explained in the accompanying text

In OnInputProcessing of the page, the function module SUSR_USER_INTERNET_CREATE is called. This function module creates the new user. The INT_USER serves as a reference user here. The new Internet user has the same authorizations as the reference user. The user name queried is used as a alias, the function module generates a SU01 user name.

Page Attributes

Attribute Name

Auto

Typing Type

Reference Type

Description

err_msg

 

TYPE

STRING

Error message

Layout

<%@ page language="abap" %>

<html>

<body>

<h3> Create new user </h3>
<form>
<table>
<tr>
<td> User Name </td>
<td> <input type=text name="username"> </td>
</tr>
<tr>
<td> Password </td>
<td> <input type=password name="pwd1"> </td>
</tr>
<tr>
<td> verify Pwd</td>
<td> <input type=password name="pwd2"> </td>
</tr>
<tr>
<td> First Name </td>
<td> <input type=test name="firstname"> </td>
</tr>
<tr>
<td> Last Name </td>
<td> <input type=test name="lastname"> </td>
</tr>
<tr>
<td> Email </td>
<td> <input type=test name="email"> </td>
</tr>
<tr>
<td></td>
<td> <input type=submit name="OnInputProcessing(create)" value="logon">
<input type=submit name="OnInputProcessing(reset)" value="reset"> </td>
</tr>
</table>
</form>

</body>

</html>

Event Handler OnInputProcessing

data: newuser type bapialias,
pwd1 type bapipwd,
pwd2 type bapipwd,
refuser type bapibname,
address type bapiaddr3,
newuserid type bapibname.

data: return type table of bapiret2,
wa_return type bapiret2.

newuser = request->get_form_field( 'newuser' ).

pwd1 = request->get_form_field( 'pwd1' ).

pwd2 = request->get_form_field( 'pwd2' ).

address-firstname = request->get_form_field( 'firstname' ).

address-lastname = request->get_form_field( 'lastname' ).address-e_mail = request->get_form_field( 'email' ).

refuser = 'INT_USER'.

CALL FUNCTION 'SUSR_USER_INTERNET_CREATE'
EXPORTING
ALIAS = newuser
PASSWORD = pwd1
PASSWORD2 = pwd2
ADDRESS = address
REF_USER = refuser
IMPORTING
GENERATED_BNAME = newuserid
TABLES
RETURN = return
.

loop at return into wa_return.
concatenate err_msg ' <br> ' wa_return-message into err_msg.
endloop.

You can of course use multiple reference users for different purposes. This enables you to create scenarios where selected Internet users have authorization to create other Internet users.

It is also conceivable that you would have applications where new users may create their own users and register themselves. In this case, the guest user, used to display the public pages, would have to have authorization to create Internet users.