Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Function module for sending email

Former Member
0 Kudos
120

Hi all,

Can I know list of function modules for sending emails.

Other than "SO_DOCUMENT_SEND_API1"

pls let me know

6 REPLIES 6

Former Member
0 Kudos
81

SO_DOCUMENT_SEND_ATT_API1

GauthamV
Active Contributor
0 Kudos
81

hi,

check these fm.

SO_DOCUMENT_SEND_API1 SAPoffice: Send new document with attachments using RFC

SO_NEW_DOCUMENT_ATT_SEND_API1 SAPoffice: Send new document with attachments using RFC

SO_NEW_DOCUMENT_ATT_SEND_MAPI

SO_NEW_DOCUMENT_SEND_API1 SAPoffice: Send new document

SO_OLD_DOCUMENT_SEND_API1 SAPoffice: Send existing document using RFC

former_member598013
Active Contributor
0 Kudos
81

Hi Praveen,

Below is the sample code to send the external mail.

&**********Reward Points if helpful**********&

DATA: ld_mtitle LIKE sodocchgi1-obj_descr,

ld_format TYPE so_obj_tp ,

ld_attdescription TYPE so_obj_nam ,

ld_attfilename TYPE so_obj_des .

  • ld_receiver LIKE sy-subrc.

DATA: it_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,

it_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,

it_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,

w_cnt TYPE i,

w_sent_all(1) TYPE c, "#EC NEEDED

w_doc_data LIKE sodocchgi1.

REFRESH it_receivers . CLEAR it_receivers .

IF v_trip_send = 'X'.

it_receivers-receiver = it_trip_dload-approver_email .

ELSE .

it_receivers-receiver = it_adv_dload-approver_email .

ENDIF.

it_receivers-rec_type = c_u .

APPEND it_receivers. CLEAR it_receivers.

  • it_receivers-receiver = " ------> pass your reciever email id.

IF v_trip_send = 'X' .

it_receivers-receiver = it_trip_dload-requester_email .

ELSE .

it_receivers-receiver = it_adv_dload-requester_email .

ENDIF .

it_receivers-rec_type = c_u .

it_receivers-copy = 'X' .

APPEND it_receivers. CLEAR it_receivers.

ld_mtitle = p_mtitle.

ld_format = p_format.

ld_attdescription = p_attdescription.

ld_attfilename = p_filename.

  • Fill the document data.

w_doc_data-doc_size = 1.

  • Populate the subject/generic message attributes

w_doc_data-obj_langu = sy-langu.

w_doc_data-obj_name = c_saprpt.

w_doc_data-obj_descr = ld_mtitle .

w_doc_data-sensitivty = 'F'.

  • Fill the document data and get size of attachment

CLEAR w_doc_data.

READ TABLE it_attach INDEX w_cnt.

w_doc_data-doc_size =

( w_cnt - 1 ) * 255 + STRLEN( it_attach ).

w_doc_data-obj_langu = sy-langu.

w_doc_data-obj_name = c_saprpt.

w_doc_data-obj_descr = ld_mtitle.

w_doc_data-sensitivty = c_f.

CLEAR it_attachment.

REFRESH it_attachment.

it_attachment[] = it_attach[].

  • Describe the body of the message

CLEAR it_packing_list.

REFRESH it_packing_list.

it_packing_list-transf_bin = space.

it_packing_list-head_start = 1.

it_packing_list-head_num = 0.

it_packing_list-body_start = 1.

DESCRIBE TABLE it_message LINES it_packing_list-body_num.

it_packing_list-doc_type = c_raw.

APPEND it_packing_list.

  • Create attachment notification

it_packing_list-transf_bin = c_x.

it_packing_list-head_start = 1.

it_packing_list-head_num = 1.

it_packing_list-body_start = 1.

DESCRIBE TABLE it_attachment LINES it_packing_list-body_num.

it_packing_list-doc_type = ld_format.

it_packing_list-obj_descr = ld_attdescription.

it_packing_list-obj_name = ld_attfilename.

it_packing_list-doc_size = it_packing_list-body_num * 255.

APPEND it_packing_list.

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

EXPORTING

document_data = w_doc_data

put_in_outbox = c_x

commit_work = c_x

IMPORTING

sent_to_all = w_sent_all

TABLES

packing_list = it_packing_list

contents_bin = it_attachment

contents_txt = it_message

receivers = it_receivers.

Former Member
0 Kudos
81

Hi,

Function Modules related to sending emails

SO_NEW_DOCUMENT_ATT_SEND_API1 - Sends emails with texts and attachments

SO_NEW_DOCUMENT_SEND_API1 - Sends emails with texts.

Regards,

Shiva Kumar

former_member181995
Active Contributor
0 Kudos
81

Praveen

SO_OBJECT_SEND

CALL FUNCTION 'SO_OBJECT_SEND'
             EXPORTING
*                   EXTERN_ADDRESS             = ' '
*                   FOLDER_ID                  = ' '
*                   FORWARDER                  = ' '
*                   OBJECT_FL_CHANGE           = ' '
                  object_hd_change           = x_object_hd_change
*                   OBJECT_ID                  = ' '
                  object_type                = document_type
*                   OUTBOX_FLAG                = ' '
*               OWNER                      = FSABE-USRNAM
*                   STORE_FLAG                 = ' '
*                   DELETE_FLAG                = ' '
*               SENDER                     = FSABE-USRNAM
*                   CHECK_ALREADY_SENT         = ' '
                  originator                 = horiginator
                  originator_type            = 'B'
             IMPORTING
*                   OBJECT_ID_NEW              =
                  sent_to_all                = x_sent_to_all
             TABLES
                  objcont                    = x_objcont
                  objhead                    = x_objhead
*                   OBJPARA                    =
*                   OBJPARB                    =
                  receivers                  = x_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.

Amit.

Former Member
0 Kudos
81

Hi,

I am using SO_DOCUMENT_SEND_API1.

When I run the program, If email is mainatined in SCOT tcode.

Mail will be sent.

If email is not maintained in SCOT, it will give one POP dialog box of SAPOffice with user details and error in sending mail.

Once if i click on continue button that POP disappears,

how to avoid this POP Up.