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

Internal & external email

Former Member
0 Likes
585

Hi Experts,

Please help me...

I need to create email through my program(Module-pool program) on click on a push button a internal(external) email should be generate .

How can i do it ?

If you have any program please send me that will become more helpful for me.

Thanks in advance.

Ankur Garg.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
553

HI,

hope you can create a button in your module pool program..

inside the function code

If function code = <your function code name>../

l_wa_content-line = 'Dear user'.

APPEND l_wa_content TO l_it_content.

l_wa_recieve-receiver = '[email protected]'

l_wa_recieve-rec_type = 'U'. "internet mail

APPEND l_wa_recieve TO l_it_recieve.

clear l_wa_recieve.

l_wa_recieve-receiver = 'PAZZ@REDIFF>COM'

l_wa_recieve-rec_type = 'U'. "internet mail

APPEND l_wa_recieve TO l_it_recieve.

clear l_wa_recieve.

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

EXPORTING

document_data = l_wa_document

document_type = 'RAW'

put_in_outbox = 'X'

commit_work = 'X"

TABLES

object_content =

receivers = l_it_recieve

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.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

endif.

Later check the SOST Tcode if your mail is not in the waiting status then the mail is send..

reward if helpful

regards,

nazeer

3 REPLIES 3
Read only

Former Member
0 Likes
554

HI,

hope you can create a button in your module pool program..

inside the function code

If function code = <your function code name>../

l_wa_content-line = 'Dear user'.

APPEND l_wa_content TO l_it_content.

l_wa_recieve-receiver = '[email protected]'

l_wa_recieve-rec_type = 'U'. "internet mail

APPEND l_wa_recieve TO l_it_recieve.

clear l_wa_recieve.

l_wa_recieve-receiver = 'PAZZ@REDIFF>COM'

l_wa_recieve-rec_type = 'U'. "internet mail

APPEND l_wa_recieve TO l_it_recieve.

clear l_wa_recieve.

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

EXPORTING

document_data = l_wa_document

document_type = 'RAW'

put_in_outbox = 'X'

commit_work = 'X"

TABLES

object_content =

receivers = l_it_recieve

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.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

endif.

Later check the SOST Tcode if your mail is not in the waiting status then the mail is send..

reward if helpful

regards,

nazeer

Read only

0 Likes
553

Hi Nazeer,

Thanks for this code...

Could you please send me complete code ? Because here you use internal table like i_wa_content , i_wa_recieve and document_data:i_wa_document etc other parameter ....if you send me complete code that will more helpful for me.....

And don't worry about reward you will be reward maximum marks.

Thanks.

Ankur

Read only

0 Likes
553

HI,

DATA : l_wa_content TYPE solisti1,

l_wa_recieve TYPE somlreci1.

*Local internal table

DATA : l_it_content TYPE STANDARD TABLE OF solisti1,

l_it_recieve TYPE STANDARD TABLE OF somlreci1.

*in contents you can add the body of the mail

CLEAR l_wa_content.

l_wa_content-line = 'Dear Customer,'.

APPEND l_wa_content TO l_it_content.

CLEAR l_wa_content.

APPEND l_wa_content TO l_it_content. *appending blank line

CONCATENATE 'TEST' 'MAIL!' 'How r u' INTO l_v_text

SEPARATED BY space.

l_wa_content-line = l_v_text.

APPEND l_wa_content TO l_it_content.

*Reciptents Mail Ids

l_wa_recieve-receiver = 'your mail id'.

l_wa_recieve-rec_type = 'U'. "this is for internet

APPEND l_wa_recieve TO l_it_recieve.

clear l_wa_recieve.

*If you need tyo send to you sap inbox TCODE SBWP (you can check mail in SBWP) do this

l_wa_recieve-receiver = 'your user id of SAP'.

l_wa_recieve-rec_type = 'B'. "for SAP user

APPEND l_wa_recieve TO l_it_recieve.

clear l_wa_recieve.

*Heading of the mail

l_wa_document-obj_name = 'TEST MAIL'.

l_wa_document-obj_langu = sy-langu.

*this FM send mail..

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

EXPORTING

document_data = l_wa_document

document_type = 'RAW'

put_in_outbox = c_x

commit_work = c_x

TABLES

object_content = l_it_content

receivers = l_it_recieve

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.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

THe above parameters are enough for sending mail

Any doubts can be posted

regards,

nazeer