<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Sending attachment using class cl_document_bcs as PDF in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163473#M1370556</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; You need to do make your internal table's content to PDF format. &lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; The easiest way would be:&lt;/P&gt;&lt;P&gt;&amp;gt; Generate a Spool of your data&lt;/P&gt;&lt;P&gt;&amp;gt; Call FM CONVERT_ABAPSPOOLJOB_2_PDF to get the PDF data&lt;/P&gt;&lt;P&gt;&amp;gt; Now, you can use the method ADD_ATTACHMENT to attach your PDF file as mail attachement.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Regards,&lt;/P&gt;&lt;P&gt;&amp;gt; Naimesh Patel&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the valuable reply, I have done what mentioned by You Naimesh.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; By using FM &lt;STRONG&gt;CONVERT_ABAPSPOOLJOB_2_PDF&lt;/STRONG&gt; I have got pdf data into &lt;STRONG&gt;tbl_pdf&lt;/STRONG&gt; as this of structure &lt;STRONG&gt;TLINE&lt;/STRONG&gt;,&lt;/P&gt;&lt;P&gt;How we need to convert in to &lt;STRONG&gt;solix_tab&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please give me light on this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Suneel G&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Sep 2009 07:01:28 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-09-23T07:01:28Z</dc:date>
    <item>
      <title>Sending attachment using class cl_document_bcs as PDF</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163471#M1370554</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;  As my Post has been rejected from SAP Community Network Forum,  &lt;STRONG&gt;Sorry&lt;/STRONG&gt; for posting my thread in two categoires.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  I have tried to search for solution in SDN but could not found a relevent solution. &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;  I am able to send an Internal table using &lt;STRONG&gt;cl_document_bcs&lt;/STRONG&gt; class to send &lt;STRONG&gt;XLS and Doc&lt;/STRONG&gt; types as attachment as follows: &lt;/P&gt;&lt;P&gt;  For Example :&lt;/P&gt;&lt;P&gt;  My Internal table is &lt;STRONG&gt;tbl_bseg&lt;/STRONG&gt; which final output table:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data : lv_string  TYPE string.

*-   tbl_bseg contains my data so..
  LOOP AT tbl_bseg INTO wa_bseg.
     CONCATENATE lv_string wa_bseg-bukrs wa_bseg-belnr wa_bseg-gjahr wa_bseg-buzei
                 wa_bseg-zumsk CN_CR_LF INTO lv_string SEPARATED BY CN_TAB.
*-     Horizontal Tab Stop Character
*-   Carriage Return and Line Feed 
   CLEAR wa_bseg.
   ENDLOOP.

   DATA:  lv_xstring TYPE xstring,
      ta_excelx  TYPE SOLIX_TAB.

*- Convert the string into xstring
  call function 'SCMS_STRING_TO_XSTRING'
   exporting
     TEXT     = p_string
   IMPORTING
     BUFFER   = lv_xstring
   EXCEPTIONS
     FAILED         = 1
     OTHERS         = 2.
  IF SY-SUBRC  0.
   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

*-  Convert the string into binary table
 CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
   EXPORTING
     buffer     = lv_xstring
   TABLES
     binary_tab = ta_excelx.

*-
 wa_attachments-type         = 'XLS'
 wa_attachments-subject      = 'This final testing - XLS'.
 wa_attachments-content_hex  = lv_xstring.
 APPEND wa_attachments to ta_attachments.

*-------- create and set document with attachment ---------------
     cl_documents = cl_document_bcs=&amp;amp;gt;create_document(
                     i_type    = CN_RAW
                     i_text    = gta_body
                     i_subject = wa_subject ).

