Debugging Part 10: Production Debugging — Evidence First
Lessons are open to try during our launch period. Some advanced content may move to Pro later. AI practice limits apply separately.
Handle production issues safely: evidence collection without debugging, read-only analysis tools (ST22, SM37, SLG1, SM13, ST05, STAD, SAT), when debugging in production is justified, risks (locks, changed values, commits), approvals and firefighter access, and closing incidents with root cause and prevention.
In this lessonShow sectionsHide sections
Visual overview
Expert visual walkthrough
Production Debugging — Evidence First
Debugging · Chapter-specific technical teaching map
Integration path
Collect evidence
Trace + logs
Reproduce off-prod
Transport fix
Tutor's chapter takeaway
Handle production issues safely: evidence collection without debugging, read-only analysis tools (ST22, SM37, SLG1, SM13, ST05, STAD, SAT), when debugging in production is justified, risks (locks, changed values, commits), approvals and firefighter access, and closing…
In a real project
During month-end, invoices for one company code failed. A developer debugged production and changed a variable to "test a fix"; the document posted with a wrong account and had to be reversed by finance, extending the close…
Watch out for
• Debugging production as the first step. • Changing values or jumping statements in production. • Holding locks during long debug sessions. • No documentation or approval. • Closing incidents without prevention.
The situation: a real project scenario
During month-end, invoices for one company code failed. A developer debugged production and changed a variable to "test a fix"; the document posted with a wrong account and had to be reversed by finance, extending the close.
The post-mortem introduced a rule: evidence and QA reproduction first, firefighter access only for read-only debugging, and change documents plus SLG1 as standard evidence. The original issue was a missing account determination entry found from the application log.
Explanation
Parts 1 through 9 taught individual debugging techniques; this final lesson applies them in the one setting where mistakes cost the most: production.
The right first move in production is to collect evidence using read-only tools: ST22 for dumps, SM37 for job logs, SLG1 for application logs, SM13 for update errors, SM21 for the system log, STAD for performance history, WE02/BD87 for IDocs, and SE16N for a straightforward display of table data.
Reproduce the issue in QA with production-like data whenever possible, since most issues can genuinely be solved there without ever touching production directly. If debugging production is truly unavoidable, it should happen through approved access, such as a firefighter ID, stay strictly read-only with no value changes, avoid stepping through COMMIT paths, and be kept as short as possible.
The debugger running in production can hold locks and database cursors open, blocking other users, and if values get changed along the way, it can leave documents in an inconsistent state — which is exactly why many companies log and audit every production debugging session.
Gathering evidence without debugging starts with the basics: the error message's ID and number, the user, the time, and the transaction involved, taken either from the user directly or from STAD. From there, look at dumps in ST22, job logs in SM37, application logs in SLG1, update errors in SM13, and the system log in SM21.
Check the actual data state too, through a plain SE16N display, change documents (CDHDR/CDPOS), or the document flow. For performance issues, STAD and a controlled, short ST05 trace window can tell you a lot without any debugging at all.
To reproduce the issue outside production, copy the relevant data into QA, or work from a recent system copy if one exists. It's worth checking whether QA actually has the same customizing and transport level as production — compare using SE38's version management or the transport logs if there's any doubt.
Production debugging is only justified when the issue genuinely depends on production-only data or state, and the read-only tools above have been exhausted — and even then, only with proper approval, a tightly limited scope, and a second person informed of what you're doing.
While actually debugging in production, stay strictly read-only: no changing variable values, no "Go to statement," and no skipping checks. Avoid long pauses while sitting inside a locked section or with a database cursor still open. Never debug a posting program all the way through its commit — stop before that point. And document the session properly, whether through a firefighter log or a ticket.
Closing out the incident means identifying the actual root cause — code, data, customizing, authorization, or infrastructure — fixing it through a proper transport with test evidence to back it up, and handling any necessary data correction only through approved programs. For prevention, think about monitoring, validation, ATC checks, regression tests, and writing up a knowledge article so the same issue is easier to resolve next time.
To practice: write an evidence checklist for your team's most common type of incident; practice reproducing a production issue in QA using copied data; and review your own company's firefighter or debug-approval process. With this you should be able to handle production issues by gathering evidence first and keeping risk to a minimum.
Code example
* ===== Production incident checklist =====* 1 Evidence : message ID/number, user, time, transaction (STAD), screenshots* 2 Logs : ST22, SM37, SLG1, SM13, SM21, WE02/BD87, /IWFND/ERROR_LOG* 3 Data : SE16N (display), change documents CDHDR/CDPOS, document flow* 4 Versions : transport logs, SE38 version management (what changed recently?)* 5 Reproduce : QA with copied data; debugger there* 6 Prod debug : only if needed, approved (firefighter), read-only, no commit paths* 7 Close : root cause, fix + test evidence, data correction, prevention * ===== Read-only helper: recent changes of a document (change documents) =====REPORT zprod_change_docs. PARAMETERS: p_class TYPE cdobjectcl DEFAULT 'VERKBELEG', p_objid TYPE cdobjectv OBLIGATORY. DATA: lt_cdhdr TYPE STANDARD TABLE OF cdhdr, ls_cdhdr TYPE cdhdr. START-OF-SELECTION. SELECT * FROM cdhdr INTO TABLE lt_cdhdr WHERE objectclas = p_class AND objectid = p_objid " CDHDR is the audit trail: who changed what, when ORDER BY udate DESCENDING utime DESCENDING. " newest change first - usually what you need first LOOP AT lt_cdhdr INTO ls_cdhdr. WRITE: / ls_cdhdr-udate, ls_cdhdr-utime, ls_cdhdr-username, ls_cdhdr-tcode, ls_cdhdr-changenr. ENDLOOP.Watch out
Common mistakes
- Debugging production as the first step.
- Changing values or jumping statements in production.
- Holding locks during long debug sessions.
- No documentation or approval.
- Closing incidents without prevention.
Do this
Best practices
- Evidence and read-only tools first.
- Reproduce in QA.
- Approved, read-only production debugging only.
- Document every session.
- Root cause and prevention for every incident.
In the interview
Interview angle
Questions: "How do you handle a production issue?", "Would you debug in production?", "What are the risks?"
Strong answer: evidence first (message, user, logs ST22/SM37/SLG1/SM13/SM21, STAD, data and change documents, recent transports), reproduce in QA; production debugging only when justified, approved (firefighter), read-only, no commit paths, short; risks: locks, inconsistent data, commits; close with root cause, fix, data correction, prevention.
Practice this lesson
Quick check
0 of 3 questions attempted
Question 1 of 3
What should be the first step for a production-only billing failure?
Question 2 of 3
Which action is most dangerous when debugging in production?
Question 3 of 3
What should you avoid during production debugging?
Practise this in an interview
Answer in your own words and get instant feedback, the way an interviewer would judge it.
1A production LUW committed partial data — how do you investigate and recover?
2You need to debug a live production issue affecting real customer data, but you must not risk changing any data during the investigation. What precautions and techniques would you use?
Try a related Code Lab
This published exercise covers the same SAP topic. Apply the ideas in a hands-on scenario, then return to review your answers.
Open: Update Task Breakpoint Not Triggering →See it in code
Each example starts from a requirement, shows the design, then the code step by step with a plain-language explanation of every part.
Was this lesson helpful?
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.