Sending SAPOffice mail- Better options

Sending SAPOffice mail- Better options

The tip titled "Sending SAPOffice mail" that was sent out on 
7/24/2001 is somewhat incorrect.  This tip encourages people to use
the SO_OBJECT_SEND.  This is an internal function module and not 
released for customer use.  

It is not documented, nor is the interface consistent across releases.
  
When we did our 3.1H to 4.6C upgrade we had several problems with 
programs that hit this function module.  The correct function modules
are in the SOI1 function group.  These are the function modules for 
the SAPOffice API.  They are documented and released for customer use.  
This means that the interface will not change across releases.  

The most useful of these being the 
SO_NEW_DOCUMENT_SEND_AP1 and SO_NEW_DOCUMENT_ATT_SEND_AP1.
The following is an example of how easy they can be to use.
This program pops up an editor to type a message into.  
It then sends this message to a list
of users.

*----------------------------------------------------------------------*

* START-OF-SELECTION *

*----------------------------------------------------------------------*

start-of-selection.

editor-call for objtxt.

****If user cancelled issue message to screen otherwise

****Send the email

if sy-subrc = 0.

perform send_message.

else.

message i023.

endif.

*&---------------------------------------------------------------------*

*& Form send_message

*&---------------------------------------------------------------------*

* Format and submit the email

*----------------------------------------------------------------------*

* -->

    Requires Free Membership to View

    When you register, you will start receiving targeted emails from my award-winning team of editorial writers. Our goal is to keep you informed on the hottest topics and biggest challenges faced by SAP professionals today.

    Hannah Smalltree, Editorial Director

    By submitting your registration information to SearchSAP.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchSAP.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

p1 text * <-- p2 text *----------------------------------------------------------------------* form send_message. data: iaddsmtp type bapiadsmtp occurs 0 with header line. data: ireturn type bapiret2 occurs 0 with header line. ****For each user on the contact list loop at izes_job_user. clear iaddsmtp. refresh iaddsmtp. clear bapiadsmtp. call function 'BAPI_USER_GET_DETAIL' exporting username = izes_job_user-user1 tables return = ireturn addsmtp = iaddsmtp. loop at iaddsmtp where std_no = 'X'. clear bapiadsmtp. move iaddsmtp to bapiadsmtp. endloop. if bapiadsmtp-e_mail = ''. concatenate izes_job_user-user1 kimball_domain into reclist-receiver. else. move bapiadsmtp-e_mail to reclist-receiver. endif. move internet to reclist-rec_type. append reclist. endloop. describe table objtxt lines tab_lines. read table objtxt index tab_lines. doc_chng-doc_size = ( tab_lines - 1 ) * 255 + strlen( objtxt ). call function 'SO_NEW_DOCUMENT_SEND_API1' exporting document_data = doc_chng document_type = 'RAW' put_in_outbox = 'X' * IMPORTING * SENT_TO_ALL = * NEW_OBJECT_ID = tables object_header = objhead object_content = objtxt * CONTENTS_HEX = * OBJECT_PARA = * OBJECT_PARB = receivers = reclist exceptions too_many_receivers = 1 document_not_sent = 2 document_type_not_exist = 3 operation_no_authorization = 4 parameter_error = 5 x_error = 6 enqueue_error = 7 others = 8 . case sy-subrc. when 0. message i014 with reclist-receiver. when 1. message i015 with text-007. when 2. message i015 with text-008. when 3. message i015 with text-009. when 4. message i015 with text-010. when 5. message i015 with text-011. when 6. message i015 with text-012. when 7. message i015 with text-013. when 8. message i015 with text-016. when others. message i015 with text-016. endcase.

This was first published in July 2001

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.