View a markdown version of this page

Beispiele für Amazon S3 Control mit SDK für SAP ABAP - AWSSDK für SAP ABAP

Die vorliegende Übersetzung wurde maschinell erstellt. Im Falle eines Konflikts oder eines Widerspruchs zwischen dieser übersetzten Fassung und der englischen Fassung (einschließlich infolge von Verzögerungen bei der Übersetzung) ist die englische Fassung maßgeblich.

Beispiele für Amazon S3 Control mit SDK für SAP ABAP

Die folgenden Codebeispiele zeigen Ihnen, wie Sie mithilfe des AWS SDK für SAP ABAP mit Amazon S3 Control Aktionen ausführen und gängige Szenarien implementieren.

Aktionen sind Codeauszüge aus größeren Programmen und müssen im Kontext ausgeführt werden. Während Aktionen Ihnen zeigen, wie Sie einzelne Service-Funktionen aufrufen, können Sie Aktionen im Kontext der zugehörigen Szenarien anzeigen.

Jedes Beispiel enthält einen Link zum vollständigen Quellcode, wo Sie Anweisungen zum Einrichten und Ausführen des Codes im Kodex finden.

Themen

Aktionen

Das folgende Codebeispiel zeigt, wie Sie es verwendenCreateJob.

SDK für SAP ABAP
Anmerkung

Es gibt noch mehr dazu. GitHub Hier finden Sie das vollständige Beispiel und erfahren, wie Sie das AWS-Code-Beispiel- einrichten und ausführen.

TRY. " iv_manifest_arn = 'arn:aws:s3:::my-bucket/job-manifest.csv' " iv_manifest_etag = 'abc123def456' " iv_report_bucket = 'arn:aws:s3:::my-report-bucket' DATA(lo_result) = lo_s3c->createjob( iv_accountid = iv_account_id iv_rolearn = iv_role_arn iv_confirmationrequired = abap_true iv_priority = 10 iv_description = 'Batch job for tagging objects' io_operation = NEW /aws1/cl_s3cjoboperation( io_s3putobjecttagging = NEW /aws1/cl_s3cs3setobjecttagop( it_tagset = VALUE /aws1/cl_s3cs3tag=>tt_s3tagset( ( NEW /aws1/cl_s3cs3tag( iv_key = 'BatchTag' iv_value = 'BatchValue' ) ) ) ) ) io_manifest = NEW /aws1/cl_s3cjobmanifest( io_spec = NEW /aws1/cl_s3cjobmanifestspec( iv_format = 'S3BatchOperations_CSV_20180820' it_fields = VALUE /aws1/cl_s3cjobmanifestfield00=>tt_jobmanifestfieldlist( ( NEW /aws1/cl_s3cjobmanifestfield00( 'Bucket' ) ) ( NEW /aws1/cl_s3cjobmanifestfield00( 'Key' ) ) ) ) io_location = NEW /aws1/cl_s3cjobmanifestloc( iv_objectarn = iv_manifest_arn iv_etag = iv_manifest_etag ) ) io_report = NEW /aws1/cl_s3cjobreport( iv_bucket = iv_report_bucket iv_format = 'Report_CSV_20180820' iv_enabled = abap_true iv_prefix = 'batch-op-reports' iv_reportscope = 'AllTasks' ) ). ov_job_id = lo_result->get_jobid( ). MESSAGE |S3 Batch Operations job created: { ov_job_id }| TYPE 'I'. CATCH /aws1/cx_s3cbadrequestex INTO DATA(lo_ex_bad). MESSAGE lo_ex_bad->get_text( ) TYPE 'I'. RAISE EXCEPTION TYPE /aws1/cx_rt_generic EXPORTING previous = lo_ex_bad. CATCH /aws1/cx_s3cclientexc INTO DATA(lo_ex_cli). MESSAGE lo_ex_cli->get_text( ) TYPE 'I'. RAISE EXCEPTION TYPE /aws1/cx_rt_generic EXPORTING previous = lo_ex_cli. CATCH /aws1/cx_s3cserverexc INTO DATA(lo_ex_srv). MESSAGE lo_ex_srv->get_text( ) TYPE 'I'. RAISE EXCEPTION TYPE /aws1/cx_rt_generic EXPORTING previous = lo_ex_srv. ENDTRY.
  • Einzelheiten zur API finden Sie CreateJobin der API-Referenz zum AWS SDK für SAP ABAP.

