SAPScript Forms
SAPScript Forms
Headerdata
Header data
Pagelayout
Page layout
Paragraphformats
Paragraph formats
Characterformats
Character formats
Documentation
Documentation
SAPScript
• Form Components
• A form of the graphical Form Painter consists of five
components.
• In alphanumeric Form Painter the Page layout
component is split into three components pages,
windows & Page windows.
• On the initial screen of the Form Painter, you can select
one of the following components:
• Header data
which stores data related to the developer
• Page layout
The page layout allows you to define the individual pages
and windows needed for the page layout.
Cont…
SAPScript
• Paragraph formats
You need paragraph formats in forms as well as in Styles for
processing the text.
• Character formats
You can format texts or paragraphs using character formats.
The only difference compared with paragraph formats is that
you use character formats to layout the text within one
paragraph
• Documentation
As the creator of a form, you are responsible for the form
documentation. This documentation is designed to provide all
information on windows and text elements required for a
modification of the form (especially the description of the
program symbols used)
Headerdata
Header data
Pagelayout
Page layout
Paragraphformats
Paragraph formats
Characterformats
Character formats
Documentation
Documentation
SAPScript
Header Data
• The header data of a form consists of global data of the
form, such as the page format used, the page
orientation, or the initially used font.
• You maintain these data in the Basic settings of the
header data. The header data also include the name of
the form, its description, the form class, and the status.
To see them, branch to the administration data.
• If you display or edit the form header in the form
maintenance transaction, the screen looks more or less
like the one below.
Cont…
Headerdata
Header data
Pagelayout
Page layout
Paragraphformats
Paragraph formats
Characterformats
Character formats
Documentation
Documentation
SAPScript Pages
Pages
• You must define at least one page for every
form. And you must designate a "first" page in
the form header. Otherwise text formatting is not
possible.
• In addition, you should inform the system which
page is to be used after reaching the end of the
first page. If you do not specify a next page, the
output of your text ends at the end of the current
page.
• You can display the contents of the page
counter with the system symbol &PAGE&.
SAPScript Pages
Address
Main text
Subseque
First Page nt Pages
Structuring Pages Using Windows
Pages
Windows
SAPScript Windows
• Documents usually consist of different areas containing
different texts like date, address, logo, page numbers so
on. SAPScript calls such an output area window. These
windows can later be positioned on different pages.
Filling the different windows with the corresponding
texts, is controlled by the print program or the
composer, respectively.
• Different pages of a document may have different
layouts. For example, the first page of an invoice
contains the customer address and letter text. The
subsequent pages contain the actual invoice data, the
order number, and so on. To be able to call the correct
subsequent page after a page break, each individual
page in SAPScript must have a name.
SAPScript Windows
Windows
• Windows are defined in form maintenance. They
represent areas that are positioned on pages then
called as page windows and in which at a later time text
is printed. You must define at least one window for each
form. Otherwise, SAPScript cannot format the text.
• You can assign window names and window types. Use
one of these window types:
MAIN
• Main window in which continuous text is printed. This is
the window used by dialog users of a print program and
form. For example, the body text of a letter would be
entered in MAIN.
Cont…
SAPScript Windows
• The text in the main window can extend over several
pages. If the text fills one page, output continues in the
window of the next and subsequent pages, as long as
MAIN has been defined for these pages.
VAR
• Window with variable contents. The text can vary on each
page in which the window is positioned. Variable windows
are formatted for each page.
• To every window you can assign text, which is printed in
the corresponding window when the form is formatted. To
assign text, use text elements, which are stored with the
form.
SAPScript Windows
CONST
• Window with constant contents that is formatted
only once.
• Currently, CONST windows are processed in the
same way as VAR windows. You should only use
windows of type VAR.
Default Paragraph
• For a particular window, you can override the
default paragraph format that is set in the form
header. Enter the default format that should apply
in the window in the Default paragraph field in the
window definition screen.
Page Windows
Page Windows
• Starting with Release 4.0, the definition of page windows
is required for the alphanumeric Form Painter only. If you
use the graphical Form Painter, you can use the mouse to
place the windows on the page (drag & drop, cut & paste).
It uses a separate design window for the page layout.
• When you define page windows, the window names are
linked to page names. Then specify the position and size
of the window on the assigned page.
• In alphanumeric Form Painter, proceed as follows:
• When defining windows and pages, you have not yet
determine the position and spacing of the texts to be
output.
Cont…
Page Windows
• For this a page window defines the rectangular output
area in the output medium (for example, DIN A4 paper
page) by specifying the left upper edge of the output area
and its width and height.
• When defining a page window, you determine
– which windows appear on a certain page,
– what size the windows have (width, height),
– their position (distance between the left upper window edge
and the left and upper page margins).
• You can create each window only once on each page,
except the main window, which may appear up to 99
times on each page (for example, for printing labels).
Page Windows
• Left margin
Space between the window and left margin of the page
• Upper margin
Space between the window and upper margin of the page
• Window width
Width of the window depending on the page format selected
• Window height
Height of the window depending on the page format selected
• Note that the width of the main window must be the same
on all pages. All other window types can have different sizes
and positions on different pages.
Headerdata
Header data
Pagelayout
Page layout
Paragraphformats
Paragraph formats
Characterformats
Character formats
Documentation
Documentation
Paragraph
Format
Paragraph Formats
Paragraph Formats and Attributes
• In SAPScript, paragraphs are formatted using formats and
their corresponding attributes. Text processing is simplified
by the use of different paragraph attribute groups:
• Standard :- Standard Paragraph Attributes
• Font :- Font Attributes for Paragraphs
• Tabs :- Tabs in Paragraph Formats
• Outline :- Paragraph and Heading Numbering
• There are naming conventions for paragraph tags:
• The paragraph tag can have one or two characters.
• The first character in the paragraph tag must be a letter, the
second a letter, number, or blank; special characters are not
valid.
• The paragraph format must be identified in the Description
field.
Standard Paragraph Attributes
Space after
Space before
Window
Paragraph Formats
Standard Paragraph Attributes
• In the Standard attribute group, you find the general
attributes that can be defined in paragraph formats:
• Description
Precise explanation of your paragraph tag, so that the user
can immediately identify it.
• Left or right margin
Amount of space between the paragraph and the left or
right border of the form window.
• Indent first line
Indent of the first line of a paragraph.
Cont…
Paragraph Formats
• Space before and space after
This controls the amount of space between paragraphs.
The actual space between paragraphs results from the
space after the preceding paragraph and the space before
the following paragraph.
• Alignment - Alignment of a paragraph.
– Left-aligned LEFT
– Right-aligned RIGHT
– Centered – CENTER
– Justified - BLOCK
• Line spacing
Spacing between the lines. The default value is 1 line; the
LPI value (lines per inch) in the header data is used to
calculate the line spacing.
Cont…
Paragraph Formats
• No blank lines
Suppression of blank lines. You can control whether the
blank lines of a paragraph should be suppressed in the
printout or not:
– No entry - blank lines not suppressed
– X - blank lines suppressed
• Page protection
Cohesion of a paragraph. It is possible to determine
whether or not a paragraph can be divided by a page
break.
– No entry -no page protection (default)
– X -all lines of the paragraph are on one page
Cont…
Paragraph Formats
• Next paragraph same page
Cohesion of two adjacent paragraphs. Here you can define
whether the subsequent paragraph should begin on the
same page (that is, at least the first line of the subsequent
paragraph must be on the same page).
• No entry
subsequent paragraph is output on the
same page or the next page, depending
on the amount of space (default)
•X
subsequent paragraph begins on the
same page
Paragraph Formats
Font Attributes for Paragraphs
• You can specify font attributes for paragraph formats. They
control the font used in the text. You can specify these
attributes both for the default font in the header and for
particular paragraph formats:
• Font family
Enter a font supported in the SAPscript font maintenance.
• Font size
Enter the size of a character font. It is measured in 1/10
point.
• Bold/ Italic
Specify whether to use bold-face printing or italics.
Cont…
Paragraph Formats
• Underlined
Mark this attribute to underline entire blocks of text.
When defining a paragraph format, use More to specify
these underline attributes:
• Spacing between the base line and the underline
• Thickness
• Intensity
• Intensity is expressed in percent: 0 % is
a black underline; 100 % is no underline.
Cont…
Paragraph Formats
Cont…
Paragraph Formats
Pagelayout
Page layout
Paragraphformats
Paragraph formats
Characterformats
Character formats
Documentation
Documentation
Character Formats
• Character formats, as opposed to paragraph attributes,
allow you to format entire blocks of text within a paragraph
definition.
• Character attribute groups can be:
• Standard - Standard Attributes for Character Formats
• Font - Font Attributes for Character Formats
• When you define character formats, observe the following
naming conventions:
• The character format can have one or two characters.
• The first character must be a letter, the second a letter,
number, or blank; special characters are not valid.
• Enter a simple explanation in the field Description. It is
intended to help the user make a selection.
Character Formats
• Standard Attributes for Character Formats
• Bar code
Bar code that is required for certain variables and is known
to the printer, for example EAN8. The character string is
printed as a bar code if the character string concerned is
selected.
• Protected
The character string is not split by a line break, but printed
together on the next line.
• Hidden
The character string is not printed. The text is only visible
in the text editor.
• Superscript/subscript
The character string is printed half a line higher or lower.
• Attributes can either be retained or set Off /On.
Character Formats
Pagelayout
Page layout
Paragraphformats
Paragraph formats
Characterformats
Character formats
Documentation
Documentation
Form Elements: Documentation
Printlayout
Page Program
Control Commands
Paragraph formats
Symbols formats
Character
Formatting Options
Documentation
Text Elements
Header data
Printlayout
Page Program
Control Commands
Paragraph formats
Symbols formats
Character
Formatting Options
Documentation
Text Elements
• Text Elements
• Text elements in SAPScript are the individual text
components of a form. In the different windows, you can
define text elements with different attributes. For printout,
the print program accesses them. Text elements can also
contain variables (symbols) and SAPScript control
statements.
• You can define text elements (window texts) for each
window. On the Form: Request screen, choose Edit Text
elements.
• The print program accesses text elements by name,
formats them and prints them in the respective window.
That is, the program can decide which text elements should
be printed in a particular window. It calls these text
elements by name to print them.
Cont…
Text Elements
• You must therefore change text element names in the print
program if you make any changes to text element names
in a form.
• In the layout of a text element, you can use only the
paragraph and character formats defined in the form.
• Example of a text element in an order confirmation:
• /E ITEM_LINE
IL &VBDPA-POSNR&,,&VBDPA-MATNR&,,&VBDPA-ARKTX&
/ &'Customernumber 'VBDPA-IDNKD&
/ &'Position 'VBDPA-POSEX&
• This example shows a section of a main window of a form,
with an item line of an order confirmation. The /E in the tag
column is used to identify the text as a text element,
ITEM_LINE is the name of the text element.
Text Elements
Printlayout
Page Program
Control Commands
Paragraph formats
Symbols formats
Character
Formatting Options
Documentation
Print Program
• Print Program
• A print program is an application program that allows you to
print documents to which forms are allocated. The print
program retrieves the required data from the database and
combines them with the data the user entered. Then, it
processes the underlying form, formats the data
accordingly, and prints it.
• Using Print Programs
• R/3 applications (FI, CO, MM and so on) deliver
standardized forms and print programs that customers may
have to adapt to their special needs. Only the close
interaction of print program and predefined form allows the
user to print forms such as orders or invoices.
Print Program
• One important feature of SAPScript is that forms contain
texts with variables besides the layout information. These
variables are replaced independent of the formatting and
appear as values in the printout. The print program is
responsible for retrieving the data from the R/3 system and
for the control logic of the output.
• This allows the user of SAPScript forms to separate the
logic of retrieving data from the layout of the output. The
print program retrieves or calculates the required data and
determines their output order. SAPScript is responsible for
formatting and positioning this data on a print page. Thus,
you can modify the layout of the form without having to
change the print program.
Print Program
• * (2) Open form
CALL FUNCTION 'OPEN_FORM'
EXPORTING
DEVICE = 'PRINTER'
FORM = 'S_EXAMPLE_1'
DIALOG = 'X'
EXCEPTIONS
others = 1
• * (3) Print table heading
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'HEADING'
WINDOW = 'MAIN'
...
Print Program
• * (4) Print customer bookings
LOOP AT bookings WHERE
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'BOOKING'
WINDOW = 'MAIN'
...
ENDLOOP
• * (5) Close form
CALL FUNCTION 'CLOSE_FORM'
...
Text Elements
Header data
Printlayout
Page Program
Control Commands
Paragraph formats
Symbols formats
Character
Formatting Options
Documentation
SAPscript Control Commands
Cont…
SAPscript Control Commands
• Enter the command itself in the text line. You will notice
that all key words and other parts of the specification
not given as literal values enclosed in inverted commas
are automatically converted to capital letters.
• Enter only one control command in each line.
Text Elements
Header data
Printlayout
Page Program
Control Commands
Paragraph formats
Symbols formats
Character
Formatting Options
Documentation
SAPScript Symbol
• SAPscript recognizes four different kinds of symbols:
– System symbols
– Standard symbols
– Program symbols
– Text symbols.
SAPscript Symbols
• SAPscript provides values for the system symbols.
• Standard symbols and their values are defined in the TTDTG
table.
• Program symbols represent data supplied by the program
that is currently executing.
• The values for text symbols come either from control
commands in the text itself or are supplied dynamically by
the Include function in the text editor.
• SAPscript automatically recognizes the type of a symbol.
First of all, it checks in the order as
• system symbol.
• program symbol.
• standard symbol.
• text symbol.
Text Elements
Header data
Printlayout
Page Program
Control Commands
Paragraph formats
Symbols formats
Character
Formatting Options
Documentation
Formatting Options
• Offset
• Specifying an offset has the effect that a certain number
of bytes of the symbol value, starting with the first byte on
the left, will not be displayed. If the offset specified is
greater than the length of the value, nothing is printed.
• &symbol+offset&
• Output Length
• If you need only a part of the symbol value, or the output
has to fit into a box or a field on the screen without
overlapping the edges of this area, then you can use an
output length specification to define how many bytes of
the value should be copied.
• &symbol(length)&
Formatting Options
• Omitting the Leading Sign
• Program symbols with numeric values can have a
leading sign. This sign usually appears to the right of the
numeric value, either as a space for positive numbers, or
as a minus sign for negative numbers . You can use t he
S option to ensure that the value is formatted without the
sign .
• &symbol(S)&
• Leading Sign to the Left
• The leading sign is normally displayed to the right of a
numeric value, except in the case of a floating point
number. This option enables you to specify that the
leading sign should be placed to the left of the number.
• &symbol(<)&
Formatting Options
• Leading Sign to the Right &symbol(>)&
• Certain symbol values are printed with leading zeros. If you
want to suppress these, use the Z option.
• Omitting Leading Zeros &symbol(Z)&
• The symbol value is viewed as a sequence of ‘words’, each
separated from the next by either one or a string of space
characters. The C option has the effect of replacing each
string of space characters with a single space and shifting
the ‘words’ to the left as necessary to close up the gaps.
Leading spaces are completely removed. The results are
the same as those of the ABAP command CONDENSE.
• Space Compression &symbol(C)&
• Number of Decimal Places &symbol(.N)&
Formatting Options
• Omitting the Separator for ‘Thousands’
&symbol(T)&
• Right-Justified Output
&symbol(R)&
• Fill Characters
&symbol(F f )&
• Preceding and Subsequent Texts (Pre-Text /
Post-Text)
&'pre-text'symbol'post-text'&
Thank You ...!