Sei sulla pagina 1di 20

IBM Global Services

SAPScript - Output Program

SAPScript - Output Program | 9.04 March-2005 © 2005 IBM Corporation


IBM Global Services

Objectives

 The participants will :


 Analyze the Function Modules OPEN_FORM , WRITE_FORM , CLOSE_FORM etc.
used in the output program to work with the SAPScripts.

2 SAPScript - Output Program | 9.04 March-2005 © 2005 IBM Corporation


IBM Global Services

Output Program - Overview

 Program retrieves the data to be printed in a SAPScript Form.


 Structure of Programs
 Stand alone
 Transaction Triggered
 Communication in between program and SAPScript Form is done via execution of
function calls and communication structures.
 Execution sequence of function calls
 A SAPScript Form must be opened before being able to output data.
 Data can be transfer as often as required.
 At the end, the SAPScript Form has to be closed.

3 SAPScript - Output Program | 9.04 March-2005 © 2005 IBM Corporation


IBM Global Services

Output Program - Function Call

 General Function calls:


 CALL FUNCTION ‘ OPEN_FORM ’.
 CALL FUNCTION ‘ WRITE_FORM ’.
 CALL FUNCTION ‘ CLOSE_FORM ’.
 CALL FUNCTION ‘ CONTROL_FORM ’.
 CALL FUNCTION ‘ READ_TEXT ’.

4 SAPScript - Output Program | 9.04 March-2005 © 2005 IBM Corporation


IBM Global Services

Output Program - Function Call ‘OPEN_FORM’


CALL FUNCTION ‘ OPEN_FORM ’
EXPORTING
FORM = ..
LANGUAGE = ..
DEVICE = ..
OPTIONS = ..
DIALOG = ..
APPLICATION = ..
IMPORTING
LANGUAGE = ..
EXCEPTIONS …..

5 SAPScript - Output Program | 9.04 March-2005 © 2005 IBM Corporation


IBM Global Services

Output Program - Function Call ‘OPEN_FORM’

 OPEN_FORM opens SAPScript Form for Printing .


 Parameters
 LANGUAGE defines the SAPScript Form language version .
 DEVICE specifies the output device type .( Example : PRINTER, SCREEN, TELEX,
TELEFAX)
 OPTIONS can be used to specify the print preview.
 DIALOG can request a pop-up screen on which user can enter spool information such
as printer name.
 FORM is used to specify the name of the SAPScript Form to be used.

6 SAPScript - Output Program | 9.04 March-2005 © 2005 IBM Corporation


IBM Global Services

Output Program - Function Call ‘OPEN_FORM’

 Possible Exceptions :
 DEVICE = Device type invalid
 FORM = SAPScript Form does not exist
 OPTIONS = Options invalid
 UNCLOSED = A SAPScript Form is still active

7 SAPScript - Output Program | 9.04 March-2005 © 2005 IBM Corporation


IBM Global Services

Output Program - Function Call ‘WRITE_FORM’

CALL FUNCTION ‘ WRITE_FORM ’


EXPORTING
ELEMENT = ..
TYPE = ..
FUNCTION = ..
WINDOW = ..
EXCEPTIONS …..

8 SAPScript - Output Program | 9.04 March-2005 © 2005 IBM Corporation


IBM Global Services

Output Program - Function Call ‘WRITE_FORM’

 WRITE_FORM transfer the data to the SAPScript Form.


 Parameters
 Explicitly specify ELEMENT and WINDOW name to output data to a specific ELEMENT
with in a WINDOW.
 No specification of WINDOW name is necessary for MAIN window.
 TYPE defines area of the MAIN window, where data need to written. Possible values :
 TOP = MAIN window header.
 BOTTOM = MAIN window footer.
 BODY = MAIN window normal output area (Default).

9 SAPScript - Output Program | 9.04 March-2005 © 2005 IBM Corporation


IBM Global Services

Output Program - Function Call ‘WRITE_FORM’

 FUNCTION defines how the data specified in the text element is to be written in
the respective WINDOW.
 MAIN window
 SET = Append to preceding output.
 APPEND = Identical with SET.
 DELETE = Ineffective.
 OTHER window
 SET = Delete old contents and output new text.
 APPEND = Append to preceding output.
 DELETE = Delete the specified text element.

 Default is SET

10 SAPScript - Output Program | 9.04 March-2005 © 2005 IBM Corporation


IBM Global Services

