09-14-2008 10:26 PM
hi guys,
I want to send a notification mail to my sap inbox when i press a "submit" button on my custom transcation. Is there any funtion modules to do this process?
please help me regarding this...........
thanks ,
sriniii
09-14-2008 11:31 PM
Hi, check this FM 'SO_NEW_DOCUMENT_SEND_API1' . there is quality documentation, so you won't have any problems.
Here is some example [http://www.sap-basis-abap.com/abap011.htm]
Hope it helps you.
Philipp
09-15-2008 5:54 AM
Srini,
Create a workflow that sends mail to your sap inbox notifying the button pressed.
Use the FM, SWU_START_WORKFLOW to start your workflow whenever you press the SUBMIT button.
In case, your are not familiar with workflows, you can use the below code.
report yh_email1.
data: email type somlreci1-receiver.
data: sender type SOEXTRECI1-RECEIVER value 'SAPDEV02'.
data: imessage type standard table of solisti1 with header line,
iattach type standard table of solisti1 with header line,
ipacking_list like sopcklsti1 occurs 0 with header line,
ireceivers like somlreci1 occurs 0 with header line.
start-of-selection.
MOVE SY-UNAME TO EMAIL.
clear imessage. refresh imessage.
imessage = 'This is a mail from SAP ECC6'.
append imessage.
imessage = 'Thanks and Regards'.
append imessage.
imessage = 'Indu'.
append imessage.
perform send_email tables imessage
using email
'Mail from Indu'.
***********************************************************************
*
* Form SEND_EMAIL
***********************************************************************
*
form send_email tables pit_message
using email
p_mtitle.
data: xdocdata like sodocchgi1,
xcnt type i.
* Fill the document data.
xdocdata-doc_size = 1.
* Populate the subject/generic message attributes
xdocdata-obj_langu = sy-langu .
xdocdata-obj_name = 'SAPRPT' .
xdocdata-obj_descr = p_mtitle .
clear ipacking_list. refresh ipacking_list.
ipacking_list-transf_bin = space.
ipacking_list-head_start = 1.
ipacking_list-head_num = 0.
ipacking_list-body_start = 1.
describe table imessage lines ipacking_list-body_num.
ipacking_list-doc_type = 'RAW'.
append ipacking_list.
clear ireceivers.
refresh ireceivers.
ireceivers-receiver = email.
ireceivers-rec_type = 'B'.
append ireceivers.
call function 'SO_DOCUMENT_SEND_API1'
exporting
document_data = xdocdata
put_in_outbox = 'X'
SENDER_ADDRESS = SENDER
commit_work = 'X'
tables
packing_list = ipacking_list
contents_txt = imessage
receivers = ireceivers
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.
*** These two statemnets are used to force the mail to send it to the
*receipeint otherwise we need to go to SOST tcode where we need to press
* F8 to send the mail to the other user. To avoid this we need to use
*these two statemnets. Here the mail is not in queue.
SUBMIT rsconn01 USING SELECTION-SET 'INT' AND RETURN.
CALL FUNCTION 'SO_DEQUEUE_UPDATE_LOCKS'.
* SUBMIT rsconn01 WITH mode = 'INT'
* WITH output = 'X'
* AND RETURN.
endform.
Regards
Indu