*     add attachment to document
       CALL METHOD cl_document_bcs-&amp;amp;gt;add_attachment
       EXPORTING  i_attachment_type    = wa_attachments-TYPE
                            i_attachment_subject = wa_attachments-SUBJECT
                            i_att_content_hex    = wa_attachments-CONTENT_HEX.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; But my issue is to send a the same &lt;STRONG&gt;Internal Table tbl_bseg&lt;/STRONG&gt; as attachement as &lt;STRONG&gt;PDF&lt;/STRONG&gt; using in the same steps:&lt;/P&gt;&lt;P&gt; A sample snippet of code could be helpful or any valuable solution are welcome.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Suneel G&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Sep 2009 09:08:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163471#M1370554</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-18T09:08:06Z</dc:date>
    </item>
    <item>
      <title>Re: Sending attachment using class cl_document_bcs as PDF</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163472#M1370555</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to do make your internal table's content to PDF format. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The easiest way would be:&lt;/P&gt;&lt;P&gt;Generate a Spool of your data&lt;/P&gt;&lt;P&gt;Call FM CONVERT_ABAPSPOOLJOB_2_PDF to get the PDF data&lt;/P&gt;&lt;P&gt;Now, you can use the method ADD_ATTACHMENT to attach your PDF file as mail attachement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Sep 2009 13:54:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163472#M1370555</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2009-09-18T13:54:07Z</dc:date>
    </item>
    <item>
      <title>Re: Sending attachment using class cl_document_bcs as PDF</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163473#M1370556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; You need to do make your internal table's content to PDF format. &lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; The easiest way would be:&lt;/P&gt;&lt;P&gt;&amp;gt; Generate a Spool of your data&lt;/P&gt;&lt;P&gt;&amp;gt; Call FM CONVERT_ABAPSPOOLJOB_2_PDF to get the PDF data&lt;/P&gt;&lt;P&gt;&amp;gt; Now, you can use the method ADD_ATTACHMENT to attach your PDF file as mail attachement.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Regards,&lt;/P&gt;&lt;P&gt;&amp;gt; Naimesh Patel&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the valuable reply, I have done what mentioned by You Naimesh.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; By using FM &lt;STRONG&gt;CONVERT_ABAPSPOOLJOB_2_PDF&lt;/STRONG&gt; I have got pdf data into &lt;STRONG&gt;tbl_pdf&lt;/STRONG&gt; as this of structure &lt;STRONG&gt;TLINE&lt;/STRONG&gt;,&lt;/P&gt;&lt;P&gt;How we need to convert in to &lt;STRONG&gt;solix_tab&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please give me light on this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Suneel G&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Sep 2009 07:01:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163473#M1370556</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-23T07:01:28Z</dc:date>
    </item>
    <item>
      <title>Re: Sending attachment using class cl_document_bcs as PDF</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163474#M1370557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1) convert TLINE_TAB to SOLI_TAB type (not solix_tab) using SX_TABLE_LINE_WIDTH_CHANGE function module&lt;/P&gt;&lt;P&gt;2) convert SOLI_TAB to XSTRING using SCMS_BINARY_TO_XSTRING function module&lt;/P&gt;&lt;P&gt;3) convert XSTRING to SOLIX_TAB using SCMS_XSTRING_TO_BINARY function module&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: SOLI_TAB is chosen because it has only one field (required to use SCMS_BINARY_TO_XSTRING) and has a width (255) greater than TLINE_TAB (required to use SX_TABLE_LINE_WIDTH_CHANGE)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Sandra Rossi on Sep 27, 2009 6:38 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 27 Sep 2009 16:03:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163474#M1370557</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2009-09-27T16:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: Sending attachment using class cl_document_bcs as PDF</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163475#M1370558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sandra Rossi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Thanks for valueble suggestion, I have tried doing it but I could do it so.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;For ex:&lt;/U&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;1. From my &lt;STRONG&gt;CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'&lt;/STRONG&gt; I get it_pdf_output of type tline_tab.&lt;/P&gt;&lt;P&gt;    the content of it_pdf_output is looking like some chinese characters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; 2.  Using below FM to convert 132 tline to 255 solitab.&lt;/P&gt;&lt;P&gt; CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'&lt;/P&gt;&lt;P&gt; EXPORTING&lt;/P&gt;&lt;P&gt;   LINE_WIDTH_SRC                    = '132'&lt;/P&gt;&lt;P&gt;   LINE_WIDTH_DST                    = '255'&lt;/P&gt;&lt;P&gt;   TRANSFER_BIN                     = 'X'   " I tried commenting this too&lt;/P&gt;&lt;P&gt;  TABLES&lt;/P&gt;&lt;P&gt;    CONTENT_IN                        = it_pdf_output&lt;/P&gt;&lt;P&gt;    CONTENT_OUT                       = it_pdf_solitab&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;3. then use the below FM to convert it_pdf_solitab to it_pdf_xstring&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;   INPUT_LENGTH       = '255'&lt;/P&gt;&lt;P&gt;   FIRST_LINE         = 0&lt;/P&gt;&lt;P&gt;   LAST_LINE          = 0&lt;/P&gt;&lt;P&gt; IMPORTING&lt;/P&gt;&lt;P&gt;   BUFFER             = it_pdf_xstring&lt;/P&gt;&lt;P&gt;  TABLES&lt;/P&gt;&lt;P&gt;   BINARY_TAB         = it_pdf_solitab    &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; 4.  Then  using this method&lt;/P&gt;&lt;P&gt;*-  Converts pdf_xstring format into solix tab&lt;/P&gt;&lt;P&gt;CALL METHOD CL_DOCUMENT_BCS=&amp;gt;XSTRING_TO_SOLIX&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;    IP_XSTRING = it_pdf_xstring&lt;/P&gt;&lt;P&gt;  RECEIVING&lt;/P&gt;&lt;P&gt;    RT_SOLIX   = pdf_content.&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I could not open the pdf_content, Could you please let me know where I am going wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Suneel G&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2009 02:05:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163475#M1370558</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-29T02:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: Sending attachment using class cl_document_bcs as PDF</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163476#M1370559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your error is with SCMS_BINARY_TO_XSTRING : you must not pass input_length = '255', instead use the &lt;STRONG&gt;binary length&lt;/STRONG&gt; that is returned by CONVERT_ABAPSPOOLJOB_2_PDF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The TRANSFER_BIN must be set to space (default).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Moreover, you may omit optional parameters:&lt;/P&gt;&lt;P&gt;- LINE_WIDTH_SRC and LINE_WIDTH_DST in SX_TABLE_LINE_WIDTH_CHANGE.&lt;/P&gt;&lt;P&gt;- FIRST_LINE and LAST_LINE in SCMS_BINARY_TO_XSTRING&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why did you use CL_DOCUMENT_BCS=&amp;gt;XSTRING_TO_SOLIX, is it because there was a problem with SCMS_XSTRING_TO_BINARY ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2009 09:03:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163476#M1370559</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2009-09-29T09:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: Sending attachment using class cl_document_bcs as PDF</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163477#M1370560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sandra Rossi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Thanks for the suggestions, I have done the changes accordingly and have tested but no luck, I could get a PDF with out&lt;/P&gt;&lt;P&gt;errors.&lt;/P&gt;&lt;P&gt;  Can provide me any other ideas, or can send me any sample.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Suneel G&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2009 09:48:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163477#M1370560</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-29T09:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: Sending attachment using class cl_document_bcs as PDF</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163478#M1370561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is an example (it works for me). Check if it works by opening `C:\ffffffffff.pdf` with Acrobat Reader. Then adapt it to send the mail. If it doesn't work, then the problem is the way you send the mail.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT z.
