Beyond ABAPdesigned by@Tejoram97
Beyond ABAP / OOPS ABAP / Interview Questions

Interview Questions

OOPS ABAP · ABAP Development ·

Open the interactive lesson →

Revise OOPS ABAP here: first the one-line checklist of every topic, then all interview questions grouped by page. Read the page when an answer needs more depth.

Quick revision checklist

01 · Classes & Objects

  • Attributes (1): instance DATA – own copy per object; static CLASS-DATA – one copy per class (class=>attr); CONSTANTS – fixed value set at declaration; TYPES allocate no memory.
  • Instance vs static methods (2): METHODS reach every component of their class and need an object; CLASS-METHODS reach only static components directly and are called with class=>m( ).
  • Parameters (3): IMPORTING, EXPORTING, CHANGING, RETURNING (only one, always VALUE( )); order IMPORTING → EXPORTING → CHANGING → RETURNING → RAISING.
  • Functional method (3): has a RETURNING parameter and can be used in expressions (IF lo_order->is_valid( ).); since 7.40 SP02 it may also have EXPORTING/CHANGING.
  • Pass by reference vs value (4): by reference is the default (IMPORTING by reference is read-only); VALUE(p) passes a copy; RETURNING is always by value.
  • Local vs global class (4): local = defined inside one program; global = SE24/ADT class pool, usable in every program.
  • Friends (5): CLASS a DEFINITION … FRIENDS b lets class B access A's protected and private components; one-way, not transitive (GLOBAL FRIENDS for global classes).
  • DEFERRED / LOAD (5): CLASS c DEFINITION DEFERRED. = forward declaration when c is defined later; DEFINITION LOAD is obsolete.
  • Instance constructor (6): method constructor, only IMPORTING parameters and exceptions, runs once for every object created.
  • Static constructor (6): class_constructor, no parameters, runs once per internal session before the class is first used – on the first NEW before the instance constructor.
  • Visibility (12): class level CREATE PUBLIC | PROTECTED | PRIVATE = who may instantiate; component level PUBLIC / PROTECTED / PRIVATE SECTION = who may access.
  • ME: implicit, read-only reference to the current object inside instance methods (not in static methods).

02 · Inheritance, Polymorphism & Interfaces

  • Inheritance (7): INHERITING FROM; single, multilevel and hierarchical – exactly one superclass (root OBJECT), no multiple class inheritance.
  • Several interfaces: a class may implement many interfaces – type inheritance without code reuse (the "multiple inheritance" answer).
  • Private components: inherited but not visible in the subclass; public and protected ones are usable.
  • FINAL (7): on a class – no subclasses; on a method – inherited but can't be redefined.
  • Redefinition (7): METHODS m REDEFINITION. keeps signature, visibility and category; only public or protected instance methods; super->m( ) calls the superclass version.
  • Overloading (7): not supported in ABAP – use OPTIONAL/DEFAULT parameters or different method names.
  • Polymorphism (7): a superclass or interface reference calls the redefined method of the real object (dynamic binding).
  • Constructor hierarchy (8): static constructors run super → sub; a subclass with its own instance constructor must call super->constructor( ) before touching instance components.
  • Abstract (9): an ABSTRACT class can't be instantiated; abstract methods have no implementation and are implemented in subclasses; static methods and constructors can't be abstract.
  • Up cast (9): subclass or implementing object → superclass/interface reference with = (old name "narrowing cast"); only the superclass's components are addressable.
  • Down cast (9): back to the subclass with ?= or CAST (old name "widening cast"); wrong class → CX_SY_MOVE_CAST_ERROR, test first with IS INSTANCE OF.
  • Dynamic call (9): CALL METHOD lo_obj->(lv_name) works but skips static checks – prefer a down cast or a method declared in the superclass/interface.
  • Interfaces (10): local or global (SE24/ADT); all components public – methods, attributes, constants, types, events, aliases; no constructor, no implementation; access with zif_x~m.
  • Partial implementation (11): INTERFACES zif_x ABSTRACT METHODS m (a subclass implements m), DEFAULT IGNORE / FAIL optional methods, PARTIALLY IMPLEMENTED only in test classes.
  • Nested interfaces (11): included interfaces sit on one level – zif_inner~m, never zif_outer~zif_inner~m.
  • Aliases (11): ALIASES m FOR zif_x~m – short names, for interface components only.

