分类:
2008-05-16 17:18:05
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.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:
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" %>
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 '
' 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.