Skip to content

/AWS1/IF_BTC=>TERMINATEJOBS()

About TerminateJobs

Terminates up to 50 jobs in a job queue. This is a bulk version of TerminateJob. Jobs that are in the STARTING or RUNNING state are terminated, which causes them to transition to FAILED. Jobs that have not progressed to the STARTING state are cancelled.

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.

Method Signature

METHODS /AWS1/IF_BTC~TERMINATEJOBS
  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_btctermjobsresponse
  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 terminate.

iv_reason TYPE /AWS1/BTCSTRING /AWS1/BTCSTRING

A message to attach to the job that explains the reason for terminating 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_btctermjobsresponse /AWS1/CL_BTCTERMJOBSRESPONSE

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->terminatejobs(
  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 terminate multiple jobs

This example terminates the jobs with the specified job IDs.

DATA(lo_result) = lo_client->terminatejobs(
  it_jobs = VALUE /aws1/cl_btcstringlist_w=>tt_stringlist(
    ( new /aws1/cl_btcstringlist_w( |61e743ed-35e4-48da-b2de-5c8333821c84| ) )
    ( new /aws1/cl_btcstringlist_w( |b3d0f26e-6d3a-4a5b-9c2e-7f4a1b2c3d4e| ) )
  )
  iv_reason = |Terminating jobs.|
).