05-09-2013 7:31 AM
Hi All,
We have a requirement to print multiple shipment documents using SAP Script. In print output, page count should come like ' Page 1 of Page n'.
Where n is the total number of form pages.
Lets take an example, we have two shipment document and both of them are having total page count as 2 and 3. When we take a print preview, we get the print output for total page count as 5.
So for first shipment document page count is displayed as 'Page 1 of Page 5, Page 2 of Page5. And second shipment document page count is coming as 'Page 1 of Page 5' , 'Page 2 of Page 5' and 'Page 3 of Page 5'.
here total page count is coming as grand total pages of sap script while we only want to print document wise page count. Out output should be like 'Page 1 of Page 2' , 'Page 2 of Page 2' for first shipment document and for second shipment document it should be like 'Page 1 of Page 3', 'Page 2 of Page 3' and 'Page 3 of Page 3'.
For printing page count i am doing as &PAGE& of &SAPSCRIPT-FORMPAGES&.
Please suggest, how to achieve total number of pages as per this requirement.
your suggestion will be highly appreciated.
Regards,
Amit
05-09-2013 7:45 AM
Hi amit,
That's exactly how you should do (&PAGE& of &SAPSCRIPT-FORMPAGES&) but for each document you need a new form to be printed. So for each shipment you need to call FM START_FORM and END_FORM.
You will have something like this
call function open_form.
loop at lt_shipment. "assume each line is one shipment
call function start_form.
call function write_form.
bla bla bla
call function end_form
endloop.
call function close_form .
Regards,
Custodio
05-09-2013 7:45 AM
Hi amit,
That's exactly how you should do (&PAGE& of &SAPSCRIPT-FORMPAGES&) but for each document you need a new form to be printed. So for each shipment you need to call FM START_FORM and END_FORM.
You will have something like this
call function open_form.
loop at lt_shipment. "assume each line is one shipment
call function start_form.
call function write_form.
bla bla bla
call function end_form
endloop.
call function close_form .
Regards,
Custodio
05-09-2013 9:40 AM
I just missed to use START_FORM.
Thanks a lot . It worked as required.
Regards,
Amit