DATA    e_spoolid TYPE rspoid.
PERFORM ali_spool_generator
      CHANGING
        e_spoolid.
DATA    et_pdf          TYPE tline_tab.
DATA    e_binary_length TYPE i.
PERFORM convert_ali_spool_to_pdf
  USING
    e_spoolid
  CHANGING
    et_pdf
    e_binary_length.
data SOLI_TAB type SOLI_TAB.
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
  TABLES
    content_in                        = et_pdf
    content_out                       = SOLI_TAB
 EXCEPTIONS
   OTHERS                            = 4.
data e_xstring TYPE xstring.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
     EXPORTING
       input_length       = e_binary_length
     IMPORTING
       buffer             = e_xstring
     TABLES
       binary_tab         = SOLI_TAB
     EXCEPTIONS
       OTHERS             = 2.
DATA lt_solix TYPE solix_tab.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
  EXPORTING
    buffer                = e_xstring
  TABLES
    binary_tab            = lt_solix.

* &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
* REPLACE THAT BY YOUR CODE TO SEND MAIL
  CALL METHOD cl_gui_frontend_services=&amp;gt;gui_download
    EXPORTING
      bin_filesize = e_binary_length
      filename     = `C:\ffffffffff.pdf`
      filetype     = 'BIN'
    CHANGING
      data_tab     = lt_solix
    EXCEPTIONS
      OTHERS       = 3.
* &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;

FORM ali_spool_generator
      CHANGING
        e_spoolid TYPE rspoid.
  NEW-PAGE PRINT ON NO DIALOG.
  WRITE : / 'Hello World'.
  NEW-PAGE PRINT OFF.
  e_spoolid = sy-spono.
  COMMIT WORK.
