Appearance
CDS & ABAP Data Types Cheat Sheet
Use alongside Lesson 8 — Custom Persistence Modeling. Browse all cheat sheets.
| CDS / Dictionary type | Use | ABAP counterpart |
|---|---|---|
abap.char(n) | Fixed-length text | c LENGTH n |
abap.numc(n) | Numeric text, often IDs with leading zeros | n LENGTH n |
abap.string | Variable-length / long text | string |
abap.int1 | Very small integer | b |
abap.int2 | Small integer | s |
abap.int4 | Standard integer | i |
abap.int8 | Large integer | int8 |
abap.dec(p,s) | Exact decimal value | p ... DECIMALS s |
abap.decfloat16 | Decimal floating point | decfloat16 |
abap.decfloat34 | High-precision decimal floating point | decfloat34 |
abap.fltp | Binary floating point | f |
abap.dats | Date | d |
abap.tims | Time | t |
abap.utclong | UTC timestamp | utclong |
abap.cuky | Currency key/code such as EUR, USD, GBP; used to tell the system which currency an amount is in | Character-based key with currency semantics |
abap.curr(p,s) | Monetary amount such as 125.50; normally paired with a CUKY field so the value has a currency | packed number p |
abap.unit(n) | Unit key such as KG, KM, L; used to describe the unit belonging to a quantity | Character-based key with unit semantics |
abap.quan(p,s) | Measured quantity such as 12.500; normally paired with a UNIT field | packed number p |
abap.clnt | SAP client identifier; used for client-dependent data separation | Character-based client key |
abap.lang | Language key such as E, D, F; used for language-dependent data/texts | Character-based language key |
abap.raw(n) | Fixed-length binary data | x LENGTH n |
abap.rawstring | Variable-length binary data | xstring |
Quick rules
- Use
CHARfor normal business fields with a sensible maximum length. - Use
STRINGfor variable-length or potentially long free text. - Use
NUMCfor numeric-looking identifiers where leading zeros matter. - Use
INT*for real integer arithmetic. - Use
CURR + CUKYfor money. - Use
QUAN + UNITfor quantities. - Use reusable types such as
SYSUUID_X16when the business meaning is known.
Small DEFINE TABLE example
abap
@EndUserText.label : 'Simple Example'
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table zexample_### {
key client : abap.clnt not null;
key uuid : sysuuid_x16 not null;
item_no : abap.numc(8) not null;
title : abap.char(80) not null;
description : abap.string;
quantity : abap.int4;
created_on : abap.dats;
@Semantics.amount.currencyCode : 'zexample_###.currency_code'
amount : abap.curr(10,2);
currency_code : abap.cuky;
}