2008 Dec 11 4:11 PM
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
2008 Dec 11 4:22 PM
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'.
2008 Dec 12 7:40 AM
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.
2008 Dec 12 8:38 AM
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
2008 Dec 12 9:11 AM
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
2008 Dec 12 9:17 AM
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
2008 Dec 12 12:28 PM
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
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |