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

write form error

NAeda
Contributor
0 Likes
491

HELLO FRNDS

If i execute this prg , i am getting this error

"write form is invalid , start form is missing "

please guide me regarding this

REPORT YRSCRIPT_SD_PROFORMA_INV.

parameter p_billno like vbrp-vbeln.

tables : vbrk, vbrp, konv , likp, lips, kna1, adrc, j_1iexchdr, eikp, vbkd.

data : begin of itab_vbrp occurs 0,

vbeln like vbrp-vbeln,

posnr like vbrp-posnr,

matnr like vbrp-matnr,

arktx like vbrp-arktx,

fkimg like vbrp-fkimg,

meins like vbrp-meins,

netwr like vbrp-netwr,

ntgew like vbrp-ntgew,

brgew like vbrp-brgew,

charg like vbrp-charg,

aubel like vbrp-aubel, " Ref no

vgbel like vbrp-vgbel, " Delivery no

vfdat like lips-vfdat,

hSdat like lips-hSdat,

rate like konv-kwert,

gewei like vbrp-gewei,

case(15).

data : end of itab_vbrp.

data : begin of itab_lips occurs 0,

vbeln like lips-vbeln,

posnr like lips-posnr,

hsdat like lips-hsdat,

vfdat like lips-vfdat,

end of itab_lips.

data : refno like vbrp-aubel,

delno like vbrp-vgbel,

invoiceno like vbrk-vbeln,

invoicedate like vbrk-fkdat,

**************************************

exnum like vbrk-exnum, "added by narsim

  • orderno like vbrk-bstnk_vf,

orderno like vbkd-bstkd,

orderdate like vbkd-bstdk,

lrdate like likp-lddat,

lrno like likp-bolnr,

inco1 like likp-inco1,

inco2 like likp-inco2,

cusno like vbrk-kunrg,

buyer like vbrk-kunag,

name like adrc-name1,

add1 like adrc-street,

add2 like adrc-str_suppl1,

add3 like adrc-city1,

add4 like adrc-post_code1,

bname like adrc-name1,

badd1 like adrc-street,

badd2 like adrc-str_suppl1,

badd3 like adrc-city1,

badd4 like adrc-post_code1,

carriage like eikp-iever,

vessel like eikp-expvz,

discharge like eikp-zollb,

receipt like eikp-zolla,

loading like eikp-azoll,

destiny like eikp-aland,

origin like eikp-stabe,

                                • added by narsim on 18.03.2008

ploading like eikp-ladel, "port of loading

pdischarge like eikp-kzabe, "port of discharge

shipdate like eikp-kzgbe, "shipping bill no and date

marking like eikp-text1, "marking

packno like eikp-text2, " no of kind of packing

flno like likp-traid, " flight no

flno1(20),

******************end by narsim on 18.03.2008

sp like spell,

totamt type p decimals 2,

totgrs like vbrp-brgew,

totnet like vbrp-ntgew,

tottar type p decimals 2. "added by narsim

data : begin of iwline occurs 0 , " For word wrapping

outlines(40) ,

end of iwline .

data : begin of iwlin occurs 0 , " For word wrapping

outlines(40) ,

end of iwlin .

data : counter type i,inwords1(20),inwords2(20),inword1(40),inword2(40),inword3(40),inword4(40).

select single * from vbrk where vbeln = p_billno.

select vbeln posnr matnr arktx fkimg meins charg aubel vgbel netwr gewei ntgew brgew from vbrp

into corresponding fields of table itab_vbrp where vbeln = vbrk-vbeln.

loop at itab_vbrp.

move itab_vbrp-aubel to refno.

move itab_vbrp-vgbel to delno.

itab_vbrp-rate = itab_vbrp-fkimg / itab_vbrp-netwr.

modify itab_vbrp.

clear itab_vbrp.

endloop.

invoiceno = vbrk-vbeln.

invoicedate = vbrk-fkdat.

orderno = vbrk-bstnk_vf.

select single * from vbkd where vbeln = refno. "Modified by Narsimha .

orderno = vbkd-bstkd.

orderdate = vbkd-bstdk.

select single * from likp where vbeln = delno.

select vbeln posnr vfdat hsdat from lips into table itab_lips where vbeln = likp-vbeln.

cusno = likp-kunnr.

buyer = likp-kunag.

inco1 = likp-inco1.

inco2 = likp-inco2.

lrno = likp-bolnr .

lrdate = likp-lfdat.

flno1 = likp-traid. "flight no r vessel no added by narsim

loop at itab_vbrp.

read table itab_lips with key vbeln = itab_vbrp-vgbel posnr = itab_vbrp-posnr.

if sy-subrc = 0.

move itab_lips-hsdat to itab_vbrp-hsdat.

move itab_lips-vfdat to itab_vbrp-vfdat.

modify itab_vbrp.

endif.

clear itab_vbrp.

clear itab_lips.

endloop.

loop at itab_vbrp.

if itab_vbrp-netwr eq 0.

delete itab_vbrp.

endif.

endloop.

*For Case Details*

DATA : SIMPLE LIKE STXH-TDNAME.

DATA : TEST(40) TYPE C.

DATA : ITLINE LIKE TLINE OCCURS 0 WITH HEADER LINE.

DATA : TDLINE(20).

LOOP AT ITAB_vbrp.

concatenate ITAB_vbrp-Vgbel itab_vbrp-posnr inTO SIMPLE .

SELECT SINGLE TDOBJECT INTO TEST FROM STXH WHERE TDNAME EQ SIMPLE.

IF SY-SUBRC = 0.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = '0001'