03 · Exceptions, Events & Advanced OO

  • Exceptions (12): an exception object of a CX_ class is raised; only an unhandled exception becomes a short dump (ST22).
  • TRY / CATCH / CLEANUP (13): CATCH blocks ordered subclass → superclass; CLEANUP runs only when the exception moves on to an outer handler; no FINALLY.
  • Categories (13): CX_STATIC_CHECK must be declared, CX_DYNAMIC_CHECK is checked at runtime, CX_NO_CHECK is implicit – all below CX_ROOT.
  • RAISING / RAISE (14): RAISING zcx_x hands the exception to the caller; raise with RAISE EXCEPTION TYPE / NEW or THROW; classic EXCEPTIONS + RAISE name + sy-subrc is legacy.
  • Custom exception classes (15): ZCX_… with a message class (IF_T100_MESSAGE / IF_T100_DYN_MSG), exception IDs and placeholder attributes; OTR texts are legacy.
  • Transient vs persistent (16): a transient object lives only in memory; a persistent object's state is stored in the database by the persistence service (legacy).
  • Persistent class (16–18): CREATE PROTECTED + IF_OS_STATE; base agent ZCB_… (abstract) and agent ZCA_… (singleton via =>AGENT); mapping by business key, GUID (OS_GUID) or both.
  • CRUD and transaction service (17, 19): CREATE_ / GET_ / DELETE_PERSISTENT + COMMIT WORK; CL_OS_SYSTEM=>GET_TRANSACTION_MANAGER → start( ), end( ), undo( ); replaced by RAP + EML.
  • RTTS (20): RTTI describes (describe_by_name / _data / _object_ref), RTTC creates (CL_ABAP_TABLEDESCR=>create, CREATE DATA … TYPE HANDLE); validate dynamic table names + authority check.
  • Design patterns (21): singleton (FINAL CREATE PRIVATE + static get_instance), factory (CL_SALV_TABLE=>FACTORY), MVC (model / view / controller).
  • Event handling (22): EVENTS → handler FOR EVENT … OF → SET HANDLER before raising → RAISE EVENT; parameters exporting by value, implicit SENDER.
  • ABAP Unit: FOR TESTING RISK LEVEL … DURATION …, concrete test methods, setup/teardown, CL_ABAP_UNIT_ASSERT, test doubles through injected interfaces.

04 · ALV Reporting

  • REUSE_ALV_GRID_DISPLAY / _LIST_DISPLAY: function-module ALV – legacy, not in ABAP Cloud; read and maintain only.
  • CL_SALV_TABLE: modern read-only ALV – factory( ) then display( ); columns, sorts, aggregations and events through get_…( ) objects; not editable.
  • CL_GUI_ALV_GRID: control-based ALV in a container; needed for editable ALV, several grids and full event control (set_table_for_first_display, refresh_table_display).
  • Field catalog: an internal table, one row per column (LVC_T_FCAT, FM ALV SLIS_T_FIELDCAT_ALV); layout in LVC_S_LAYO.
  • ALV events: handler methods FOR EVENT double_click / hotspot_click / toolbar / user_command / data_changed OF cl_gui_alv_grid, registered with SET HANDLER.
  • ALV with IDA: CL_SALV_GUI_TABLE_IDA pages large tables or CDS views directly in HANA – no internal table.

How to practise

Cover the answer, say yours out loud in 30–60 seconds, then compare.

01 · Classes & Objects

What is a class and what is an object? Does a class use memory?

