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

problem with printing a receipt

0 Likes
1,159

guys please help out am trying to print a receipt from an internal table but when i loop before the write form into the internal table that is used for printing the form it gives me an error "WRITE FORM INVALID START FORM MISSING". THE PROBLEM S the start form is there but if i remove the loop or i loop at the empty internal table it prints but the receipt will be empty . has any1 ever come across this problem

guys please help out am trying to print a receipt from an internal table but when i loop before the write form into the internal table that is used for printing the form it gives me an error "WRITE FORM INVALID START FORM MISSING". THE PROBLEM S the start form is there but if i remove the loop or i loop at the empty internal table it prints but the receipt will be empty . has any1 ever come across this problem

6 REPLIES 6
Read only

Former Member
0 Likes
1,121

this is the procedure....

CALL FUNCTION 'OPEN_FORM'

EXPORTING

form = gv_label_name

device = 'PRINTER'

OPTIONS = itcpo

dialog = ' '.

LOOP AT lt_final_mg INTO wa_final_ssf.

CALL FUNCTION 'START_FORM'

EXPORTING

form = gc_big

program = sy-repid.

CALL FUNCTION 'END_FORM'.

CLEAR wa_final_ssf.

ENDLOOP.

CALL FUNCTION 'CLOSE_FORM'.

Read only

0 Likes
1,121

thank you your solution resolves part of the problem the write invalid and the start form missing one but still its not looping its printing just one record.

Read only

Former Member
0 Likes
1,121

You can try like this.

the flow will be like this..

data : count type i.

open_form.

start_form.

loop at itab.

count = count + 1.

write_form.

if count gt 8.

CALL FUNCTION 'CONTROL_FORM'

EXPORTING

COMMAND = 'NEW_PAGE'

EXCEPTIONS

UNOPENED = 1

UNSTARTED = 2

OTHERS = 3

.

clear : count

endif.

endloop.

end_form.

close_form.

Regards

Shiba Prasad Dutta

Read only

Former Member
0 Likes
1,121

Hi .. just follow these steps . you can get it..

  • OPEN FORM

call function 'OPEN_FORM'

exporting

device = 'PRINTER'

form = lv_form

language = sy-langu

options = itcpo

dialog = lv_dialog

importing

result = itcpp

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

others = 11.

if sy-subrc <> 0.

exit.

endif.

call function 'START_FORM'

exporting

form = lv_form

language = lv_langu

startpage = lv_page

program = ''FORM_NAME'

exceptions

form = 1

format = 2

unended = 3

unopened = 4

unused = 5

spool_error = 6

others = 7.

if sy-subrc <> 0.

exit.

endif.

  • POPULATE THE LINE ITEM DATA

loop at gt_des.

.

.

.

.

.

.

endif.

  • EGP/CHALLAN NUMBER AND DATE

call function 'WRITE_FORM'

exporting

element = 'MAIN'

function = 'SET'

type = 'BODY'

window = 'MAIN'

exceptions

others = 4.

if sy-subrc ne 0.

exit.

endif.

endloop.

  • PASS SUBTOTAL DATA

call function 'WRITE_FORM'

exporting

element = 'SUB'

function = 'SET'

type = 'BODY'

window = 'SUBTOTAL'.

call function 'END_FORM'.

enddo.

endif.

endloop.

  • CLOSE FORM

call function 'CLOSE_FORM'

tables

otfdata = gt_itcoo

exceptions

unopened = 1

bad_pageformat_for_print = 2

send_error = 3

spool_error = 4

others = 5.

if sy-subrc <> 0.

exit.

endif.

Thanks

GSANA

Read only

0 Likes
1,121

hi ,

in your sap script , check the next page u have assigned or not if its assigned then correct page or not which contains the main window .

regards

Digvijay Rai

Read only

0 Likes
1,121

CALL FUNCTION 'OPEN_FORM'

EXPORTING

  • APPLICATION = 'TX'

  • ARCHIVE_INDEX =

  • ARCHIVE_PARAMS =

  • DEVICE = 'PRINTER'

DIALOG = 'X'

FORM = 'ZUT_RECEIPT'

LANGUAGE = SY-LANGU.

CALL FUNCTION 'START_FORM'

EXPORTING

  • ARCHIVE_INDEX =

FORM = 'ZUT_RECEIPT'

  • LOOP AT itprint[] INTO itprint.

loop at itprint.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'RECORDS'

  • FUNCTION = 'SET'

  • TYPE = 'BODY'

WINDOW = 'MAIN'.

ENDLOOP.

CALL FUNCTION 'END_FORM'.

CALL FUNCTION 'CLOSE_FORM'.

i did this but still the receipt is printing the first record only