Tables in ABAP Cloud: From SE11 to CDS-Based Definition

Category
ABAP Cloud
Published
Author
Johannes

In Classic ABAP, SE11 was the central tool for table definitions. In ABAP Cloud, things are different: Tables are defined directly in code as DDL Source, activated via ABAP Development Tools (ADT). This article shows the transition from the classic SE11 world to modern CDS-based table definition.

The Problem: SE11 in ABAP Cloud?

Those looking for transaction SE11 in ABAP Cloud won’t find it:

SE11? → Doesn't exist in ABAP Cloud
SE16? → Doesn't exist in ABAP Cloud
SM30? → Doesn't exist in ABAP Cloud

All data definitions are done through ADT (Eclipse) and DDL Source Files.

Table Definition Comparison

Classic ABAP (SE11)

Transaction SE11 → Database Table → ZFLIGHT_BOOK
Fields:
MANDT CLNT Client
BOOKING_ID NUMC(10) Booking number
FLIGHT_ID NUMC(10) Flight number
CUSTOMER_ID NUMC(10) Customer number
BOOKING_DATE DATS Booking date
PRICE CURR(15,2) Price
CURRENCY CUKY Currency
STATUS CHAR(1) Status
→ Activate → Database table created

ABAP Cloud (DDL Source)

@EndUserText.label: 'Flight Bookings'
@AbapCatalog.enhancement.category: #NOT_EXTENSIBLE
@AbapCatalog.tableCategory: #TRANSPARENT
@AbapCatalog.deliveryClass: #A
@AbapCatalog.dataMaintenance: #RESTRICTED
define table zflight_book {
key client : abap.clnt not null;
key booking_id : abap.numc(10) not null;
flight_id : abap.numc(10);
customer_id : abap.numc(10);
booking_date : abap.dats;
@Semantics.amount.currencyCode: 'zflight_book.currency_code'
price : abap.curr(15,2);
currency_code: abap.cuky;
status : abap.char(1);
}

Advantages of DDL Syntax:

  • Version-controllable with Git (see abapGit)
  • No GUI dependency
  • Annotations directly at field level
  • Better readability in code reviews

Creating Tables in ADT

Step-by-Step

1. Right-click on package → New → Other ABAP Repository Object
2. Dictionary → Database Table
3. Enter name: ZFLIGHT_BOOK
4. Description: Flight Bookings
5. Finish → DDL Source is generated

Basic Table Structure

@EndUserText.label: 'Table Description'
@AbapCatalog.enhancement.category: #NOT_EXTENSIBLE
@AbapCatalog.tableCategory: #TRANSPARENT
@AbapCatalog.deliveryClass: #A
@AbapCatalog.dataMaintenance: #RESTRICTED
define table ztable {
key client : abap.clnt not null;
key key_field : <datatype> not null;
field1 : <datatype>;
field2 : <datatype>;
}

Important Annotations

AnnotationMeaningValues
@AbapCatalog.tableCategoryTable type#TRANSPARENT, #STRUCTURE
@AbapCatalog.deliveryClassDelivery class#A (Application data), #C (Customizing)
@AbapCatalog.dataMaintenanceMaintenance permission#RESTRICTED, #ALLOWED
@AbapCatalog.enhancement.categoryExtensibility#NOT_EXTENSIBLE, #EXTENSIBLE_ANY

Built-in Data Types in ABAP Cloud

In ABAP Cloud, data types are referenced directly with abap.<type>:

Commonly Used Types

" Strings
field_char : abap.char(30); " Fixed length
field_string : abap.string(256); " Variable length
field_numc : abap.numc(10); " Numeric text (e.g., IDs)
field_lang : abap.lang; " Language key
" Numbers
field_int : abap.int4; " Integer (4 bytes)
field_int8 : abap.int8; " Integer (8 bytes)
field_dec : abap.dec(10,2); " Decimal number
field_curr : abap.curr(15,2); " Currency amount
field_quan : abap.quan(13,3); " Quantity field
" Date and Time
field_date : abap.dats; " Date (YYYYMMDD)
field_time : abap.tims; " Time (HHMMSS)
field_tstmp : abap.utclong; " UTC timestamp (recommended!)
" Others
field_bool : abap_boolean; " Boolean (X or blank)
field_client : abap.clnt; " Client
field_cuky : abap.cuky; " Currency key
field_unit : abap.unit(3); " Unit of measure

Timestamps: Prefer UTCLONG

" ❌ Old: Separate date and time
created_date : abap.dats;
created_time : abap.tims;
" ✅ New: UTC timestamp
created_at : abap.utclong;
changed_at : abap.utclong;

The type abap.utclong stores timestamps timezone-independent and is the standard for ABAP Cloud.

Data Elements and Domains

Classic ABAP: Separate Objects

SE11 → Domain → ZBOOKING_STATUS
Data type: CHAR(1)
Value range: O (Open), C (Confirmed), X (Cancelled)
SE11 → Data Element → ZBOOKING_STATUS
Domain: ZBOOKING_STATUS
Field label: Booking Status
SE11 → Table → ZFLIGHT_BOOK
STATUS → Data element ZBOOKING_STATUS

