Smart Forms Part 1: What Smart Forms Are and How Printing Works
Free sample lesson · open to everyone
Understand SAP Smart Forms: transaction SMARTFORMS, the generated function module, the driver (print) program, form interface, pages and windows, Smart Styles, output control, and how Smart Forms compare with SAPscript and Adobe Forms.
In this lessonShow sectionsHide sections
Visual overview
Expert visual walkthrough
What Smart Forms Are and How Printing Works
SmartForms · Chapter-specific technical teaching map
Integration path
Driver program
SSF FM
Form processing
Spool / printer
Tutor's chapter takeaway
Understand SAP Smart Forms: transaction SMARTFORMS, the generated function module, the driver (print) program, form interface, pages and windows, Smart Styles, output control, and how Smart Forms compare with SAPscript and Adobe Forms.
In a real project
A company's invoice Smart Form contained 15 SELECT statements in program-lines nodes. Printing 2,000 invoices in the nightly billing output run took hours, and every layout change risked breaking data logic. The team moved…
Watch out for
• Hard-coding the generated FM name (/1BCDWB/SF…). • SELECTs inside the form. • Using USER_SETTINGS = 'X' and ignoring passed output options. • Not handling exceptions of the form call. • Starting new forms in Smart Forms…
The situation: a real project scenario
A company's invoice Smart Form contained 15 SELECT statements in program-lines nodes. Printing 2,000 invoices in the nightly billing output run took hours, and every layout change risked breaking data logic.
The team moved all selection into the driver program, passed prepared structures via the form interface, and kept only formatting in the form. The run time dropped to minutes, and layout changes became safe for junior developers.
Explanation
A Smart Form is a form layout designed in transaction SMARTFORMS; once activated, SAP generates a function module, named something like /1BCDWB/SF..., that actually prints it. A driver program reads the business data and calls that generated function module, which you find using SSF_FUNCTION_MODULE_NAME, since its exact name differs from system to system.
The layout itself is made up of pages, windows (a main window plus any secondary windows), texts, tables, and graphics, with formatting handled through Smart Styles maintained in SMARTSTYLES.
One design rule worth following from the start: keep all data selection in the driver program, not inside the form itself — forms that contain their own SELECTs are slow, hard to test, and hard to reuse.
This series covers Smart Forms in eight parts: this lesson on what Smart Forms actually are; Part 2 on their anatomy and the driver program; Part 3 on output determination and debugging the print call; Part 4 on the form interface — import parameters, tables, and global data; Part 5 on pages, windows, and the main window's flow; Part 6 on tables, templates, and conditions; Part 7 on texts, translations, and language handling; and Part 8 on debugging Smart Forms and the generated function module.
Smart Forms show up most often for invoices, order confirmations, delivery notes, purchase orders, labels, and custom letters — mainly in ECC and S/4HANA on-premise systems that use output control through NACE.
The building blocks include the form interface, which is the set of parameters the driver passes in, such as IS_HEADER or IT_ITEMS; global definitions, covering variables, types, field symbols, and initialization code; pages and windows, the actual layout areas, where the main window flows content across as many pages as needed; nodes, which include text, table, template, loop, condition, program lines, graphic, and address elements; and the Smart Style itself, which defines paragraph and character formats.
The print flow runs like this: the driver program calls SSF_FUNCTION_MODULE_NAME to turn the form's name into the generated function module's name, then calls that function module with control parameters — printer, preview — and the actual data, which produces either a spool request (viewable in SP01) or a direct preview or PDF.
Comparing the three form technologies: SAPscript, maintained in SE71, is the oldest, is client-dependent, and uses a text-based layout, yet it's still behind many standard SAP forms. Smart Forms are graphical, client-independent, and work through a generated function module, and remain widely used throughout ECC. Adobe Forms, maintained in SFP, are PDF-based, required for many S/4HANA output scenarios and for interactive forms, and represent SAP's strategic direction for forms going forward.
To practice: display SF_EXAMPLE_01 in SMARTFORMS and look at its interface, pages, and windows; test it with F8 to see the generated function module's actual name; and run the demo driver for SF_EXAMPLE_01 in SE38 against flight data, then preview the result. With this you should know the parts that make up a Smart Form and understand the basic print flow.
Code example
* ===== Minimal Smart Form call from a driver program =====REPORT zsf_demo. PARAMETERS p_form TYPE tdsfname DEFAULT 'ZSF_INVOICE'. DATA: lv_fm TYPE rs38l_fnam, ls_control TYPE ssfctrlop, " control parameters (preview, no dialog ...) ls_output TYPE ssfcompop, " output options (printer, copies ...) ls_header TYPE zsf_inv_header, " own structure, used in the form interface lt_items TYPE ztt_inv_items. " own table type START-OF-SELECTION.* ===== Step 1: data selection in the DRIVER, not in the form ===== PERFORM get_data. " fills ls_header / lt_items (not shown) * ===== Step 2: find the generated FM (name differs per system) ===== CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' EXPORTING formname = p_form IMPORTING fm_name = lv_fm " the real callable FM, generated and renamed on each activation EXCEPTIONS no_form = 1 no_function_module = 2 OTHERS = 3. IF sy-subrc <> 0. MESSAGE 'Form not found or not active' TYPE 'E'. ENDIF. * ===== Step 3: output options ===== ls_control-preview = 'X'. " show print preview ls_output-tddest = 'LP01'. " output device * ===== Step 4: call the form ===== CALL FUNCTION lv_fm " call the generated FM, never the form name directly EXPORTING control_parameters = ls_control output_options = ls_output user_settings = space is_header = ls_header it_items = lt_items EXCEPTIONS formatting_error = 1 internal_error = 2 send_error = 3 user_canceled = 4 OTHERS = 5. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 DISPLAY LIKE 'E'. " reuses the form's own message, shown like an error ENDIF. FORM get_data.ENDFORM.Watch out
Common mistakes
- Hard-coding the generated FM name (/1BCDWB/SF…).
- SELECTs inside the form.
- Using USER_SETTINGS = 'X' and ignoring passed output options.
- Not handling exceptions of the form call.
- Starting new forms in Smart Forms when Adobe Forms is the target technology.
Do this
Best practices
- Always use SSF_FUNCTION_MODULE_NAME.
- Data in the driver, formatting in the form.
- Use Smart Styles for consistent formatting.
- Handle exceptions and spool information.
- Check the organisation's form strategy (Smart Forms vs Adobe).
In the interview
Interview angle
Questions: "What is a Smart Form?", "Why use SSF_FUNCTION_MODULE_NAME?", "Smart Forms vs SAPscript vs Adobe Forms?"
Strong answer: graphical form in SMARTFORMS generating an FM; driver program selects data and calls the FM obtained via SSF_FUNCTION_MODULE_NAME (name differs per system); interface, global definitions, pages/windows, nodes, Smart Styles; SAPscript older client-dependent, Adobe PDF-based and strategic in S/4HANA.
Practice this lesson
Quick check
0 of 3 questions attempted
Question 1 of 3
Where should an invoice Smart Form get its customer and tax data from?
Question 2 of 3
Which transaction is used to maintain SmartForms?
Question 3 of 3
Which is TRUE about SmartForms in S/4HANA?
Practise this in an interview
Answer in your own words and get instant feedback, the way an interviewer would judge it.
1What is a SmartForm in SAP ABAP?
2In S/4HANA, should new output be built in SmartForms?
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: Item Table Not Continuing to Next Page →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
Interview questions on this topic
Related SAP topics
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.