/AWS1/IF_CGP=>CREATEUSERPOOL()¶
About CreateUserPool¶
Creates a new Amazon Cognito user pool. This operation sets basic and advanced configuration options.
If you don't provide a value for an attribute, Amazon Cognito sets it to its default value.
This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint. Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in.
If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Services service, Amazon Simple Notification Service might place your account in the SMS sandbox. In sandbox mode , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide.
Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy.
Learn more
Method Signature¶
METHODS /AWS1/IF_CGP~CREATEUSERPOOL
  IMPORTING
    !IV_POOLNAME TYPE /AWS1/CGPUSERPOOLNAMETYPE OPTIONAL
    !IO_POLICIES TYPE REF TO /AWS1/CL_CGPUSERPOOLPOLICYTYPE OPTIONAL
    !IV_DELETIONPROTECTION TYPE /AWS1/CGPDELETIONPROTECTIONT00 OPTIONAL
    !IO_LAMBDACONFIG TYPE REF TO /AWS1/CL_CGPLAMBDACONFIGTYPE OPTIONAL
    !IT_AUTOVERIFIEDATTRIBUTES TYPE /AWS1/CL_CGPVERIFIEDATTRSLST00=>TT_VERIFIEDATTRIBUTESLISTTYPE OPTIONAL
    !IT_ALIASATTRIBUTES TYPE /AWS1/CL_CGPALIASATTRSLSTTYP00=>TT_ALIASATTRIBUTESLISTTYPE OPTIONAL
    !IT_USERNAMEATTRIBUTES TYPE /AWS1/CL_CGPUSERNAMEATTRSLST00=>TT_USERNAMEATTRIBUTESLISTTYPE OPTIONAL
    !IV_SMSVERIFICATIONMESSAGE TYPE /AWS1/CGPSMSVERIFICATIONMSGT00 OPTIONAL
    !IV_EMAILVERIFICATIONMESSAGE TYPE /AWS1/CGPEMAILVERIFICATIONMS00 OPTIONAL
    !IV_EMAILVERIFICATIONSUBJECT TYPE /AWS1/CGPEMAILVERIFICATIONSU00 OPTIONAL
    !IO_VERIFICATIONMESSAGETMPL TYPE REF TO /AWS1/CL_CGPVERIFICATIONMSGT00 OPTIONAL
    !IV_SMSAUTHENTICATIONMESSAGE TYPE /AWS1/CGPSMSVERIFICATIONMSGT00 OPTIONAL
    !IV_MFACONFIGURATION TYPE /AWS1/CGPUSERPOOLMFATYPE OPTIONAL
    !IO_USERATTRUPDATESETTINGS TYPE REF TO /AWS1/CL_CGPUSERATTRUPSTGSTYPE OPTIONAL
    !IO_DEVICECONFIGURATION TYPE REF TO /AWS1/CL_CGPDEVICECONFTYPE OPTIONAL
    !IO_EMAILCONFIGURATION TYPE REF TO /AWS1/CL_CGPEMAILCONFTYPE OPTIONAL
    !IO_SMSCONFIGURATION TYPE REF TO /AWS1/CL_CGPSMSCONFTYPE OPTIONAL
    !IT_USERPOOLTAGS TYPE /AWS1/CL_CGPUSERPOOLTAGSTYPE_W=>TT_USERPOOLTAGSTYPE OPTIONAL
    !IO_ADMINCREATEUSERCONFIG TYPE REF TO /AWS1/CL_CGPADMINCREUSERCFGT00 OPTIONAL
    !IT_SCHEMA TYPE /AWS1/CL_CGPSCHEMAATTRTYPE=>TT_SCHEMAATTRIBUTESLISTTYPE OPTIONAL
    !IO_USERPOOLADDONS TYPE REF TO /AWS1/CL_CGPUSERPOOLADDONSTYPE OPTIONAL
    !IO_USERNAMECONFIGURATION TYPE REF TO /AWS1/CL_CGPUSERNAMECONFTYPE OPTIONAL
    !IO_ACCOUNTRECOVERYSETTING TYPE REF TO /AWS1/CL_CGPACCTRECSETTINGTYPE OPTIONAL
    !IV_USERPOOLTIER TYPE /AWS1/CGPUSERPOOLTIERTYPE OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_cgpcreateuserpoolrsp
  RAISING
    /AWS1/CX_CGPFTUNAVINTIEREX
    /AWS1/CX_CGPINTERNALERROREX
    /AWS1/CX_CGPINVEMAILROLEACCP00
    /AWS1/CX_CGPINVALIDPARAMETEREX
    /AWS1/CX_CGPINVSMSROLEACCPLYEX
    /AWS1/CX_CGPINVSMSROLETRUSTR00
    /AWS1/CX_CGPLIMITEXCEEDEDEX
    /AWS1/CX_CGPNOTAUTHORIZEDEX
    /AWS1/CX_CGPTIERCHANGENOTALW00
    /AWS1/CX_CGPTOOMANYREQUESTSEX
    /AWS1/CX_CGPUSERPOOLTAGGINGEX
    /AWS1/CX_CGPCLIENTEXC
    /AWS1/CX_CGPSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
