A SAPscript commands program will look like
CALL FUNCTION ‘OPEN_FORM’
.
CALL FUNCTION ‘START_FORM’
.
CALL FUNCTION ‘WRITE_FORM’
.
CALL FUNCTION ‘END_FORM’
.
CALL FUNCTION ‘WRITE_FORM’
.
.
CALL FUNCTION ‘END_FORM’
.
CALL FUNCTION “CLOSE_FORM’
The main function modules used in SAPScript are
OPEN_FORM: Used for initializing a form printing. It should appear before using any other function modules. The syntax will look like as follow
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 =
CLOSE_FORM: At the end of form printing (After all the operation to close the form printing). It must be used otherwise nothing will be printed on screen or printer. Its syntax will look like
CALL FUNCTION ‘CLOSE_FORM’
IMPORTING RESULT =
TABLES OTFDATA = ?…
EXCEPTIONS UNOPENED =
START_FORM: In between OPEN_FORM and CLOSE_FORM we need to open several forms. For that START_FORM function module is used.
CALL FUNCTION ‘START_FORM’
EXPORTING FORM = SPACE
UNOPENED =
LANGUAGE = SPACE
STARTPAGE = SPACE
PROGRAM = SPACE
ARCHIVE_INDEX = SPACE
IMPORTING LANGUAGE =
EXCEPTIONS FORM =
FORMAT =
UNENDED =
UNUSED =
WRITE_FORM: Output the specified element in the currently opened form. We can specify the window name in which the element should display.
CALL FUNCTION ‘WRITE_FORM’
WINDOW = ‘MAIN’
TYPE = ‘BODY’
IMPORTING PENDING_LINES =
UNOPENED =
EXPORTING ELEMENT = SPACE
FUNCTION = ‘SET’
EXCEPTIONS ELEMENT =
FUNCTION =
TYPE =
UNSTARTED =
WINDOW =
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.
CALL FUNCTION ‘WRITE_FORM_LINES’
EXPORTING HEADER = ?…
WINDOW = ‘MAIN’
UNOPENED =
FUNCTION = ‘SET’
TYPE = ‘BODY’
IMPORTING PENDING_LINES =
FROMPAGE =
TABLES LINES = ?…
EXCEPTIONS FUNCTION =
TYPE =
UNSTARTED =
WINDOW =
END_FORM: Close the current open form using the function module OPEN_FORM
CALL FUNCTION ‘END_FORM’
IMPORTING RESULT =
EXCEPTIONS UNOPENED =
CONTROL_FORM: Used to pass SAPSCRIPT control statement to the form.
CALL FUNCTION ‘CONTROL_FORM’
EXPORTING COMMAND = ?…
EXCEPTIONS UNOPENED =
UNSTARTED =
READ_FORM_ELEMENTS: It fills a table with all the text elements of that form.
READ_FORM_LINES: Used to transfer the lines of form elements into an internal table.
Also Read : ABAP Tutorial Home page -> SAPSCRIPT Tutorial -> How to migrate Sapscript forms to Smartforms