Skip to Content
Technical Articles
Author's profile photo Sebastian Michler

Introducing the XCO Library Cloud Platform edition


Starting with CE 2008 the XCO Library is now publicly available on the SAP Cloud Platform ABAP Environment (aka Steampunk) for the first time. It is a completely newly engineered development library for ABAP with the goal to offer a highly intuitive and effective development experience for tasks that go beyond the mere scope of the ABAP programming language.

With this blog post I want to give you a first impression of what working with the XCO Library looks like. A detailed explanation of the overall organization, design principles and available functionality is provided with the official documentation, which can be found at

A first impression of the library

The initial CE 2008 shipment of the XCO Library already comes with a wealth of functionality for different areas. To give you an idea of how the XCO Library looks and feels like in action I will provide a simple, integrated example that showcases the following aspects:

  • Creating and releasing transports
  • Generating ABAP Repository objects
  • Searching for and accessing the content of ABAP Repository objects

At first we will have a look at how a new Workbench transport request can be created. Before being able to create a new transport request the transport target which is usually derived from the transport layer of a development package needs to be known. With the XCO Library, we can perform these operations concisely with just the following statements:

DATA(lo_package) = xco_cp_abap_repository=>package->for( 'Z_MY_PACKAGE' ).

DATA(lv_transport_target) = lo_package->read(

DATA(lo_transport_request) = xco_cp_cts=>transports->workbench( lv_transport_target
  )->create_request( 'My generated transport request' ).

Equipped with a development package and a modifiable transport request we can use the XCO Generation APIs to easily create a new database table with a simple CDS view entity on top of it:

DATA(lo_put_operation) = xco_cp_generation=>environment->dev_system( lo_transport_request->value
  )->create_put_operation( ).

" Add the database table to the PUT operation.
DATA(lo_database_table) = lo_put_operation->for-tabl-for-database_table->add_object( 'ZMY_DBT'
  )->set_package( lo_package->name
  )->create_form_specification( ).
lo_database_table->set_short_description( 'My generated database table' ).
lo_database_table->set_delivery_class( xco_cp_database_table=>delivery_class->l ).
lo_database_table->set_data_maintenance( xco_cp_database_table=>data_maintenance->allowed ).

lo_database_table->add_field( 'KEY_FIELD'
  )->set_type( xco_cp_abap_dictionary=>built_in_type->char( 30 )
  )->set_not_null( ).

" Further fields (including information about foreign keys, search helps, etc.) can be
" added following the same pattern.

" Add the data definition for the CDS view entity to the PUT operation
DATA(lo_data_definition) = lo_put_operation->for-ddls->add_object( 'ZMY_VIEW_ENTITY'
  )->set_package( lo_package->name
  )->create_form_specification( ).
lo_data_definition->set_short_description( 'My generated view entity' ).

DATA(lo_view_entity) = lo_data_definition->add_view_entity( ).
lo_view_entity->data_source->set_view_entity( 'ZMY_DBT' ).

DATA(lo_key_field) = lo_view_entity->add_field( xco_cp_ddl=>field( 'KEY_FIELD' ) ).
lo_key_field->set_key( )->set_alias( 'keyField' ).
lo_key_field->add_annotation( 'EndUserText.label' )->value->build( )->add_string( 'Key field' ).

lo_put_operation->execute( ).

Executing this coding will result in the following database table and CDS view entity being created (or updated in case they already exist) and activated together in a single mass activation:


Generated database table



Generated view entity

Database tables and data definitions are just two examples of object types that are already supported by the XCO Generation APIs. With the CE 2008 shipment it is possible to generate all the objects that go into a full-fledged RAP business object, starting from domains, data elements and database tables over CDS view entities and behavior definitions all the way up to service definitions and service bindings. An overview of all currently supported object types is available here.

Where the XCO Generation APIs allow you to modify the ABAP Repository by creating, updating or deleting objects, the XCO ABAP Repository APIs can be used to search for objects and read their contents:

DATA(lo_name_constraint) = xco_cp_abap_sql=>constraint->contains_pattern( 'ZMY_%' ).
DATA(lo_name_filter) = xco_cp_abap_repository=>object_name->get_filter( lo_name_constraint ).

" This query will retrieve all database tables whose name starts with ZMY_ that are contained
" in the package denoted by LO_PACKAGE.
DATA(lt_database_tables) = xco_cp_abap_repository=>objects->tabl->database_tables->where( VALUE #(
  ( lo_name_filter )
) )->in( lo_package )->get( ).