ENDFORM.

FORM convert_ali_spool_to_pdf
  USING
    i_spoolid       TYPE rspoid
  CHANGING
    et_pdf          TYPE tline_tab
    e_binary_length TYPE i.
  CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
    EXPORTING
      src_spoolid              = i_spoolid
      no_dialog                = 'X'
    IMPORTING
      pdf_bytecount            = e_binary_length
    TABLES
      pdf                      = et_pdf
    EXCEPTIONS
      OTHERS                   = 12.
ENDFORM.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2009 12:22:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163478#M1370561</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2009-09-29T12:22:50Z</dc:date>
    </item>
    <item>
      <title>Re: Sending attachment using class cl_document_bcs as PDF</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163479#M1370562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sandra Rossi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; This works perfect and  I am able to send the mail with out any errors. &lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;Thanks a lot for your efforts and ideas.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  I have a concer, as I was creating spool id with following FM's:&lt;/P&gt;&lt;P&gt;   a. 'RSPO_OPEN_SPOOLREQUEST'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   b. 'RSPO_WRITE_SPOOLREQUEST'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   c. 'RSPO_CLOSE_SPOOLREQUEST'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Once I get spool ID I am doing as you have done, Do you have any idea why I am not getting PDF data with spool id what I got.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks once agian.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Suneel G&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Sep 2009 02:42:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163479#M1370562</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-30T02:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: Sending attachment using class cl_document_bcs as PDF</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163480#M1370563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can't see if you don't show your code (please just paste the minimum lines of code we need to answer you, not the whole code!)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why do you use function modules instead of (shorter) ABAP statements? Refer to my code above, I generate a spool too!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Sep 2009 09:11:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163480#M1370563</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2009-09-30T09:11:18Z</dc:date>
    </item>
    <item>
      <title>Re: Sending attachment using class cl_document_bcs as PDF</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163481#M1370564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sandra Rossi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Your code is working and I am using the same code in my program, the spool data in &lt;STRONG&gt;ABAP list format&lt;/STRONG&gt;. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As previously I was using the below FM's for spool no, I want to know why these FM's are not working:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the code what I was doing previously.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: v_handle type SY-TABIX,
         gd_spool_nr type TSP01-RQIDENT,
         v_rc,
         v_errmessage.
data: v_text(80) type C.

data: it_mara like mara OCCURS 0 WITH HEADER LINE.

select * from mara
          into table it_mara UP TO 10 ROWS.

CALL FUNCTION 'RSPO_OPEN_SPOOLREQUEST'
EXPORTING
  dest = 'LOCL'
IMPORTING
  handle = v_handle
  spoolid = e_spoolid
  rc = v_rc
  errmessage = v_errmessage.

LOOP AT it_mara.
  v_text = it_mara-matnr.
  CALL FUNCTION 'RSPO_WRITE_SPOOLREQUEST'
  EXPORTING
      handle = v_handle
      text   = v_text
  IMPORTING
      rc         = v_rc
      errmessage = v_errmessage
  EXCEPTIONS
      handle_not_valid = 1
  OTHERS = 2.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
ENDLOOP.

CALL FUNCTION 'RSPO_CLOSE_SPOOLREQUEST'
  EXPORTING
    handle           = v_handle
  IMPORTING
    rc               = v_rc
    errmessage       = v_errmessage
  EXCEPTIONS
    handle_not_valid = 1
    OTHERS           = 2.
