Skip to Content
0
Former Member
Jun 18, 2008 at 02:49 AM

pls help me very urgent

823 Views

Hi

i want send mail to outlook. Following code is working fine. I am hard coded the mail address here. Instead of this i want to extract the mailid from Z1ychclientid table and sent mail to Z1ychclientid table mail address

i changed this in program. but it is going to dump. pls help me.

pls dont suggest any other FM

data declaration

data: maildata type sodocchgi1.
data: mailtxt type table of solisti1 with header line.

DATA : BEGIN OF MAILREC OCCURS 0,
EMAIL1(30),
EMAIL2(30),
EMAIL3(30),
EMAIL4(30),
EMAIL5(30),
EMAIL6(30),
EMAIL7(30),
EMAIL8(30),
EMAIL9(30),
EMAIL10(30),
end OF MAILREC.
*data: mailrec type table of somlrec90 with header line.

Code

form SEND_MAIL .
clear: maildata, mailtxt, mailrec.
refresh: mailtxt, mailrec.
maildata-obj_name = 'TEST'.
maildata-obj_descr = 'DDL Reloaded for Approvel Number'.
CONCATENATE maildata-obj_descr p_appno INTO maildata-obj_descr.
maildata-obj_langu = sy-langu.

mailtxt-line = 'Please Note above request has been Completed'.
append mailtxt.

select email1 email2 email3 email4 email5
      email6 email7 email8 email9  email10
from z1ychclientid into table mailrec
          
      where werks = p_werks.
if mailrec[] is not initial.
endif.
mailrec-receiver = 'name.company.com'.  "i hadr coded the mail address here
mailrec-rec_type = 'U'.
append mailrec.

call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
document_data = maildata
document_type = 'RAW'
put_in_outbox = 'X'
tables
object_header = mailtxt
object_content = mailtxt
receivers = mailrec
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.
COMMIT WORK.
if sy-subrc = 0.
*write : 'mail sent'.
endif.
endform.                    " SEND_MAIL