Q1
Why does FOR ALL ENTRIES IN fail silently and return every row from the database table if the driver internal table is empty?
In Open SQL, when the driver internal table in FOR ALL ENTRIES IN itab is empty, the WHERE condition evaluates as unrestricted and selects the entire target table. Always wrap it in IF itab IS NOT INITIAL, sort the driver table by join keys, and DELETE ADJACENT DUPLICATES beforehand to prevent duplicate rows and full-table scans.
Q2
What subtle bug occurs if you forget that FOR ALL ENTRIES IN automatically removes duplicate rows in the result set?
FOR ALL ENTRIES IN implicitly behaves like SELECT DISTINCT across the selected fields. If you omit primary key fields from the SELECT list (such as item number POSNR or line sequence), distinct business rows with identical non-key field values get silently collapsed. Always include all primary key fields in the projection.
Q3
When would you use a Hashed Table instead of a Sorted Table inside high-volume ABAP reports?
Use a HASHED TABLE for single-key exact lookups (READ TABLE ... WITH TABLE KEY) where O(1) constant time stays flat even at 500k+ rows. Use a SORTED TABLE when you need range loops (LOOP AT itab WHERE key BETWEEN ...) or non-unique secondary access paths.
Q4
How do Implicit Enhancement Points differ from explicit BAdIs during an S/4HANA upgrade?
Explicit BAdIs follow a SAP-guaranteed interface contract and rarely break across support packs. Implicit Enhancement Options exist at the start/end of standard routines/methods; because SAP can refactor internal variables or split subroutines during upgrades, you must run SPAU_ENH carefully and avoid modifying undocumented SAP globals.
Q5
Why should you prefer Field Symbols (<fs>) over Work Areas inside nested LOOP AT statements?
Looping INTO wa copies the entire row structure on every iteration and requires an explicit MODIFY back to the internal table. ASSIGNING <fs> points directly to the memory address in the table—eliminating structure copy overhead and avoiding stale work-area bugs on updates.
Q6
What happens during a LUW if you call COMMIT WORK inside a User Exit or BAdI executed in update task?
Calling COMMIT WORK inside an update module, BAdI, or User Exit corrupts SAP's Logical Unit of Work, triggers premature database commits before validation finishes, or causes runtime dump COMMIT_IN_POSTING. Persistence should always remain with the caller or via BAPI_TRANSACTION_COMMIT at orchestration level.
Q7
In ABAP CDS Views, why can combining @Analytics.dataCategory and association path expressions cause Cartesian inflation?
Exposing a to-many (0..*) association without specifying cardinality or filtering triggers an outer join expansion on every access path used in the projection list, inflating aggregated sums. Explicitly declare [1..1] or [0..1] where valid and push aggregations inside dedicated lower-layer CDS views.
Q8
How does Secondary Database Connection (CONNECTION) behave differently from RFC async calls regarding rollback?
A secondary DB connection opens an independent transaction context separate from the primary SAP LUW. A rollback on the primary work process does NOT automatically roll back uncommitted writes already committed on the secondary connection—requiring explicit compensating logic.
Q9
Why does SELECT SINGLE without specifying the full primary key generate a Code Inspector warning?
Without all key fields, SELECT SINGLE returns an arbitrary first row matching the partial condition, making results non-deterministic across DB optimizers or table reorganizations. Use SELECT ... UP TO 1 ROWS with an ORDER BY when only partial keys are known.
Q10
When debugging an IDoc failure in production, why might status 51 not show the actual BAPI error inside WE02?
Custom inbound function modules sometimes overwrite IDOC_STATUS with a generic wrapper message or raise an unhandled exception before populating BAPIRET2. Tracing via WE19 in foreground debugging or checking the CALL TRANSACTION ... MODE 'E' BDC log reveals the exact screen/field rejection.