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.

referencescloud-development.md

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

ABAP Cloud Development - Complete Reference

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


Core Concepts

ABAP Cloud: Programming paradigm for cloud-ready, upgrade-stable solutions using restricted ABAP technology.

Key Restrictions:

  • Limited to ABAP for Cloud Development language version
  • Access restricted to released SAP APIs only
  • ADT (ABAP Development Tools for Eclipse) is the only supported IDE
  • RAP is the transactional programming model

Prohibited Syntax

" NOT allowed in ABAP Cloud

" Classic statements
MOVE source TO target.              " Use: target = source.
DESCRIBE TABLE itab LINES count.    " Use: count = lines( itab ).
GET REFERENCE OF var INTO dref.     " Use: dref = REF #( var ).

" Classic UI
WRITE 'text'.
SELECTION-SCREEN ...
START-OF-SELECTION.

" Reports
REPORT ...

" Classic debugging
BREAK-POINT.

" Client handling
SELECT ... USING CLIENT ...

" Some sy-fields
DATA(date) = sy-datum.              " Use XCO library
DATA(time) = sy-uzeit.
DATA(timestamp) = sy-timlo.

Released APIs

Date and Time (XCO Library)

" Current date
DATA(date) = xco_cp=>sy->date( )->as( xco_cp_time=>format->iso_8601_extended )->value.

" Current time
DATA(time) = xco_cp=>sy->time( )->as( xco_cp_time=>format->iso_8601_extended )->value.

" Date calculations
DATA(tomorrow) = xco_cp=>sy->date( )->add( iv_day = 1 )->value.
DATA(next_month) = xco_cp=>sy->date( )->add( iv_month = 1 )->value.

UUID Generation

" Generate UUID
DATA(uuid) = cl_system_uuid=>create_uuid_x16_static( ).

" As string format
TRY.
    DATA(uuid_str) = cl_system_uuid=>convert_uuid_x16_static(
      uuid = uuid ).
  CATCH cx_uuid_error.
ENDTRY.

Random Numbers

" Random integer
DATA(random) = cl_abap_random_int=>create(
  seed = CONV i( sy-uzeit )
  min = 1
  max = 100 ).
DATA(number) = random->get_next( ).

" Probability distributions
DATA(prob) = cl_abap_prob_distribution=>get_instance( ).
DATA(normal) = prob->normal( mean = 50 stdev = 10 ).

Output (if_oo_adt_classrun)

CLASS zcl_demo DEFINITION PUBLIC FINAL CREATE PUBLIC.
  PUBLIC SECTION.
    INTERFACES if_oo_adt_classrun.
ENDCLASS.

CLASS zcl_demo IMPLEMENTATION.
  METHOD if_oo_adt_classrun~main.
    out->write( 'Hello from ABAP Cloud!' ).
    out->write( data_object ).
    out->write( itab ).
  ENDMETHOD.
ENDCLASS.

String Processing

" Available string functions
DATA(upper) = to_upper( text ).
DATA(lower) = to_lower( text ).
DATA(len) = strlen( text ).
DATA(found) = find( val = text sub = 'pattern' ).
DATA(result) = replace( val = text sub = 'old' with = 'new' occ = 0 ).

" String templates
DATA(formatted) = |Date: { xco_cp=>sy->date( )->value DATE = ISO }|.

Released Table Types

" Available system types
DATA itab TYPE string_table.
DATA hash_tab TYPE string_hashed_table.
DATA xstr_tab TYPE xstring_table.

Released Data Elements

" Available DDIC elements
DATA ts TYPE timestampl.
DATA country TYPE land1.
DATA bool TYPE abap_boolean.
DATA true_val TYPE abap_bool VALUE abap_true.

RAP as Programming Model

" EML for data access
MODIFY ENTITIES OF zroot_entity
  ENTITY root
  CREATE FROM ...
  MAPPED DATA(mapped)
  FAILED DATA(failed)
  REPORTED DATA(reported).

READ ENTITIES OF zroot_entity
  ENTITY root
  ALL FIELDS WITH VALUE #( ( key = 1 ) )
  RESULT DATA(result).

COMMIT ENTITIES.

Checking Cloud Readiness

In ADT

  1. Right-click on class/object
  2. Select "Run As" → "ABAP Test Cockpit"
  3. Use check variant ABAP_CLOUD_READINESS
  4. Review findings

Change Language Version

  1. Open object properties
  2. Go to "General" tab
  3. Edit "ABAP Language Version"
  4. Select "ABAP for Cloud Development"
  5. Check for syntax errors

Migration Patterns

Date/Time

" Classic (not allowed)
DATA(date) = sy-datum.
DATA(time) = sy-uzeit.

" Cloud (use XCO)
DATA(date) = xco_cp=>sy->date( )->value.
DATA(time) = xco_cp=>sy->time( )->value.

Table Line Count

" Classic (not allowed)
DESCRIBE TABLE itab LINES count.

" Cloud
DATA(count) = lines( itab ).

Reference Creation

" Classic (not allowed)
GET REFERENCE OF var INTO dref.

" Cloud
dref = REF #( var ).

Assignment

" Classic (not allowed)
MOVE source TO target.

" Cloud
target = source.

Output

" Classic (not allowed)
WRITE 'text'.

" Cloud (in if_oo_adt_classrun)
out->write( 'text' ).

Available CDS Objects

" Released CDS views
DATA tz TYPE i_timezone.

" Access via ABAP SQL
SELECT * FROM i_country INTO TABLE @DATA(countries).

Release Contracts

Contract Meaning
C0 Not released
C1 Released for key user extensibility
C2 Released for partner development
C3 Released for SAP internal

Use only C1 or higher in ABAP Cloud.


Best Practices

  1. Use released APIs only - check release status before using
  2. Use RAP for transactional scenarios
  3. Use XCO library for date/time operations
  4. Implement if_oo_adt_classrun for console output
  5. Run ATC checks regularly with cloud readiness variant
  6. Avoid sy-datum/sy-uzeit - use XCO alternatives
  7. Use constructor expressions over obsolete syntax
  8. Test in cloud environment before deployment

Supported Environments

  • SAP BTP ABAP Environment
  • SAP S/4HANA Cloud, public edition
  • SAP S/4HANA Cloud, private edition
  • SAP S/4HANA (on-premise) - opt-in

Documentation Links

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