LOOP AT lt_database_tables INTO DATA(lo_database_table).
  " LS_CONTENT is a structure comprised of the header attributes of the
  " database table such as the delivery class or the technical settings.
  DATA(ls_content) = lo_database_table->content( )->get( ).

  " LT_FIELDS is a table of objects representing the fields of the database
  " table. As with the header information, the field objects can be used to
  " access the content of the field (e.g. its type or foreign key).
  DATA(lt_fields) = lo_database_table->fields->all->get( ).

Finally, releasing a transport request is as simple as

DATA(lt_transport_tasks) = lo_transport_request->get_tasks( ).

LOOP AT lt_transport_tasks INTO DATA(lo_transport_task).
  IF lo_transport_task->get_status( ) EQ xco_cp_transport=>status->modifiable.
    lo_transport_task->release( ).

lo_transport_request->release( ).

Next steps

The simple example presented above is meant to give you a sense of the expressiveness and power that is now available with the XCO Library.

The functionality offered with CE 2008 already ranges far beyond working with objects of the ABAP Repository. Other highlights include APIs for integrating business application logs into your own application logic as well as an already rich set of standard library functionality. This includes in particular the XCO JSON module which offers new ideas of how to work with JSON data in ABAP.

Feel free to try out the XCO Library and post your questions and thoughts in the comments. The XCO Library is still under very active development, so stay tuned for lots more features to come!