A class is the blueprint: it declares attributes (state) and methods (behaviour). An object is an instance created at runtime with NEW or CREATE OBJECT, with its own copy of the instance attributes. The class itself creates no instance data, but once loaded its static attributes and code are in memory.

What are the OO principles, and what is the difference between encapsulation and abstraction?

Encapsulation, abstraction, inheritance, polymorphism. Encapsulation hides the data inside the class and allows changes only through its methods (visibility sections). Abstraction exposes only the essential behaviour – a small public API, abstract classes and interfaces – so callers don't depend on details.

Local vs global class?

A local class is defined inside one program and visible only there (lcl_…). A global class is created in SE24 or ADT, stored in a class pool and usable by all programs (ZCL_…). Global classes can have local helper and test classes in their own includes.

Instance vs static attributes and methods?

Instance components belong to one object (DATA, METHODS, accessed with ->). Static components belong to the class, exist once per session and are shared by all objects (CLASS-DATA, CLASS-METHODS, accessed with =>). Static methods cannot use instance attributes or ME directly.

What is a functional method? Can it have EXPORTING parameters?

A method with exactly one RETURNING parameter (always by value), so its call can be used in expressions, conditions and chains. Since 7.40 SP02 it may also have EXPORTING and CHANGING parameters; before that it could only have IMPORTING parameters besides RETURNING. Clean ABAP still advises using only one kind of output parameter per method.

Pass by value vs pass by reference in methods?

By reference (default) passes the address: IMPORTING is read-only, EXPORTING/CHANGING write directly into the caller's variable – and a by-reference EXPORTING parameter is not cleared at the start. By value (VALUE( )) works on a copy that is copied back only when the method ends normally. RETURNING is always by value.

What is ME?

An implicit, read-only reference variable pointing to the object whose instance method is running. It is used to address attributes hidden by local names (me->attr) or to pass the current object on. It does not exist in static methods.

CREATE OBJECT vs NEW?

Both create an object. NEW (7.40) is an expression: it can be used inline (DATA(lo) = NEW lcl_x( )), with # for the target type, directly in method calls and chains. CREATE OBJECT is the classic statement; its TYPE (name) variant creates an object of a class known only at runtime.

Instance vs static constructor – when do they run and in which order?

The static constructor (class_constructor, no parameters) runs once per internal session before the class is first used. The instance constructor (constructor, IMPORTING only) runs for every new object. For the first object: static first, then instance; afterwards only the instance constructor. With inheritance, static constructors run superclass first.

Explain PUBLIC, PROTECTED, PRIVATE and READ-ONLY.

Public components are visible everywhere, protected ones in the class and its subclasses, private ones only in the class (and its friends). READ-ONLY on a public attribute lets everyone read it but only the class change it.

What does CREATE PRIVATE do, and how do you build a singleton?

CREATE PRIVATE allows instances to be created only inside the class. A singleton combines CREATE PRIVATE (best also FINAL) with a private static attribute holding the one instance and a public static get_instance( ) method that creates it on first call and returns it.

What is a friend class? Is friendship inherited?

A class that has been granted access (CLASS a DEFINITION FRIENDS b) to all components of the granting class, including private ones. It is one-way and not transitive. Subclasses of the friend are also friends, but subclasses of the granting class do not pass the friendship on. Typical use: LOCAL FRIENDS for unit tests.

What is the difference between a data reference and an object reference?

A data reference (TYPE REF TO <data type>, generic REF TO data) points to a data object and is dereferenced with ->*; it is created with REF #( ), NEW type( ) or CREATE DATA. An object reference (TYPE REF TO <class or interface>, generic REF TO object) points to an instance of a class and reaches its components with ->; it is created with NEW or CREATE OBJECT. Through REF TO object you can call nothing until you cast it or use a dynamic call.

There are no reports in ABAP Cloud – how do you run a class?

