/AWS1/IF_BTC=>CANCELJOBS()¶
About CancelJobs¶
Cancels up to 50 jobs in an Batch job queue. This is a bulk version of CancelJob. Jobs that are in a
SUBMITTED, PENDING, or RUNNABLE state are cancelled
and the job status is updated to FAILED.
A PENDING job is cancelled after all dependency jobs are completed.
Therefore, it might take longer than expected to cancel a job in PENDING
status.
When you try to cancel an array parent job in PENDING, Batch attempts to
cancel all child jobs. The array parent job is cancelled when all child jobs are
completed.
Jobs that progressed to the STARTING or RUNNING state aren't
cancelled. These jobs must be terminated with the TerminateJob or
TerminateJobs operation.
Batch reports the result for each job individually in the response. Jobs that
were processed successfully are reported in the successful list. Jobs that
encountered errors are reported in the errors list. The response returns an
HTTP status code of 200 even when some jobs encountered errors, so check the
errors list. Jobs that can't be found are treated as successfully
processed.
This operation requires batch:CancelJob permission for each job in the
request. There is no separate batch:CancelJobs IAM action. If a caller's IAM
policy grants batch:CancelJob, they can use both the singular
CancelJob and bulk CancelJobs operations.
Method Signature¶
METHODS /AWS1/IF_BTC~CANCELJOBS
IMPORTING
!IT_JOBS TYPE /AWS1/CL_BTCSTRINGLIST_W=>TT_STRINGLIST OPTIONAL
!IV_REASON TYPE /AWS1/BTCSTRING OPTIONAL
RETURNING
VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_btccanceljobsresponse
RAISING
/AWS1/CX_BTCCLIENTEXCEPTION
/AWS1/CX_BTCSERVEREXCEPTION
/AWS1/CX_BTCCLIENTEXC
/AWS1/CX_BTCSERVEREXC
/AWS1/CX_RT_TECHNICAL_GENERIC
/AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
it_jobs TYPE /AWS1/CL_BTCSTRINGLIST_W=>TT_STRINGLIST TT_STRINGLIST¶
An array of up to 50 Batch job IDs of the jobs to cancel.
iv_reason TYPE /AWS1/BTCSTRING /AWS1/BTCSTRING¶
A message to attach to the job that explains the reason for cancelling it. This message is returned by future DescribeJobs operations on the job. It is also recorded in the Batch activity logs.
This parameter has a limit of 1024 characters.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_btccanceljobsresponse /AWS1/CL_BTCCANCELJOBSRESPONSE¶
Examples¶
Syntax Example¶
This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.
DATA(lo_result) = lo_client->canceljobs(
it_jobs = VALUE /aws1/cl_btcstringlist_w=>tt_stringlist(
( new /aws1/cl_btcstringlist_w( |string| ) )
)
iv_reason = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
LOOP AT lo_result->get_successful( ) into lo_row.
lo_row_1 = lo_row.
IF lo_row_1 IS NOT INITIAL.
lv_string = lo_row_1->get_value( ).
ENDIF.
ENDLOOP.
LOOP AT lo_result->get_errors( ) into lo_row_2.
lo_row_3 = lo_row_2.
IF lo_row_3 IS NOT INITIAL.
lv_string = lo_row_3->get_job( ).
lv_string = lo_row_3->get_code( ).
lv_string = lo_row_3->get_message( ).
ENDIF.
ENDLOOP.
ENDIF.
To cancel multiple jobs¶
This example cancels the jobs with the specified job IDs.
DATA(lo_result) = lo_client->canceljobs(
it_jobs = VALUE /aws1/cl_btcstringlist_w=>tt_stringlist(
( new /aws1/cl_btcstringlist_w( |1d828f65-7a4d-42e8-996d-3b900ed59dc4| ) )
( new /aws1/cl_btcstringlist_w( |b3d0f26e-6d3a-4a5b-9c2e-7f4a1b2c3d4e| ) )
)
iv_reason = |Cancelling jobs.|
).