ACM examples using SDK for SAP ABAP - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

ACM examples using SDK for SAP ABAP

The following code examples show you how to perform actions and implement common scenarios by using the AWS SDK for SAP ABAP with ACM.

Actions are code excerpts from larger programs and must be run in context. While actions show you how to call individual service functions, you can see actions in context in their related scenarios.

Each example includes a link to the complete source code, where you can find instructions on how to set up and run the code in context.

Topics

Actions

The following code example shows how to use AddTagsToCertificate.

SDK for SAP ABAP
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

TRY. " iv_certificate_arn = 'arn:aws:acm:region:123456789012:certificate/certificate-id' lo_acm->addtagstocertificate( iv_certificatearn = iv_certificate_arn it_tags = it_tags ). MESSAGE 'Tags added to certificate successfully.' TYPE 'I'. CATCH /aws1/cx_acminvalidarnex. MESSAGE 'The certificate ARN is not valid.' TYPE 'I'. CATCH /aws1/cx_acmresourcenotfoundex. MESSAGE 'Certificate not found.' TYPE 'I'. CATCH /aws1/cx_acminvalidtagex. MESSAGE 'Invalid tag provided.' TYPE 'I'. CATCH /aws1/cx_acmtoomanytagsex. MESSAGE 'Too many tags for certificate.' TYPE 'I'. ENDTRY.

The following code example shows how to use DeleteCertificate.

SDK for SAP ABAP
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

TRY. " iv_certificate_arn = 'arn:aws:acm:region:123456789012:certificate/certificate-id' lo_acm->deletecertificate( iv_certificatearn = iv_certificate_arn ). MESSAGE 'Certificate deleted successfully.' TYPE 'I'. CATCH /aws1/cx_acminvalidarnex. MESSAGE 'The certificate ARN is not valid.' TYPE 'I'. CATCH /aws1/cx_acmresourcenotfoundex. MESSAGE 'Certificate not found.' TYPE 'I'. CATCH /aws1/cx_acmresourceinuseex. MESSAGE 'Certificate is in use and cannot be deleted.' TYPE 'I'. ENDTRY.

The following code example shows how to use DescribeCertificate.

SDK for SAP ABAP
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

TRY. " iv_certificate_arn = 'arn:aws:acm:region:123456789012:certificate/certificate-id' oo_result = lo_acm->describecertificate( iv_certificatearn = iv_certificate_arn ). MESSAGE 'Certificate details retrieved.' TYPE 'I'. CATCH /aws1/cx_acminvalidarnex. MESSAGE 'The certificate ARN is not valid.' TYPE 'I'. CATCH /aws1/cx_acmresourcenotfoundex. MESSAGE 'Certificate not found.' TYPE 'I'. ENDTRY.

The following code example shows how to use GetCertificate.

SDK for SAP ABAP
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

TRY. " iv_certificate_arn = 'arn:aws:acm:region:123456789012:certificate/certificate-id' oo_result = lo_acm->getcertificate( iv_certificatearn = iv_certificate_arn ). MESSAGE 'Certificate body and chain retrieved.' TYPE 'I'. CATCH /aws1/cx_acminvalidarnex. MESSAGE 'The certificate ARN is not valid.' TYPE 'I'. CATCH /aws1/cx_acmresourcenotfoundex. MESSAGE 'Certificate not found.' TYPE 'I'. CATCH /aws1/cx_acmrequestinprgssex. MESSAGE 'Certificate request is in progress.' TYPE 'I'. ENDTRY.
  • For API details, see GetCertificate in AWS SDK for SAP ABAP API reference.

The following code example shows how to use ImportCertificate.

SDK for SAP ABAP
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

TRY. " Only pass certificate chain if it's provided (it's optional) IF iv_certificate_chain IS NOT INITIAL. DATA(lo_result) = lo_acm->importcertificate( iv_certificate = iv_certificate iv_privatekey = iv_private_key iv_certificatechain = iv_certificate_chain ). ELSE. lo_result = lo_acm->importcertificate( iv_certificate = iv_certificate iv_privatekey = iv_private_key ). ENDIF. ov_certificate_arn = lo_result->get_certificatearn( ). MESSAGE 'Certificate imported successfully.' TYPE 'I'. CATCH /aws1/cx_acminvalidparameterex. MESSAGE 'Invalid parameter provided.' TYPE 'I'. CATCH /aws1/cx_acmlimitexceededex. MESSAGE 'Certificate limit exceeded.' TYPE 'I'. ENDTRY.

