ERPClimb logoERPClimb
SmartForms
ABAP Developmentintermediate 10 min read

Smart Forms Part 3: Output Determination and the Print Program Entry

Preview · a free account unlocks the full lesson

Key takeaway

Connect a Smart Form to SD/MM output control: output types in NACE, processing routines (program, FORM ENTRY, form name in TNAPR), condition records, NAST fields in the driver, return codes, reprocessing with VF31/RSNAST00, and debugging output issues.

In this lessonShow sections

Visual overview

Smart Forms Part 3: Output Determination and the Print Program Entry — learning sheetFlow: NACE: display RD00 processing routines and note program, FORM routine and form → Create a copy of the output type in a sandbox with your driver ZSD_INVOICE_PRINT → Preview the invoice from VF03 and debug FORM ENTRY. Key ideas: OUTPUT TYPE CONFIGURATION (NACE); DRIVER INTERFACE FOR OUTPUT CONTROL; OUTPUT OPTIONS FROM NAST; ERROR HANDLING. Watch out: Always use NAST-OBJKY and the form name from TNAPR in the driver — never hard-code document numbers or form names.ERPClimb.com / ABAP / LESSON 3/8 / LEARNING SHEETSmart Forms Part 3: Output Determination and the PrintProgram Entry1 · HOW IT FLOWS1NACEdisplay RD00 processing routinesand note program, FORM routine and…2Create a copy of theoutput type in a sandboxwith your driver…3Preview the invoice fromVF03 and debug FORM ENTRY2 · KEY IDEAS EXPLAINEDOutput Type Configuration (Nace)Application (V3 billing, V1 sales, V2 shipping, EFpurchasing) → output type (RD00, BA00, LD00, NEU).Processing routines: medium 1 (print), programZSD_INVOICE_PRINT, FORM routine ENTRY, Smart FormZSF_INVOICE.Driver Interface For Output ControlFORM entry USING return_code us_screen.NAST global (TABLES nast): OBJKY (document), SPRAS(language), LDEST (printer), ANZAL (copies),TDIMMED etc.Output Options From NastMap NAST-LDEST → TDDEST, NAST-ANZAL → TDCOPIES,NAST-DIMME → TDIMMED, NAST-DELET → TDDELETE;preview when us_screen = 'X'.Error HandlingSet return_code = 0 on success, 1 on error.Write messages to the processing log withNAST_PROTOCOL_UPDATE so users see them in theoutput log.3 · REMEMBER · WATCH OUTRememberIn output control, the output type (e.g. RD00 invoice) has aprocessing routine: program, FORM routine (ENTRY) and Smart Form name…The driver's FORM ENTRY USING return_code us_screen receives theoutput record in NAST (document number in NAST-OBJKY, language…RETURN_CODE = 0 marks the output as processed successfully; non-zeromarks it as failed (visible in the document's output log).!Watch outAlways use NAST-OBJKY and the formname from TNAPR in the driver —never hard-code document numbers orform names.4 · IN A REAL PROJECTInvoices printed in English for French customers. The driver called the form with the logon language of thebatch user instead of NAST-SPRAS, and the output type's language was ignored. Setting CONTROL_PARAMETERS-LANGUfrom NAST-SPRAS and maintaining the French translation of the form fixed it. The team also added…Original ERPClimb learning sheet • Verify against your SAP release and edition

Explanation

Part 2 of this series printed a form directly from a report; in SD and MM, printing instead gets triggered through output control, which calls your driver program.

In output control (configured in NACE), an application — V3 for billing, V1 for sales, V2 for shipping, EF for purchasing — is linked to an output type such as RD00, BA00, LD00, or NEU.

That output type carries processing routines: a medium (1 for print), a program such as ZSD_INVOICE_PRINT, a FORM routine named ENTRY, and a Smart Form name such as ZSF_INVOICE.

Condition records — maintained in VV31 for billing — decide when the output is proposed in the first place, and a dispatch time (for example, 4 for immediately, or 1 to go through the RSNAST00 job) decides when it actually runs.

All of this processing-routine information, including the output type's assigned program, FORM, and Smart Form, is stored in table TNAPR.

The driver interface that output control calls looks like FORM entry USING return_code us_screen. It receives the output record through the global NAST structure (declared with TABLES nast), which carries OBJKY (the document number), SPRAS (language), LDEST (printer), ANZAL (copies), TDIMMED, and more. TNAPR is a global structure that output control fills for you, and its SFORM field holds the Smart Form name. The us_screen parameter is set to 'X' when the driver is called for a print preview.

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.