Skip to Content

Short read

In this blog the creation of an Odata Service is shown which can be used to get the unit test data of an ABAP Netweaver system. The target is to make the information about the actual Unit test state of ABAP packages available for a external Continuous Integration system. This systems can be for example Jenkins or the Eclipse plugin abapCI.

To get the information whether all tests of a package are valid or not the ABAP class cl_aunit_adt_res_test_runs is used. The code to extract the package status is available on github: zabap_ci and can be imported with abapGit.

Also the code for the endpoint is available on github, see zabap_ci_ep. But as this is a standard Gateway service which generated a bunch of code the best way to create the gateway service is certainly the tool SEGW (see a step by step explanation for an ABAP 7.5 system below).

In any case the target of this blog is to get a running Odata-Service


where ‘PACKAGE_TO_TEST’ is the package name for that the unit test data should be retrieved and can be used for further processing in Jenkins or the Eclipse Plugin abapCI

Long read

Odata Service created with the SAP Gateway Service Builder

To create an Odata service the first step is to create a package. See below some sample values – but feel free to use your own coding conventions.

The central element of the Odata service is the Data model. For this Odata service a structure is used: zst_abap_ci_summary which is converted by the SAP Gateway Service Builder automatically into the Data model.

The defintion of this structure and also a class zcl_aunit_testrun which delivers the information about the unit test  state of one package can be found in the following github repository zabap_ci.

The class zcl_aunit_testrun should be included in the extension of the Data provider class for the above created service. In the here shown example the generated class name is ZCL_ZABAP_CI_EP_DPC_EXT, where you can redefine the OdataCall for getEntity in the method /iwbep/if_mgw_appl_srv_runtime~get_entity. See a sample code below.


class ZCL_ZABAP_CI_EP_DPC_EXT definition
  inheriting from ZCL_ZABAP_CI_EP_DPC
  create public .

public section.
methods /iwbep/if_mgw_appl_srv_runtime~get_entity redefinition .
protected section.
private section.

method /iwbep/if_mgw_appl_srv_runtime~get_entity.

    read table it_key_tab into data(ls_key_tab) with key name = 'PackageName'.

    data(aunit_testrun) = new zcl_aunit_testrun( ).
    data(abap_ci_summary_entity)  = aunit_testrun->get_test_run_result( exporting package_name = ls_key_tab-value ).

                is_data = abap_ci_summary_entity
                cr_data = er_entity    ).


In ABAP 7.5 the activation (or registration) of a service is literally one click. Under Service Maintenance you can use the Register button to make your service public available.

To test if the service is up and running the SAP Gateway Client can be used.

After finishing the above steps and ensuring that the service is up and running the service can be used to provide the unit test status of a package to external systems like Jenkins or the Eclipse plugin abapCI.

The created Odata Service returns in the tag TestResult the information whether the testrun of the package was OK or not. This is indicated in the tag TestResult by the strings TESTRUN_OK or TESTRUN_FAILED.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply