<?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: Problems when sending PDF attachments.... in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problems-when-sending-pdf-attachments/m-p/12599005#M2010800</link>
    <description>&lt;P&gt;Andrea,&lt;/P&gt;&lt;P&gt;Thanks for your answer. Will check further the size info, although I'm afraid I have tried several approaches without success. The routine I have been using was found, precisely, in the community forums.&lt;/P&gt;&lt;P&gt;Thanks for the tip for avoiding the HTML code.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Regards,&lt;/P&gt;&lt;P&gt;Luis&lt;/P&gt;</description>
    <pubDate>Mon, 03 Oct 2022 13:43:03 GMT</pubDate>
    <dc:creator>luis_rod</dc:creator>
    <dc:date>2022-10-03T13:43:03Z</dc:date>
    <item>
      <title>Problems when sending PDF attachments....</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problems-when-sending-pdf-attachments/m-p/12599003#M2010798</link>
      <description>&lt;P&gt;Hi all:&lt;/P&gt;
  &lt;P&gt;First, let me apologize beforehand, as my ABAP knowledge is self-taught, and I’m pretty sure I must be doing a lot of mistakes. Also, part of the code I’m using is adapted from some examples I have found online, and undoubtedly I must have interpreted those lines in a wrong way. &lt;/P&gt;
  &lt;P&gt;I have a program that creates several files (attachments) to be sent by a single email. Most of them are .CSV, and those are sent (and received) perfectly. Nevertheless, when trying to open the .PDF attachments I get an error message that states that Adobe could not open the file “because it is either not a supported file type or because the file has been damaged”.&lt;/P&gt;
  &lt;P&gt;In my test program, the spool is created using the output created by an ALV program that executes in the background. The relevant code sections are as follow:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;   CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'&lt;BR /&gt;
    EXPORTING&lt;BR /&gt;
      src_spoolid              = pv_spool&lt;BR /&gt;
      no_dialog                = ' '&lt;BR /&gt;
      dst_device               = 'LOCL'&lt;BR /&gt;
    IMPORTING&lt;BR /&gt;
      pdf_bytecount            = pdf_bytecount&lt;BR /&gt;
    TABLES&lt;BR /&gt;
      pdf                      = lt_pdf-SPAN {
font-family: "Courier New";
font-size: 12pt;
color: #000000;
background: #FFFFFF;
}.L0S33 {
color: #4DA619;
}.L0S52 {
color: #0000FF;
}.L0S55 {
color: #800080;
}&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;After that, I convert lt_pdf to a single string:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;CLEAR gv_buffer.&lt;BR /&gt;
  LOOP AT lt_pdf.&lt;BR /&gt;
    CONCATENATE gv_buffer lt_pdf INTO gv_buffer.&lt;BR /&gt;
  ENDLOOP.
SPAN {
font-family: "Courier New";
font-size: 12pt;
color: #000000;
background: #FFFFFF;
}.L0S52 {
color: #0000FF;
}.L0S55 {
color: #800080;
}&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;And add the attachment to my email:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;
    TRY.&lt;BR /&gt;
        cl_bcs_convert=&amp;gt;string_to_solix(&lt;BR /&gt;
        EXPORTING&lt;BR /&gt;
          iv_string   = gv_buffer&lt;BR /&gt;
          iv_codepage = ' '&lt;BR /&gt;
          iv_add_bom  = 'X'&lt;BR /&gt;
        IMPORTING&lt;BR /&gt;
          et_solix  = binary_content&lt;BR /&gt;
          ev_size   = size ).&lt;BR /&gt;
      CATCH cx_bcs.&lt;BR /&gt;
        MESSAGE e445(so).&lt;BR /&gt;
    ENDTRY.&lt;BR /&gt;
    lv_name = w_string.&lt;BR /&gt;
    document-&amp;gt;add_attachment(&lt;BR /&gt;
    i_attachment_type    = 'pdf'&lt;BR /&gt;
    i_attachment_subject = lv_name&lt;BR /&gt;
    i_attachment_size    = size&lt;BR /&gt;
    i_att_content_hex    = binary_content ).&lt;BR /&gt;
    send_request-&amp;gt;set_document( document ).
SPAN {
font-family: "Courier New";
font-size: 12pt;
color: #000000;
background: #FFFFFF;
}.L0S33 {
color: #4DA619;
}.L0S52 {
color: #0000FF;
}.L0S55 {
color: #800080;
}.L0S70 {
color: #808080;
}&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;But, as stated before, this is not working.&lt;/P&gt;
  &lt;P&gt;&lt;BR /&gt;Any ideas?&lt;/P&gt;
  &lt;P&gt;&lt;BR /&gt;TIA,&lt;/P&gt;
  &lt;P&gt;Luis&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 01:25:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problems-when-sending-pdf-attachments/m-p/12599003#M2010798</guid>
      <dc:creator>luis_rod</dc:creator>
      <dc:date>2022-10-03T01:25:55Z</dc:date>
    </item>
    <item>
      <title>Re: Problems when sending PDF attachments....</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problems-when-sending-pdf-attachments/m-p/12599004#M2010799</link>
      <description>&lt;P&gt;Most of the time, when this issue occurs it is due to a wrong size parameter, which is either omitted or incorrectly derived. This is where I'd concentrate my attention. In the forums and in the blogs you can find &lt;A href="https://blogs.sap.com/2018/06/16/using-abap2xlsx-to-send-alv-table-output-as-excel-spreadsheet-via-internet-email/" target="_blank"&gt;complete functioning examples&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Also, please remember to switch back to display mode when copying code from the GUI: this will avoide the html noise, like "span" and similar.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 07:52:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problems-when-sending-pdf-attachments/m-p/12599004#M2010799</guid>
      <dc:creator>abo</dc:creator>
      <dc:date>2022-10-03T07:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: Problems when sending PDF attachments....</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problems-when-sending-pdf-attachments/m-p/12599005#M2010800</link>
      <description>&lt;P&gt;Andrea,&lt;/P&gt;&lt;P&gt;Thanks for your answer. Will check further the size info, although I'm afraid I have tried several approaches without success. The routine I have been using was found, precisely, in the community forums.&lt;/P&gt;&lt;P&gt;Thanks for the tip for avoiding the HTML code.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Regards,&lt;/P&gt;&lt;P&gt;Luis&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 13:43:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problems-when-sending-pdf-attachments/m-p/12599005#M2010800</guid>
      <dc:creator>luis_rod</dc:creator>
      <dc:date>2022-10-03T13:43:03Z</dc:date>
    </item>
    <item>
      <title>Re: Problems when sending PDF attachments....</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problems-when-sending-pdf-attachments/m-p/12599006#M2010801</link>
      <description>&lt;P&gt;Rewrote both, the size determination and the send code, and now it works. &lt;/P&gt;&lt;P&gt;Thanks to Andrea for steering me in the right direction.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 20:33:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problems-when-sending-pdf-attachments/m-p/12599006#M2010801</guid>
      <dc:creator>luis_rod</dc:creator>
      <dc:date>2022-10-03T20:33:31Z</dc:date>
    </item>
  </channel>
</rss>