ABAP Cloud: Integrated Definition

In ABAP Cloud, data elements are defined as DDL Source:

@EndUserText.label: 'Booking Status'
@EndUserText.heading: 'Status'
define type zbooking_status : abap.char(1)

Domain with Fixed Values

For fixed value sets, there’s the Enumeration concept:

" Enumeration for booking status
CLASS zcl_booking_status DEFINITION
PUBLIC
FINAL
CREATE PUBLIC.
PUBLIC SECTION.
TYPES:
BEGIN OF ENUM booking_status,
open VALUE IS INITIAL,
confirmed,
cancelled,
END OF ENUM booking_status.
ENDCLASS.

Or directly as CDS Type:

@EndUserText.label: 'Booking Status'
define type zbooking_status : abap.char(1)
enum {
open = 'O';
confirmed = 'C';
cancelled = 'X';
}

Complete Flight Booking Example

Main Table: Bookings

@EndUserText.label: 'Flight Bookings'
@AbapCatalog.enhancement.category: #NOT_EXTENSIBLE
@AbapCatalog.tableCategory: #TRANSPARENT
@AbapCatalog.deliveryClass: #A
@AbapCatalog.dataMaintenance: #RESTRICTED
define table zflight_book {
key client : abap.clnt not null;
key booking_id : abap.numc(10) not null;
" Business keys
flight_id : abap.numc(10);
customer_id : abap.numc(10);
" Booking data
booking_date : abap.dats;
@Semantics.amount.currencyCode: 'zflight_book.currency_code'
price : abap.curr(15,2);
currency_code : abap.cuky;
seats_booked : abap.int4;
booking_status : abap.char(1);
" Administrative fields
created_by : abap.uname;
created_at : abap.utclong;
last_changed_by : abap.uname;
last_changed_at : abap.utclong;
local_last_changed: abap.utclong;
}

Master Data Table: Flights

@EndUserText.label: 'Flight Data'
@AbapCatalog.enhancement.category: #NOT_EXTENSIBLE
@AbapCatalog.tableCategory: #TRANSPARENT
@AbapCatalog.deliveryClass: #A
@AbapCatalog.dataMaintenance: #RESTRICTED
define table zflight {
key client : abap.clnt not null;
key flight_id : abap.numc(10) not null;
" Flight data
carrier_id : abap.char(3);
connection_id : abap.numc(4);
flight_date : abap.dats;
" Route
departure_city : abap.char(30);
departure_code : abap.char(3);
arrival_city : abap.char(30);
arrival_code : abap.char(3);
" Capacity
seats_max : abap.int4;
seats_occupied : abap.int4;
" Price
@Semantics.amount.currencyCode: 'zflight.currency_code'
base_price : abap.curr(15,2);
currency_code : abap.cuky;
}

Master Data Table: Customers

@EndUserText.label: 'Customer Master Data'
@AbapCatalog.enhancement.category: #NOT_EXTENSIBLE
@AbapCatalog.tableCategory: #TRANSPARENT
@AbapCatalog.deliveryClass: #A
@AbapCatalog.dataMaintenance: #RESTRICTED
define table zcustomer {
key client : abap.clnt not null;
key customer_id : abap.numc(10) not null;
" Customer data
first_name : abap.char(40);
last_name : abap.char(40);
email : abap.char(100);
phone : abap.char(30);
" Address
street : abap.char(60);
city : abap.char(40);
postal_code : abap.char(10);
country : abap.char(3);
}

Table Entities: The New Architecture

With ABAP Cloud 2024, the concept of Table Entities was introduced. The table itself becomes an entity - without an additional CDS View.

Classic Approach (three objects)

1. Database table (ZFLIGHT_BOOK)
2. CDS View (ZI_FlightBooking)
3. Behavior Definition (ZI_FlightBooking)

Table Entity Approach (two objects)

1. Table Entity (ZI_FlightBooking) - Table + View in one
2. Behavior Definition (ZI_FlightBooking)

Table Entity Definition

@EndUserText.label: 'Flight Booking (Table Entity)'
@AbapCatalog.enhancement.category: #NOT_EXTENSIBLE
define table entity zi_flightbooking {
key client : abap.clnt not null;
key booking_id : abap.numc(10) not null;
flight_id : abap.numc(10);
customer_id : abap.numc(10);
booking_date : abap.dats;
@Semantics.amount.currencyCode: 'zi_flightbooking.currency_code'
price : abap.curr(15,2);
currency_code : abap.cuky;
booking_status : abap.char(1);
created_by : abap.uname;
created_at : abap.utclong;
last_changed_by : abap.uname;
last_changed_at : abap.utclong;
local_last_changed: abap.utclong;
}

Comparison: Table vs. Table Entity

