Problem solve Get help with specific problems with your technologies, process and projects.

Sending SAPOffice mail- Better options

This is a user submitted tip in response to the developer tip titled "Sending SAPOffice mail."

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

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

* --> 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 last published in July 2001

Dig Deeper on SAP application integration

PRO+

Content

Find more PRO+ content and other member only offers, here.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close