Printing Forms with
Interactive Forms
Based on Adobe
Software
M. S. AHMED
Prerequisites for the
Workshop
Required:
• BC400 (ABAP Workbench: Basics)
• ABAP Programming background
Recommended:
• Knowledge of SAPscript and/or Smart Forms
Workshop
Printing Forms with
Interactive Forms Based
on Adobe Software
Overview
Program
Form Builder: Interface
Form Builder: Form
Tips and Tricks
Accessibility
Migration
User's Perspective: Printing
with PDF-Based Forms
1 Program 2 Document
The Tools Involved (Design
Time)
Form Template FUNCTION
/1BCDWB/SM00000001.
DATA: %OUTPAR TYPE
SFPOUTPAR,
%DOCPAR TYPE
SFPDOCPAR,
...
Context Layout
Interface
What Happens at Run Time
PDF-based
form template
activate
ABAP
Application function
program module
(generated)
Printout
= Form
= Document
Database
Data retrieval Form description
Architecture
SAP Web Application Server
J2EE Stack ABAP Stack
Application Code (ABAP)
Application Code (Java)
Post Processing
PDF Object (Java) Framework
Web Services SAFPAPI
SOAP
PDF Object (ABAP)
Web Services
Web Services
Document Service
SOAP
(EJB)
Adobe Document Services
Core Components
Workshop
Printing Forms with
Interactive Forms Based
on Adobe Software
Overview
Program
Form Builder: Interface
Form Builder: Form
Tips and Tricks
Accessibility
Migration
Sections of the Application
Program
* (1) Data retrieval and processing
SELECT ... FROM ...
...
* (2) Find out name of generated function module
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'...
* (3) Start form processing
CALL FUNCTION 'FP_JOB_OPEN'...
LOOP AT ...
* (4) Call function module dynamically
CALL FUNCTION <generated function module> ...
ENDLOOP.
* (5) End form processing
CALL FUNCTION 'FP_JOB_CLOSE'...
FP_FUNCTION_MODULE_NA
SELECT
ME NAME?
OPEN
CALL
CLOSE
DATA:
form TYPE fpwbformname,
fm_name TYPE rs38l_fnam,
interface_type TYPE fpinterfacetype.
* (2) Find out name of generated function module
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING i_name = form
IMPORTING
e_funcname = fm_name
e_interface_type = interface_type.
Starting and Ending Form SELECT
Processing
DATA:
fp_outputparams TYPE sfpoutputparams.
NAME?
OPEN
CALL
CLOSE
...
* (3) Start form processing
CALL FUNCTION 'FP_JOB_OPEN'...
* set output parameters like printer, preview...
CHANGING ie_outputparams = fp_outputparams ...
...
* (5) End form processing
CALL FUNCTION 'FP_JOB_CLOSE'...
Calling the Generated
DATA: SELECT
Function Module
fp_docparams TYPE sfpdocparams,
fm_name TYPE rs38l_fnam,
NAME?
OPEN
fp_result TYPE TYPE fpformoutput, ... CALL
CLOSE
LOOP AT ...
fp_docparams-langu = customer_language.
* (4) Call function module dynamically
CALL FUNCTION fm_name
EXPORTING
/1bcdwb/docparams = fp_docparams
bookings = it_bookings
IMPORTING
/1bcdwb/formoutput = fp_result
EXCEPTIONS
OTHERS = 1.
ENDLOOP.
Reuse of Smart Forms
Application Programs
DATA:
ssf_name TYPE tdsfname,
func_mod_name TYPE rs38L_fnam.
(1) Data retrieval SELECT ... FROM ...
...
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
(2) Name of the
formname = ssf_name
generated function
IMPORTING
module?
fm_name = func_mod_name.
LOOP AT ...
CALL FUNCTION func_mod_name
(3) Call generated
EXPORTING ...
function module
IMPORTING ...
ENDLOOP.
Program: Example Used in
Workshop
Program
FP_EXAMPLE_01
Workshop
Printing Forms with
Interactive Forms Based
on Adobe Software
Overview
Program
Form Builder: Interface
Form Builder: Form
Tips and Tricks
Accessibility
Migration
Interface: Properties
Interface: Form Interface
• ABAP types
• Dictionary types
Double click
Dictionary
Encapsulated Parts of an
Interface
Workshop
Printing Forms with
Interactive Forms Based
on Adobe Software
Overview
Program
Form Builder: Interface
Form Builder: Form
Tips and Tricks
Accessibility
Migration
Form Builder: Form
Properties
Context
Designer: Overview
Designer: Structuring a Form
Form Properties
Click Properties
Form Builder: Form
Properties
Context
Designer: Overview
Designer: Structuring a Form
Context: Overview
Interface Context
Node properties/
Field properties
conditions
Context: Using the Interface
2
1
Detour: XML
Representations of Internal
Tables
XML Data Definition XML Data Stream
<BOOKINGS> <BOOKINGS>
<DATA>
<DATA dd:maxOccur="-1">
<CARRID>LH</CARRID>
<CARRID/> <CONNID>0400</CONNID>
</DATA>
<CONNID/>
<DATA>
</DATA> <CARRID>LH</CARRID>
</BOOKINGS> <CONNID>0402</CONNID>
</DATA>
</BOOKINGS>
Conditions for Context
Elements
to be done
Including Addresses
Address type 1 Organization, company
2 Private address
3 Contact person (in
company)
Determine dynamically
Address number Required for all address
types
Person number Required for address types 2
and 3
Long Texts
Form 1
Please settle the invoice
within two weeks.
Form 2 Form 3
Deutsche Bank Hamburg,
(BLZ 699 700 99) 099 55555
SWIFT DEUT DESM 699
Vorstand: Chr. Sparwasser · Sharon Bishop
Chantal Willemin · Hassan Chaatouf
Registergericht Heidelberg HRB 999-WWW
Creating Text Modules
SAP Smart Forms Initial Screen
Form
• Package
Style
ADDR_FOOTER
• Translation attributes
Text Module
• Style
Display Change Create
Text Management
* Left-justified BO Bold
4 Truckee Way, New York, NY 12345-678
P.O. Box 16 05 29, New York NY 34573-134
Telephone (212) 990 Fax (212) 99 12 77
Including Text Modules
determined at design time
determined at runtime
Including SAPscript Texts
determined at runtime
determined at design time
Including Graphics
Type Graphic Content Type Graphic Reference
Form Builder: Form
Properties
Context
Designer: Overview
Designer: Structuring a Form
Designer: Technical
Prerequisites
• SAP GUI for Windows
• A recent 6.20 GUI works: select complete
local GUI for installation
• A 6.40 GUI: make sure that Designer is
installed and check on your hard drive.
Default location:
C:\Program Files\Adobe\Designer 6.0.
If missing: go to
\\dwdf045\640_32.srv\ADOBE\Designer 6.0
• Adobe Reader 6.0 (used to be Acrobat
Reader), incl. update to 6.0.2 (SAPNet alias
adobe-internal)
Bug in Current Designer
Version
• If you get a message like the following, click OK and ignore it.
• If Designer does not open, sometimes this message is hidden somewhere
(in particular if you have opened Designer twice.) Find it and click on OK.
Caution: Loss of Changes
Changes are lost when the layout is in display mode.
The following note is displayed once in the status
line:
“Changes to the layout cannot be saved in display
mode!”
You can make changes but these changes are lost
when you leave the layout area.
Designer: Overview
Script Editor
Palette Layout Palette
Window Editor Window
close/resize left side Palettes
Designer: Menus
Font Paragraph Layout
Click here to move toolbar
Standard
Double click to unlock toolbar
Ctrl click to move toolbar freely
Double click to let it snap back to
its former position
Palette Windows: Handling
Palette bar Expand to full size Close palette
Palette menu
Palettes (can
be moved to
different
palettes)
Palettes: Overview
Objects
List of included on
available the pages
objects
Fields from
the context
Object details
Basic settings
for the
Layout Editor
Drawing Aids: Settings for
the Layout Editor
Before you start with a
new form determine
the basic settings for
the Layout Editor in
Palettes Drawing
Aids
The Layout Editor: Including
1
Objects
2 2
3 5
4 6
Nested Objects vs.
Consecutive
To nest an object
under another object
Objects
To place an object
underneath another
(making it a part of it) object in the
in the Hierarchy Hierarchy palette:
palette:
Drag the object over Drag the object
the object in which below the other
you want it nested. object.
Preparing Layout Elements
for Re-Use
1
2
XML Data and Preview
Preview with test
data
Preview without
test data
Suggested Approach to
Designing Forms
Set up your design environment based on agreed standards.
• Settings are document-based and all members of the
development team should know what those settings are.
• Agree upon font, grids, guidelines and so on
• Build a library
Test your form frequently, if possible using different test
data.
Form Builder: Form
Properties
Context
Designer: Overview
Designer: Structuring a Form
Form Properties
title, author etc.
will be overridden
by application program
always use print program or spool
preview instead!
Objects on a Master Page
boilerplate objects
Own address
Customer address
content area
topmost subform = body page
Dear Mr Smart,
Flight Time Price
repeatable subform as header
LH400 11:00 AM 800 USD
repeatable subform
Thanks for your business.
(static) text
boilerplate object
Bank information
Inserting Several Master
Pages
MP1 MP2 MP3
Restrict page
occurrence:
max count = 1
Suggested Approach to
Designing Forms
Create the master page first.
• Look for data that belongs to the background of the page
• Set your content area
Divide the form information / data into
• Header (master page)
• Form content (body page)
• Leaders / detail lines / trailers
• Footer (master page)
What Are Subforms?
• Can be laid down only in the content area of a master page.
• If of type Position Content, objects of subforms can be laid down at
their exact position at runtime. (Hierarchy position of objects not
relevant for layout position)
• If of type Flow Content, the objects will follow each other, depending
on which space they require at runtime.
What Are Body Pages, and
When to Include Them
Alternative: Top of Next Page
When should you insert a new body page?
when you want to make clear that a new page starts here (make sure
to say so!)
when you want to make sure you want to lay down a subform on a
particular master page
When to Include Subforms
Placing objects in a subform makes sense:
if you want to output the element repeatedly (type Flow
Content)
if you want to visually group objects
if you want to keep objects together (protect them against page
break)
if you want to force a page break afterwards
FP_EXAMPLE_01: Inserting
the Company Logo
2. Drag and drop
static image
1. Click master page
4. Embed image in
XML source 3. Browse image
Inserting Sender’s Address
2
4
5
Inserting Recipient’s Address
3
1 2
4
5
Covering Opening & Closing
1
3
2
Booking Table: Inserting
Fields
1 2
3
Booking Table: Arranging
Columns
1 5
6
Booking Table
1
Booking Table: Creating
Subform for Header
1
3
2
Header: Inserting Text Fields
2
Header: Formatting Text
Fields
2
3
Setting Subform as Header
2
Inserting Totals Table
3
Formatting Totals Table
1
2
1
4
Formatting Totals Table
2
1
4
Totals Table: Inserting
Labels
1
2
3
New Page: Inserting the
Terms of Trades
Workshop
Printing Forms with
Interactive Forms Based
on Adobe Software
Overview
Program
Form Builder: Interface
Form Builder: Form
Tips and Tricks
Accessibility
Migration
Tips and Tricks
Display Options
Scripting
General Tips
Offset and Output Length
Editing options for character fields, for
example:
• Offset
• Output lengths
• Omitting leading zeros
• Compressing blanks
takes place exclusively in print program
(conversion exit).
Editing Options Display
Patterns
To specify patterns choose Object Field
Display Pattern.
The dropdown list box shows only some
of the options. (Display Pattern is a free
entry field.)
check notes
Date Pattern Symbols
D 1 or 2 digit (1-31) day of the month
DD Zero-padded 2 digit (01-31) day of
the month
M One- or two-digit (1-12) month of the
year
MM Zero-padded, two-digit (01-12)
month of the year
MMM Abbreviated month name
MMM Full month name
M
Time Pattern Symbols
h One- or two-digit (1-12) hour of the meridian
(AM/PM)
hh Zero-padded two-digit (01-12) hour of the
meridian (AM/PM)
H One- or two-digit (0-23) hour of the day
HH Zero-padded two-digit (0-23) hour of the day
M One- or two-digit (0-59) minute of the hour
MM Zero-padded, two-digit (00-59) minute of the
hour
S One- or two-digit (0-59) second of the minute
SS Zero-padded, two-digit (00-59) second of the
minute
Pattern Examples (Date /
Time Fields)
Custom Input Resulting formatted
pattern value value
Locale Locale
en_US de_DE
MMMM DD, 2010-05- May 15, May 15,
YYYY 15 2010 2010
EEEE, 'the' 2010-05- Sunday, the Sonntag,
D 'of' 15 15 of the 15 of
MMMM, May, May,
YYYY 2010 2010
Predefined Formatting of
Date Fields
To format date fields choose Object Library FormBuilder.
give examples
Country-Specific Formatting
with no Patterns
• If there are no pattern entries, data is formatted
according to the specified locale.
• Prerequisite: The locale is specified in the function
module's interface or by ABAP command SET
COUNTRY.
Numeric Pattern Symbols
9 a single digit, or
zero digit if empty or a space
z a single digit, or
nothing if empty, a space, or the
zero digit
Z a single digit, or
a space if empty, a space, or the
zero digit
S a minus sign if the number is
negative, and
a space otherwise
Pattern Examples (Numeric
Fields)
Custom Input Formatted value
pattern value
Locale Locale
en_US de_DE
99 155 "15" "15"
S999.9 1.55 " 001.6" " 001,6"
155 " 155.0" " 155,0"
SZZ9.99 15.5 " 15.50" " 15,50"
-15.5 "- 15.50" "- 15,50"
szz9.99 155 "155.00" "155,00"
-155 "-155.00" "-155,00"
Tips and Tricks
Display Options
Scripting
General Tips
Scripting
single-line display • FormCalc (recommended for print forms)
• JavaScript (recommended for interactive forms)
various events
• Client
• Server
multi-line display
option available in multi-line display only
Examples of FormCalc
to be done
CHECK notes
talk about variables
Tips and Tricks
Display Options
Scripting
General Tips
PROTECT (Controlling Page
Breaks)
To control content page breaks choose Palette Object
Subform Allow Page Break within Content.
Suggested Approach to
Designing Forms
Take the time to review the data schema (i. e. the context).
• Compare the flow of the data to the physical output of the form.
• Ideally, the data flow should have logical groups that match the
logical groupings of the physical file.
• Ensure that the data schema has a data node that is representative
of one transaction/form
The data view in the designer is a good tool for determining the
grouping.
Suggested Approach to
Designing Forms
• Draw the form initially without subforms or with only a few
subforms to start.
• To replicate objects choose Copy / duplicate multiple.
• If a field is not behaving as expected, try recreating it.
• For print forms, margins may not be required.
• Save the form frequently and incrementally if possible.
Suggested Approach to
Designing Forms
• Place the items / fields on the form in the order they appear on
the printout and in the order in which they appear on the form.
• After creating your subforms and before setting their properties,
test whether that data is still populating.
• Before setting the page content area to Flowed, set your layout
information for each subform.
Suggested Approach to
Designing Forms
The last step(s) you should take is/are
• Creating any reference / overflow items.
• Setting page content to Flowed
check ???
Downloading Form objects
Utilities
...
Uploading form object
Downloading form object
PDF Import Functionality of
Designer Importing an existing PDF form
means converting it to an XDP file
(containing the XFA, that is, the
XML description for the layout of
the form).
Importing PDF files is especially
suitable for static PDF forms.
PDF Import Functionality of
Designer
PDF Import Functionality of
Designer
PDF Import Functionality of
Designer
Workshop
Printing Forms with
Interactive Forms Based
on Adobe Software
Overview
Program
Form Builder: Interface
Form Builder: Form
Tips and Tricks
Accessibility
Migration
Accessibility
The Adobe Reader and Acrobat provide several
techniques for supporting them when “reading”
PDF documents.
Accessibility Logical Read
Documents are more accessible if they have been written with a logical
Sequence
structure in mind. The logical structure refers to the organization of the
document such as
• Title page
• Chapters, headings
• Sections and subsections
• Multi-column text
• Tables
This structure along with the layout (top-to-bottom, left-to-
right) determines the order in which we read the document.
Accessibility How to
• Logical read sequence
achieve this
• You have to set the alignment on every page for the page itself and for its
subforms.
• Identify units that belong together such as the address, document
information in your form and structure your template accordingly with
subforms.
Accessibility Navigation
help
The document should include navigational and organization aids, such as
a table of contents and useful headings. This helps users to move
through the document without having to read the entire document page
by page in order to find what they are looking for.
Accessibility
Navigation help
How to
achieve this
• Use XFA tables instead of normal subform hierarchies for building
output tables.
XFA Table vs. Table w/
Normal Subform Hierarchy
XFA Table Table
- Flow Content Table Flow Content
Bookings - determine cell width Bookings (w/ default settings)
DATA Flow Content DATA Position Content
Table Row
Field 1 Field 1 determine width
Field 2 Field 2 determine width
Field 3 Field 3 determine width
Accessibility Alternate
Alternate text descriptions for images and barcodes
text
• Use thedescriptions
accessibility palette to define alternate texts, and add a custom
screen reader text.
Workshop
Printing Forms with
Interactive Forms Based
on Adobe Software
Overview
Program
Form Builder: Interface
Form Builder: Form
Tips and Tricks
Accessibility
Migration
Migration of SAPscript
Recommendation: Create a new PDF based form from scratch
Migration of Smart Forms
Steps
The conversion step is used to generate a PDF-form
template from a Smart Form.
Make sure all referenced objects (Dictionary types,
Smart Styles, text modules, SAPscript texts etc.) are
available before conversion.
Migration of Smart Forms
Steps
To start the conversion from the initial screen of the transaction
SMARTFORMS choose
Utilities Migration PDF-Based Form Export
Migration of Smart Forms
You can rename the default target form:
Steps
Migration of Smart Forms
Settings
Migration of Smart Forms
Error Log
First run the conversion and then analyze the conversion
protocol by choosing:
Utilities Migration PDF-Based Form Display Log
Migration of Smart Forms
Final Steps
Pain Points in Smart Forms I
• Using SAP signs (<123>)
• Program line nodes in flow logic
• Formatting in text nodes that diverge from the XHTML subset defined by
Adobe (formatting that cannot be converted is lost during migration)
• Combination of data-specific output conditions (table control on conditions
tabstrip) and conditions with times (for example, only after the main window is
closed)
Pain Points in Smart Forms II
• Obsolete 4.6C tables
• Template cells whose layout is interrupted by the layout of other cells (for
example, text1 in cell 1-1, text2 in cell 1-2, text3 in cell 1-1)
• Table and export parameters:
• The new interface optimized for processing with Adobe does not
support table- or export parameters.
• Tables should be created as import parameters (TYPE
<TABLETYPE>).
• Export parameters should not be created for application data: Export
parameters that refer to document output are generally provided.
Pain Points in Smart Forms
III
• Combination of output-related conditions (for example, SFSY-PAGE > 10) and
data-related output conditions with the link OR to text modules, Includes,
graphics, addresses, loops.
• Program lines depend on a layout condition (current page = 1) or a layout-
related event (page break), for example, changing a global variable depends on
the current number of pages.
• Using the output formats XSF, XDF or HTML.
Further
Intranet:
information
http://intranet.sap.com/adobe (Information for customers and partners)
http://intranet.sap.com/adobe-internal (Information for SAP developers)
Public web:
SAP Service Marketplace: http://service.sap.com/adobe
SAP Developer Network: http://sdn.sap.com
Adobe: http://www.adobe.com/sap
SAP Contacts:
Product Management:
Markus Meisl (General): [email protected]
Carsten Brandt (Java development): [email protected]
Project Office (Development):
Christoph Wachter: [email protected]