S OneStopSAP
← All articles ABAP

Sending Emails and SAP Mail Using ABAP

Published November 13, 2009

SAP is a robust system, which gives many facilities in the form of Function Modules (FMs) for connecting to external systems or for use within the system. With a clever use of these FMs we can achieve a lot of things through ABAP code.

This article focuses on ways to send E-mails and SAP Mails using ABAP code.

Firstly SAP Mail

A SAP mail is a mail internal to the SAP system. It is a very good forum to exchange information with other users. Using a SAP mail in ABAP code facilitates exchange of automatic messages at various stages of the business process. It is easy to use and saves many hassles involved in using workflows for exchanging messages.

The ABAP code to send a sap mail is built around the FM SO_OBJECT_SEND which has the following pattern.

call function 'SO_OBJECT_SEND'

exporting

* EXTERN_ADDRESS = ' '

* FOLDER_ID = ' '

* FORWARDER = ' '

* OBJECT_FL_CHANGE = ' '

* OBJECT_HD_CHANGE = ' '

* OBJECT_ID = ' '

* OBJECT_TYPE = ' '

* OUTBOX_FLAG = ' '

* OWNER = ' '

* STORE_FLAG = ' '

* DELETE_FLAG = ' '

* SENDER = ' '

* CHECK_ALREADY_SENT = ' '

importing

object_id_new =

sent_to_all =

tables

* OBJCONT =

* OBJHEAD =

* OBJPARA =

* OBJPARB =

receivers =

* PACKING_LIST =

* ATT_CONT =

* ATT_HEAD =

* NOTE_TEXT =

exceptions

active_user_not_exist = 1

communication_failure = 2

component_not_available = 3

folder_not_exist = 4

folder_no_authorization = 5

forwarder_not_exist = 6

note_not_exist = 7

object_not_exist = 8

object_not_sent = 9

object_no_authorization = 10

object_type_not_exist = 11

operation_no_authorization = 12

owner_not_exist = 13

parameter_error = 14

substitute_not_active = 15

substitute_not_defined = 16

system_failure = 17

too_much_receivers = 18

user_not_exist = 19

x_error = 20

others = 21.

Share

Cookies on OneStopSAP

We use cookies for session handling and anonymous traffic analytics. No third-party tracking, no profiling.

Privacy →