Implement the released interface IF_OO_ADT_CLASSRUN in a global class and put the code in its method if_oo_adt_classrun~main. Pressing F9 in ADT runs it; out->write( data = … name = … ) sends data objects to the Console view. For repeatable checks use ABAP Unit tests instead.

What is ABAP Doc?

Documentation comments that start with "! directly before a declaration, with tags such as @parameter and @raising for the method signature. ADT shows them in the ABAP Element Info view and the F2 pop-up wherever the element is used. Clean ABAP recommends ABAP Doc for public APIs, not for internal code.

Should parameters have prefixes like iv_ and rv_? May one method mix RETURNING, EXPORTING and CHANGING?

Many classic projects use prefixes and you should follow the project's convention. SAP's Clean ABAP guide recommends dropping encoding prefixes and naming the RETURNING parameter result. Mixing output kinds is allowed since 7.40 SP02, but Clean ABAP says to use only one of RETURNING, EXPORTING or CHANGING, preferably RETURNING, because several output kinds suggest the method does more than one thing.

02 · Inheritance, Polymorphism & Interfaces

Does ABAP support multiple inheritance?

Not for classes: every class has exactly one superclass (root class OBJECT). A class can implement any number of interfaces, which gives multiple type inheritance – the class must still implement the methods itself.

Are private components inherited?

Yes, they exist in every subclass object and the superclass's methods use them, but they are not visible in the subclass. Only public and protected components can be addressed there.

Overloading vs overriding – which does ABAP support?

Only overriding (redefinition): a subclass re-declares an inherited instance method with REDEFINITION and implements it again, same signature. Overloading – one name, several parameter lists – is not supported; use optional parameters or different method names.

What are the rules for redefining a method?

Only public or protected, non-final instance methods; the signature, visibility and category stay the same; static, private, final methods and constructors cannot be redefined. super->m( ) calls the superclass version inside the redefinition. A redefinition can be made FINAL.

Why must a subclass constructor call super->constructor( )?

So the inherited part of the object is initialised by the superclass's own logic. It is mandatory whenever the subclass declares its own instance constructor, and before the call the subclass cannot use instance attributes. A subclass without its own constructor uses the superclass constructor and its parameters.

Abstract class vs interface – when do you use which?

An abstract class can hold concrete code, attributes, a constructor and protected components; a class inherits only one. An interface is a pure contract with public components only; a class can implement many. Use an abstract class for shared implementation in an is-a hierarchy, an interface for a contract that unrelated classes fulfil (BAdIs, test doubles).

Can you instantiate an abstract class? Must it have abstract methods?

No – NEW on an abstract class is a syntax error, but you can declare references of its type and create objects of concrete subclasses. An abstract class does not need abstract methods; a class that has an abstract method must be abstract.

Explain up cast and down cast. What are narrowing and widening casts?

Up cast: subclass or class reference to superclass or interface reference, always allowed with = (old name narrowing cast). Down cast: back to the more specific type with ?= or CAST, checked at runtime (old name widening cast); if the object is not of that type, CX_SY_MOVE_CAST_ERROR is raised. Check first with IS INSTANCE OF or CASE TYPE OF.

What is polymorphism / dynamic binding? Give an example.

One reference type, many behaviours: a superclass or interface reference points to objects of different classes, and calling a redefined method runs each object's own implementation. Example: a table of REF TO lcl_vehicle holding cycles and bikes – the same describe( ) call prints different texts. BAdIs rely on it.

How do you call a method of a nested interface? What are aliases?

Component interfaces are on one level: in the class you write lif_inner~m, and through a reference to the outer interface lo->lif_inner~m( ). An alias (ALIASES m FOR lif_inner~m) gives an interface component a short name in the class or the outer interface.

Can a class implement only part of an interface?

Yes: with INTERFACES lif_x ABSTRACT METHODS m (the class becomes abstract, a subclass implements m), or if the interface declares the method DEFAULT IGNORE or DEFAULT FAIL (7.40 SP08). PARTIALLY IMPLEMENTED is allowed only in test classes.

