KS-18 Sap Scripts

  • Upload
    -

  • View
    231

  • Download
    0

Embed Size (px)

Citation preview

  • 8/11/2019 KS-18 Sap Scripts

    1/23

    SAP SCRIPT

    FORMS

    RAGHAVENDER.M

    18.11.2002

  • 8/11/2019 KS-18 Sap Scripts

    2/23

    OBJECTIVES

    oCONTROL PROGRAM

    oFUNCTION MODULES USED INCONTROL PROGRAM.

  • 8/11/2019 KS-18 Sap Scripts

    3/23

    CONTROL PROGRAM

    CONTROL PROGRAM IS ALSO CALLED AS PRINTPROGRAM.

    A print program is an application program ( REPORT

    or MODULE POOL ) that allows you to printdocuments to which forms are allocated.

    The print program retrieves the required data fromthe database and combines them with the data the

    user entered. Then, it processes the underlyingform, formats the data accordingly, and prints it.

  • 8/11/2019 KS-18 Sap Scripts

    4/23

    FUNCTION MODULES USED INPRINT PROGRAM

    OPEN_FORM

    CLOSE_FORM

    START_FORM

    END_FORM

    WRITE_FORM

    WRITE_FORM_LINES

    CONTROL_FORM

    READ_FORM_LINES

    READ_FORM_ELEMENTS

  • 8/11/2019 KS-18 Sap Scripts

    5/23

    OPEN_FORM

    The function module OPEN_FORM opens formprinting. You must call this function module before youcan use any other form function (WRITE_FORM,START_FORM, CONTROL_FORM...).

    You must end form printing by using the functionmodule CLOSE_FORM. Otherwise, the system does notprint or display anything.

    Within a program, you can use several OPEN_FORM..CLOSE_FORM pairs. This allows you to write output toseveral different spool requests from within one

    program.

  • 8/11/2019 KS-18 Sap Scripts

    6/23

    CALL FUNCTION 'OPEN_FORM'EXPORTING FORM = SPACELANGUAGE = SY-LANGUDEVICE = 'PRINTER'DIALOG = 'X'

    OPTIONS = SPACEAPPLICATION = 'TX'ARCHIVE_INDEX = SPACEARCHIVE_PARAMS = SPACEIMPORTING LANGUAGE =RESULT =

    NEW_ARCHIVE_PARAMS =EXCEPTIONS CANCELED =DEVICE =FORM =OPTIONS =UNCLOSED =

    OPEN_FORM

  • 8/11/2019 KS-18 Sap Scripts

    7/23

    CLOSE_FORM

    The function module closes the form openedusing OPEN_FORM. The system executes anyterminating processing steps for the lastopened form.

    You must use this function module to closeform printing. Otherwise, no output appears onprinter or screen.

  • 8/11/2019 KS-18 Sap Scripts

    8/23

    CLOSE FORM

    CALL FUNCTION 'CLOSE_FORM'

    IMPORTING

    RESULT =TABLES

    OTFDATA = ?...

    EXCEPTIONS

    UNOPENED =

  • 8/11/2019 KS-18 Sap Scripts

    9/23

    START_FORM

    In-between the function modules OPEN_FORM andCLOSE_FORM, you can use different forms. This allowsyou to combine several different forms into one printoutput. However, you can combine only those forms that

    have the same page format.To switch forms, use the function moduleSTART_FORM. If another form is still open, you mustclose it first using END_FORM.

    If you specify no form name when callingSTART_FORM, the system restarts the last open form.If after OPEN_FORM no form was activated yet, thesystem leaves the function module with the exceptionUNUSED.

  • 8/11/2019 KS-18 Sap Scripts

    10/23

    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

  • 8/11/2019 KS-18 Sap Scripts

    11/23

    END_FORM

    END_FORM ends the currently openform and executes the requiredtermination processing. After calling thisfunction module, no more form is active.For further output, you must start a newform using START_FORM.

    END_FORM does not replaceCLOSE_FORM, that is, you must always

    close any SAPscript output usingCLOSE_FORM.

  • 8/11/2019 KS-18 Sap Scripts

    12/23

    CALL FUNCTION 'END_FORM'

    IMPORTING

    RESULT =

    EXCEPTIONS

    UNOPENED =

    END_FORM

  • 8/11/2019 KS-18 Sap Scripts

    13/23

    The system outputs the form elementspecified in parameter ELEMENT into thecurrently opened form.

    In the parameter WINDOW you canspecify the name of a window for theoutput. Remember that the form elementmust be defined in this window.

    The parameter FUNCTION specifies how

    to merge the text lines to be output withany existing contents in the window. In thiscase, there are differences between thedifferent window types or areas.

    WRITE_FORM

  • 8/11/2019 KS-18 Sap Scripts

    14/23

    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

  • 8/11/2019 KS-18 Sap Scripts

    15/23

    WRITE_FORM_LINES

    The function module outputs the text lines intable LINES into the specified form window.The text lines must have the SAPscript ITFformat. From the data in the text header, the

    system uses only the field TDSTYLE to applythe formatting attributes defined in thespecified style for this text. If the field isempty, the system uses the identically namedformatting attributes (character and paragraphformats) of the form.

    Use parameter WINDOW to specify into whichof the windows defined in the form you

  • 8/11/2019 KS-18 Sap Scripts

    16/23

    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

  • 8/11/2019 KS-18 Sap Scripts

    17/23

    CONTROL_PROGRAM

    This module is use to passSAPscript control statements

    to the form.Enter the SAPscriptstatementyou want to execute in ITFformat, but without the

    statement paragraph attribute'/:'.

  • 8/11/2019 KS-18 Sap Scripts

    18/23

    CALL FUNCTION 'CONTROL_FORM'

    EXPORTING

    COMMAND = ?...

    EXCEPTIONS

    UNOPENED =

    UNSTARTED =

    CONTROL_FORM

  • 8/11/2019 KS-18 Sap Scripts

    19/23

  • 8/11/2019 KS-18 Sap Scripts

    20/23

    CALL FUNCTION 'READ_FORM_ELEMENTS'

    EXPORTING

    FORM = SPACE

    LANGUAGE = SPACE

    TABLES

    ELEMENTS = ?...

    EXCEPTIONS

    FORM =

    UNOPENED =

    READ_FORM_ELEMENTS

  • 8/11/2019 KS-18 Sap Scripts

    21/23

    Use this function module to transfer thelines of a form element into an internal table.

    If you specify no form name, the system

    transfers the text lines of the currentlyopen form. If you specify a form, the systemuses the text lines of the active version ofthe form from the database

    READ_FORM_LINES

  • 8/11/2019 KS-18 Sap Scripts

    22/23

    CALL FUNCTION 'READ_FORM_LINES'

    EXPORTING FORM = SPACE

    LANGUAGE = SPACE

    WINDOW = 'MAIN'

    ELEMENT = SPACE

    TABLES LINES = ?...

    EXCEPTIONS ELEMENT =

    FORM =

    UNOPENED =

    READ_FORM_LINES

  • 8/11/2019 KS-18 Sap Scripts

    23/23

    THANK YOU