Show TOC

Background documentationCreating New Users Locate this document in the navigation 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. You enter the required user data for a new user on this page.

Note 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.

End of the note.

In OnInputProcessing of the page, the function module SUSR_USER_INTERNET_CREATE is called, which creates the new internet user. The INT_USER serves as a reference user here. The new Internet user has the same authorizations as the reference user.

Page Attribute

Attribute Name

Auto

Typing Kind

Reference Type

Description

err_msg

TYPE

STRING

Error message

Layout

Syntax Syntax

  1. <%@ 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>
End of the source code.
Eventhandler OnInputProcessing

Syntax Syntax

  1. 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.
End of the source code.

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.