Skip to content

/AWS1/IF_SUS=>GETESTIMATEDCARBONEMISSIONS()

About GetEstimatedCarbonEmissions

Returns estimated carbon emission values based on customer grouping and filtering parameters. We recommend using pagination to ensure that the operation returns quickly and successfully.

Method Signature

METHODS /AWS1/IF_SUS~GETESTIMATEDCARBONEMISSIONS
  IMPORTING
    !IO_TIMEPERIOD TYPE REF TO /AWS1/CL_SUSTIMEPERIOD OPTIONAL
    !IT_GROUPBY TYPE /AWS1/CL_SUSDIMENSIONLIST_W=>TT_DIMENSIONLIST OPTIONAL
    !IO_FILTERBY TYPE REF TO /AWS1/CL_SUSFILTEREXPRESSION OPTIONAL
    !IT_EMISSIONSTYPES TYPE /AWS1/CL_SUSEMSNSTYPELIST_W=>TT_EMISSIONSTYPELIST OPTIONAL
    !IV_GRANULARITY TYPE /AWS1/SUSTIMEGRANULARITY OPTIONAL
    !IO_GRANULARITYCONFIGURATION TYPE REF TO /AWS1/CL_SUSGRANULARITYCONF OPTIONAL
    !IV_MAXRESULTS TYPE /AWS1/SUSMAXRESULTS OPTIONAL
    !IV_NEXTTOKEN TYPE /AWS1/SUSNEXTTOKEN OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_susgetestcrbnemsnsrsp
  RAISING
    /AWS1/CX_SUSACCESSDENIEDEX
    /AWS1/CX_SUSINTERNALSERVEREX
    /AWS1/CX_SUSTHROTTLINGEX
    /AWS1/CX_SUSVLDTNEXCEPTION
    /AWS1/CX_SUSCLIENTEXC
    /AWS1/CX_SUSSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

io_timeperiod TYPE REF TO /AWS1/CL_SUSTIMEPERIOD /AWS1/CL_SUSTIMEPERIOD

The date range for fetching estimated carbon emissions.

Optional arguments:

it_groupby TYPE /AWS1/CL_SUSDIMENSIONLIST_W=>TT_DIMENSIONLIST TT_DIMENSIONLIST

The dimensions available for grouping estimated carbon emissions.

io_filterby TYPE REF TO /AWS1/CL_SUSFILTEREXPRESSION /AWS1/CL_SUSFILTEREXPRESSION

The criteria for filtering estimated carbon emissions.

it_emissionstypes TYPE /AWS1/CL_SUSEMSNSTYPELIST_W=>TT_EMISSIONSTYPELIST TT_EMISSIONSTYPELIST

The emission types to include in the results. If absent, returns TOTAL_LBM_CARBON_EMISSIONS and TOTAL_MBM_CARBON_EMISSIONS emissions types.

iv_granularity TYPE /AWS1/SUSTIMEGRANULARITY /AWS1/SUSTIMEGRANULARITY

The time granularity for the results. If absent, uses MONTHLY time granularity.

io_granularityconfiguration TYPE REF TO /AWS1/CL_SUSGRANULARITYCONF /AWS1/CL_SUSGRANULARITYCONF

Configuration for fiscal year calculations when using YEARLY_FISCAL or QUARTERLY_FISCAL granularity.

iv_maxresults TYPE /AWS1/SUSMAXRESULTS /AWS1/SUSMAXRESULTS

The maximum number of results to return in a single call. Default is 40.

iv_nexttoken TYPE /AWS1/SUSNEXTTOKEN /AWS1/SUSNEXTTOKEN

The pagination token specifying which page of results to return in the response. If no token is provided, the default page is the first page.

RETURNING

