Problem: convert spool into PDF

Hi all,
I have written the report. It is used to convert the spool in to PDF file and it will send an email with attached document to the user.
Problem:
        When i open the PDF file. It display only the half of the report
       (i.e first 4 columns) remaining 3 columns are displayed.
If I see the spool no it display all the 7 columns.
Thnx in Ad

so problem with ur report only.So here u have to increase the width of the lines.
like this
<b>docdata-doc_size = ( tab_lines - 1 ) * 2560 + strlen( objtxt ).</b>
regards
Prabhu

Similar Messages

  • Problem converting MSWord into PDF with Acrobat 8.1

    I have a problem very similar to this. I also have a new laptop with WINDOWS Vista professional, MS Office 2007, and Acrobat Standard 8.1.
    The 'Create PDF' button in MSWord (and MSExcel, Powerpoint etc) does not work even for the simplest of Word file without any speacial character. Also if I try to convert the file from inside Adobe Acrobat using "Create PDF/From File...", I get the following message: "An unexpected error occurred. PDFMaker was unable to produce the Adobe PDF." The Acrobat printer is working fine.
    Any Remedy?

    See my answer to your duplicate posting
    http://www.adobeforums.com/webx/.59b4eeda/0

  • While converting spool to PDF marathi character shown as symbolic in PDF

    Hi guys,
    I have requirement to send payslip via mail.i have developed program everything working well.get payslip,create spool and convert spool to pdf is working well.But issue is while converting spool into PDF then marathi character display like special symbols in PDF (in payslip emp.name , emp location,designation,department are in Marathi).
    code as follow,
    CALL FUNCTION 'GET_PAYSLIP'
             EXPORTING
               EMPLOYEE_NUMBER = WA-PERNR
               SEQUENCE_NUMBER = WA_PC261-SEQNR
               PAYSLIP_VARIANT = FORMULAR                        " 'ZN01'
             IMPORTING
               RETURN          = RETURN
               P_INFO          = PINFO
             TABLES
               P_FORM          = PFORM.
           CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
            EXPORTING
                FORMNAME                 = 'ZHR_ESS_PAYSLIP_TO_PDF'
    *          VARIANT                  = ' '
    *          DIRECT_CALL              = ' '
           IMPORTING
                FM_NAME                  = FNAME.
    *     EXCEPTIONS
    *       NO_FORM                  = 1
    *       NO_FUNCTION_MODULE       = 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.
           SF_CONTROL_PARAMETERS-DEVICE = 'PRINTER'.
           SF_CONTROL_PARAMETERS-NO_DIALOG = 'X'.
           SF_OUTPUT_OPTIONS-TDNEWID       = 'X'.
           SF_CONTROL_PARAMETERS-LANGU     = SY-LANGU.
           SF_OUTPUT_OPTIONS-TDDEST  = 'LP01'.
    *      SF_OUTPUT_OPTIONS-tdprinter = 'PDFUC'.
           CALL FUNCTION FNAME "'/1BCDWB/SF00000499'
             EXPORTING
    *     ARCHIVE_INDEX              =
    *    ARCHIVE_INDEX_TAB          =
    *   ARCHIVE_PARAMETERS         =
         CONTROL_PARAMETERS         = SF_CONTROL_PARAMETERS
    *    MAIL_APPL_OBJ              =
    *    MAIL_RECIPIENT             =
    *    MAIL_SENDER                =
         OUTPUT_OPTIONS             = SF_OUTPUT_OPTIONS
         USER_SETTINGS              = ''
               PINFO                      = PINFO
               PFORM                      = PFORM
            IMPORTING
    *    DOCUMENT_OUTPUT_INFO       =
               JOB_OUTPUT_INFO            = JOB_OUTPUT_INFO
    *    JOB_OUTPUT_OPTIONS         =
            EXCEPTIONS
              FORMATTING_ERROR           = 1
              INTERNAL_ERROR             = 2
              SEND_ERROR                 = 3
              USER_CANCELED              = 4
              OTHERS                     = 5
           IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
           ENDIF.
           IF JOB_OUTPUT_INFO-SPOOLIDS IS NOT INITIAL.
             LOOP AT JOB_OUTPUT_INFO-SPOOLIDS INTO LV_SPOOL.
               EXIT.
             ENDLOOP.
             REFRESH IT_TY_TAB_PDF.
             CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
               EXPORTING
                 SRC_SPOOLID              = LV_SPOOL
                 NO_DIALOG                = ' '
               TABLES
                 PDF                      = IT_TY_TAB_PDF
               EXCEPTIONS
                 ERR_NO_OTF_SPOOLJOB      = 1
                 ERR_NO_SPOOLJOB          = 2
                 ERR_NO_PERMISSION        = 3
                 ERR_CONV_NOT_POSSIBLE    = 4
                 ERR_BAD_DSTDEVICE        = 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.
             IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
             ENDIF.
             APPEND LINES OF IT_TY_TAB_PDF TO IT_TY_TAB_PDF1..
    Please guys help on this issue.its urgent.

    i am doing this...
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = l_spool_nr1
                no_dialog                = 'X'
                dst_device               = 'LOCL'
           IMPORTING
                pdf_bytecount            = l_bytecount
                LIST_PAGECOUNT           = l_page1
           TABLES
                pdf                      = itab_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.
    now l_bytecount stores the total number of bytes in the internal table itab_pdf_output. The value of this differs when i run in foreground nad background seperately

  • URGENT -----  Problem in converting spool to pdf .

    Error - File cannot be opened because of no pages ......
    Hi experts,
    I am passing internal table contents to spool   -->  then spool to pdf  -
    >  then mail sending.
    Everything is fine but only error is in the receiving mail the above error is coming.
    given the code...
    <b>I think the error is in converting into pdf function module</b>
    <b>Help me to solve this problem as it is very urgent</b>
    include data_declare.       "  pasted down
    select * from kna1 into table itab up to 50 rows.
    CALL FUNCTION 'RSPO_OPEN_SPOOLREQUEST'
    EXPORTING
    dest = 'LP01'
    immediate_print = 'X'
    IMPORTING
    handle = handle
    SPOOLID = spoolid.
    loop at itab.
    concatenate itab-kunnr itab-name1 itab-land1 into text separated by
    space.
    CALL FUNCTION 'RSPO_WRITE_SPOOLREQUEST'
    EXPORTING
    handle = handle
    text =  text.
    endloop.
    CALL FUNCTION 'RSPO_CLOSE_SPOOLREQUEST'
    EXPORTING
    handle = handle.
    Convert Spool to PDF **********************************
      <b>CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = 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.</b>
    Processing Mail Sending ************************************
      DATA: p_email LIKE somlreci1-receiver,
            p_sender LIKE somlreci1-receiver,
            sub(40).
      DESCRIBE TABLE it_mess_att LINES gd_recsize.
      CHECK gd_recsize > 0.
      REFRESH it_mess_bod.
    Default subject matter
      gd_subject         = 'Subject'.
      gd_attachment_desc = text-002.
      it_mess_bod        = text-001.
      APPEND it_mess_bod.
      IF p_sender EQ space.
        gd_sender_type  = space.
      ELSE.
        gd_sender_type  = 'INT'.
      ENDIF.
      MOVE 'Orders Rejeced on' TO sub.
      WRITE: sy-datum DD/MM/YYYY TO sub+27(10).
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                                   TABLES it_mess_bod
                                          it_mess_att
                                    USING
                                         p_email
                                           sub                  "text-009
                                          'PDF'
                                           gd_attachment_name
                                           gd_attachment_desc
                                         p_sender
                                         gd_sender_type
                                 CHANGING gd_error
                                          gd_reciever.
    ENDFORM.                    " process_email
    *&      Form  send_file_as_email_attachment
          text
         -->P_IT_MESS_BOD  text
         -->P_IT_MESS_ATT  text
         -->P_TEXT_009  text
         -->P_1058   text
         -->P_GD_ATTACHMENT_NAME  text
         -->P_GD_ATTACHMENT_DESC  text
         <--P_GD_ERROR  text
         <--P_GD_RECIEVER  text
    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-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      CLEAR gt_mail.
      SELECT SINGLE * FROM zmail INTO gt_mail
                      WHERE grpnr = '1'.
      IF NOT gt_mail-mail1 IS INITIAL.
        t_receivers-receiver = gt_mail-mail1.
        APPEND t_receivers.
      ENDIF.
      IF NOT gt_mail-mail2 IS INITIAL.
        t_receivers-receiver = gt_mail-mail2.
        APPEND t_receivers.
      ENDIF.
      IF NOT gt_mail-mail3 IS INITIAL.
        t_receivers-receiver = gt_mail-mail3.
        APPEND t_receivers.
      ENDIF.
      IF NOT gt_mail-mail4 IS INITIAL.
        t_receivers-receiver = gt_mail-mail4.
        APPEND t_receivers.
      ENDIF.
    LOOP AT gt_mail.
       t_receivers-receiver = gt_mail-mailid..
       APPEND t_receivers.
    ENDLOOP.
      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.                    " send_file_as_email_attachment
    Data Declaration ************************************
    DATA : handle LIKE sy-tabix.
    data itab like kna1 occurs 0 with header line.
    data: text(50) type c.
    data: spoolid type TSP01-RQIDENT.
    DATA : gt_listobject LIKE abaplist OCCURS 10 .
    DATA : gt_objcont LIKE soli OCCURS 10 WITH HEADER LINE.
    DATA : gt_objcont1 LIKE soli OCCURS 10 WITH HEADER LINE.
    DATA : gt_objhead LIKE soli OCCURS 10 WITH HEADER LINE.
    DATA : gt_att_head LIKE soli OCCURS 10  WITH HEADER LINE.
    DATA : gt_receivers LIKE soos1 OCCURS 10 WITH HEADER LINE.
    DATA : gt_packing_list LIKE soxpl OCCURS 10 WITH HEADER LINE.
    DATA : gt_so_ali LIKE soli OCCURS 100 WITH HEADER LINE.
    DATA : gt_so_ali1 LIKE soli OCCURS 100 WITH HEADER LINE.
    DATA : gt_document_data LIKE sood1.
    DATA: lineno TYPE i , length TYPE i , size TYPE i.
    DATA: gt_message LIKE soli OCCURS 10 WITH HEADER LINE,
          gt_message1 LIKE soli OCCURS 10 WITH HEADER LINE.
    DATA: gt_scheme LIKE ztrc_scheme OCCURS 0 WITH HEADER LINE,
         gt_mail LIKE zmail_prov OCCURS 0 WITH HEADER LINE.
          gt_mail LIKE zmail." occurs 0 with header line.
    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'.
    DATA: check TYPE c,
          days TYPE i.
    <b></b><b></b><b></b>

    Hi Prashant,
    Thanks for your reply. Really it is very useful one.
    In this, the output list is getting populated into spool and to pdf.
    But my requirement sending the internal table contents to spool directly without dispalying in the output list.
    I did the program like the above mentioned one already. But my requirement is not that one.
    Regards
    chakradhar

  • Problem in converting Spool to PDF file, having non-English characters

    Hi All,
            I have problem in converting Spool to PDF format.
    Scenario : I have a spool which has non-English characters. I am using CONVERT_ABAPSPOOLJOB_2_PDF  FM to perform conversion. But my output is having junk values( ie # ) for non-English characters. Any pointers to solve this issue will be appreciated.
    I even tried with report RSTXPDFT4 , it also gives me the same junk characters.
    Regards,
    Navin.

    Hi All,
            I have problem in converting Spool to PDF format.
    Scenario : I have a spool which has non-English characters. I am using CONVERT_ABAPSPOOLJOB_2_PDF  FM to perform conversion. But my output is having junk values( ie # ) for non-English characters. Any pointers to solve this issue will be appreciated.
    I even tried with report RSTXPDFT4 , it also gives me the same junk characters.
    Regards,
    Navin.

  • Problem in converting spool to pdf

    Hi Experts,
    I want an internal table to be converted to the PDF. For this RSPO_OPEN_SPOOLREQUEST, RSPO_WRITE_SPOOLREQUEST and RSPO_CLOSE_SPOOLREQUEST to create the spool. However, somehow the table tsp01 does not gets updated as a result i could not convert the data to PDF. Can any one help me how this problem could be solved.
    Thank.
    Warm Regards,
    Harshad.

    Hi,
    you can refer this sample code.
    DATA: t_otfdata_tab LIKE ITCOO OCCURS 0 WITH HEADER LINE.
    CALL FUNCTION 'CLOSE_FORM'
    TABLES
    OTFDATA = t_otfdata_tab
    fill the exceptions..
    IF SY-SUBRC = 0.
    ENDIF.
    then pass the t_otfdata_tab to this function module..
    CONSTANTS: c_pdf(03) VALUE 'PDF'.
    PDF File size
    DATA: w_file_size TYPE I.
    Internal Table to hold Form contents in PDF format
    DATA: t_pdfdata_tab LIKE tline OCCURS 0 WITH HEADER LINE.
    for converting. the output format from OTF to PDF
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
    FORMAT eq c_pdf
    IMPORTING
    BIN_FILESIZE = w_file_size
    TABLES
    OTF eq t_otfdata_tab
    LINES eq t_pdfdata_tab
    EXCEPTIONS...
    use these links, hope it will be useful to you....
    Problem in converting spool to PDF file
    Problem in converting the spool to PDF.
    Thanks and Regards,
    Ahamed.

  • I am having a problem converting word onto PDF . PDF into word.Please help .I am signed and paid to Feb 2015

    Can someone advise me why I am having this problem

    Always in the past .I have my Word Document on screen and then I go to 
    Publish and it atomatically PDF the doc.
    The same if I have a PDF to convert to word. I have the PDF on screen and 
    to the right of my screen it will say Convert .I press on convert it
    converts to  word
    In a message dated 12/17/2014 10:01:32 A.M. Eastern Standard Time, 
    [email protected] writes:
    I  am having a problem converting word onto PDF . PDF into word.Please help
    .I am signed and paid to Feb 2015
    created by florencejohn (https://forums.adobe.com/people/florencejohn) 
    in  Adobe Acrobat.com Services - View the full  discussion
    (https://forums.adobe.com/message/7023171#7023171)

  • I am having a problem converting a scanned pdf file into Excel.

    I am having a problem converting a scanned pdf file into Excel. I do not get the columns and rows to align, just a single column of everything. Any suggestions?

    Export makes use of what is "in" a PDF.
    Good export is the "silk purse" and, ya know, you canna make a silk purse from a sow's ear (which is what any scanned image in PDF is with regards to export).
    The quality of export is dictated by the quality of the PDF. We are taking about the "inner essences" of the PDF (e.g., degree of compliance with the PDF Standard - ISO 32000-1).
    So, what goes in goes out or "GIGO".
    This has nothing to do with Acrobat or Acrobat's export process.
    A well-formed Tagged PDF (compliant to ISO 32000-1 & ISO 14289-1, PDF/UA-1) provides a PDF that proactively
    supports content export by Acrobat.
    To get the good stuff from export you start with a well-formed Tagged PDF.
    Goodstuff In — Goodstuff Out
    or
    Garbage In — Garbage Out
    "GIGO"
    Be well...
    Message was edited by: CtDave

  • Background Submit to Spool,  convert spool to PDF send via email

    I am calling an ABAP in the background. this abap makes use of a custom table as the main driver ie on each change of vendor within this custom table I want to create a spool and email the spool - the spool is suppossed to be created via a submit RMCB0300  with screen selection to to sap-spool and return. I then want the program to take the spool convert it to PDF and email.
    Problems I am encountering:
    1. writing to the spool via background ABAP  as follows
       submit RMCB0300 with selection-table rspar
                  to sap-spool
                  spool parameters %_print
                 archive parameters %_archive
                 without spool dynpro and return.
    Doesn't appear to be creating the spool - rspar is populated.
    2. Best way to retrieve the correct spool number.
    3. how to successfully convert PDF output after CONVERT_ABAPSPOOLJOB_2_PDF for email attachment - if this returns IT_PDF_OUTPUT.
    is this the best way to do it:
    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.
    Thanks
    Mark
    Edited by: Matt on Apr 2, 2009 11:03 AM - amended title with formatting problems.

    Please find the code for converting SPool to pdf and sending mail
    CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
         EXPORTING
           SRC_SPOOLID              = LV_MI_RQIDENT
           NO_DIALOG                = 'X'
           DST_DEVICE               = LV_PRINT_PARMS-PDEST
         IMPORTING
           PDF_BYTECOUNT            = LV_BYTECOUNT
           PDF_SPOOLID              = LV_RQIDENT
         TABLES
           PDF                      = LT_MTAB_PDF
         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.
       IF SY-SUBRC <> 0.
         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
       ENDIF.
       LOOP AT LT_MTAB_PDF INTO LWA_MTAB_PDF.
         TRANSLATE LWA_MTAB_PDF USING ' ~'.
         CONCATENATE LV_GD_BUFFER LWA_MTAB_PDF INTO LV_GD_BUFFER.
         CLEAR LWA_MTAB_PDF.
       ENDLOOP.
       TRANSLATE LV_GD_BUFFER USING '~ '.
       DO.
         LWA_MESS_ATT = LV_GD_BUFFER.
         APPEND LWA_MESS_ATT TO LT_MESS_ATT.
         CLEAR LWA_MESS_ATT.
         SHIFT LV_GD_BUFFER LEFT BY 255 PLACES.
         IF LV_GD_BUFFER IS INITIAL.
           EXIT.
         ENDIF.
       ENDDO.
       CLEAR:  LWA_RECLIST, LT_RECLIST[],
               LT_OBJHEAD, LT_OBJHEAD[],
               LWA_OBJTXT,  LT_OBJTXT[],
               LWA_OBJBIN,  LT_OBJBIN[],
               LWA_OBJPACK, LT_OBJPACK[].
       "   CLEAR LT_OBJBIN.
       REFRESH LT_OBJBIN.
       LT_OBJBIN[] = LT_MESS_ATT[].
       DESCRIBE TABLE  LT_OBJBIN LINES LV_L_ATTACHMENT.
       LWA_OBJTXT = ''.
       APPEND LWA_OBJTXT TO LT_OBJTXT.
       CLEAR LWA_OBJTXT.
       DESCRIBE TABLE LT_OBJTXT LINES LV_L_TESTO.
       LT_DOC_CHNG-OBJ_NAME   = 'STATUS_REPORT'.
       LT_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
       LT_DOC_CHNG-OBJ_DESCR  = 'Generated File'.               "#EC NOTEXT
       LT_DOC_CHNG-SENSITIVTY = 'F'.
       LT_DOC_CHNG-SENSITIVTY = 'O'.
       LT_DOC_CHNG-OBJ_PRIO   = '1'.
       LT_DOC_CHNG-DOC_SIZE   = LV_L_TESTO * 255.
       CLEAR LWA_OBJPACK-TRANSF_BIN.
       LWA_OBJPACK-HEAD_START = 1.
       LWA_OBJPACK-HEAD_NUM   = 0.
       LWA_OBJPACK-BODY_START = 1.
       LWA_OBJPACK-BODY_NUM   = LV_L_TESTO.
       LWA_OBJPACK-DOC_TYPE   = 'RAW'.
       APPEND LWA_OBJPACK TO LT_OBJPACK.
       CLEAR LWA_OBJPACK.
       LWA_OBJPACK-TRANSF_BIN = 'X' .
       LWA_OBJPACK-HEAD_START = 1.
       LWA_OBJPACK-HEAD_NUM   = 1.
       LWA_OBJPACK-BODY_START = 1.
       LWA_OBJPACK-BODY_NUM   = LV_L_ATTACHMENT.
       LWA_OBJPACK-DOC_TYPE   = 'PDF'.
       LWA_OBJPACK-OBJ_NAME   ='SPOOL'.
       LWA_OBJPACK-OBJ_DESCR = 'Test'.     
       LWA_OBJPACK-DOC_SIZE = LV_L_ATTACHMENT * 255.
       APPEND LWA_OBJPACK TO LT_OBJPACK.
       CLEAR LWA_OBJPACK.
       CLEAR LWA_RECLIST.
       LWA_RECLIST-COPY = 'X'.
       LWA_RECLIST-RECEIVER   = P_EMAIL.
       LWA_RECLIST-REC_TYPE   = 'U'.
       LWA_RECLIST-NOTIF_DEL  = 'X'.
       LWA_RECLIST-NOTIF_NDEL = 'X'.
       APPEND LWA_RECLIST TO LT_RECLIST.
       CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
         EXPORTING
           DOCUMENT_DATA              = LT_DOC_CHNG
           PUT_IN_OUTBOX              = ' '
           COMMIT_WORK                = 'X'
         TABLES
           PACKING_LIST               = LT_OBJPACK
           OBJECT_HEADER              = LT_OBJHEAD
           CONTENTS_BIN               = LT_OBJBIN
           CONTENTS_TXT               = LT_OBJTXT
           RECEIVERS                  = LT_RECLIST
         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.
       IF SY-SUBRC <> 0.
         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
       ENDIF.

  • Problem concerting spool to PDF format

    Hi all,
    I am trying a small program to write ABAP list to spool, and within the same program I am trying to convert the spool into PDF format. I am including all the code , please can any one check and tell me where I am going wrong. I am getting a message saying 0 bytes transferred.
    Even the contents of the table pdf_table is empty.
    REPORT ZWRITE_SPOOL .
    tables tsp01.
    DATA: val(1) TYPE c,
          pripar TYPE pri_params,
          arcpar TYPE arc_params,
          lay   TYPE pri_params-paart,
          lines TYPE pri_params-linct value 60,
          rows  TYPE pri_params-linsz value 80.
    data : w_spoolnumber like tsp01-RQIDENT.
    data : w_device like  tsp03-PADEST value 'H278' .
    data begin of pdf_table occurs 0.
            include structure tline.
    data end   of pdf_table.
    data : MI_BYTECOUNT type i ,
           MC_FILENAME LIKE RLGRAP-FILENAME.
    DATA: MTAB_PDF LIKE TLINE OCCURS 0 WITH HEADER LINE .
    data pdf_fsize type i.
    DATA: MSTR_PRINT_PARMS LIKE PRI_PARAMS ,
          MC_VALID(1) TYPE C .
    CONCATENATE 'C:\TEMP\' sy-repid '.PDF' INTO MC_FILENAME.
    *---- Code added
    pripar-pdest = 'H278'.
    pripar-prcop = 001.
    pripar-plist = sy-repid.
    pripar-prnew = 'X'.
    pripar-pexpi = 8.
    pripar-linct = 65.
    pripar-linsz = 80.
    pripar-paart = 'X_65_80'.
    pripar-prsap = 'D'.
    pripar-prrec = sy-uname.
    pripar-prdsn = 'LIST1S'.
    pripar-ptype = 'TEXT'.
    pripar-armod = 1.
    *---- End of code
    perform format.
    select single RQIDENT from tsp01 into w_spoolnumber
    where RQ2NAME = sy-repid .
      NEW-PAGE PRINT OFF.
    write w_spoolnumber.
    perform spool_to_pdf.
         Form  format
    FORM format.
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
           EXPORTING
                in_archive_parameters  = arcpar
                in_parameters          = pripar
                layout                 = lay
                line_count             = lines
                line_size              = rows
                no_dialog              = 'X'
           IMPORTING
                out_archive_parameters = arcpar
                out_parameters         = pripar
                valid                  = val
           EXCEPTIONS
                archive_info_not_found = 1
                invalid_print_params   = 2
                invalid_archive_params = 3
                OTHERS                 = 4.
      IF val <> space AND sy-subrc = 0.
        PERFORM list.
      ENDIF.
    endform.                    " format
    FORM list.
      NEW-PAGE PRINT ON
        NEW-SECTION
        PARAMETERS pripar
        ARCHIVE PARAMETERS arcpar
        NO DIALOG.
    write 'SAP PROGRAMMING USING ABAP'.
    ENDFORM.
         Form  spool_to_pdf
    form spool_to_pdf.
    call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
         exporting
              src_spoolid   = w_spoolnumber
              no_dialog     = 'X'
              DST_DEVICE    = w_device
         importing
              pdf_bytecount = pdf_fsize
         tables
              pdf           = pdf_table
         exceptions
              others        = 0.
    CALL FUNCTION 'DOWNLOAD'
    EXPORTING
    BIN_FILESIZE = MI_BYTECOUNT
    FILENAME = MC_FILENAME
    FILETYPE = 'BIN'
    IMPORTING
    ACT_FILENAME = MC_FILENAME
    TABLES
    DATA_TAB = MTAB_PDF
    EXCEPTIONS
    INVALID_FILESIZE = 1
    INVALID_TABLE_WIDTH = 2
    INVALID_TYPE = 3
    NO_BATCH = 4
    UNKNOWN_ERROR = 5
    GUI_REFUSE_FILETRANSFER = 6
    CUSTOMER_ERROR = 7
    OTHERS = 8.
    endform.                    " spool_to_pdf
    Thanks,
    Varun.

    hi Varun,
        Check for the <b>internal Table data/work area</b> as whether data is getting populated in to that or not.
    i.e,
    CALL FUNCTION 'DOWNLOAD'
    EXPORTING
    BIN_FILESIZE = MI_BYTECOUNT
    FILENAME = MC_FILENAME
    FILETYPE = 'BIN'
    IMPORTING
    ACT_FILENAME = MC_FILENAME
    TABLES
    <b>DATA_TAB = MTAB_PDF</b>
    EXCEPTIONS
    INVALID_FILESIZE = 1
    INVALID_TABLE_WIDTH = 2
    INVALID_TYPE = 3
    NO_BATCH = 4
    UNKNOWN_ERROR = 5
    GUI_REFUSE_FILETRANSFER = 6
    CUSTOMER_ERROR = 7
    OTHERS = 8.
    <b>check whether data is getting populated in MATAB_PDF in debug mode.</b>
    Regards,
    Santosh

  • Double print in one line,when convert spool to PDF

    Dear Expert:
    I have a problem to solve when convert spool to PDF,there is one line will double imaged.
    The form is created by smartforms.
    I have tryed many ways,retype the text or start a new line,all didn't works.
    So could any one tell me how to solve this problem.
    Many thanks.
    [Picture of the PDF|http://picasaweb.google.com/nika.wei/SAP#5274740000941172338]
    Edited by: Nika Wei on Dec 1, 2008 9:50 AM

    Thanks for your quick response.
    I used the program you mentioned to download spool to PDF.The download file is like the link picture.
    And the form will not overlap when I print it immediately.But it will overlap the first line when preview or convert to PDF. My user don't want to print it immediately they want to save it to PDF.
    I know maybe there is something wrong with the format, I tryed retype the text but it didn't works.

  • Converting HTML into PDF

    Hello ABAP Experts,
    I have a request to convert a HTML Response (FM: HTTP2_GET) into a PDF Document.
    Has any body an idea how to handle that.
    Thank you very much for you answers.
    Kind regards
    Axel

    The easiest way to convert web pages/sites into PDF is with Acrobat! Important: this is Acrobat (costs a few dollars) and not Acrobat Reader!
    Acrobat has a web capture tool. With the older version I tested there was some minor problems.
    (1) It is not recognized as a browser we support. You will have to knock out the browser checking for this to work. Look at the cl_htmlb_content->runtime_validation. The last case statement. Modify your system to temporarily comment this out. (Do not forget to place it back!).
    (2) The older version I tested with had problems to convert complex pages into PDF. The new rendering we use is to browser specific. Your milage might vary.
    Alternative could be just to "print" the page from the browser into a PDFWriter (kind of printer driver that comes with Acrobat). This actually worked very well.
    Alternative is just to make screenshots into word document and convert this into PDF.
    > Please help me ..
    With this, I think we have now helped you. In return, you can help us with a nice append (or better a small weblog) about the "huge project that was a challange". These war stories shared by the fire side makes for interesting reading, and I am sure other people would also be interested in seeing what you achieved. Looking forward to it.
    ++bcm

  • Problem in Spool to PDF conversion

    Hi,
    Iam using FM 'RSPO_SX_OUTPUT_TEXTDATA' to genarete a spool. then iam using FM 'CONVERT_ABAPSPOOLJOB_2_PDF' to conver to PDF.
    Iam able to generate spool as wel pdf file, but when try to open pdf file, its thrwing an error ''There was an error opening  this document. the file is damaged  and could not be repair'
    pls help me to solve this...
    Srinivas

    Hi,
    After calling the fm'CONVERT_ABAPSPOOLJOB_2_PDF' u need to call the subroutine.Please have a look at the below piece of code.
    Declaration of local variables
      DATA : lv_bytecount  TYPE i,
             lv_cancel(1)  TYPE c,
             lv_filename1  LIKE rlgrap-filename.    "File name
    Declaration of local constants
      CONSTANTS: lc_pdf(4) TYPE c VALUE '.PDF'.
      CONCATENATE c_c
                  sy-repid
                  lc_pdf
          INTO lv_filename1.
    Convert Spool to PDF
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
        EXPORTING
          src_spoolid              = v_rqident
          no_dialog                = c_x
          dst_device               = v_print_parms-pdest
        IMPORTING
          pdf_bytecount            = lv_bytecount
        TABLES
          pdf                      = i_pdf
        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.
      IF sy-subrc NE 0.
        REFRESH : i_pdf.
      ENDIF.
      IF p_pdf IS NOT INITIAL.
    To  Download to PDF format
        PERFORM download_w_ext(rstxpdft) TABLES i_pdf
                                          USING lv_filename1
                                                lc_pdf
                                                'BIN'
                                                lv_bytecount
                                                lv_cancel.
      ENDIF.
    Reward points if u find useful
    Regards,
    Nagaraj

  • Convert spool to PDF and send as email attachment

    When i try to convert SAP spool to PDF and send it as email attachment,  size of PDF document becomes large as compared to size of the PDF cocument i download using the same spool.
    I am using following FMs.
    CONVERT_ABAPSPOOLJOB_2_PDF to convert spool to PDF
    and
    SO_NEW_DOCUMENT_ATT_SEND_API1 to send email with attchment.
    some times size of attchment exceeds 2MB and email results in error in SAP connect (SOST).
    Any idea on how to compress the PDF attchment??
    Thanks

    Hi Venkat,
    Can you plesae assist me.
    I have a requirement to convert spool to pdf
    send an email to users
    issue is that attachement is big cant go through
    I have used compress, but when I open the pdf file error that file was not correclty decoded
    please assist, anyone

  • Convert SmartForm into PDF(PDF should be password protected)

    Hi Friends,
                  This is my requirement.
    Need to convert SmartForm into PDF and this PDF should be send as an email with attachment and PDF should be password protected.
    Can anyone plz help me???

    Dear Jena,
                   This is my code.
       CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname = 'ZBIN_SMARTFORM'
        IMPORTING
          fm_name  = v_fm.
    *&   ASSIGNING VALUES TO FORM CONTROL STRUCTURE AND FORM COMPOSER
      gs_ctrlop-getotf = 'X'.
      gs_ctrlop-device = 'PRINTER'.
      gs_ctrlop-preview = ' '.
      gs_ctrlop-no_dialog = 'X'.
      gs_outopt-tddest = 'LOCL'.
    *                   GETTING THE OTF DATA
      CALL FUNCTION v_fm
        EXPORTING
    *     ARCHIVE_INDEX        =
    *     ARCHIVE_INDEX_TAB    =
    *     ARCHIVE_PARAMETERS   =
          control_parameters   = gs_ctrlop
    *     MAIL_APPL_OBJ        =
    *     MAIL_RECIPIENT       =
    *     MAIL_SENDER          =
          output_options       = gs_outopt
          user_settings        = ' '
          wa_lfa1              = wa_lfa1
          wa_t001              = wa_t001
          wa_ekko              = wa_ekko
          wa_adrc              = wa_adrc
        IMPORTING
    *     DOCUMENT_OUTPUT_INFO =
          job_output_info      = gs_otfdata
    *     JOB_OUTPUT_OPTIONS   =
        TABLES
          it_ekpo              = it_ekpo
        EXCEPTIONS
          formatting_error     = 1
          internal_error       = 2
          send_error           = 3
          user_canceled        = 4
          OTHERS               = 5.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    *        ASSIGNING THE OTFDATA TO OTF STRUCTURE TABLE
      CLEAR gt_otf.
      gt_otf[] = gs_otfdata-otfdata[].
    *                   CONVERTING THE OTFDATA
      CLEAR gt_lines.
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          format                = 'PDF'
          max_linewidth         = 132
    *     ARCHIVE_INDEX         = ' '
    *     COPYNUMBER            = 0
    *     ASCII_BIDI_VIS2LOG    = ' '
    *     PDF_DELETE_OTFTAB     = ' '
    *     PDF_USERNAME          = ' '
    *     PDF_PREVIEW           = ' '
    *     USE_CASCADING         = ' '
        IMPORTING
          bin_filesize          = bin_file
    *     bin_file              = bin_file
        TABLES
          otf                   = gt_otf
          lines                 = gt_lines
        EXCEPTIONS
          err_max_linewidth     = 1
          err_format            = 2
          err_conv_not_possible = 3
          err_bad_otf           = 4
          OTHERS                = 5.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      DATA l_file TYPE string  .
      CONCATENATE  'D:\usr\sap\CID\DVEBMGS00\work' '.PDF' INTO l_file.
      OPEN DATASET l_file FOR OUTPUT IN BINARY MODE  .
      IF  sy-subrc = 0 .
        LOOP AT gt_lines INTO gs_lines .
          TRANSFER gs_lines TO l_file .
        ENDLOOP.
        CLOSE DATASET l_file .
      ELSE.
        WRITE : / 'operating system could not open file' .
      ENDIF.
    *      ASSIGNING THE DESCRIPTION OF THE OBJECT SENT IN MAIL
      CLEAR gs_docdata.
      gs_docdata-obj_name = gc_tst.
      gs_docdata-obj_descr = gc_testing.
      gs_docdata-obj_langu = sy-langu.
    *        ASSIGNING THE EMAIL-ID TO STRUCTURE OF API RECIPIENT LIST TABLE
      CLEAR : gt_reclist,gs_reclist.
    ***IF INTERNAL MAIL-ID
    *  gs_reclist-receiver = sy-uname.
    *  gs_reclist-rec_type = 'B'.
    ***IF EXTERNAL MAIL-ID
      gs_reclist-receiver = '[email protected]'.
      gs_reclist-rec_type = 'U'.
      APPEND gs_reclist TO gt_reclist.
    *     PASSING THE SAP SCRIPT LINES TO SAP OFFICE
      CLEAR : gs_objbin,gs_lines.
      LOOP AT gt_lines INTO gs_lines.
        gv_pos = 255 - gv_len.
        IF gv_pos > 134.
          gv_pos = 134.
        ENDIF.
        gs_objbin+gv_len = gs_lines(gv_pos).
        gv_len = gv_len + gv_pos.
        IF gv_len = 255.
          APPEND gs_objbin TO gt_objbin.
          CLEAR : gs_objbin,gv_len.
          IF gv_pos < 134.
            gs_objbin = gs_lines+gv_pos.
            gv_len = 134 - gv_pos.
          ENDIF.
        ENDIF.
      ENDLOOP.
      IF gv_len > 0.
        APPEND gs_objbin TO gt_objbin.
      ENDIF.
    *           FILLING THE DETAILS IN SAP OFFICE
      DESCRIBE TABLE gt_objbin LINES gv_tab_lines.
      CLEAR gs_objbin.
      READ TABLE gt_objbin INTO gs_objbin INDEX gv_tab_lines.
      IF sy-subrc = 0.
        gs_objpack-doc_size = ( gv_tab_lines - 1 ) * 255 + strlen( gs_objbin ).
        gs_objpack-transf_bin = 'X'.
        gs_objpack-head_start = 1.
        gs_objpack-head_num = 0.
        gs_objpack-body_start = 1.
        gs_objpack-body_num = gv_tab_lines.
        gs_objpack-doc_type = 'PDF'.
        gs_objpack-obj_name = 'ATTACHMENT'.
        gs_objpack-obj_descr = 'TEST'.
        APPEND gs_objpack TO gt_objpack.
      ENDIF.
      DATA: BEGIN OF command_list OCCURS 0.
              INCLUDE STRUCTURE sxpgcolist.
      DATA: END OF command_list .
      DATA: BEGIN OF exec_protocol OCCURS 0.
              INCLUDE STRUCTURE btcxpm.
      DATA: END OF exec_protocol.
      DATA: status LIKE btcxp3-exitstat,
       commandname LIKE sxpgcolist-name VALUE 'ZB_TEST',
        sel_no LIKE sy-tabix.
    * GET LIST OF EXTERNAL COMMANDS
      CALL FUNCTION 'SXPG_COMMAND_LIST_GET'
        EXPORTING
          commandname     = commandname
          operatingsystem = sy-opsys
        TABLES
          command_list    = command_list
        EXCEPTIONS
          OTHERS          = 1.
      CALL FUNCTION 'SXPG_COMMAND_CHECK'
        EXPORTING
          commandname                = command_list-name
          operatingsystem            = sy-opsys
        EXCEPTIONS
          no_permission              = 1
          command_not_found          = 2
          parameters_too_long        = 3
          security_risk              = 4
          wrong_check_call_interface = 5
          x_error                    = 6
          too_many_parameters        = 7
          parameter_expected         = 8
          illegal_command            = 9
          communication_failure      = 10
          system_failure             = 11
          OTHERS                     = 12.
      CLEAR command_list.
      REFRESH command_list.
      DATA: v_dir_input      TYPE sxpgcolist-parameters.
      DATA: v_dir_input1      TYPE sxpgcolist-parameters.
      command_list-name = 'ZB_TEST'.
      command_list-opsystem = 'Windows NT'.
      DATA : doc  TYPE string.
      DATA : pass TYPE string ,
            name(40).
      doc = 'invoice'.
      pass = '123456'.
      CONCATENATE   'cnd/c d:\pdf\encryptpdf.exe' doc'.PDF' INTO name.
      CONCATENATE 'cmd /c d:\pdf\encryptpdf.exe' '-i'  name  '-o ' name  '-u'  pass INTO v_dir_input SEPARATED BY space .
      READ TABLE command_list INDEX sel_no.
      CONCATENATE command_list-opcommand v_dir_input INTO command_list-opcommand SEPARATED BY space.
    * CHECK AUTHORIZATION
      command_list-addpar = 'X'.
      APPEND command_list.
      CONSTANTS: c_extcom    TYPE sxpgcolist-name VALUE 'ZB_TEST',
       c_oper      TYPE syopsys VALUE 'Windows NT'.
      DATA: t_result         TYPE STANDARD TABLE OF btcxpm.
      v_dir_input  =  command_list-opcommand.
      CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
        EXPORTING
          commandname                   = c_extcom
          additional_parameters         = v_dir_input
          operatingsystem               = c_oper
        TABLES
          exec_protocol                 = t_result
        EXCEPTIONS
          no_permission                 = 1
          command_not_found             = 2
          parameters_too_long           = 3
          security_risk                 = 4
          wrong_check_call_interface    = 5
          program_start_error           = 6
          program_termination_error     = 7
          x_error                       = 8
          parameter_expected            = 9
          too_many_parameters           = 10
          illegal_command               = 11
          wrong_asynchronous_parameters = 12
          cant_enq_tbtco_entry          = 13
          jobcount_generation_error     = 14
          OTHERS                        = 15.
      OPEN DATASET l_file FOR INPUT IN BINARY MODE.
      IF sy-subrc = 0.
        READ DATASET l_file INTO itab_attach.
        CLOSE DATASET l_file.
      ENDIF.
      CALL METHOD cl_bcs_convert=>xstring_to_solix
        EXPORTING
          iv_xstring = itab_attach
        RECEIVING
          et_solix   = t_attachment.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data                    = gs_docdata
       PUT_IN_OUTBOX                    = 'X'
       COMMIT_WORK                      = 'X'
    * IMPORTING
    *   SENT_TO_ALL                      =
    *   NEW_OBJECT_ID                    =
        TABLES
          packing_list                     = gt_objpack
    *   OBJECT_HEADER                    =
       CONTENTS_BIN                     = gt_objbin
    *   CONTENTS_TXT                     =
       CONTENTS_HEX                     = t_attachment
    *   OBJECT_PARA                      =
    *   OBJECT_PARB                      =
          receivers                        = gt_reclist
    * 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
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
           WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
        WRITE 'SENT SUCCESSFULLY'.
      ENDIF.
      SUBMIT rsconn01 WITH mode EQ 'INT' AND RETURN.
    The mail is sent to inbox successfully,but when am opening the attachment am getting the below error as,
    ---> There was an error while opening this file.The file is damaged and couldnt be repaired.

Maybe you are looking for

  • How can I tell if a user has used IMAP?

    How can I tell if a user has used IMAP? <P> Check their mailbox for a file called "__VALIDITY__" If they have this file in their mailbox, they've used IMAP.

  • Could 'export button' show only pdf, and excel only?

    Hai, I am using report viewer, it has export button in that header. Could 'export button' show only pdf, and excel only? So the report just only export pdf only or excel only. Technology: Asp.net Vs2010 SSRS2012 Windows 7

  • My ipad is inative, and now?

    Hi, few days ago something weird happened to my ipad, an screen written " ipad is inative  connect with itunes". The problem is that there wasnt any wrong password typing and when i connect with the itunes. When i connect to itunes it says that canno

  • Inventory Management MultiProvider 0IC_MC03 - Where does the WIP Come From

    Hi, I have installed the primary InfoCube 0IC_C03 for Material Movements and noticed that there is a MultiProvider 0IC_MC03 (Material Range of Coverage WIP )  and I'm curious how this would project WIP?  The Documentation doesn't mention any details

  • Caller Display/BT Answer 1571 charges

    Unbeknownst to me, Caller Display and BT Answer 1571 have been free since 2005 yet BT have been charging me £3.50/month (slighlty less before price increases) so I have been paying unnessarily for 9 years! I queried this with them and they said £1.75