Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Converting a spool containing 'multiple copies' of a smartform to PDF

former_member215424
Active Participant
0 Kudos
1,838

Hi Experts,

I have a requirement to convert a spool having one page but multiple copies inside it , to a PDF with all the copies.

Ex : A smartform converts a output to five copies , like original , duplicate, triplicate ,extra copy1 and extra copy2 .Page number is same for all the copies.

When I try to convert the output to PDF using PDF! or RSTXPDFT4 , the PDF file has only one page with Original copy. All the other copies are not converted or not appearing in PDF.

Need your assistance on the same.

P.S : Unable to get any suitable information anywhere, hence posting the query.

1 ACCEPTED SOLUTION

former_member215424
Active Participant
0 Kudos
824

Solved.

Changed the printer name to PDFCreator in the print pop up , thus able to download all the five copies as a single PDF file.

14 REPLIES 14

Former Member
0 Kudos
824

Hi Shruti,

Please correct me if 'am wrong, you have a SmartForm output which has 5 pages in it (Whatever may be the Page nos) and you want to convert the same as PDF files (All the 5 pages).

You can use the SmartForm FM to convert it as OTF file and using the FM CONVERT_OTF_2_PDF, you can convert the OTF file to a PDF one.

Hope this will help you

Thanks & Regards

0 Kudos
824

Hi Manu,

I have one page with 5 copies. I need to convert this to PDF. The PDF would contain 5 pages , one for each copy.

This FM converts only the first copy of a page to PDF with one page.

Regards,

Shruti

0 Kudos
824

Hi Shruti,

Are you trying to print the output from spool list?

Where you are saying there are 5 copies?

Confused....

Thanks & Regards

0 Kudos
824

Hi Manu,

Yes , the spool has 1 page with 5 copies.

Something like below shown :

0 Kudos
824

So the spool has only ONE page and FIVE copies (TSP01-RQCOPIES), the last one is only an attribute, and not taken in account by the converter tools.

Regards,

Raymond

0 Kudos
824

Hi Raymond,

Yes,I have set output_options-tdcopies = 005 to print 5 copies of a smartform.

Each copy will have a texts ORIGINAL COPY, DUPLICATE COPY ... etc.

Regards,

Shruti

Former Member
0 Kudos
824

Hi,

You can use the program RSTXPDFT4.

Regards,

Supratik

0 Kudos
824

Hi,

Tried it , but doesn't work.

The PDF has only one page with the first copy i.e original copy.

Regards,

Shruti

reachdebopriya
Active Participant
0 Kudos
824

Hi Shruti,

Please check this link http://scn.sap.com/thread/3258797

This might help you.

Regards,

Debopriya Ghosh

former_member186143
Active Contributor
0 Kudos
824

confusing , if you have 1 spool with 5 copies then those copies are identical.

if in the copies something has changed like original duiplicate triplicate etc than I guess it should be different spools unless you put the setting to combine spools to one spool ?

do you say that you have 1 spool which shows 1 page with 5 copies but when you look at the spool you can scroll through 5 pages where every page has a different word on it like original , duplicate ?

but if you have put that setting than the RSTXPDFT4 must work.

I rebuild RSTXPDFT4 it to make 1 pdf out of multiple spools

LOOP AT ta_zrstxpdft4_alv WHERE chk EQ 'X' AND rqdoctype = 'OTF'.
     spoolno = ta_zrstxpdft4_alv-rqident.
     lv_otf = 'X'.
     REFRESH gt_soli.

     CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
       EXPORTING
         rqident                    = spoolno
*   FIRST_LINE                 = 1
*   LAST_LINE                  =
*   DESIRED_TYPE               =
* IMPORTING
*   REAL_TYPE                  =
*   SP_LANG                    =
       TABLES
         buffer                     = gt_soli
         buffer_pdf                 = gt_buffer
