Skip to content

/AWS1/IF_BIL=>GETCREDITS()

About GetCredits

Returns the list of Amazon Web Services account credits for the specified account. Each credit includes its identifier, type, monetary amounts, applicable products, expiration, sharing configuration, and current enabled status.

When the caller is the management account of a consolidated billing family and payerAccountFlag is true, the response aggregates credits across the entire family. Otherwise, the response includes only credits owned by the account specified in accountId.

Method Signature

METHODS /AWS1/IF_BIL~GETCREDITS
  IMPORTING
    !IV_ACCOUNTID TYPE /AWS1/BILSTRING OPTIONAL
    !IV_STARTDATE TYPE /AWS1/BILTIMESTAMP OPTIONAL
    !IV_ENDDATE TYPE /AWS1/BILTIMESTAMP OPTIONAL
    !IV_PAYERACCOUNTFLAG TYPE /AWS1/BILBOOLEAN OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_bilgetcreditsresponse
  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/BILSTRING /AWS1/BILSTRING

The Amazon Web Services account ID. Must be a 12-digit numeric string.

iv_startdate TYPE /AWS1/BILTIMESTAMP /AWS1/BILTIMESTAMP

The start date for the credit period as Unix epoch seconds. Must be a past date that is not more than one year before the current date.

Optional arguments:

iv_enddate TYPE /AWS1/BILTIMESTAMP /AWS1/BILTIMESTAMP

The end date for the credit period as Unix epoch seconds. Must not be a future date and must be on or after startDate. Defaults to the current date when omitted.

iv_payeraccountflag TYPE /AWS1/BILBOOLEAN /AWS1/BILBOOLEAN

When true and the caller is the management account, the response aggregates credits across the entire consolidated billing family. When false or omitted, returns only credits for the specified accountId.

RETURNING

oo_output TYPE REF TO /aws1/cl_bilgetcreditsresponse /AWS1/CL_BILGETCREDITSRESPONSE

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->getcredits(
  iv_accountid = |string|
  iv_enddate = '20150101000000.0000000'
  iv_payeraccountflag = ABAP_TRUE
  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_credits( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_creditid = lo_row_1->get_creditid( ).
      lv_accountid = lo_row_1->get_accountid( ).
      lv_string = lo_row_1->get_credittype( ).
      lo_amount = lo_row_1->get_initialamount( ).
      IF lo_amount IS NOT INITIAL.
        lv_currencycode = lo_amount->get_currencycode( ).
        lv_currencyamount = lo_amount->get_currencyamount( ).
      ENDIF.
      lo_amount = lo_row_1->get_remainingamount( ).
      IF lo_amount IS NOT INITIAL.
        lv_currencycode = lo_amount->get_currencycode( ).
        lv_currencyamount = lo_amount->get_currencyamount( ).
      ENDIF.
      lo_amount = lo_row_1->get_estimatedamount( ).
      IF lo_amount IS NOT INITIAL.
        lv_currencycode = lo_amount->get_currencycode( ).
        lv_currencyamount = lo_amount->get_currencyamount( ).
      ENDIF.
      LOOP AT lo_row_1->get_applicableproductnames( ) into lo_row_2.
        lo_row_3 = lo_row_2.
        IF lo_row_3 IS NOT INITIAL.
          lv_productname = lo_row_3->get_value( ).
        ENDIF.
      ENDLOOP.
      lv_string = lo_row_1->get_description( ).
      lv_timestamp = lo_row_1->get_startdate( ).
      lv_timestamp = lo_row_1->get_enddate( ).
      lv_timestamp = lo_row_1->get_exhaustdate( ).
      lv_applicationtype = lo_row_1->get_applicationtype( ).
      LOOP AT lo_row_1->get_shareableaccounts( ) into lo_row_4.
        lo_row_5 = lo_row_4.
        IF lo_row_5 IS NOT INITIAL.
          lv_accountid = lo_row_5->get_value( ).
        ENDIF.
      ENDLOOP.
      lv_boolean = lo_row_1->get_accthascreditshareenbld( ).
      lv_string = lo_row_1->get_creditconsolevisibility( ).
      lv_creditsharingtype = lo_row_1->get_creditsharingtype( ).
      lv_string = lo_row_1->get_costcategoryarn( ).
      lv_string = lo_row_1->get_rulename( ).
      lv_creditstatus = lo_row_1->get_creditstatus( ).
      LOOP AT lo_row_1->get_purchasetypeapplications( ) into lo_row_6.
        lo_row_7 = lo_row_6.
        IF lo_row_7 IS NOT INITIAL.
          lv_purchasetype = lo_row_7->get_value( ).
        ENDIF.
      ENDLOOP.
    ENDIF.
  ENDLOOP.
ENDIF.