<?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 With Class CL_DOCUMENT_BCS in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-class-cl-document-bcs/m-p/2700308#M625330</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Andrew!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the info.  It was a bit weird because the function SX_OBJECT_CONVERT_OTF_PDF have different parameters from the ones given by aRs, but checking the function code itself I discovered that formatting of the table is very much similar to the code you gave.  Will try this.  Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Aug 2007 04:23:57 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-08-10T04:23:57Z</dc:date>
    <item>
      <title>Problem With Class CL_DOCUMENT_BCS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-class-cl-document-bcs/m-p/2700302#M625324</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello!  I hope someone could help me on this one...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am now trying to develop a program that sends an email with multiple pdf attachments.  I saw in one of the threads I think that an alternative to using the function modules is to use methods.  The steps I did prior to the email subroutine are the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.  Call the Smartform to return an OTF table&lt;/P&gt;&lt;P&gt;2.  Convert the OTF  Using the 'CONVERT_OTF' function&lt;/P&gt;&lt;P&gt;3. Call the email subroutine&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I am having some problems with the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;    document = cl_document_bcs=&amp;gt;create_document(
               i_type = 'RAW'
               i_text = text
               i_length = '12'
               i_subject = '' ).

*--- Add attachments
    IF NOT t_pdf_vrs[] IS INITIAL.
      CLEAR binary_content[].
         binary_content[] = t_pdf_vrs[].        "&amp;lt;==PROBLEM HERE
      CASE p_rtyp.
      WHEN 'V'.
        CONCATENATE 'VRS' p_lifnr sy-datlo
               INTO i_att_sub separated by '_'.
        CALL METHOD document-&amp;gt;add_attachment
        EXPORTING
        i_attachment_type    = 'PDF'
        i_attachment_subject = i_att_sub
        i_att_content_hex    = binary_content.
      WHEN 'M',
      ENDCASE.
    ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get an error saying:&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;"BINARY_CONTENT" and "T_PDF_VRS" are not mutually convertible.  In Unicode programs, "BINARY_CONTENT" must have the same structure layout as "T_PDF_VRS", independent of the length of a Unicode character.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The declarations of the tables in question are the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA binary_content TYPE solix_tab.
DATA t_pdf_vrs          LIKE tline OCCURS 0 with HEADER LINE.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The t_pdf_vrs table contains the &amp;lt;b&amp;gt;lines&amp;lt;/b&amp;gt; parameter  from the CONVERT_OTF fm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help.  Points for any helpful answer.&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Aug 2007 23:35:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-class-cl-document-bcs/m-p/2700302#M625324</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-09T23:35:49Z</dc:date>
    </item>
    <item>
      <title>Re: Problem With Class CL_DOCUMENT_BCS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-class-cl-document-bcs/m-p/2700303#M625325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;chk both internal fields are same.&lt;/P&gt;&lt;P&gt;binary_content[] = t_pdf_vrs[]. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;refer the same strture.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Aug 2007 01:20:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-class-cl-document-bcs/m-p/2700303#M625325</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-10T01:20:58Z</dc:date>
    </item>
    <item>
      <title>Re: Problem With Class CL_DOCUMENT_BCS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-class-cl-document-bcs/m-p/2700304#M625326</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;Try to use SX_OBJECT_CONVERT_OTF_PDF instead of CONVERT_OTF&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
EXPORTING
format_src = 'OTF'
format_dst = 'PDF'
devtype = 'PRINTER'
len_in = lv_len_in
TABLES
content_in = lt_content_in
content_out = lt_content_out.

gt_pdfdata[] = lt_content_out[].
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;aRs&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Aug 2007 01:33:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-class-cl-document-bcs/m-p/2700304#M625326</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2007-08-10T01:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: Problem With Class CL_DOCUMENT_BCS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-class-cl-document-bcs/m-p/2700305#M625327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi aRs,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I checked the FM you suggested, I got different parameters:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
  EXPORTING
    FORMAT_SRC            =
    FORMAT_DST            =
*   ADDR_TYPE             =
*   DEVTYPE               =
*   FUNCPARA              =
  CHANGING
    TRANSFER_BIN          =
    CONTENT_TXT           =
    CONTENT_BIN           =
    OBJHEAD               =
    LEN                   =
* EXCEPTIONS
*   ERR_CONV_FAILED       = 1
*   OTHERS                = 2
          .
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Aug 2007 02:17:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-class-cl-document-bcs/m-p/2700305#M625327</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-10T02:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: Problem With Class CL_DOCUMENT_BCS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-class-cl-document-bcs/m-p/2700306#M625328</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;Check this link&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="2873081"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;aRs&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Aug 2007 03:03:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-class-cl-document-bcs/m-p/2700306#M625328</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2007-08-10T03:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: Problem With Class CL_DOCUMENT_BCS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-class-cl-document-bcs/m-p/2700307#M625329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The CONVERT_OTF_2_PDF function returns the PDF data in a table of STRUCTURE  TLINE which has lines of 134 characters long (2 + 132).  The send email functions or methods want the data in a structure of length 255 (TYPE  SOLI_TAB).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The returned PDF data is actually binary data, so you need to combine the input table entries as a single long string, and then split this into the output as blocks of 255 characters.  Take care using CONCATENATE to do this - it trims spaces which corrupts the PDF if you do not have the RESPECTING BLANKS addition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  DATA: l_str TYPE string.
  LOOP AT it_input.
    CONCATENATE l_str it_input INTO l_str RESPECTING BLANKS.
  ENDLOOP.

  DATA: l_len TYPE i.
  DO.
    l_len = STRLEN( l_str ).
    IF l_len = 0. EXIT. ENDIF.
    IF l_len &amp;gt; 255. l_len = 255. ENDIF.
    it_output = l_str+0(l_len).
    APPEND it_output.
    l_str = l_str+l_len.
  ENDDO.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Andrew Marshall&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Aug 2007 03:44:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-class-cl-document-bcs/m-p/2700307#M625329</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-10T03:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: Problem With Class CL_DOCUMENT_BCS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-class-cl-document-bcs/m-p/2700308#M625330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Andrew!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the info.  It was a bit weird because the function SX_OBJECT_CONVERT_OTF_PDF have different parameters from the ones given by aRs, but checking the function code itself I discovered that formatting of the table is very much similar to the code you gave.  Will try this.  Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Aug 2007 04:23:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-class-cl-document-bcs/m-p/2700308#M625330</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-10T04:23:57Z</dc:date>
    </item>
  </channel>
</rss>

