Traditionally, when developing a managed RAP application, we create multiple artifacts such as CDS view entities, behavior definitions, service definitions, and service bindings. However, with the introduction of Table Entity, SAP allows us to directly expose database tables in a RAP-compliant way, significantly reducing boilerplate development effort.
This feature is especially useful when:
You want to quickly generate a managed RAP application
The table structure already satisfies your business requirements
You want to minimize intermediate CDS modeling layers
You are building internal or utility applications with simple transactional needs
In this blog, we will explore:
What a Table Entity is in RAP
How it differs from traditional CDS view entities
Step-by-step creation of a Managed RAP application using Table Entity
Service exposure and preview in Fiori Elements
Table Entity:
Read and write access is possible using ABAP SQL SELECT, UPDATE, MODIFY, INSERT, and DELETE.
A table entity can be used as a data type in ABAP.
Properties of Table Entities:
Key Fields – You can define one or more elements as the primary key using the keyword KEY. However, unlike database tables, key fields are optional and it is also possible to have a table entity without a primary key.
Note: The access pattern of a table entity without a primary key is that it is always read completely, which can result in longer processing times. Single record access is not provided.
Client Dependency
Client handling is defined using the header annotation @ClientHandling.type. The possible annotation values are #CLIENT_DEPENDENT or #CLIENT_INDEPENDENT.
Flag for Null Values
A null value on the database is an undefined value. Columns of table entities are by default created as NOT NULL on the SAP HANA database. It is possible to override this default behavior by using the optional addition NULL for a column.
Delivery Class
The delivery class of a table entity controls the transport of table data in installations, upgrades, or client copies, and in transports between customer systems. Annotation @AbapCatalog.deliveryClass is used to specify delivery class.
select table entity template.
@ClientHandling.type: #CLIENT_DEPENDENT
@AbapCatalog.deliveryClass: #APPLICATION_DATA
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: ‘travel information’
define table entity ztb_travel
{
key travel_id : /dmo/travel_id;
description : /dmo/description;
status : /dmo/travel_status;
lastchangedat : timestampl;
create report/class to insert entries.
select travel_id, description, status,lastchangedat FROM /dmo/travel into TABLE (lt_travel).
if sy-subrc eq 0.
insert ztb_travel FROM TABLE _TRAVEL.
if sy-subrc eq 0.
out->write( ‘travel data inserted successfully’ ).
else.
out->write( ‘failed to insert’ ).
ENDIF.
endif.
Lets make our table entity as root entity so that will create rap application as well
@ClientHandling.type: #CLIENT_DEPENDENT
@AbapCatalog.deliveryClass: #APPLICATION_DATA
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: ‘travel information’
define root table entity ztb_travel
{
key travel_id : /dmo/travel_id;
description : /dmo/description;
status : /dmo/travel_status;
lastchangedat : timestampl;
}
Projection View:
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: ‘consumption view for travel table entity’
@Metadata.ignorePropagatedAnnotations: true
define root view entity zcb_travel as projection on ztb_travel
{
@UI.facet: [{ label: ‘Travel Info’, type: #IDENTIFICATION_REFERENCE }]
@UI.lineItem: [{ position: 10 }]
@UI.identification: [{ position: 10 }]
key travel_id,
.lineItem: [{ position: 20 }]
@UI.identification: [{ position: 20 }]
description,
.lineItem: [{ position: 30 }]
@UI.identification: [{ position: 30 }]
status
}
Interface Behavior Definition:
managed implementation in class zbp_tb_travel unique;
strict ( 2 );
with draft;
define behavior for ztb_travel alias tb_travel
lock master total etag lastchangedat
draft table zdtbtrav
authorization master ( instance )
{
create ( authorization : global );
update;
delete;
field ( readonly ) lastchangedat;
draft action Activate optimized;
draft action Discard;
draft action Edit;
draft action Resume;
draft determine action Prepare;
}
Projection Behavior Definition:
projection implementation in class zbp_cb_travel unique;
strict ( 2 );
use draft;
define behavior for zcb_travel alias tb_travel
{
use create;
use update;
use delete;
use action Activate;
use action Discard;
use action Edit;
use action Resume;
use action Prepare;
}
Service Definition:
@EndUserText.label: ‘sd for table entity travel’
define service Zsd_tb_trav {
expose zcb_travel as TableEntityTravel;
}
Service Binding:
generate service binding and test,we generate managed rap application, CRUD operations will be handled by framework itself.
Conclusion:
the table entity in RAP provides a simple and effective way to expose database tables directly in RAP-based applications. It helps developers quickly build transactional services with minimal configuration while still benefiting from the RAP framework’s capabilities. By using table entities, developers can accelerate development and maintain consistency within modern SAP application architecture.
Traditionally, when developing a managed RAP application, we create multiple artifacts such as CDS view entities, behavior definitions, service definitions, and service bindings. However, with the introduction of Table Entity, SAP allows us to directly expose database tables in a RAP-compliant way, significantly reducing boilerplate development effort.This feature is especially useful when:You want to quickly generate a managed RAP applicationThe table structure already satisfies your business requirementsYou want to minimize intermediate CDS modeling layersYou are building internal or utility applications with simple transactional needsIn this blog, we will explore:What a Table Entity is in RAPHow it differs from traditional CDS view entitiesStep-by-step creation of a Managed RAP application using Table EntityService exposure and preview in Fiori ElementsTable Entity:Read and write access is possible using ABAP SQL SELECT, UPDATE, MODIFY, INSERT, and DELETE.A table entity can be used as a data type in ABAP.Properties of Table Entities:Key Fields – You can define one or more elements as the primary key using the keyword KEY. However, unlike database tables, key fields are optional and it is also possible to have a table entity without a primary key.Note: The access pattern of a table entity without a primary key is that it is always read completely, which can result in longer processing times. Single record access is not provided.Client DependencyClient handling is defined using the header annotation @ClientHandling.type. The possible annotation values are #CLIENT_DEPENDENT or #CLIENT_INDEPENDENT. Flag for Null ValuesA null value on the database is an undefined value. Columns of table entities are by default created as NOT NULL on the SAP HANA database. It is possible to override this default behavior by using the optional addition NULL for a column. Delivery ClassThe delivery class of a table entity controls the transport of table data in installations, upgrades, or client copies, and in transports between customer systems. Annotation @AbapCatalog.deliveryClass is used to specify delivery class. select table entity template.@ClientHandling.type: #CLIENT_DEPENDENT
@AbapCatalog.deliveryClass: #APPLICATION_DATA
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: ‘travel information’
define table entity ztb_travel
{
key travel_id : /dmo/travel_id;
description : /dmo/description;
status : /dmo/travel_status;
lastchangedat : timestampl;
create report/class to insert entries. select travel_id, description, status,lastchangedat FROM /dmo/travel into TABLE (lt_travel).
if sy-subrc eq 0.
insert ztb_travel FROM TABLE _TRAVEL.
if sy-subrc eq 0.
out->write( ‘travel data inserted successfully’ ).
else.
out->write( ‘failed to insert’ ).
ENDIF.
endif.Lets make our table entity as root entity so that will create rap application as well @ClientHandling.type: #CLIENT_DEPENDENT
@AbapCatalog.deliveryClass: #APPLICATION_DATA
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: ‘travel information’
define root table entity ztb_travel
{
key travel_id : /dmo/travel_id;
description : /dmo/description;
status : /dmo/travel_status;
lastchangedat : timestampl;
} Projection View:@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: ‘consumption view for travel table entity’
@Metadata.ignorePropagatedAnnotations: true
define root view entity zcb_travel as projection on ztb_travel
{
@UI.facet: [{ label: ‘Travel Info’, type: #IDENTIFICATION_REFERENCE }]
@UI.lineItem: [{ position: 10 }]
@UI.identification: [{ position: 10 }]
key travel_id,
.lineItem: [{ position: 20 }]
@UI.identification: [{ position: 20 }]
description,
.lineItem: [{ position: 30 }]
@UI.identification: [{ position: 30 }]
status
} Interface Behavior Definition:managed implementation in class zbp_tb_travel unique;
strict ( 2 );
with draft;
define behavior for ztb_travel alias tb_travel
lock master total etag lastchangedat
draft table zdtbtrav
authorization master ( instance )
{
create ( authorization : global );
update;
delete;
field ( readonly ) lastchangedat;
draft action Activate optimized;
draft action Discard;
draft action Edit;
draft action Resume;
draft determine action Prepare;
}Projection Behavior Definition:projection implementation in class zbp_cb_travel unique;
strict ( 2 );
use draft;
define behavior for zcb_travel alias tb_travel
{
use create;
use update;
use delete;
use action Activate;
use action Discard;
use action Edit;
use action Resume;
use action Prepare;
}Service Definition: @EndUserText.label: ‘sd for table entity travel’
define service Zsd_tb_trav {
expose zcb_travel as TableEntityTravel;
} Service Binding: generate service binding and test,we generate managed rap application, CRUD operations will be handled by framework itself.Conclusion:the table entity in RAP provides a simple and effective way to expose database tables directly in RAP-based applications. It helps developers quickly build transactional services with minimal configuration while still benefiting from the RAP framework’s capabilities. By using table entities, developers can accelerate development and maintain consistency within modern SAP application architecture. Read More Technology Blog Posts by Members articles
#SAP
#SAPTechnologyblog