Skip to content

/AWS1/IF_CWL=>GETSCHEDULEDQUERYHISTORY()

About GetScheduledQueryHistory

Retrieves the execution history of a scheduled query within a specified time range, including query results and destination processing status.

Method Signature

METHODS /AWS1/IF_CWL~GETSCHEDULEDQUERYHISTORY
  IMPORTING
    !IV_IDENTIFIER TYPE /AWS1/CWLSCHEDULEDQUERYID OPTIONAL
    !IV_STARTTIME TYPE /AWS1/CWLTIMESTAMP OPTIONAL
    !IV_ENDTIME TYPE /AWS1/CWLTIMESTAMP OPTIONAL
    !IT_EXECUTIONSTATUSES TYPE /AWS1/CL_CWLEXECSTATUSLIST_W=>TT_EXECUTIONSTATUSLIST OPTIONAL
    !IV_MAXRESULTS TYPE /AWS1/CWLGETSCHDQUERYHISTORY00 OPTIONAL
    !IV_NEXTTOKEN TYPE /AWS1/CWLNEXTTOKEN OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_cwlgetschdqueryhist01
  RAISING
    /AWS1/CX_CWLACCESSDENIEDEX
    /AWS1/CX_CWLINTERNALSERVEREX
    /AWS1/CX_CWLRESOURCENOTFOUNDEX
    /AWS1/CX_CWLTHROTTLINGEX
    /AWS1/CX_CWLVALIDATIONEX
    /AWS1/CX_CWLCLIENTEXC
    /AWS1/CX_CWLSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_identifier TYPE /AWS1/CWLSCHEDULEDQUERYID /AWS1/CWLSCHEDULEDQUERYID

The ARN or name of the scheduled query to retrieve history for.

iv_starttime TYPE /AWS1/CWLTIMESTAMP /AWS1/CWLTIMESTAMP

The start time for the history query in Unix epoch format.

iv_endtime TYPE /AWS1/CWLTIMESTAMP /AWS1/CWLTIMESTAMP

The end time for the history query in Unix epoch format.

Optional arguments:

it_executionstatuses TYPE /AWS1/CL_CWLEXECSTATUSLIST_W=>TT_EXECUTIONSTATUSLIST TT_EXECUTIONSTATUSLIST

An array of execution statuses to filter the history results. Only executions with the specified statuses are returned.

iv_maxresults TYPE /AWS1/CWLGETSCHDQUERYHISTORY00 /AWS1/CWLGETSCHDQUERYHISTORY00

The maximum number of history records to return. Valid range is 1 to 1000.

iv_nexttoken TYPE /AWS1/CWLNEXTTOKEN /AWS1/CWLNEXTTOKEN

The token for the next set of items to return. The token expires after 24 hours.

RETURNING

oo_output TYPE REF TO /aws1/cl_cwlgetschdqueryhist01 /AWS1/CL_CWLGETSCHDQUERYHIST01

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->getscheduledqueryhistory(
  it_executionstatuses = VALUE /aws1/cl_cwlexecstatuslist_w=>tt_executionstatuslist(
    ( new /aws1/cl_cwlexecstatuslist_w( |string| ) )
  )
  iv_endtime = 123
  iv_identifier = |string|
  iv_maxresults = 123
  iv_nexttoken = |string|
  iv_starttime = 123
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_scheduledqueryname = lo_result->get_name( ).
  lv_arn = lo_result->get_scheduledqueryarn( ).
  LOOP AT lo_result->get_triggerhistory( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_queryid = lo_row_1->get_queryid( ).
      lv_executionstatus = lo_row_1->get_executionstatus( ).
      lv_timestamp = lo_row_1->get_triggeredtimestamp( ).
      lv_string = lo_row_1->get_errormessage( ).
      LOOP AT lo_row_1->get_destinations( ) into lo_row_2.
        lo_row_3 = lo_row_2.
        IF lo_row_3 IS NOT INITIAL.
          lv_scheduledquerydestinati = lo_row_3->get_destinationtype( ).
          lv_string = lo_row_3->get_destinationidentifier( ).
          lv_actionstatus = lo_row_3->get_status( ).
          lv_string = lo_row_3->get_processedidentifier( ).
          lv_string = lo_row_3->get_errormessage( ).
        ENDIF.
      ENDLOOP.
    ENDIF.
  ENDLOOP.
  lv_nexttoken = lo_result->get_nexttoken( ).
ENDIF.