Language Versions and Released APIs

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

ABAP is not one fixed set of rules. The same product can offer a large, older set of statements and a smaller, stricter set, and every development object says which set it is written in. That choice is called the language version. It decides which statements you may write and which objects of the system your code may call. This page explains the three language versions, how SAP marks an object as safe to call (it is "released"), and what the syntax check does when your code reaches for something that is not released. It is written against Standard ABAP release 8.16 and ABAP for Cloud Development release 9.20 (the 2608 release of the SAP BTP ABAP environment and of SAP S/4HANA Cloud Public Edition). The rules for ABAP for Cloud Development, which together with released APIs is called ABAP Cloud, apply to the SAP BTP ABAP environment, to SAP S/4HANA Cloud Public Edition and to new development on premise. Standard ABAP applies to classic code on premise and in SAP S/4HANA Cloud Private Edition. After reading you can tell which language version a piece of code needs and why a call is rejected.

Before you read

Key terms

  • ABAP language version: a setting on a development object that fixes which statements it may use and which other objects it may call.

  • Standard ABAP: the full, classic language version with all statements and unrestricted access to system objects.

  • ABAP for Cloud Development: the restricted language version that allows only a cloud-suitable subset of statements and calls to released objects only.

  • ABAP for Key Users: an even smaller language version meant for small extensions written by business users.

  • Released API: an object that SAP has marked as stable and allowed for use by your own code.

  • Release contract: the named promise (C0 to C4) that says for which kind of use an object is released.

  • ABAP Cloud: the development model that combines ABAP for Cloud Development with released APIs only.

Three language versions

Every development object, such as a class, a program or a CDS view, carries one language version. SAP documents three.

  • Standard ABAP is the unrestricted language version for classic ABAP. Its documentation describes every ABAP language element, and, apart from the static package concept, code in it may access all other repository objects, whether SAP intended them for outside use or not.

  • ABAP for Cloud Development is a restricted language version for ABAP Cloud. Only a very restricted set of language elements is supported, almost no obsolete elements are allowed, and access to repository objects is restricted to released ones. Classic list output with WRITE, dynpro statements and executable programs (reports) are examples of what is not allowed.

  • ABAP for Key Users is a restricted language version meant for the secure implementation of enhancements by key users, within the enhancement options that SAP provides. It supports an even smaller set of language elements.

flowchart TD A["Code calls an object"] --> B{"Language version of the calling code"} B -->|"Standard ABAP"| C["Allowed: any visible object"] B -->|"ABAP for Cloud Development"| D{"Is the object a released API for this language version?"} D -->|"yes"| E["Allowed"] D -->|"no"| F["Syntax check reports an error"]

A practical consequence follows. A class in ABAP for Cloud Development may not call classic code written in Standard ABAP, unless that code is released. A class in Standard ABAP may call released objects as well as everything else. In a system that supports classic ABAP you can use both Standard ABAP and ABAP for Cloud Development, so new code that should survive upgrades can be written in ABAP for Cloud Development even on premise.

In ABAP Development Tools (ADT) the language version of an object is the property ABAP Language Version on the General tab of its properties. The setup of ADT is in ABAP Development Tools (ADT).

Released APIs and release contracts

An API is the part of a piece of software that other code is allowed to call. A released API is one that SAP has explicitly marked as stable: SAP promises not to change it in a way that breaks callers, so your code keeps working after an upgrade. Objects that are not released can change or disappear without notice, which is exactly what makes code hard to upgrade.

A repository object becomes a released API for a restricted language version through two classifications. It has a release contract, which names the kind of use the promise covers, and it is marked visible for the restricted language version. Objects with the contracts C0 and C1 can be made visible for ABAP for Cloud Development and ABAP for Key Users, and for access from other objects only C1 is relevant. The contracts are called C0, C1, C2, C3 and C4:

Contract What it is about

C0

Allows enhancement fields to be added at specified extension options.

C1

Use system-internally: a stable interface for use within the AS ABAP. This is the contract that matters when you call a class, an interface or a CDS view from ABAP for Cloud Development.

