This SAP Connector is in beta The SAP Connector is not yet publicly available. We are actively working on its completion. If you would like early access, please contact us.
Datentypen
SAP ABAP Datentypen und deren Mapping zu JSON/JavaScript.
ABAP Datentypen
ABAP verwendet spezifische Datentypen, die der ZATW-Connector automatisch in JSON-kompatible Formate konvertiert.
| ABAP Typ | Beschreibung | Länge |
|---|---|---|
C | Character (Text) | 1-262143 |
N | Numerischer Text | 1-262143 |
I | Integer | 4 Bytes |
P | Packed Number (Dezimal) | 1-16 Bytes |
F | Floating Point | 8 Bytes |
D | Datum (YYYYMMDD) | 8 Bytes |
T | Zeit (HHMMSS) | 6 Bytes |
X | Hexadezimal (Binär) | 1-524287 |
STRING | Variable Länge Text | Variabel |
Typ-Mapping
Automatische Konvertierung zwischen ABAP und JSON/JavaScript Typen.
| ABAP | JSON | JavaScript | Beispiel |
|---|---|---|---|
C, N, STRING | string | string | "ABC123" |
I | number | number | 42 |
P, F | string* | string | "123.45" |
D | string | string | "2024-01-15" |
T | string | string | "14:30:00" |
X | string (Base64) | string | "SGVsbG8=" |
* Dezimalzahlen werden als String übertragen um Präzisionsverlust zu vermeiden.
Datum & Zeit
SAP verwendet interne Formate für Datum und Zeit. Der Connector konvertiert diese automatisch.
Datum (DATS)
SAP intern
20240115JSON Output
2024-01-15Zeit (TIMS)
SAP intern
143000JSON Output
14:30:00Timestamp
SAP intern
20240115143000JSON Output
2024-01-15T14:30:00ZZeitzone
Dezimalzahlen
SAP Packed Numbers (Typ P) haben eine feste Anzahl Dezimalstellen.
// ABAP Definition
DATA: lv_amount TYPE p DECIMALS 2. " 123.45
// JSON Output
{
"amount": "123.45"
}
// Zurück zu ABAP
{
"amount": "123.45" // String verwenden!
}Präzision beachten
Strukturen & Tabellen
ABAP Strukturen werden zu JSON Objects, interne Tabellen zu Arrays.
Struktur
// ABAP Struktur
TYPES: BEGIN OF ty_address,
street TYPE string,
city TYPE string,
zip TYPE n LENGTH 5,
END OF ty_address.
// JSON
{
"street": "Hauptstraße 1",
"city": "Berlin",
"zip": "10115"
}Interne Tabelle
// ABAP Tabelle
DATA: lt_items TYPE TABLE OF ty_item.
// JSON
[
{ "matnr": "MAT001", "quantity": 10 },
{ "matnr": "MAT002", "quantity": 5 }
]