Hay más ejemplos de AWS SDK disponibles en el GitHub repositorio de ejemplos de AWS Doc SDK
Las traducciones son generadas a través de traducción automática. En caso de conflicto entre la traducción y la version original de inglés, prevalecerá la version en inglés.
Ejemplos de API de SMS y voz de Amazon Pinpoint con el SDK para SAP ABAP
Los siguientes ejemplos de código muestran cómo realizar acciones e implementar escenarios comunes mediante el uso del AWS SDK para SAP ABAP con la API de SMS y voz de Amazon Pinpoint.
Las acciones son extractos de código de programas más grandes y deben ejecutarse en contexto. Mientras las acciones muestran cómo llamar a las distintas funciones de servicio, es posible ver las acciones en contexto en los escenarios relacionados.
En cada ejemplo se incluye un enlace al código de origen completo, con instrucciones de configuración y ejecución del código en el contexto.
Temas
Acciones
En el siguiente ejemplo de código, se muestra cómo utilizar CreateConfigurationSet.
- SDK para SAP ABAP
-
nota
Hay más información al respecto. GitHub Busque el ejemplo completo y aprenda a configurar y ejecutar en el Repositorio de ejemplos de código de AWS
. TRY. " Create a new configuration set lo_pps->createconfigurationset( iv_configurationsetname = iv_configuration_set_name " e.g., 'my-config-set' ). MESSAGE 'Configuration set created successfully.' TYPE 'I'. CATCH /aws1/cx_ppsalreadyexistsex INTO DATA(lo_already_exists_ex). MESSAGE lo_already_exists_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_already_exists_ex. CATCH /aws1/cx_ppsbadrequestex INTO DATA(lo_bad_request_ex). MESSAGE lo_bad_request_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_bad_request_ex. CATCH /aws1/cx_ppsinternalsvcerrorex INTO DATA(lo_internal_error_ex). MESSAGE lo_internal_error_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_internal_error_ex. CATCH /aws1/cx_ppslimitexceededex INTO DATA(lo_limit_exceeded_ex). MESSAGE lo_limit_exceeded_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_limit_exceeded_ex. CATCH /aws1/cx_ppstoomanyrequestsex INTO DATA(lo_too_many_requests_ex). MESSAGE lo_too_many_requests_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_too_many_requests_ex. ENDTRY.-
Para obtener más información sobre la API, consulte CreateConfigurationSetla referencia sobre la API ABAP del AWS SDK para SAP.
-
En el siguiente ejemplo de código, se muestra cómo utilizar CreateConfigurationSetEventDestination.
- SDK para SAP ABAP
-
nota
Hay más información al respecto. GitHub Busque el ejemplo completo y aprenda a configurar y ejecutar en el Repositorio de ejemplos de código de AWS
. TRY. " Create event destination for the configuration set lo_pps->createconfseteventdst( iv_configurationsetname = iv_configuration_set_name " e.g., 'my-config-set' iv_eventdestinationname = iv_event_destination_name " e.g., 'my-event-dest' io_eventdestination = io_event_destination ). MESSAGE 'Event destination created successfully.' TYPE 'I'. CATCH /aws1/cx_ppsalreadyexistsex INTO DATA(lo_already_exists_ex). MESSAGE lo_already_exists_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_already_exists_ex. CATCH /aws1/cx_ppsnotfoundexception INTO DATA(lo_not_found_ex). MESSAGE lo_not_found_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_not_found_ex. CATCH /aws1/cx_ppsbadrequestex INTO DATA(lo_bad_request_ex). MESSAGE lo_bad_request_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_bad_request_ex. CATCH /aws1/cx_ppsinternalsvcerrorex INTO DATA(lo_internal_error_ex). MESSAGE lo_internal_error_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_internal_error_ex. CATCH /aws1/cx_ppslimitexceededex INTO DATA(lo_limit_exceeded_ex). MESSAGE lo_limit_exceeded_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_limit_exceeded_ex. CATCH /aws1/cx_ppstoomanyrequestsex INTO DATA(lo_too_many_requests_ex). MESSAGE lo_too_many_requests_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_too_many_requests_ex. ENDTRY.-
Para obtener más información sobre la API, consulte CreateConfigurationSetEventDestinationla referencia sobre la API ABAP del AWS SDK para SAP.
-
En el siguiente ejemplo de código, se muestra cómo utilizar DeleteConfigurationSet.
- SDK para SAP ABAP
-
nota
Hay más información al respecto. GitHub Busque el ejemplo completo y aprenda a configurar y ejecutar en el Repositorio de ejemplos de código de AWS
. TRY. " Delete the configuration set lo_pps->deleteconfigurationset( iv_configurationsetname = iv_configuration_set_name " e.g., 'my-config-set' ). MESSAGE 'Configuration set deleted successfully.' TYPE 'I'. CATCH /aws1/cx_ppsnotfoundexception INTO DATA(lo_not_found_ex). MESSAGE lo_not_found_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_not_found_ex. CATCH /aws1/cx_ppsbadrequestex INTO DATA(lo_bad_request_ex). MESSAGE lo_bad_request_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_bad_request_ex. CATCH /aws1/cx_ppsinternalsvcerrorex INTO DATA(lo_internal_error_ex). MESSAGE lo_internal_error_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_internal_error_ex. CATCH /aws1/cx_ppstoomanyrequestsex INTO DATA(lo_too_many_requests_ex). MESSAGE lo_too_many_requests_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_too_many_requests_ex. ENDTRY.-
Para obtener más información sobre la API, consulte DeleteConfigurationSetla referencia sobre la API ABAP del AWS SDK para SAP.
-
En el siguiente ejemplo de código, se muestra cómo utilizar DeleteConfigurationSetEventDestination.
- SDK para SAP ABAP
-
nota
Hay más información al respecto. GitHub Busque el ejemplo completo y aprenda a configurar y ejecutar en el Repositorio de ejemplos de código de AWS
. TRY. " Delete the event destination lo_pps->deleteconfseteventdst( iv_configurationsetname = iv_configuration_set_name " e.g., 'my-config-set' iv_eventdestinationname = iv_event_destination_name " e.g., 'my-event-dest' ). MESSAGE 'Event destination deleted successfully.' TYPE 'I'. CATCH /aws1/cx_ppsnotfoundexception INTO DATA(lo_not_found_ex). MESSAGE lo_not_found_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_not_found_ex. CATCH /aws1/cx_ppsbadrequestex INTO DATA(lo_bad_request_ex). MESSAGE lo_bad_request_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_bad_request_ex. CATCH /aws1/cx_ppsinternalsvcerrorex INTO DATA(lo_internal_error_ex). MESSAGE lo_internal_error_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_internal_error_ex. CATCH /aws1/cx_ppstoomanyrequestsex INTO DATA(lo_too_many_requests_ex). MESSAGE lo_too_many_requests_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_too_many_requests_ex. ENDTRY.-
Para obtener más información sobre la API, consulte DeleteConfigurationSetEventDestinationla referencia sobre la API ABAP del AWS SDK para SAP.
-
En el siguiente ejemplo de código, se muestra cómo utilizar GetConfigurationSetEventDestinations.
- SDK para SAP ABAP
-
nota
Hay más información al respecto. GitHub Busque el ejemplo completo y aprenda a configurar y ejecutar en el Repositorio de ejemplos de código de AWS
. TRY. " Get event destinations for the configuration set oo_result = lo_pps->getconfseteventdestinations( iv_configurationsetname = iv_configuration_set_name " e.g., 'my-config-set' ). " Process the event destinations LOOP AT oo_result->get_eventdestinations( ) INTO DATA(lo_event_dest). DATA(lv_dest_name) = lo_event_dest->get_name( ). DATA(lv_enabled) = lo_event_dest->get_enabled( ). MESSAGE |Event destination: { lv_dest_name }, Enabled: { lv_enabled }| TYPE 'I'. " Check for CloudWatch Logs destination DATA(lo_cloudwatch_dest) = lo_event_dest->get_cloudwatchlogsdst( ). IF lo_cloudwatch_dest IS NOT INITIAL. DATA(lv_log_group_arn) = lo_cloudwatch_dest->get_loggrouparn( ). MESSAGE | CloudWatch Logs destination: { lv_log_group_arn }| TYPE 'I'. ENDIF. " Check for Kinesis Firehose destination DATA(lo_firehose_dest) = lo_event_dest->get_kinesisfirehosedst( ). IF lo_firehose_dest IS NOT INITIAL. DATA(lv_delivery_stream) = lo_firehose_dest->get_deliverystreamarn( ). MESSAGE | Kinesis Firehose destination: { lv_delivery_stream }| TYPE 'I'. ENDIF. " Check for SNS destination DATA(lo_sns_dest) = lo_event_dest->get_snsdestination( ). IF lo_sns_dest IS NOT INITIAL. DATA(lv_topic_arn) = lo_sns_dest->get_topicarn( ). MESSAGE | SNS destination: { lv_topic_arn }| TYPE 'I'. ENDIF. ENDLOOP. CATCH /aws1/cx_ppsnotfoundexception INTO DATA(lo_not_found_ex). MESSAGE lo_not_found_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_not_found_ex. CATCH /aws1/cx_ppsbadrequestex INTO DATA(lo_bad_request_ex). MESSAGE lo_bad_request_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_bad_request_ex. CATCH /aws1/cx_ppsinternalsvcerrorex INTO DATA(lo_internal_error_ex). MESSAGE lo_internal_error_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_internal_error_ex. CATCH /aws1/cx_ppstoomanyrequestsex INTO DATA(lo_too_many_requests_ex). MESSAGE lo_too_many_requests_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_too_many_requests_ex. ENDTRY.-
Para obtener más información sobre la API, consulte GetConfigurationSetEventDestinationsla referencia sobre la API ABAP del AWS SDK para SAP.
-
En el siguiente ejemplo de código, se muestra cómo utilizar ListConfigurationSets.
- SDK para SAP ABAP
-
nota
Hay más información al respecto. GitHub Busque el ejemplo completo y aprenda a configurar y ejecutar en el Repositorio de ejemplos de código de AWS
. TRY. " List all configuration sets oo_result = lo_pps->listconfigurationsets( iv_nexttoken = iv_next_token " Optional: Token for pagination iv_pagesize = iv_page_size " Optional: Number of results per page, e.g., '10' ). " Process the configuration sets LOOP AT oo_result->get_configurationsets( ) INTO DATA(lo_config_set). DATA(lv_config_set_name) = lo_config_set->get_value( ). MESSAGE |Configuration set: { lv_config_set_name }| TYPE 'I'. ENDLOOP. " Check if there are more results DATA(lv_next_token) = oo_result->get_nexttoken( ). IF lv_next_token IS NOT INITIAL. MESSAGE |More results available. Next token: { lv_next_token }| TYPE 'I'. ENDIF. CATCH /aws1/cx_ppsbadrequestex INTO DATA(lo_bad_request_ex). MESSAGE lo_bad_request_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_bad_request_ex. CATCH /aws1/cx_ppsinternalsvcerrorex INTO DATA(lo_internal_error_ex). MESSAGE lo_internal_error_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_internal_error_ex. CATCH /aws1/cx_ppstoomanyrequestsex INTO DATA(lo_too_many_requests_ex). MESSAGE lo_too_many_requests_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_too_many_requests_ex. ENDTRY.-
Para obtener más información sobre la API, consulte ListConfigurationSetsla referencia sobre la API ABAP del AWS SDK para SAP.
-
En el siguiente ejemplo de código, se muestra cómo utilizar SendVoiceMessage.
- SDK para SAP ABAP
-
nota
Hay más información al respecto. GitHub Busque el ejemplo completo y aprenda a configurar y ejecutar en el Repositorio de ejemplos de código de AWS
. TRY. " Create SSML message type object with voice parameters DATA(lo_ssml_message) = NEW /aws1/cl_ppsssmlmessagetype( iv_languagecode = iv_language_code " e.g., 'en-US' iv_voiceid = iv_voice_id " e.g., 'Matthew' iv_text = iv_ssml_message " SSML formatted message text ). " Create voice message content with the SSML message DATA(lo_content) = NEW /aws1/cl_ppsvoicemessagecont( io_ssmlmessage = lo_ssml_message ). " Send the voice message DATA(lo_result) = lo_pps->sendvoicemessage( iv_originationphonenumber = iv_origination_number " e.g., '+12065550110' iv_callerid = iv_caller_id " e.g., '+12065550199' iv_destinationphonenumber = iv_destination_number " e.g., '+12065550142' io_content = lo_content ). " Retrieve the message ID from the response ov_message_id = lo_result->get_messageid( ). MESSAGE 'Voice message sent successfully.' TYPE 'I'. CATCH /aws1/cx_ppsbadrequestex INTO DATA(lo_bad_request_ex). MESSAGE lo_bad_request_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_bad_request_ex. CATCH /aws1/cx_ppsinternalsvcerrorex INTO DATA(lo_internal_error_ex). MESSAGE lo_internal_error_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_internal_error_ex. CATCH /aws1/cx_ppstoomanyrequestsex INTO DATA(lo_too_many_requests_ex). MESSAGE lo_too_many_requests_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_too_many_requests_ex. ENDTRY.-
Para obtener más información sobre la API, consulte SendVoiceMessagela referencia sobre la API ABAP del AWS SDK para SAP.
-
En el siguiente ejemplo de código, se muestra cómo utilizar UpdateConfigurationSetEventDestination.
- SDK para SAP ABAP
-
nota
Hay más información al respecto. GitHub Busque el ejemplo completo y aprenda a configurar y ejecutar en el Repositorio de ejemplos de código de AWS
. TRY. " Update the event destination lo_pps->updateconfseteventdst( iv_configurationsetname = iv_configuration_set_name " e.g., 'my-config-set' iv_eventdestinationname = iv_event_destination_name " e.g., 'my-event-dest' io_eventdestination = io_event_destination ). MESSAGE 'Event destination updated successfully.' TYPE 'I'. CATCH /aws1/cx_ppsnotfoundexception INTO DATA(lo_not_found_ex). MESSAGE lo_not_found_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_not_found_ex. CATCH /aws1/cx_ppsbadrequestex INTO DATA(lo_bad_request_ex). MESSAGE lo_bad_request_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_bad_request_ex. CATCH /aws1/cx_ppsinternalsvcerrorex INTO DATA(lo_internal_error_ex). MESSAGE lo_internal_error_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_internal_error_ex. CATCH /aws1/cx_ppstoomanyrequestsex INTO DATA(lo_too_many_requests_ex). MESSAGE lo_too_many_requests_ex->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_too_many_requests_ex. ENDTRY.-
Para obtener más información sobre la API, consulte UpdateConfigurationSetEventDestinationla referencia sobre la API ABAP del AWS SDK para SAP.
-