There are more AWS SDK examples available in the AWS Doc SDK Examples
Amazon Transcribe 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 Amazon Transcribe.
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 CreateVocabulary.
- 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. IF it_phrases IS NOT INITIAL. oo_result = lo_tnb->createvocabulary( iv_vocabularyname = iv_vocabulary_name iv_languagecode = iv_language_code it_phrases = it_phrases ). ELSEIF iv_vocab_file_uri IS NOT INITIAL. oo_result = lo_tnb->createvocabulary( iv_vocabularyname = iv_vocabulary_name iv_languagecode = iv_language_code iv_vocabularyfileuri = iv_vocab_file_uri ). ENDIF. MESSAGE 'Custom vocabulary created.' TYPE 'I'. CATCH /aws1/cx_tnbbadrequestex INTO DATA(lo_bad_request_ex). MESSAGE lo_bad_request_ex TYPE 'I'. RAISE EXCEPTION lo_bad_request_ex. CATCH /aws1/cx_tnblimitexceededex INTO DATA(lo_limit_ex). MESSAGE lo_limit_ex TYPE 'I'. RAISE EXCEPTION lo_limit_ex. CATCH /aws1/cx_tnbinternalfailureex INTO DATA(lo_internal_ex). MESSAGE lo_internal_ex TYPE 'I'. RAISE EXCEPTION lo_internal_ex. CATCH /aws1/cx_tnbconflictexception INTO DATA(lo_conflict_ex). MESSAGE lo_conflict_ex TYPE 'I'. RAISE EXCEPTION lo_conflict_ex. ENDTRY.-
For API details, see CreateVocabulary in AWS SDK for SAP ABAP API reference.
-
The following code example shows how to use DeleteTranscriptionJob.
- 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. lo_tnb->deletetranscriptionjob( iv_job_name ). MESSAGE 'Transcription job deleted.' TYPE 'I'. CATCH /aws1/cx_tnbbadrequestex INTO DATA(lo_bad_request_ex). MESSAGE lo_bad_request_ex TYPE 'I'. RAISE EXCEPTION lo_bad_request_ex. CATCH /aws1/cx_tnblimitexceededex INTO DATA(lo_limit_ex). MESSAGE lo_limit_ex TYPE 'I'. RAISE EXCEPTION lo_limit_ex. CATCH /aws1/cx_tnbinternalfailureex INTO DATA(lo_internal_ex). MESSAGE lo_internal_ex TYPE 'I'. RAISE EXCEPTION lo_internal_ex. ENDTRY.-
For API details, see DeleteTranscriptionJob in AWS SDK for SAP ABAP API reference.
-
The following code example shows how to use DeleteVocabulary.
- 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. lo_tnb->deletevocabulary( iv_vocabulary_name ). MESSAGE 'Vocabulary deleted.' TYPE 'I'. CATCH /aws1/cx_tnbbadrequestex INTO DATA(lo_bad_request_ex). MESSAGE lo_bad_request_ex TYPE 'I'. CATCH /aws1/cx_tnblimitexceededex INTO DATA(lo_limit_ex). MESSAGE lo_limit_ex TYPE 'I'. RAISE EXCEPTION lo_limit_ex. CATCH /aws1/cx_tnbnotfoundexception INTO DATA(lo_not_found_ex). MESSAGE lo_not_found_ex TYPE 'I'. CATCH /aws1/cx_tnbinternalfailureex INTO DATA(lo_internal_ex). MESSAGE lo_internal_ex TYPE 'I'. RAISE EXCEPTION lo_internal_ex. ENDTRY.-
For API details, see DeleteVocabulary in AWS SDK for SAP ABAP API reference.
-
The following code example shows how to use GetTranscriptionJob.
- 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_tnb->gettranscriptionjob( iv_job_name ). DATA(lo_job) = oo_result->get_transcriptionjob( ). MESSAGE 'Retrieved transcription job details.' TYPE 'I'. CATCH /aws1/cx_tnbbadrequestex INTO DATA(lo_bad_request_ex). MESSAGE lo_bad_request_ex TYPE 'I'. RAISE EXCEPTION lo_bad_request_ex. CATCH /aws1/cx_tnbnotfoundexception INTO DATA(lo_not_found_ex). MESSAGE lo_not_found_ex TYPE 'I'. RAISE EXCEPTION lo_not_found_ex. CATCH /aws1/cx_tnbinternalfailureex INTO DATA(lo_internal_ex). MESSAGE lo_internal_ex TYPE 'I'. RAISE EXCEPTION lo_internal_ex. ENDTRY.-
For API details, see GetTranscriptionJob in AWS SDK for SAP ABAP API reference.
-
The following code example shows how to use GetVocabulary.
- 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_tnb->getvocabulary( iv_vocabulary_name ). MESSAGE 'Retrieved vocabulary details.' TYPE 'I'. CATCH /aws1/cx_tnbbadrequestex INTO DATA(lo_bad_request_ex). MESSAGE lo_bad_request_ex TYPE 'I'. RAISE EXCEPTION lo_bad_request_ex. CATCH /aws1/cx_tnbnotfoundexception INTO DATA(lo_not_found_ex). MESSAGE lo_not_found_ex TYPE 'I'. RAISE EXCEPTION lo_not_found_ex. CATCH /aws1/cx_tnbinternalfailureex INTO DATA(lo_internal_ex). MESSAGE lo_internal_ex TYPE 'I'. RAISE EXCEPTION lo_internal_ex. ENDTRY.-
For API details, see GetVocabulary in AWS SDK for SAP ABAP API reference.
-
The following code example shows how to use ListTranscriptionJobs.
- 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. IF iv_job_filter IS NOT INITIAL. oo_result = lo_tnb->listtranscriptionjobs( iv_jobnamecontains = iv_job_filter ). ELSE. oo_result = lo_tnb->listtranscriptionjobs( ). ENDIF. MESSAGE 'Retrieved transcription jobs list.' TYPE 'I'. CATCH /aws1/cx_tnbbadrequestex INTO DATA(lo_bad_request_ex). MESSAGE lo_bad_request_ex TYPE 'I'. RAISE EXCEPTION lo_bad_request_ex. CATCH /aws1/cx_tnbinternalfailureex INTO DATA(lo_internal_ex). MESSAGE lo_internal_ex TYPE 'I'. RAISE EXCEPTION lo_internal_ex. ENDTRY.-
For API details, see ListTranscriptionJobs in AWS SDK for SAP ABAP API reference.
-
The following code example shows how to use ListVocabularies.
- 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. IF iv_vocab_filter IS NOT INITIAL. oo_result = lo_tnb->listvocabularies( iv_namecontains = iv_vocab_filter ). ELSE. oo_result = lo_tnb->listvocabularies( ). ENDIF. MESSAGE 'Retrieved vocabularies list.' TYPE 'I'. CATCH /aws1/cx_tnbbadrequestex INTO DATA(lo_bad_request_ex). MESSAGE lo_bad_request_ex TYPE 'I'. RAISE EXCEPTION lo_bad_request_ex. CATCH /aws1/cx_tnbinternalfailureex INTO DATA(lo_internal_ex). MESSAGE lo_internal_ex TYPE 'I'. RAISE EXCEPTION lo_internal_ex. ENDTRY.-
For API details, see ListVocabularies in AWS SDK for SAP ABAP API reference.
-
The following code example shows how to use StartTranscriptionJob.
- 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. DATA(lo_media) = NEW /aws1/cl_tnbmedia( iv_mediafileuri = iv_media_uri ). DATA(lo_settings) = NEW /aws1/cl_tnbsettings( ). IF iv_vocabulary_name IS NOT INITIAL. lo_settings = NEW /aws1/cl_tnbsettings( iv_vocabularyname = iv_vocabulary_name ). ENDIF. oo_result = lo_tnb->starttranscriptionjob( iv_transcriptionjobname = iv_job_name io_media = lo_media iv_mediaformat = iv_media_format iv_languagecode = iv_language_code io_settings = lo_settings ). MESSAGE 'Transcription job started.' TYPE 'I'. CATCH /aws1/cx_tnbbadrequestex INTO DATA(lo_bad_request_ex). MESSAGE lo_bad_request_ex TYPE 'I'. RAISE EXCEPTION lo_bad_request_ex. CATCH /aws1/cx_tnblimitexceededex INTO DATA(lo_limit_ex). MESSAGE lo_limit_ex TYPE 'I'. RAISE EXCEPTION lo_limit_ex. CATCH /aws1/cx_tnbinternalfailureex INTO DATA(lo_internal_ex). MESSAGE lo_internal_ex TYPE 'I'. RAISE EXCEPTION lo_internal_ex. CATCH /aws1/cx_tnbconflictexception INTO DATA(lo_conflict_ex). MESSAGE lo_conflict_ex TYPE 'I'. RAISE EXCEPTION lo_conflict_ex. ENDTRY.-
For API details, see StartTranscriptionJob in AWS SDK for SAP ABAP API reference.
-
The following code example shows how to use UpdateVocabulary.
- 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. IF it_phrases IS NOT INITIAL. oo_result = lo_tnb->updatevocabulary( iv_vocabularyname = iv_vocabulary_name iv_languagecode = iv_language_code it_phrases = it_phrases ). ELSEIF iv_vocab_file_uri IS NOT INITIAL. oo_result = lo_tnb->updatevocabulary( iv_vocabularyname = iv_vocabulary_name iv_languagecode = iv_language_code iv_vocabularyfileuri = iv_vocab_file_uri ). ENDIF. MESSAGE 'Vocabulary updated.' TYPE 'I'. CATCH /aws1/cx_tnbbadrequestex INTO DATA(lo_bad_request_ex). MESSAGE lo_bad_request_ex TYPE 'I'. CATCH /aws1/cx_tnblimitexceededex INTO DATA(lo_limit_ex). MESSAGE lo_limit_ex TYPE 'I'. RAISE EXCEPTION lo_limit_ex. CATCH /aws1/cx_tnbnotfoundexception INTO DATA(lo_not_found_ex). MESSAGE lo_not_found_ex TYPE 'I'. CATCH /aws1/cx_tnbinternalfailureex INTO DATA(lo_internal_ex). MESSAGE lo_internal_ex TYPE 'I'. RAISE EXCEPTION lo_internal_ex. CATCH /aws1/cx_tnbconflictexception INTO DATA(lo_conflict_ex). MESSAGE lo_conflict_ex TYPE 'I'. RAISE EXCEPTION lo_conflict_ex. ENDTRY.-
For API details, see UpdateVocabulary in AWS SDK for SAP ABAP API reference.
-