Online Tutorials & Training Materials | STechies.com
Register Login
Advertisement

WRITE FORM function module

|| 0

WRITE FORM function module
Stechies

The WRITE_FORM function module is used in a print program to write text elements to a window of the form.

Syntax

CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT =
FUNCTION =
TYPE =
WINDOW =
IMPORTING
PENDING_LINES =
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
OTHERS = 8

.


Parameters

ELEMENT Text element to be output. ITEM_LINE, ITEM_HEADER etc. (Can be seen in the form layout)
FUNCTION Specifies whether the text is to be appended, replaced or deleted. APPEND,SET, DELETE
TYPE Output area of the main window. TOP, BODY, BOTTOM (Default = TOP)
WINDOW Window where the text element is output. MAIN....... other windows (Default = MAIN)

Note: To write lines to the main window, you can also use the WRITE_FORM_LINES function module.


Example

Form layout of MAIN window

/E INTRODUCTION
* Dear Customer

...........................

/E ITEM_HEADER
IH Carrier, Departure

/E ITEM_LINE
IL &SBOOK-CARRID&, &SPFLI-DEPTIME&

/E CLOSING_REMARK


Writing introduction

CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'INTRODUCTION'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS = 8
.

Writing column headers
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_HEADER'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS = 8

.

Set column headings into TOP area of main window for subsequent pages
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_HEADER'
FUNCTION = 'SET'
TYPE = 'TOP'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS = 8

Write item lines
LOOP AT .....
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_LINE'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS = 8.
ENDLOOP.


Delete column headings from TOP area of main window
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_HEADER'
FUNCTION = 'DELETE'

TYPE = 'TOP'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS = 8



Print closing remark
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'CLOSING_REMARK'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS = 8






Advertisement
Advertisement
Advertisement