cancel
Showing results for 
Search instead for 
Did you mean: 

Email via report using : SO_NEW_DOCUMENT_ATT_SEND_API1: Function Module.

Former Member
0 Kudos

Hi,

Actually i want to send a mail ( to a yahoo mail address ) using a report, as i came to know that one has to use the above Function Module i started using it. But i am unable to send an e-mail. the report is getting executed and the return code i am getting is zero and i am getting an object i.d. too. But the recipient is not receiving the mail.

I am attaching my code here. Please help.

Any help in this regard is highly appreciated.

DATA : tab_lines TYPE i.

DATA : var_receiver LIKE sadrud.

  • EXPORT TO FM

DATA : wa_docu_data LIKE sodocchgi1.

  • IMPORT FROM FM

DATA : flag_sent_to_all LIKE sonv-flag.

DATA : obj_id LIKE sofolenti1-object_id.

  • TABLES TO FM

DATA : obj_header LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.

DATA : rec_list LIKE somlreci1 OCCURS 0 WITH HEADER LINE.

DATA : obj_txt LIKE solisti1 OCCURS 0 WITH HEADER LINE.

START-OF-SELECTION.

var_receiver-address = 'gouthamprg@yahoo.com'.

obj_txt-line = 'This is the sent Document'.

APPEND obj_txt.

CLEAR obj_txt.

DESCRIBE TABLE obj_txt LINES tab_lines.

READ TABLE obj_txt INDEX tab_lines.

BREAK-POINT.

wa_docu_data-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( obj_txt ).

wa_docu_data-obj_name = 'TESTING'.

wa_docu_data-obj_descr = 'This is Test Mail'.

wa_docu_data-proc_type = 'R'.

wa_docu_data-proc_name = 'Z34_MAIL_TEST'.

wa_docu_data-proc_syst = '*'.

wa_docu_data-proc_clint = '*'.

  • wa_docu_data-to_do_out = 'X'.

  • wa_docu_data-sensitivity = 'O'.

obj_header-transf_bin = ' '.

  • obj_header-head_start = 1.

  • obj_header-head_num = 0.

obj_header-body_start = 1.

obj_header-body_num = tab_lines.

obj_header-doc_type = 'RAW'.

APPEND obj_header.

CLEAR obj_header.

BREAK-POINT.

rec_list-receiver = var_receiver-address.

rec_list-rec_type = 'U'.

rec_list-express = 'X'.

rec_list-com_type = 'INT'.

rec_list-notif_del = 'X'.

APPEND rec_list.

CLEAR rec_list.

BREAK-POINT.

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = wa_docu_data

put_in_outbox = 'X'

commit_work = 'X'

IMPORTING

sent_to_all = flag_sent_to_all

new_object_id = obj_id

TABLES

packing_list = obj_header

  • OBJECT_HEADER =

  • CONTENTS_BIN =

contents_txt = obj_txt

  • CONTENTS_HEX =

  • OBJECT_PARA =

  • OBJECT_PARB =

receivers = rec_list

  • 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

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

BREAK-POINT.

WRITE : / , 'Object Created' , obj_id,50 'SENT TO ALL' , flag_sent_to_all.

LOOP AT rec_list.

WRITE 😕 , 'status' , rec_list-retrn_code,

/ , 'Sent to' , rec_list-receiver.

ENDLOOP.

Thanks and Regards,

Goutham.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello Goutham,

I use this function also, when we upgraded to SAP 4.7 I had the same problem.

I had to put a COMMIT WORK AND WAIT after the call of the function, in that way the receiver gets his mail.

Hope this will help.

Regards,

Dirk.

athavanraja
Active Contributor
0 Kudos

Did you check out in txn SCOT about the status of your mail?

Regards

Raja

Former Member
0 Kudos

Hi, Thanks for your early reply.

can you tell me what exactly i have to do after executing the report. i came to know that, once you execute the report the data will not be sent to the address. we have to do some processing after that.what is it. can you elaborate and explain it to me.

Thanks in advance for your esteemed reply.

Former Member
0 Kudos

Check these weblogs:

1) /people/thomas.jung3/blog/2004/09/09/receiving-e-mail-and-processing-it-with-abap--version-610-and-higher

2) /people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface

3) /people/thomas.jung3/blog/2004/09/07/sending-e-mail-from-abap--version-46d-and-lower--api-interface

Very very informative. Probably you might also want to look at SAP Connect help.

Regards,

Subramanian V.

Former Member
0 Kudos

Hi,

Thanks for the early Reply.

After executing the program i am getting the output

object created : a number

send to all = 'X'.

status is 0.

After this i am going to transaction : SCOT, where i have given my name in MAIL, and executing the document. after execution the document is placed under error heading.

Now i went to Transaction : SOST, here i see my document with the Message Status :

DEFINITELY cannot transfer message to node EMAIL due to connection error.

What Exactly does this message mean.

Any help in this regard is highly appreciated.