This document provides an overview of SAPscript, which is a tool used in SAP to create and design business forms. It discusses the two main components of SAPscript - the SAPscript form and the print program. The SAPscript form controls the appearance of the business document using components like pages, windows, and paragraph and character formats. The print program initializes the printing process by retrieving data and specifying the form and output device. It discusses how the form is processed and formatted according to the layout from the print program before being sent to the specified output. Finally, it outlines the course which will teach students how to create and maintain SAPscript forms as well as print programs.
3. Course Goals
– To learn the basic concepts of SAPscript and how its various
components interact.
– To learn how to create and maintain SAPscript forms
– To learn how to maintain and execute print programs
3
4. Course Objectives
– At the conclusion of the training, you will be able to:
◦ Explain how SAPscript forms are processed
◦ Create and manage SAPscript forms
◦ Maintain print programs
4
5. Course Outline
– SAPscript Introduction
◦ Overview, Components, and Processing
– SAPscript Form
◦ Form Painter
◦ Form Painter Components
◦ Form Painter Screen Editors
– SAPscript Print Program
◦ SAPscript Function Modules
5
7. Overview
– What is SAPscript?
◦ SAPscript is a tool used within SAP that allows us to create and
design a business form. It also enable us to display, print, or
distribute (via email / fax) the business forms through the ABAP Print
Program.
7
8. Overview (cont..)
– Sample of Business Forms
◦ Invoices
◦ Purchase Orders
◦ Accounting Statements
◦ Payslip
◦ Checks
◦ Confirmations
◦ Reminders (Dunning Letters)
[ 8
9. Components of SAPscript
– The 2 Major Components when creating a SAPscript are:
◦ SAPscript Form
◦ Print Program
9
10. SAPscript Forms
– Forms contains the layout and appearance of the document.
– Forms can be accessed via:
◦ Transaction SE71
◦ Menu Path: ABAP Workbench -> Tools -> Form Printout ->
Sapscript -> Form
10
11. Print Program
– An ABAP program where the general processing of the SAPscript
takes place, such as:
◦ Allows the user to input the parameters of the data to be displayed.
◦ Retrieves the data from the database table.
◦ Specify the SAPscript Form to be displayed.
◦ Controls what are the text/data to be displayed.
◦ Controls the type of output of the SAPscript, whether it will be
displayed, printed, emailed, or faxed.
[Rev. # or date] – HP Restricted 11
12. SAPscript Processing
– Listed below shows how the SAPscript is being processed and the
interaction between the print program and the form:
– The Print Program initializes the printing process, it retrieves the data
from the database, and specifies the SAPscript Form to be used, as
well as the Output Device.
– The Document will now be formatted according to the layout
information from the Form specified by the Print Program.
– If the Document contains variables, these will be replaced with the
values of the variables declared/populated by the Print Program.
– The processing is now complete, and the completed document will be
sent to the Output Devices as determined in the Print Program.
[Rev. # or date] – HP Restricted 12
13. SAPscript Processing (cont..)
Print
Database
Program
Output Devices
Printer
Onscreen Display
Email
Fax
SAPscript Form
[Rev. # or date] – HP Restricted 13
15. SAPscript Form
– A SAPscript Form controls the appearance of the business document.
– It is client-dependent.
15
16. Form Painter
– This can be accessed via:
◦ Transaction SE71
◦ Menu Path: ABAP Workbench -> Tools -> Form Printout ->
Sapscript -> Form
– This is a graphical tool that is used to manage/create a Form Layout.
16
17. Form Painter (cont..)
– Form Components
◦ Header
◦ Pages
◦ Windows
◦ Page Windows
◦ Paragraph Formats
◦ Character Formats
17
18. Form Components - Header
– The Header contains the general information about the layout set
– It consists of the Administrative Data for the form and the Basic
Settings that can be overridden in other parts of the form.
– Within the Basic Settings, you can input the global parameters of the
form like, the page format (e.g. LETTER, LEGAL, DINA4 etc..), the
page orientation (e.g. Portrait or Landscape), the default values for text
formatting.
– You can also assign a default paragraph and the first page.
18
19. Form Components – Header (cont..)
Administrative Data Basic Settings
19
20. Form Components - Pages
– A FORM / LAYOUT SET can have one or more pages
– Allows a page sequence for a document
– You must always enter a starting page in a form’s header data
– A specific page format is defined for each form
– SAP Script allows for automatic page numbering
20
22. Form Components - Window
– The Window are the Output area found on a form, this is where the
text are added and displayed.
– There are three type: MAIN, CONSTANT and VARIABLE window:
◦ MAIN window can flow across pages.
– Every layout set can have only one MAIN window.
– MAIN window is created by default.
– As soon as the MAIN window is full, it will automatically trigger a page break and continue the
output of the remaining text in the Main Window of the subsequent pages.
22
23. Form Components - Window (cont…)
◦ CONSTANT and VARIABLE windows
– These are use only once per page.
– The contents of the windows are processed for each page which includes this window.
– The system outputs as much text as fits into the window, but Text exceeding the window size is
truncated.
– The main difference between CONSTANT and VARIABLE window is that for VARIABLE
window, it may have different window sizes on different pages, while the CONSTANT window
can only have a single defined window size on all pages.
23
25. Form Components – Page Windows
– A Page Window is where we specify which Window will appear on a
Page.
– We can also arrange the Window’s position and their sizes on the
Page.
– By default the Main window should be included in all Page Window.
25
27. Form Components – Paragraph
– Used to Format texts in form. The Paragraph Formats contains all
information needed to format the text within the window.
– You can specify different attributes like paragraph alignment (left, right,
centered, justified), line spacing, font formats, tab setting , bar codes,
margins, etc…
27
28. Form Components – Paragraph (cont..)
– The “Standard” tab is where you specify the Paragraph Alignment
(Right, Left, Center, Justified); the Line Spacing; and the Paragraph
Margins.
28
29. Form Components – Paragraph (cont..)
– The “Font” tab is where you specify the default Paragraph Font
Settings, such as Font Type, Size, and Attributes (such as Bold, Italics,
or Underlined).
29
30. Form Components – Paragraph (cont..)
– The “Tabs” tab is where you specify the Tab spacing/position. In the
PC Editor, you click the Tab button from your keyboard to go to the
next tab position. In the Line Editor, tabs are represented by “,,” (2
commas). This is most useful in creating tables in the Form.
30
31. Form Components – Paragraph (cont..)
– The “Outline” tab is where you specify the Outline settings (e.g. I, II, III
…) for the given Paragraph.
31
32. Form Components - Character
– You can specify the font types, font sizes, barcodes, superscripts,
subscript, hidden, protected, etc…
– You can override the paragraph settings (or the header settings) for a
specific words within the window.
32
34. Form Screen Editors
– There are 2 Types of screen editors used to enter texts within the
SAPscript windows, these are:
◦ PC Editor
◦ Line Editor
34
35. Form Screen Editors – PC Editor
– You can edit text in the PC Editor the same way you can edit text in
any word processing system.
– Directly assigns Paragraph and Character Formats via pushbuttons in
the application toolbar.
– Operates on a WYSIWYG concept (What You See Is What You Get).
Which means it displays all applied paragraph and character format as
you see in the editor.
– Has an integrated syntax check for the inserted commands to avoid
input errors.
– This editor can be activated by Settings -> Editor Mode
35
36. Form Screen Editors – Line Editor
– The Line Editor screen contains the Format Column and the Input
Lines.
– The Format Columns is used to enter the Paragraph Format, and
special types of formatting to interpret SAPscript commands.
– The Input Lines is where you enter you text or commands.
– Entering and formatting text using the Line Editor is different than the
WYSIWYG concept of the PC Editor.
◦ The main difference is that with Line Editor, the text you entered is
not in its final format.
◦ Instead the formatting is applied only when the form is printed or
displayed.
36
37. Form Content – Text-Elements
– This are the individual components of a form, which is defined in
different windows.
– In each window you can use 2 types of Text-Elements. These are:
◦ Text Elements with Names
◦ Text Elements without Names
37
38. Form Content – Named Text-Elements
– The Named Text-Elements can be identified by the paragraph
format /E in the format column for the Line Editor, or in the PC Editor,
this line is shaded in gray.
– The Name assigned to the Text-Element can be up to 30 characters
and may consist of letters, numbers, and/or special characters.
– The Text-Element name is valid locally, meaning different window can
use the same Text-Element name.
– The end of this type of text-element is marked by the start of the next
text-element (the next /E line).
– The system outputs the Named Text-Elements only if the print program
explicitly calls them.
38
39. Form Content – Nameless Text-Elements
– The Nameless Text-Elements or Default Text-Elements are those text
lines and control statements that appear at the beginning of the
corresponding window contents without having the /E paragraph
format.
– Only 1 Nameless Text-Elements in each window.
– The Nameless Text-Elements includes all text lines up to the next /E
paragraph line or up to the end of the text is no /E paragraph line was
declared.
– The main difference between the Named and Nameless Text-Element
are:
◦ The system outputs the Named Text-Elements only if the print
program explicitly calls them using the Function Module
WRITE_FORM.
◦ The system outputs the Nameless Text-Elements automatically
whenever it processes the corresponding window.
[ 39
40. Form Content – Symbols
– Symbols are used to insert program and system data into the form.
– Symbols are declared with the &<symbol>&
– Can be added within the Editor Screen via “Insert Symbols”
– Type of Symbols supported by SAPscript:
◦ Text Symbols
◦ Program Symbols
◦ Standard Symbols
◦ System Symbols
40
41. Form Content – Text Symbols
– Text Symbols are defined locally within the Window.
– These is used to define recurring terms or text fragments in the document.
– Use the DEFINE Control Command to declare a text symbol within your
document. And enclose the symbol with &…&
– Then Use the path Insert Symbols Text Symbols to insert the symbol
declared into any part of your window.
– In the Line Editor, you can directly input the Text Symbol by the following:
Example: /: DEFINE &name& = ‘ABAP’
B1 Name: &name&
B1 Are you really &name& ?
Result: Name: ABAP
Are you really ABAP ?
41
42. Form Content – Program Symbols
– Program Symbols are data which came from a database table or internal
table/variable within the Print Program.
– You use the Print Program to provide the necessary data for the Program
Symbols.
– You can use the path Insert Symbols Program Symbols to insert the
symbol into your form.
– In the Line Editor, you can directly input the Program Symbol by the following:
Example:Print Program populates i_mara with contents
coming from the database table mara
SAPscript Form: MAIN Window
B1 Material Number: &I_MARA-MATNR&
Result: Material Number: 000000123456
42
43. Form Content – Standard Symbols
– Standard Symbols are predefined text symbol which are maintained in
the table TTDTG.
– Standard Symbols are language dependent, which based it in the
language settings of your SAPscript form.
– You can use the path Insert Symbols Standard to insert the
symbol into your form.
Example:
B1 &SGF& Meme
Result: Dear Ms. Meme
43
44. Form Content – System Symbols
– System Symbols came from global system variables
– The different system symbols are retrieved from the following tables:
◦ SAPSCRIPT – these contains SAPscript form specific symbols such as
&sapscript-formpage&, etc…
◦ SYST – these are the system fields in ABAP program such as &syst-
uname&, &syst-subrc&, etc..
◦ TTSXY – these are the SAPscript system symbol such as &date&, &uline&…
Example: B1 Page: &SAPSCRIPT-FORMPAGE&
B1 Name: &SYST-UNAME&
B1 Date: &DATE&
Result: Page: 1
Name: BH8044
Date: 07.09.2007
44
45. Form Content – Control Commands
– The Control Commands can be use to influence the output formatting,
such as it allows us to:
◦ Apply special formats into the text
◦ Apply condition logic
◦ Assign values into the Text Symbols, and many more…
– The Control Commands are indicated by the /: Paragraph format in the
Format column (in the Line Editor), or in the PC Editor, it is highlighted
in gray.
– If the Control Commands is unknown or syntactically incorrect, the
command line is treated as a comment line, and is not interpreted or
printed.
45
46. Form Content – Control Commands (cont..)
SAPscript Command Description
ADDRESS Formatting of Addresses
BOTTOM, Define Footer Text in a Window
ENDBOTTOM
BOX, POSITION, SIZE Boxes, Lines and Shading
CASE, ENDCASE Case Distinction
DEFINE Value Assignment to Text Symbols
HEX, ENDHEX Hexadecimal Values
IF, ENDIF Conditional Text Output
INCLUDE Include Other Texts
NEW-PAGE Explicit Forms Feed
NEW-WINDOW Next Window MAIN
46
47. Form Content – Control Commands (cont..)
SAPscript Command Description
PERFORM, Calling ABAP Subroutines
ENDPERFORM
PRINT-CONTROL Insert Print Control Characters
PROTECT, Protect Text from Page Break
ENDPROTECT
RESET Initialize Outline Paragraphs
SET COUNTRY Country Specific Formatting
SET DATE MASK Formatting of Date Fields
SET SIGN Position or +/- signs
SET TIME MASK Formatting of Time Fields
STYLE Change Style
SUMMING Summing Variables
TOP Set Header Text in Window MAIN
47
48. Form Content – Formatting Options
– Country Dependent Formatting
◦ Formatting the fields based on the country settings.
◦ The country depended format options are stored in table T005X.
Syntax: /: SET COUNTRY <country_key>
Example: /: SET COUNTRY ‘CAN’
– To revert the back the settings, use a blank country key.
◦ Example: /: SET COUNTRY ‘ ‘
48
49. Form Content – Formatting Options (cont..)
– Date Mask
◦ Allows us to format the date field
Syntax: /: SET DATE MASK = ‘date_mask’
Example: /: SET DATE MASK = ‘MMDDYYYY’
B1 &SY-DATUM&
Result: 09012007
◦ If there are other characters existing other than the default date mask values, these are interpreted
as simple text. /: SET DATE MASK = ‘Date, MM/DD/YYYY’
Example:
B1 &SY-DATUM&
Result: Date, 09/01/2007
◦ To revert the back the settings, use a blank date mask.
– Example: /: SET DATE MASK = ‘ ‘ 49
50. Form Content – Formatting Options (cont..)
– Time Mask
◦ Allows us to format the time field
Syntax: /: SET TIME MASK = ‘time_mask’
Example: /: SET TIME MASK = ‘HH:MM’
B1 &SY-UZEIT&
Result: 11:30
◦ If there are other characters existing other than the default time mask values, these are
interpreted as simple text.
Example: /: SET DATE MASK = ‘HH Hours MM Minutes’
B1 &SY-UZEIT&
Result: 11 Hours 30 Minutes
◦ To revert the back the settings, use a blank date mask.
– Example: /: SET TIME MASK = ‘ ‘
50
51. Form Content – Formatting Options (cont..)
– Fill Character (F<char>)
◦ This formatting option replace the leading spaces of a
field with a character.
Syntax: &variable(F<char>)&
Example: If the field w_name contains the value ‘ Hello’.
B1 &w_name(F#)&
Result: ###Hello
51
52. Form Content – Formatting Options (cont..)
– Leading Signs Format (< or >)
◦ This format option specifies the placement of the leading sign.
Syntax: &variable(< or >)& – for individual variable
SET SIGN LEFT/RIGHT – for the whole window
Example:
Example: To display the the w_num leading sign to to the (100.00-)
To display w_num leading sign the left left (100.00-)
B1
B1 &w_num(<)&
&w_num(<)&
Result:
Result: -100.00
-100.00
Example:
Example: To display the the w_num leading sign to to the (100.00-)
To display w_num leading sign the left left (100.00-)
/:
/: SET SIGN LEFT
SET SIGN LEFT
B1
B1 &w_num&
&w_num&
Result:
Result: -100.00
-100.00
52
53. Form Content – Formatting Options (cont..)
– Output Length and No. of Decimals
◦ This format option specifies the number of characters to output.
◦ And also for numeric, it can specify the number of decimal character.
Syntax: &variable(x)& – for output length
&variable(.y)& – for decimals
&variable(x.y)& – combination of both
Example: w_num = 12345
B1 &w_num(3)&
B1 &w_num(.2)&
B1 &w_num(3.2)&
Result: 123
12345.00
123.00
53
54. Form Content – Formatting Options (cont..)
– Offset
◦ This format option specifies from what character value of a variable
to be shown in the output.
◦ This can also be combined with the Output length and Decimal
formats
Syntax: &variable+(x)&
Example: w_num = 12345
B1 &w_num+2&
B1 &w_num+2(1)&
B1 &w_num+3(2.2)&
Result: 345
3
45.00
54
55. Form Content – Formatting Options (cont..)
– Omitting Leading Zeros (Z)
◦ This format option suppressed the leading zeros before output
Syntax: &variable(Z)&
Example: w_num = 0012
B1 &w_num(Z)&
Result: 12
55
56. Form Content – Formatting Options (cont..)
– Omitting Leading Signs (S)
◦ This format option suppressed the leading signs before output
Syntax: &variable(S)&
Example: w_num = 100.00-
B1 &w_num(S)&
Result: 100.00
56
57. Form Content – Formatting Options (cont..)
– Omitting Thousands Separator (T)
◦ This format option suppressed the Thousands separator character
before output (which are normally formatted for the data types DEC,
CURR, INT, and QUAN)
Syntax: &variable(T)&
Example: w_num = 112,233.00
B1 &w_num(T)&
Result: 112233.00
57
58. Form Content – Formatting Options (cont..)
– Suppressing Initial Values (I)
◦ This format option suppressed the output of the symbol that still
contains their initial value.
Syntax: &variable(I)&
Example: w_num = 0 currency field, thus initial value is not space but 0.
B1 &w_num&
B1 &w_num(I)&
Result: 0.00
<blank>
58
59. Form Content – Formatting Options (cont..)
– Condense (Space Compression) (C)
◦ This format option replaces a string of space characters into a single
space.
◦ The leading spaces are completely removed.
Syntax: &variable(C)&
Example: w_name = ‘ Who Are You ?’
B1 &w_name(C)&
Result: Who Are You ?
59
60. Form Content – Formatting Options (cont..)
Right-Justified Output (R)
– This format options output the variable in right-justified format.
Syntax: &variable(R)&
Example: w_name = ‘Hello’
B1 &w_name(R)&
Result: Hello
60
61. Form Content – Formatting Options (cont..)
– Preceeding and Subsequent Text
◦ In using the variable symbols, we can also add text inside the &…&
symbols. The advantage of using this is, if the text symbol does not
contain a value, then the text within the & will not be shown.
Syntax: &’text’variable’text’&
Example 1: B1 NAME: &w_name&
w_name = ‘ABAP Team’
B1 &‘NAME: ’w_name&
Result: NAME: ABAP Team
NAME: ABAP Team
Example 2: B1 NAME: &w_name&
w_name = blank
B1 &‘NAME: ’w_name&
Result: NAME:
<no output> 61
62. Form Content – Standard Texts
– Standard Texts are stored externally via the transaction code SO10.
– These text can be re-used in any SAPscript forms
– The advantage of using standard texts is that any updates made are
automatically reflected in the SAPscript forms which uses these
standard texts. Sample of these texts are disclaimers, header texts,
etc…
– In SO10, input the TEXT name, the Text ID (by default can use ST for
Standard text), and Language Key. Upon clicking the create button,
enter your text, save and activate.
– To include a Standard Text in the Sapscript Editor, go to “Insert
Text Standard”. Then input the TEXT name you have created in
SO10.
– To add the Standard Text in the SAPscript Editor, it uses the INCLUDE
Control Command.
◦ Example: INCLUDE YAJC_SAPSCRIPT_TEXT01 OBJECT TEXT ID 62
64. SAPscript Print Program
– The Print Program is an ABAP program which allows you to print the
SAPscript form.
– It retrieves the necessary data from the database table and combines
it with the users input within the selection screen, then process the
data and output it into the SAPscript form.
[Rev. # or date] – HP Restricted 64
65. Print Program Function Modules
OPEN_FORM
START_FORM
WRITE_FORM
WRITE_FORM
….
END_FORM
START_FORM
WRITE_FORM
WRITE_FORM
….
END_FORM
CLOSE_FORM
[Rev. # or date] – HP Restricted 65
66. Print Program FM – OPEN_FORM
– This function module opens the SAPscript form for printing.
– This is the first function module that needs to be executed before the
START_FORM, and WRITE_FORM can be processed.
– To end a form printing, you must specify the CLOSE_FORM,
otherwise the system does not print or display anything.
– At this function module, you need not specify the Form Name.
– But if you did not specify the form name at this FM, you need to use
the START_FORM function module to open the specific form for
printing.
[Rev. # or date] – HP Restricted 66
67. Print Program FM – OPEN_FORM (cont..)
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX‘ if device is set to SCREEN, system displays text formatting on the
screen
ARCHIVE_INDEX = ' ‘ Enter the index information for the print output you want to archive
ARCHIVE_PARAMS = ' ‘ interprets the settings passed in this parameter when archiving the
output.
DEVICE = 'PRINTER‘ desire output device (PRINTER, MAIL, TELEFAX, SCREEN/ABAP)
DIALOG = 'X‘ determines whether to display a dialog box before printing
FORM = ' ‘ you can enter the form name here, which then controls output
formatting
LANGUAGE = SY-LANGU form are language-dependent, enter desired language
OPTIONS = ' ‘ to set several options for printing. Allows user to change print settings
MAIL_SENDER = ' ‘ used for email device type
MAIL_RECIPIENT = ' ‘ used for email device type
MAIL_APPL_OBJECT = ' ‘ used for email device type
RAW_DATA_INTERFACE = '*‘
IMPORTING
LANGUAGE = to retrieve which language variant of the form the system actually used.
NEW_ARCHIVE_PARAMS = results of the archiving process
RESULT = results of the print formatting process
EXCEPTIONS
CANCELED = 1
…
67
68. Print Program FM – START_FORM
– In between the OPEN_FORM and CLOSE_FORM function module,
you can use different form.
– With the use of the START_FORM/END_FORM function modules, you
can combine several different forms into one print output.
– You can specify the SAPscript form name within the START_FORM
function module.
– This function module is optional. You can skip executing the
START_FORM/END_FORM function module by indicating the
SAPscript form name into the OPEN_FORM function module.
68
69. Print Program FM – START_FORM (cont..)
CALL FUNCTION 'START_FORM'
EXPORTING
ARCHIVE_INDEX = ' ‘
FORM = ' ‘ name of the form you want to use for printing
LANGUAGE = ' ‘ form are language-dependent, enter desired language
STARTPAGE = ' ‘ enter the desired start-page if you want to start with other page than the default
PROGRAM = ' ‘ enter the program name of where the program symbols will be taken
MAIL_APPL_OBJECT = ' '
IMPORTING
LANGUAGE = to retrieve which language variant of the form the system actually used.
EXCEPTIONS
FORM = 1
FORMAT = 2
UNENDED = 3
UNOPENED = 4
UNUSED = 5
OTHERS = 6
69
70. Print Program FM – WRITE_FORM
– This function module outputs the texts of the Window and Text-
Elements specified.
– If the Element parameter is blank, it prints out all the Name-less text
element within the window.
– You should execute One (1) WRITE_FORM function module for each
window and element that you want to output.
– Refer to this site for documentation on the parameters of this Function
Module.
http://help.sap.com/saphelp_nw70/helpdata/en/d6/0dba41494511d182
b70000e829fbfe/content.htm
70
71. Print Program FM – END_FORM
– This function module ends the currently open form and executes the
required termination processing
– Once this form is executed, the form that was opened by the
START_FORM function module was closed.
– This is an option function module. Only execute this function module if
the START_FORM was executed.
– This function module does not replace the CLOSE_FORM function
module.
71
72. Print Program FM – CLOSE_FORM
– This function module closes the SAPscript processing opened by the
OPEN_FORM function module.
– This function module is used to close the form printing.
– If this function module was not executed, the form will not be printed,
emailed, or displayed.
72
74. Exercise
In this exercise, we will create a SAPscript form and a print program to
output a formatted document.
– The format of the output document should look like the form below:
74
75. Exercise (cont..)
– Go to SE71 and create a form following this format:
Z_SSCRIPT_<emp_no>
Z_SSCRIPT_TA0000
75
76. Exercise (cont..)
– Inside the PAGES tab, let us create a page named FIRST.
76
77. Exercise (cont..)
– Inside the WINDOWS tab, let us create two windows namely HEADER
and MAIN. HEADER window will contain the CARRID and
CARRNAME details while MAIN window will contain the rest.
– Make sure that the window type of MAIN is MAIN and of HEADER is
VAR.
77
78. Exercise (cont..)
– Inside the PAGE WINDOWS, map each window to a page. Thus,
HEADER and MAIN windows should be mapped to FIRST page
78
79. Exercise (cont..)
– Inside Paragraph Formats tab, create paragraph formats depending on
the paragraph style our form requires. Specify the Standard, Font,
Tabs, and Outline attributes as needed. In this exercise, it seems we
only need to define one set of paragraph format for our document. Let
us use Courier for our font.
79
80. Exercise (cont..)
– Similar with Paragraph Formats, inside the Character Formats tab,
create character formats as necessary. It looks like we will need Bold
characters for our document. Let us create a Bold character format
80
81. Exercise (cont..)
– Let us try to activate the form. When the Activation finds an error stating for
example that the Page FIRST window MAIN: Window is too wide for the page
format used, press Enter to bypass the message.
– In this instance we can use the Graphical Form Painter to fix alignment of
windows. We can do this by going to Transaction SE71, then Settings->Form
Painter..
81
82. Exercise (cont..)
– Now we go to the print program. The program should prompt for
CARRID for out input.
– From this CARRID, we need to output CARRNAME, and all CONNID,
CITYFROM, CITYTO, and MAXSETS associated with the CARRID
inputted.
– Note: The tables involved are SCARR, SPFLI, and SFLIGHT
– Lets go to transaction SE38 and create the Print Program. Please use
this format in naming your object: Y_PPROGRAM_<emp_no>.
82
83. Exercise (cont..)
– After all the data is ready for output, we then invoke the SAPscript
form by using the following function modules:
◦ OPEN_FORM
◦ START_FORM
◦ WRITE_FORM
◦ END_FORM
◦ CLOSE_FORM
83
84. Exercise (cont..)
Reference:
* (1)TABLES: scarr, sflight, spfli.
DATA: carrid like scarr-carrid...
select * from... * (4) Print customer bookings
LOOP AT bookings WHERE
* (2) Open form CALL FUNCTION 'WRITE_FORM'
CALL FUNCTION 'OPEN_FORM' EXPORTING
EXPORTING ELEMENT = 'FLIGHTS'
DEVICE = 'PRINTER' TYPE = 'BODY'
FORM = 'Z_SSCRIPTFORM'
WINDOW = 'MAIN'
DIALOG = 'X'
...
EXCEPTIONS
ENDLOOP
others = 1
* (5) Close form
* (3) Print table heading
CALL FUNCTION 'CLOSE_FORM'
CALL FUNCTION 'WRITE_FORM'
EXPORTING
TYPE = 'TOP'
WINDOW = 'HEADING'
FUNCTION = 'SET'
84
85. Exercise (cont..)
– Finally, let us try to execute our program and print our document!
85