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

problem while sending mail

Former Member
0 Likes
580

The following code is not working,the mail is not getting posted to the receiver.Can sum1 plz help...

DATA: objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.

DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.

DATA: objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE.

DATA: objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.

DATA: reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.

DATA: doc_chng LIKE sodocchgi1.

DATA: tab_lines LIKE sy-tabix.

  • Creation of the document to be sent

  • File Name

doc_chng-obj_name = 'SENDFILE'.

  • Mail Subject

doc_chng-obj_descr = 'Send External Mail'.

  • Mail Contents

LOOP AT git_error INTO gwa_error.

t1 = 'Success'.

t2 = 'Operation successful'.

ENDLOOP.

objtxt = t1.

APPEND objtxt.

objtxt = t2.

APPEND objtxt.

DESCRIBE TABLE objtxt LINES tab_lines.

READ TABLE objtxt INDEX tab_lines.

doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).

  • Creation of the entry for the compressed document

CLEAR objpack-transf_bin.

objpack-head_start = 1.

objpack-head_num = 0.

objpack-body_start = 1.

objpack-body_num = tab_lines.

objpack-doc_type = 'RAW'.

APPEND objpack.

  • Completing the recipient list

reclist-receiver = 'vaishali.rana@capgemini.com'.

reclist-rec_type = 'U'.

APPEND reclist.

  • Sending the document

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = doc_chng

put_in_outbox = 'X'

TABLES

packing_list = objpack

object_header = objhead

contents_bin = objbin

contents_txt = objtxt

receivers = reclist

EXCEPTIONS

too_many_receivers = 1

document_not_sent = 2

operation_no_authorization = 4

OTHERS = 99.

IF reclist-retrn_code = 0.

WRITE:/ 'hello'.

*WRITE 'The document was sent'.

ELSE.

WRITE 'The document could not be sent'.

4 REPLIES 4
Read only

Former Member
0 Likes
538

The code is working fine for me. Probably you should have got two mails from me.

regards,

Sandeep Josyula

*Mark if helpful

Read only

Former Member
0 Likes
538

Hi vaishali,

1. The mail may not be sent immediately.

2. It is scheduled by basis team to actually send, with some interval.

3. To send immediately, goto SCOT transaction,

and Execute.

regards,

amit m.

Read only

Former Member
0 Likes
538

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = doc_chng

put_in_outbox = 'X'

<b>commit_work = 'X'</b>

TABLES

packing_list = objpack

object_header = objhead

contents_bin = objbin

contents_txt = objtxt

receivers = reclist

EXCEPTIONS

too_many_receivers = 1

document_not_sent = 2

operation_no_authorization = 4

OTHERS = 99.

Just the parameter as indicated in bold and it should work.

Dont forget to assign points for helpful answers

Read only

Former Member
0 Likes
538

Check whether RSCONN01 program is scheduled in background to sent email regular or execute the above program to send email immediatley.