You are on page 1of 23

SAP SCRIPT

FORMS

RAGHAVENDER.M
18.11.2002
OBJECTIVES

o CONTROL PROGRAM

o FUNCTION MODULES USED IN
CONTROL PROGRAM.
CONTROL PROGRAM
CONTROL PROGRAM IS ALSO CALLED AS PRINT
PROGRAM.
A print program is an application program ( REPORT
or MODULE POOL ) 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.

FUNCTION MODULES USED IN
PRINT PROGRAM

OPEN_FORM
CLOSE_FORM
START_FORM
END_FORM
WRITE_FORM
WRITE_FORM_LINES
CONTROL_FORM
READ_FORM_LINES
READ_FORM_ELEMENTS
OPEN_FORM
The function module OPEN_FORM opens form
printing. You must call this function module before you
can use any other form function (WRITE_FORM,
START_FORM, CONTROL_FORM...).
You must end form printing by using the function
module CLOSE_FORM. Otherwise, the system does not
print or display anything.
Within a program, you can use several OPEN_FORM..
CLOSE_FORM pairs. This allows you to write output to
several different spool requests from within one
program.



CALL FUNCTION 'OPEN_FORM'
EXPORTING FORM = SPACE
LANGUAGE = SY-LANGU
DEVICE = 'PRINTER'
DIALOG = 'X'
OPTIONS = SPACE
APPLICATION = 'TX'
ARCHIVE_INDEX = SPACE
ARCHIVE_PARAMS = SPACE
IMPORTING LANGUAGE =
RESULT =
NEW_ARCHIVE_PARAMS =
EXCEPTIONS CANCELED =
DEVICE =
FORM =
OPTIONS =
UNCLOSED =

OPEN_FORM
CLOSE_FORM
The function module closes the form opened
using OPEN_FORM. The system executes any
terminating processing steps for the last
opened form.
You must use this function module to close
form printing. Otherwise, no output appears on
printer or screen.

CLOSE FORM

CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT =
TABLES
OTFDATA = ?...
EXCEPTIONS
UNOPENED =

START_FORM
In-between the function modules OPEN_FORM and
CLOSE_FORM, you can use different forms. This allows
you to combine several different forms into one print
output. However, you can combine only those forms that
have the same page format.
To switch forms, use the function module
START_FORM. If another form is still open, you must
close it first using END_FORM.
If you specify no form name when calling
START_FORM, the system restarts the last open form.
If after OPEN_FORM no form was activated yet, the
system leaves the function module with the exception
UNUSED.


CALL FUNCTION 'START_FORM'
EXPORTING FORM = SPACE
LANGUAGE = SPACE
STARTPAGE = SPACE
PROGRAM = SPACE
ARCHIVE_INDEX = SPACE
IMPORTING LANGUAGE =
EXCEPTIONS FORM =
FORMAT =
UNENDED =
UNOPENED =
UNUSED =

START_FORM
END_FORM
END_FORM ends the currently open
form and executes the required
termination processing. After calling this
function module, no more form is active.
For further output, you must start a new
form using START_FORM.
END_FORM does not replace
CLOSE_FORM, that is, you must always
close any SAPscript output using
CLOSE_FORM.


CALL FUNCTION 'END_FORM'
IMPORTING
RESULT =
EXCEPTIONS
UNOPENED =


END_FORM
The system outputs the form element
specified in parameter ELEMENT into the
currently opened form.
In the parameter WINDOW you can
specify the name of a window for the
output. Remember that the form element
must be defined in this window.
The parameter FUNCTION specifies how
to merge the text lines to be output with
any existing contents in the window. In this
case, there are differences between the
different window types or areas.

WRITE_FORM
CALL FUNCTION 'WRITE_FORM'
EXPORTING ELEMENT = SPACE
WINDOW = 'MAIN'
FUNCTION = 'SET'
TYPE = 'BODY'
IMPORTING PENDING_LINES =
EXCEPTIONS ELEMENT =
FUNCTION =
TYPE =
UNOPENED =
UNSTARTED =
WINDOW =

WRITE_FORM
WRITE_FORM_LINES
The function module outputs the text lines in
table LINES into the specified form window.
The text lines must have the SAPscript ITF
format. From the data in the text header, the
system uses only the field TDSTYLE to apply
the formatting attributes defined in the
specified style for this text. If the field is
empty, the system uses the identically named
formatting attributes (character and paragraph
formats) of the form.
Use parameter WINDOW to specify into which
of the windows defined in the form you

CALL FUNCTION 'WRITE_FORM_LINES'
EXPORTING HEADER = ?...
WINDOW = 'MAIN'
FUNCTION = 'SET'
TYPE = 'BODY'
IMPORTING PENDING_LINES =
FROMPAGE =
TABLES LINES = ?...
EXCEPTIONS FUNCTION =
TYPE =
UNOPENED =
UNSTARTED =
WINDOW =

WRITE_FORM_LINES
CONTROL_PROGRAM
This module is use to pass
SAPscript control statements
to the form.
Enter the SAPscript statement
you want to execute in ITF
format, but without the
statement paragraph attribute
'/:'.


CALL FUNCTION 'CONTROL_FORM'
EXPORTING
COMMAND = ?...
EXCEPTIONS
UNOPENED =
UNSTARTED =

CONTROL_FORM
READ_FORM_ELEMENTS
The function module fills a table with all text
elements that appear in one form.
If you specify no form name, the system includes
all elements of the currently open form. If you
specify a form, the system uses the information
about the active version of the form, retrieved
from the database.


CALL FUNCTION 'READ_FORM_ELEMENTS'
EXPORTING
FORM = SPACE
LANGUAGE = SPACE
TABLES
ELEMENTS = ?...
EXCEPTIONS
FORM =
UNOPENED =


READ_FORM_ELEMENTS
Use this function module to transfer the
lines of a form element into an internal table.
If you specify no form name, the system
transfers the text lines of the currently
open form. If you specify a form, the system
uses the text lines of the active version of
the form from the database

READ_FORM_LINES
CALL FUNCTION 'READ_FORM_LINES'
EXPORTING FORM = SPACE
LANGUAGE = SPACE
WINDOW = 'MAIN'
ELEMENT = SPACE
TABLES LINES = ?...
EXCEPTIONS ELEMENT =
FORM =
UNOPENED =

READ_FORM_LINES
THANK YOU

You might also like