Debugging in ABAP Cloud is different from Classic ABAP. This guide shows you the new tools and techniques.
What’s Different in ABAP Cloud?
No Longer Available
/hdebugger command- SAP GUI Debugger (SE38, SE80)
BREAK-POINTstatement- Dynpro debugging
- Direct DB access in debugger
New Tools
- ADT Debugger (Eclipse)
- ABAP Console (
cl_demo_output) - Feed Reader (Background Jobs)
- Application Log (BAL)
- SQL Trace (Performance)
1. ADT Debugger (Main Tool)
Starting the Debugger
Method 1: Set breakpoint
- In ADT: Double-click on line number → Breakpoint (blue dot)
- Run program (F9 or Preview)
- Debugger stops at breakpoint
Method 2: Run As → ABAP Application (Debug)
- Right-click on class/program
Debug As→ABAP Application
Debugger Layout
┌─────────────────────────────────┐│ Code (current line marked) │├─────────────────────────────────┤│ Variables (variable values) │├─────────────────────────────────┤│ Breakpoints (all breakpoints) │├─────────────────────────────────┤│ Call Stack (call history) │└─────────────────────────────────┘Key Shortcuts
| Shortcut | Action |
|---|---|
F5 | Step Into (jump into method) |
F6 | Step Over (execute line) |
F7 | Step Return (return from method) |
F8 | Resume (to next breakpoint) |
Ctrl+Shift+B | Toggle Breakpoint |
Ctrl+Alt+B | Show all breakpoints |
Inspecting Variables
METHOD calculate. DATA(lv_a) = 5. DATA(lv_b) = 3. DATA(lv_result) = lv_a + lv_b. " Breakpoint here
" In Variables tab: " lv_a = 5 " lv_b = 3 " lv_result = 8ENDMETHOD.Changing variables:
- Right-click on variable →
Change Value - Enter new value
- Continue debugging with changed value
Watchpoints
Stops when variable changes:
- Right-click on variable →
Toggle Watchpoint - Debugger stops on every change
Conditional Breakpoints
Only stop when condition is met:
- Right-click on breakpoint →
Breakpoint Properties - Condition:
lv_id = '12345' - Only stops when
lv_idhas this value
2. ABAP Console (Output During Development)
Instead of WRITE or debug outputs:
METHOD process_data. " Simple output cl_demo_output=>display( 'Starting processing' ).
" Output variable cl_demo_output=>write( |Customer ID: { lv_customer_id }| ).
" Output table cl_demo_output=>write( lt_customers ).
" Final output cl_demo_output=>display( ).ENDMETHOD.Output:
- Appears in Console tab in ADT
- Only use in development!
- In production: Use Application Log
Advantages:
- Faster than debugger
- For complex data structures
- Stays in log (scrollable)
3. Logging with Application Log
For production code:
METHOD process_order. TRY. " Create log DATA(lo_log) = cl_bali_log=>create_with_header( header = cl_bali_header_setter=>create( object = 'ZORDERS' subobject = 'PROCESS' external_id = |Order { iv_order_id }| ) ).
" Info message lo_log->add_item( item = cl_bali_free_text_setter=>create( severity = if_bali_constants=>c_severity_information text = |Processing order { iv_order_id }| ) ).
" Processing...
" Success message lo_log->add_item( item = cl_bali_free_text_setter=>create( severity = if_bali_constants=>c_severity_status text = 'Order processed successfully' ) ).
" Save log cl_bali_log_db=>get_instance( )->save_log( log = lo_log ).
CATCH cx_bali_runtime INTO DATA(lx_error). " Error handling ENDTRY.ENDMETHOD.View log:
- Transaction
SLG1(Classic) - Fiori App: “Application Logs”
Severity levels:
c_severity_error- Error (red)c_severity_warning- Warning (yellow)c_severity_information- Info (blue)c_severity_status- Status (green)
4. SQL Trace (Performance Debugging)
Problem: Find slow SELECT statements
Activate SQL Trace
In ADT:
Run→Run Configurations- Tab
Trace Requests - Enable
SQL Trace - Run program
Analyze Trace
SQL Console opens:
SELECT * FROM kna1 Duration: 1.2s ❌ SLOW! Rows: 1,000,000
SELECT name1 FROM kna1 WHERE kunnr = '12345' Duration: 0.001s ✅ Fast Rows: 1Optimization:
- ❌ Avoid
SELECT * - ❌
FOR ALL ENTRIESwith empty table - ✅ Explicit fields
- ✅ WHERE on indexed fields
5. Feed Reader (Background Jobs)
Problem: Debug background jobs
Setup
- Start job (Fiori App / SM37)
- In ADT:
Window→Show View→Feed Reader - Enter Feed URL:
https://<system>/sap/bc/adt/runtime/traces/abaplogs
Output
Feed Reader shows:
- Console outputs
- Application Logs
- Runtime errors
Live updates while job runs!
6. Debugging Strategies Without Debugger
Strategy 1: Unit Tests
Instead of debugging: Write tests
METHOD test_calculate_discount. " Given DATA(lv_amount) = 1000.
" When DATA(lv_discount) = zcl_pricing=>calculate_discount( lv_amount ).
" Then cl_abap_unit_assert=>assert_equals( act = lv_discount exp = 100 msg = |Expected 100, got { lv_discount }| " Debug info! ).ENDMETHOD.Advantage: Reproducible, automated
Strategy 2: Defensive Assertions
METHOD process_order. " Check precondition ASSERT iv_order_id IS NOT INITIAL.
" Business logic DATA(lv_customer) = get_customer( iv_order_id ).
" Check postcondition ASSERT lv_customer IS BOUND.ENDMETHOD.In production: ASSERT is ignored (only active in debug mode)
Better for production: Exceptions
IF lv_customer IS NOT BOUND. RAISE EXCEPTION TYPE zcx_customer_not_found.ENDIF.Strategy 3: Logging Framework
Custom logging wrapper:
CLASS zcl_logger DEFINITION. PUBLIC SECTION. CLASS-METHODS log IMPORTING iv_level TYPE string DEFAULT 'INFO' iv_text TYPE string.ENDCLASS.
CLASS zcl_logger IMPLEMENTATION. METHOD log. " In Dev: Console IF sy-sysid = 'DEV'. cl_demo_output=>write( |[{ iv_level }] { iv_text }| ). ELSE. " In Prod: Application Log " ... BAL code ... ENDIF. ENDMETHOD.ENDCLASS.
" Usagezcl_logger=>log( iv_level = 'DEBUG' iv_text = |Processing customer { lv_id }| ).7. Common Debug Scenarios
Scenario 1: Exception in RAP
Problem: Validation fails, but why?
METHOD validateIsbn. READ ENTITIES OF zi_book IN LOCAL MODE ENTITY Book FIELDS ( Isbn ) WITH CORRESPONDING #( keys ) RESULT DATA(lt_books).
LOOP AT lt_books INTO DATA(ls_book). " Debug output cl_demo_output=>write( |Checking ISBN: { ls_book-Isbn }| ).
IF strlen( ls_book-Isbn ) <> 13. cl_demo_output=>write( 'ISBN invalid - length mismatch' ).
APPEND VALUE #( ... ) TO reported-book. ENDIF. ENDLOOP.
cl_demo_output=>display( ).ENDMETHOD.Scenario 2: CDS View Returns Wrong Data
Strategy:
- SQL Console: Query CDS View directly
- Data Preview: In ADT right-click on view →
Open With→Data Preview - Check source tables: Is raw data correct?
Scenario 3: Performance Problem
Approach:
- Activate SQL Trace
- Identify slow SELECTs
- ABAP Console: Log timestamps
DATA(lv_start) = cl_abap_context_info=>get_system_time( ).
" Slow operationSELECT ... INTO TABLE lt_data.
DATA(lv_end) = cl_abap_context_info=>get_system_time( ).cl_demo_output=>write( |Duration: { lv_end - lv_start } µs| ).8. Debugging Best Practices
DO
- Set breakpoints sparingly (not 50 of them!)
- Conditional breakpoints for large datasets
- Unit tests instead of live debugging
- Logging in production code
- SQL Trace for performance
DON’T
- Debug production (only as last resort!)
- Leave
BREAK-POINTin code - Console output in production
- Use debugger as only tool
9. Tools Overview
| Tool | Use Case | Where available? |
|---|---|---|
| ADT Debugger | Interactive debugging | ADT/Eclipse |
| ABAP Console | Quick outputs | ADT (Dev only) |
| Application Log | Production logging | All systems |
| SQL Trace | Performance analysis | ADT |
| Feed Reader | Background job logs | ADT |
| Data Preview | Check CDS View data | ADT |
Summary
ABAP Cloud Debugging Workflow:
1. Write unit tests ↓ (if test fails)2. Use ADT Debugger ↓ (performance problem?)3. Activate SQL Trace ↓ (production?)4. Analyze Application LogMindset shift:
- Classic ABAP: Debugger-First
- ABAP Cloud: Test-First, Logging, then Debugger
See also:
- ABAP Unit Testing
- ABAP Cloud Performance Optimization
- RAP Tutorial Part 3: Best Practices
Happy Debugging!