SAP ABAP Open SQL Interview Questions
Interviewers use open sql to test depth rather than coverage: the follow-up question is almost always "why does the system behave that way?", and that is where prepared answers usually run out.
Master Open SQL for fast, clean and HANA-friendly ABAP data access with joins, filters, aggregation, package processing and real project performance patterns.
This page carries 35 reviewed SAP ABAP open sql interview questions, each with a complete written answer and no sign-in required. The set breaks down into 3 foundational, 16 mid-level and 16 advanced questions, so you can start at the top for a first interview or skip ahead to the scenario-based items for a senior round.
If you can handle every question here without hesitating, open sql is unlikely to be what costs you an SAP ABAP interview — and the same reasoning pattern transfers to the neighbouring topics linked at the bottom of this page.
35 Open SQL questions with answers
2. Write an Open SQL SELECT INTO TABLE statement that fetches material master header data from MARA for a list of materials. Include proper field selection, WHERE clause, and no-data handling.
3. A monthly billing report selects every invoice and filters in ABAP. What is the fix?
4. Explain the GROUP BY and HAVING clauses in Open SQL. Provide an example that counts orders by customer and filters for customers with > 10 orders.
5. Explain the difference between SELECT SINGLE and SELECT ... UP TO 1 ROWS in Open SQL. When would you use each, and what are the performance and determinism implications?
6. A SELECT statement returns duplicate rows due to a JOIN with a table that has multiple matches. How would you identify this issue and resolve it?
7. Explain aggregate functions in Open SQL (SUM, COUNT, AVG, MAX, MIN) and how they work with GROUP BY. Include how to handle NULL values.
8. A SELECT query returns results, but you notice unexpected NULL values in certain fields. How would you handle NULL values in Open SQL, and what are the implications for business logic?
9. You notice that a SELECT statement with an IN operator and a large list (5000 values) is slow. Explain the performance issue and propose alternatives.
10. Your SELECT statement uses FOR ALL ENTRIES but the driver table is sometimes empty during execution. How does this affect the query result, and how would you code defensively?
11. Describe how client handling (MANDT) works in Open SQL. When is client filtering automatic, and when must it be handled explicitly?
12. After executing a SELECT statement in Open SQL, your SY-SUBRC is 0 but the result set is logically empty (e.g., all rows filtered out in your application logic). How does this differ from a true database 'no rows found' scenario, and what debugging approach would you take?
13. A legacy finance report reads all line items and sums them in ABAP. What do you change?
14. Which classic SQL habits hurt most after moving to SAP HANA, and how do you fix them?
15. A sales report joins header, items and partners, and totals are too high. What is the likely cause?
16. A program uses SELECT SINGLE by customer to find "the latest" order. What is wrong?
17. What are the rules for using FOR ALL ENTRIES safely?
18. A slow report was blamed on ALV rendering. How do you prove where the time goes?
19. A finance extraction selects all BKPF fields for every document. How would you improve it?
20. A SELECT statement into an internal table takes 30 seconds. After analyzing the code, you realize the WHERE clause doesn't use any indexed fields, and a full table scan is occurring. How would you refactor this, and what tools would you use to verify improvement?
21. Design a robust error handling and monitoring strategy for a production Open SQL batch job that processes 10 million rows. Include recovery, logging, and performance tracking.
22. Compare CDS Views vs. Open SQL for data retrieval in SAP S/4HANA. When would you recommend each approach?
23. You are tasked with fetching 500,000 sales orders and their line items for a month-end batch. Describe your approach to avoid memory issues and database timeouts, including PACKAGE SIZE, batching, and commit strategy.
24. You are debugging a SELECT query using ST05 (SQL Trace). Walk through the key metrics you would examine to diagnose performance issues and identify the root cause.
25. Explain the relationship between index field order and WHERE-clause selectivity in Open SQL. Does the written order of conditions in the WHERE clause matter?
26. You are designing a high-performance batch job to export 2 million sales orders to a data warehouse. Walk through your Open SQL strategy, including PACKAGE SIZE, indexing, and monitoring.
27. A performance report queries sales data across 10 SAP tables. Explain your approach to optimize this using Open SQL, including when you would consider a CDS View or materialized aggregates.
28. Explain the concept of database pushdown in S/4HANA and how it influences your Open SQL design decisions.
29. A report uses multiple SELECT statements inside a loop, fetching related data for each order. Redesign this using a single query with JOINs and explain the performance benefit.
30. A production system is experiencing slow response times. You suspect a SELECT inside a LOOP is the culprit. Describe the anti-pattern, its performance impact, and provide a refactored solution.
31. A monthly report processes sales orders but runs for 8 hours, causing a production backup. Using ST05, you identify that the query scans 50 million rows but returns only 10,000. Propose and implement a solution.
32. A report queries purchase orders from multiple vendors. You have a list of 800 vendor IDs and need to fetch orders for all of them efficiently. Compare FOR ALL ENTRIES vs. JOIN approaches and recommend based on your experience.
33. A migration report loads millions of accounting rows at once and dumps. How do you redesign it?
34. An OData service reuses SQL from an internal report. What must you check?
35. A background job frequently fails with cursor-related dumps or lock-timeout symptoms during large Open SQL processing. How would you diagnose and redesign it safely?
Related lesson
Open SQL Part 9: HANA-Friendly SQL and Code PushdownRelated topics
Next practice step
Go deeper on this topic
- Open SQL — lessons, mock tests and code lab
- ABAP Core
- Internal Tables
- Modularization
- OOP ABAP
- ALV Reports
- Enhancements
- SAP ABAP Debugging Interview Questions
- SAP ABAP ABAP Core interview questions
- SAP ABAP Workflow interview questions
- SAP ABAP Adobe Forms interview questions
- SAP ABAP ALV Reports interview questions
- SAP ABAP BAPI interview questions