Das folgende Codebeispiel zeigt die VerwendungDeleteJobTagging.

SDK für SAP ABAP
Anmerkung

Es gibt noch mehr dazu. GitHub Hier finden Sie das vollständige Beispiel und erfahren, wie Sie das AWS-Code-Beispiel- einrichten und ausführen.

TRY. lo_s3c->deletejobtagging( iv_accountid = iv_account_id iv_jobid = iv_job_id ). MESSAGE |Tags deleted from job { iv_job_id }| TYPE 'I'. CATCH /aws1/cx_s3cnotfoundexception INTO DATA(lo_ex_nf). MESSAGE lo_ex_nf->get_text( ) TYPE 'I'. RAISE EXCEPTION TYPE /aws1/cx_rt_generic EXPORTING previous = lo_ex_nf. CATCH /aws1/cx_s3cclientexc INTO DATA(lo_ex_cli). MESSAGE lo_ex_cli->get_text( ) TYPE 'I'. RAISE EXCEPTION TYPE /aws1/cx_rt_generic EXPORTING previous = lo_ex_cli. CATCH /aws1/cx_s3cserverexc INTO DATA(lo_ex_srv). MESSAGE lo_ex_srv->get_text( ) TYPE 'I'. RAISE EXCEPTION TYPE /aws1/cx_rt_generic EXPORTING previous = lo_ex_srv. ENDTRY.
  • Einzelheiten zur API finden Sie DeleteJobTaggingin der API-Referenz zum AWS SDK für SAP ABAP.

Das folgende Codebeispiel zeigt die VerwendungDescribeJob.

SDK für SAP ABAP
Anmerkung

Es gibt noch mehr dazu. GitHub Hier finden Sie das vollständige Beispiel und erfahren, wie Sie das AWS-Code-Beispiel- einrichten und ausführen.