IF sy-subrc &amp;lt;&amp;gt; 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;and then using CONVERT_ABAPSPOOLJOB_2_PDF&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
  EXPORTING
    src_spoolid              = gd_spool_nr
    no_dialog                 = 'X'
    dst_device               = 'LOCL'
  IMPORTING
    pdf_bytecount         = gd_bytecount
  TABLES
    pdf                           = it_pdf_output
  EXCEPTIONS
    OTHERS                   = 12.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This code was not working and if I check spool its created with RAW data format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to ask you any idea why this is not working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Suneel G&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Sep 2009 09:39:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163481#M1370564</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-30T09:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: Sending attachment using class cl_document_bcs as PDF</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163482#M1370565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It doesn't work because you don't convert the text into abap list format. So you get an undefined spool, although CONVERT_ABAPSPOOLJOB_2_PDF expects an ABAP list spool (while CONVERT_OTFSPOOLJOB_2_PDF function module expects an OTF spool).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, you must use abap WRITE so that to get ABAP list format : you may also use SUBMIT ... EXPORTING LIST TO MEMORY and related function modules (see abap doc) to get an abap list format without generating a spool in background.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Sep 2009 13:25:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163482#M1370565</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2009-09-30T13:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: Sending attachment using class cl_document_bcs as PDF</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163483#M1370566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, my last answer is wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In fact, it doesn't work (you probably get the error message "Impossible to open this file because it doesn't contain any page" from Acrobat Reader) because you have to call function module RSPO_PAGE_BREAK_SPOOLREQUEST to terminate the last page!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note also that you have to manage yourself the page break, otherwise if you write only one page with 20000 lines for example, these lines will be printed on the same unique page, and be overwritten several times, as the PDF converter restarts at the top of 1st page when bottom is reached.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, really, my opinion is that these function modules should be used only in rare cases, use WRITE statement instead.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Sep 2009 15:22:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163483#M1370566</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2009-09-30T15:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: Sending attachment using class cl_document_bcs as PDF</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163484#M1370567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sandra Rossi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; I really thank you for the efforts and appreciate your knowledge.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; If we use this &lt;STRONG&gt;RSPO_PAGE_BREAK_SPOOLREQUEST&lt;/STRONG&gt; my problem can be solved, but need to think when we need a Page   &lt;/P&gt;&lt;P&gt; break.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; As said by Sandra I am using Write statements to get my &lt;STRONG&gt;PDF lines&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Suneel G&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Oct 2009 02:48:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163484#M1370567</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-01T02:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: Sending attachment using class cl_document_bcs as PDF</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163485#M1370568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sandra,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you plz help me in sending email with pdf attachmetnt.&lt;/P&gt;&lt;P&gt;I am getting the output with this FM&lt;/P&gt;&lt;P&gt;CONVERT_OTFSPOOLJOB_2_PDF&lt;/P&gt;&lt;P&gt;SX_TABLE_LINE_WIDTH_CHANGE&lt;/P&gt;&lt;P&gt;SCMS_BINARY_TO_XSTRING&lt;/P&gt;&lt;P&gt;SCMS_XSTRING_TO_BINARY&lt;/P&gt;&lt;P&gt;and sending mail with 'SO_NEW_DOCUMENT_ATT_SEND_API1'  by &lt;/P&gt;&lt;P&gt;passing in content_hex as 'lt_solix'.&lt;/P&gt;&lt;P&gt;But i am getting '.pdf' file with junk values in receiver emailid.&lt;/P&gt;&lt;P&gt;what can be the problem?&lt;/P&gt;&lt;P&gt;I am passing Doc type as 'SCR'.&lt;/P&gt;&lt;P&gt;If I set doc type as 'PDF' in packing list then it gives error &lt;/P&gt;&lt;P&gt;...'Adobe Reader can not open the '.....pdf'  bcoz it is either not a supported filet type.......wasn't correctly decoded'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please tell me what i need to check.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Oct 2010 09:44:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163485#M1370568</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-07T09:44:27Z</dc:date>
    </item>
    <item>
      <title>Re: Sending attachment using class cl_document_bcs as PDF</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163486#M1370569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 12:16:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163486#M1370569</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-06T12:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: Sending attachment using class cl_document_bcs as PDF</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163487#M1370570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;STRONG style="font-size: 11.199999809265137px; background-color: #ffffff; color: #333333;"&gt;&lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" href="https://answers.sap.com/people/suneelkumar.gopisetty" id="jive-20908423484992184368423" style="padding: 0 3px 0 0; font-weight: inherit; font-style: inherit; font-size: 1.1em; font-family: inherit; color: #3778c7;"&gt;Suneel Kumar Gopisetty&lt;/A&gt;..&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please tell me how u solved the issue..&lt;BR /&gt;I'm getting same error while sending PDF attachment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It says "PDF could not be opened, since it has no pages"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any kind of help will be rewarded points.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, &lt;/P&gt;&lt;P&gt;Sandy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Sep 2012 11:52:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-attachment-using-class-cl-document-bcs-as-pdf/m-p/6163487#M1370570</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-09-05T11:52:45Z</dc:date>
    </item>
  </channel>
</rss>

