AWS code-library documentation change
Summary
Added SAP ABAP code example for CreateSchedule operation
Security assessment
Demonstrates scheduling functionality without security-specific features. Includes routine IAM role usage but no security vulnerability fixes or security-focused documentation.
Diff
diff --git a/code-library/latest/ug/scheduler_example_scheduler_CreateSchedule_section.md b/code-library/latest/ug/scheduler_example_scheduler_CreateSchedule_section.md index 0089e13d8..04538bfe4 100644 --- a//code-library/latest/ug/scheduler_example_scheduler_CreateSchedule_section.md +++ b//code-library/latest/ug/scheduler_example_scheduler_CreateSchedule_section.md @@ -296,0 +297,94 @@ There's more on GitHub. Find the complete example and learn how to set up and ru +SAP ABAP + + +**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](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/sap-abap/services/scd#code-examples). + + + TRY. + " Constants for time calculations + DATA lv_start_date TYPE /aws1/scdstartdate. + DATA lv_end_date TYPE /aws1/scdenddate. + DATA lv_start_timestamp TYPE timestamp. + DATA lv_end_timestamp TYPE timestamp. + DATA lv_hours_to_run TYPE i VALUE 1. + + " Get current timestamp + GET TIME STAMP FIELD lv_start_timestamp. + + " Add 1 hour to the current timestamp using CL_ABAP_TSTMP + lv_end_timestamp = cl_abap_tstmp=>add( + tstmp = lv_start_timestamp + secs = lv_hours_to_run * 3600 ). + + " Convert timestamps to decimal format for AWS API + lv_start_date = lv_start_timestamp. + lv_end_date = lv_end_timestamp. + + " Prepare flexible time window configuration + DATA lo_flexible_time_window TYPE REF TO /aws1/cl_scdflexibletimewindow. + IF iv_use_flexible_time_win = abap_true. + " iv_use_flexible_time_win = ABAP_TRUE + " Example: Set MaximumWindowInMinutes to 10 for flexible window + lo_flexible_time_window = NEW /aws1/cl_scdflexibletimewindow( + iv_mode = 'FLEXIBLE' + iv_maximumwindowinminutes = 10 ). + ELSE. + lo_flexible_time_window = NEW /aws1/cl_scdflexibletimewindow( + iv_mode = 'OFF' ). + ENDIF. + + " Prepare target configuration + " Example iv_target_arn = 'arn:aws:sqs:us-east-1:123456789012:my-queue' + " Example iv_role_arn = 'arn:aws:iam::123456789012:role/SchedulerRole' + " Example iv_input = '{"message": "Hello from EventBridge Scheduler"}' + DATA(lo_target) = NEW /aws1/cl_scdtarget( + iv_arn = iv_target_arn + iv_rolearn = iv_role_arn + iv_input = iv_input ). + + " Set action after completion if needed + DATA lv_action_after_completion TYPE /aws1/scdactionaftercompletion. + IF iv_delete_after_completion = abap_true. + " iv_delete_after_completion = ABAP_TRUE + lv_action_after_completion = 'DELETE'. + ELSE. + lv_action_after_completion = 'NONE'. + ENDIF. + + " Create the schedule + " Example iv_name = 'my-schedule' + " Example iv_schedule_expression = 'rate(15 minutes)' + " Example iv_schedule_group_name = 'my-schedule-group' + DATA(lo_result) = lo_scd->createschedule( + iv_name = iv_name + iv_scheduleexpression = iv_schedule_expression + iv_groupname = iv_schedule_group_name + io_target = lo_target + io_flexibletimewindow = lo_flexible_time_window + iv_startdate = lv_start_date + iv_enddate = lv_end_date + iv_actionaftercompletion = lv_action_after_completion ). + + ov_schedule_arn = lo_result->get_schedulearn( ). + MESSAGE 'Schedule created successfully.' TYPE 'I'. + + CATCH /aws1/cx_scdconflictexception INTO DATA(lo_conflict_ex). + DATA(lv_error) = |Conflict creating schedule: { lo_conflict_ex->if_message~get_text( ) }|. + MESSAGE lv_error TYPE 'I'. + CATCH /aws1/cx_rt_generic INTO DATA(lo_generic_ex). + DATA(lv_generic_error) = |Error creating schedule: { lo_generic_ex->if_message~get_text( ) }|. + MESSAGE lv_generic_error TYPE 'I'. + ENDTRY. + + + + * For API details, see [CreateSchedule](https://docs.aws.amazon.com/sdk-for-sap-abap/v1/api/latest/index.html) in _AWS SDK for SAP ABAP API reference_. + + + +