FINAL class vs FINAL method?

A FINAL class cannot have subclasses. A FINAL method is inherited but cannot be redefined; it makes sense only for public or protected instance methods, because static and private methods can't be redefined anyway.

What is a class that is both ABSTRACT and FINAL?

It can have neither objects nor subclasses, so only its static components can be used – a static utility class. Instance components may be declared but can never be used. Clean ABAP prefers objects to static classes because static methods cannot be replaced by test doubles.

How is a BAdI related to interfaces and polymorphism?

A new BAdI defines an interface (including IF_BADI_INTERFACE); each implementation is a class that implements it. GET BADI picks the active implementations by filter values (or the fallback class), and CALL BADI calls the interface method – SAP's code knows only the interface, the implementing class decides what runs. Classic BAdIs use CL_EXITHANDLER=>GET_INSTANCE and are legacy; in ABAP Cloud only released BAdIs can be implemented.

ABAP has no overloading – how can one method accept values of different types?

With generic typing: IMPORTING iv_value TYPE simple (or any, data, numeric, clike, ANY TABLE …). The actual type comes from the argument at runtime. A RETURNING parameter must be completely typed; REF TO data and REF TO object count as complete.

What can you do with a variable of TYPE REF TO object?

It can hold any object, because every class inherits from OBJECT. But OBJECT has no components, so to use the object you down cast it (after IS INSTANCE OF or with CASE TYPE OF) or call a method dynamically. Prefer an interface type when the methods are known.

03 · Exceptions, Events & Advanced OO

What are the three exception categories and how do you choose?

All inherit from CX_ROOT. CX_STATIC_CHECK: must be declared in RAISING, checked at compile time – for errors every caller must expect (most custom exceptions). CX_DYNAMIC_CHECK: checked at runtime – for errors the caller can avoid by checking first (CX_SY_ZERODIVIDE). CX_NO_CHECK: implicitly declared – for errors that can't sensibly be handled locally (resource shortage).

When does the CLEANUP block run? Can a TRY have CATCH and CLEANUP together?

Yes – any number of CATCH blocks plus one CLEANUP after them. CLEANUP runs only when an exception from this TRY is not caught here but by an outer handler; it must end normally through ENDTRY. If the exception is caught locally, or nobody catches it (short dump), CLEANUP does not run. ABAP has no FINALLY.

What does RAISING do, and what happens if an exception is not declared?

RAISING lets the exception propagate to the caller, who handles it. If a STATIC or DYNAMIC check exception leaves a method without being declared, the runtime raises CX_SY_NO_HANDLER with the original exception in PREVIOUS; unhandled, that dumps.

Classic exceptions vs class-based exceptions?

Classic: EXCEPTIONS in the signature, RAISE name or MESSAGE … RAISING, caller checks SY-SUBRC; no object, no text, no propagation through several levels. Class-based: exception objects with texts and PREVIOUS chaining, propagate automatically, handled with TRY/CATCH. One method can't mix both; new code uses class-based exceptions.

How do you create a custom exception class with a message from a message class?

Create ZCX_… in SE24/ADT inheriting from CX_STATIC_CHECK (usually), tick "With message class" so it implements IF_T100_MESSAGE (or IF_T100_DYN_MSG), define exception ID constants (MSGID, MSGNO, ATTR1–4) and attributes for the placeholders. Raise with RAISE EXCEPTION TYPE zcx_… EXPORTING textid = … or, with IF_T100_DYN_MSG, RAISE EXCEPTION TYPE zcx_… MESSAGE e001(zmsg) WITH …. OTR texts are legacy.

What is the difference between RESUME and RETRY?

RESUME continues in the raising method right after a RAISE RESUMABLE EXCEPTION; it needs CATCH BEFORE UNWIND and RESUMABLE in every RAISING clause on the way. RETRY restarts the whole TRY block from the beginning – fix the cause first or you loop forever.

Explain events in ABAP – what are the steps?

