cancel
Showing results for 
Search instead for 
Did you mean: 

Forms:

Former Member
0 Kudos

Hello every1.

Can you explain the difference between

1.open_form and Start form

2.end_form and Close_form.

As i am new to scripts, Can u please explain me in Details.

Thanks,

Shweta.

Helpful Points will be awarded

Accepted Solutions (1)

Accepted Solutions (1)

former_member150733
Contributor
0 Kudos

start_form is used to call a sapscript. you will be passing the SAp script form name to this Funnction module.

close_form is used to close the form called using start_form.

when multiple sapscripts are involved and you want to print all the sapscripts in one go or one spool request, then you can use open_form to start a list of sapscripts specified by start_forms . close form is used to close the open_form statement.

eg., call sequence will be as below

FM : open_form.

FM : start_form (form1)

FM : close_form (form1)

FM : start_form (form2)

FM : close_form (form2)

FM : start_form (form3)

FM : close_form (form3)

FM : close_form

Answers (5)

Answers (5)

Former Member
0 Kudos

Thank you all.

Former Member
0 Kudos

hi,

we can use OPEN_FORM FM to open's the form for printing from intial page, where as we use START_PAGE FM to open's the form for printing from specific page( means we can specifes the page name, that particuller page will be printed only)

call funtion 'open_form'
                 exporting
                                form   = '   '      "specifies the form name
                                language  = '  ' " specifes the language in which form 
                                                        " exisisting

call funtion 'open_form'
                 exporting
                                form   = '   '      "specifies the form name
                                language  = '  ' " specifes the language in which form 
                                                        " exisisting
                               startpage = '    '   "here specifes your reqiured page name

<b>close_form is used for closing the form printing which was opened by open_form.

open_form must close with close_form.</b>

<b>end_form is used for closing the form printing which was opened by start_form.

start_form must close with end_form.</b>

we can place start_form inside the open_form viceversa not possible.

<b>for more information follow these links.</b>

http://help.sap.com/saphelp_nw2004s/helpdata/en/d6/0dba1a494511d182b70000e829fbfe/content.htm

https://www.sdn.sap.com/irj/sdn/advancedsearch?query=start_form&cat=sdn_help

regards,

Ashokreddy

Former Member
0 Kudos

Hi Shweta,

Read this:

Open_form => It assign the form and printer, It should be first.

Start_form => It start Writing mode. You can use write_form in loop to write more than one lines befor End_form.

End_form => It end writing mode of current page and will require to start again through Start_form.

Close_form=> it end the Form. After this you can not start again for created file.

This is the way these fm are called in a program.

CALL FUNCTION 'OPEN_FORM'

  • EXPORTING

  • APPLICATION = 'TX'

  • ARCHIVE_INDEX =

  • ARCHIVE_PARAMS =

  • DEVICE = 'PRINTER'

  • DIALOG = 'X'

  • FORM = 'ZSCRIPT1'

  • LANGUAGE = SY-LANGU

  • OPTIONS =

  • MAIL_SENDER =

  • MAIL_RECIPIENT =

  • MAIL_APPL_OBJECT =

  • RAW_DATA_INTERFACE = '*'

  • SPONUMIV =

  • IMPORTING

  • LANGUAGE =

  • NEW_ARCHIVE_PARAMS =

  • RESULT =

EXCEPTIONS

CANCELED = 1

DEVICE = 2

FORM = 3

OPTIONS = 4

UNCLOSED = 5

MAIL_OPTIONS = 6

ARCHIVE_ERROR = 7

INVALID_FAX_NUMBER = 8

MORE_PARAMS_NEEDED_IN_BATCH = 9

SPOOL_ERROR = 10

CODEPAGE = 11

OTHERS = 12

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'START_FORM'

EXPORTING

  • ARCHIVE_INDEX =

FORM = 'ZFORM1'

  • LANGUAGE = ' '

  • STARTPAGE = 'X'

PROGRAM = 'ZSCRIPT1'

  • MAIL_APPL_OBJECT =

  • IMPORTING

  • LANGUAGE =

  • EXCEPTIONS

  • FORM = 1

  • FORMAT = 2

  • UNENDED = 3

  • UNOPENED = 4

  • UNUSED = 5

  • SPOOL_ERROR = 6

  • CODEPAGE = 7

  • OTHERS = 8

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

  • ELEMENT = ' '

  • FUNCTION = 'SET'

  • TYPE = 'BODY'

