Adobe Forms Part 4: Interface and Context Design
Design the Adobe Form data contract: ABAP dictionary-based interface with import parameters, global data and initialization, the form context with nodes, conditions and deactivated fields, alternatives (conditions in context vs scripting in layout), and keeping the data sent to ADS small.
Explanation
📌 KEY POINTS
✅ Interface = what the driver passes (DDIC types); context = what of that data is sent to the layout (and to ADS as XML).
✅ Initialization code in the interface prepares presentation values (totals, formatted strings) before rendering.
✅ Context conditions decide which nodes are sent — cleaner than hiding elements with layout scripting.
⚠️ Every active context field becomes XML sent to ADS — large contexts (whole tables, unused fields) slow rendering noticeably.
━━━━━━━━━━━━━━━━━━━━
▶ WHERE WE ARE
Part 2 dragged data into a form. Now we design the contract properly.
━━━━━━━━━━━━━━━━━━━━
▶ 1. INTERFACE
- Type: ABAP dictionary-based (classic).
- Import: header structure, item table type, flags (e.g. IV_REPRINT) — DDIC types.
- Global data: values computed in initialization (totals, formatted address lines, text names).
- Initialization: declare input/output parameters of the code; no database access ideally (driver's job).
- Currency/quantity: reference fields for correct formatting.
━━━━━━━━━━━━━━━━━━━━
▶ 2. CONTEXT
- Drag the parameters you need; inside structures, deactivate unused fields.
- Node types: data (structure/table), text (text modules/include texts, Part 7), graphic, address, condition, alternative, loop (for tables).
- Conditions on nodes: e.g. show discount line only if IS_HEADER-DISCOUNT <> 0.
━━━━━━━━━━━━━━━━━━━━
▶ 3. CONDITIONS VS SCRIPTING
- Context conditions: evaluated in ABAP before rendering; the data isn't sent at all.
- Layout scripting (FormCalc/JavaScript): logic inside the PDF; harder to test and maintain.
Prefer context conditions and prepared data.
━━━━━━━━━━━━━━━━━━━━
▶ 4. SIZE AND PERFORMANCE
- Deactivate fields not used in layout.
- Avoid passing large texts or tables that are not printed.
- Prepare aggregated values instead of sending detail rows only to compute sums in scripts.
━━━━━━━━━━━━━━━━━━━━
▶ 5. REUSE
One interface can serve several forms (e.g. invoice variants per country), keeping the driver identical.
━━━━━━━━━━━━━━━━━━━━
▶ STEP BY STEP
- Review your form's context and deactivate unused fields.
- Add a condition node that prints a discount block only when a discount exists.
- Move a total calculation from layout script to interface initialization.
✅ CHECKPOINT: your Adobe Form has a lean, typed interface and a purposeful context.
Code example
* ===== Interface ZAF_INV_IF =====* Import parameters* IS_HEADER TYPE ZAF_INV_HEADER (VBELN, FKDAT, KUNAG, WAERK, DISCOUNT, SPRAS ...)* IT_ITEMS TYPE ZTT_INV_ITEMS* IV_REPRINT TYPE FLAG optional* Global data* GV_TOTAL TYPE NETWR* GV_ADDR_LINE1 TYPE CHAR80* GV_TITLE TYPE CHAR40 * ===== Initialization (input: IS_HEADER IT_ITEMS IV_REPRINT, output: GV_*) =====DATA ls_item TYPE zaf_inv_item. CLEAR gv_total.LOOP AT it_items INTO ls_item. gv_total = gv_total + ls_item-netwr.ENDLOOP. IF iv_reprint = 'X'. gv_title = 'INVOICE (COPY)'.ELSE. gv_title = 'INVOICE'.ENDIF. * ===== Context (form ZAF_INVOICE) =====* IS_HEADER fields used: VBELN FKDAT WAERK DISCOUNT; others deactivated* IT_ITEMS fields used: POSNR ARKTX FKIMG VRKME NETWR* GV_TOTAL, GV_TITLE* Condition node DISCOUNT_BLOCK : IS_HEADER-DISCOUNT <> 0 (block not sent otherwise)Real project scenario
A purchase order form took 12 seconds per document in ADS. The context contained full EKKO/EKPO structures with hundreds of fields and all condition records, though the layout used 25 fields.
After deactivating unused fields and passing prepared totals instead of condition details, the XML shrank by 90% and rendering time fell to under 2 seconds.
Common mistakes
- Passing whole database structures to the context.
- Logic in layout scripts instead of context/initialization.
- Database access in initialization.
- Missing currency/quantity references.
- Changing interfaces without updating all drivers.
Best practices
- Lean DDIC interface designed for printing.
- Deactivate unused context fields.
- Context conditions over scripting.
- Initialization for presentation values only.
- Reuse interfaces for form variants.
Interview angle
Questions: "Interface vs context in Adobe Forms?", "Where do you put conditions?", "Why can an Adobe Form be slow?"
Strong answer: interface = DDIC data contract from driver with global data and initialization; context = subset sent to layout/ADS with node types and conditions; prefer context conditions and prepared data over scripting; large contexts increase XML and rendering time — deactivate unused fields.
Practice this lesson
Quick check
1. A driver fills a field correctly but the Adobe output is blank. Which is a likely cause?
2. When creating an Adobe Form in transaction SFP, what is the primary purpose of defining the Form Interface before working on the Context node?
3. What does the Adobe Form context mainly control?
Interview questions
1. A field is populated in the driver program but appears blank in Adobe Form output. What would you check?
Answer it in your own words first, then compare.
2. A GST number is filled correctly by the driver but appears blank on the Adobe invoice. Where do you look?
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
- Adobe Forms Part 1: What SAP Interactive Forms by Adobe Are
- Adobe Forms Part 10: Migrating Smart Forms to Adobe Forms
- Adobe Forms Part 2: SFP Form Design and Layout Basics
- Adobe Forms Part 3: Print Runs, Interactive Forms and Troubleshooting Overview
- Adobe Forms Part 5: The Driver Program Pattern
- Adobe Forms Part 6: Tables, Subforms and Repeating Item Data
- Adobe Forms Part 7: Texts, Logos, Barcodes and Images
- Adobe Forms Part 8: Output Parameters, PDF Return and Spool Handling