All skills
secondsky avatar

/sap-abap

@620a19a
by Eddiesecondsky/sap-skills456 stars
120

Comprehensive ABAP development skill for SAP systems. Use when writing ABAP code, working with internal tables, structures, ABAP SQL, object-oriented programming, RAP (RESTful Application Programming Model), CDS views, EML statements, ABAP Cloud development, string processing, dynamic programming, RTTI/RTTC, field symbols, data references, exception handling, or ABAP unit testing. Covers both classic ABAP and modern ABAP for Cloud Development patterns.

Use this Skill: https://skilld.dev/gh/secondsky/sap-skills/sap-abap

This session only. Nothing lands on disk.

referencesabap-dictionary.md

≈1.2k tokens on demand. Your agent reads this file only when SKILL.md points to it.

ABAP Dictionary - Complete Reference

Source: https://github.com/SAP-samples/abap-cheat-sheets/blob/main/26_ABAP_Dictionary.md


Data Elements

Define elementary and reference data types:

" Data element based on built-in type
TYPES ty_dtel1 TYPE zdemo_abap_dtel_pr.
DATA char3_dtel TYPE zdemo_abap_dtel_pr.

" Data element based on domain
TYPES ty_dtel2 TYPE zdemo_abap_dtel_do.
DATA char1_dtel TYPE zdemo_abap_dtel_do.

" Data element with reference type
TYPES ty_dtel3 TYPE zdemo_abap_dtel_ref.
DATA char10_dtel_ref TYPE zdemo_abap_dtel_ref.

Domains

Define reusable technical and semantic properties:

  • Standalone dictionary objects
  • Cannot be used directly with TYPES and DATA
  • Support value ranges for input validation
  • Multiple data elements can reference same domain

Structures

Flat Structure Definition

@EndUserText.label : 'Demo flat DDIC structure'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
define structure zdemo_abap_struc_flat {
  chars : abap.char(3);
  num   : abap.int4;
  cuky  : abap.cuky;
  @Semantics.amount.currencyCode : 'zdemo_abap_struc_flat.cuky'
  curr  : abap.curr(8,2);
  id    : zdemo_abap_dtel_pr;
  flag  : zdemo_abap_dtel_do;
}

Deep Structure Definition

@EndUserText.label : 'Demo deep DDIC structure'
define structure zdemo_abap_struc_deep {
  bt_elem1   : abap.char(5);
  bt_elem2   : abap.int4;
  dref1      : reference to abap.char(3);
  oref1      : reference to cl_abap_math;
  struc1     : zdemo_abap_tab1;
  struc2     : include zdemo_abap_carr;
  struc3     : include zdemo_abap_fli with suffix _in;
  tab1       : string_table;
}

Component Types Supported

  • Elementary types (built-in and data elements)
  • Reference types (data/object references)
  • Structured types (other structures, database tables)
  • Include structures with optional suffixes
  • Table types

Table Types

ABAP Usage

TYPES ty_tab_elem TYPE zdemo_abap_tt_str.
TYPES ty_tab_struc TYPE zdemo_abap_tt_so.
DATA tab_elem1 TYPE ty_tab_elem.
DATA tab_struct1 TYPE ty_tab_struc.

RTTI for Table Types

DATA(tdo_table_type) = CAST cl_abap_tabledescr(
  cl_abap_typedescr=>describe_by_name( 'ZDEMO_ABAP_TT_SO' ) ).
DATA(table_keys) = tdo_table_type->get_keys( ).
DATA(table_key_aliases) = tdo_table_type->get_key_aliases( ).

Database Tables

Definition

@EndUserText.label : 'Demo DDIC database table'
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table zdemo_abap_tabl1 {
  key client : abap.clnt not null;
  key num    : abap.int4 not null;
  chars      : abap.char(5);
  id         : zdemo_abap_dtel_pr;
  str        : abap.string(0);
  cuky       : abap.cuky;
  @Semantics.amount.currencyCode : 'zdemo_abap_tabl1.cuky'
  curr       : abap.curr(8,2);
}

With Included Structure

define table zdemo_abap_tabl2 {
  key client    : abap.clnt not null;
  key key_field : abap.int4 not null;
  include zdemo_abap_struc_flat;
}

Key Requirements

  • Must have primary key with unique field combinations
  • Key fields require NOT NULL flag
  • Cannot use string or rawstring for keys
  • First column typically uses clnt for client-dependency

ABAP Usage

DATA struc_from_dbtab TYPE zdemo_abap_tabl1.
struc_from_dbtab = VALUE #( num = 1 chars = 'abcde' ).

MODIFY zdemo_abap_tabl1 FROM @struc_from_dbtab.

DATA itab_from_dbtab TYPE TABLE OF zdemo_abap_tabl1 WITH EMPTY KEY.
SELECT * FROM zdemo_abap_tabl1 INTO TABLE @itab_from_dbtab.

CDS Simple Types

TYPES ty_cds_simple TYPE zdemo_abap_cds_type.
DATA dobj_w_simple_type TYPE zdemo_abap_cds_type.

CDS Enumerated Types

TYPES ty_cds_enum TYPE zdemo_abap_cds_enum.
DATA dobj_w_enum_type TYPE zdemo_abap_cds_enum.

" Convert to enum
DATA(conv_enum) = CONV zdemo_abap_cds_enum( 'X' ).

" Handle invalid value
TRY.
    DATA(result) = CONV zdemo_abap_cds_enum( 'INVALID' ).
  CATCH cx_sy_conversion_no_enum_value INTO DATA(error).
    " Handle error
ENDTRY.

Predefined Types

DATA a TYPE int1.        " 1-byte integer
DATA b TYPE int2.        " 2-byte integer
DATA c TYPE int4.        " 4-byte integer
DATA d TYPE d16n.        " Decimal 16
DATA e TYPE d34n.        " Decimal 34
DATA f TYPE datn.        " Date (internal)
DATA g TYPE timn.        " Time (internal)
DATA h TYPE utcl.        " UTC long timestamp

DATA is_true TYPE abap_boolean.
is_true = abap_true.

Released APIs Query

SELECT ReleasedObjectType, ReleasedObjectName, ReleaseState
  FROM i_apisforclouddevelopment
  WHERE releasestate = 'RELEASED'
  AND ( ReleasedObjectType = 'DTEL' OR ReleasedObjectType = 'DOMA' )
  ORDER BY ReleasedObjectType, ReleasedObjectName
  INTO TABLE @DATA(released_dtel_doma).

Source: SKILL.md on GitHub

No alerts16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    A comprehensive reference for SAP ABAP development, providing documentation and code examples for both classic ABAP and modern ABAP Cloud patterns. No security issues were detected.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer6mo

    3/32 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 620a19a. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 weeks ago.

Activeupdated 2 months ago
Other metadata
metadata
{
  "maintainer": "Eduard Jiglau",
  "maintainer_email": "hello@sap-ai-skills.com",
  "website": "https://sap-ai-skills.com",
  "version": "2.4.1",
  "last_verified": "2026-04-02",
  "abap_release": "7.40 SP08+ / 7.50+ / ABAP Cloud",
  "sources": [
    "https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm",
    "https://github.com/SAP-samples/abap-cheat-sheets"
  ]
}

README badge

README badge for secondsky/sap-skills/sap-abap