1、7/7/2019,Output Program Overview,Program retrieves the data to be printed in a Layout set.Structure of Programs Stand alone Transaction TriggeredCommunication in between program and layout set is done via execution of function calls, communication structures and Data Dictionary objects.Execution seq
2、uence of function calls A layout set must be opened before data output begins. Data can be transfer as often as required. At the end the Layout Set has to be closed.,7/7/2019,Output Program Function Call,General Function calls CALL FUNCTION OPEN_FORM CALL FUNCTION WRITE_FORM CALL FUNCTION CLOSE_FORM
3、 CALL FUNCTION CONTROL_FORM CALL FUNCTION READ_TEXT ,7/7/2019,Output Program Function Call,CALL FUNCTION OPEN_FORM EXPORTINGFORM = LANGUAGE = DEVICE = OPTIONS = DIALOG = APPLICATION = IMPORTINGLANGUAGE = EXCEPTIONS ,7/7/2019,Output Program Function Call,OPEN_FORM opens the Layout Set for Printing .
4、Parameters FORM is the name of the Layout Set to open. LANGUAGE defines the layout set 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 ente
5、r spool information such as printer name.,7/7/2019,Output Program Function Call,Possible Exceptions :DEVICE = Device type invalidFORM = Layout set does not existOPTIONS = Options invalidUNCLOSED = A layout set is still active,7/7/2019,Output Program Function Call,CALL FUNCTION WRITE_FORM EXPORTING E
6、LEMENT = TYPE = FUNCTION = WINDOW = EXCEPTIONS ,7/7/2019,Output Program Function Call,WRITE_FORM transfer the data to layout. Parameters ELEMENT - a specific block of data to be output. WINDOW - a specific window where the data is defined. If omitted MAIN window is assumed.TYPE defines area of the M
7、AIN window, where data need to written. Possible values : TOP = MAIN window header. BOTTOM = MAIN window footer. BODY = MAIN window normal output area (Default).,7/7/2019,Output Program Function Call,FUNCTION defines how the data specified in the text element is to be written in the respective WINDO
8、W.MAIN windowSET = Set an element to appear automatically as pages are ejected.APPEND = Add to previously set elementDELETE = Delete previously SET element,7/7/2019,Output Program Function Call,Possible Exceptions : ELEMENT = Text does not exist. FUNCTION = Function is invalid. TYPE = Window area is
9、 invalid. WINDOW = Window does not exist. UNOPENED = Layout set printing not opened.,7/7/2019,Output Program Function Call,CALL FUNCTION CLOSE_FORM EXPORTINGRESULT = EXCEPTIONS Layout set opened with function OPEN_FORM is closed. Only when the Layout Set is closed is the data actually sent to the de
10、vice, the screen or the printer. Possible exceptions: UNOPENED = No open layout set.,7/7/2019,Output Program Function Call,CALL FUNCTION CONTROL_FORM EXPORTINGCOMMAND = EXCEPTIONS Parameter COMMAND accepts the SAPscript command. CONTROL_FORM can execute SAPscript control commands like:PROTECT ENDPRO
11、TECT.Possible exceptions : UNOPENED = Layout set has not been opened.,7/7/2019,Output Program Function Call,CALL FUNCTION READ_TEXTEXPORTINGOBJECT = NAME = ID = LANGUAGE = IMPORTINGHEADER = TABLESLINES = EXCEPTIONS (Note: This function is equivalent to the SAPscript INCLUDE command.),7/7/2019,Output
12、 Program Function Call,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 an Internal table.DATA BEGIN OF HEADER INCLUDE STRUCTURE THEAD DATA END OF HEADER Work area for text lines m
13、ust be defined as an internal table. DATA BEGIN OF LINES OCCURS 0 INCLUDE STRUCTURE TLINE DATA END OF LINES,7/7/2019,Output Program Function Call,Possible Exceptions : ID = Text ID invalid. LANGUAGE = Language invalid. NAME = Text name invalid. NOT_FOUND = Text not found. OBJECT = Text object invali
14、d. REFERENCE_CHECK = Reference sequence interrupted.,7/7/2019,Output Program Function Call,Document ( e.g. Sales Order ) generation programs can also be triggered via business transaction. Sources of data : Document Header Item SO VDBKA VBDPA Delivery Note VDBKL VBDPL Picking VDLKK VBLKP Invoice VDB
15、KR VBDPR Purchase Order EKKO EKPO Payment REGUH REGUP,7/7/2019,Output Program Exercise 2,Write a very basic ABAP program and a Layout Set. Have the program open the Layout Set, then use it to write out some info and close the layout set.,7/7/2019,Output Program Solution for Exercise 2,Please see Not
16、es Pages for the solution,7/7/2019,Output Program Solution for Exercise 2,Please see Notes Pages for the solution,7/7/2019,Output Program Solution for Exercise 2,Please see Notes Pages for the solution,7/7/2019,Output Program Solution for Exercise 2,Please see Notes Pages for the solution,7/7/2019,Output Program Solution for Exercise 2,Please see Notes Pages for the solution,7/7/2019,Output Program Solution for Exercise 2,Please see Notes Pages for the solution,7/7/2019,Output Program Solution for Exercise 2,Please see Notes Pages for the solution,