ERPClimb logoERPClimb
OOP ABAP
ABAP Developmentadvanced 9 min read

OOP ABAP Part 10: OOP in S/4HANA, RAP and Clean Core

Preview · a free account unlocks the full lesson

Key takeaway

See where classic OOP knowledge is used in S/4HANA: BAdIs as interfaces, released APIs and wrapper classes, RAP behaviour pools with local handler classes, ABAP Cloud restrictions and Clean ABAP guidelines for classes.

In this lessonShow sections

Visual overview

OOP ABAP Part 10: OOP in S/4HANA, RAP and Clean Core — learning sheetFlow: Open a RAP behaviour pool (ZBP_…) and identify lhc_ and lsc_ classes → Implement a BAdI and note the interface it implements → Create a wrapper class for an unreleased FM, as in the code example. Key ideas: BAdIs = INTERFACES; RELEASED APIs AND WRAPPERS; RAP BEHAVIOUR POOLS; CLEAN ABAP FOR CLASSES. Watch out: In ABAP Cloud (language version 5), classic FORMs, WRITE lists, direct SAP table access and unreleased FMs are not allowed.ERPClimb.com / ABAP / LESSON 10/10 / LEARNING SHEETOOP ABAP Part 10: OOP in S/4HANA, RAP and Clean Core1 · HOW IT FLOWS1Open a RAP behaviour pool(ZBP_…) and identify lhc_and lsc_ classes2Implement a BAdI and notethe interface itimplements3Create a wrapper classfor an unreleased FM, asin the code example2 · KEY IDEAS EXPLAINEDBAdIs = InterfacesA new BAdI implementation (SE19/ADT) is a classimplementing the BAdI interface (IF_EX_… classic,IF_BADI_… new). The framework instantiates it (GET…Released APIs And WrappersSAP marks objects as released (API state C1 foruse in cloud development).In ABAP Cloud you may use only released CDS views,classes and interfaces (e.g. XCO library,CL_ABAP_CONTEXT_INFO instead of sy-uname in some…RAP Behaviour PoolsThe behaviour definition points to a class ZBP_…;its global part is empty.Local classes inside it: lhc_booking INHERITINGFROM cl_abap_behavior_handler with methods FORVALIDATE, FOR DETERMINE, FOR MODIFY (actions)…Clean ABAP For ClassesSmall classes with one responsibility; FINAL bydefault.Prefer instance methods and interfaces; injectdependencies.3 · REMEMBER · WATCH OUTRememberIn S/4HANA, extensions are object-oriented: BAdIs are interfaces, RAPbehaviour is implemented in classes, and released APIs are…Clean core: use released objects (C1 contract) and wrap unreleasedfunctionality in your own class when needed.RAP behaviour pools are global classes with local handler classes(lhc_…) and saver classes (lsc_…).!Watch outIn ABAP Cloud (language version 5),classic FORMs, WRITE lists, directSAP table access and unreleased FMsare not allowed.4 · IN A REAL PROJECTDuring an S/4HANA conversion, a team wanted new approval logic to be cloud-ready, but it needed material textsread by an unreleased function module. Calling the FM directly would have failed the clean core ATC checks forthe new package. They created a wrapper class ZCL_MATERIAL_READER with an interface in a classic package and…Original ERPClimb learning sheet • Verify against your SAP release and edition

Explanation

Parts 1 through 9 of this series built up OOP skills; this lesson connects them to what you actually meet in S/4HANA projects today, while classic ECC and on-premise code keeps running in the very same system. In S/4HANA, extensions are object-oriented throughout: BAdIs are interfaces, RAP behavior is implemented in classes, and released APIs are themselves classes and interfaces.

A new BAdI implementation, built in SE19 or ADT, is simply a class implementing the BAdI's interface — IF_EX_… for classic BAdIs, IF_BADI_… for new ones — and the framework instantiates it through GET BADI / CALL BADI; everything covered in Parts 3 and 8, on interfaces, factories, and polymorphism, applies directly here.

SAP marks certain objects as released, with API state C1 meaning they're usable in cloud development. In ABAP Cloud, you may only use released CDS views, classes, and interfaces — for example, the XCO library, or CL_ABAP_CONTEXT_INFO in place of sy-uname in some cases. If you need functionality that isn't released while working on-premise, create a wrapper class in a classic ABAP package, release that wrapper yourself for your cloud-ready code to depend on, and keep the dependency on the unreleased object contained in that one place.

Free account

Create a free account to keep reading

You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.

  • Full explanation
  • Code example
  • Real project scenario
  • Common mistakes
  • Best practices
  • Interview angle

One tap with Google works too. Every topic keeps its first lesson open to everyone.

Keep exploring

Referenced SAP objects

Reviewed reference pages for the objects this page mentions.

Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.