Declare the event with EVENTS/CLASS-EVENTS (EXPORTING parameters by value), declare a handler method FOR EVENT … OF class, register it with SET HANDLER before the event is raised, raise it with RAISE EVENT inside a method. Handlers are never called directly; unregistered handlers don't run. It is the observer pattern; ALV events (double_click, hotspot_click) work the same way.

Instance event vs static event – and what is SENDER?

Instance events (EVENTS) are raised only in instance methods and registered per sender (FOR lo_obj or FOR ALL INSTANCES). Static events (CLASS-EVENTS) can be raised in any method of the class and are registered without FOR. SENDER is the implicit parameter of instance events – a reference to the object that raised it. ACTIVATION abap_false deregisters a handler.

What is RTTS? How do you create an internal table for a table name known only at runtime?

RTTS = RTTI (describe types: CL_ABAP_TYPEDESCR=>describe_by_name/data/object_ref) + RTTC (create types: CL_ABAP_STRUCTDESCR=>get, CL_ABAP_TABLEDESCR=>create). Get the structure description, build the table type, CREATE DATA lr TYPE HANDLE lo_type, ASSIGN lr->* to a field symbol, SELECT FROM (name). Shortcut: CREATE DATA lr TYPE STANDARD TABLE OF (name). Always validate the name (allow-list, CL_ABAP_DYN_PRG) and check authorization – otherwise users can read any table.

How do you implement a singleton? Give a factory example from SAP.

Class FINAL CREATE PRIVATE, a private static attribute holding the instance, and a public static get_instance method that creates it on first call and always returns the same reference. Factory example: CL_SALV_TABLE=>FACTORY creates the ALV object for you; your own factories return an interface reference and choose the implementing class inside.

How do you write an ABAP Unit test, and how do you isolate dependencies?

Local class FOR TESTING with RISK LEVEL and DURATION, test methods FOR TESTING (concrete, no parameters), fixtures setup/teardown and class_setup/class_teardown, checks with CL_ABAP_UNIT_ASSERT. Isolate dependencies by injecting interfaces (constructor injection) and passing a test double – own class, CL_ABAP_TESTDOUBLE, CL_OSQL_TEST_ENVIRONMENT for tables, CL_CDS_TEST_ENVIRONMENT for CDS. Run with Ctrl+Shift+F10.

What is the persistence service, and what replaces it in S/4HANA?

Object Services map a persistence class (CREATE PROTECTED, IF_OS_STATE) to a table by business key, GUID or both; the generated singleton agent class (ZCA_…=>AGENT) offers CREATE/GET/DELETE_PERSISTENT, and the transaction service (CL_OS_SYSTEM) bundles changes. It is legacy and not available in ABAP Cloud; new development uses RAP business objects with CDS and EML.

What changes for object-oriented development in ABAP Cloud?

The OO language stays the same; the rules around it change. Objects use the language version ABAP for Cloud Development, so only released SAP APIs can be used (also dynamically) and SAP GUI techniques are gone: no SE24 (ADT instead), no reports or WRITE lists (IF_OO_ADT_CLASSRUN, application jobs), no CL_GUI_ALV_GRID or SALV (Fiori elements on RAP), no Object Services (RAP BOs), no OTR texts (message classes). XCO and released CDS views replace many function modules and tables.

What is a released API and what does the C1 contract mean?

A released API is an SAP object that SAP promises to keep stable across upgrades. ADT shows it on the API State tab: released or not, for which release contract, and the successor if it is deprecated. C1 means "use system-internally" – the object may be used in ABAP Cloud code; C0 covers extension points and C2 remote APIs. Classic code is checked with the ATC variant ABAP_CLOUD_READINESS.

What is a RAP behaviour pool, and which OO concepts does it use?

