SAP /VIRSA/BAPI_USER_CREATE Function Module for User Creation
/VIRSA/BAPI_USER_CREATE is a standard /virsa/bapi user create SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for User Creation processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for /virsa/bapi user create FM, simply by entering the name /VIRSA/BAPI_USER_CREATE into the relevant SAP transaction such as SE37 or SE38.
Function Group: /VIRSA/AECO
Program Name: /VIRSA/SAPLAECO
Main Program: /VIRSA/SAPLAECO
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Remote-Enabled
Update:

Function /VIRSA/BAPI_USER_CREATE pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION '/VIRSA/BAPI_USER_CREATE'"User Creation.
EXPORTING
GEN_PASSWORD = "Single-character flag
* REF_USER = "User name
* ALIAS = "User Name Alias
* EX_ADDRESS = "Person number
* UCLASS = "License-Related User Classification
* FORCE_SYSTEM_ASSIGNMENT = "Single-character flag
* PASSWORD_LENGTH = 8 "
USERNAME = "User Name in User Master Record
* NAME_IN = "User name
LOGONDATA = "User: Logon Data Transfer Structure
PASSWORD = "SAP user password
* DEFAULTS = "User: Fixed Values Transfer Structure
ADDRESS = "BAPI reference structure for addresses (contact person)
* COMPANY = "Company to which a user is assigned
* SNC = "SNC attributes for a user
IMPORTING
GENERATE_PASSWORD = "Character field, 8 characters long
TABLES
* PARAMETER = "User: Parameter Transfer Structure
* ADDRFC = "BAPI Structure for RFC Addresses (Business Address Services)
* ADDPRT = "BAPI Structure for PRT Addresses (Business Address Services)
* ADDSSF = "BAPI Structure for SSF Addresses (Business Address Services)
* ADDURI = "BAPI Structure for URI Addresses (Business Address Services)
* ADDPAG = "BAPI Structure for Pager Numbers (Business Address Services)
* ADDCOMREM = "BAPI structure for communication type comments
* GROUPS = "Transfer Structure for a List of User Groups
* PARAMETER1 = "User: Parameter Transfer Structure
* EXTIDHEAD = "Header Data for External ID of a User
* EXTIDPART = "Part of a Long Field for the External ID of a User
* RETURN = "Return Parameter
* ADDTEL = "BAPI Structure for Telephone Numbers (Bus. Address Services)
* ADDFAX = "BAPI Structure for Fax Numbers (Business Address Services)
* ADDTTX = "BAPI Structure for Teletex Numbers (Bus. Address Services)
* ADDTLX = "BAPI Structure for Telex Numbers (Business Address Services)
* ADDSMTP = "BAPI Structure for E-Mail Addresses (Bus. Address Services)
* ADDRML = "BAPI Structure for RML Addresses (Business Address Services)
* ADDX400 = "BAPI Structure for X.400 Addresses (Bus. Address Services)
IMPORTING Parameters details for /VIRSA/BAPI_USER_CREATE
GEN_PASSWORD - Single-character flag
Data type: CHAR1Optional: No
Call by Reference: No ( called with pass by value option)
REF_USER - User name
Data type: BAPIREFUSOptional: Yes
Call by Reference: No ( called with pass by value option)
ALIAS - User Name Alias
Data type: BAPIALIASOptional: Yes
Call by Reference: No ( called with pass by value option)
EX_ADDRESS - Person number
Data type: BAPIADDR3-PERS_NOOptional: Yes
Call by Reference: No ( called with pass by value option)
UCLASS - License-Related User Classification
Data type: /VIRSA/BAPIUCLASSOptional: Yes
Call by Reference: No ( called with pass by value option)
FORCE_SYSTEM_ASSIGNMENT - Single-character flag
Data type: BAPIFLAG-BAPIFLAGOptional: Yes
Call by Reference: No ( called with pass by value option)
PASSWORD_LENGTH -
Data type: IDefault: 8
Optional: No
Call by Reference: No ( called with pass by value option)
USERNAME - User Name in User Master Record
Data type: BAPIBNAME-BAPIBNAMEOptional: No
Call by Reference: No ( called with pass by value option)
NAME_IN - User name
Data type: BAPIBNAMEOptional: Yes
Call by Reference: No ( called with pass by value option)
LOGONDATA - User: Logon Data Transfer Structure
Data type: BAPILOGONDOptional: No
Call by Reference: No ( called with pass by value option)
PASSWORD - SAP user password
Data type: BAPIPWDOptional: No
Call by Reference: No ( called with pass by value option)
DEFAULTS - User: Fixed Values Transfer Structure
Data type: /VIRSA/BAPIDEFAULOptional: Yes
Call by Reference: No ( called with pass by value option)
ADDRESS - BAPI reference structure for addresses (contact person)
Data type: BAPIADDR3Optional: No
Call by Reference: No ( called with pass by value option)
COMPANY - Company to which a user is assigned
Data type: BAPIUSCOMPOptional: Yes
Call by Reference: No ( called with pass by value option)
SNC - SNC attributes for a user
Data type: BAPISNCUOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for /VIRSA/BAPI_USER_CREATE
GENERATE_PASSWORD - Character field, 8 characters long
Data type: XUNCODEOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for /VIRSA/BAPI_USER_CREATE
PARAMETER - User: Parameter Transfer Structure
Data type: BAPIPARAMOptional: Yes
Call by Reference: Yes
ADDRFC - BAPI Structure for RFC Addresses (Business Address Services)
Data type: BAPIADRFCOptional: Yes
Call by Reference: Yes
ADDPRT - BAPI Structure for PRT Addresses (Business Address Services)
Data type: BAPIADPRTOptional: Yes
Call by Reference: Yes
ADDSSF - BAPI Structure for SSF Addresses (Business Address Services)
Data type: BAPIADSSFOptional: Yes
Call by Reference: Yes
ADDURI - BAPI Structure for URI Addresses (Business Address Services)
Data type: BAPIADURIOptional: Yes
Call by Reference: Yes
ADDPAG - BAPI Structure for Pager Numbers (Business Address Services)
Data type: BAPIADPAGOptional: Yes
Call by Reference: Yes
ADDCOMREM - BAPI structure for communication type comments
Data type: BAPICOMREMOptional: Yes
Call by Reference: Yes
GROUPS - Transfer Structure for a List of User Groups
Data type: BAPIGROUPSOptional: Yes
Call by Reference: Yes
PARAMETER1 - User: Parameter Transfer Structure
Data type: BAPIPARAM1Optional: Yes
Call by Reference: Yes
EXTIDHEAD - Header Data for External ID of a User
Data type: /VIRSA/BAPIUSEXTIDHEADOptional: Yes
Call by Reference: Yes
EXTIDPART - Part of a Long Field for the External ID of a User
Data type: /VIRSA/BAPIUSEXTIDPARTOptional: Yes
Call by Reference: Yes
RETURN - Return Parameter
Data type: BAPIRET2Optional: Yes
Call by Reference: Yes
ADDTEL - BAPI Structure for Telephone Numbers (Bus. Address Services)
Data type: BAPIADTELOptional: Yes
Call by Reference: Yes
ADDFAX - BAPI Structure for Fax Numbers (Business Address Services)
Data type: BAPIADFAXOptional: Yes
Call by Reference: Yes
ADDTTX - BAPI Structure for Teletex Numbers (Bus. Address Services)
Data type: BAPIADTTXOptional: Yes
Call by Reference: Yes
ADDTLX - BAPI Structure for Telex Numbers (Business Address Services)
Data type: BAPIADTLXOptional: Yes
Call by Reference: Yes
ADDSMTP - BAPI Structure for E-Mail Addresses (Bus. Address Services)
Data type: BAPIADSMTPOptional: Yes
Call by Reference: Yes
ADDRML - BAPI Structure for RML Addresses (Business Address Services)
Data type: BAPIADRMLOptional: Yes
Call by Reference: Yes
ADDX400 - BAPI Structure for X.400 Addresses (Bus. Address Services)
Data type: BAPIADX400Optional: Yes
Call by Reference: Yes
Copy and paste ABAP code example for /VIRSA/BAPI_USER_CREATE Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lt_parameter | TYPE STANDARD TABLE OF BAPIPARAM, " | |||
| lv_gen_password | TYPE CHAR1, " | |||
| lv_generate_password | TYPE XUNCODE, " | |||
| lt_addrfc | TYPE STANDARD TABLE OF BAPIADRFC, " | |||
| lv_ref_user | TYPE BAPIREFUS, " | |||
| lv_alias | TYPE BAPIALIAS, " | |||
| lt_addprt | TYPE STANDARD TABLE OF BAPIADPRT, " | |||
| lt_addssf | TYPE STANDARD TABLE OF BAPIADSSF, " | |||
| lv_ex_address | TYPE BAPIADDR3-PERS_NO, " | |||
| lt_adduri | TYPE STANDARD TABLE OF BAPIADURI, " | |||
| lv_uclass | TYPE /VIRSA/BAPIUCLASS, " | |||
| lt_addpag | TYPE STANDARD TABLE OF BAPIADPAG, " | |||
| lv_force_system_assignment | TYPE BAPIFLAG-BAPIFLAG, " | |||
| lt_addcomrem | TYPE STANDARD TABLE OF BAPICOMREM, " | |||
| lv_password_length | TYPE I, " 8 | |||
| lt_groups | TYPE STANDARD TABLE OF BAPIGROUPS, " | |||
| lt_parameter1 | TYPE STANDARD TABLE OF BAPIPARAM1, " | |||
| lt_extidhead | TYPE STANDARD TABLE OF /VIRSA/BAPIUSEXTIDHEAD, " | |||
| lt_extidpart | TYPE STANDARD TABLE OF /VIRSA/BAPIUSEXTIDPART, " | |||
| lt_return | TYPE STANDARD TABLE OF BAPIRET2, " | |||
| lv_username | TYPE BAPIBNAME-BAPIBNAME, " | |||
| lt_addtel | TYPE STANDARD TABLE OF BAPIADTEL, " | |||
| lv_name_in | TYPE BAPIBNAME, " | |||
| lt_addfax | TYPE STANDARD TABLE OF BAPIADFAX, " | |||
| lv_logondata | TYPE BAPILOGOND, " | |||
| lt_addttx | TYPE STANDARD TABLE OF BAPIADTTX, " | |||
| lv_password | TYPE BAPIPWD, " | |||
| lt_addtlx | TYPE STANDARD TABLE OF BAPIADTLX, " | |||
| lv_defaults | TYPE /VIRSA/BAPIDEFAUL, " | |||
| lv_address | TYPE BAPIADDR3, " | |||
| lt_addsmtp | TYPE STANDARD TABLE OF BAPIADSMTP, " | |||
| lt_addrml | TYPE STANDARD TABLE OF BAPIADRML, " | |||
| lv_company | TYPE BAPIUSCOMP, " | |||
| lv_snc | TYPE BAPISNCU, " | |||
| lt_addx400 | TYPE STANDARD TABLE OF BAPIADX400. " |
|   CALL FUNCTION '/VIRSA/BAPI_USER_CREATE' "User Creation |
| EXPORTING | ||
| GEN_PASSWORD | = lv_gen_password | |
| REF_USER | = lv_ref_user | |
| ALIAS | = lv_alias | |
| EX_ADDRESS | = lv_ex_address | |
| UCLASS | = lv_uclass | |
| FORCE_SYSTEM_ASSIGNMENT | = lv_force_system_assignment | |
| PASSWORD_LENGTH | = lv_password_length | |
| USERNAME | = lv_username | |
| NAME_IN | = lv_name_in | |
| LOGONDATA | = lv_logondata | |
| PASSWORD | = lv_password | |
| DEFAULTS | = lv_defaults | |
| ADDRESS | = lv_address | |
| COMPANY | = lv_company | |
| SNC | = lv_snc | |
| IMPORTING | ||
| GENERATE_PASSWORD | = lv_generate_password | |
| TABLES | ||
| PARAMETER | = lt_parameter | |
| ADDRFC | = lt_addrfc | |
| ADDPRT | = lt_addprt | |
| ADDSSF | = lt_addssf | |
| ADDURI | = lt_adduri | |
| ADDPAG | = lt_addpag | |
| ADDCOMREM | = lt_addcomrem | |
| GROUPS | = lt_groups | |
| PARAMETER1 | = lt_parameter1 | |
| EXTIDHEAD | = lt_extidhead | |
| EXTIDPART | = lt_extidpart | |
| RETURN | = lt_return | |
| ADDTEL | = lt_addtel | |
| ADDFAX | = lt_addfax | |
| ADDTTX | = lt_addttx | |
| ADDTLX | = lt_addtlx | |
| ADDSMTP | = lt_addsmtp | |
| ADDRML | = lt_addrml | |
| ADDX400 | = lt_addx400 | |
| . " /VIRSA/BAPI_USER_CREATE | ||
ABAP code using 7.40 inline data declarations to call FM /VIRSA/BAPI_USER_CREATE
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.| "SELECT single PERS_NO FROM BAPIADDR3 INTO @DATA(ld_ex_address). | ||||
| "SELECT single BAPIFLAG FROM BAPIFLAG INTO @DATA(ld_force_system_assignment). | ||||
| DATA(ld_password_length) | = 8. | |||
| "SELECT single BAPIBNAME FROM BAPIBNAME INTO @DATA(ld_username). | ||||
Search for further information about these or an SAP related objects