The following code example shows how to use ListCertificates.

SDK for SAP ABAP
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

TRY. oo_result = lo_acm->listcertificates( iv_maxitems = iv_max_items it_certificatestatuses = it_statuses io_includes = io_includes ). MESSAGE 'Certificates listed successfully.' TYPE 'I'. CATCH /aws1/cx_acminvalidargsex. MESSAGE 'Invalid arguments provided.' TYPE 'I'. CATCH /aws1/cx_acmvalidationex. MESSAGE 'Validation error occurred.' TYPE 'I'. ENDTRY.

The following code example shows how to use ListTagsForCertificate.

SDK for SAP ABAP
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

TRY. " iv_certificate_arn = 'arn:aws:acm:region:123456789012:certificate/certificate-id' DATA(lo_result) = lo_acm->listtagsforcertificate( iv_certificatearn = iv_certificate_arn ). ot_tags = lo_result->get_tags( ). MESSAGE 'Certificate tags retrieved successfully.' TYPE 'I'. CATCH /aws1/cx_acminvalidarnex. MESSAGE 'The certificate ARN is not valid.' TYPE 'I'. CATCH /aws1/cx_acmresourcenotfoundex. MESSAGE 'Certificate not found.' TYPE 'I'. ENDTRY.

The following code example shows how to use RemoveTagsFromCertificate.

SDK for SAP ABAP
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

TRY. " iv_certificate_arn = 'arn:aws:acm:region:123456789012:certificate/certificate-id' lo_acm->removetagsfromcertificate( iv_certificatearn = iv_certificate_arn it_tags = it_tags ). MESSAGE 'Tags removed from certificate successfully.' TYPE 'I'. CATCH /aws1/cx_acminvalidarnex. MESSAGE 'The certificate ARN is not valid.' TYPE 'I'. CATCH /aws1/cx_acmresourcenotfoundex. MESSAGE 'Certificate not found.' TYPE 'I'. CATCH /aws1/cx_acminvalidtagex. MESSAGE 'Invalid tag provided.' TYPE 'I'. ENDTRY.

The following code example shows how to use RequestCertificate.

SDK for SAP ABAP
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

TRY. " iv_domain_name = 'example.com' " iv_validation_method = 'DNS' or 'EMAIL' DATA(lo_result) = lo_acm->requestcertificate( iv_domainname = iv_domain_name it_subjectalternativenames = COND #( WHEN it_alternate_domains IS NOT INITIAL THEN it_alternate_domains ) iv_validationmethod = iv_validation_method ). ov_certificate_arn = lo_result->get_certificatearn( ). MESSAGE 'Certificate requested successfully.' TYPE 'I'. CATCH /aws1/cx_acminvalidparameterex. MESSAGE 'Invalid parameter provided.' TYPE 'I'. CATCH /aws1/cx_acmlimitexceededex. MESSAGE 'Certificate limit exceeded.' TYPE 'I'. CATCH /aws1/cx_acminvdomvationoptsex. MESSAGE 'Invalid domain validation options.' TYPE 'I'. ENDTRY.

The following code example shows how to use ResendValidationEmail.

SDK for SAP ABAP
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

TRY. " iv_certificate_arn = 'arn:aws:acm:region:123456789012:certificate/certificate-id' " iv_domain = 'example.com' " iv_validation_domain = 'example.com' lo_acm->resendvalidationemail( iv_certificatearn = iv_certificate_arn iv_domain = iv_domain iv_validationdomain = iv_validation_domain ). MESSAGE 'Validation email resent successfully.' TYPE 'I'. CATCH /aws1/cx_acminvalidarnex. MESSAGE 'The certificate ARN is not valid.' TYPE 'I'. CATCH /aws1/cx_acmresourcenotfoundex. MESSAGE 'Certificate not found.' TYPE 'I'. CATCH /aws1/cx_acminvalidstateex. MESSAGE 'Certificate is not in a valid state.' TYPE 'I'. CATCH /aws1/cx_acminvdomvationoptsex. MESSAGE 'Invalid domain validation options.' TYPE 'I'. ENDTRY.