Smart Forms Part 8: Debugging Smart Forms and Generated Function Modules
Debug Smart Form problems systematically: driver vs form, finding the generated function module, breakpoints in program lines and initialization, output control errors, missing or wrong data, layout issues, spool and PDF checks, and CONVERT OTF for PDF output.
Explanation
📌 KEY POINTS
✅ Split the problem: data missing (driver/interface), data wrong (driver logic), layout wrong (form nodes/windows), nothing printed (output control/spool).
✅ Breakpoints: in the driver before the form call, and in program-lines/initialization nodes (BREAK-POINT or session breakpoint via the generated FM).
✅ The generated FM (/1BCDWB/SF…) is found via SSF_FUNCTION_MODULE_NAME or form → Environment → Function module name.
⚠️ Never leave hard BREAK-POINT statements in forms — they stop output processing for all users; use checkpoint groups or session breakpoints.
━━━━━━━━━━━━━━━━━━━━
▶ WHERE WE ARE
Parts 1–7 built the form. This lesson is the troubleshooting toolkit.
━━━━━━━━━━━━━━━━━━━━
▶ 1. NOTHING PRINTED
- Document output log (Extras → Output → Processing log) — messages from NAST_PROTOCOL_UPDATE.
- Output status: not processed (dispatch time 1 → RSNAST00 job?), error, or processed.
- SP01: spool exists? Printer status in SPAD; SM37 for output jobs.
━━━━━━━━━━━━━━━━━━━━
▶ 2. DATA MISSING OR WRONG
- Breakpoint before CALL FUNCTION lv_fm in the driver; check interface structures.
- If correct there, problem is in the form: conditions suppressing nodes, wrong work area in loops, reference fields.
━━━━━━━━━━━━━━━━━━━━
▶ 3. DEBUGGING INSIDE THE FORM
- Add a program-lines node with BREAK-POINT ID zsf_debug (checkpoint group, activate in SAAB).
- Or open the generated FM in SE37, search for the node's code and set a session breakpoint.
- Check SFSY fields (page, formpages) and global variables.
━━━━━━━━━━━━━━━━━━━━
▶ 4. LAYOUT ISSUES
- Text overflow: window/cell too small; check paragraph formats in the Smart Style.
- Columns shifted: line type widths.
- Page problems: next page settings, main window widths (Part 5).
- Use print preview and "Form check" (Ctrl+F2) in SMARTFORMS.
━━━━━━━━━━━━━━━━━━━━
▶ 5. PDF AND EMAIL
- GETOTF = 'X' → JOB_OUTPUT_INFO-OTFDATA → CONVERT_OTF (format PDF) → attach to email (CL_BCS).
- Check the PDF by downloading it (GUI_DOWNLOAD) in tests.
━━━━━━━━━━━━━━━━━━━━
▶ 6. AFTER CHANGES
Activate the form (regenerates the FM), transport form and style together; test all output types and languages.
━━━━━━━━━━━━━━━━━━━━
▶ STEP BY STEP
- Find the generated FM of your form and set a breakpoint in its initialization code.
- Insert a checkpoint-group breakpoint in a program-lines node and activate it in SAAB.
- Generate a PDF with GETOTF and CONVERT_OTF (code example).
✅ CHECKPOINT: you can locate Smart Form problems quickly and produce PDFs for verification.
Code example
* ===== Generate PDF from a Smart Form (verification / email) =====REPORT zsf_to_pdf. DATA: lv_fm TYPE rs38l_fnam, ls_control TYPE ssfctrlop, ls_output TYPE ssfcompop, ls_jobinfo TYPE ssfcrescl, lt_otf TYPE STANDARD TABLE OF itcoo, lt_lines TYPE STANDARD TABLE OF tline, lv_size TYPE i, lv_pdf TYPE xstring, ls_header TYPE zsf_inv_header, lt_items TYPE ztt_inv_items. START-OF-SELECTION. CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' EXPORTING formname = 'ZSF_INVOICE' IMPORTING fm_name = lv_fm EXCEPTIONS OTHERS = 1. CHECK sy-subrc = 0. * ===== Return OTF instead of printing ===== ls_control-no_dialog = 'X'. ls_control-getotf = 'X'. ls_output-tddest = 'LP01'. CALL FUNCTION lv_fm EXPORTING control_parameters = ls_control output_options = ls_output is_header = ls_header it_items = lt_items IMPORTING job_output_info = ls_jobinfo EXCEPTIONS OTHERS = 1. CHECK sy-subrc = 0. lt_otf = ls_jobinfo-otfdata. * ===== OTF -> PDF ===== CALL FUNCTION 'CONVERT_OTF' EXPORTING format = 'PDF' IMPORTING bin_filesize = lv_size bin_file = lv_pdf TABLES otf = lt_otf lines = lt_lines EXCEPTIONS OTHERS = 1. IF sy-subrc = 0. WRITE: / 'PDF size in bytes:', lv_size. ENDIF. * ===== Diagnostic breakpoint inside a program-lines node =====* BREAK-POINT ID zsf_debug. " inactive unless activated in SAAB * ===== Debugging checklist =====* Nothing printed : output log, RSNAST00, SP01, SPAD, SM37* Data wrong : breakpoint before CALL FUNCTION lv_fm* Layout wrong : conditions, line types, windows, Smart Style, form check (Ctrl+F2)Real project scenario
Users reported that discounts were missing on some printed invoices. Debugging the driver showed correct discount lines in IT_ITEMS; the problem was a condition on the table row that suppressed lines with negative amounts, added years earlier for a different purpose.
The team removed the condition, added a regression check with sample invoices (PDF comparison), and replaced a forgotten hard BREAK-POINT in another form with a checkpoint group.
Common mistakes
- Hard BREAK-POINT statements in forms.
- Debugging the form when the driver passes wrong data.
- Ignoring the output processing log.
- Not activating the form after changes.
- Transporting the form without its style/text modules.
Best practices
- Classify: nothing printed / data / layout.
- Breakpoint before the form call first.
- Checkpoint groups for diagnostic breakpoints.
- PDF output for regression comparisons.
- Transport form, style and text modules together.
Interview angle
Questions: "How do you debug a Smart Form?", "How do you find the generated FM?", "How do you convert a Smart Form to PDF?"
Strong answer: classify issue; breakpoint in driver before the call; in form via checkpoint-group BREAK-POINT in program lines or session breakpoint in the generated FM (SSF_FUNCTION_MODULE_NAME / Environment); check output log, RSNAST00, SP01; layout via conditions, line types, form check; PDF via GETOTF + CONVERT_OTF.
Practice this lesson
Quick check
1. How do you get PDF data from a Smart Form call?
2. A field is filled in the driver's structure before the form call but blank in the output. Where is the problem?
3. A field is blank in the output. What should be checked first?
Interview questions
1. Form prints blank pages. What do you check?
Answer it in your own words first, then compare.
2. An invoice shows a blank tax registration field. How do you find whether the problem is in the driver or in the form?
Answer it in your own words first, then compare.
Reference-verified: the steps are checked against official SAP documentation and tutorials, and object and field names in the sample code are checked for consistency. The code has not been compiled or run on an SAP system by ERPClimb. Syntax marked release-dependent varies by SAP release, so check it in your own system.
More lessons in this topic
- Smart Forms Part 1: What Smart Forms Are and How Printing Works
- Smart Forms Part 2: Anatomy of a Smart Form and the Driver Program
- Smart Forms Part 3: Output Determination and the Print Program Entry
- Smart Forms Part 4: Form Interface — Import Parameters, Tables and Global Data
- Smart Forms Part 5: Pages, Windows and Main Window Flow
- Smart Forms Part 6: Tables, Templates, Loops and Conditions
- Smart Forms Part 7: Texts, Translations and Language Handling