File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -7,10 +7,11 @@ class ZCL_AWS1_CPD_ACTIONS definition
77 create public .
88
99public section .
10+ METHODS detectsentiment
11+ EXPORTING VALUE (oo_result ) TYPE REF TO /aws1/cl_cpddetectsentimentrsp .
1012protected section .
1113private section .
12- METHODS detectsentiment
13- RETURNING VALUE (oo_result ) TYPE REF TO /aws1/cl_cpddetectsentimentrsp .
14+
1415ENDCLASS .
1516
1617
@@ -25,7 +26,7 @@ CLASS ZCL_AWS1_CPD_ACTIONS IMPLEMENTATION.
2526 DATA (lo_cpd ) = /aws1/cl_cpd_factory=>create( lo_session ).
2627
2728 DATA (lv_text ) = | I love unicorns!| .
28- DATA (lv_language_code ) = | EN | .
29+ DATA (lv_language_code ) = | en | .
2930
3031
3132 " snippet-start:[cpd.abapv1.detect_sentiment]
@@ -38,7 +39,7 @@ CLASS ZCL_AWS1_CPD_ACTIONS IMPLEMENTATION.
3839 MESSAGE 'Detected sentiment.' TYPE 'I' .
3940
4041 CATCH /aws1/cx_cpdserverexc INTO DATA (lo_cpdex ) .
41- MESSAGE 'CPD exception ' TYPE 'E' .
42+ MESSAGE 'The size of the input text exceeds the limit. Use a smaller document. ' TYPE 'E' .
4243
4344 ENDTRY .
4445 " snippet-end:[cpd.abapv1.detect_sentiment]
Original file line number Diff line number Diff line change @@ -6,16 +6,15 @@ CLASS ltc_zcl_aws1_cpd_actions DEFINITION FOR TESTING
66 RISK LEVEL HARMLESS .
77
88 PRIVATE SECTION .
9- CONSTANTS cv_pfl TYPE /aws1/rt_profile_id VALUE 'ZCODE_DEMO' .
10- CONSTANTS cv_languagecode VALUE | EN| .
11-
9+ DATA ao_cpd_actions TYPE REF TO zcl_aws1_cpd_actions.
1210 METHODS : detectsentiment FOR TESTING .
1311ENDCLASS . "ltc_Zcl_Aws1_Cpd_Actions
1412
1513
1614CLASS ltc_zcl_aws1_cpd_actions IMPLEMENTATION .
1715
1816 METHOD detectsentiment .
17+ ao_cpd_actions = NEW zcl_aws1_cpd_actions( ).
1918 DATA lo_output TYPE REF TO /aws1/cl_cpddetectsentimentrsp.
2019 DATA (lv_expected_output ) = | POSITIVE| .
2120
@@ -24,8 +23,8 @@ CLASS ltc_zcl_aws1_cpd_actions IMPLEMENTATION.
2423 oo_result = lo_output ).
2524
2625 DATA (lv_found ) = abap_true .
27- IF lo_output->has_sentiment() = abap_true .
28- IF lo_output->get_sentiment( ) = lv_expected_output.
26+ IF lo_output->has_sentiment( ) = abap_true .
27+ IF lo_output->ask_sentiment( ) = lv_expected_output.
2928 lv_found = abap_true .
3029 ENDIF .
3130 ENDIF .
You can’t perform that action at this time.
0 commit comments