C2

Use as remote API: a stable interface that also holds for use outside the AS ABAP.

C3

Manage configuration content: stable persistence for configuration content.

C4

Use in ABAP-managed database procedures (AMDP): a stable interface of AMDP methods for use in other AMDP methods.

Each contract says "stable for this use only". In ADT the release state of an object, and its release contract, is shown in the API State part of the object’s properties, and the Released Objects node of the project explorer lists the released objects. SAP also publishes data on released objects as the Cloudification Repository so that you can look at it outside the system.

SAP also classifies extensions by clean core levels A to D; level A is cloud development with the use of released APIs. This page does not define levels B to D; their definitions are in the SAP Cloud ALM documentation.

What the syntax check does

The syntax check is the compiler step that reads your source and reports errors before anything runs. In Standard ABAP it accepts any call to any visible object. In ABAP for Cloud Development it adds a second test: for every object your code uses, it asks whether that object is released for the kind of use you make of it. If not, the check reports an error. Statements that are not allowed in ABAP for Cloud Development are rejected in the same way.

The problem is reported while you edit, not at run time, which is why you meet it early. Two ways out exist. Replace the call by a released alternative (the Cloudification Repository data has a successor field for objects that have one), or keep the classic call in a class of your own written in Standard ABAP, which is possible only in a system that supports classic ABAP.

Example: a released class and a call that is rejected

The first listing uses CL_ABAP_RANDOM_INT, a class with release contract C1, so it can be used in ABAP for Cloud Development. The listing requires an SAP system; not run here.

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

CLASS zcl_exp_claim_ticket IMPLEMENTATION.
  METHOD if_oo_adt_classrun~main.
    " Draw a number between 1 and 6, for example to pick a review slot
    DATA(random) = cl_abap_random_int=>create( seed = 42
                                                min  = 1
                                                max  = 6 ).
    out->write( |Review slot: { random->get_next( ) }| ).
  ENDMETHOD.
ENDCLASS.

The next listing calls the classic function module POPUP_TO_CONFIRM, which the Cloudification Repository lists as a classic API, not as released. In Standard ABAP the call is accepted. In ABAP for Cloud Development the syntax check reports an error for it. It requires an SAP system; not run here.

METHOD if_oo_adt_classrun~main.
  " Not released for ABAP for Cloud Development: the syntax check rejects this call
  CALL FUNCTION 'POPUP_TO_CONFIRM'
    EXPORTING
      text_question = 'Delete the claim?'.
ENDMETHOD.

The fix is not to hide the call but to leave the user interface to the front end: an app asks the question and the class only receives the answer. Logic that works on claims belongs in a RAP business object, as in the Expense claims running example with ZEXP_CLAIM and ZEXP_ITEM.

Older material you may meet

Older books, blog posts and code written before ABAP for Cloud Development existed describe only one ABAP, which is now called Standard ABAP. They freely call function modules, read SAP tables directly and use WRITE lists and dialog screens. List output and dynpro statements are not allowed in ABAP for Cloud Development, and the other calls are allowed there only for released objects. The ideas of language version, release contract and released API are absent from such sources. When you read old code, treat it as Standard ABAP. The concepts it teaches (internal tables, classes, exceptions) still apply, but the objects it calls may not be released, so expect to look for a released successor before moving it to ABAP Cloud. Systems that are on premise keep supporting Standard ABAP, so old code continues to run there.

Summary

  • ABAP has three language versions: Standard ABAP (unrestricted), and the restricted ABAP for Cloud Development and ABAP for Key Users.

  • ABAP for Cloud Development, combined with released APIs only, is called ABAP Cloud, and it is the safe base for code that must survive upgrades.

  • SAP marks an object as released for a kind of use through release contracts named C0 to C4; C1 covers use in your own ABAP code.

  • The syntax check of ABAP for Cloud Development rejects a call to an object that is not released, so the error shows up while you edit.

  • Clean core levels A to D exist; level A is cloud development with the use of released APIs.

  • Old code and old books describe Standard ABAP only; check each object it calls before reusing it in the cloud.