Show TOC

Assigning Measurements to a Measurement SeriesLocate this document in the navigation structure

Procedure

Do you have a standalone measurement that actually should be added to a series?

No problem: You can assign a measurement to a series.

Assigning a measurement to a series adds it to the set of measurements associated with the series. No aggregation of the measurement with other series measurements occurs. You can assign a measurement even if the raw data of the measurement has been deleted. Assigning a measurement to a measurement series also assigns any results of the measurement to the series.

Sample Code

Here is sample code for loading a preexisting measurement series and then assigning a standalone measurement to the series.

REPORT  z_coverage_api_series_assign.

* Measurement Series
DATA: series     TYPE REF TO if_scv_series.

* Standalone Measurement and Results
DATA: factory TYPE REF TO if_scv_factory,
      standalone_measurement TYPE REF TO if_scv_measurement,
      standalone_result TYPE REF TO if_scv_result.

* Coverage API Repository
DATA repository TYPE REF TO if_scv_repository. 

* Exceptions 
DATA: ex_ops  TYPE REF TO cx_scv_execution_error,
      ex_call TYPE REF TO cx_scv_call_error.

* Load the series from the Coverage API repository
TRY.
    series = repository->load_series( 'SERIES_SMOI_29_7' ).
  CATCH cx_scv_execution_error INTO ex_ops.
  CATCH cx_scv_call_error INTO ex_call. 
ENDTRY.

* Create the repository
repository = cl_scv_coverage_api=>get_repository( ).

* Create a measurement that is not part of the series.
* You could also load a standalone measurement 
* that was saved to the repository
TRY.
    standalone_measurement = factory->create_measurement( 'STANDALONE_MEASUREMENT' ).
    standalone_measurement->start( ). "Coverage API defaults are used

    SUBMIT rsdssmpl_status AND RETURN.

    standalone_measurement->stop( ).
    standalone_result = standalone_measurement->build_package_result( 'SMOI' ).

    " Add the standalone measurement and result to the series. 
    series->assign_measurement( standalone_measurement ).

    " Save the measurement and result in the series
    repository->save_measurement( standalone_measurement ).

  CATCH cx_scv_execution_error INTO ex_ops.
  CATCH cx_scv_call_error INTO ex_call. 
ENDTRY.