<?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: Problem using FM SO_ATTACHMENT_INSERT in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-using-fm-so-attachment-insert/m-p/3623538#M872962</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Bala, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The table which i am passing to SO_ATTACHMENT_INSERT, is already same as you have suggested, but stil it gives error while opening, what i noticed is the no of bytes of the file that i get are reduced ,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 24 Mar 2008 08:53:12 GMT</pubDate>
    <dc:creator>former_member97974</dc:creator>
    <dc:date>2008-03-24T08:53:12Z</dc:date>
    <item>
      <title>Problem using FM SO_ATTACHMENT_INSERT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-using-fm-so-attachment-insert/m-p/3623536#M872960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i am using the FM SO_ATTACHMENT_INSERT for attaching a file content in PDF format in a folder, now the prblem is weh i send this attacment through mail, i get the PDF document but it gives the error while opening, it says file is damaged,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Mar 2008 07:48:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-using-fm-so-attachment-insert/m-p/3623536#M872960</guid>
      <dc:creator>former_member97974</dc:creator>
      <dc:date>2008-03-24T07:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: Problem using FM SO_ATTACHMENT_INSERT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-using-fm-so-attachment-insert/m-p/3623537#M872961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After using the FM &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA : POS TYPE I,
         STUFF(65000),
         LEN TYPE I,
         COMPRESSED_SIZE LIKE SY-INDEX,
         COMPRESSED_ATTACHMENT LIKE SOLI OCCURS 100 WITH HEADER LINE,
          W_OBJECT_HD_CHANGE LIKE SOOD1.
  DATA: CLIENT LIKE TST01-DCLIENT,
        DNAME LIKE TST01-DNAME,
        OBJTYPE LIKE RSTSTYPE-TYPE,
        TYPE LIKE RSTSTYPE-TYPE.
  DATA PDF LIKE TLINE OCCURS 100 WITH HEADER LINE.

 CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
        EXPORTING
          SRC_SPOOLID                    = P_SPOOLNO
          NO_DIALOG                      = ' '
*       DST_DEVICE                     =
*       PDF_DESTINATION                =
        IMPORTING
          PDF_BYTECOUNT                  = NUMBYTES
          PDF_SPOOLID                    = PDFSPOOLID
*       OTF_PAGECOUNT                  =
          BTC_JOBNAME                    = JOBNAME
          BTC_JOBCOUNT                   = JOBCOUNT
        TABLES
          PDF                            = 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.
  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.

LOOP AT PDF INTO PDF.
    IF POS = 34170.
      PERFORM ATTACH TABLES COMPRESSED_ATTACHMENT USING POS LEN STUFF .
    ENDIF.
    STUFF+POS(134) = PDF.
    ADD 134 TO POS.
  ENDLOOP.
  IF NOT ( STUFF IS INITIAL ).
    PERFORM ATTACH TABLES COMPRESSED_ATTACHMENT USING POS LEN STUFF .
    CLEAR POS.
    LEN = STRLEN( STUFF ).
    WHILE LEN &amp;gt; 0.
      SUBTRACT 255 FROM LEN.
      COMPRESSED_ATTACHMENT = STUFF+POS(255).
      APPEND COMPRESSED_ATTACHMENT.
      ADD 255 TO POS.
    ENDWHILE.
    CLEAR POS.
    CLEAR STUFF.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use this Procedure before the calling FM SO_ATTACHMENT_INSERT .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Balakumar.G.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rewards Point if helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Mar 2008 08:38:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-using-fm-so-attachment-insert/m-p/3623537#M872961</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-24T08:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: Problem using FM SO_ATTACHMENT_INSERT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-using-fm-so-attachment-insert/m-p/3623538#M872962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Bala, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The table which i am passing to SO_ATTACHMENT_INSERT, is already same as you have suggested, but stil it gives error while opening, what i noticed is the no of bytes of the file that i get are reduced ,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Mar 2008 08:53:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-using-fm-so-attachment-insert/m-p/3623538#M872962</guid>
      <dc:creator>former_member97974</dc:creator>
      <dc:date>2008-03-24T08:53:12Z</dc:date>
    </item>
  </channel>
</rss>

