<?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: Error when executing call transformation in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-executing-call-transformation/m-p/1420229#M201785</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The itab which i pass is the sflight internal table filled with values from the sflight db table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess when u use the xstring type in the transformation function no conversion from string to xstring is necsesary anymore.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i believe i do not use encoding?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"you want to read data from some DB table , convert it to XML and email the same as attchment - is that right? confirm this i will post a complete sample code."&lt;/P&gt;&lt;P&gt;Please do post a complete sample.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thnx for your fast replies!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Martijn.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 23 Jul 2006 12:57:47 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-07-23T12:57:47Z</dc:date>
    <item>
      <title>Error when executing call transformation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-executing-call-transformation/m-p/1420227#M201783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Raja,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I copied your code to a test program, but when i execute the "Call transformation" the generated string (output) contains an unknown character which causes the function module 'SCMS_STRING_TO_XSTRING' to raise an error(unknown character). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When i debug the program i see that the first character of the 'output'-string is a square. When i delete this first charcter, everything goes well......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Why not directly execute the call transformation to an xstring instead of a normal string?&lt;/P&gt;&lt;P&gt;- Any suggestions on what might create this unknown character?&lt;/P&gt;&lt;P&gt;- Any change you could post the rest of your code as a sample? So an example of the way you fill the rest of the document-object and which function you use to send the e-mail?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Martijn de Jong.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Jul 2006 11:55:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-executing-call-transformation/m-p/1420227#M201783</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-23T11:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: Error when executing call transformation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-executing-call-transformation/m-p/1420228#M201784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;so i guess the data type of output is string. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is there anything special about the itab passed to call transformation?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as per the documentation the variable for xmloutput can be&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;i&amp;gt;Data object of type string and xstring or as a standard table with flat character-type row type,&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but i have never tried using other than string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Any suggestions on what might create this unknown character?&lt;/P&gt;&lt;P&gt;may be encoding in causing this - try the option without encoding in call transformation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let me understand your complete requirement.&lt;/P&gt;&lt;P&gt;you want to read data from some DB table , convert it to XML and email the same as attchment - is that right? confirm this i will post a complete sample code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for emailing, i use CL_bcs class. you can refer the following code sample for this&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5931ff64-0a01-0010-2bb7-ff2f9a6165a0" target="test_blank"&gt;https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5931ff64-0a01-0010-2bb7-ff2f9a6165a0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/7f601a65-0a01-0010-16a5-c369f2a9fa87" target="test_blank"&gt;https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/7f601a65-0a01-0010-16a5-c369f2a9fa87&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Jul 2006 12:18:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-executing-call-transformation/m-p/1420228#M201784</guid>
      <dc:creator>athavanraja</dc:creator>
      <dc:date>2006-07-23T12:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: Error when executing call transformation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-executing-call-transformation/m-p/1420229#M201785</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The itab which i pass is the sflight internal table filled with values from the sflight db table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess when u use the xstring type in the transformation function no conversion from string to xstring is necsesary anymore.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i believe i do not use encoding?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"you want to read data from some DB table , convert it to XML and email the same as attchment - is that right? confirm this i will post a complete sample code."&lt;/P&gt;&lt;P&gt;Please do post a complete sample.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thnx for your fast replies!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Martijn.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Jul 2006 12:57:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-executing-call-transformation/m-p/1420229#M201785</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-23T12:57:47Z</dc:date>
    </item>
    <item>
      <title>Re: Error when executing call transformation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-executing-call-transformation/m-p/1420230#M201786</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;here is the code sample.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT ymailxml
       NO STANDARD PAGE HEADING.

DATA:       ftab TYPE STANDARD TABLE OF sflight .

DATA: xml_out TYPE Xstring .
DATA: binary_content     TYPE solix_tab.
DATA : text_tab TYPE soli_tab .
DATA: send_request       TYPE REF TO cl_bcs.
DATA: text               TYPE bcsy_text.
DATA: document           TYPE REF TO cl_document_bcs.
DATA: sender             TYPE REF TO if_sender_bcs.
DATA: recipient          TYPE REF TO if_recipient_bcs.
DATA: bcs_exception      TYPE REF TO cx_bcs.
DATA: sent_to_all        TYPE os_boolean.
DATA: conlength TYPE i ,
      conlengths TYPE so_obj_len ,
      result_content TYPE string .
DATA: content_length	TYPE	w3param-cont_len ,
      content_type	TYPE	w3param-cont_type,
      return_code	TYPE	w3param-ret_code .

DATA: bcs_message TYPE string .
CLEAR: ftab.
REFRESH: ftab .

PARAMETERS: send_id TYPE ad_smtpadr LOWER CASE OBLIGATORY DEFAULT 'sender@xyz.com',
            rec_id TYPE ad_smtpadr  LOWER CASE  OBLIGATORY DEFAULT 'receiver@xyz.com' .

