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

Email via report using : SO_NEW_DOCUMENT_ATT_SEND_API1: Function Module.

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.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Dec 01, 2004 at 04:42 AM

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

    Regards

    Raja

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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.

  • author's profile photo Former Member
    Former Member
    Posted on Dec 01, 2004 at 03:43 PM

    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.

    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.