Skip to Content
avatar image
Former Member

sapscript

hi

me again...

in sapscript we uses the functions

OPEN_FORM

WRITE_FORM

CLOSE_FORM

If I am right?

but I am getting an error message that

WRITE_FORM is invalid use START_FORM.

and when I am use the following

OPEN_FORM

START_FORM

CLOSE_FORM

I get the error

WRITE_FORM is missing.

I am totally confused in this

Plz Help me out....

ThanX in advance.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    May 26, 2007 at 02:19 PM

    hi Riaz,

    Read the below document to know the scenario where you can use those

    <b>Start_Form</b>: In-between the function modules OPEN_FORM and CLOSE_FORM, we can use different layout sets. This allows us to combine several different layout sets into one print output. However, we can combine only those layout sets that have the same page format. To switch layout sets, use the function module START_FORM. If another layout set is still open, we must close it first using END_FORM. If we specify no layout set name when calling START_FORM, the system restarts the last open layout set. If after OPEN_FORM no layout set was activated yet, the system leaves the function module with the exception UNUSED. Some of the important export parameters for this function module are

    Form: The parameter contains the name of the layout set you want to use for printing. If you specify no layout set here, the system restarts the last active layout set.

    Language: Layout sets are language-dependent. Enter the desired language here. If the layout set does not exist in this language, the system tries to call the layout set in its original language. If the parameter LANGUAGE is empty, the system uses the language of the last active layout set.

    Startpage: Usually, SAP script starts with the page specified as start page in the layout set definition. If we want to start output with another layout set page, enter the name of the desired layout set page here. If the desired page is not defined, the system uses the start page defined in the layout set.

    Program: To replace program symbols, SAP script must know which active program contains the work areas for the values to be passed. If we omit the parameter, the system searches for the field values in the program that was specified in the parameter OPTIONS (field TDPROGRAM) of OPEN_FORM. If we enter a program name, the system replaces the program symbols with the values from this program up to the next END_FORM.

    Exceptions and other Export, Import parameters are self-explanatory.

    <b>Write_Form</b>: The system outputs the layout set element specified in parameter ELEMENT into the currently opened layout set. In the parameter WINDOW we can specify the name of a window for the output. Remember that the layout set element must be defined in this window. The parameter FUNCTION specifies how to merge the text lines to be output with any existing contents in the window. In this case, there are differences between the different window types or areas. Some of the important export parameters used in Write_Form.

    Element: Specify the name of the text element you want to output into the layout set window specified in the parameter WINDOW. The element must be defined in that layout set window. If you specify no element, the system uses the default element, if one is defined in the layout set.

    Window: Specify the name of the window into which you want to output the layout set element specified in the parameter ELEMENT. Default value for Window is ‘MAIN’.

    Function: The parameter determines how to output the text element into the respective window. The output type depends on the window type and area:

    Window Type: MAIN Area: BODY

    SET/APPEND: Appends to previous output.

    Window Type: Main Area: Top/Bottom and

    Window Type: Other than Main and all areas

    SET: Delete the old element contents and prints the new elements

    APPEND: Appends the new content to existing elements.

    Type: The system interprets this parameter only for output to the main window. The parameter determines the area of the main window into which we want to output the element. Possible values: 'TOP' header area

    'BODY' main area

    'BOTTOM' footer area

    Default value: 'BODY'

    Refer this sample code

    http://www.sap-img.com/sapscripts/a-sample-sap-scripts-reports.htm

    Regards,

    Santosh

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 26, 2007 at 02:21 PM

    Hi Mohd,

    The order of forms in scirpts should be:

    OPEN_FORM

    START_FORM

    WRITE_FORM

    END_FORM

    START_FORM

    WRITE_FORM

    END_FORM

    CLOSE_FORM

    If you have START_FORM then there should be respective END_FORM.

    1) START_FORM using this we can open many layoutses

    2) OPEN_FORM using this we can open the layout

    Thanks,

    Vinay

    Add comment
    10|10000 characters needed characters exceeded