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

error messages captured

Former Member
0 Likes
703

hi experts,

plz help me with the following requirement.

actually i am working on interface from SAP to NON SAP.

depending on teh situation i need to send the occured messages to the user through email. description given as below.

Error Processing

• An email notification should be sent if any of the following errors occur:

o Failure to export file

o Duplicate file exists

o Missing parameters in export

actually i used the following code. could u plz correct and suggest me if i need to add anything.

<b>data: maildata type sodocchgi1.

data: mailtxt type table of solisti1 with header line.

data: mailrec type table of somlrec90 with header line.

start-of-selection.

clear: maildata, mailtxt, mailrec.

refresh: mailtxt, mailrec.

maildata-obj_name = 'TEST'.

maildata-obj_descr = 'Test'.

maildata-obj_langu = sy-langu.

mailtxt-line = 'This is a test'.

append mailtxt.

mailrec-receiver = 'you@yourcompany.com'.

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.</b>

ragards,

siri.

2 REPLIES 2
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
380

That's all you need. Just add your error messages in the MAILTXT internal table.




mailtxt-line = 'This is a text line 1'.
append mailtxt.

mailtxt-line = 'This is a text line 2'.
append mailtxt.


mailtxt-line = 'This is a text line 3'.
append mailtxt.


After this, you will need to run the SCOT program to force the send process. You can do this via the transaction SCOT or you can just submit this program from the end of your program.

submit rsconn01 with mode = 'INT' and return.

Regards,

Rich Heilman

Read only

suresh_datti
Active Contributor
0 Likes
380

one quick change is you must add the following as an EXPORTING parameter..

COMMIT_WORK = 'X'

~Suresh