Doc AWS SDK Examples GitHub リポジトリには、他にも SDK の例があります。 AWS
翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。
SDK for SAP ABAP を使用した Amazon SES API v2 の例
次のコード例は、Amazon SES API v2 で AWS SDK for SAP ABAP を使用してアクションを実行し、一般的なシナリオを実装する方法を示しています。
アクションはより大きなプログラムからのコードの抜粋であり、コンテキスト内で実行する必要があります。アクションは個々のサービス機能を呼び出す方法を示していますが、コンテキスト内のアクションは、関連するシナリオで確認できます。
各例には完全なソースコードへのリンクが含まれており、コードの設定方法と実行方法に関する手順を確認できます。
トピック
アクション
次の例は、CreateContact を使用する方法を説明しています。
- SDK for SAP ABAP
-
注記
GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリ
での設定と実行の方法を確認してください。 TRY. lo_se2->createcontact( iv_contactlistname = iv_contact_list_name iv_emailaddress = iv_email_address ). MESSAGE 'Contact created successfully.' TYPE 'I'. CATCH /aws1/cx_se2alreadyexistsex. MESSAGE 'Contact already exists.' TYPE 'I'. CATCH /aws1/cx_se2badrequestex. MESSAGE 'Bad request.' TYPE 'E'. CATCH /aws1/cx_se2notfoundexception. MESSAGE 'Contact list not found.' TYPE 'E'. ENDTRY.-
API の詳細については、 AWS SDK for SAP ABAP API リファレンスの「CreateContact」を参照してください。
-
次の例は、CreateContactList を使用する方法を説明しています。
- SDK for SAP ABAP
-
注記
GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリ
での設定と実行の方法を確認してください。 TRY. lo_se2->createcontactlist( iv_contactlistname = iv_contact_list_name ). MESSAGE 'Contact list created successfully.' TYPE 'I'. CATCH /aws1/cx_se2alreadyexistsex. MESSAGE 'Contact list already exists.' TYPE 'I'. CATCH /aws1/cx_se2badrequestex INTO DATA(lo_bad_request). MESSAGE 'Bad request - contact list limit may be reached.' TYPE 'I'. " Re-raise the exception so the caller can handle it RAISE EXCEPTION lo_bad_request. CATCH /aws1/cx_se2limitexceededex INTO DATA(lo_limit_exceeded). MESSAGE 'Limit exceeded - contact list limit reached.' TYPE 'I'. " Re-raise the exception so the caller can handle it RAISE EXCEPTION lo_limit_exceeded. ENDTRY.-
API の詳細については、 AWS SDK for SAP ABAP API リファレンスの「CreateContactList」を参照してください。
-
次の例は、CreateEmailIdentity を使用する方法を説明しています。
- SDK for SAP ABAP
-
注記
GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリ
での設定と実行の方法を確認してください。 TRY. lo_se2->createemailidentity( iv_emailidentity = iv_email_identity ). MESSAGE 'Email identity created successfully.' TYPE 'I'. CATCH /aws1/cx_se2alreadyexistsex. MESSAGE 'Email identity already exists.' TYPE 'I'. CATCH /aws1/cx_se2badrequestex INTO DATA(lo_bad_request). MESSAGE lo_bad_request TYPE 'I' DISPLAY LIKE 'E'. CATCH /aws1/cx_se2limitexceededex INTO DATA(lo_limit_exceeded). MESSAGE lo_limit_exceeded TYPE 'I' DISPLAY LIKE 'E'. ENDTRY.-
API の詳細については、 AWS SDK for SAP ABAP API リファレンスの「CreateEmailIdentity」を参照してください。
-
次の例は、CreateEmailTemplate を使用する方法を説明しています。
- SDK for SAP ABAP
-
注記
GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリ
での設定と実行の方法を確認してください。 TRY. DATA(lo_template_content) = NEW /aws1/cl_se2emailtmplcontent( iv_subject = iv_subject iv_html = iv_html iv_text = iv_text ). lo_se2->createemailtemplate( iv_templatename = iv_template_name io_templatecontent = lo_template_content ). MESSAGE 'Email template created successfully.' TYPE 'I'. CATCH /aws1/cx_se2alreadyexistsex. MESSAGE 'Email template already exists.' TYPE 'I'. CATCH /aws1/cx_se2badrequestex. MESSAGE 'Bad request.' TYPE 'E'. CATCH /aws1/cx_se2limitexceededex. MESSAGE 'Limit exceeded.' TYPE 'E'. ENDTRY.-
API の詳細については、 AWS SDK for SAP CreateEmailTemplate」を参照してください。
-
次の例は、DeleteContactList を使用する方法を説明しています。
- SDK for SAP ABAP
-
注記
GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリ
での設定と実行の方法を確認してください。 TRY. lo_se2->deletecontactlist( iv_contactlistname = iv_contact_list_name ). MESSAGE 'Contact list deleted successfully.' TYPE 'I'. CATCH /aws1/cx_se2notfoundexception. MESSAGE 'Contact list not found.' TYPE 'I'. CATCH /aws1/cx_se2badrequestex INTO DATA(lo_bad_request). MESSAGE 'Bad request.' TYPE 'I'. RAISE EXCEPTION lo_bad_request. ENDTRY.-
API の詳細については、 AWS SDK for SAP ABAP API リファレンスのDeleteContactList」を参照してください。
-
次の例は、DeleteEmailIdentity を使用する方法を説明しています。
- SDK for SAP ABAP
-
注記
GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリ
での設定と実行の方法を確認してください。 TRY. lo_se2->deleteemailidentity( iv_emailidentity = iv_email_identity ). MESSAGE 'Email identity deleted successfully.' TYPE 'I'. CATCH /aws1/cx_se2notfoundexception. MESSAGE 'Email identity not found.' TYPE 'I'. CATCH /aws1/cx_se2badrequestex INTO DATA(lo_bad_request). MESSAGE 'Bad request.' TYPE 'I'. RAISE EXCEPTION lo_bad_request. ENDTRY.-
API の詳細については、 AWS SDK for SAP ABAP API リファレンスのDeleteEmailIdentity」を参照してください。
-
次の例は、DeleteEmailTemplate を使用する方法を説明しています。
- SDK for SAP ABAP
-
注記
GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリ
での設定と実行の方法を確認してください。 TRY. lo_se2->deleteemailtemplate( iv_templatename = iv_template_name ). MESSAGE 'Email template deleted successfully.' TYPE 'I'. CATCH /aws1/cx_se2notfoundexception. MESSAGE 'Email template not found.' TYPE 'I'. CATCH /aws1/cx_se2badrequestex INTO DATA(lo_bad_request). MESSAGE 'Bad request.' TYPE 'I'. RAISE EXCEPTION lo_bad_request. ENDTRY.-
API の詳細については、 AWS SDK for SAP ABAP API リファレンスのDeleteEmailTemplate」を参照してください。
-
次の例は、ListContacts を使用する方法を説明しています。
- SDK for SAP ABAP
-
注記
GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリ
での設定と実行の方法を確認してください。 TRY. oo_result = lo_se2->listcontacts( iv_contactlistname = iv_contact_list_name ). DATA(lv_count) = lines( oo_result->get_contacts( ) ). MESSAGE |Retrieved { lv_count } contacts from list.| TYPE 'I'. CATCH /aws1/cx_se2badrequestex INTO DATA(lo_bad_request). MESSAGE 'Bad request.' TYPE 'I'. RAISE EXCEPTION lo_bad_request. CATCH /aws1/cx_se2notfoundexception INTO DATA(lo_not_found). MESSAGE 'Contact list not found.' TYPE 'I'. RAISE EXCEPTION lo_not_found. ENDTRY.-
API の詳細については、 AWS SDK for SAP ABAP API リファレンスのListContacts」を参照してください。
-
次の例は、SendEmail を使用する方法を説明しています。
- SDK for SAP ABAP
-
注記
GitHub には、その他のリソースもあります。用例一覧を検索し、AWS コード例リポジトリ
での設定と実行の方法を確認してください。 メッセージを送信します。
TRY. " Create destination with recipient address DATA lt_to_addresses TYPE /aws1/cl_se2emailaddresslist_w=>tt_emailaddresslist. APPEND NEW /aws1/cl_se2emailaddresslist_w( iv_value = iv_to_email_address ) TO lt_to_addresses. DATA(lo_destination) = NEW /aws1/cl_se2destination( it_toaddresses = lt_to_addresses ). " Create message content DATA(lo_subject) = NEW /aws1/cl_se2content( iv_data = iv_subject ). DATA(lo_text_body) = NEW /aws1/cl_se2content( iv_data = iv_text_body ). DATA(lo_html_body) = NEW /aws1/cl_se2content( iv_data = iv_html_body ). DATA(lo_body) = NEW /aws1/cl_se2body( io_text = lo_text_body io_html = lo_html_body ). DATA(lo_message) = NEW /aws1/cl_se2message( io_subject = lo_subject io_body = lo_body ). DATA(lo_content) = NEW /aws1/cl_se2emailcontent( io_simple = lo_message ). " Send the email lo_se2->sendemail( iv_fromemailaddress = iv_from_email_address io_destination = lo_destination io_content = lo_content ). MESSAGE 'Email sent successfully.' TYPE 'I'. CATCH /aws1/cx_se2accountsuspendedex INTO DATA(lo_account_suspended). MESSAGE 'Account suspended.' TYPE 'I'. RAISE EXCEPTION lo_account_suspended. CATCH /aws1/cx_se2badrequestex INTO DATA(lo_bad_request). MESSAGE 'Bad request.' TYPE 'I'. RAISE EXCEPTION lo_bad_request. CATCH /aws1/cx_se2messagerejected INTO DATA(lo_message_rejected). MESSAGE 'Message rejected - check email verification.' TYPE 'I'. RAISE EXCEPTION lo_message_rejected. ENDTRY.テンプレートを使用してメッセージを送信します。
TRY. " Create destination with recipient address DATA lt_to_addresses TYPE /aws1/cl_se2emailaddresslist_w=>tt_emailaddresslist. APPEND NEW /aws1/cl_se2emailaddresslist_w( iv_value = iv_to_email_address ) TO lt_to_addresses. DATA(lo_destination) = NEW /aws1/cl_se2destination( it_toaddresses = lt_to_addresses ). " Create template reference DATA(lo_template) = NEW /aws1/cl_se2template( iv_templatename = iv_template_name iv_templatedata = iv_template_data ). DATA(lo_content) = NEW /aws1/cl_se2emailcontent( io_template = lo_template ). " Create list management options DATA(lo_list_mgmt) = NEW /aws1/cl_se2listmanagementopts( iv_contactlistname = iv_contact_list_name ). " Send the email using template lo_se2->sendemail( iv_fromemailaddress = iv_from_email_address io_destination = lo_destination io_content = lo_content io_listmanagementoptions = lo_list_mgmt ). MESSAGE 'Email sent using template successfully.' TYPE 'I'. CATCH /aws1/cx_se2accountsuspendedex INTO DATA(lo_account_suspended). MESSAGE 'Account suspended.' TYPE 'I'. RAISE EXCEPTION lo_account_suspended. CATCH /aws1/cx_se2badrequestex INTO DATA(lo_bad_request). MESSAGE 'Bad request.' TYPE 'I'. RAISE EXCEPTION lo_bad_request. CATCH /aws1/cx_se2messagerejected INTO DATA(lo_message_rejected). MESSAGE 'Message rejected - check email verification.' TYPE 'I'. RAISE EXCEPTION lo_message_rejected. ENDTRY.-
API の詳細については、 AWS SDK for SAP ABAP API リファレンスの「SendEmail」を参照してください。
-