<?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: send sapscript to customer in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/send-sapscript-to-customer/m-p/2481382#M559105</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It´s resolved, thanks!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 25 Jun 2007 08:47:43 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-06-25T08:47:43Z</dc:date>
    <item>
      <title>send sapscript to customer</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/send-sapscript-to-customer/m-p/2481376#M559099</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;could I use the function USE_SEND_OBJECT to send a sapscript (an invoice) to an external mail (customer email) ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 06:10:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/send-sapscript-to-customer/m-p/2481376#M559099</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-21T06:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: send sapscript to customer</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/send-sapscript-to-customer/m-p/2481377#M559100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="302522"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do like this .&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;Peram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 06:47:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/send-sapscript-to-customer/m-p/2481377#M559100</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-21T06:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: send sapscript to customer</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/send-sapscript-to-customer/m-p/2481378#M559101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt; Try with this:&lt;/P&gt;&lt;P&gt; 'SO_NEW_DOCUMENT_ATT_SEND_API1&lt;/P&gt;&lt;P&gt;Hope this helps you. Reply for queries, shall post the updates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.  &lt;/P&gt;&lt;P&gt;Kumar.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 07:02:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/send-sapscript-to-customer/m-p/2481378#M559101</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-21T07:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: send sapscript to customer</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/send-sapscript-to-customer/m-p/2481379#M559102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks! &lt;/P&gt;&lt;P&gt;I´ll try it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 07:26:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/send-sapscript-to-customer/m-p/2481379#M559102</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-21T07:26:01Z</dc:date>
    </item>
    <item>
      <title>Re: send sapscript to customer</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/send-sapscript-to-customer/m-p/2481380#M559103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Juan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Go through the follwoing Code&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;



DATA: ITCPO LIKE ITCPO,
TAB_LINES LIKE SY-TABIX.


* Variables for EMAIL functionality
DATA: MAILDATA LIKE SODOCCHGI1.
DATA: MAILPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
DATA: MAILHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
DATA: MAILBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: MAILTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: MAILREC LIKE SOMLREC90 OCCURS 0 WITH HEADER LINE.
DATA: SOLISTI1 LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.


PERFORM SEND_FORM_VIA_EMAIL.


************************************************************************
* FORM SEND_FORM_VIA_EMAIL *
************************************************************************
FORM SEND_FORM_VIA_EMAIL.

CLEAR: MAILDATA, MAILTXT, MAILBIN, MAILPACK, MAILHEAD, MAILREC.
REFRESH: MAILTXT, MAILBIN, MAILPACK, MAILHEAD, MAILREC.

* Creation of the document to be sent File Name
MAILDATA-OBJ_NAME = 'TEST'.
* Mail Subject
MAILDATA-OBJ_DESCR = 'Subject'.

* Mail Contents
MAILTXT-LINE = 'Here is your file'.
APPEND MAILTXT.

* Prepare Packing List
PERFORM PREPARE_PACKING_LIST.

* Set recipient - email address here!!!
MAILREC-RECEIVER = 'itsme@whatever.com'.
MAILREC-REC_TYPE = 'U'.
APPEND MAILREC.

* Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = MAILDATA
PUT_IN_OUTBOX = ' '
TABLES
PACKING_LIST = MAILPACK
OBJECT_HEADER = MAILHEAD
CONTENTS_BIN = MAILBIN
CONTENTS_TXT = MAILTXT
RECEIVERS = MAILREC
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.

ENDFORM.

************************************************************************
* Form PREPARE_PACKING_LIST
************************************************************************
FORM PREPARE_PACKING_LIST.

CLEAR: MAILPACK, MAILBIN, MAILHEAD.
REFRESH: MAILPACK, MAILBIN, MAILHEAD.

DESCRIBE TABLE MAILTXT LINES TAB_LINES.
READ TABLE MAILTXT INDEX TAB_LINES.
MAILDATA-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( MAILTXT ).

