Home > SAP software/management Tips > SAP ABAP/Java developer tips > Sending SAPOffice mail- Better options
SAP Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

SAP ABAP/JAVA DEVELOPER TIPS

Sending SAPOffice mail- Better options


Thomas Jung
07.24.2001
Rating: -4.06- (out of 5) Hall of fame tip of the month winner


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


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.


Code

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

* 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.


Rate this Tip
To rate tips, you must be a member of SearchSAP.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
SAP ABAP/Java developer tips
How to do additional dialog processing after SAP COMMIT WORK statement
How to find a piece of SAP ABAP code without debugging
How to read an SAP transaction in an ABAP code
How to provide an SAP R/3 4.5B application server with a Web service interface
How to find owners and transports of deleted ABAP programs
Fixing a common OPEN_FORM and START_FORM error in SAPscript
Select Text fields: Case-insensitive
Is this the quickest way to find a BADI?
Easily debug error messages in SAP processes
Accessing private attributes in ABAP Objects

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

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.



NetWeaver SAP White Papers
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2000 - 2009, TechTarget | Read our Privacy Policy
SearchSAP.com is a search service provided by TechTarget and is completely
independent of and not affiliated with SAP AG.
  TechTarget - The IT Media ROI Experts