TRY. oo_result = lo_s3c->describejob( " oo_result is returned for testing purposes. iv_accountid = iv_account_id iv_jobid = iv_job_id ). DATA(lo_job) = oo_result->get_job( ). DATA(lv_status) = lo_job->get_status( ). DATA(lv_priority) = lo_job->get_priority( ). DATA(lo_progress) = lo_job->get_progresssummary( ). IF lo_progress IS NOT INITIAL. MESSAGE |Job { iv_job_id }: status={ lv_status }, priority={ lv_priority }, | && |total={ lo_progress->get_totalnumberoftasks( ) }, | && |succeeded={ lo_progress->get_numberoftaskssucceeded( ) }, | && |failed={ lo_progress->get_numberoftasksfailed( ) }| TYPE 'I'. ELSE. MESSAGE |Job { iv_job_id }: status={ lv_status }, priority={ lv_priority }| TYPE 'I'. ENDIF. CATCH /aws1/cx_s3cnotfoundexception INTO DATA(lo_ex_nf). MESSAGE lo_ex_nf->get_text( ) TYPE 'I'. RAISE EXCEPTION TYPE /aws1/cx_rt_generic EXPORTING previous = lo_ex_nf. CATCH /aws1/cx_s3cclientexc INTO DATA(lo_ex_cli). MESSAGE lo_ex_cli->get_text( ) TYPE 'I'. RAISE EXCEPTION TYPE /aws1/cx_rt_generic EXPORTING previous = lo_ex_cli. CATCH /aws1/cx_s3cserverexc INTO DATA(lo_ex_srv). MESSAGE lo_ex_srv->get_text( ) TYPE 'I'. RAISE EXCEPTION TYPE /aws1/cx_rt_generic EXPORTING previous = lo_ex_srv. ENDTRY.
  • Einzelheiten zur API finden Sie DescribeJobin der API-Referenz zum AWS SDK für SAP ABAP.

Das folgende Codebeispiel zeigt die VerwendungGetJobTagging.

SDK für SAP ABAP
Anmerkung

Es gibt noch mehr dazu. GitHub Hier finden Sie das vollständige Beispiel und erfahren, wie Sie das AWS-Code-Beispiel- einrichten und ausführen.

TRY. oo_result = lo_s3c->getjobtagging( " oo_result is returned for testing purposes. iv_accountid = iv_account_id iv_jobid = iv_job_id ). DATA(lt_tags) = oo_result->get_tags( ). MESSAGE |Retrieved { lines( lt_tags ) } tag(s) for job { iv_job_id }| TYPE 'I'. CATCH /aws1/cx_s3cnotfoundexception INTO DATA(lo_ex_nf). MESSAGE lo_ex_nf->get_text( ) TYPE 'I'. RAISE EXCEPTION TYPE /aws1/cx_rt_generic EXPORTING previous = lo_ex_nf. CATCH /aws1/cx_s3cclientexc INTO DATA(lo_ex_cli). MESSAGE lo_ex_cli->get_text( ) TYPE 'I'. RAISE EXCEPTION TYPE /aws1/cx_rt_generic EXPORTING previous = lo_ex_cli. CATCH /aws1/cx_s3cserverexc INTO DATA(lo_ex_srv). MESSAGE lo_ex_srv->get_text( ) TYPE 'I'. RAISE EXCEPTION TYPE /aws1/cx_rt_generic EXPORTING previous = lo_ex_srv. ENDTRY.
  • Einzelheiten zur API finden Sie GetJobTaggingin der API-Referenz zum AWS SDK für SAP ABAP.

Das folgende Codebeispiel zeigt die VerwendungPutJobTagging.

SDK für SAP ABAP
Anmerkung

Es gibt noch mehr dazu. GitHub Hier finden Sie das vollständige Beispiel und erfahren, wie Sie das AWS-Code-Beispiel- einrichten und ausführen.

TRY. lo_s3c->putjobtagging( iv_accountid = iv_account_id iv_jobid = iv_job_id it_tags = VALUE /aws1/cl_s3cs3tag=>tt_s3tagset( ( NEW /aws1/cl_s3cs3tag( iv_key = 'Environment' iv_value = 'Development' ) ) ( NEW /aws1/cl_s3cs3tag( iv_key = 'Team' iv_value = 'DataProcessing' ) ) ) ). MESSAGE |Tags added to job { iv_job_id }| TYPE 'I'. CATCH /aws1/cx_s3cnotfoundexception INTO DATA(lo_ex_nf). MESSAGE lo_ex_nf->get_text( ) TYPE 'I'. RAISE EXCEPTION TYPE /aws1/cx_rt_generic EXPORTING previous = lo_ex_nf. CATCH /aws1/cx_s3ctoomanytagsex INTO DATA(lo_ex_tags). MESSAGE lo_ex_tags->get_text( ) TYPE 'I'. RAISE EXCEPTION TYPE /aws1/cx_rt_generic EXPORTING previous = lo_ex_tags. CATCH /aws1/cx_s3cclientexc INTO DATA(lo_ex_cli). MESSAGE lo_ex_cli->get_text( ) TYPE 'I'. RAISE EXCEPTION TYPE /aws1/cx_rt_generic EXPORTING previous = lo_ex_cli. CATCH /aws1/cx_s3cserverexc INTO DATA(lo_ex_srv). MESSAGE lo_ex_srv->get_text( ) TYPE 'I'. RAISE EXCEPTION TYPE /aws1/cx_rt_generic EXPORTING previous = lo_ex_srv. ENDTRY.
  • Einzelheiten zur API finden Sie PutJobTaggingin der API-Referenz zum AWS SDK für SAP ABAP.

Das folgende Codebeispiel zeigt die VerwendungUpdateJobPriority.

SDK für SAP ABAP
Anmerkung

Es gibt noch mehr dazu. GitHub Hier finden Sie das vollständige Beispiel und erfahren, wie Sie das AWS-Code-Beispiel- einrichten und ausführen.

TRY. oo_result = lo_s3c->updatejobpriority( " oo_result is returned for testing purposes. iv_accountid = iv_account_id iv_jobid = iv_job_id iv_priority = 60 ). MESSAGE |Job { oo_result->get_jobid( ) } priority updated to { oo_result->get_priority( ) }| TYPE 'I'. CATCH /aws1/cx_s3cnotfoundexception INTO DATA(lo_ex_nf). MESSAGE lo_ex_nf->get_text( ) TYPE 'I'. RAISE EXCEPTION TYPE /aws1/cx_rt_generic EXPORTING previous = lo_ex_nf. CATCH /aws1/cx_s3cbadrequestex INTO DATA(lo_ex_bad). MESSAGE lo_ex_bad->get_text( ) TYPE 'I'. RAISE EXCEPTION TYPE /aws1/cx_rt_generic EXPORTING previous = lo_ex_bad. CATCH /aws1/cx_s3cclientexc INTO DATA(lo_ex_cli). MESSAGE lo_ex_cli->get_text( ) TYPE 'I'. RAISE EXCEPTION TYPE /aws1/cx_rt_generic EXPORTING previous = lo_ex_cli. CATCH /aws1/cx_s3cserverexc INTO DATA(lo_ex_srv). MESSAGE lo_ex_srv->get_text( ) TYPE 'I'. RAISE EXCEPTION TYPE /aws1/cx_rt_generic EXPORTING previous = lo_ex_srv. ENDTRY.
  • Einzelheiten zur API finden Sie UpdateJobPriorityin der API-Referenz zum AWS SDK für SAP ABAP.

Das folgende Codebeispiel zeigt die VerwendungUpdateJobStatus.

SDK für SAP ABAP
Anmerkung

Es gibt noch mehr dazu. GitHub Hier finden Sie das vollständige Beispiel und erfahren, wie Sie das AWS-Code-Beispiel- einrichten und ausführen.

TRY. " iv_requested_status = 'Cancelled' oo_result = lo_s3c->updatejobstatus( " oo_result is returned for testing purposes. iv_accountid = iv_account_id iv_jobid = iv_job_id iv_requestedjobstatus = iv_requested_status ). MESSAGE |Job { oo_result->get_jobid( ) } status updated to { oo_result->get_status( ) }| TYPE 'I'. CATCH /aws1/cx_s3cjobstatusexception INTO DATA(lo_ex_js). MESSAGE lo_ex_js->get_text( ) TYPE 'I'. RAISE EXCEPTION TYPE /aws1/cx_rt_generic EXPORTING previous = lo_ex_js. CATCH /aws1/cx_s3cnotfoundexception INTO DATA(lo_ex_nf). MESSAGE lo_ex_nf->get_text( ) TYPE 'I'. RAISE EXCEPTION TYPE /aws1/cx_rt_generic EXPORTING previous = lo_ex_nf. CATCH /aws1/cx_s3cclientexc INTO DATA(lo_ex_cli). MESSAGE lo_ex_cli->get_text( ) TYPE 'I'. RAISE EXCEPTION TYPE /aws1/cx_rt_generic EXPORTING previous = lo_ex_cli. CATCH /aws1/cx_s3cserverexc INTO DATA(lo_ex_srv). MESSAGE lo_ex_srv->get_text( ) TYPE 'I'. RAISE EXCEPTION TYPE /aws1/cx_rt_generic EXPORTING previous = lo_ex_srv. ENDTRY.
  • Einzelheiten zur API finden Sie UpdateJobStatusin der API-Referenz zum AWS SDK für SAP ABAP.