iv_poolname TYPE /AWS1/CGPUSERPOOLNAMETYPE /AWS1/CGPUSERPOOLNAMETYPE¶
A friendly name for your user pool.
Optional arguments:¶
io_policies TYPE REF TO /AWS1/CL_CGPUSERPOOLPOLICYTYPE /AWS1/CL_CGPUSERPOOLPOLICYTYPE¶
The password policy and sign-in policy in the user pool. The password policy sets options like password complexity requirements and password history. The sign-in policy sets the options available to applications in choice-based authentication.
iv_deletionprotection TYPE /AWS1/CGPDELETIONPROTECTIONT00 /AWS1/CGPDELETIONPROTECTIONT00¶
When active,
DeletionProtectionprevents accidental deletion of your user pool. Before you can delete a user pool that you have protected against deletion, you must deactivate this feature.When you try to delete a protected user pool in a
DeleteUserPoolAPI request, Amazon Cognito returns anInvalidParameterExceptionerror. To delete a protected user pool, send a newDeleteUserPoolrequest after you deactivate deletion protection in anUpdateUserPoolAPI request.
io_lambdaconfig TYPE REF TO /AWS1/CL_CGPLAMBDACONFIGTYPE /AWS1/CL_CGPLAMBDACONFIGTYPE¶
A collection of user pool Lambda triggers. Amazon Cognito invokes triggers at several possible stages of authentication operations. Triggers can modify the outcome of the operations that invoked them.
it_autoverifiedattributes TYPE /AWS1/CL_CGPVERIFIEDATTRSLST00=>TT_VERIFIEDATTRIBUTESLISTTYPE TT_VERIFIEDATTRIBUTESLISTTYPE¶
The attributes that you want your user pool to automatically verify. For more information, see Verifying contact information at sign-up.
it_aliasattributes TYPE /AWS1/CL_CGPALIASATTRSLSTTYP00=>TT_ALIASATTRIBUTESLISTTYPE TT_ALIASATTRIBUTESLISTTYPE¶
Attributes supported as an alias for this user pool. For more information about alias attributes, see Customizing sign-in attributes.
it_usernameattributes TYPE /AWS1/CL_CGPUSERNAMEATTRSLST00=>TT_USERNAMEATTRIBUTESLISTTYPE TT_USERNAMEATTRIBUTESLISTTYPE¶
Specifies whether a user can use an email address or phone number as a username when they sign up. For more information, see Customizing sign-in attributes.
iv_smsverificationmessage TYPE /AWS1/CGPSMSVERIFICATIONMSGT00 /AWS1/CGPSMSVERIFICATIONMSGT00¶
This parameter is no longer used.
iv_emailverificationmessage TYPE /AWS1/CGPEMAILVERIFICATIONMS00 /AWS1/CGPEMAILVERIFICATIONMS00¶
This parameter is no longer used.
iv_emailverificationsubject TYPE /AWS1/CGPEMAILVERIFICATIONSU00 /AWS1/CGPEMAILVERIFICATIONSU00¶
This parameter is no longer used.
io_verificationmessagetmpl TYPE REF TO /AWS1/CL_CGPVERIFICATIONMSGT00 /AWS1/CL_CGPVERIFICATIONMSGT00¶
The template for the verification message that your user pool delivers to users who set an email address or phone number attribute.
Set the email message type that corresponds to your
DefaultEmailOptionselection. ForCONFIRM_WITH_LINK, specify anEmailMessageByLinkand leaveEmailMessageblank. ForCONFIRM_WITH_CODE, specify anEmailMessageand leaveEmailMessageByLinkblank. When you supply both parameters with either choice, Amazon Cognito returns an error.
iv_smsauthenticationmessage TYPE /AWS1/CGPSMSVERIFICATIONMSGT00 /AWS1/CGPSMSVERIFICATIONMSGT00¶
The contents of the SMS message that your user pool sends to users in SMS OTP and MFA authentication.
iv_mfaconfiguration TYPE /AWS1/CGPUSERPOOLMFATYPE /AWS1/CGPUSERPOOLMFATYPE¶
Sets multi-factor authentication (MFA) to be on, off, or optional. When
ON, all users must set up MFA before they can sign in. WhenOPTIONAL, your application must make a client-side determination of whether a user wants to register an MFA device. For user pools with adaptive authentication with threat protection, chooseOPTIONAL.When
MfaConfigurationisOPTIONAL, managed login doesn't automatically prompt users to set up MFA. Amazon Cognito generates MFA prompts in API responses and in managed login for users who have chosen and configured a preferred MFA factor.
io_userattrupdatesettings TYPE REF TO /AWS1/CL_CGPUSERATTRUPSTGSTYPE /AWS1/CL_CGPUSERATTRUPSTGSTYPE¶
The settings for updates to user attributes. These settings include the property
AttributesRequireVerificationBeforeUpdate, a user-pool setting that tells Amazon Cognito how to handle changes to the value of your users' email address and phone number attributes. For more information, see Verifying updates to email addresses and phone numbers.
io_deviceconfiguration TYPE REF TO /AWS1/CL_CGPDEVICECONFTYPE /AWS1/CL_CGPDEVICECONFTYPE¶
The device-remembering configuration for a user pool. Device remembering or device tracking is a "Remember me on this device" option for user pools that perform authentication with the device key of a trusted device in the back end, instead of a user-provided MFA code. For more information about device authentication, see Working with user devices in your user pool. A null value indicates that you have deactivated device remembering in your user pool.
When you provide a value for any
DeviceConfigurationfield, you activate the Amazon Cognito device-remembering feature. For more information, see Working with devices.
io_emailconfiguration TYPE REF TO /AWS1/CL_CGPEMAILCONFTYPE /AWS1/CL_CGPEMAILCONFTYPE¶
The email configuration of your user pool. The email configuration type sets your preferred sending method, Amazon Web Services Region, and sender for messages from your user pool.
io_smsconfiguration TYPE REF TO /AWS1/CL_CGPSMSCONFTYPE /AWS1/CL_CGPSMSCONFTYPE¶
The settings for your Amazon Cognito user pool to send SMS messages with Amazon Simple Notification Service. To send SMS messages with Amazon SNS in the Amazon Web Services Region that you want, the Amazon Cognito user pool uses an Identity and Access Management (IAM) role in your Amazon Web Services account. For more information see SMS message settings.
it_userpooltags TYPE /AWS1/CL_CGPUSERPOOLTAGSTYPE_W=>TT_USERPOOLTAGSTYPE TT_USERPOOLTAGSTYPE¶
The tag keys and values to assign to the user pool. A tag is a label that you can use to categorize and manage user pools in different ways, such as by purpose, owner, environment, or other criteria.
io_admincreateuserconfig TYPE REF TO /AWS1/CL_CGPADMINCREUSERCFGT00 /AWS1/CL_CGPADMINCREUSERCFGT00¶
The configuration for administrative creation of users. Includes the template for the invitation message for new users, the duration of temporary passwords, and permitting self-service sign-up.
it_schema TYPE /AWS1/CL_CGPSCHEMAATTRTYPE=>TT_SCHEMAATTRIBUTESLISTTYPE TT_SCHEMAATTRIBUTESLISTTYPE¶
An array of attributes for the new user pool. You can add custom attributes and modify the properties of default attributes. The specifications in this parameter set the required attributes in your user pool. For more information, see Working with user attributes.
io_userpooladdons TYPE REF TO /AWS1/CL_CGPUSERPOOLADDONSTYPE /AWS1/CL_CGPUSERPOOLADDONSTYPE¶
Contains settings for activation of threat protection, including the operating mode and additional authentication types. To log user security information but take no action, set to
AUDIT. To configure automatic security responses to potentially unwanted traffic to your user pool, set toENFORCED.For more information, see Adding advanced security to a user pool. To activate this setting, your user pool must be on the Plus tier.
io_usernameconfiguration TYPE REF TO /AWS1/CL_CGPUSERNAMECONFTYPE /AWS1/CL_CGPUSERNAMECONFTYPE¶
Sets the case sensitivity option for sign-in usernames. When
CaseSensitiveisfalse(case insensitive), users can sign in with any combination of capital and lowercase letters. For example,username,USERNAME, orUserName, or for email,email@example.comorEMaiL@eXamplE.Com. For most use cases, set case sensitivity tofalseas a best practice. When usernames and email addresses are case insensitive, Amazon Cognito treats any variation in case as the same user, and prevents a case variation from being assigned to the same attribute for a different user.When
CaseSensitiveistrue(case sensitive), Amazon Cognito interpretsUSERNAMEandUserNameas distinct users.This configuration is immutable after you set it.
io_accountrecoverysetting TYPE REF TO /AWS1/CL_CGPACCTRECSETTINGTYPE /AWS1/CL_CGPACCTRECSETTINGTYPE¶
The available verified method a user can use to recover their password when they call
ForgotPassword. You can use this setting to define a preferred method when a user has more than one method available. With this setting, SMS doesn't qualify for a valid password recovery mechanism if the user also has SMS multi-factor authentication (MFA) activated. Email MFA is also disqualifying for account recovery with email. In the absence of this setting, Amazon Cognito uses the legacy behavior to determine the recovery method where SMS is preferred over email.As a best practice, configure both
verified_emailandverified_phone_number, with one having a higher priority than the other.
iv_userpooltier TYPE /AWS1/CGPUSERPOOLTIERTYPE /AWS1/CGPUSERPOOLTIERTYPE¶
The user pool feature plan, or tier. This parameter determines the eligibility of the user pool for features like managed login, access-token customization, and threat protection. Defaults to
ESSENTIALS.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_cgpcreateuserpoolrsp /AWS1/CL_CGPCREATEUSERPOOLRSP¶
Domain /AWS1/RT_ACCOUNT_ID Primitive Type NUMC 
Examples¶
Syntax Example¶
This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.
DATA(lo_result) = lo_client->createuserpool(
  io_accountrecoverysetting = new /aws1/cl_cgpacctrecsettingtype(
    it_recoverymechanisms = VALUE /aws1/cl_cgprecoveryoptiontype=>tt_recoverymechanismstype(
      (
        new /aws1/cl_cgprecoveryoptiontype(
          iv_name = |string|
          iv_priority = 123
        )
      )
    )
  )
  io_admincreateuserconfig = new /aws1/cl_cgpadmincreusercfgt00(
    io_invitemessagetemplate = new /aws1/cl_cgpmessagetmpltype(
      iv_emailmessage = |string|
      iv_emailsubject = |string|
      iv_smsmessage = |string|
    )
    iv_allowadmincreateuseronly = ABAP_TRUE
    iv_unusedaccountvaliditydays = 123
  )
  io_deviceconfiguration = new /aws1/cl_cgpdeviceconftype(
    iv_challengerequiredonnewdev = ABAP_TRUE
    iv_devonlyrememberedonuser00 = ABAP_TRUE
  )
  io_emailconfiguration = new /aws1/cl_cgpemailconftype(
    iv_configurationset = |string|
    iv_emailsendingaccount = |string|
    iv_from = |string|
    iv_replytoemailaddress = |string|
    iv_sourcearn = |string|
  )
  io_lambdaconfig = new /aws1/cl_cgplambdaconfigtype(
    io_customemailsender = new /aws1/cl_cgpcustemaillambdav00(
      iv_lambdaarn = |string|
      iv_lambdaversion = |string|
    )
    io_customsmssender = new /aws1/cl_cgpcustsmslambdavrs00(
      iv_lambdaarn = |string|
      iv_lambdaversion = |string|
    )
    io_pretokengenerationconfig = new /aws1/cl_cgppretokgeneration00(
      iv_lambdaarn = |string|
      iv_lambdaversion = |string|
    )
    iv_createauthchallenge = |string|
    iv_custommessage = |string|
    iv_defineauthchallenge = |string|
    iv_kmskeyid = |string|
    iv_postauthentication = |string|
    iv_postconfirmation = |string|
    iv_preauthentication = |string|
    iv_presignup = |string|
    iv_pretokengeneration = |string|
    iv_usermigration = |string|
    iv_verifyauthchallengersp = |string|
  )
  io_policies = new /aws1/cl_cgpuserpoolpolicytype(
    io_passwordpolicy = new /aws1/cl_cgppasswordpolicytype(
      iv_minimumlength = 123
      iv_passwordhistorysize = 123
      iv_requirelowercase = ABAP_TRUE
      iv_requirenumbers = ABAP_TRUE
      iv_requiresymbols = ABAP_TRUE
      iv_requireuppercase = ABAP_TRUE
      iv_temporarypasswordvalidi00 = 123
    )
    io_signinpolicy = new /aws1/cl_cgpsigninpolicytype(
      it_allowedfirstauthfactors = VALUE /aws1/cl_cgpalwedfirstauthfa00=>tt_alwedfirstauthfactorslstt00(
        ( new /aws1/cl_cgpalwedfirstauthfa00( |string| ) )
      )
    )
  )
  io_smsconfiguration = new /aws1/cl_cgpsmsconftype(
    iv_externalid = |string|
    iv_snscallerarn = |string|
    iv_snsregion = |string|
  )
  io_userattrupdatesettings = new /aws1/cl_cgpuserattrupstgstype(
    it_attrsrequireverificatio00 = VALUE /aws1/cl_cgpattrsrequireveri00=>tt_attrsrequireverificationb00(
      ( new /aws1/cl_cgpattrsrequireveri00( |string| ) )
    )
  )
  io_usernameconfiguration = new /aws1/cl_cgpusernameconftype( ABAP_TRUE )
  io_userpooladdons = new /aws1/cl_cgpuserpooladdonstype(
    io_advancedsecurityaddlflows = new /aws1/cl_cgpadvancedsecaddlf00( |string| )
    iv_advancedsecuritymode = |string|
  )
  io_verificationmessagetmpl = new /aws1/cl_cgpverificationmsgt00(
    iv_defaultemailoption = |string|
    iv_emailmessage = |string|
    iv_emailmessagebylink = |string|
    iv_emailsubject = |string|
    iv_emailsubjectbylink = |string|
    iv_smsmessage = |string|
  )
  it_aliasattributes = VALUE /aws1/cl_cgpaliasattrslsttyp00=>tt_aliasattributeslisttype(
    ( new /aws1/cl_cgpaliasattrslsttyp00( |string| ) )
  )
  it_autoverifiedattributes = VALUE /aws1/cl_cgpverifiedattrslst00=>tt_verifiedattributeslisttype(
    ( new /aws1/cl_cgpverifiedattrslst00( |string| ) )
  )
  it_schema = VALUE /aws1/cl_cgpschemaattrtype=>tt_schemaattributeslisttype(
    (
      new /aws1/cl_cgpschemaattrtype(
        io_numberattributecnstrnts = new /aws1/cl_cgpnumberattrcnsstype(
          iv_maxvalue = |string|
          iv_minvalue = |string|
        )
        io_stringattributecnstrnts = new /aws1/cl_cgpstringattrcnsstype(
          iv_maxlength = |string|
          iv_minlength = |string|
        )
        iv_attributedatatype = |string|
        iv_developeronlyattribute = ABAP_TRUE
        iv_mutable = ABAP_TRUE
        iv_name = |string|
        iv_required = ABAP_TRUE
      )
    )
  )
  it_usernameattributes = VALUE /aws1/cl_cgpusernameattrslst00=>tt_usernameattributeslisttype(
    ( new /aws1/cl_cgpusernameattrslst00( |string| ) )
  )
  it_userpooltags = VALUE /aws1/cl_cgpuserpooltagstype_w=>tt_userpooltagstype(
    (
      VALUE /aws1/cl_cgpuserpooltagstype_w=>ts_userpooltagstype_maprow(
        key = |string|
        value = new /aws1/cl_cgpuserpooltagstype_w( |string| )
      )
    )
  )
  iv_deletionprotection = |string|
  iv_emailverificationmessage = |string|
  iv_emailverificationsubject = |string|
  iv_mfaconfiguration = |string|
  iv_poolname = |string|
  iv_smsauthenticationmessage = |string|
  iv_smsverificationmessage = |string|
  iv_userpooltier = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lo_userpooltype = lo_result->get_userpool( ).
  IF lo_userpooltype IS NOT INITIAL.
    lv_userpoolidtype = lo_userpooltype->get_id( ).
    lv_userpoolnametype = lo_userpooltype->get_name( ).
    lo_userpoolpolicytype = lo_userpooltype->get_policies( ).
    IF lo_userpoolpolicytype IS NOT INITIAL.
      lo_passwordpolicytype = lo_userpoolpolicytype->get_passwordpolicy( ).
      IF lo_passwordpolicytype IS NOT INITIAL.
        lv_passwordpolicyminlength = lo_passwordpolicytype->get_minimumlength( ).
        lv_booleantype = lo_passwordpolicytype->get_requireuppercase( ).
        lv_booleantype = lo_passwordpolicytype->get_requirelowercase( ).
        lv_booleantype = lo_passwordpolicytype->get_requirenumbers( ).
        lv_booleantype = lo_passwordpolicytype->get_requiresymbols( ).
        lv_passwordhistorysizetype = lo_passwordpolicytype->get_passwordhistorysize( ).
        lv_temporarypasswordvalidi = lo_passwordpolicytype->get_temporarypasswordvalid00( ).
      ENDIF.
      lo_signinpolicytype = lo_userpoolpolicytype->get_signinpolicy( ).
      IF lo_signinpolicytype IS NOT INITIAL.
        LOOP AT lo_signinpolicytype->get_allowedfirstauthfactors( ) into lo_row.
          lo_row_1 = lo_row.
          IF lo_row_1 IS NOT INITIAL.
            lv_authfactortype = lo_row_1->get_value( ).
          ENDIF.
        ENDLOOP.
      ENDIF.
    ENDIF.
    lv_deletionprotectiontype = lo_userpooltype->get_deletionprotection( ).
    lo_lambdaconfigtype = lo_userpooltype->get_lambdaconfig( ).
    IF lo_lambdaconfigtype IS NOT INITIAL.
      lv_arntype = lo_lambdaconfigtype->get_presignup( ).
      lv_arntype = lo_lambdaconfigtype->get_custommessage( ).
      lv_arntype = lo_lambdaconfigtype->get_postconfirmation( ).
      lv_arntype = lo_lambdaconfigtype->get_preauthentication( ).
      lv_arntype = lo_lambdaconfigtype->get_postauthentication( ).
      lv_arntype = lo_lambdaconfigtype->get_defineauthchallenge( ).
      lv_arntype = lo_lambdaconfigtype->get_createauthchallenge( ).
      lv_arntype = lo_lambdaconfigtype->get_verifyauthchallengersp( ).
      lv_arntype = lo_lambdaconfigtype->get_pretokengeneration( ).
      lv_arntype = lo_lambdaconfigtype->get_usermigration( ).
      lo_pretokengenerationversi = lo_lambdaconfigtype->get_pretokengenerationconfig( ).
      IF lo_pretokengenerationversi IS NOT INITIAL.
        lv_pretokengenerationlambd = lo_pretokengenerationversi->get_lambdaversion( ).
        lv_arntype = lo_pretokengenerationversi->get_lambdaarn( ).
      ENDIF.
      lo_customsmslambdaversionc = lo_lambdaconfigtype->get_customsmssender( ).
      IF lo_customsmslambdaversionc IS NOT INITIAL.
        lv_customsmssenderlambdave = lo_customsmslambdaversionc->get_lambdaversion( ).
        lv_arntype = lo_customsmslambdaversionc->get_lambdaarn( ).
      ENDIF.
      lo_customemaillambdaversio = lo_lambdaconfigtype->get_customemailsender( ).
      IF lo_customemaillambdaversio IS NOT INITIAL.
        lv_customemailsenderlambda = lo_customemaillambdaversio->get_lambdaversion( ).
        lv_arntype = lo_customemaillambdaversio->get_lambdaarn( ).
      ENDIF.
      lv_arntype = lo_lambdaconfigtype->get_kmskeyid( ).
    ENDIF.
    lv_statustype = lo_userpooltype->get_status( ).
    lv_datetype = lo_userpooltype->get_lastmodifieddate( ).
    lv_datetype = lo_userpooltype->get_creationdate( ).
    LOOP AT lo_userpooltype->get_schemaattributes( ) into lo_row_2.
      lo_row_3 = lo_row_2.
      IF lo_row_3 IS NOT INITIAL.
        lv_customattributenametype = lo_row_3->get_name( ).
        lv_attributedatatype = lo_row_3->get_attributedatatype( ).
        lv_booleantype = lo_row_3->get_developeronlyattribute( ).
        lv_booleantype = lo_row_3->get_mutable( ).
        lv_booleantype = lo_row_3->get_required( ).
        lo_numberattributeconstrai = lo_row_3->get_numberattributecnstrnts( ).
        IF lo_numberattributeconstrai IS NOT INITIAL.
          lv_stringtype = lo_numberattributeconstrai->get_minvalue( ).
          lv_stringtype = lo_numberattributeconstrai->get_maxvalue( ).
        ENDIF.
        lo_stringattributeconstrai = lo_row_3->get_stringattributecnstrnts( ).
        IF lo_stringattributeconstrai IS NOT INITIAL.
          lv_stringtype = lo_stringattributeconstrai->get_minlength( ).
          lv_stringtype = lo_stringattributeconstrai->get_maxlength( ).
        ENDIF.
      ENDIF.
    ENDLOOP.
    LOOP AT lo_userpooltype->get_autoverifiedattributes( ) into lo_row_4.
      lo_row_5 = lo_row_4.
      IF lo_row_5 IS NOT INITIAL.
        lv_verifiedattributetype = lo_row_5->get_value( ).
      ENDIF.
    ENDLOOP.
    LOOP AT lo_userpooltype->get_aliasattributes( ) into lo_row_6.
      lo_row_7 = lo_row_6.
      IF lo_row_7 IS NOT INITIAL.
        lv_aliasattributetype = lo_row_7->get_value( ).
      ENDIF.
    ENDLOOP.
    LOOP AT lo_userpooltype->get_usernameattributes( ) into lo_row_8.
      lo_row_9 = lo_row_8.
      IF lo_row_9 IS NOT INITIAL.
        lv_usernameattributetype = lo_row_9->get_value( ).
      ENDIF.
    ENDLOOP.
    lv_smsverificationmessaget = lo_userpooltype->get_smsverificationmessage( ).
    lv_emailverificationmessag = lo_userpooltype->get_emailverificationmessage( ).
    lv_emailverificationsubjec = lo_userpooltype->get_emailverificationsubject( ).
    lo_verificationmessagetemp = lo_userpooltype->get_verificationmessagetmpl( ).
    IF lo_verificationmessagetemp IS NOT INITIAL.
      lv_smsverificationmessaget = lo_verificationmessagetemp->get_smsmessage( ).
      lv_emailverificationmessag = lo_verificationmessagetemp->get_emailmessage( ).
      lv_emailverificationsubjec = lo_verificationmessagetemp->get_emailsubject( ).
      lv_emailverificationmessag_1 = lo_verificationmessagetemp->get_emailmessagebylink( ).
      lv_emailverificationsubjec_1 = lo_verificationmessagetemp->get_emailsubjectbylink( ).
      lv_defaultemailoptiontype = lo_verificationmessagetemp->get_defaultemailoption( ).
    ENDIF.
    lv_smsverificationmessaget = lo_userpooltype->get_smsauthenticationmessage( ).
    lo_userattributeupdatesett = lo_userpooltype->get_userattrupdatesettings( ).
    IF lo_userattributeupdatesett IS NOT INITIAL.
      LOOP AT lo_userattributeupdatesett->get_attrsrequireverificati00( ) into lo_row_10.
        lo_row_11 = lo_row_10.
        IF lo_row_11 IS NOT INITIAL.
          lv_verifiedattributetype = lo_row_11->get_value( ).
        ENDIF.
      ENDLOOP.
    ENDIF.
    lv_userpoolmfatype = lo_userpooltype->get_mfaconfiguration( ).
    lo_deviceconfigurationtype = lo_userpooltype->get_deviceconfiguration( ).
    IF lo_deviceconfigurationtype IS NOT INITIAL.
      lv_booleantype = lo_deviceconfigurationtype->get_challengerequiredonnew00( ).
      lv_booleantype = lo_deviceconfigurationtype->get_devonlyrememberedonuse00( ).
    ENDIF.
    lv_integertype = lo_userpooltype->get_estimatednumberofusers( ).
    lo_emailconfigurationtype = lo_userpooltype->get_emailconfiguration( ).
    IF lo_emailconfigurationtype IS NOT INITIAL.
      lv_arntype = lo_emailconfigurationtype->get_sourcearn( ).
      lv_emailaddresstype = lo_emailconfigurationtype->get_replytoemailaddress( ).
      lv_emailsendingaccounttype = lo_emailconfigurationtype->get_emailsendingaccount( ).
      lv_stringtype = lo_emailconfigurationtype->get_from( ).
      lv_sesconfigurationset = lo_emailconfigurationtype->get_configurationset( ).
    ENDIF.
    lo_smsconfigurationtype = lo_userpooltype->get_smsconfiguration( ).
    IF lo_smsconfigurationtype IS NOT INITIAL.
      lv_arntype = lo_smsconfigurationtype->get_snscallerarn( ).
      lv_stringtype = lo_smsconfigurationtype->get_externalid( ).
      lv_regioncodetype = lo_smsconfigurationtype->get_snsregion( ).
    ENDIF.
    LOOP AT lo_userpooltype->get_userpooltags( ) into ls_row_12.
      lv_key = ls_row_12-key.
      lo_value = ls_row_12-value.
      IF lo_value IS NOT INITIAL.
        lv_tagvaluetype = lo_value->get_value( ).
      ENDIF.
    ENDLOOP.
    lv_stringtype = lo_userpooltype->get_smsconfigurationfailure( ).
    lv_stringtype = lo_userpooltype->get_emailconffailure( ).
    lv_domaintype = lo_userpooltype->get_domain( ).
    lv_domaintype = lo_userpooltype->get_customdomain( ).
    lo_admincreateuserconfigty = lo_userpooltype->get_admincreateuserconfig( ).
    IF lo_admincreateuserconfigty IS NOT INITIAL.
      lv_booleantype = lo_admincreateuserconfigty->get_allowadmincreateuseronly( ).
      lv_admincreateuserunusedac = lo_admincreateuserconfigty->get_unusedacctvaliditydays( ).
      lo_messagetemplatetype = lo_admincreateuserconfigty->get_invitemessagetemplate( ).
      IF lo_messagetemplatetype IS NOT INITIAL.
        lv_smsinvitemessagetype = lo_messagetemplatetype->get_smsmessage( ).
        lv_emailinvitemessagetype = lo_messagetemplatetype->get_emailmessage( ).
        lv_emailverificationsubjec = lo_messagetemplatetype->get_emailsubject( ).
      ENDIF.
    ENDIF.
    lo_userpooladdonstype = lo_userpooltype->get_userpooladdons( ).
    IF lo_userpooladdonstype IS NOT INITIAL.
      lv_advancedsecuritymodetyp = lo_userpooladdonstype->get_advancedsecuritymode( ).
      lo_advancedsecurityadditio = lo_userpooladdonstype->get_advancedsecaddlflows( ).
      IF lo_advancedsecurityadditio IS NOT INITIAL.
        lv_advancedsecurityenabled = lo_advancedsecurityadditio->get_customauthmode( ).
      ENDIF.
    ENDIF.
    lo_usernameconfigurationty = lo_userpooltype->get_usernameconfiguration( ).
    IF lo_usernameconfigurationty IS NOT INITIAL.
      lv_wrappedbooleantype = lo_usernameconfigurationty->get_casesensitive( ).
    ENDIF.
    lv_arntype = lo_userpooltype->get_arn( ).
    lo_accountrecoverysettingt = lo_userpooltype->get_accountrecoverysetting( ).
    IF lo_accountrecoverysettingt IS NOT INITIAL.
      LOOP AT lo_accountrecoverysettingt->get_recoverymechanisms( ) into lo_row_13.
        lo_row_14 = lo_row_13.
        IF lo_row_14 IS NOT INITIAL.
          lv_prioritytype = lo_row_14->get_priority( ).
          lv_recoveryoptionnametype = lo_row_14->get_name( ).
        ENDIF.
      ENDLOOP.
    ENDIF.
    lv_userpooltiertype = lo_userpooltype->get_userpooltier( ).
  ENDIF.
ENDIF.
Example user pool with email and username sign-in¶
The following example creates a user pool with all configurable properties set to an example value. The resulting user pool allows sign-in with username or email address, has optional MFA, and has a Lambda function assigned to each possible trigger.
DATA(lo_result) = lo_client->createuserpool(
  io_accountrecoverysetting = new /aws1/cl_cgpacctrecsettingtype(
    it_recoverymechanisms = VALUE /aws1/cl_cgprecoveryoptiontype=>tt_recoverymechanismstype(
      (
        new /aws1/cl_cgprecoveryoptiontype(
          iv_name = |verified_email|
          iv_priority = 1
        )
      )
    )
  )
  io_admincreateuserconfig = new /aws1/cl_cgpadmincreusercfgt00(
    io_invitemessagetemplate = new /aws1/cl_cgpmessagetmpltype(
      iv_emailmessage = |Your username is {username} and temporary password is {####}.|
      iv_emailsubject = |Your sign-in information|
      iv_smsmessage = |Your username is {username} and temporary password is {####}.|
    )
    iv_allowadmincreateuseronly = ABAP_FALSE
  )
  io_deviceconfiguration = new /aws1/cl_cgpdeviceconftype(
    iv_challengerequiredonnewdev = ABAP_TRUE
    iv_devonlyrememberedonuser00 = ABAP_TRUE
  )
  io_emailconfiguration = new /aws1/cl_cgpemailconftype(
    iv_configurationset = |my-test-ses-configuration-set|
    iv_emailsendingaccount = |DEVELOPER|
    iv_from = |support@example.com|
    iv_replytoemailaddress = |support@example.com|
    iv_sourcearn = |arn:aws:ses:us-east-1:123456789012:identity/support@example.com|
  )
  io_lambdaconfig = new /aws1/cl_cgplambdaconfigtype(
    io_customemailsender = new /aws1/cl_cgpcustemaillambdav00(
      iv_lambdaarn = |arn:aws:lambda:us-east-1:123456789012:function:MyFunction|
      iv_lambdaversion = |V1_0|
    )
    io_customsmssender = new /aws1/cl_cgpcustsmslambdavrs00(
      iv_lambdaarn = |arn:aws:lambda:us-east-1:123456789012:function:MyFunction|
      iv_lambdaversion = |V1_0|
    )
    iv_custommessage = |arn:aws:lambda:us-east-1:123456789012:function:MyFunction|
    iv_defineauthchallenge = |arn:aws:lambda:us-east-1:123456789012:function:MyFunction|
    iv_kmskeyid = |arn:aws:kms:us-east-1:123456789012:key/a6c4f8e2-0c45-47db-925f-87854bc9e357|
    iv_postauthentication = |arn:aws:lambda:us-east-1:123456789012:function:MyFunction|
    iv_postconfirmation = |arn:aws:lambda:us-east-1:123456789012:function:MyFunction|
    iv_preauthentication = |arn:aws:lambda:us-east-1:123456789012:function:MyFunction|
    iv_presignup = |arn:aws:lambda:us-east-1:123456789012:function:MyFunction|
    iv_pretokengeneration = |arn:aws:lambda:us-east-1:123456789012:function:MyFunction|
    iv_usermigration = |arn:aws:lambda:us-east-1:123456789012:function:MyFunction|
    iv_verifyauthchallengersp = |arn:aws:lambda:us-east-1:123456789012:function:MyFunction|
  )
  io_policies = new /aws1/cl_cgpuserpoolpolicytype(
    io_passwordpolicy = new /aws1/cl_cgppasswordpolicytype(
      iv_minimumlength = 6
      iv_requirelowercase = ABAP_TRUE
      iv_requirenumbers = ABAP_TRUE
      iv_requiresymbols = ABAP_TRUE
      iv_requireuppercase = ABAP_TRUE
      iv_temporarypasswordvalidi00 = 7
    )
  )
  io_smsconfiguration = new /aws1/cl_cgpsmsconftype(
    iv_externalid = |my-role-external-id|
    iv_snscallerarn = |arn:aws:iam::123456789012:role/service-role/test-cognito-SMS-Role|
  )
  io_userattrupdatesettings = new /aws1/cl_cgpuserattrupstgstype(
    it_attrsrequireverificatio00 = VALUE /aws1/cl_cgpattrsrequireveri00=>tt_attrsrequireverificationb00(
      ( new /aws1/cl_cgpattrsrequireveri00( |email| ) )
    )
  )
  io_usernameconfiguration = new /aws1/cl_cgpusernameconftype( ABAP_TRUE )
  io_userpooladdons = new /aws1/cl_cgpuserpooladdonstype( iv_advancedsecuritymode = |OFF| )
  io_verificationmessagetmpl = new /aws1/cl_cgpverificationmsgt00(
    iv_defaultemailoption = |CONFIRM_WITH_CODE|
    iv_emailmessage = |Your confirmation code is {####}|
    iv_emailmessagebylink = |Choose this link to {##verify your email##}|
    iv_emailsubject = |Here is your confirmation code|
    iv_emailsubjectbylink = |Here is your confirmation link|
    iv_smsmessage = |Your confirmation code is {####}|
  )
  it_aliasattributes = VALUE /aws1/cl_cgpaliasattrslsttyp00=>tt_aliasattributeslisttype(
    ( new /aws1/cl_cgpaliasattrslsttyp00( |email| ) )
  )
  it_autoverifiedattributes = VALUE /aws1/cl_cgpverifiedattrslst00=>tt_verifiedattributeslisttype(
    ( new /aws1/cl_cgpverifiedattrslst00( |email| ) )
  )
  it_schema = VALUE /aws1/cl_cgpschemaattrtype=>tt_schemaattributeslisttype(
    (
      new /aws1/cl_cgpschemaattrtype(
        io_numberattributecnstrnts = new /aws1/cl_cgpnumberattrcnsstype(
          iv_maxvalue = |99|
          iv_minvalue = |1|
        )
        io_stringattributecnstrnts = new /aws1/cl_cgpstringattrcnsstype(
          iv_maxlength = |99|
          iv_minlength = |1|
        )
        iv_attributedatatype = |Number|
        iv_developeronlyattribute = ABAP_TRUE
        iv_mutable = ABAP_TRUE
        iv_name = |mydev|
        iv_required = ABAP_FALSE
      )
    )
  )
  it_userpooltags = VALUE /aws1/cl_cgpuserpooltagstype_w=>tt_userpooltagstype(
    (
      VALUE /aws1/cl_cgpuserpooltagstype_w=>ts_userpooltagstype_maprow(
        key = |my-test-tag-key|
        value = new /aws1/cl_cgpuserpooltagstype_w( |my-test-tag-key| )
      )
    )
  )
  iv_deletionprotection = |ACTIVE|
  iv_emailverificationmessage = |Your verification code is {####}.|
  iv_emailverificationsubject = |Verify your email address|
  iv_mfaconfiguration = |OPTIONAL|
  iv_poolname = |my-test-user-pool|
  iv_smsauthenticationmessage = |Your verification code is {####}.|
  iv_smsverificationmessage = |Your verification code is {####}.|
).