Output Program - Function Call ‘WRITE_FORM’

 Possible Exceptions :
 ELEMENT = Text does not exist.
 FUNCTION = Function is invalid.
 TYPE = Window area is invalid.
 WINDOW = Window does not exist.
 UNOPENED = SAPScript Form printing not opened.

11 SAPScript - Output Program | 9.04 March-2005 © 2005 IBM Corporation


IBM Global Services

Output Program - Function Call ‘CLOSE_FORM’


 SAPScript Form opened with function
CALL FUNCTION 'CLOSE_FORM'
‘OPEN_FORM’ is closed.
* IMPORTING
 SAPScript must be closed before
* RESULT = being able to output the data on the
* RDI_RESULT = screen or printer.
* TABLES  Possible exceptions :
 UNOPENED = No open SAPScript
* OTFDATA =
Form.
* EXCEPTIONS
* UNOPENED =1
* BAD_PAGEFORMAT_FOR_PRINT = 2
* SEND_ERROR =3
* SPOOL_ERROR =4
* CODEPAGE =5
* OTHERS = 6.

12 SAPScript - Output Program | 9.04 March-2005 © 2005 IBM Corporation


IBM Global Services

Output Program - Function Call ‘CONTROL_FORM’

 ‘CONTROL_FORM’ can execute SAPScript control commands.


 Example : PROTECT … ENDPROTECT.
 Parameter COMMAND accept the SAPScript command.
 Possible exceptions :
 UNOPENED = SAPScript Form printing has not been opened.
 UNSTARTED = No SAPScript Form opened

13 SAPScript - Output Program | 9.04 March-2005 © 2005 IBM Corporation


IBM Global Services

Output Program - Function Call ‘READ_TEXT’


CALL FUNCTION ‘ READ_TEXT ’
EXPORTING
OBJECT = ..
NAME = ..
ID = ..
LANGUAGE = ..
IMPORTING
HEADER = ..
TABLES
LINES = ..
EXCEPTIONS …..

14 SAPScript - Output Program | 9.04 March-2005 © 2005 IBM Corporation


IBM Global Services

Output Program - Function Call ‘READ_TEXT’

 An application text can be read from text file. HEADER and LINES contain header
and text information after successful execution.
 Work area for header must be defined as a field string.
DATA BEGIN OF HEADER
INCLUDE STRUCTURE THEAD
DATA END OF HEADER
 Work area for text lines must be defined as an internal table.
DATA BEGIN OF LINES OCCURS ...
INCLUDE STRUCTURE TLINE
DATA END OF HEADER

15 SAPScript - Output Program | 9.04 March-2005 © 2005 IBM Corporation


IBM Global Services

Output Program - Function Call ‘READ_TEXT’

 Possible Exceptions :
 ID = Text ID invalid.
 LANGUAGE = Language invalid.
 NAME = Text name invalid.
 NOT_FOUND = Text not found.
 OBJECT = Text object invalid.
 REFERENCE_CHECK = Reference sequence interrupted.

16 SAPScript - Output Program | 9.04 March-2005 © 2005 IBM Corporation


IBM Global Services

Demonstration

 Creating an output program using the SAPScript function modules OPEN_FORM


, WRITE_FORM , CLOSE_FORM.

17 SAPScript - Output Program | 9.04 March-2005 © 2005 IBM Corporation


IBM Global Services

Practice

 Creating an output program using the SAPScript function modules OPEN_FORM


, WRITE_FORM , CLOSE_FORM.

18 SAPScript - Output Program | 9.04 March-2005 © 2005 IBM Corporation


IBM Global Services

Summary

 An output program is required to retrieve data to be printed in SAPScript forms.


 The general function-modules used in SAPScript forms are : OPEN_FORM
WRITE_FORM , CLOSE_FORM, CONTROL_FORM , READ_TEXT.
 The ‘OPEN_FORM’ function-module opens the SAPScript Form for Printing .
 The ‘WRITE_FORM’ function-module transfer the data to the SAPScript Form.
 A SAPScript must be closed before being able to output the data on the screen or
printer using the function-module ‘CLOSE_FORM’.

19 SAPScript - Output Program | 9.04 March-2005 © 2005 IBM Corporation


IBM Global Services

Questions

 What is the purpose of the output program ?


 What is the function-module required to transfer data to the SAPScript form ?
 What is the use of the ‘CLOSE_FORM’ function-module ?

20 SAPScript - Output Program | 9.04 March-2005 © 2005 IBM Corporation

Potrebbero piacerti anche