Converting the spool request to PDF format

Dear All ,
I am using RSTXPDF4 to convert a spool request to PDF format , when I execute this program by giving the spool number and dstdevic as Local , its giving   the message as " Spool request XXXXX with PDF data created ".
But the problem is when I open this spool request its printing the Junk characters ..!!!
What could be the problem ?
Please give me the solution for this...
Thanks in advance.

Hi Prem ,
I have checked the tranx SCOT there I have  found the following settings..
Output  Dev Type              USE
format
PCL     HPLJIIID     Not Yet Used in Node Maintenance
PDF     PDF1             Already Used in Node Maintenance
PS     POST2             Not Yet Used in Node Maintenance
TXT     ASCIIPRI     Already Used in Node Maintenance
Is this OK ...or am I need to do any changes in the settings...??
One more thing when I tries to give this PDF1 Dev type in my RSTXPDF4 input parameters its not taking !!!
Please help...

Similar Messages

  • Converting the WAD applications into PDF format

    Hi SAPians,
    I'm in need to convert WAD results into PDF Format using SAP BW 3.5 and Acrobat Reader 7.0. And I've referred some documents in Net, But,they gave ideas only for 3.5 and Acorobat 5 version.
    But i've to convert the WAD results into PDF format only by using Acrobat Reader 7.0. So, kindly let me know the steps to do so.
    Thanks in Advance.
    Jayaprakash J

    Hi Shahid syed,
    Thanks for your reply.
    It was very useful.
    But, i've askd the solution for sap bw 3.5 with Acrobat reader 7.0.
    So, plz let me knw if any solutions for that to make wad reports into pdf format.
    Points will be awarded.
    Thanks & Regards
    Jayaprakash J

  • Problem in converting Spool Request into PDF format

    Hi,
      I am facing problem to convert spool request (which store output of sap script) in to PDF format. Actually I have converted it with function module 'CONVERT_OTFSPOOLJOB_2_PDF' and it is working properly but the problem occurs where the BOLD fonts are used. I am unable to see the Text/Address where i have used Bold Font in script (PDF FORMAT). Even though in (SPO1) spool request shows every thing perfectly (along with Bold Font). It will great if you could suggest me something.
    Thanks,
    Pradeep

    Hi Pradeep,
    Use ,
    Closing the Sapscript, we save data (OTF) in a table
    CALL FUNCTION 'CLOSE_FORM'
    TABLES
    otfdata = t_otfdata
    EXCEPTIONS
    unopened = 1
    bad_pageformat_for_print = 2
    send_error = 3
    spool_error = 4
    OTHERS = 5.
    DATA: BEGIN OF t_otfdata2 OCCURS 0.
    INCLUDE STRUCTURE solisti1.
    DATA: END OF t_otfdata2.
    Move OTF data to another table with lenght 255
    LOOP AT t_otfdata.
    CONCATENATE t_otfdata-tdprintcom t_otfdata-tdprintpar INTO t_otfdata2.
    APPEND t_otfdata2.
    ENDLOOP.
    Convert OTF format to PDF
    CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
    EXPORTING
    format_src = 'OTF'
    format_dst = 'PDF'
    devtype = 'PRINTER'
    FUNCPARA =
    len_in = len_in
    IMPORTING
    len_out = len_out
    TABLES
    content_in = t_otfdata2
    content_out = t_pdfdata
    EXCEPTIONS
    err_conv_failed = 1
    OTHERS = 2.
    Have a look at Progs. RSTXPDF4 and RSTXPDFT2 for converting the Spool to PDF.
    Regards,
    Raj
    Message was edited by: Rajasekhar Dinavahi
    Message was edited by: Rajasekhar Dinavahi

  • How to convert spool request to pdf format (to send mail) - SAP 3.1H

    Hi,
       I am working in 3.1H version. How to convert spool request into pdf cormat to send a mail?. Spool request is in TEXT format.
    regards,
    sundaram J.

    Hi sundaram,
    1. I suppose u know how to send
        mail with attachment.
    2. If that is the case,
       then no need to do anything.
    3. Bcos
       There is setting in SCOT,
       for INTERNET
       ABAP List ---> PDF
       Raw TEXT  -
    PDF
      (Your basis team will help u)
    4.  text data will get automatically converted
       to pdf and get mailed.
    regards,
    amit m.

  • Saving spool request  in PDF format  using background job

    Hi,
    We have some important jobs which create spool requests. My requirement is to save those spool requests either on front end  or on application server in pdf format. I tried with  program RSTXPDF4 but i can save those files only when pdf conversion is done online and I want it to run in background  as some of the spool request have more then 3000 pages and also i'm not looking for ABAP development.
    It is fine with me to save it in text format but some of the spool request have around 3000 pages and  i cannot save the whole request in one shot using option system->list->save->local file
    It is appreciated if someone has any alternative for the above one.
    Regards,
    Chaitanya

    Hi,
    Just check Is it solve your purpose... When you are creating background jobs mention your email / user id as spool list recipient...
    I think you will recv. the spool output in the mailbox in pdf
    Edited by: Mrinal Das on Jan 3, 2011 2:37 PM

  • Small font size in converting spool request to pdf format

    Dear All,
    Every month after payroll run, the payslips are converted to pdf format with the help of standard program 'RSTXPDFT4'. But now when we are converting the file to pdf, the font size is coming too small to be read, though there is no truncation of data. No changes have been made recently and earlier it used to work fine.
    Please suggest how do I rectify this problem.
    Regards,
    Kanupriya

    Hi Soumyaprakash,
    Earlier when % size of pdf was 75 then also we got a clear view but now we have to go as high as 150% to get it readable. Even the printout is not readable.
    Please let me know how to check the font size. Also could this problem be due to some Basis setting?
    Regards,
    Kanupriya

  • Converting spool request into PDF forms

    Hi gurus
    i am working on upgrade project from 4.6C to ECC 6.0. Business had the functionality developed in 4.6C to " Convert the spool request into PDF forms and can be downloaded into local PC".
    Moving to ECC 6.0, is there any standard functionality available in ECC 6.0 to "Convert spool request to PDF forms and download"?
    Any help towards this is appreciable.
    Thanks
    Aleem

    Hello,
    Yes. The program is RSTXPDFT4.
    Sourabh

  • How to print the spool request with a given file name.

    Dear Experts;
    I used FM RSPO_OUTPUT_SPOOL_REQUEST to print spool request. And the device type is a local pdf printer. By default, the download file name will be the spool id. How can I change the download file name? Thanks!
    Convert 'CutePrinter' to qualify the format.
      CALL FUNCTION 'CONVERSION_EXIT_SPDEV_INPUT'
        EXPORTING
          input  = 'CutePrinter'
        IMPORTING
          output = lv_device.
    Downloading as pdf by printer
      CALL FUNCTION 'RSPO_OUTPUT_SPOOL_REQUEST'
        EXPORTING
          device                         = lv_device
          spool_request_id               = pa_spool
       EXCEPTIONS
         archive_dest_invalid           = 1
         archive_dest_not_found         = 2
         archive_dest_no_right          = 3
         cannot_archive                 = 4
         change_archdest_no_right       = 5
         change_copies_no_right         = 6
         change_dest_no_right           = 7
         change_devtype_no_right        = 8
         change_prio_no_right           = 9
         change_telenum_no_right        = 10
         change_title_no_right          = 11
         dest_invalid                   = 12
         dest_not_found                 = 13
         dest_no_right                  = 14
         internal_problem               = 15
         invalid_fax_attribute          = 16
         invalid_parameters             = 17
         non_owner_no_right             = 18
         no_layout                      = 19
         no_spool_request               = 20
         out_again_no_right             = 21
         spooler_problem                = 22
         OTHERS                         = 23

    SELECT SINGLE * FROM tsp01 into rq WHERE rqident = p_spool  .
    *   To get attributes of spool request
    CALL FUNCTION 'RSPO_GET_ATTRIBUTES_SPOOLJOB'
        EXPORTING
          rqident     = p_spool             "Spool Request Number
        IMPORTING
          rq          = rq                                 "Consists the Spool Document Type Details
        TABLES
          attributes = dummy
        EXCEPTIONS
          no_such_job = 1
          OTHERS      = 2.
      IF sy-subrc <> 0.
      ENDIF.
    *Convert spool request into PDF, dependent on document type
    IF rq-rqdoctype = 'OTF' OR rq-rqdoctype = 'SMART'.    "Doc Type is of Sap Script or Smart form
        CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
          EXPORTING
            src_spoolid              = p_spool               "Spool Request Number
            no_dialog                = 'X'
            pdf_destination          = 'X'
            no_background            = 'X'
          IMPORTING
            pdf_bytecount            = bin_size
            bin_file                 = pdf_xstring                  "This fm will convert the spool data into
         TABLES
            pdf                      = it_pdf   .                                                                       "PDF Format in this importing string
      ELSEIF rq-rqdoctype = 'LIST'.                 "Doc Type of List
    * Convert spool to PDF
        CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
          EXPORTING
            src_spoolid              = p_spool               "Spool Request Number
            no_dialog                = ' '
            dst_device               = 'LOCL'
            pdf_destination          = 'X'
            no_background            = 'X'
          IMPORTING
            pdf_bytecount            = bin_size
            bin_file                 = pdf_xstring                     "This fm will convert the spool data into
                                                                                  "PDF Format in this importing string
          TABLES
            pdf                      = it_pdf.
        ENDIF.
    *      Downloading file to p_file loation in PDF foramt
          CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
              bin_filesize            = bin_size
              filename                = w_filename     "Custom File name
              filetype                = 'BIN'
            TABLES
              data_tab                = it_pdf
    Prabhudas

  • Convert Spool request to PDF and send as e-mail

    Hi all,
    Can any one please provide me a  sample code for converting spool request to pdf?
    Thanks in advance,
    Suneela.

    HI,
    Try this
    Hi all,
    Can any one please provide me a  sample code for converting spool request to pdf?
    *& Report  ZSPOOLTOPDF                                                 *
    *& Converts spool request into PDF document and emails it to           *
    *& recipicant.                                                         *
    *& Execution                                                           *
    *& This program must be run as a background job in-order for the write *
    *& commands to create a Spool request rather than be displayed on      *
    *& screen                                                              *
    REPORT  zspooltopdf.
    PARAMETER: p_email1 LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_sender LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_delspl  AS CHECKBOX.
    *DATA DECLARATION
    DATA: gd_recsize TYPE i.
    Spool IDs
    TYPES: BEGIN OF t_tbtcp.
            INCLUDE STRUCTURE tbtcp.
    TYPES: END OF t_tbtcp.
    DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
          wa_tbtcp TYPE t_tbtcp.
    Job Runtime Parameters
    DATA: gd_eventid LIKE tbtcm-eventid,
          gd_eventparm LIKE tbtcm-eventparm,
          gd_external_program_active LIKE tbtcm-xpgactive,
          gd_jobcount LIKE tbtcm-jobcount,
          gd_jobname LIKE tbtcm-jobname,
          gd_stepcount LIKE tbtcm-stepcount,
          gd_error    TYPE sy-subrc,
          gd_reciever TYPE sy-subrc.
    DATA:  w_recsize TYPE i.
    DATA: gd_subject   LIKE sodocchgi1-obj_descr,
          it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          gd_sender_type     LIKE soextreci1-adr_typ,
          gd_attachment_desc TYPE so_obj_nam,
          gd_attachment_name TYPE so_obj_des.
    Spool to PDF conversions
    DATA: gd_spool_nr LIKE tsp01-rqident,
          gd_destination LIKE rlgrap-filename,
          gd_bytecount LIKE tst01-dsize,
          gd_buffer TYPE string.
    Binary store for PDF
    DATA: BEGIN OF it_pdf_output OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA: END OF it_pdf_output.
    CONSTANTS: c_dev LIKE  sy-sysid VALUE 'DEV',
               c_no(1)     TYPE c   VALUE ' ',
               c_device(4) TYPE c   VALUE 'LOCL'.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    Write statement to represent report output. Spool request is created
    if write statement is executed in background. This could also be an
    ALV grid which would be converted to PDF without any extra effort
      WRITE 'Hello World'.
      new-page.
      commit work.
      new-page print off.
      IF sy-batch EQ 'X'.
        PERFORM get_job_details.
        PERFORM obtain_spool_id.
    Alternative way could be to submit another program and store spool
    id into memory, will be stored in sy-spono.
    *submit ZSPOOLTOPDF2
           to sap-spool
           spool parameters   %_print
           archive parameters %_print
           without spool dynpro
           and return.
    Get spool id from program called above
    IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
        PERFORM convert_spool_to_pdf.
        PERFORM process_email.
        if p_delspl EQ 'X'.
          PERFORM delete_spool.
        endif.
        IF sy-sysid = c_dev.
          wait up to 5 seconds.
          SUBMIT rsconn01 WITH mode   = 'INT'
                          WITH output = 'X'
                          AND RETURN.
        ENDIF.
      ELSE.
        SKIP.
        WRITE:/ 'Program must be executed in background in-order for spool',
                'request to be created.'.
      ENDIF.
          FORM obtain_spool_id                                          *
    FORM obtain_spool_id.
      CHECK NOT ( gd_jobname IS INITIAL ).
      CHECK NOT ( gd_jobcount IS INITIAL ).
      SELECT * FROM  tbtcp
                     INTO TABLE it_tbtcp
                     WHERE      jobname     = gd_jobname
                     AND        jobcount    = gd_jobcount
                     AND        stepcount   = gd_stepcount
                     AND        listident   <> '0000000000'
                     ORDER BY   jobname
                                jobcount
                                stepcount.
      READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
      IF sy-subrc = 0.
        message s004(zdd) with gd_spool_nr.
        gd_spool_nr = wa_tbtcp-listident.
        MESSAGE s004(zdd) WITH gd_spool_nr.
      ELSE.
        MESSAGE s005(zdd).
      ENDIF.
    ENDFORM.
          FORM get_job_details                                          *
    FORM get_job_details.
    Get current job details
      CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
           IMPORTING
                eventid                 = gd_eventid
                eventparm               = gd_eventparm
                external_program_active = gd_external_program_active
                jobcount                = gd_jobcount
                jobname                 = gd_jobname
                stepcount               = gd_stepcount
           EXCEPTIONS
                no_runtime_info         = 1
                OTHERS                  = 2.
    ENDFORM.
          FORM convert_spool_to_pdf                                     *
    FORM convert_spool_to_pdf.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = gd_spool_nr
                no_dialog                = c_no
                dst_device               = c_device
           IMPORTING
                pdf_bytecount            = gd_bytecount
           TABLES
                pdf                      = it_pdf_output
           EXCEPTIONS
                err_no_abap_spooljob     = 1
                err_no_spooljob          = 2
                err_no_permission        = 3
                err_conv_not_possible    = 4
                err_bad_destdevice       = 5
                user_cancelled           = 6
                err_spoolerror           = 7
                err_temseerror           = 8
                err_btcjob_open_failed   = 9
                err_btcjob_submit_failed = 10
                err_btcjob_close_failed  = 11
                OTHERS                   = 12.
      CHECK sy-subrc = 0.
    Transfer the 132-long strings to 255-long strings
      LOOP AT it_pdf_output.
        TRANSLATE it_pdf_output USING ' ~'.
        CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
      ENDLOOP.
      TRANSLATE gd_buffer USING '~ '.
      DO.
        it_mess_att = gd_buffer.
        APPEND it_mess_att.
        SHIFT gd_buffer LEFT BY 255 PLACES.
        IF gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    ENDFORM.
          FORM process_email                                            *
    FORM process_email.
      DESCRIBE TABLE it_mess_att LINES gd_recsize.
      CHECK gd_recsize > 0.
      PERFORM send_email USING p_email1.
    perform send_email using p_email2.
    ENDFORM.
          FORM send_email                                               *
    -->  p_email                                                       *
    FORM send_email USING p_email.
      CHECK NOT ( p_email IS INITIAL ).
      REFRESH it_mess_bod.
    Default subject matter
      gd_subject         = 'Subject'.
      gd_attachment_desc = 'Attachname'.
    CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
      it_mess_bod        = 'Message Body text, line 1'.
      APPEND it_mess_bod.
      it_mess_bod        = 'Message Body text, line 2...'.
      APPEND it_mess_bod.
    If no sender specified - default blank
      IF p_sender EQ space.
        gd_sender_type  = space.
      ELSE.
        gd_sender_type  = 'INT'.
      ENDIF.
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_mess_bod
                                          it_mess_att
                                    using p_email
                                          'Example .xls documnet attachment'
                                          'PDF'
                                          gd_attachment_name
                                          gd_attachment_desc
                                          p_sender
                                          gd_sender_type
                                 changing gd_error
                                          gd_reciever.
    ENDFORM.
          FORM delete_spool                                             *
    FORM delete_spool.
      DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
      ld_spool_nr = gd_spool_nr.
      CHECK p_delspl <> c_no.
      CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
           EXPORTING
                spoolid = ld_spool_nr.
    ENDFORM.
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          Send email
    FORM send_file_as_email_attachment tables it_message
                                              it_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                              p_sender_address
                                              p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      DATA: ld_error    TYPE sy-subrc,
            ld_reciever TYPE sy-subrc,
            ld_mtitle LIKE sodocchgi1-obj_descr,
            ld_email LIKE  somlreci1-receiver,
            ld_format TYPE  so_obj_tp ,
            ld_attdescription TYPE  so_obj_nam ,
            ld_attfilename TYPE  so_obj_des ,
            ld_sender_address LIKE  soextreci1-receiver,
            ld_sender_address_type LIKE  soextreci1-adr_typ,
            ld_receiver LIKE  sy-subrc.
    data:   t_packing_list like sopcklsti1 occurs 0 with header line,
            t_contents like solisti1 occurs 0 with header line,
            t_receivers like somlreci1 occurs 0 with header line,
            t_attachment like solisti1 occurs 0 with header line,
            t_object_header like solisti1 occurs 0 with header line,
            w_cnt type i,
            w_sent_all(1) type c,
            w_doc_data like sodocchgi1.
      ld_email   = p_email.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      ld_sender_address      = p_sender_address.
      ld_sender_address_type = p_sender_addres_type.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = it_attach[].
    Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_receivers
           EXCEPTIONS
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                OTHERS                     = 8.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.
    Reward points if found helpfull....
    Venkoji.

  • Convert the spool to xls format and email through attachment to the user

    Hi all,
    When I execute a report in background, I get spool. I need to convert the spool to xls format and email through attachment to the user.The xls file should not be saved on local system.
    If I use the Spool Recepient tab in SM37 it mails the spool list as .txt file to the mail receipient. But I need to send it as an .xls file.
    Can any one help me on this

    Did you get the solution? i have the same problem.

  • The online conversion of my pdf file to word did not correctly convert the tables and certain other formatting.  I wish to obtain a refund.

    The online conversion of my pdf file to word did not correctly convert the tables and certain other formatting.  I wish to obtain a refund.

    Hi yammyamm,
    I'm sorry that your conversion didn't work out for you. Please contact Adobe Customer Support via phone or chat, and an agent will be able to process that cancellation/refund for you. Here is the contact information: Contact Customer Care
    Best,
    Sara

  • How to convert message in XI into PDF format

    Hi,
    I am trying out a scenario where i am getting an idoc from SAP into XI and now in XI i need to convert the data into pdf format and send that pdf in a mail using mail adapter.
    Can any body help me out how to convert a message in XI to pdf format.
    Thanks in Advance!!
    Regards,
    Sudheer

    Hi Sudheer
    follow these links
    http://www.erpgenie.com/sap/sapedi/Conversion%20of%20IDOCs%20to%20XML%20format.pdf
    Here is the complete code for you;
    It Converts spool request into PDF document and emails it.
    http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
    Smartform as attachment in mail. - 46k
    http://sap.ittoolbox.com/groups/technical-functional/sap-dev/convert-smartforms-form-in-pdf-998715 - 87k
    SMART form to PDF
    https://wiki.sdn.sap.com/wiki/display/Snippets/ConvertSmartformtoPDFformat
    smartform to MAIL
    https://wiki.sdn.sap.com/wiki/display/Snippets/SmartformtoMailasPDF+attachment
    Regards
    Sandeep Sharma
    PS: if helpful kindly reward points

  • Splitting the Spool Request for Form Printing

    Hello,
    I have a requirement where I need to print data for 1500 employees (1 Page per employee) which makes 1500 pages per spool request. Now, there is a change in the printer due to which the printer only accepts only 300 pages in the buffer. So, after printing 300 pages, it stops. Is there any way I can split the spool request and generate 5 spool requests (1 request for every 300 pages) so that all the pages are printed at once? Please let me know.
    Regards,
    Venkata Phani Prasad Konduri

    i have created a program using which you can create multiple pdf from a single spool number
    first in the code below i have taken a spool number which has 2 pages in it.
    second you must use the FM : RSPO_RETURN_SPOOLJOB  in the program to get the content of the spool .  while to perform analysis on how to build logic to split the spool otf/pdf user the FM RSPO_DISPLAY_SPOOLJOB, here by passing the spool number you will get the content in display mode and then based on the keyword you will build logic for e.g in my case i have to perform segregation based on material number so it can be used to decide how many pages are reserved by a specific material number.
    another important point to kept in mind is that otf begins with "//"  and a page ends with "EP" and last page ends with  "//" along with "EP". It can be used to remove the number of lines to keep specific pages .
    program layout as with proper documentation has been provided.
    REPORT  zdk_spool_split.
    * DATA DECLARATION.
    TYPES : tbuf LIKE tline OCCURS 1.
    FIELD-SYMBOLS: <buf> TYPE tbuf.
    FIELD-SYMBOLS : <lit_otf> TYPE ANY TABLE.
    DATA : lit_otf TYPE STANDARD TABLE OF itcoo.
    DATA : objcont LIKE soli  OCCURS 0 WITH HEADER LINE.
    DATA : format(5) TYPE c, dummy TYPE i.
    DATA : buffer_pdf TYPE STANDARD TABLE OF tline.
    DATA : p_file LIKE rlgrap-filename VALUE 'C:\temp\file1.pdf'. "#EC NOTEXT
    DATA : numbytes TYPE i VALUE 255.
    DATA : cancel.
    DATA : otfcmd LIKE itcoo VALUE '//'.
    DATA : pdfcnv_archive_index LIKE toa_dara.
    DATA : bin_file TYPE xstring,
            pdf_username TYPE c.
    * GET THE SPOOL NUMBER FROM THE USER.
    PARAMETERS : p_sid TYPE tsp01-rqident OBLIGATORY.
    * GET THE CONTENT OF THE SPOOL NUMBER
    CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
       EXPORTING
         rqident              = p_sid
       TABLES
         buffer               = objcont
       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.
    ENDIF.
    * INCORPORATE YOUR LOGIC TO DELETE LINES WHICH ARE NOT REQUIRED.
    * IN MY CASE I HAVE REMOVED LINES FROM 351 TO 715 TO REMOVE THE SECOND PAGE FROM MY SPOOL
    * MY OBJCONT AFTER DELTED BEGINS WITH "//" AND ENDS WITH "EP" AND "//"
    DELETE objcont[] FROM 351 TO 715.
    * IT ONLY CONTAINS ONE PAGE OUT OF 2 PAGES FROM THE SPOOL NUMBER I HAVE PROVIDED.
    * CONVERT OTF TO PDF
    lit_otf = objcont[]. " GET THE OTF IN CORRECT OTF FORMAT
    ASSIGN buffer_pdf TO <buf>.
    format = 'PDF'. " CHOOSE THE CORRECT FORMAT IE PDF MUST FOR CONVERSION
    CALL FUNCTION 'CONVERT_OTF'
       EXPORTING
         format                = format
       IMPORTING
         bin_filesize          = dummy
       TABLES
         otf                   = lit_otf
         lines                 = <buf>
       EXCEPTIONS
         err_max_linewidth     = 1
         err_format            = 2
         err_conv_not_possible = 3
         OTHERS                = 4.
    IF sy-subrc IS NOT INITIAL.
       MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    * GET THE NUMBYTES OF THE PDF CONTENT OBTAINED AFTER THE CONVERSION
    * CORRECT NUMBYTE IS VERY IMPORTANT OTHERWISE IT WILL NOT GENERATE
    * PDF IN CORRECT FORMAT.
    PERFORM convert_otf2pdf_end(rstxcpdf) TABLES <buf>
                                           USING otfcmd
                                                 numbytes
                                                 pdfcnv_archive_index
                                                 bin_file
                                                 pdf_username.
    * NOW DOWNLOAD THE PDF TO VIEW IN ACTUAL PDF AT DESIRED PATH
    PERFORM download_w_ext(rstxpdft) TABLES <buf>
                                      USING p_file
                                            '.pdf'
                                            'BIN'
                                            numbytes
                                            cancel.

  • How can I convert a report/ ALV in PDF format?

    Can you tell me how can I convert a report or ALV in PDF format?
    Regards,
    Subhasish

    hi ,
    check this..
    *& Report  ZSPOOLTOPDF                                                 *
    *& Converts spool request into PDF document and emails it to           *
    *& recipicant.                                                         *
    *& Execution                                                           *
    *& This program must be run as a background job in-order for the write *
    *& commands to create a Spool request rather than be displayed on      *
    *& screen                                                              *
    REPORT  zspooltopdf.
    PARAMETER: p_email1 LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_sender LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_delspl  AS CHECKBOX.
    *DATA DECLARATION
    DATA: gd_recsize TYPE i.
    Spool IDs
    TYPES: BEGIN OF t_tbtcp.
            INCLUDE STRUCTURE tbtcp.
    TYPES: END OF t_tbtcp.
    DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
          wa_tbtcp TYPE t_tbtcp.
    Job Runtime Parameters
    DATA: gd_eventid LIKE tbtcm-eventid,
          gd_eventparm LIKE tbtcm-eventparm,
          gd_external_program_active LIKE tbtcm-xpgactive,
          gd_jobcount LIKE tbtcm-jobcount,
          gd_jobname LIKE tbtcm-jobname,
          gd_stepcount LIKE tbtcm-stepcount,
          gd_error    TYPE sy-subrc,
          gd_reciever TYPE sy-subrc.
    DATA:  w_recsize TYPE i.
    DATA: gd_subject   LIKE sodocchgi1-obj_descr,
          it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          gd_sender_type     LIKE soextreci1-adr_typ,
          gd_attachment_desc TYPE so_obj_nam,
          gd_attachment_name TYPE so_obj_des.
    Spool to PDF conversions
    DATA: gd_spool_nr LIKE tsp01-rqident,
          gd_destination LIKE rlgrap-filename,
          gd_bytecount LIKE tst01-dsize,
          gd_buffer TYPE string.
    Binary store for PDF
    DATA: BEGIN OF it_pdf_output OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA: END OF it_pdf_output.
    CONSTANTS: c_dev LIKE  sy-sysid VALUE 'DEV',
               c_no(1)     TYPE c   VALUE ' ',
               c_device(4) TYPE c   VALUE 'LOCL'.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    Write statement to represent report output. Spool request is created
    if write statement is executed in background. This could also be an
    ALV grid which would be converted to PDF without any extra effort
      WRITE 'Hello World'.
      new-page.
      commit work.
      new-page print off.
      IF sy-batch EQ 'X'.
        PERFORM get_job_details.
        PERFORM obtain_spool_id.
    Alternative way could be to submit another program and store spool
    id into memory, will be stored in sy-spono.
    *submit ZSPOOLTOPDF2
           to sap-spool
           spool parameters   %_print
           archive parameters %_print
           without spool dynpro
           and return.
    Get spool id from program called above
    IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
        PERFORM convert_spool_to_pdf.
        PERFORM process_email.
        if p_delspl EQ 'X'.
          PERFORM delete_spool.
        endif.
        IF sy-sysid = c_dev.
          wait up to 5 seconds.
          SUBMIT rsconn01 WITH mode   = 'INT'
                          WITH output = 'X'
                          AND RETURN.
        ENDIF.
      ELSE.
        SKIP.
        WRITE:/ 'Program must be executed in background in-order for spool',
                'request to be created.'.
      ENDIF.
          FORM obtain_spool_id                                          *
    FORM obtain_spool_id.
      CHECK NOT ( gd_jobname IS INITIAL ).
      CHECK NOT ( gd_jobcount IS INITIAL ).
      SELECT * FROM  tbtcp
                     INTO TABLE it_tbtcp
                     WHERE      jobname     = gd_jobname
                     AND        jobcount    = gd_jobcount
                     AND        stepcount   = gd_stepcount
                     AND        listident   <> '0000000000'
                     ORDER BY   jobname
                                jobcount
                                stepcount.
      READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
      IF sy-subrc = 0.
        message s004(zdd) with gd_spool_nr.
        gd_spool_nr = wa_tbtcp-listident.
        MESSAGE s004(zdd) WITH gd_spool_nr.
      ELSE.
        MESSAGE s005(zdd).
      ENDIF.
    ENDFORM.
          FORM get_job_details                                          *
    FORM get_job_details.
    Get current job details
      CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
           IMPORTING
                eventid                 = gd_eventid
                eventparm               = gd_eventparm
                external_program_active = gd_external_program_active
                jobcount                = gd_jobcount
                jobname                 = gd_jobname
                stepcount               = gd_stepcount
           EXCEPTIONS
                no_runtime_info         = 1
                OTHERS                  = 2.
    ENDFORM.
          FORM convert_spool_to_pdf                                     *
    FORM convert_spool_to_pdf.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = gd_spool_nr
                no_dialog                = c_no
                dst_device               = c_device
           IMPORTING
                pdf_bytecount            = gd_bytecount
           TABLES
                pdf                      = it_pdf_output
           EXCEPTIONS
                err_no_abap_spooljob     = 1
                err_no_spooljob          = 2
                err_no_permission        = 3
                err_conv_not_possible    = 4
                err_bad_destdevice       = 5
                user_cancelled           = 6
                err_spoolerror           = 7
                err_temseerror           = 8
                err_btcjob_open_failed   = 9
                err_btcjob_submit_failed = 10
                err_btcjob_close_failed  = 11
                OTHERS                   = 12.
      CHECK sy-subrc = 0.
    Transfer the 132-long strings to 255-long strings
      LOOP AT it_pdf_output.
        TRANSLATE it_pdf_output USING ' ~'.
        CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
      ENDLOOP.
      TRANSLATE gd_buffer USING '~ '.
      DO.
        it_mess_att = gd_buffer.
        APPEND it_mess_att.
        SHIFT gd_buffer LEFT BY 255 PLACES.
        IF gd_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    ENDFORM.
          FORM process_email                                            *
    FORM process_email.
      DESCRIBE TABLE it_mess_att LINES gd_recsize.
      CHECK gd_recsize > 0.
      PERFORM send_email USING p_email1.
    perform send_email using p_email2.
    ENDFORM.
          FORM send_email                                               *
    -->  p_email                                                       *
    FORM send_email USING p_email.
      CHECK NOT ( p_email IS INITIAL ).
      REFRESH it_mess_bod.
    Default subject matter
      gd_subject         = 'Subject'.
      gd_attachment_desc = 'Attachname'.
    CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
      it_mess_bod        = 'Message Body text, line 1'.
      APPEND it_mess_bod.
      it_mess_bod        = 'Message Body text, line 2...'.
      APPEND it_mess_bod.
    If no sender specified - default blank
      IF p_sender EQ space.
        gd_sender_type  = space.
      ELSE.
        gd_sender_type  = 'INT'.
      ENDIF.
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   tables it_mess_bod
                                          it_mess_att
                                    using p_email
                                          'Example .xls documnet attachment'
                                          'PDF'
                                          gd_attachment_name
                                          gd_attachment_desc
                                          p_sender
                                          gd_sender_type
                                 changing gd_error
                                          gd_reciever.
    ENDFORM.
          FORM delete_spool                                             *
    FORM delete_spool.
      DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
      ld_spool_nr = gd_spool_nr.
      CHECK p_delspl <> c_no.
      CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
           EXPORTING
                spoolid = ld_spool_nr.
    ENDFORM.
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          Send email
    FORM send_file_as_email_attachment tables it_message
                                              it_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                              p_sender_address
                                              p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      DATA: ld_error    TYPE sy-subrc,
            ld_reciever TYPE sy-subrc,
            ld_mtitle LIKE sodocchgi1-obj_descr,
            ld_email LIKE  somlreci1-receiver,
            ld_format TYPE  so_obj_tp ,
            ld_attdescription TYPE  so_obj_nam ,
            ld_attfilename TYPE  so_obj_des ,
            ld_sender_address LIKE  soextreci1-receiver,
            ld_sender_address_type LIKE  soextreci1-adr_typ,
            ld_receiver LIKE  sy-subrc.
    data:   t_packing_list like sopcklsti1 occurs 0 with header line,
            t_contents like solisti1 occurs 0 with header line,
            t_receivers like somlreci1 occurs 0 with header line,
            t_attachment like solisti1 occurs 0 with header line,
            t_object_header like solisti1 occurs 0 with header line,
            w_cnt type i,
            w_sent_all(1) type c,
            w_doc_data like sodocchgi1.
      ld_email   = p_email.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      ld_sender_address      = p_sender_address.
      ld_sender_address_type = p_sender_addres_type.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = it_attach[].
    Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_receivers
           EXCEPTIONS
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                OTHERS                     = 8.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.
    regards,
    venkat.

  • How to put the alv output into the spool request?

    Hi guys,
    How to put the alv output into the spool request?
    Thanks!

    Hi
    Sending an ALV List screen output to SPOOL
    Convert ALV list to PDF and send mails to respective persons
    Regards
    Pavan

