Skip to content

/AWS1/IF_BIL=>GETCREDITALLOCATIONHISTORY()

About GetCreditAllocationHistory

Returns the per-billing-month allocation history for credits applied to an Amazon Web Services account's bills. Traverses the consolidated billing family to capture cross-account credit applications. Supports pagination and optional filtering to a single credit.

Method Signature

METHODS /AWS1/IF_BIL~GETCREDITALLOCATIONHISTORY
  IMPORTING
    !IV_ACCOUNTID TYPE /AWS1/BILACCOUNTID OPTIONAL
    !IV_CREDITID TYPE /AWS1/BILLONG OPTIONAL
    !IV_STARTDATE TYPE /AWS1/BILTIMESTAMP OPTIONAL
    !IV_ENDDATE TYPE /AWS1/BILTIMESTAMP OPTIONAL
    !IV_NEXTTOKEN TYPE /AWS1/BILPAGETOKEN OPTIONAL
    !IV_MAXRESULTS TYPE /AWS1/BILINTEGER OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_bilgtcrdtallochistrsp
  RAISING
    /AWS1/CX_BILACCESSDENIEDEX
    /AWS1/CX_BILINTERNALSERVEREX
    /AWS1/CX_BILTHROTTLINGEX
    /AWS1/CX_BILVALIDATIONEX
    /AWS1/CX_BILCLIENTEXC
    /AWS1/CX_BILSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_accountid TYPE /AWS1/BILACCOUNTID /AWS1/BILACCOUNTID

The Amazon Web Services account ID whose allocation history to retrieve. Must be a 12-digit numeric string.

iv_startdate TYPE /AWS1/BILTIMESTAMP /AWS1/BILTIMESTAMP

Inclusive start date as Unix epoch seconds. Must be on or before endDate. The range from startDate to endDate cannot exceed 24 billing months.

iv_enddate TYPE /AWS1/BILTIMESTAMP /AWS1/BILTIMESTAMP

Inclusive end date as Unix epoch seconds.

Optional arguments:

iv_creditid TYPE /AWS1/BILLONG /AWS1/BILLONG

Filters the result to a single credit. When omitted, returns allocation entries for all credits.

iv_nexttoken TYPE /AWS1/BILPAGETOKEN /AWS1/BILPAGETOKEN

Pagination token from a previous response. Pass the value returned in nextToken to retrieve the next page of results.

iv_maxresults TYPE /AWS1/BILINTEGER /AWS1/BILINTEGER

The maximum number of records to return per page. Range: 1 to 1000. Default: 100.

RETURNING

oo_output TYPE REF TO /aws1/cl_bilgtcrdtallochistrsp /AWS1/CL_BILGTCRDTALLOCHISTRSP

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->getcreditallocationhistory(
  iv_accountid = |string|
  iv_creditid = 123
  iv_enddate = '20150101000000.0000000'
  iv_maxresults = 123
  iv_nexttoken = |string|
  iv_startdate = '20150101000000.0000000'
).

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_creditallochistorylist( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_creditid = lo_row_1->get_creditid( ).
      lo_amount = lo_row_1->get_creditamount( ).
      IF lo_amount IS NOT INITIAL.
        lv_currencycode = lo_amount->get_currencycode( ).
        lv_currencyamount = lo_amount->get_currencyamount( ).
      ENDIF.
      lv_string = lo_row_1->get_description( ).
      lv_accountid = lo_row_1->get_accountid( ).
      lv_string = lo_row_1->get_appliedservicename( ).
      lv_billingmonth = lo_row_1->get_billingmonth( ).
      lv_boolean = lo_row_1->get_isestimatedbill( ).
    ENDIF.
  ENDLOOP.
  lv_boolean = lo_result->get_partialresults( ).
  LOOP AT lo_result->get_failedmonths( ) into lo_row_2.
    lo_row_3 = lo_row_2.
    IF lo_row_3 IS NOT INITIAL.
      lv_billingmonth = lo_row_3->get_value( ).
    ENDIF.
  ENDLOOP.
  lv_pagetoken = lo_result->get_nexttoken( ).
ENDIF.