diff --git a/.doc_gen/metadata/comprehend_metadata.yaml b/.doc_gen/metadata/comprehend_metadata.yaml
index b2590b3d34f..f8a44b912f8 100644
--- a/.doc_gen/metadata/comprehend_metadata.yaml
+++ b/.doc_gen/metadata/comprehend_metadata.yaml
@@ -291,6 +291,14 @@ comprehend_DetectSentiment:
snippet_tags:
- python.example_code.comprehend.ComprehendDetect
- python.example_code.comprehend.DetectSentiment
+ SAP ABAP:
+ versions:
+ - sdk_version: 1
+ github: sap-abap/services/cpd
+ excerpts:
+ - description:
+ snippet_tags:
+ - cpd.abapv1.detect_sentiment
services:
comprehend: {DetectSentiment}
comprehend_DetectSyntax:
diff --git a/.tools/readmes/config.py b/.tools/readmes/config.py
index e6e215717d8..35bd076a6ac 100644
--- a/.tools/readmes/config.py
+++ b/.tools/readmes/config.py
@@ -197,6 +197,7 @@
"service_folder_overrides": {
"bedrock-runtime": "sap-abap/services/bdr",
"bedrock-agent-runtime": "sap-abap/services/bdz",
+ "comprehend": "sap-abap/services/cpd",
"dynamodb": "sap-abap/services/dyn",
},
}
diff --git a/sap-abap/services/cpd/README.md b/sap-abap/services/cpd/README.md
new file mode 100644
index 00000000000..8bf7adbf17a
--- /dev/null
+++ b/sap-abap/services/cpd/README.md
@@ -0,0 +1,78 @@
+# Amazon Comprehend code examples for the SDK for SAP ABAP
+
+## Overview
+
+Shows how to use the AWS SDK for SAP ABAP to work with Amazon Comprehend.
+
+
+
+
+_Amazon Comprehend uses natural language processing (NLP) to extract insights about the content of documents without the need of any special preprocessing._
+
+## ⚠ Important
+
+* Running this code might result in charges to your AWS account. For more details, see [AWS Pricing](https://aws.amazon.com/pricing/) and [Free Tier](https://aws.amazon.com/free/).
+* Running the tests might result in charges to your AWS account.
+* We recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see [Grant least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege).
+* This code is not tested in every AWS Region. For more information, see [AWS Regional Services](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services).
+
+
+
+
+## Code examples
+
+### Prerequisites
+
+For prerequisites, see the [README](../../README.md#Prerequisites) in the `sap-abap` folder.
+
+
+
+
+
+### Single actions
+
+Code excerpts that show you how to call individual service functions.
+
+- [DetectSentiment](zcl_aws1_cpd_actions.clas.abap#L32)
+
+
+
+
+
+## Run the examples
+
+### Instructions
+
+
+
+
+
+
+
+### Tests
+
+⚠ Running tests might result in charges to your AWS account.
+
+
+To find instructions for running these tests, see the [README](../../README.md#Tests)
+in the `sap-abap` folder.
+
+
+
+
+
+
+## Additional resources
+
+- [Amazon Comprehend Developer Guide](https://docs.aws.amazon.com/comprehend/latest/dg/what-is.html)
+- [Amazon Comprehend API Reference](https://docs.aws.amazon.com/comprehend/latest/APIReference/welcome.html)
+- [SDK for SAP ABAP Amazon Comprehend reference](https://docs.aws.amazon.com/sdk-for-sap-abap/v1/api/latest/comprehend/index.html)
+
+
+
+
+---
+
+Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+
+SPDX-License-Identifier: Apache-2.0
diff --git a/sap-abap/services/cpd/package.devc.xml b/sap-abap/services/cpd/package.devc.xml
new file mode 100644
index 00000000000..c5fef40c774
--- /dev/null
+++ b/sap-abap/services/cpd/package.devc.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+ Package for Amazon Comprehend
+
+
+
+
diff --git a/sap-abap/services/cpd/zcl_aws1_cpd_actions.clas.abap b/sap-abap/services/cpd/zcl_aws1_cpd_actions.clas.abap
new file mode 100644
index 00000000000..5b0de5e3f2b
--- /dev/null
+++ b/sap-abap/services/cpd/zcl_aws1_cpd_actions.clas.abap
@@ -0,0 +1,47 @@
+" Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+" SPDX-License-Identifier: Apache-2.0
+
+class ZCL_AWS1_CPD_ACTIONS definition
+ public
+ final
+ create public .
+
+public section.
+ METHODS detectsentiment
+ EXPORTING VALUE(oo_result) TYPE REF TO /aws1/cl_cpddetectsentimentrsp .
+protected section.
+private section.
+
+ENDCLASS.
+
+
+
+CLASS ZCL_AWS1_CPD_ACTIONS IMPLEMENTATION.
+
+
+ METHOD detectsentiment.
+ CONSTANTS cv_pfl TYPE /aws1/rt_profile_id VALUE 'ZCODE_DEMO'.
+
+ DATA(lo_session) = /aws1/cl_rt_session_aws=>create( cv_pfl ).
+ DATA(lo_cpd) = /aws1/cl_cpd_factory=>create( lo_session ).
+
+ DATA(lv_text) = |I love unicorns!| .
+ DATA(lv_language_code) = |en| .
+
+
+ " snippet-start:[cpd.abapv1.detect_sentiment]
+ TRY.
+ oo_result = lo_cpd->detectsentiment(
+ iv_languagecode = lv_language_code
+ iv_text = lv_text
+ ).
+
+ MESSAGE |Detected sentiment: { oo_result->get_sentiment( ) }| TYPE 'I'.
+
+ CATCH /aws1/cx_cpdtextsizelmtexcdex INTO DATA(lo_cpdex) .
+ MESSAGE 'The size of the input text exceeds the limit. Use a smaller document.' TYPE 'E'.
+
+ ENDTRY.
+ " snippet-end:[cpd.abapv1.detect_sentiment]
+ ENDMETHOD.
+ENDCLASS.
diff --git a/sap-abap/services/cpd/zcl_aws1_cpd_actions.clas.testclasses.abap b/sap-abap/services/cpd/zcl_aws1_cpd_actions.clas.testclasses.abap
new file mode 100644
index 00000000000..29af606d68b
--- /dev/null
+++ b/sap-abap/services/cpd/zcl_aws1_cpd_actions.clas.testclasses.abap
@@ -0,0 +1,37 @@
+" Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+" SPDX-License-Identifier: Apache-2.0
+
+CLASS ltc_zcl_aws1_cpd_actions DEFINITION FOR TESTING
+ DURATION SHORT
+ RISK LEVEL HARMLESS.
+
+ PRIVATE SECTION.
+ DATA ao_cpd_actions TYPE REF TO zcl_aws1_cpd_actions.
+ METHODS: detectsentiment FOR TESTING.
+ENDCLASS. "ltc_Zcl_Aws1_Cpd_Actions
+
+
+CLASS ltc_zcl_aws1_cpd_actions IMPLEMENTATION.
+
+ METHOD detectsentiment.
+ ao_cpd_actions = NEW zcl_aws1_cpd_actions( ).
+ DATA lo_output TYPE REF TO /aws1/cl_cpddetectsentimentrsp.
+ DATA(lv_expected_output) = |POSITIVE|.
+
+ ao_cpd_actions->detectsentiment(
+ IMPORTING
+ oo_result = lo_output ).
+
+ DATA(lv_found) = abap_true.
+ IF lo_output->has_sentiment( ) = abap_true.
+ IF lo_output->ask_sentiment( ) = lv_expected_output.
+ lv_found = abap_true.
+ ENDIF.
+ ENDIF.
+
+ cl_abap_unit_assert=>assert_true(
+ act = lv_found
+ msg = |Sentiment detection failed| ).
+ ENDMETHOD.
+
+ENDCLASS.
diff --git a/sap-abap/services/cpd/zcl_aws1_cpd_actions.clas.xml b/sap-abap/services/cpd/zcl_aws1_cpd_actions.clas.xml
new file mode 100644
index 00000000000..cf647da1aa3
--- /dev/null
+++ b/sap-abap/services/cpd/zcl_aws1_cpd_actions.clas.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+ ZCL_AWS1_CPD_ACTIONS
+ E
+ Comprehend Code Example
+ 1
+ X
+ X
+ X
+ X
+
+
+
+