‎2007 May 15 6:30 AM
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.
‎2007 May 15 6:46 AM
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
‎2007 May 15 6:46 AM
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
‎2007 May 15 7:00 AM
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
‎2007 May 15 7:22 AM
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