This is a test message to test the length of the message box.
ABAP RAP Generator
Created by Software-Heroes

RAP - Generator (Fiori)


In this article we will look at the more complex RAP generator as a Fiori Elements application and what advantages you have with it.

Last week we looked at the RAP Generator, which comes with the ABAP Development Tools. What was particularly noticeable was that you could only generate one entity with it. In this article we look at another project that allows more possibilities for generation.



Even before the RAP Generator was developed in the ABAP Development Tools, there was the RAP Generator which was developed by Andre Fischer, an employee at SAP. In the beginning it was an HTTP service that was configured with a JSON file in order to then generate objects in the system. There is now its own, quite complex, Fiori Elements app that guides you through the generation process and offers a nice input for the data. Since it is an open source project, you can use it freely to create RAP objects.



To install on your system, you need the abapGit Client for the on-premise system or the abapGit Plugn for Eclipse if you work in the cloud. You can then carry out the installation via the GitHub repository, where you will also find instructions, as there are currently different versions for the different environments. After installation, make sure that all objects in the system are activated and finally release the OData v4 service in the system via “Publish”. If you want to start the application, you do this via the “Project” root node.



In our scenario this time we rely on three tables that are linked to each other in order to create a hierarchy and put the RAP generator through its paces. The model and relationships therefore look like this:


define table zbs_dmo_gen2h {
  key client         : abap.clnt not null;
  key uuid_key       : zbs_demo_key not null;
  description        : zbs_demo_description;
  is_active          : abap_boolean;
  local_last_changed : abp_locinst_lastchange_tstmpl;
  last_changed       : abp_lastchange_tstmpl;


define table zbs_dmo_gen2p {
  key client         : abap.clnt not null;
  key uuid_pos       : zbs_demo_key not null;
  uuid_key           : zbs_demo_key;
  @Semantics.amount.currencyCode : 'zbs_dmo_gen2p.currency'
  price              : zbs_demo_price;
  currency           : abap.cuky;
  local_last_changed : abp_locinst_lastchange_tstmpl;
  last_changed       : abp_lastchange_tstmpl;


define table zbs_dmo_gen2s {
  key client         : abap.clnt not null;
  key uuid_sub_pos   : zbs_demo_key not null;
  uuid_key           : zbs_demo_key;
  uuid_pos           : zbs_demo_key;
  description        : zbs_demo_description;
  local_last_changed : abp_locinst_lastchange_tstmpl;
  last_changed       : abp_lastchange_tstmpl;


Hint: There should only ever be one key as UUID per table if you rely on automatic key assignment, otherwise the app cannot derive the correct key field. Furthermore, parent and root are required in the underlying tables for linking.



To start with the settings, we start the app and can create a new RAP project by clicking on “New Project”. First of all, there are the different choices we have at the moment. So we can specify table, CDS or an abstract entity as the data source. It is also possible to decide between managed and unmanaged. Accordingly, we now make the following settings.


In the following detailed screen we receive information about the current entities in the RAP object, as well as a summary of the implementation details, naming conventions, lifecycle information, other parameters and the log.


Maintain entity

However, before we save so that we can create the entry, we still have to store the required information in the entity. To do this, navigate forward to the entry “DMOGen2H” in the detail page. There are still a few mandatory fields that need to be filled out. The information for draft handling is stored in the upper part; this has already been drawn automatically. The semantic key is either a unique "speaking" ID or the key of the table.


In the lower part you can adapt the generated objects again to implement the naming conventions in your company. At least default values are suggested at the beginning so that you can continue generating directly.


In the last section, all fields in the table are listed; here you can adjust the suggested aliases again if the names don't suit you or are too short.


Add entities

In order to take over further entities, you have to mark the root node in the list and you can create another subnode using the corresponding button above the list.


On the popup you now have to enter the name of the entity and select the table as the data source. The information is then sufficient to generate the positions.


Hint: It may be that the new entry does not appear in the list immediately, in which case it is best to refresh the browser (F5).


The semantic key must now be defined again on the object side of the entity. There is also information about the underlying entity so that the key relationships are clearly defined.


According to the method, we now create a subentity and fill in the relevant information. Finally, our three new entities should appear in the list of entities.



On the object page of the project you will find the various possible options at the top. Once you have provided all the information and the project has been saved, you can start generating the objects via "Generate repository objects".


A job is then scheduled in the system to generate the objects. The job status is displayed accordingly in the application.


In this case the job takes about 2 minutes. After generation is complete, the status and a fresh ADT link are displayed in the project header.



The RAP Generator automatically activates the service binding so that we can directly access the Fiori Elements Preview.


With the preview you can now work accordingly and navigate in the entities. The interfaces still need to be made pretty, and the logic should also be supplemented with validations. The generator generated around 25 objects that we didn't have to create by hand, which saved us a lot of work.


Clean Up

In the RAP Generator there is also a button for deleting the generated objects, which is helpful for regeneration or if you integrate new entities at the beginning. Before you click on the button, you should set the generated service binding back to "Unpublish" and close the object in the ADTs. This check also takes place before deletion and informs you of any problems. If everything is OK, another job is scheduled in the system and begins deleting the objects.



The RAP Generator takes a lot of work off your hands, especially if you want to build complex RAP objects. If you are already familiar with the structure and handling of RAP, we recommend using it to become even faster in implementing applications.


SAP Blog - RAP Generator
SAP Blog - New Version of RAP Generator

Included topics:
RAPBTPRAP GeneratorFiori Elements
Comments (0)

And further ...

Are you satisfied with the content of the article? We post new content in the ABAP area every Friday and irregularly in all other areas. Take a look at our tools and apps, we provide them free of charge.

RAP - Deep Action in OData v4

Category - ABAP

In this article we will look at actions with deep structures, how we can create them and pass data to an API endpoint.


BTP - Connect On-Premise (Consumption Model v2)

Category - ABAP

In this article we want to provide another update on the connection of on-premise systems and how this is done with a communication arrangement.


RAP - Show app count (Tile)

Category - ABAP

This example is about displaying a counter on the tile of a Fiori Elements application and how such a thing can be implemented.


RAP - Generator (ADT)

Category - ABAP

Today, let's take a look at the RAP Generator, which is already integrated into ABAP Development Tools, and how you can use it to easily build new RAP apps.


RAP - Unmanaged (Remote)

Category - ABAP

Here you can learn more about the unmanaged RAP object with a remote data source and how you can implement such scenarios.