Skip to Content
author's profile photo Former Member
Former Member

pls help me very urgent

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 03:01 AM

    Hi Kumar,

    Your MAILREC internal table have to be like SOMLRECI1 structure.

    You can't define your own structure for MAILREC else it will shortdump.

    Hope it helps,

    Victor.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.