Application Development 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: 

Problem while sending an email.

Former Member
0 Kudos

Hi all,

I have copied an example program which is used to send Email to External Address.

But so far i am not able to recieve a mail in External address,

Can any body help me,

I have pasted the code below.

Thanks in Advance

Vinay.

Code:-

REPORT zvinay3 .

DATA: objcont LIKE solisti1 OCCURS 5 WITH HEADER LINE.

DATA: reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.

DATA: doc_chng LIKE sodocchgi1.

DATA: entries LIKE sy-tabix.

DATA: name(15).

  • Fill the document

doc_chng-obj_name = 'URGENT'.

doc_chng-obj_descr = 'Read at once !'.

doc_chng-sensitivty = 'P'.

objcont = 'Hey guys, time for lunch !!!'.

APPEND objcont.

objcont = 'Lets get going !'.

APPEND objcont.

DESCRIBE TABLE objcont LINES entries.

READ TABLE objcont INDEX entries.

doc_chng-doc_size = ( entries - 1 ) * 255 + STRLEN( objcont ).

  • Fill the receiver list

CLEAR reclist.

reclist-receiver = sy-uname. " replace with <login name>

reclist-rec_type = 'B'.

reclist-express = 'X'.

APPEND reclist.

CLEAR reclist.

reclist-receiver = 'vinay.br@sap.com'.

reclist-rec_type = 'U'.

APPEND reclist.

  • Send the document

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

EXPORTING

document_type = 'RAW'

document_data = doc_chng

put_in_outbox = 'X'

TABLES

object_content = objcont

receivers = reclist

EXCEPTIONS

too_many_receivers = 1

document_not_sent = 2

operation_no_authorization = 4

OTHERS = 99.

CASE sy-subrc.

WHEN 0.

LOOP AT reclist.

IF reclist-receiver = space.

name = reclist-rec_id.

ELSE.

name = reclist-receiver.

ENDIF.

IF reclist-retrn_code = 0.

WRITE: / name, ': succesfully sent'.

ELSE.

WRITE: / name, ': error occured'.

ENDIF.

ENDLOOP.

WHEN 1.

WRITE: / 'Too many receivers specified !'.

WHEN 2.

WRITE: / 'No receiver got the document !'.

WHEN 4.

WRITE: / 'Missing send authority !'.

WHEN OTHERS.

WRITE: / 'Unexpected error occurred !'.

ENDCASE.

10 REPLIES 10

former_member611006
Active Participant
0 Kudos

In the Function 'SO_NEW_DOCUMENT_SEND_API1', you must add commit_work = 'X' ...

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = document_data

put_in_outbox = 'X'

commit_work = 'X'

...etc

Greetz!

Message was edited by: David Cerati

Message was edited by: David Cerati

Former Member
0 Kudos

Hi,

I think two prerequisites are neccessary:

- within TA SCOT the connection to a mail server has to be arranged

- the report RSCONN01 has to run to get the mail to the SAP interface

then it should work.

Good luck

Olaf

0 Kudos

Hi Olaf Bethke,

i checked SCOT transaction.

it has SENDMAIL_SERVER in RFC Destination.

I even executed the report RSCONN01, but still i am not able to recieve any mail,

can you please tell what could be the problem

With REgards

Vinay

0 Kudos

Hi Vinay,

please read SAP-Note 63480 for further details. I'm not a network expert and BC is not my profession so I can't give you detailed instructions how to implement the connection on servers.

Hope you have other experts to ask for that topics.

Greets

Olaf

0 Kudos

Look at OSS note 455140 to setup email, fax, paging/sms via STMP.

Former Member
0 Kudos

Check SOST Transaction Also. Whether you have a mail there or not. If not then there is a problem in SAP connect set up.

0 Kudos

Hi,

i checked it using SOST transaction.

The status of all the Messages are "In Transit".

and the status text says "Message transfered by node to communication system".

Can you help me out....

Thanks in advance,

Vinay

0 Kudos

Hi Vinay,

Now it looks good that means your SAPconnect is properly configured at SAP end.

Try starting send process using SCOT transaction --- Utilities ---start Send Process.

Regards,

DB

0 Kudos

Hi Deepak,

Thanks for helping, Still some problem is there,

When i start the "send process" , it will for "address type". There i mentioned "INT - Internet Mail Address".

Then OK.

Then it will get a message called "You Didn't Select any objects".

How should i proceed further,

Thanks,

Vinay

0 Kudos

Last Check to make sure that everything is fine and connection is proper. Double click at the node below INT in SCOT transaction. Screen will pop up from there you can actually perform the connection test under External Software.

Moreover please see below What In transit stands for. It seems that there is a problem between SAP and External system. Check all Configurations once again.

In Transit Means

"Number of send orders that are currently in process outside of the R/3 System, that is, the messages have been transferred to the external nodes by the SAPconnect send process but neither a positive nor a negative status message has been received."

Message was edited by: Deepak Bhalla