cancel
Showing results for 
Search instead for 
Did you mean: 

Smartforms print sort - need to print by number of pages (i.e. 1, 2, 3)

Former Member
0 Kudos

I am working with SMARTFORMS, and need to print spool out by number of pages within customer invoices. The result should be all single page documents at beginning of spool (by customer number), then 2-page documents, etc. I am not sure where to place the logic within the print program. I appreciate any help or direction you can provide. Also, it is accpetable (not preferable) to split each into a separate print spool if needed.

Thanks,

Jeff

Accepted Solutions (1)

Accepted Solutions (1)

naimesh_patel
Active Contributor
0 Kudos

It would be difficult to know the number of pages for each document i.e. One invoice can have 1 page where as next invoice can have 10 pages.

You can get the number of pages generated during the function call by FM's exporting parameter DOCUMENT_OUTPUT_INFO.

You can save this customer number and page number combination in one internal table.

After finishing the spool generation for all your invoices, you can print this internal table. You can create an ALV or simple list to generate a spool for this details.

You can set the SSFCOMPOP-TDNEWID to control the New Spool Request or to use the existing.

E.g.


Loop at itab. " < contains Invoice data
  if sy-tabix = 1.
    SSFCOMPOP-TDNEWID = 'X'.
  else.
    clear: SSFCOMPOP-TDNEWID.
  endif.
  call function smartform_fm
   exporting
     output options...  " SSFCOMPOP
    importing
     document info    "<< gives the number of pages
endloop.

* Print the data for the customer / page infor

Regards,

Naimesh Patel

Answers (1)

Answers (1)

Former Member
0 Kudos

hi

Try to use Copies window option..

surya

Former Member
0 Kudos

I need to update my question.

1. Invoice is generated via OUTPUT TYPE within the Billing config.

2. Once daily, RSNAST00 is used to get all application types identified with Invoice which has been previously generated.

3. Single Print spool is sent to printer, sorted by CUSTOMER

What I need to do is this: SORT print output of all invoices by number of pages, and possibly by "special character" within a form. Can you help ID where I can do this?

Thanks,

jeff

Former Member
0 Kudos

Here is how I managed this process:

RSNAST00 invoice call to smartform in a "2-pass" approach.

1. First pass - I sent the smartform creation with the return of pages for the invoice. I did not create a spool request by setting parameter. I build an internal table to collect the number of pages based on the invoices. I sorted this by customer, then tallied the total number of pages for each customer, and stored this in the table.

2. Second pass - For the acutal creation of the smartform invoices, I used the internal table, sorted by TOTAL PAGES and CUSTOMER. This put the number of pages in ascending order, and kept the customer invoices together. I called the smartform with spool creation with my sorted order, and resulted in a single print spool request to be printed in sequential page number order, which allows the folding machine to be used as needed.

3. EMAIL PDF to customers (additional requirement). Similar 2-pass process, sorting all invoices by customer. The desire here is to send one PDF with all invoices in a single attachment to customer via email. I created a separate spool request for each customer, and used funciton to convert spool to PDF file. I emailed this file to the customer via the function below.

--> FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF' (spool to pdf)

--> FUNCTION 'SO_DOCUMENT_SEND_API1' (email pdf attachment to customer)