ERPClimb logoERPClimb
SmartForms
ABAP Developmentbeginner 9 min read

Smart Forms Part 2: Anatomy of a Smart Form and the Driver Program

Preview · a free account unlocks the full lesson

Key takeaway

Build a complete driver program for a Smart Form: selection screen, data retrieval into interface structures, SSF FUNCTION MODULE NAME, control parameters (preview, no dialog, getotf), output options, printing multiple documents in one spool with SSF OPEN/SSF CLOSE, and checking job output info.

In this lessonShow sections

Visual overview

Smart Forms Part 2: Anatomy of a Smart Form and the Driver Program — learning sheetFlow: Build the driver from the code example for your own form → Print 3 documents and check SP01: one spool with 3 documents → Remove SSF_OPEN/SSF_CLOSE and compare the number of spools. Key ideas: ANATOMY OF THE FORM (SMARTFORMS); DRIVER RESPONSIBILITIES; MULTIPLE DOCUMENTS IN ONE SPOOL; BACKGROUND AND NO DIALOG. Watch out: Calling the form once per document without NO_OPEN/NO_CLOSE creates one spool per document — thousands of spools in mass printing.ERPClimb.com / ABAP / LESSON 2/8 / LEARNING SHEETSmart Forms Part 2: Anatomy of a Smart Form and the DriverProgram1 · HOW IT FLOWS1Build the driver from thecode example for your ownform2Print 3 documents andcheck SP01: one spoolwith 3 documents3Remove SSF_OPEN/SSF_CLOSEand compare the number ofspools2 · KEY IDEAS EXPLAINEDAnatomy Of The Form (Smartforms)Global settings: form attributes (style,language), form interface, global definitions(data, types, initialization).Pages and windows: first page, next page, mainwindow, secondary windows (header, footer,address).Driver Responsibilities1. Selection screen (document numbers, printer,preview flag).Multiple Documents In One SpoolSSF_OPEN before the loop; each call with NO_OPEN ='X' and NO_CLOSE = 'X'; SSF_CLOSE after the loop.Alternative: first call NO_CLOSE = 'X', middlecalls NO_OPEN/NO_CLOSE, last call NO_OPEN only.Background And No DialogNO_DIALOG = 'X' suppresses the print dialog(required in background, output control).In background, a printer (TDDEST) must be given.3 · REMEMBER · WATCH OUTRememberThe driver program owns: selection, data retrieval, determining theFM, output options and error handling.Control parameters (SSFCTRLOP): PREVIEW, NO_DIALOG, GETOTF (return OTFinstead of printing), NO_OPEN/NO_CLOSE (several forms in one spool).Output options (SSFCOMPOP): TDDEST (printer), TDIMMED (printimmediately), TDNEWID (new spool), TDCOPIES.!Watch outCalling the form once per documentwithout NO_OPEN/NO_CLOSE creates onespool per document — thousands ofspools in mass printing.4 · IN A REAL PROJECTA reprint program for 5,000 invoices created 5,000 spool requests, overwhelmed the spool system and printedevery invoice with a separate cover page on the high-speed printer. Using SSF_OPEN, NO_OPEN/NO_CLOSE andSSF_CLOSE put all invoices into one spool. Printing became one job, and the print shop could handle it in a…Original ERPClimb learning sheet • Verify against your SAP release and edition

Explanation

Part 1 showed the basic call to a Smart Form. Now we build a driver that prints many documents properly, in a single spool.

A Smart Form itself is organized around global settings — form attributes such as style and language, the form interface, and global definitions covering data, types and initialization — along with pages and windows: a first page, a next page, a main window, and secondary windows for things like the header, footer, and address block. The actual output is produced by nodes placed inside those windows.

The driver program carries a clear set of responsibilities. The driver program owns: selection, data retrieval, determining the FM, output options and error handling. In sequence, that means: a selection screen for document numbers, printer and a preview flag; reading and preparing the data into structures matching the form's interface; getting the generated function module's name with SSF_FUNCTION_MODULE_NAME; setting the control and output options; calling the function module once per document and handling its exceptions; and finally reporting the results, including spool numbers, via JOB_OUTPUT_INFO.

Free account

Create a free account to keep reading

You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.

  • Full explanation
  • Code example
  • Real project scenario
  • Common mistakes
  • Best practices
  • Interview angle

One tap with Google works too. Every topic keeps its first lesson open to everyone.

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.