* Creation of the entry for the compressed document
CLEAR MAILPACK-TRANSF_BIN.
MAILPACK-HEAD_START = 1.
MAILPACK-HEAD_NUM = 0.
MAILPACK-BODY_START = 1.
MAILPACK-BODY_NUM = TAB_LINES.
MAILPACK-DOC_TYPE = 'RAW'.
APPEND MAILPACK.

* Creation of the document attachment
* This form gets the OTF code from the SAPscript form.
* If you already have your OTF code, I believe that you may
* be able to skip this form. just do the following code, looping thru
* your SOLISTI1 and updating MAILBIN.
PERFORM GET_OTF_CODE.

LOOP AT SOLISTI1.
MOVE-CORRESPONDING SOLISTI1 TO MAILBIN.
APPEND MAILBIN.
ENDLOOP.

DESCRIBE TABLE MAILBIN LINES TAB_LINES.
MAILHEAD = 'TEST.OTF'.
APPEND MAILHEAD.

** Creation of the entry for the compressed attachment
MAILPACK-TRANSF_BIN = 'X'.
MAILPACK-HEAD_START = 1.
MAILPACK-HEAD_NUM = 1.
MAILPACK-BODY_START = 1.
MAILPACK-BODY_NUM = TAB_LINES.
MAILPACK-DOC_TYPE = 'OTF'.
MAILPACK-OBJ_NAME = 'TEST'.
MAILPACK-OBJ_DESCR = 'Subject'.
MAILPACK-DOC_SIZE = TAB_LINES * 255.
APPEND MAILPACK.

ENDFORM.

************************************************************************
* Form GET_OTF_CODE
************************************************************************
FORM GET_OTF_CODE.

DATA: BEGIN OF OTF OCCURS 0.
INCLUDE STRUCTURE ITCOO .
DATA: END OF OTF.

DATA: ITCPO LIKE ITCPO.
DATA: ITCPP LIKE ITCPP.

CLEAR ITCPO.
ITCPO-TDGETOTF = 'X'.

* Start writing OTF code
CALL FUNCTION 'OPEN_FORM'
EXPORTING
FORM = 'ZTEST_FORM'
LANGUAGE = SY-LANGU
OPTIONS = ITCPO
DIALOG = ' '
EXCEPTIONS
OTHERS = 1.

CALL FUNCTION 'START_FORM'
EXCEPTIONS
ERROR_MESSAGE = 01
OTHERS = 02.

CALL FUNCTION 'WRITE_FORM'
EXPORTING
WINDOW = 'MAIN'
EXCEPTIONS
ERROR_MESSAGE = 01
OTHERS = 02.

* Close up Form and get OTF code
CALL FUNCTION 'END_FORM'
EXCEPTIONS
ERROR_MESSAGE = 01
OTHERS = 02.

MOVE-CORRESPONDING ITCPO TO ITCPP.

CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = ITCPP
TABLES
OTFDATA = OTF
EXCEPTIONS
OTHERS = 1.

* Move OTF code to structure SOLI form email
CLEAR SOLISTI1. REFRESH SOLISTI1.
LOOP AT OTF.
SOLISTI1-LINE = OTF.
APPEND SOLISTI1.
ENDLOOP.

ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this links&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="331371"&gt;&lt;/A&gt;&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="1653676"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward all helpfull answers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Pavan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 07:41:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/send-sapscript-to-customer/m-p/2481380#M559103</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-21T07:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: send sapscript to customer</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/send-sapscript-to-customer/m-p/2481381#M559104</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;the code was very usefull, thanks, but I have problem when i´m going open de attachment, Adobe Reader can´t open 'is not valid or is damaged'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 16:51:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/send-sapscript-to-customer/m-p/2481381#M559104</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-21T16:51:32Z</dc:date>
    </item>
    <item>
      <title>Re: send sapscript to customer</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/send-sapscript-to-customer/m-p/2481382#M559105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It´s resolved, thanks!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2007 08:47:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/send-sapscript-to-customer/m-p/2481382#M559105</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-25T08:47:43Z</dc:date>
    </item>
  </channel>
</rss>

