‎2006 Feb 01 4:55 PM
Hi all,
I have designed a form and I am trying to send data from the print program.But I get an error message saying
<b>"write_form is invalid start_form is missing"</b>.
I am sending the whole code of my program. Can you please check and tell me where I am going wrong.
********************************************************
REPORT Z_V_SCRIPT_2.
data : begin of itab occurs 0,
carrid like sflight-carrid,
connid like sflight-connid,
fldate like sflight-fldate,
end of itab.
select carrid connid fldate from sflight into table itab.
perform open_form.
LOOP at itab.
perform write_form.
endloop.
perform close_form.
----
Form open_form
----
form open_form .
CALL FUNCTION 'OPEN_FORM'
EXPORTING
FORM = 'Z_V_SCRIPT_2'
LANGUAGE = SY-LANGU.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform. " open_form
----
Form write_form
----
form write_form .
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'MAIN'
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
CODEPAGE = 9
OTHERS = 10
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform. " write_form
----
Form close_form
----
form close_form .
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
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform. " close_form
********************************************************
Regards,
Varun.
‎2006 Feb 01 4:58 PM
Hi Varun,
You have to define OPEN_FORM first then START_FORM.
Sequence:
OPEN_FORM
START_FORM
WRITE_FORM
CLOSE_FORM
Example :
CALL FUNCTION 'OPEN_FORM'
EXPORTING
DEVICE = 'PRINTER'
DIALOG = SPACE
FORM = FORM
LANGUAGE = PRINT_CO-SPRAS
OPTIONS = PR_OPTIONS
EXCEPTIONS
CANCELED = 01
DEVICE = 02
FORM = 03
OPTIONS = 04
UNCLOSED = 05.
CALL FUNCTION 'START_FORM'.
Lanka
Message was edited by: Lanka Murthy
‎2006 Feb 01 5:17 PM
Hi Murthy,
I tried a form yesterday with out using start_form, it worked. So I think it is not mandatory for me to use start_form. Even though I use it gives me a message saying form not actibated even though it is activated.
Regards,
Varun.
‎2006 Feb 01 5:19 PM
Hi,
Please check whether your form exists or not.
I too got the same error. (I did not create the form)
Regards,
GSR.
‎2006 Feb 01 5:26 PM
Hi Varun,
It is not mandatory to use START_FORM. I just mentioned because you are getting an error mesage for START_FORM.
Check your form is activeted or not. I think you have to define Options at OPEN_FORM.
Lanka
‎2006 Feb 01 5:18 PM
Hi Varun,
Can you just see that your report name & the form names are different.Just create a new report with a diff name & paste this code.
‎2006 Feb 01 5:22 PM
Hi Phani,
The report name and script name are same.I dont know where they are differing.By the way whats the deal with names? I have specified the correct name of the form in the program.
Regards,
Varun.
‎2006 Feb 01 5:25 PM
‎2006 Feb 01 5:34 PM
Hi varun,
I just checked your code,its working fine for me even with the same names for program & form.try to activate the form & see.
‎2006 Feb 01 5:38 PM
Hi Varun,
There is no need that you must have a different name at form and program. you code looks OK. Only thing mat be missing is your script activation.
Lanka
‎2006 Feb 01 5:41 PM
Put a break point on the perform open_form and execute your program. Now, exactly at which point are you getting the errror?
Also, in write_form, you are exporting a text-element called 'MAIN'. Check if you have defined it in your form.
‎2006 Dec 30 6:48 AM
Hello SAm,
i have seen ur thread....i want to know how 2 define a text element for form..i tried using so10 and tried using in the program itself using f9 keyword...
i donno where i am doing mistake
REPORT ZSECOND_PROG .
DATA: BEGIN OF ITAB OCCURS 0,
LIFNR TYPE LFA1-LIFNR,
LAND1 TYPE LFA1-LAND1,
NAME1 TYPE LFA1-NAME1,
END OF ITAB.
SELECT LIFNR LAND1 NAME1 FROM LFA1 INTO CORRESPONDING FIELDS OF TABLE
ITAB UP TO 5
ROWS.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX =
ARCHIVE_PARAMS =
DEVICE = 'PRINTER'
DIALOG = 'X'
FORM = 'ZTHIRD_FORM'
LANGUAGE = SY-LANGU
OPTIONS =
MAIL_SENDER =
MAIL_RECIPIENT =
MAIL_APPL_OBJECT =
RAW_DATA_INTERFACE = '*'
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.
LOOP AT ITAB.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT ='MYPAGE1'
*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
CODEPAGE = 9
OTHERS = 10
*
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDLOOP.
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
thanks in advace
‎2006 Dec 30 8:41 AM
In ur write form u have given a text element MYPAGE1
in ur form go to editor , there in command use /E .
/E - used to create the text element.
‎2006 Feb 01 5:43 PM
This happens when it is not able to recognise ur open_form statement. Either it is not executing Open_Form before Write_Form or ur SAPSCRIPT name maybe wrong. Debug n find out this.Put ur BP at Open_Form statement n c the sapscript name u r passing n chk if it is correct or not.
Hope it helps.
Regards,
Bikash
‎2007 Jan 02 5:15 AM
Call The <b>Open_Form</b> and <b>Start_Form</b> Function before your loop statement and then call the <b>Write_Form</b> within the loop and the <b>close_form</b> after the endloop...it should work fine....
‎2007 Jan 02 7:02 AM
Hi varun,
1. There can be possibly one reason.
2. a) make sure the OPEN_FORM has worked out successfully.
Check sy-subrc is 0 immeditately after this FM.
(when open form is encountered, the system will display
a window for choosing the print options.
If this window is not displayed, then it means, there is some problem.
regards,
amit m.
‎2007 Mar 01 1:23 PM
Hi,
This issue might also happen if the data getting printed is being spilled on the second page and SAP Script does not have a next page and corresponding windows to handle it.
Regards,
Kaustubh B. Khasnis
‎2007 Mar 01 3:13 PM
how many pages do u have in the script.
if u have one page, give the page name in first page and next page also.
this will solve your problem.
first page <u>FIRST</u>
next page <u>FIRST</u>
reward if solves.