A global class ABSTRACT FINAL … FOR BEHAVIOR OF the BO, normally empty. The logic sits in local classes: handler classes inheriting from CL_ABAP_BEHAVIOR_HANDLER with methods FOR MODIFY / READ / VALIDATE / DETERMINE, and a saver class inheriting from CL_ABAP_BEHAVIOR_SAVER that redefines the save-sequence methods. The RAP runtime creates and calls them; errors go into failed and reported, not into exceptions, and handlers never COMMIT.

How do you get a test double into the code under test, and when is CL_ABAP_TESTDOUBLE not enough?

Constructor injection by default; setter or parameter injection for optional or single-use dependencies; back-door injection through LOCAL FRIENDS; or a factory with a test injector. Databases are replaced with CL_OSQL_TEST_ENVIRONMENT, CDS sources with CL_CDS_TEST_ENVIRONMENT, RAP BOs with the CL_BOTD_* environments, legacy blocks with test seams. CL_ABAP_TESTDOUBLE only doubles global interfaces and global classes that are not FINAL, FOR TESTING or CREATE PRIVATE and have no mandatory constructor parameters. And: without RISK LEVEL a test class counts as CRITICAL.

Exception, ASSERT or RAISE SHORTDUMP – which one when?

An exception (RAISE EXCEPTION NEW) for errors that can happen and that a caller may handle; chain the cause with previous. ASSERT for conditions that can only be false through a bug (ASSERTION_FAILED). RAISE SHORTDUMP (7.53) for unrecoverable states: it cannot be caught and writes the exception class and its text into the short dump. Clean ABAP: dump only for totally unrecoverable situations.

04 · ALV Reporting

REUSE_ALV_GRID_DISPLAY vs CL_GUI_ALV_GRID vs CL_SALV_TABLE?

REUSE FMs are legacy: SLIS catalog, events as callback FORMs, full screen only, not released for ABAP Cloud. CL_GUI_ALV_GRID is the OO grid control: needs a container, LVC catalog, many events, the only supported editable ALV. CL_SALV_TABLE is the simple OO model: factory( ) builds the catalog, full screen or container, runs in background, read-only.

What is a field catalog and how can you build it?

An internal table with one row per column (SLIS_T_FIELDCAT_ALV or LVC_T_FCAT): field name, heading, position, output length, colour, DO_SUM, HOTSPOT, EDIT, NO_OUT. Built automatically (I_STRUCTURE_NAME), with REUSE_ALV_ / LVC_FIELDCATALOG_MERGE from a DDIC structure, manually, or derived from SALV with cl_salv_controller_metadata=>get_lvc_fieldcatalog( ). Without it the ALV aborts.

What are the steps to display a CL_GUI_ALV_GRID?

Screen with a custom control area → in PBO create CL_GUI_CUSTOM_CONTAINER and CL_GUI_ALV_GRID once (IS NOT BOUND) → read data, build field catalog and layout, SET HANDLER → set_table_for_first_display( ) → later refresh_table_display( ); PAI handles OK_CODE and Back.

How do you colour a row, a cell and a column?

Column: fcat EMPHASIZE 'Cxyz'. Row: CHAR4 field with the colour code + layout INFO_FNAME. Cell: LVC_T_SCOL field (FNAME + COLOR) + layout CTAB_FNAME. In SALV: set_color( ) for a column and set_color_column( ) with an LVC_T_SCOL field for rows and cells.

How do you make an ALV editable and save the changes?

Use CL_GUI_ALV_GRID; fcat EDIT = 'X' (or layout EDIT). Handle DATA_CHANGED to validate (MT_MOD_CELLS, get_cell_value, add_protocol_entry), optionally register_edit_event( mc_evt_enter / mc_evt_modified ). On SAVE in PAI call check_changed_data( ), lock, check authority and update via own UPDATE or a BAPI, then COMMIT WORK.

MC_EVT_ENTER vs MC_EVT_MODIFIED?

Both are extra triggers for DATA_CHANGED, registered with register_edit_event( ). MC_EVT_ENTER fires on Enter; MC_EVT_MODIFIED fires as soon as the user leaves a modified cell. Without either, DATA_CHANGED fires only on the Check button, toolbar functions or check_changed_data( ).

