/AWS1/IF_LXB=>PUTSLOTTYPE()¶
About PutSlotType¶
Creates a custom slot type or replaces an existing custom slot type.
To create a custom slot type, specify a name for the slot type and a set of enumeration values, which are the values that a slot of this type can assume. For more information, see how-it-works.
If you specify the name of an existing slot type, the fields in the
request replace the existing values in the $LATEST version of
the slot type. Amazon Lex removes the fields that you don't provide in the
request. If you don't specify required fields, Amazon Lex throws an exception.
When you update the $LATEST version of a slot type, if a bot
uses the $LATEST version of an intent that contains the slot
type, the bot's status field is set to
NOT_BUILT.
This operation requires permissions for the
lex:PutSlotType action.
Method Signature¶
METHODS /AWS1/IF_LXB~PUTSLOTTYPE
IMPORTING
!IV_NAME TYPE /AWS1/LXBSLOTTYPENAME OPTIONAL
!IV_DESCRIPTION TYPE /AWS1/LXBDESCRIPTION OPTIONAL
!IT_ENUMERATIONVALUES TYPE /AWS1/CL_LXBENUMERATIONVALUE=>TT_ENUMERATIONVALUES OPTIONAL
!IV_CHECKSUM TYPE /AWS1/LXBSTRING OPTIONAL
!IV_VALUESELECTIONSTRATEGY TYPE /AWS1/LXBSLOTVALUESELIONSTRAG OPTIONAL
!IV_CREATEVERSION TYPE /AWS1/LXBBOOLEAN OPTIONAL
!IV_PARENTSLOTTYPESIGNATURE TYPE /AWS1/LXBCUSTORBUILTINSLOTTY00 OPTIONAL
!IT_SLOTTYPECONFIGURATIONS TYPE /AWS1/CL_LXBSLOTTYPECONF=>TT_SLOTTYPECONFIGURATIONS OPTIONAL
RETURNING
VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_lxbputslottypersp
RAISING
/AWS1/CX_LXBBADREQUESTEX
/AWS1/CX_LXBCONFLICTEXCEPTION
/AWS1/CX_LXBINTERNALFAILUREEX
/AWS1/CX_LXBLIMITEXCEEDEDEX
/AWS1/CX_LXBPRECONDFAILEDEX
/AWS1/CX_LXBCLIENTEXC
/AWS1/CX_LXBSERVEREXC
/AWS1/CX_RT_TECHNICAL_GENERIC
/AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
iv_name TYPE /AWS1/LXBSLOTTYPENAME /AWS1/LXBSLOTTYPENAME¶
The name of the slot type. The name is not case sensitive.
The name can't match a built-in slot type name, or a built-in slot type name with "AMAZON." removed. For example, because there is a built-in slot type called
AMAZON.DATE, you can't create a custom slot type calledDATE.For a list of built-in slot types, see Slot Type Reference in the Alexa Skills Kit.
Optional arguments:¶
iv_description TYPE /AWS1/LXBDESCRIPTION /AWS1/LXBDESCRIPTION¶
A description of the slot type.
it_enumerationvalues TYPE /AWS1/CL_LXBENUMERATIONVALUE=>TT_ENUMERATIONVALUES TT_ENUMERATIONVALUES¶
A list of
EnumerationValueobjects that defines the values that the slot type can take. Each value can have a list ofsynonyms, which are additional values that help train the machine learning model about the values that it resolves for a slot.A regular expression slot type doesn't require enumeration values. All other slot types require a list of enumeration values.
When Amazon Lex resolves a slot value, it generates a resolution list that contains up to five possible values for the slot. If you are using a Lambda function, this resolution list is passed to the function. If you are not using a Lambda function you can choose to return the value that the user entered or the first value in the resolution list as the slot value. The
valueSelectionStrategyfield indicates the option to use.
iv_checksum TYPE /AWS1/LXBSTRING /AWS1/LXBSTRING¶
Identifies a specific revision of the
$LATESTversion.When you create a new slot type, leave the
checksumfield blank. If you specify a checksum you get aBadRequestExceptionexception.When you want to update a slot type, set the
checksumfield to the checksum of the most recent revision of the$LATESTversion. If you don't specify thechecksumfield, or if the checksum does not match the$LATESTversion, you get aPreconditionFailedExceptionexception.
iv_valueselectionstrategy TYPE /AWS1/LXBSLOTVALUESELIONSTRAG /AWS1/LXBSLOTVALUESELIONSTRAG¶
Determines the slot resolution strategy that Amazon Lex uses to return slot type values. The field can be set to one of the following values:
ORIGINAL_VALUE- Returns the value entered by the user, if the user value is similar to the slot value.
TOP_RESOLUTION- If there is a resolution list for the slot, return the first value in the resolution list as the slot type value. If there is no resolution list, null is returned.If you don't specify the
valueSelectionStrategy, the default isORIGINAL_VALUE.
iv_createversion TYPE /AWS1/LXBBOOLEAN /AWS1/LXBBOOLEAN¶
When set to
truea new numbered version of the slot type is created. This is the same as calling theCreateSlotTypeVersionoperation. If you do not specifycreateVersion, the default isfalse.
iv_parentslottypesignature TYPE /AWS1/LXBCUSTORBUILTINSLOTTY00 /AWS1/LXBCUSTORBUILTINSLOTTY00¶
The built-in slot type used as the parent of the slot type. When you define a parent slot type, the new slot type has all of the same configuration as the parent.
Only
AMAZON.AlphaNumericis supported.
it_slottypeconfigurations TYPE /AWS1/CL_LXBSLOTTYPECONF=>TT_SLOTTYPECONFIGURATIONS TT_SLOTTYPECONFIGURATIONS¶
Configuration information that extends the parent built-in slot type. The configuration is added to the settings for the parent slot type.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_lxbputslottypersp /AWS1/CL_LXBPUTSLOTTYPERSP¶
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->putslottype(
it_enumerationvalues = VALUE /aws1/cl_lxbenumerationvalue=>tt_enumerationvalues(
(
new /aws1/cl_lxbenumerationvalue(
it_synonyms = VALUE /aws1/cl_lxbsynonymlist_w=>tt_synonymlist(
( new /aws1/cl_lxbsynonymlist_w( |string| ) )
)
iv_value = |string|
)
)
)
it_slottypeconfigurations = VALUE /aws1/cl_lxbslottypeconf=>tt_slottypeconfigurations(
( new /aws1/cl_lxbslottypeconf( new /aws1/cl_lxbslottyperegexconf( |string| ) ) )
)
iv_checksum = |string|
iv_createversion = ABAP_TRUE
iv_description = |string|
iv_name = |string|
iv_parentslottypesignature = |string|
iv_valueselectionstrategy = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
lv_slottypename = lo_result->get_name( ).
lv_description = lo_result->get_description( ).
LOOP AT lo_result->get_enumerationvalues( ) into lo_row.
lo_row_1 = lo_row.
IF lo_row_1 IS NOT INITIAL.
lv_value = lo_row_1->get_value( ).
LOOP AT lo_row_1->get_synonyms( ) into lo_row_2.
lo_row_3 = lo_row_2.
IF lo_row_3 IS NOT INITIAL.
lv_value = lo_row_3->get_value( ).
ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
lv_timestamp = lo_result->get_lastupdateddate( ).
lv_timestamp = lo_result->get_createddate( ).
lv_version = lo_result->get_version( ).
lv_string = lo_result->get_checksum( ).
lv_slotvalueselectionstrat = lo_result->get_valueselectionstrategy( ).
lv_boolean = lo_result->get_createversion( ).
lv_customorbuiltinslottype = lo_result->get_parentslottypesignature( ).
LOOP AT lo_result->get_slottypeconfigurations( ) into lo_row_4.
lo_row_5 = lo_row_4.
IF lo_row_5 IS NOT INITIAL.
lo_slottyperegexconfigurat = lo_row_5->get_regexconfiguration( ).
IF lo_slottyperegexconfigurat IS NOT INITIAL.
lv_regexpattern = lo_slottyperegexconfigurat->get_pattern( ).
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
To Create a Slot Type¶
This example shows how to create a slot type that describes pizza sauces.
DATA(lo_result) = lo_client->putslottype(
it_enumerationvalues = VALUE /aws1/cl_lxbenumerationvalue=>tt_enumerationvalues(
( new /aws1/cl_lxbenumerationvalue( iv_value = |red| ) )
( new /aws1/cl_lxbenumerationvalue( iv_value = |white| ) )
)
iv_description = |Available pizza sauces|
iv_name = |PizzaSauceType|
).