Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

scripts

Former Member
0 Likes
1,140

Hi all,

I am getting error as 'write_form is invalid, start_form is missing'.

I have given both start and write forms.

Please clarify it.

Regards,

Nasru

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,117

Hi Nasru,

If you are using only one page in your script then go to page1 there in the page attributes, there will be an option for Next page, give the first page name itself there. This will solve your problem.

Reward points if useful.

Regards,

U. Uma

9 REPLIES 9
Read only

Former Member
0 Likes
1,117

what parameters did u pass in start_form

santhosh can u paste ur start form

santhosh

Read only

0 Likes
1,117

Hi santosh,

Here am pasting my program

TABLES:

VBAK.

DATA: BEGIN OF IT_VBAK OCCURS 0,

VBELN TYPE VBAK-VBELN,

ERDAT TYPE VBAK-ERDAT,

ERNAM TYPE VBAK-ERNAM,

AUART TYPE VBAK-AUART,

NETWR TYPE VBAK-NETWR,

END OF IT_VBAK.

SELECT VBELN ERDAT ERNAM AUART NETWR FROM VBAK INTO TABLE IT_VBAK UP TO 10 ROWS.

*LOOP AT IT_VBAK.

*WRITE:/ IT_VBAK-VBELN,

  • IT_VBAK-ERDAT,

  • IT_VBAK-ERNAM,

  • IT_VBAK-AUART,

  • IT_VBAK-NETWR.

*ENDLOOP.

*

CALL FUNCTION 'OPEN_FORM'

EXPORTING

FORM = 'Z705682_Q4'

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

FORM = 'Z705682_Q4'

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.

LOOP AT IT_VBAK.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'MAIN'

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 'END_FORM'

  • IMPORTING

  • RESULT =

  • EXCEPTIONS

  • UNOPENED = 1

  • BAD_PAGEFORMAT_FOR_PRINT = 2

  • SPOOL_ERROR = 3

  • CODEPAGE = 4

  • OTHERS = 5

.

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 'CLOSE_FORM'.

Regards,

Nasru

Read only

0 Likes
1,117

hi nasru,

there is no need of using start form in your code and one thing set the parameter element in your write form like

element = ' pur'.

and same in text of your main window.

like this example

/* HEADER ITEM

/: TOP

HI MATERIAL NO ,, CREATED BY ,, MATERIAL TYPE

HI &SY-ULINE(50)&

/: ENDTOP

/* LINE_ITEM

/E MATERIAL

LI &ITAB-MATNR&,,,,&ITAB-ERNAM&,,,,&ITAB-MTART&

HERE /E REPRESENT THE ELEMENT .

TABLES: MARA.

DATA: BEGIN OF ITAB OCCURS 0,

MATNR LIKE MARA-MATNR,

ERNAM LIKE MARA-ERNAM,

MTART LIKE MARA-MTART,

END OF ITAB.

SELECT MATNR ERNAM MTART FROM MARA INTO CORRESPONDING FIELDS OF TABLE

ITAB.

CALL FUNCTION 'OPEN_FORM'

EXPORTING

DEVICE = 'PRINTER'

DIALOG = 'X'

FORM = 'ZVIJS1'

LANGUAGE = SY-LANGU.

LOOP AT ITAB.

CALL FUNCTION WRITE_FORM

EXPORTING

ELEMENT = 'MATERIAL'

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'MAIN'.

ENDLOOP.

CALL FUNCTION 'END_FORM'

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

USE START FORM ONLY IN THAT CASE WHEN U WANNA TO USE MORE THAN ONE FORM IN YOUR ONE SCRIPT OR WANNA TO USE DIFFERENT FORMATTING FOR DIFFERENT PAGE THEN YOU CAN USE START FORM.

REGARDS

VIJAY

REWARDS*

Read only

Former Member
0 Likes
1,117

hi,

u must follow this sequence for calling the fm..

open_form.

start_form.

write_form.

end_form.

close_form.

Read only

Former Member
0 Likes
1,117

HI

I think you have this FM call in loop

here you might have called write form again after calling close form without calling start form,..

just tell me the sequence ,that how you are calling these in your program

Regards Rk

Read only

Former Member
0 Likes
1,117

hi nasru,

it is not being clear, well would u tell the picture in broader sense like why u r using start forms.

surely i can help u but tell me in detail.

regards

vijay

Read only

Former Member
0 Likes
1,117

Hi Narsu,

I think there is no need of using the start_form, you can simple use as

open_form / write_form / close_form.

Also if you are using any loops or printing any table controls then just use as this

open_form.

loop at itab.

write_form.

endloop.

close_form.

Read only

Former Member
0 Likes
1,118

Hi Nasru,

If you are using only one page in your script then go to page1 there in the page attributes, there will be an option for Next page, give the first page name itself there. This will solve your problem.

Reward points if useful.

Regards,

U. Uma

Read only

0 Likes
1,117

Hi Uma,

Thanks a lot. I got the result.

Regards,

Nasru