LANGUAGE = 'E'

NAME = SIMPLE

OBJECT = 'VBBP'

TABLES

LINES = ITLINE

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8.

ENDIF.

LOOP AT ITLINE.

ITAB_VBRp-case = itline-TdLINE.

MODIFY ITAB_VBRp.

CLEAR ITAB_VBRp.

ENDLOOP.

CLEAR SIMPLE.

endloop.

*Selecting Consignee Details*

select single * from kna1 where kunnr eq cusno.

select single * from adrc where addrnumber eq kna1-adrnr.

name = adrc-name1.

add1 = adrc-street.

add2 = adrc-str_suppl1.

add3 = adrc-city1.

add4 = adrc-post_code1.

select single * from kna1 where kunnr eq buyer.

select single * from adrc where addrnumber eq kna1-adrnr.

move adrc-name1 to bname.

move adrc-street to badd1.

move adrc-str_suppl1 to badd2 .

move adrc-city1 to badd3.

move adrc-post_code1 to badd4.

*Shipping Details*

select single * from j_1iexchdr where rdoc = p_billno. "commented by narsim

select single * from eikp where exnum = j_1iexchdr-exnum. " commented by narsim

*select single * from eikp where exnum = vbrk-exnum. " added by narsim

carriage = eikp-iever.

vessel = eikp-expvz.

discharge = eikp-zollb.

receipt = eikp-zolla.

loading = eikp-azoll.

destiny = eikp-aland.

origin = eikp-stabe.

******************************

                                            • added by narsim\

ploading = eikp-ladel. "port of loading

pdischarge = eikp-kzabe. "port of discharge

shipdate = eikp-kzgbe. "shipping bill no and date

marking = eikp-text1. "marking

packno = eikp-text2. "no of kind of packing

flno = flno1. "Flight no likp-traid

***********************added by narsim

************************

CALL FUNCTION 'OPEN_FORM'

EXPORTING

APPLICATION = 'TX'

  • ARCHIVE_INDEX =

  • ARCHIVE_PARAMS =

DEVICE = 'PRINTER'

DIALOG = ''

FORM = 'YRSCRIPT_PINV'

LANGUAGE = SY-LANGU

IMPORTING

LANGUAGE = SY-LANGU

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

.

*CALL FUNCTION 'OPEN_FORM'

  • EXPORTING

  • DEVICE = 'PRINTER'

  • DIALOG = 'X'

  • FORM = 'YRSCRIPT_PINV'

  • LANGUAGE = SY-LANGU .

*

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'HEADER'

WINDOW = 'HEADER'.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'LEFTWIN'

WINDOW = 'LEFTWIN'.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'RIGHTWIN'

WINDOW = 'RIGHTWIN'.

*CALL FUNCTION 'WRITE_FORM'

  • EXPORTING

  • ELEMENT = 'MAIN'

  • WINDOW = 'MAIN'.

LOOP AT ITAB_VBRP.

call function 'RKD_WORD_WRAP'

exporting

textline = itab_vbrp-arktx

delimiter = ' '

outputlen = 20

tables

out_lines = iwline .

counter = 1 .

totamt = totamt + itab_vbrp-netwr.

totnet = totnet + itab_vbrp-ntgew.

totgrs = totgrs + itab_vbrp-brgew.

tottar = totgrs - totnet.

loop at iwline .

case counter .

when 1 .

move iwline-outlines to inwords1 .

when 2 .

move iwline-outlines to inwords2 .

endcase .

counter = counter + 1 .

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'MAIN'

WINDOW = 'MAIN'.

endloop .

*************************************************

**To get the Amount in Words

call function 'Z_SPELL_AMOUNT_INDIA' " change the fm india1 by india

exporting

amount = totamt

language = sy-langu

importing

in_words = sp .

call function 'RKD_WORD_WRAP'

exporting

textline = sp-word

delimiter = ' '

outputlen = 40

tables

out_lines = iwlin .

counter = 1 .

loop at iwlin .

case counter .

when 1 .

move iwlin-outlines to inword1 .

when 2 .

move iwlin-outlines to inword2 .

when 3 .

move iwlin-outlines to inword3 .

when 4 .

move iwlin-outlines to inword4 .

endcase .

counter = counter + 1 .

endloop .

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'ZEILE'

WINDOW = 'MAIN'.

ENDLOOP.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'TOTAL'

WINDOW = 'TOTAL'.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'FOOTER'

WINDOW = 'FOOTER'.

CALL FUNCTION 'CLOSE_FORM'.

thanks

2 REPLIES 2
Read only

Former Member
0 Likes
426

Hi,

Before Open_form,use this

CALL FUNCTION 'START_FORM'

EXPORTING

FORM = LAYTYPE "'Z_SD_INVOICE_PRN'

EXCEPTIONS

FORM = 1

FORMAT = 2

UNENDED = 3

UNOPENED = 4

UNUSED = 5

OTHERS = 6.

After CLOSE_FORM USE THIS,

CALL FUNCTION 'END_FORM'

  • IMPORTING

  • RESULT =

EXCEPTIONS

UNOPENED = 1

OTHERS = 2.

Reward if helpful.

Regards,

Kumar

Read only

Former Member
0 Likes
426

hi use this prosess..

if u had more than one windows you must specify startform and endform .

call function 'open_form'.

call function 'start_form'.

call function 'write_form'.

call function 'end_form'.

call function 'close_form'.

if u had only one window it is sufficient..

call function 'open_form'.

call function 'write_form'.

call function 'close_form'.

regards,

venkat.