
You create a measurement series with the Coverage API factory. You must specify a name for the series that is unique in the ABAP system. It is best to save a series right after you create it; the Coverage API checks the uniqueness of the name only when the series is saved.
Normally, you would set the defaults for the series before saving. For simplicity, this step is shown separately.
DATA: factory TYPE REF TO if_scv_factory,
repository TYPE REF TO if_scv_repository,
series TYPE REF TO if_scv_series.
factory = cl_scv_coverage_api=>get_factory( ).
repository = cl_scv_coverage_api=>get_repository( ).
series = factory->create_series( 'MY_UNIQUE_SERIES' ).
" Set defaults before saving
repository->save_series( series ). " Uniqueness of series name is checked.
If you have already created a series, then you load it to use it. A combined operation might look like this:
DATA: ex type ref to cx_scv_execution_error.
TRY.
repository->save_series( series ). " Uniqueness of series name is checked.
CATCH cx_scv_execution_error.
TRY.
series = repository->load_series( 'MY_UNIQUE_SERIES' ).
CATCH cx_scv_execution_error into ex.
<error message>
ENDTRY.
ENDTRY.
The next step (which should actually be integrated in this step) is to set defaults for the series.
Here is the complete tutorial program.