Last but not least I can highly recommend the blog from Andre Fischer about the RAP Generator that he has built based on the XCO Library. It allows you to easily generate complete RAP business objects which are defined in a JSON file and showcases what is now possible with the XCO Library on the SAP Cloud Platform ABAP Environment.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Thomas Schneider
      Thomas Schneider

      Hi Sebastian, thanks a lot for the great blog. This is really a very helpful improvement!


      Author's profile photo Ravi Singh
      Ravi Singh

      Great stuff Sebastian. This is just amazing.

      Author's profile photo Andre Fischer
      Andre Fischer

      The XCO libraries are very useful, indeed.

      Without them I would not have been able to develop my RAP Generator.

      Even better to get a first hand explanation from the product owner.

      Author's profile photo Stephan Heinberg
      Stephan Heinberg

      Thanks, Sebastian.

      Will XCO Library be available in the ABAP Platform 2020 as well, so you could use it on prem?

      Author's profile photo Sebastian Michler
      Sebastian Michler
      Blog Post Author

      Hi Stehan,

      yes, the Cloud Platform edition of the XCO Library will also be available in the ABAP Platform 2020.

      I am currently preparing a dedicated blog that will provide an overview of best practices and considerations when using the XCO Library in an On Premise environment.

      Best regards,


      Author's profile photo Santhosh Kumar Cheekoti
      Santhosh Kumar Cheekoti

      Hello Sebastian,

      Thank you for the Blog.

      1. Any plans to support below scenario?
        1. I have a data model in ODM format and I want to generate ABAP artifacts for the model( Base DDIC tables, CDS view, Associations, and RAP object

      PS : The library is nicely designed, especially ability for method chaining.

      Author's profile photo Sebastian Michler
      Sebastian Michler
      Blog Post Author

      Hi Santhosh,

      first of all thanks for the feedback!

      While the XCO Library does not provide built-in support for the ODM format its various modules should be combinable to realize such a use case:

      Best regards,


      Author's profile photo Tobias Bock
      Tobias Bock

      Hello Sebastian,

      we are currently using ABAP Platform 2021 on premise.

      Is there a possibility to get (and generate/modify) the local implementation types section of classes via XCO?

      Is there possibility to get the content (and generate/modify) of a CDS behaviour definition via XCO?

      If not is one of both or even both planned for future releases?

      Author's profile photo Andre Fischer
      Andre Fischer

      Hi Tobias,

      this is possible, indeed.

      Checkout the code of my RAP Generator, especially in the branch for on premise 2021.

      GitHub - SAP-samples/cloud-abap-rap at On-Premise-2021

      Here I generator behavior definitions using the method:

      create_bdef( )

      and behavior implementation classes for each definition in method:

      create_bil( )

      when I call


      Please note that there are two types of interfaces that have to be used when generating code for ABAP language version standard and ABAP language version 5 .

      Therefore I had to implement two different classes zdmo_cl_rap_generator and zdmo_cl_rap_generator_on_prem.

      The on_prem version will generate code for ABAP language version standard. If you want to generate language version 5 you have to use zdmo_cl_rap_generator and a package that has this language version.

      My new Fiori Elements UI will choose the correct class based on the language version of the package you chose.

      cloud-abap-rap/zdmo_cl_rap_generator_on_prem.clas.abap at On-Premise-2021 · SAP-samples/cloud-abap-rap · GitHub

      cloud-abap-rap/zdmo_cl_rap_generator.clas.abap at On-Premise-2021 · SAP-samples/cloud-abap-rap · GitHub

      *    DATA mo_environment TYPE REF TO if_xco_cp_gen_env_dev_system.
      *    DATA mo_put_operation  TYPE REF TO if_xco_cp_gen_d_o_put .
      *    DATA mo_draft_tabl_put_opertion TYPE REF TO if_xco_cp_gen_d_o_put .
      *    DATA mo_srvb_put_operation    TYPE REF TO if_xco_cp_gen_d_o_put .
          DATA mo_environment           TYPE REF TO if_xco_gen_environment .
          DATA mo_put_operation         TYPE REF TO if_xco_gen_o_mass_put.
          DATA mo_draft_tabl_put_opertion TYPE REF TO if_xco_gen_o_mass_put.
          DATA mo_srvb_put_operation    TYPE REF TO if_xco_gen_o_mass_put.

      Hope this helps.

      Kind regards,






      Author's profile photo Tobias Bock
      Tobias Bock

      Hello Andre,

      yes, that helps a lot. Thank you very much!


      Generation works, but I still don't get  how the read/get works (f.e. for a BDEF name or a class name).

      Read via xco_cp_abap_repository=>object->clas->fori_classname ) or
      xco_cp_abap=>classi_classname ) or
      xco_cp_abap_repository=>object->bdef->for( i_bdef_name ) 


      Author's profile photo Sebastian Michler
      Sebastian Michler
      Blog Post Author

      Hello Tobias,

      reading the content of a behavior definition is currently not supported. It is however possible to read the content of a class in a structured way. You can refer to for a detailed code sample.

      Best regards,


      Author's profile photo T. KASI SURYANARAYANA MURTHY

      Hi Sebastian,

      Thanks so much for the blog. is it possible to read and copy database tables from remote destination. I realized there is an option to read classes and interfaces from remote destination but not for dictionary objects.

      Something like this:

      DATA(lt_database_tables) = xco_cp_abap_repository=>objects->tabl->database_tables->all->in( 'ZPACKAGE')->get( io_origin = lo_remote_origin ).

      Appreciate your response.





      Author's profile photo Sebastian Michler
      Sebastian Michler
      Blog Post Author

      Hi Kasi,

      thanks for the feedback! As a matter of fact, the extension of the XCO remote reading functionality to objects of the ABAP Dictionary (in a similar fashion as it is offered for classes and interfaces) is currently under evaluation internally.

      Unfortunately, I cannot yet make any statements as to when (or if) this feature might become available, but it is a topic we are looking into.

      Best regards,


      Author's profile photo Pascal Ditzel
      Pascal Ditzel

      Hi, thanks for this blog.

      Is there a way to create an ABAP class with local test class implementation in the local object folder instead of providing a request?


      Kind Regards

      Author's profile photo T. KASI SURYANARAYANA MURTHY

      Hi, Thanks for the blog. I have one question. I have created a class to read and load data from on-premise Netweaver system table data to BTP using XCO library. Now we want to execute this class on a daily basis to update BTP table with delta changes coming from on onpremise system.

      Is there a easy way to schedule job in BTP similar to SM36 to run the class to update BTP table data.



      Author's profile photo Thomas Schneider
      Thomas Schneider

      Please check out application jobs:

      Best regards,




      Author's profile photo T. KASI SURYANARAYANA MURTHY


      Thanks for the response. Our developer has written the code to create job which worked fine but our customer is asking if there is a GUI where end users can create/change jobs similar to SM36 in ECC.

      Appreciate your response.



      Author's profile photo Thomas Schneider
      Thomas Schneider

      Please kindly refer to the documentation. In the documentation you will find a link to the Fiori app for managing application jobs.