ABAP Cloud Part 6: Language Version, Syntax Restrictions and API Checks
Understand ABAP language versions (Standard ABAP, ABAP for Cloud Development, ABAP for Key Users), what the cloud version forbids, how to set and check it in ADT, and how to rewrite common classic statements in cloud-compliant style.
Explanation
📌 KEY POINTS
✅ Every ABAP object has a language version. "ABAP for Cloud Development" is the one used for ABAP Cloud.
✅ The syntax check itself enforces the rules: forbidden statements and unreleased objects are syntax errors, not just warnings.
✅ Classic UI and system statements (WRITE, SUBMIT, CALL TRANSACTION, dynpro) are not allowed. Use RAP, released classes and console output.
⚠️ You can use your own custom tables and objects freely. The restriction is on SAP objects that are not released.
━━━━━━━━━━━━━━━━━━━━
▶ WHERE WE ARE
Part 4 used ATC to find problems. This part explains the rule that produces many of them: the language version of each object.
━━━━━━━━━━━━━━━━━━━━
▶ 1. THE LANGUAGE VERSIONS
- Standard ABAP: the classic full language. Anything is allowed; nothing is checked for release.
- ABAP for Cloud Development: restricted syntax plus a release check. Only released SAP APIs and your own objects may be used. This is ABAP Cloud.
- ABAP for Key Users: used by key-user tools (e.g. custom logic in Fiori apps); even more restricted.
In the SAP BTP ABAP environment and S/4HANA Cloud Public Edition, developer objects are always ABAP for Cloud Development. In S/4HANA on-premise and Private Cloud you choose per software component or package.
━━━━━━━━━━━━━━━━━━━━
▶ 2. WHERE IT IS SET
- In ADT: object → Properties → General → ABAP Language Version.
- Usually inherited: the software component or package is set up for ABAP Cloud, so every new object gets the cloud version automatically.
- Mixed packages are a warning sign; keep ABAP Cloud code in dedicated packages.
2a. HOW THE CHECK WORKS
When an object is ABAP for Cloud Development, the ABAP compiler checks each statement and each referenced repository object. Using an unreleased SAP table, class or function module gives a syntax error such as "not released for use in cloud development". ATC adds further checks, but the core rule is enforced at compile time.
━━━━━━━━━━━━━━━━━━━━
▶ 3. WHAT IS NOT ALLOWED (TYPICAL)
- Classic list and screen programming: WRITE, dynpro screens, selection screens, SUBMIT, CALL TRANSACTION.
- Native and dynamic access to SAP internals: EXEC SQL, direct access to SAP tables that are not released.
- Unreleased function modules, classes, BAdIs and system fields restricted in cloud (e.g. some sy fields).
- File system and OS access from the application server.
- Dynamic generation of programs (GENERATE SUBROUTINE POOL and similar).
━━━━━━━━━━━━━━━━━━━━
▶ 4. WHAT TO USE INSTEAD
- Output: console classes (IF_OO_ADT_CLASSRUN) for tests, RAP services and Fiori apps for users.
- User and time: CL_ABAP_CONTEXT_INFO for user, date and time.
- Number ranges: CL_NUMBERRANGE_RUNTIME.
- Background processing: application jobs (released job catalog/templates) or bgPF instead of SUBMIT/job FMs.
- Reading SAP data: released I_ CDS views and released RAP BO interfaces.
- Utilities: the XCO library (XCO_CP_*) for many generic needs.
━━━━━━━━━━━━━━━━━━━━
▶ 5. SWITCHING AN EXISTING OBJECT
Changing old code to ABAP for Cloud Development usually produces many syntax errors at once. Plan it as a migration: fix dependencies first (Part 3), then switch the version, then run ATC. Do not switch productive objects without regression tests.
💡 TIP: Create a small ABAP Cloud "playground" package and try each forbidden statement once. Seeing the actual syntax errors makes the rules stick.
⚠️ WATCH OUT: Released status is per contract. An object released for key-user use is not automatically released for cloud development, and the reverse is also true.
📌 REMEMBER: Language version decides what the compiler accepts. Release state decides which SAP objects you may call.
━━━━━━━━━━━━━━━━━━━━
▶ STEP BY STEP
- Create package ZPR_CLOUD with the ABAP Cloud language version (or in a cloud software component).
- Create class ZCL_PR_DEMO implementing IF_OO_ADT_CLASSRUN.
- Add a WRITE statement and a SELECT on a classic table; activate and read the errors.
- Replace them with the cloud-compliant code shown in the example; activate again.
- Run ATC with the cloud development variant to confirm zero findings.
✅ CHECKPOINT: you can tell which language version an object uses and rewrite classic statements into ABAP Cloud style.
Code example
" ===== Step 1: class in a package with ABAP for Cloud Development =====CLASS zcl_pr_demo DEFINITION PUBLIC FINAL CREATE PUBLIC. PUBLIC SECTION. INTERFACES if_oo_adt_classrun.ENDCLASS. CLASS zcl_pr_demo IMPLEMENTATION. METHOD if_oo_adt_classrun~main. " ----- Step 2: output ----- " NOT allowed: WRITE: / 'Hello'. out->write( 'Hello from ABAP Cloud' ). " ----- Step 3: user, date, time ----- " NOT allowed (restricted): DATA(u) = sy-uname. DATA(user) = cl_abap_context_info=>get_user_technical_name( ). DATA(today) = cl_abap_context_info=>get_system_date( ). out->write( |User { user }, date { today }| ). " ----- Step 4: SAP data ----- " NOT allowed: SELECT lifnr FROM lfa1 ... (unreleased table) SELECT Supplier, SupplierName FROM i_supplier INTO TABLE @DATA(suppliers) UP TO 5 ROWS. out->write( suppliers ). " ----- Step 5: own custom table is fine ----- SELECT request_id, supplier FROM zpr_head INTO TABLE @DATA(requests) UP TO 5 ROWS. out->write( requests ). " ----- Also NOT allowed in ABAP for Cloud Development ----- " SUBMIT zold_report. -> use application jobs / bgPF " CALL TRANSACTION 'ME51N'. -> use released RAP BO / Fiori app " EXEC SQL ... ENDEXEC. -> use ABAP SQL on released CDS " CALL FUNCTION 'NUMBER_GET_NEXT' -> cl_numberrange_runtime=>number_get ENDMETHOD.ENDCLASS. " Run: F9 in ADT (Run as ABAP Application - Console)Real project scenario
A team switched 60 existing classes to ABAP for Cloud Development in one transport because "ATC showed only a few findings per class". Activation failed with hundreds of syntax errors, the transport was blocked and a release date slipped.
They restarted with a plan: replace dependencies per class first, switch one class at a time, activate, run unit tests and ATC, then move on. New development went into a dedicated cloud package from day one, so the migration backlog stopped growing.
Common mistakes
- Thinking the cloud rules are only ATC warnings; they are syntax errors.
- Mixing Standard ABAP and ABAP Cloud objects in the same package.
- Assuming your own Z tables are forbidden (they are allowed).
- Switching many old objects at once without fixing dependencies first.
- Using sy-uname or sy-datum where released classes are required.
Best practices
- Keep ABAP Cloud code in dedicated packages or software components.
- Migrate old objects one at a time: dependencies first, then the version switch.
- Use released classes (CL_ABAP_CONTEXT_INFO, XCO) instead of system fields and FMs.
- Run ATC with the cloud development variant on every change.
- Keep a small playground package for trying out the rules.
Interview angle
Questions: "What is an ABAP language version?", "What is not allowed in ABAP Cloud?", "How do you get the current user in ABAP Cloud?"
Strong answer: each object has a language version; ABAP for Cloud Development restricts syntax and only allows released SAP objects plus your own, enforced by the compiler. Classic UI statements, SUBMIT/CALL TRANSACTION, native SQL and unreleased objects are blocked. Alternatives: console output via IF_OO_ADT_CLASSRUN, CL_ABAP_CONTEXT_INFO for user/date, released I_ CDS views, application jobs or bgPF for background work.
Practice this lesson
Quick check
1. An ATC readiness run returns 18,000 findings. What is the most effective first step?
2. In ABAP for Cloud Development, how should code read the current user name?
3. Which statement is allowed in ABAP for Cloud Development?
Interview questions
1. Which ABAP language versions exist, and what is not allowed in ABAP for Cloud Development?
Answer it in your own words first, then compare.
2. What is ABAP Cloud, and what changes for a developer compared to classic ABAP?
Answer it in your own words first, then compare.
Reference-verified: the steps are checked against official SAP documentation and tutorials, and object and field names in the sample code are checked for consistency. The code has not been compiled or run on an SAP system by ERPClimb. Syntax marked release-dependent varies by SAP release, so check it in your own system.
More lessons in this topic
- ABAP Cloud Part 1: Released APIs, ATC and Clean Core
- ABAP Cloud Part 2: RAP and ABAP Cloud Architecture for Clean-Core Extensions
- ABAP Cloud Part 3: Replacing Direct Table and Classic API Dependencies
- ABAP Cloud Part 4: ATC Readiness — Finding and Fixing Unreleased Usage
- ABAP Cloud Part 5: On-Stack Developer Extension vs BTP Side-by-Side
- ABAP Cloud Part 7: Released APIs and Release Contracts