cancel
Showing results for 
Search instead for 
Did you mean: 

Forms

Former Member
0 Kudos

Can any body explain what is the use of FM’s open_form, close_form, write_form.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

open_form

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

You need not specify a form name. If you omit the name, you must use the function module START_FORM to open a form before starting the output.

You must end form printing by using the function module CLOSE_FORM. Otherwise, the system does not print or display anything.

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

close_form

The function module closes the form opened using OPEN_FORM. The system executes any terminating processing steps for the last opened form.

You must use this function module to close form printing. Otherwise, no output appears on printer or screen.

Function call:

CALL FUNCTION 'CLOSE_FORM'

IMPORTING RESULT =

TABLES OTFDATA = ?...

EXCEPTIONS UNOPENED =

Write_form

The system outputs the form element specified in parameter ELEMENT into the currently opened form.

In the parameter WINDOW you can specify the name of a window for the output. Remember that the form 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.

plzz reward if it is useful..

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

close_form.

CALL FUNCTION 'CLOSE_FORM'

IMPORTING RESULT =

TABLES OTFDATA = ?...

EXCEPTIONS UNOPENED =

Import parameters:

RESULT

The parameter contains results of the print formatting process. By comparing the corresponding fields of parameter OPTIONS with those of parameter RESULT, you can determine whether the user made changes to any settings on the print control screen.

Structure: ITCPP

Among others, the structure ITCPP contains a field with the name of USEREXIT. This field tells you how the user left the print view:

Characters E, B, or C:

EXIT <-> E

BACK <-> B

CANCEL <-> C

Table parameters:

OTFDATA

If in the parameter OPTIONS the field TDGETOTF contains 'X', the system returns the formatted output in the OTF format in the optional table parameter OTFDATA.

In this case, the system does not output anything to printer, screen or fax/telex/teletex.

Structure: ITCOO

Exceptions:

UNOPENED

The system could not execute the current form function, since the form output was not yet initialized using OPEN_FORM.

open_form.

CALL FUNCTION 'CLOSE_FORM'

IMPORTING RESULT =

TABLES OTFDATA = ?...

EXCEPTIONS UNOPENED =

Import parameters:

RESULT

The parameter contains results of the print formatting process. By comparing the corresponding fields of parameter OPTIONS with those of parameter RESULT, you can determine whether the user made changes to any settings on the print control screen.

Structure: ITCPP

Among others, the structure ITCPP contains a field with the name of USEREXIT. This field tells you how the user left the print view:

Characters E, B, or C:

EXIT <-> E

BACK <-> B

CANCEL <-> C

Table parameters:

OTFDATA

If in the parameter OPTIONS the field TDGETOTF contains 'X', the system returns the formatted output in the OTF format in the optional table parameter OTFDATA.

In this case, the system does not output anything to printer, screen or fax/telex/teletex.

Structure: ITCo

Exceptions:

UNOPENED

The system could not execute the current form function, since the form output was not yet initialized using OPEN_FORM.

write_form.

CALL FUNCTION 'CLOSE_FORM'

IMPORTING RESULT =

TABLES OTFDATA = ?...

EXCEPTIONS UNOPENED =

Import parameters:

RESULT

The parameter contains results of the print formatting process. By comparing the corresponding fields of parameter OPTIONS with those of parameter RESULT, you can determine whether the user made changes to any settings on the print control screen.

Structure: ITCPP

Among others, the structure ITCPP contains a field with the name of USEREXIT. This field tells you how the user left the print view:

Characters E, B, or C:

EXIT <-> E

BACK <-> B

CANCEL <-> C

Table parameters:

OTFDATA

If in the parameter OPTIONS the field TDGETOTF contains 'X', the system returns the formatted output in the OTF format in the optional table parameter OTFDATA.

In this case, the system does not output anything to printer, screen or fax/telex/teletex.

Structure: ITCOO

Exceptions:

UNOPENED

The system could not execute the current form function, since the form output was not yet initialized using OPEN_FORM.

Plzz reward points if it helps.

Former Member
0 Kudos

OPEN_FORM:

It opens form for printing. OPEN_FORM must be called before all other forms. It must be closed by using CLOSE_FORM.

START_FORM:

In between the function modules OPEN_FORM and CLOSE_FORM, you can use different forms. This allows you to combine several different forms into one print output.

However, you can combine only those forms that have the same page format.

To switch forms, use the function module START_FORM. If another form is still open you must close it first using END_FORM.

WRITE_FORM:

The system outputs the form element specified in parameter element into the currently opened form andinto the specified window.

Call Function 'WRITE_FORM'

Exporting

ELEMENT = <Element Name>

WINDOW = 'MAIN'

FUNCTION = 'SET'

TYPE = 'BODY'

END_FORM:

It ends the currently started form and execute the required termination process to enable to start new form. The current START_FORM must be closed by using END_FORM.

CLOSE_FORM:

It closes the form opened using OPEN_FORM it terminate the process which is started by OPEN_FORM.

Reward points if useful.

Former Member
0 Kudos

Hi,

The function module OPEN_FORM creates the spool for the print, can open the dialog to choose the data for the printer and can run the SAPSCRIPT. It can also call the fm START_FORM in order to run the SAPSCRIPT.

The OPEN and CLOSE are used to open and close the spool. The START and END is used to start and end the form. Lets say for example, that you have a report that is to go to the sold to customers, one spool for each customer, but you need to break the report by ship-to. So for each ship-to under the sold-to, you need to start the page numbering over again, but still inside of the "Sold To" spool. If this is your requirement, you would use the START and END function modules to write each ship-to report to the sold-to spool. You can also use the START and END to force the printing of a certain page in the sapscript.

WRITE_FORM function: Then you display the data in the layout set using the WRITE_FORM function. Here you specify the ELEMENTNAME and the window in which you display the data.

Regards,

Satish

Former Member
0 Kudos

in sapscripts in b/w open form and end form a spool request is generated

in open form we can call any no of sap scripts using start form

after start form u need to use write form

open_form

*& Script 1

start_form

write_form

end_form

*& Script 2

start_form

write_form

end_form

Close_form

http://www.esnips.com/doc/99f8f94d-e784-4f64-bad5-65c8865311f0/SAPSCRIPTS-Guide-(ACCENTURE)

Edited by: Madhavi t on Jan 31, 2008 8:45 AM