AspectTable + CDS ViewTable Entity
Objects2 (Table + View)1
MaintenanceDouble maintenanceDefine once
FlexibilityHighLimited
AliasesFreely choosableField name = column name
Calculated FieldsYesNo
Recommended forComplex modelsSimple CRUD

For more on CDS patterns, see the upcoming article on RAP CDS patterns.

Foreign Keys and Associations

Foreign Key in Table Definition

In ABAP Cloud, foreign keys are defined via annotations:

@EndUserText.label: 'Flight Bookings with Foreign Keys'
define table zflight_book_fk {
key client : abap.clnt not null;
key booking_id : abap.numc(10) not null;
@AbapCatalog.foreignKey.screenCheck: false
flight_id : abap.numc(10)
with foreign key zflight
where client = zflight_book_fk.client
and flight_id = zflight_book_fk.flight_id;
@AbapCatalog.foreignKey.screenCheck: false
customer_id : abap.numc(10)
with foreign key zcustomer
where client = zflight_book_fk.client
and customer_id = zflight_book_fk.customer_id;
" ... more fields
}

Associations in CDS Views

For RAP applications, associations in CDS Views are the better way:

@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Flight Bookings with Associations'
define root view entity ZI_FlightBooking
as select from zflight_book as Booking
association [1..1] to ZI_Flight as _Flight
on $projection.FlightId = _Flight.FlightId
association [1..1] to ZI_Customer as _Customer
on $projection.CustomerId = _Customer.CustomerId
{
key Booking.booking_id as BookingId,
Booking.flight_id as FlightId,
Booking.customer_id as CustomerId,
Booking.booking_date as BookingDate,
@Semantics.amount.currencyCode: 'CurrencyCode'
Booking.price as Price,
Booking.currency_code as CurrencyCode,
Booking.booking_status as BookingStatus,
" Expose associations
_Flight,
_Customer
}

Cardinalities

CardinalityMeaningExample
[0..1]Optional, max 1Optional contact person
[1..1]Exactly 1Booking → Flight
[0..*]Optional, any numberCustomer → Bookings
[1..*]At least 1, any numberOrder → Items

Populating and Reading Tables

Inserting Data

" Single record
INSERT INTO zflight_book VALUES @(
VALUE #(
client = sy-mandt
booking_id = '0000000001'
flight_id = '0000000100'
customer_id = '0000000001'
booking_date = cl_abap_context_info=>get_system_date( )
price = '499.00'
currency_code = 'EUR'
booking_status = 'O'
created_by = cl_abap_context_info=>get_user_technical_name( )
created_at = utclong_current( )
)
).
" Multiple records
DATA(lt_bookings) = VALUE #(
( client = sy-mandt booking_id = '0000000002' flight_id = '0000000101' ... )
( client = sy-mandt booking_id = '0000000003' flight_id = '0000000102' ... )
).
INSERT zflight_book FROM TABLE @lt_bookings.

Reading Data

" Read via CDS View (recommended for RAP)
SELECT FROM ZI_FlightBooking
FIELDS BookingId, FlightId, BookingDate, Price
WHERE BookingStatus = 'O'
INTO TABLE @DATA(lt_open_bookings).
" With associations
SELECT FROM ZI_FlightBooking AS Booking
FIELDS Booking~BookingId,
\_Flight-DepartureCity,
\_Flight-ArrivalCity,
\_Customer-LastName
INTO TABLE @DATA(lt_with_details).

Best Practices

1. Always Plan Administrative Fields

" These fields should be in every table:
created_by : abap.uname;
created_at : abap.utclong;
last_changed_by : abap.uname;
last_changed_at : abap.utclong;
local_last_changed: abap.utclong; " For ETag/Optimistic Locking

2. Use Semantic Annotations

" Correctly annotate currency fields
@Semantics.amount.currencyCode: 'currency_code'
price : abap.curr(15,2);
currency_code : abap.cuky;
" Correctly annotate quantity fields
@Semantics.quantity.unitOfMeasure: 'unit'
quantity : abap.quan(13,3);
unit : abap.unit(3);

3. Follow Naming Conventions

Tables: z<area>_<name> → zflight_book
Table Entities: zi_<name> → zi_flightbooking
CDS Views: ZI_<Name> (Interface) → ZI_FlightBooking
ZC_<Name> (Consumption) → ZC_FlightBooking

4. UTCLONG Instead of DATS/TIMS

" ❌ Avoid:
changed_date : abap.dats;
changed_time : abap.tims;
" ✅ Prefer:
changed_at : abap.utclong;

Conclusion

Tables in ABAP Cloud are exclusively defined via DDL Source in ADT:

Classic (SE11)ABAP Cloud (ADT)
GUI-basedCode-based
Domain → Data element → TableTypes inline or as Type
Foreign Key dialogForeign Key annotation
Not version-controllableGit-ready

The transition requires initial training, but offers clear advantages: Better readability, version control, and integration with the RAP stack.

For next steps with RAP, see RAP Basics, for CDS Views in detail CDS Views, and for migrating existing objects the ABAP Cloud Migration Guide.