Saturday 3 January 2015

Need to Convert Spool Request(OTF Script) Into PDF!

------------------------------------------------------------------------------------------------------------------------------
To convert Spool request to PDF, standard program - RSTXPDFT4 can be refereed.

Step1. So here for a billing document output is generated. can be seen in Tcode- VF02 or VF03. Click on output button.

Step2. Select the line and then select Processing Log.

Step3. So here we have the Spool request number for the billing doc number.

Step4. go to Tx- SP01 to get the spool details.






 


Step5. Execute it.

Step6. So here we have the spool number . Click on the arrow mark button.

Step7. So here the output which is generated after smart form is processed. 

Step8. So here table that contains the spool details.

Step9. So here the program that reads the given spool and converts it to PDF and downloads into a destination as per given in the local machine.
---------------------------------------------------------------------------------------------------------------------------------

PARAMETERS spool_no TYPE tsp01-rqident DEFAULT '3168',
                                                      

                    path TYPE string DEFAULT 'C:\Users\Documents\DOWNLOAD\SPOOL.PDF'.
DATA ls_spool TYPE tsp01,
            lt_pdf TYPE TABLE OF tline,
            objtype LIKE rststype-type,
            file_size TYPE i.

START-OF-SELECTION.

  SELECT SINGLE FROM tsp01 INTO ls_spool WHERE rqident spool_no.
  IF sy-subrc IS INITIAL .
    CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
      EXPORTING
        client        ls_spool-rqclient
        name          ls_spool-rqo1name
        part          1
      IMPORTING
        objtype       objtype " says whether OTF or other format
      EXCEPTIONS
        fb_error      1
        fb_rsts_other 2
        no_object     3
        no_permission 4.

    IF objtype(3'OTF'.
      CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF' " convert OTF to PDF format
        EXPORTING
          src_spoolid              ls_spool-rqident " spool number
          no_dialog                ' '
        IMPORTING
          pdf_bytecount        file_size
*         OTF_PAGECOUNT            =
        TABLES
          pdf                      lt_pdf.



    CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
         bin_filesize                    file_size
         filename                        path
         filetype                        'BIN'
        TABLES
          data_tab                        lt_pdf.

    ENDIF.
  ENDIF.

------------------------------------------------------------------------------------------------------------------------
Step10. Here is the destination  location.

Step11. Execute the above program with below inputs.

Step12. So after the program execution finish we have the status message.

Step13. Go to the destination folder and here we have a PDF file. Open it.

Step14. The spool OTF is converted in to PDF and displayed.

------------------------------------------------------------------------------------------------------------------------------------

No comments:

Comments system

Disqus Shortname