Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

LOOP IN SAPSCRIPT

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

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question