<?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 in FM SO_DOCUMENT_SEND_API1 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-fm-so-document-send-api1/m-p/4948201#M1153863</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you please advise on how did you manage to remove the distorted field in the column.&lt;/P&gt;&lt;P&gt;Even I am facing the same issue while using the above FM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; regards,&lt;/P&gt;&lt;P&gt;Pushkar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 06 Sep 2010 01:07:21 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-09-06T01:07:21Z</dc:date>
    <item>
      <title>Problem in FM SO_DOCUMENT_SEND_API1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-fm-so-document-send-api1/m-p/4948197#M1153859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using FM SO_DOCUMENT_SEND_API1 to send excel attachment in a mail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The data is coming correctly but data in one column is coming in distorted format with lot of spaces that are not given at any point. I used 'CONDENSE' in all fields but it didnt help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly advice where can be the problem or any alternative FM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dinesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Dec 2008 06:31:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-fm-so-document-send-api1/m-p/4948197#M1153859</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-15T06:31:40Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in FM SO_DOCUMENT_SEND_API1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-fm-so-document-send-api1/m-p/4948198#M1153860</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;use the procedure given below it will definately solve your problem: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Firstly export  the data to memory using the FM LIST_FROM_MEMORY. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'LIST_FROM_MEMORY'&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;listobject = t_listobject&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;not_found = 1&lt;/P&gt;&lt;P&gt;OTHERS = 2.&lt;/P&gt;&lt;P&gt;IF sy-subrc 0.&lt;/P&gt;&lt;P&gt;MESSAGE e000(su) WITH text-001.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then i converted it into ASCII using LIST_TO_ASCI,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'LIST_TO_ASCI'&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;listasci = t_xlstab&lt;/P&gt;&lt;P&gt;listobject = t_listobject&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;empty_list = 1&lt;/P&gt;&lt;P&gt;list_index_invalid = 2&lt;/P&gt;&lt;P&gt;OTHERS = 3.&lt;/P&gt;&lt;P&gt;IF sy-subrc NE 0.&lt;/P&gt;&lt;P&gt;MESSAGE e003(yuksdbfzs).&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This gives the data in ASCII format separated by '|' and the header has '-', dashes. If you use this internal table directly without any proccesing in SO_NEW_DOCUMENT_ATT_SEND_API1, then you will not get a good excel sheet attachment. To overcome this limitation, i used cl_abap_char_utilities=&amp;gt;newline and cl_abap_char_utilities=&amp;gt;horizontal_tab to add horizontal and vertical tabs to the internal table, replacing all occurences of '|' with &lt;/P&gt;&lt;P&gt;cl_abap_char_utilities=&amp;gt;horizontal_tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set the doc_type as 'XLS', create the body and header using the packing_list and pass the data to be downloaded to SO_NEW_DOCUMENT_ATT_SEND_API1 as contents_bin.&lt;/P&gt;&lt;P&gt;This will create an excel attachment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sample code for formatting the data for the attachment in excel format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u2022	Format the data for excel file download &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT t_xlstab INTO wa_xlstab .&lt;/P&gt;&lt;P&gt;DESCRIBE TABLE t_xlstab LINES lw_cnt.&lt;/P&gt;&lt;P&gt;CLEAR lw_sytabix.&lt;/P&gt;&lt;P&gt;lw_sytabix = sy-tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u2022	If not new line then replace '|' by tabs &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT wa_xlstab EQ cl_abap_char_utilities=&amp;gt;newline.&lt;/P&gt;&lt;P&gt;REPLACE ALL OCCURRENCES OF '|' IN wa_xlstab&lt;/P&gt;&lt;P&gt;WITH cl_abap_char_utilities=&amp;gt;horizontal_tab.&lt;/P&gt;&lt;P&gt;MODIFY t_xlstab FROM wa_xlstab .&lt;/P&gt;&lt;P&gt;CLEAR wa_xlstab.&lt;/P&gt;&lt;P&gt;wa_xlstab = cl_abap_char_utilities=&amp;gt;newline.&lt;/P&gt;&lt;P&gt;IF lw_cnt NE 0 .&lt;/P&gt;&lt;P&gt;lw_sytabix = lw_sytabix + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u2022	Insert new line for the excel data &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INSERT wa_xlstab INTO t_xlstab INDEX lw_sytabix.&lt;/P&gt;&lt;P&gt;lw_cnt = lw_cnt - 1.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;CLEAR wa_xlstab.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;Sample code for creating attachment and sending mail:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM send_mail .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u2022	Define the attachment format &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lw_doc_type = 'XLS'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u2022	Create the document which is to be sent &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lwa_doc_chng-obj_name = 'List'.&lt;/P&gt;&lt;P&gt;lwa_doc_chng-obj_descr = w_subject. "Subject&lt;/P&gt;&lt;P&gt;lwa_doc_chng-obj_langu = sy-langu.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u2022	Fill the document data and get size of message &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT t_message.&lt;/P&gt;&lt;P&gt;lt_objtxt = t_message-line.&lt;/P&gt;&lt;P&gt;APPEND lt_objtxt.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DESCRIBE TABLE lt_objtxt LINES lw_tab_lines.&lt;/P&gt;&lt;P&gt;IF lw_tab_lines GT 0.&lt;/P&gt;&lt;P&gt;READ TABLE lt_objtxt INDEX lw_tab_lines.&lt;/P&gt;&lt;P&gt;lwa_doc_chng-doc_size = ( lw_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).&lt;/P&gt;&lt;P&gt;lwa_doc_chng-obj_langu = sy-langu.&lt;/P&gt;&lt;P&gt;lwa_doc_chng-sensitivty = 'F'.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;lwa_doc_chng-doc_size = 0.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u2022	Fill Packing List For the body of e-mail &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lt_packing_list-head_start = 1.&lt;/P&gt;&lt;P&gt;lt_packing_list-head_num = 0.&lt;/P&gt;&lt;P&gt;lt_packing_list-body_start = 1.&lt;/P&gt;&lt;P&gt;lt_packing_list-body_num = lw_tab_lines.&lt;/P&gt;&lt;P&gt;lt_packing_list-doc_type = 'RAW'.&lt;/P&gt;&lt;P&gt;APPEND lt_packing_list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u2022	Create the attachment (the list itself) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DESCRIBE TABLE t_xlstab LINES lw_tab_lines.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u2022	Fill the fields of the packing_list for creating the attachment: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lt_packing_list-transf_bin = 'X'.&lt;/P&gt;&lt;P&gt;lt_packing_list-head_start = 1.&lt;/P&gt;&lt;P&gt;lt_packing_list-head_num = 0.&lt;/P&gt;&lt;P&gt;lt_packing_list-body_start = 1.&lt;/P&gt;&lt;P&gt;lt_packing_list-body_num = lw_tab_lines.&lt;/P&gt;&lt;P&gt;lt_packing_list-doc_type = lw_doc_type.&lt;/P&gt;&lt;P&gt;lt_packing_list-obj_name = 'Attach'.&lt;/P&gt;&lt;P&gt;lt_packing_list-obj_descr = w_docdesc.&lt;/P&gt;&lt;P&gt;lt_packing_list-doc_size = lw_tab_lines * 255.&lt;/P&gt;&lt;P&gt;APPEND lt_packing_list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u2022	Fill the mail recipient list &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lt_reclist-rec_type = 'U'.&lt;/P&gt;&lt;P&gt;LOOP AT t_recipient_list.&lt;/P&gt;&lt;P&gt;lt_reclist-receiver = t_recipient_list-address.&lt;/P&gt;&lt;P&gt;APPEND lt_reclist.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u2022	Finally send E-Mail &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;document_data = lwa_doc_chng&lt;/P&gt;&lt;P&gt;put_in_outbox = 'X'&lt;/P&gt;&lt;P&gt;commit_work = 'X'&lt;/P&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;P&gt;sent_to_all = lw_sent_to_all&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;packing_list = lt_packing_list&lt;/P&gt;&lt;P&gt;object_header = lt_objhead&lt;/P&gt;&lt;P&gt;contents_bin = t_xlstab&lt;/P&gt;&lt;P&gt;contents_txt = lt_objtxt&lt;/P&gt;&lt;P&gt;receivers = lt_reclist&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;too_many_receivers = 1&lt;/P&gt;&lt;P&gt;document_not_sent = 2&lt;/P&gt;&lt;P&gt;document_type_not_exist = 3&lt;/P&gt;&lt;P&gt;operation_no_authorization = 4&lt;/P&gt;&lt;P&gt;parameter_error = 5&lt;/P&gt;&lt;P&gt;x_error = 6&lt;/P&gt;&lt;P&gt;enqueue_error = 7&lt;/P&gt;&lt;P&gt;OTHERS = 8.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it will help you&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Rahul sharma&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Dec 2008 06:48:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-fm-so-document-send-api1/m-p/4948198#M1153860</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-15T06:48:57Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in FM SO_DOCUMENT_SEND_API1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-fm-so-document-send-api1/m-p/4948199#M1153861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dinesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check out this link -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/sending-email-with-attachment.htm" target="test_blank"&gt;http://www.sap-img.com/abap/sending-email-with-attachment.htm&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Seema Chand.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Dec 2008 09:01:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-fm-so-document-send-api1/m-p/4948199#M1153861</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-15T09:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in FM SO_DOCUMENT_SEND_API1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-fm-so-document-send-api1/m-p/4948200#M1153862</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;solved on own.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jun 2009 10:13:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-fm-so-document-send-api1/m-p/4948200#M1153862</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-12T10:13:09Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in FM SO_DOCUMENT_SEND_API1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-fm-so-document-send-api1/m-p/4948201#M1153863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you please advise on how did you manage to remove the distorted field in the column.&lt;/P&gt;&lt;P&gt;Even I am facing the same issue while using the above FM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; regards,&lt;/P&gt;&lt;P&gt;Pushkar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Sep 2010 01:07:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-fm-so-document-send-api1/m-p/4948201#M1153863</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-09-06T01:07:21Z</dc:date>
    </item>
  </channel>
</rss>