oo_output TYPE REF TO /aws1/cl_susgetestcrbnemsnsrsp /AWS1/CL_SUSGETESTCRBNEMSNSRSP

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->getestimatedcarbonemissions(
  io_filterby = new /aws1/cl_susfilterexpression(
    it_dimensions = VALUE /aws1/cl_susdimenvaluelist_w=>tt_dimensionlistmap(
      (
        VALUE /aws1/cl_susdimenvaluelist_w=>ts_dimensionlistmap_maprow(
          key = |string|
          value = VALUE /aws1/cl_susdimenvaluelist_w=>tt_dimensionvaluelist(
            ( new /aws1/cl_susdimenvaluelist_w( |string| ) )
          )
        )
      )
    )
  )
  io_granularityconfiguration = new /aws1/cl_susgranularityconf( 123 )
  io_timeperiod = new /aws1/cl_sustimeperiod(
    iv_end = '20150101000000.0000000'
    iv_start = '20150101000000.0000000'
  )
  it_emissionstypes = VALUE /aws1/cl_susemsnstypelist_w=>tt_emissionstypelist(
    ( new /aws1/cl_susemsnstypelist_w( |string| ) )
  )
  it_groupby = VALUE /aws1/cl_susdimensionlist_w=>tt_dimensionlist(
    ( new /aws1/cl_susdimensionlist_w( |string| ) )
  )
  iv_granularity = |string|
  iv_maxresults = 123
  iv_nexttoken = |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_results( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lo_timeperiod = lo_row_1->get_timeperiod( ).
      IF lo_timeperiod IS NOT INITIAL.
        lv_timestamp = lo_timeperiod->get_start( ).
        lv_timestamp = lo_timeperiod->get_end( ).
      ENDIF.
      LOOP AT lo_row_1->get_dimensionsvalues( ) into ls_row_2.
        lv_key = ls_row_2-key.
        lo_value = ls_row_2-value.
        IF lo_value IS NOT INITIAL.
          lv_string = lo_value->get_value( ).
        ENDIF.
      ENDLOOP.
      lv_modelversion = lo_row_1->get_modelversion( ).
      LOOP AT lo_row_1->get_emissionsvalues( ) into ls_row_3.
        lv_key_1 = ls_row_3-key.
        lo_value_1 = ls_row_3-value.
        IF lo_value_1 IS NOT INITIAL.
          lv_double = lo_value_1->get_value( ).
          lv_emissionsunit = lo_value_1->get_unit( ).
        ENDIF.
      ENDLOOP.
    ENDIF.
  ENDLOOP.
  lv_nexttoken = lo_result->get_nexttoken( ).
ENDIF.

GetEstimatedCarbonEmissionsSuccess

GetEstimatedCarbonEmissionsSuccess

DATA(lo_result) = lo_client->getestimatedcarbonemissions(
  io_timeperiod = new /aws1/cl_sustimeperiod(
    iv_end = '20251231235959.9990000'
    iv_start = '20250101000000.0000000'
  )
  it_emissionstypes = VALUE /aws1/cl_susemsnstypelist_w=>tt_emissionstypelist(
    ( new /aws1/cl_susemsnstypelist_w( |TOTAL_LBM_CARBON_EMISSIONS| ) )
    ( new /aws1/cl_susemsnstypelist_w( |TOTAL_MBM_CARBON_EMISSIONS| ) )
    ( new /aws1/cl_susemsnstypelist_w( |TOTAL_SCOPE_1_CARBON_EMISSIONS| ) )
    ( new /aws1/cl_susemsnstypelist_w( |TOTAL_SCOPE_2_LBM_CARBON_EMISSIONS| ) )
    ( new /aws1/cl_susemsnstypelist_w( |TOTAL_SCOPE_2_MBM_CARBON_EMISSIONS| ) )
    ( new /aws1/cl_susemsnstypelist_w( |TOTAL_SCOPE_3_LBM_CARBON_EMISSIONS| ) )
    ( new /aws1/cl_susemsnstypelist_w( |TOTAL_SCOPE_3_MBM_CARBON_EMISSIONS| ) )
  )
  it_groupby = VALUE /aws1/cl_susdimensionlist_w=>tt_dimensionlist(
    ( new /aws1/cl_susdimensionlist_w( |SERVICE| ) )
  )
  iv_granularity = |MONTHLY|
).