Maybe you are looking for

  • Help me buy a new computer please :)

    Hi. I gonna buy a new computer soon. I've heard alot problems about Neo4 Plat and World of Warcraft which is the only game iam playing, and the only reason iam buying a new system. Can you please explaing your experience which WoW+Neo4 Plat ? I also

  • Table  for pegged requirement

    HI, I need to develop a report to  identify the pegged requirement against purchase requsition for the dependent requirements of low-level components. i have checked MD_PEGGING  and MD_PEGGING_NODIALOG but these FM are not suitable for my requirement

  • PRINT PARTICULAR CONDITION TYPE INTO OUTPUT FORM

    Hi experts, Thanks in advance, can somebody tell me that if particular condition type(Example:: ZDIS) is determine in sales document pricing then only system should print that condition Type(ZDIS) into Invoice output.(Here my we are using Smart form)

  • Does my boolean logic make sense?

    Hello. I am currently working on a linked list assignment, but for some reason my boolean doesn't seem to do what I want it to do. can someone take a look to see why I am getting a black screen? public boolean addEmployee(Employee newEmployee) //if t

  • Authorizations in role creation

    hi,           any body can help me. in which table the status of maintained, changed, satandard is available. suppose when we change the filedvalues of one object it will be maintained in one table and shows the changed and maintained status flags in