Application Development and Automation 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: 
Read only

Trigger the mail on selecting the screen elements.

former_member288488
Participant
0 Likes
831

Hi,

I have a requirement where I have to trigger the mail on selecting certain screen elements as below:-

1.) On pressing the pushbutton on the custom screen the mail should be sent to the email id's given. I have the body of the email to be sent.

2.) On selecting the respective values from the drop down in the I/O selection screen element the respective email should be sent.

Please respond to the query at the earliest.

Thanks,

Naveen

4 REPLIES 4
Read only

Danish
Explorer
0 Likes
735

Hi,

you just need to use the function module when the user presses the send mail button or whatever button u provide him.

'SO_NEW_DOCUMENT_ATT_SEND_API1'

check even these :

sap_new_document_send_api1(send document)

sap_new_document_att_send_api1(send with attachments) .

Hope this solves your problem.

and ya one more thing, you need to check with your BASIS guys whether they have provided you the option of sending mails to external ids.

Cordially,

Danish

Read only

Former Member
0 Likes
735

SAP has provided you with the ability to reuse their Business Communication Services (BCS) email class CL_BCS ... have a look in SE38 at the programs that start with BCS_* as there are lots of sample pieces of code there that you can easily reuse. Do note the need for a "commit work" to trigger the send.

Jonathan

Read only

Former Member
0 Likes
735

Hi,

You need to use FM 'SO_DOCUMENT_SEND_API1' to send mail. Please refer below code to call it. To use this, you need to have your internal table in binary format. In below code 'T_ATTACHMENT' is the internal table with binary format.

So, you need to convert your internal table into binary format and then use this FM to send mail.

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
       EXPORTING
            document_data              = w_doc_data
            put_in_outbox              = 'X'
            sender_address             = ld_sender_address
            sender_address_type        = ld_sender_address_type
            commit_work                = 'X'
       IMPORTING
            sent_to_all                = w_sent_all
       TABLES
            packing_list               = t_packing_list
            contents_bin               = t_attachment
            contents_txt               = it_message
            receivers                  = t_receivers.

Thanks,

Archana

Edited by: Archana Pawar on Aug 12, 2010 5:45 AM

Edited by: Archana Pawar on Aug 12, 2010 5:45 AM

Read only

0 Likes
735

Hi,

Please let me know how to proceed on this as i have the body and id where i need to send the mail.

Thanks,

Naveen Sharma