04-20-2006 1:11 PM
i made a popup when i choose output type in va42.
i choose 2,3,4.... lines and i need to print for each line layout.
my problem is: always the last line print twice.
my code is:
perform item_print.-standard
check retcode = 0.
perform end_print.
i add
<b> perform print_additional_copies.
check retcode = 0.</b> perform form_close.
check retcode = 0.
///////////////////////////////
form print_additional_copies.
loop at itab_h. "i_matnrs where check = 'X'.
z_count = z_count + 1.
<b> komk-exp_busobj = itab_h-sernr.-change
komk-inco2 = itab_h-maktx.-change</b>* if z_count > 1.
perform restart_form using gvf_fonam nast-spras.
perform print_copies.
endif.
endloop.
endform.
////////////////////////////////////
form restart_form using p_gvf_fonam
p_nast_spras.
call function 'END_FORM'
IMPORTING
RESULT =
exceptions
unopened = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SPOOL_ERROR = 3
others = 4
.
call function 'START_FORM'
exporting
ARCHIVE_INDEX =
form = p_gvf_fonam
language = p_nast_spras
startpage = 'FIRST '
program = tnapr-pgnam
MAIL_APPL_OBJECT =
IMPORTING
LANGUAGE =
exceptions
form = 1
format = 2
unended = 3
unopened = 4
unused = 5
spool_error = 6
OTHERS = 7
.
endform. " RESTART_FORM
//////////////////////////////////////
form print_copies.
perform item_print.
perform check_repeat.
check retcode = 0.
endform. " PRINT_COPIES
04-20-2006 1:24 PM
Hello,
Try like,
form print_additional_copies.
loop at itab_h. "i_matnrs where check = 'X'.
z_count = z_count + 1.
komk-exp_busobj = itab_h-sernr.-change
komk-inco2 = itab_h-maktx.-change* if z_count > 1.
<i>*perform restart_form using gvf_fonam nast-spras.</i><b>Perform start_form.</b>
perform print_copies.
<b>perform close_form.</b>
endif.
endloop.
endform.
04-20-2006 1:40 PM
04-20-2006 1:58 PM
I think the normal printing is taking place from perform item_print. only when the number of items finished then it must be executing the end_print. Check in debug if the data is again getting printed in this form. As u have not provided the form routines of the item_print and end_print, i think that could be the error point.