* EXCEPTIONS
*   NO_SUCH_JOB                = 1
*   JOB_CONTAINS_NO_DATA       = 2
*   SELECTION_EMPTY            = 3
*   NO_PERMISSION              = 4
*   CAN_NOT_ACCESS             = 5
*   READ_ERROR                 = 6
*   TYPE_NO_MATCH              = 7
*   OTHERS                     = 8
               .
     IF sy-subrc <> 0.
       MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
     ELSE.
       LOOP AT gt_soli  INTO gs_soli.


         APPEND gs_soli TO gt_soli_total.
       ENDLOOP.
     ENDIF.
   ENDLOOP.

   IF lv_otf EQ 'X'.
     LOOP AT gt_soli_total INTO gs_soli_total.
       gs_otf = gs_soli_total.
       APPEND gs_otf TO gt_otf.
     ENDLOOP.


     CALL FUNCTION 'CONVERT_OTF_2_PDF'
      EXPORTING
        use_otf_mc_cmd               = 'X'
*   ARCHIVE_INDEX                =
      IMPORTING
         bin_filesize                 = lv_filesize
       TABLES
         otf                          = gt_otf
         doctab_archive               = gt_doctab
         lines                        = gt_tline
      EXCEPTIONS
        err_conv_not_possible        = 1
        err_otf_mc_noendmarker       = 2
        OTHERS                       = 3
               .
     IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
     ENDIF.

     GET PARAMETER ID 'ZZ_USERDIR' FIELD h_userdir.
     .

     CALL FUNCTION 'Z_SAPWORKDIR'
       IMPORTING
         e_sapworkdir = h_workdir.



     IF h_userdir <> ''.
       CONCATENATE h_userdir 'bestand.pdf' INTO p_file.
     ELSE.
       IF h_workdir <> ''.
         CONCATENATE h_workdir '\bestand.pdf' INTO p_file.
       ELSE.
         CONCATENATE 'c:\temp\' 'bestand.pdf' INTO p_file.
       ENDIF.
     ENDIF.

     download = 'X'.

     numbytes = lv_filesize.

     PERFORM download_w_ext(rstxpdft) TABLES gt_tline
                                      USING p_file
                                            '.pdf'
                                            'BIN'
                                            numbytes
                                            cancel.
     IF cancel = space.
       WRITE: / numbytes, 'Bytes heruntergeladen in Datei'(009), p_file.
     ENDIF.
     .

   ENDIF.

kind regards

arthur

former_member215424
Active Participant
0 Kudos
824

Hi Arthur,

//if you have 1 spool with 5 copies then those copies are identical.

if in the copies something has changed like original duiplicate triplicate etc than I guess it should be different spools unless you put the setting to combine spools to one spool ?

do you say that you have 1 spool which shows 1 page with 5 copies but when you look at the spool you can scroll through 5 pages where every page has a different word on it like original , duplicate ?

Yes, your understanding is correct.

//but if you have put that setting than the RSTXPDFT4 must work.

It doesn't work.Because this program is reading OTF data as shown below :

// -> this marks the beginning of OTF file

-

- (commands and texts in the printout)

-

- ORIGINAL COPY

-

- DUPLICATE COPY

-

-TRIPLICATE COPY

-

- EXTRA COPY1

-

-EXTRA COPY2

----- etc with data in unreadable format

-

// -> marks the end of file.

as you can see all the texts are in a single OTF table, because of which there is one spool.

I will try the solution you have mentioned above. Thanks

Regards,

Shruti

former_member215424
Active Participant
0 Kudos
825

Solved.

Changed the printer name to PDFCreator in the print pop up , thus able to download all the five copies as a single PDF file.

0 Kudos
824

"PDFCreator" is a system or standard printer like LP01??  Please dont mark such answers as Correct......

!! ALERT MODERATOR !!

0 Kudos
824

PDFCreator is a fairly well known free utility for printing as PDF. If you have it set up as a local printer, it will solve the problem very well.