WINDOW = 'HEADER'

  • IMPORTING

  • PENDING_LINES =

EXCEPTIONS

ELEMENT = 1

FUNCTION = 2

TYPE = 3

UNOPENED = 4

UNSTARTED = 5

WINDOW = 6

BAD_PAGEFORMAT_FOR_PRINT = 7

SPOOL_ERROR = 8

OTHERS = 9

.

IF SY-SUBRC <> 0.

write:/ 'ERROR IN HEADER'.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

  • ELEMENT = ' '

  • FUNCTION = 'SET'

  • TYPE = 'BODY'

WINDOW = 'MAIN'

  • IMPORTING

  • PENDING_LINES =

EXCEPTIONS

ELEMENT = 1

FUNCTION = 2

TYPE = 3

UNOPENED = 4

UNSTARTED = 5

WINDOW = 6

BAD_PAGEFORMAT_FOR_PRINT = 7

SPOOL_ERROR = 8

OTHERS = 9

.

IF SY-SUBRC <> 0.

write:/ 'ERROR IN HEADER'.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

  • ELEMENT = ' '

  • FUNCTION = 'SET'

  • TYPE = 'BODY'

WINDOW = 'FOOTER'

  • IMPORTING

  • PENDING_LINES =

EXCEPTIONS

ELEMENT = 1

FUNCTION = 2

TYPE = 3

UNOPENED = 4

UNSTARTED = 5

WINDOW = 6

BAD_PAGEFORMAT_FOR_PRINT = 7

SPOOL_ERROR = 8

OTHERS = 9

.

IF SY-SUBRC <> 0.

write:/ 'ERROR IN HEADER'.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'END_FORM'

  • IMPORTING

  • RESULT =

  • EXCEPTIONS

  • UNOPENED = 1

  • BAD_PAGEFORMAT_FOR_PRINT = 2

  • SPOOL_ERROR = 3

  • CODEPAGE = 4

  • OTHERS = 5

.

CALL FUNCTION 'CLOSE_FORM'

  • IMPORTING

  • RESULT =

  • RDI_RESULT =

  • TABLES

  • OTFDATA =

  • EXCEPTIONS

  • UNOPENED = 1

  • BAD_PAGEFORMAT_FOR_PRINT = 2

  • SEND_ERROR = 3

  • SPOOL_ERROR = 4

  • CODEPAGE = 5

  • OTHERS = 6

I hope this is enough for you to understand the concepts.

Donot forget to assign points for the valuable posts and replies of every1.

Regards

Sapna

Former Member
0 Kudos

Hi Shewta,

<b>open_form</b>

this FM open's the form printing and initialses the layout.

call function 'open_form'

exporting

form = ' ' ' here specifies the form name. default value is SPACE

language = sy-langu "here specifies the language in which form existing

device = 'printer' " here pass o/p device type.

<b>

close_form</b>

this FM close the form printing, we must close the opened form with close-form.

call function 'close_form'

**this FM has no parameters

<b>

start_form</b>

this FM is used for printing the form specified page, not from starting page.

call function 'start_form'

exporting

form = ' ' "name of the form

language = sy-langu " exisisting language

startpage = < > ' here specifies the page number from which printing is started.

<b>end_form</b>

this FM is used for end the form printing whish was started by start_form.

start_form must end with end_form FM.

call function 'end_form'

**has no mandatiry parameters

<b>write_form</b>

this FM outputs the form elements specified in the parameter element.

call function 'write_form'

exporting

element = < > "pass the element to output

window = <> " specifies the output location

type = < > "specifies the position onn window

<b>control_form</b>

this FM is used for inserting script control command from program into script editor.

call function 'control_form'

exporting

command = < > 'here pass the control command.

Regards

Aneesh.

Former Member
0 Kudos

he print program is used to print forms. The program retieves the necesary data from datbase tables, defines the order of in which text elements are printed, chooses a form for printing and selects an output device and print options.

  • Open form printing - Must be called before working with any of the other form function modules.

Must be ended with function module CLOSE FORM

call function 'OPEN_FORM'.....

*To begin several indentical forms containing different data within a single spool request, begin each form using START_FORM, and end it using END_FORM

call funtion 'START_FORM'.....

  • Write text elements to a window of the form

call function 'WRITE_FORM'.....

  • Ends form

call funtion 'END_FORM'.....

  • Closes form printing

call function 'CLOSE_FORM'....

Regards

Peram