How do you add your own button to the grid toolbar?

Handle event TOOLBAR and append a line to e_object->mt_toolbar (FUNCTION, ICON, TEXT, BUTN_TYPE); register the handler before the first display or call set_toolbar_interactive( ). The click arrives in USER_COMMAND (E_UCOMM). Hide standard buttons with IT_TOOLBAR_EXCLUDING (MC_FC_… constants).

HOTSPOT_CLICK vs DOUBLE_CLICK vs BUTTON_CLICK?

HOTSPOT_CLICK: single click on a cell of a column with fcat HOTSPOT (E_ROW_ID, E_COLUMN_ID). DOUBLE_CLICK: double click on any cell (E_ROW, E_COLUMN). BUTTON_CLICK: click on a cell with style MC_STYLE_BUTTON (ES_COL_ID, ES_ROW_NO). In REUSE FMs both clicks come as USER_COMMAND '&IC1'.

How do users save layouts, and what does I_SAVE mean?

Pass IS_VARIANT with REPORT = sy-repid and I_SAVE: space none, 'X' global only (names start with '/'), 'U' user-specific only, 'A' both; I_DEFAULT = 'X' allows a default layout. A selection-screen parameter with F4 LVC_VARIANT_F4 lets users choose the start layout.

How do you show a header (top of page) in each ALV type?

REUSE: TOP_OF_PAGE FORM calling REUSE_ALV_COMMENTARY_WRITE (logo from OAER via I_LOGO). Grid: event TOP_OF_PAGE with a CL_DD_DOCUMENT, raised by list_processing_events( ), displayed in a splitter pane. SALV: set_top_of_list( ) with CL_SALV_FORM_LAYOUT_GRID.

Can CL_SALV_TABLE be editable, and what are its limits?

No supported edit mode – use CL_GUI_ALV_GRID. Other limits (SAP Help): 90 columns, 128 characters per column, 9 sort / subtotal levels, flat tables only, no background mode in a container. It can colour rows and cells, show traffic lights, hotspots and buttons.

Why ALV with IDA, and why still SAP GUI ALV in S/4HANA?

IDA reads only the visible rows and lets HANA sort, filter and total – no internal table, so millions of rows display fast (ABAP on HANA › 04). New end-user apps should be Fiori elements on CDS + RAP; SAP GUI ALV stays fine for back-office and brownfield reports in classic ABAP (on-premise, private cloud), using CL_SALV_TABLE / IDA instead of REUSE FMs.

Which ALV can you use in ABAP Cloud?

None. REUSE FMs, CL_GUI_ALV_GRID, CL_SALV_TABLE and CL_SALV_GUI_TABLE_IDA are classic ABAP only: ABAP for Cloud Development has no SAP GUI, no dynpros or lists, no executable programs and only released APIs. A list for the user is a Fiori elements list report on a CDS view entity with @UI annotations, exposed by a service definition and an OData V4 UI service binding; changes go through a RAP business object.

How do you show a table or CDS view with ALV with IDA?

cl_salv_gui_table_ida=>create( iv_table_name = 'SFLIGHT' )->fullscreen( )->display( ) for a table or DDIC view, create_for_cds_view( iv_cds_view_name = … ) for a CDS view (set_view_parameters( ) for CDS parameters). Select-options become named ranges via CL_SALV_RANGE_TAB_COLLECTOR and set_select_options( ), so filtering runs in the database. It is display-only and runs in dialog only.

How would you rebuild a classic ALV report the clean-core way?

SELECT → CDS view entity on released views; selection screen → filter bar (@UI.selectionField); field catalog → @UI.lineItem; layouts, sorting and export are built into the list report; authority check → CDS access control; editable grid → RAP BO. If the list needs ABAP logic, use a custom entity with a query provider class (Clean Core › 02 Clean-Core Report).