START-OF-SELECTION .

  SELECT * UP TO 10 ROWS FROM sflight INTO TABLE ftab .

  CALL TRANSFORMATION (`ID`)
  SOURCE itab = ftab[]
  RESULT XML xml_out.


  REFRESH binary_content .
  CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
    EXPORTING
      buffer     = xml_out
    TABLES
      binary_tab = binary_content.


  TRY.
      CLEAR send_request .

      send_request = cl_bcs=&amp;gt;create_persistent( ).

      CLEAR document .
      APPEND 'Test XML Message' TO text .

      document = cl_document_bcs=&amp;gt;create_document(
                      i_type    = 'HTM'
                      i_text    = text
                      i_subject = 'Test' ).

      CALL METHOD document-&amp;gt;add_attachment
        EXPORTING
          i_attachment_type    = 'xml'
          i_attachment_subject = 'TestXML'
          i_att_content_hex    = binary_content.

*     add document to send request
      CALL METHOD send_request-&amp;gt;set_document( document ).

      CLEAR sender .
      sender = cl_cam_address_bcs=&amp;gt;create_internet_address( send_id ).
      CALL METHOD send_request-&amp;gt;set_sender
        EXPORTING
          i_sender = sender.

      CLEAR recipient .

      recipient = cl_cam_address_bcs=&amp;gt;create_internet_address(
                                        rec_id ).

*     add recipient with its respective attributes to send request
      CALL METHOD send_request-&amp;gt;add_recipient
        EXPORTING
          i_recipient = recipient
          i_express   = 'X'.
      CALL METHOD send_request-&amp;gt;set_status_attributes
        EXPORTING
          i_requested_status = 'E'
          i_status_mail      = 'E'.

      CALL METHOD send_request-&amp;gt;set_send_immediately( 'X' ).
*     ---------- send document ---------------------------------------
      CALL METHOD send_request-&amp;gt;send(
        EXPORTING
          i_with_error_screen = 'X'
        RECEIVING
          result              = sent_to_all ).
      IF sent_to_all = 'X'.
        WRITE:/  'Mail sent successfully ' .
      ENDIF.

      COMMIT WORK.

    CATCH cx_bcs INTO bcs_exception.
      bcs_message = bcs_exception-&amp;gt;get_text( ).
      WRITE:/  bcs_message .
      EXIT.

  ENDTRY.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Jul 2006 09:08:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-executing-call-transformation/m-p/1420230#M201786</guid>
      <dc:creator>athavanraja</dc:creator>
      <dc:date>2006-07-24T09:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: Error when executing call transformation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-executing-call-transformation/m-p/1420231#M201787</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thnx Raja,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good to see that you tried the transformation directly in a Xstring.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I copied your source code example to a local program. everything works well, except that the XML-file which is created, contains errors when i open it. When i edit it, the only thing i can find is that the file ends with alot of spaces. When i remove these spaces, the XML can be displayed fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you get the same or have any idea on what to do?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Martijn.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Jul 2006 12:47:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-executing-call-transformation/m-p/1420231#M201787</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-24T12:47:50Z</dc:date>
    </item>
    <item>
      <title>Re: Error when executing call transformation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-executing-call-transformation/m-p/1420232#M201788</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;lt;i&amp;gt;Do you get the same or have any idea on what to do?&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes i get the same error which i havent noticed, when i open the xml from mail, it opened in a small ie window and the xml error is at the bottom which i failed to notice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The fix suggested below, removes this error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just add the content length to add attachment method. it should be alright.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;calculate the length.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear conlengths .&lt;/P&gt;&lt;P&gt;  conlengths = xstrlen( xml_out ) .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;replace the code for adding attchment with the following code.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL METHOD document-&amp;gt;add_attachment&lt;/P&gt;&lt;P&gt;        EXPORTING&lt;/P&gt;&lt;P&gt;          i_attachment_type    = 'xml'&lt;/P&gt;&lt;P&gt;          i_attachment_subject = 'TestXML'&lt;/P&gt;&lt;P&gt;         &amp;lt;b&amp;gt; I_ATTACHMENT_SIZE    = conlengths&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;          i_att_content_hex    = binary_content.&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;Raja&lt;/P&gt;&lt;P&gt;Reward points to helpful answers and mark the thread as answered once your question is answered.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jul 2006 05:16:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-executing-call-transformation/m-p/1420232#M201788</guid>
      <dc:creator>athavanraja</dc:creator>
      <dc:date>2006-07-25T05:16:24Z</dc:date>
    </item>
    <item>
      <title>Re: Error when executing call transformation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-executing-call-transformation/m-p/1420233#M201789</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Raja,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Great! Many many many thanks! I had looked for a method to calculate the length of the RAW binary content table, which i couldn't find, but didn't think that i could also use the length of the xstring!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You've been a great help, sorry that i can only reward you with 10 points!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many regards!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Martijn.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jul 2006 06:23:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-when-executing-call-transformation/m-p/1420233#M201789</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-25T06:23:37Z</dc:date>
    </item>
  </channel>
</rss>

