About using SO_NEW_DOCUMENT_ATT_SEND_API1 to send mail to external!

hi
i using the function to send mail from sap to external!
the coding as follow: but i will get sy-subrc = 2:document could not be sent to any of the recipients
if i want to send mail from SAP
and how to solved it !
thank you very much!
*& Report  ZJOHN_STUDY1
REPORT  ZJOHN_STUDY1.
*REPORT  ZSSO_DOCUMENT_SEND_API1.
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.
* Creating the document to be sent
DOC_CHNG-OBJ_NAME = 'OFFER'.
DOC_CHNG-OBJ_DESCR = 'Auction of a Picasso jr'.
OBJTXT = 'Reserve price : $250000'.
APPEND OBJTXT.
OBJTXT = 'A reproduction of the painting to be auctioned'.
APPEND OBJTXT.
OBJTXT = 'is enclosed as an attachment.'.
APPEND OBJTXT.
DESCRIBE TABLE OBJTXT LINES TAB_LINES.
READ TABLE OBJTXT INDEX TAB_LINES.
DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
* Creating 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.
* Creating the document attachment
* (Assume the data in OBJBIN are given in BMP format)
OBJBIN = ' \O/ '. APPEND OBJBIN.
OBJBIN = '  |  '. APPEND OBJBIN.
OBJBIN = ' / \ '. APPEND OBJBIN.
DESCRIBE TABLE OBJBIN LINES TAB_LINES.
OBJHEAD = 'picasso.bmp'. APPEND OBJHEAD.
* Creating the entry for the compressed attachment
OBJPACK-TRANSF_BIN = 'X'.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM   = 1.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM   = TAB_LINES.
OBJPACK-DOC_TYPE   = 'BMP'.
OBJPACK-OBJ_NAME   = 'ATTACHMENT'.
OBJPACK-OBJ_DESCR = 'Reproduction object 138'.
OBJPACK-DOC_SIZE   = TAB_LINES * 255.
APPEND OBJPACK..
* Entering names in the distribution list
RECLIST-RECEIVER = "'test  @   test   . com". "is external mail
RECLIST-REC_TYPE = 'U'.
RECLIST-com_type = 'INT'.
RECLIST-notif_del = 'X'.
RECLIST-notif_ndel = 'X'.
APPEND RECLIST.
*RECLIST-RECEIVER = 'DLI-NEUREICH'.
*RECLIST-REC_TYPE = 'P'.
*APPEND RECLIST.
*** Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
  EXPORTING
    DOCUMENT_DATA              = DOC_CHNG
    PUT_IN_OUTBOX              = 'X'
    COMMIT_WORK                = '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.
CASE SY-SUBRC.
  WHEN 0.
    WRITE: / 'Result of the send process:'.
    LOOP AT RECLIST.
      WRITE: / RECLIST-RECEIVER(48), ':'.
      IF RECLIST-RETRN_CODE = 0.
        WRITE 'sent successfully'.
      ELSE.
        WRITE 'not sent'.
      ENDIF.
    ENDLOOP.
  WHEN 1.
    WRITE: /
    'no authorization to send to the specified number of recipients!'.
  WHEN 2.
    WRITE: / 'document could not be sent to any of the recipients!'.
  WHEN 4.
    WRITE: / 'no authorization to send !'.
  WHEN OTHERS.
    WRITE: / 'error occurred during sending !'.
ENDCASE.
Code Formatted by: Alvaro Tejada Galindo on Jan 7, 2009 12:36 PM

when sy-subrc = 0 for above f.m then write below coding...
if sy-subrc = 0.
SUBMIT RSCONN01 WITH MODE = 'INT'. ----> *to run scot t.code*
endif.
as below..
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
      document_data = doc_chng
      put_in_outbox = 'X'
      commit_work = 'X'
      TABLES
      packing_list = objpack
      contents_txt = objtxt[]
      contents_bin = so_ali[]
*contents_hex = so_ali[]
      receivers = reclist[]
      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 'Mail sent successfully' TYPE 'S'.
*SUBMIT RSCONN01 WITH MODE = MODE.*
      ENDIF.
Edited by: shan palani on Jan 7, 2009 4:10 PM
Code Formatted by: Alvaro Tejada Galindo on Jan 7, 2009 12:36 PM

Similar Messages

  • Truncation while using FM SO_NEW_DOCUMENT_ATT_SEND_API1 for sending mail

    I am using function module SO_NEW_DOCUMENT_ATT_SEND_API1 to send mail to external email id specified in a distribution list .But the restriction of this FM is truncates the content of a line having more than 255 char (as CONTENTS_BIN is of type char of 255 length ).
    Is there is any other function module or any tweak to this FM which can solve my problem
    Regards.
    Tushar

    Refer the links -
    Re: Formattiing mail With more than 255 characters
    Re: Mail with a file txt attached - lenght each record more than 255 chars
    Email attachment rows greater than 255 char get truncated
    Creating an spreadsheet as an e-mail attachment sprdsht line data is GT 255
    Regards,
    Amit
    Reward all helpful replies.

  • Error while sending mail to external id

    Hai all,
    I am trying to send mail to external mail id using the FM SO_NEW_DOCUMENT_ATT_SEND_API1. After executing when i check in sost i m getting an error 'Cannot process message, no route from sapuserto external mail id.
    Can anyone help me resolve this issue pls.
    Thanks in advance,
    Neela

    Hi,
    You have to fill the tables parameter 'PACKING_LIST'.
    try with these values
    wa_objpack-TRANSF_BIN = space.
    wa_objpack-HEAD_START = 1.
    wa_objpack-HEAD_NUM   = 0.
    wa_objpack-BODY_START = 1.
    wa_objpack-DOC_TYPE   = 'RAW'.
    APPEND wa_objpack to it_objpack.
    Regards,
    Daz.

  • How to send mails to external maild like yahoo

    I am using 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    funtion module to send mails to internal office mail ids and working correctly .
    Not the requirement changed . I need to send mail to external mail id like
    per at the rateyahoo dot com also.
    What can I do to send mail to external mailids like yahoo.
    Do I need to use flag some thing ?
    THANSK IN ADVANCE.

    Hi,
    Hi,
    It is posible to send the mail to external address usign the above FM . But some configurations have to be maitnaied in SCOT Tcode for INT (Internet) ->SMTP protocal. we need to give the Mail Host and Mail Port all this information is usually done by the BASIS. Please approach them for these settings and try again with the FM. Here we have to configure it to Yahoo so that we can send the mail.
    Regards
    Lekha

  • Problem while sending mail to external mail ids

    Hi All,
    while trying to send mail to external mail ids through some custom program, i'm facing an error as "recipient not in address management".
    Can anyone giude me why this is occuring and actually what is this Address management?
    Thanks & Regards,
    Anil.

    Hi,
    Check this sample code..
    http://www.sapdevelopment.co.uk/reporting/email/email_mbody.htm
    * Add the recipients email address
      clear it_receivers.
      refresh it_receivers.
    <b>  it_receivers-receiver = p_email.
      it_receivers-rec_type = 'U'.
      it_receivers-com_type = 'INT'.</b>
      it_receivers-notif_del = 'X'.
      it_receivers-notif_ndel = 'X'.
      append it_receivers.
    what Fm you are using..?are you specifying like above for e-mail address..
    Regards
    vijay

  • How to use FM SO_DOCUMENT_REPOSITORY_MANAGER send mail with CC.

    Dear Experts:
    Please help me. How to use FM SO_DOCUMENT_REPOSITORY_MANAGER send mail with CC.
    My Program code is as follow:
    *Send the mail.
    tb_receipients-recnam = 'BAITZ'.
    tb_receipients-recesc = 'B'.
    tb_receipients-sndex = 'X'.
    tb_receipients-att_fix ='X' .
    APPEND  tb_receipients.
    CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
      EXPORTING
        method       = wa_method1
        office_user  = wa_owner
        ref_document = wa_ref_document
        new_parent   = wa_new_parent
      IMPORTING
        authority    = wa_authority
      TABLES
        objcont      = tb_objcnt
        objhead      = tb_objhead
        objpara      = tb_objpara
        objparb      = tb_objparb
        recipients   = tb_receipients
        attachments  = tb_attachments
        references   = tb_references
        files        = tb_files
      CHANGING
        document     = wa_document
        header_data  = wa_header.
    endform.                    " send_mail
    By the why, tb_receipients-recnam = 'BAITZ'. What's the meaning of 'BAITZ'? Thanks!

    you can use FM SO_NEW_DOCUMENT_SEND_API1
    WA_RECV TYPE SOMLRECI1,
    IT_RECV TYPE STANDARD TABLE OF SOMLRECI1.
    wa_recv-receiver = 'TO email address'.
    wa_recv-rec_type = 'U'.
    wa_recv-com_type = 'INT'.
    APPEND wa_recv TO it_recv.
    CLEAR wa_recv."To Recipient
    wa_recv-receiver = 'CC email address'.
    wa_recv-rec_type = 'U'.
    wa_recv-com_type = 'INT'.
    wa_recv-copy = 'X'.
    APPEND wa_recv TO it_recv.
    CLEAR wa_recv. "CC Recipient
    wa_recv-receiver = 'BCC email address'.
    wa_recv-rec_type = 'U'.
    wa_recv-com_type = 'INT'.
    wa_recv-blind_copy = 'X'.
    APPEND wa_recv TO it_recv.
    CLEAR wa_recv. "BCC Recipient

  • Sending mail to external mailid from user exit EXIT_SAPLEBNF_005

    Hai ALL,
    iam facing problem with sending mail to external id from user exit exit_saplebnf_005 , this user exit for ROLE Determination of releasing of PO .
    in this user exit i passed a user name for this role from one z table.
    through workflow the mails are send to workplace of resposible person maintained in ztable.
    now user requirement is they want some intimation in their outlook for they got mail in workplace .
    can anybody help me.
    Thanks .
    sushmita.k

    they can either define automatic forwarding in their SAP office to external e-mail OR they can set their external e-mail as preferred method of communication and they should receive mail to their external mailbox assuming that sending to external mail is supported in your system (check with BASIS folks).

  • Not send mail for external domains

    Hi,
    I have installed OCS 10g(10.1.2) in linux. All components ok, but i not send mail for external domain.
    Att,
    Mesti

    I remember in version 9.0.2 that i configure in SMTP_OUTBOUND the IP of DNS external to send mail for other domains.
    Mesti

  • Failed to send mail to external domain via portal

    Hi Gurus,
    By following the configuraion instructions in <b>SAP library - Collaboration - Groupware - Installing and Configuring E-Mail Connectivity</b>, I managed to send mail to recipients who reside in same domain e.g. <b>[email protected]</b> via portal.
    However, I failed to send mail to external domain e.g. <b>[email protected]</b>. I got the following error message:
    The mail could not be sent to the specified recipients com.sap.ip.collaboration.gw.impl.transport.javamail.exception.MailSendException: The mail could not be sent to the specified recipients
         at com.sap.ip.collaboration.gw.impl.transport.javamail.JavaMailTransport.sendMail(JavaMailTransport.java:183)
    --------- exception is chained. Original exception ------------
    javax.mail.SendFailedException: Invalid Addresses;
      nested exception is:
         javax.mail.SendFailedException: 553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1)
         at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:804)
         at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:320)
    Please help.
    Thanks alot.

    Hi Ajey,
    Thanks for your reply. I had tried your suggestion but same problem occurred with same error output.
    Actually, I encounterred this error message before in my <b>Microsoft Outlook</b>, where System Admin returned me a mail saying that, my mail was undeliverable with the same error message. But this can be solved by applying the <b>Internet Email Account Setting - Outgoing Server - My outgoing server (SMTP) require authentication</b>.
    So I am wondering,
    1) This problem is caused by SMTP server?
    2) Is there any workaround (like the Outlook Setting) I can configure in Portal?
    Do you have any idea?
    Thanks,
    HauChee

  • Sending mail to external system in sap 4.6c

    Hi WF experts,
    We are configuring sending mails to external system in sap4.6c.
    sxdump20.exe is kept on the frontend and created RFC destination with path to sxdump20.exe.
    same RFC destination is given while configuring in SCOT trxn.
    From SAP, mails are successfully sent and getting message in SOST as delivered to recipent.
    But recipent is not receiving mails in his inbox ( outlook express,gmail,hotmail etc ).
    Any solution from you will be of great help.
    simha

    Hi,
    Make sure that the mail sent from SAP 4.6C are not declared as "Bad Mails" at your Mail Server/SMTP Gateways, possibly due to some technical reason. (such as sender address is not correct, any other SMTP errors,  etc...etc.).
    Ask your network/system admin to verify it.
    Regards,
    Bhavik G. Shroff

  • WorkFlows:How to send mail to external address

    Hi all,
    I am new to workflows, I want to send mail to my outlook form workflow. I have added mail id in Tcode: SO13 in Automatic Forwarding Tab. when I excute the workflow by adding mail step. the mail is going to sap inbox but it is not going to my outlook. Can anybody please explain.
    Thanks in Advance.
    Edited by: Ranjith Reddy on Feb 20, 2009 11:32 AM

    Hi,
    The 'SendMail' activity is failing in my workflow if I give the Recipient type 'E-mail Address' and hard code the email id. I tried the other way of giving expression also, both have resulted in error halting the workflow.
    Is there any other configuration need to be done to send mail to external system (mail server) ? Please help .
    Regards,
    Gowri.S

  • Send mail to external id using send mail task in workflow

    hello,
    i am trying to send mail using send mail task in workflow for an external email address (yahoo).No pernr here it is associated .
    IN scot, it shows it is transmitted,but i dont find any in my mail box.
    But when i send it from business workplace, i can see the mail in my mail box.
    Can you please help me in this regard.
    Best Regards,
    Saujanya.

    Hi Saujanya,
    When you send it from the workplace you also send it to your Yahoo mail-id? As far as I can see from you replies the problem lies outside of SAP. Maybe a SPAM filter which blocks the message. This could be due to the mail-id which sends the e-mail.
    Regards,
    Martin

  • Send mail to external address using send mail step.

    Hi all,
    I have one question.
    In a send mail step of workflow, when the recipient type is a Organizational Object and Org Unit, the mail is only sent to workplace? I would need to send the mail to external address from all users of Org Unit. Is possible it?
    Thanks
    Regards,
    David.

    Hi,
    1) In the Recipient type select the E-Mail address from the drop down
    2) And give the email id (in the text box)
    3) Then save & test it.
    4) Once it execute goto t.code SOST and see the email entry.
    5) If entry not found, the SCOT settings is not done then check with Basis Team
    6) If found, select it and execute.
    7) And check you email
    Regards,
    Surjith

  • Send Mail to External Mail ID's for Multiple Users

    Hi All,
    I want to send mail from SAP to External mail ID's for multiple Users.The program is ok.
    But I want to send this to Multiple external Mail id's. Where should I assign this receivers list. Pls advise.
    What is the transaction to assign multiple receivers.?
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
            DOCUMENT_DATA              = GD_DOC_DATA
            PUT_IN_OUTBOX              = 'X'
            COMMIT_WORK                = ''
          TABLES
            PACKING_LIST               = IT_PACKING_LIST
            CONTENTS_TXT               = IT_MESSAGE
            RECEIVERS                  = IT_RECEIVERS
          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.
    Thank You.
    Pranitha.

    IT_RECEIVERS parameters needs to be passed as shown below.
        wa_receivers-receiver = "..........External mail id".
        wa_receivers-rec_type = 'U'.
        wa_receivers-express = 'X'.
        APPEND wa_receivers TO lt_receivers.
        CLEAR  wa_receivers.
    Once mail is triggered to the external mail id's, check the mail is transferred from SAP or not using the tcode SCOT.
    In SCOT,follow the path UTILITIES-> Overview of send orders.
    Regards,
    Satish Kanteti

  • How to send Mail to external system - Check the program ?

    Hi all,
          The following is a ABAP Program to Send a mail to external mail id. this program is not showing error but when executed it say "No message sent"
    what i've to do to overcome this hurdles. if any solution or prerequisites then '
    please give me a solution. 
    PARAMETERS: psubject(40) type c default  'Hello',
                p_email(40)   type c default '[email protected]' .
    data:   it_packing_list like sopcklsti1 occurs 0 with header line,
            it_contents like solisti1 occurs 0 with header line,
            it_receivers like somlreci1 occurs 0 with header line,
            it_attachment like solisti1 occurs 0 with header line,
            gd_cnt type i,
            gd_sent_all(1) type c,
            gd_doc_data like sodocchgi1,
            gd_error type sy-subrc.
    data:   it_message type standard table of SOLISTI1 initial size 0
                    with header line.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    Perform populate_message_table.
    *Send email message, although is not sent from SAP until mail send
    *program has been executed(rsconn01)
    PERFORM send_email_message.
    *Instructs mail send program for SAPCONNECT to send email(rsconn01)
    perform initiate_mail_execute_program.
    *&      Form  POPULATE_MESSAGE_TABLE
          Adds text to email text table
    form populate_message_table.
      Append 'Email line 1' to it_message.
      Append 'Email line 2' to it_message.
      Append 'Email line 3' to it_message.
      Append 'Email line 4' to it_message.
    endform.                    " POPULATE_MESSAGE_TABLE
    *&      Form  SEND_EMAIL_MESSAGE
          Send email message
    form send_email_message.
    Fill the document data.
      gd_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      gd_doc_data-obj_langu = sy-langu.
      gd_doc_data-obj_name  = 'SAPRPT'.
      gd_doc_data-obj_descr = psubject.
      gd_doc_data-sensitivty = 'F'.
    Describe the body of the message
      clear it_packing_list.
      refresh it_packing_list.
      it_packing_list-transf_bin = space.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 0.
      it_packing_list-body_start = 1.
      describe table it_message lines it_packing_list-body_num.
      it_packing_list-doc_type = 'RAW'.
      append it_packing_list.
    Add the recipients email address
      clear it_receivers.
      refresh it_receivers.
      it_receivers-receiver = p_email.
      it_receivers-rec_type = 'U'.
      it_receivers-com_type = 'INT'.
      it_receivers-notif_del = 'X'.
      it_receivers-notif_ndel = 'X'.
      append it_receivers.
    Call the FM to post the message to SAPMAIL
      call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           exporting
                document_data              = gd_doc_data
                put_in_outbox              = 'X'
           importing
                sent_to_all                = gd_sent_all
           tables
                packing_list               = it_packing_list
                contents_txt               = it_message
                receivers                  = it_receivers
           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.
    Store function module return code
      gd_error = sy-subrc.
    Get it_receivers return code
      loop at it_receivers.
      endloop.
    endform.                    " SEND_EMAIL_MESSAGE
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
          Instructs mail send program for SAPCONNECT to send email.
    form initiate_mail_execute_program.
      wait up to 2 seconds.
      if gd_error eq 0.
          submit rsconn01 with mode = 'INT'
                        with output = 'X'
                        and return.
      endif.
    endform.                    " INITIATE_MAIL_EXECUTE_PROGRAM
    Thanks in Advance,
        Manian

    Hi,
       I can get the idea but i'm asking u about the prerequisites such as SCOT - sap connect or something else has to be done before executing the program.
    if i need any pls let me know?
    I've tried the program but it say " No Message sent" and i didn't get any mail to mail id.
    thanks in advance,
      Manian.

Maybe you are looking for

  • Unable to open a link document

    Dear All, In test workbench , in the test case attributes tab there is an option for opening the linked document which is linked to test case which is not working for us and we are getting following error. Error message. no info object found for the

  • Why no indication of flag status in 'edit' mode?

    In 'edit' mode, I can flag photos, either via the menu or command-period. How come I can't tell if a current photo is flagged? No indicator anywhere, except to watch the 'flagged <n>' indicator in 'recent' and hit the key combo a few times to see if

  • Sp_TransactionNotification error in 2007 B

    Hi All, the following stored procedure was running just fine in 2005 B version. set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go ALTER proc [dbo].[SBO_SP_TransactionNotification] @object_type nvarchar(25),                     -- SBO Object Type @transac

  • Deleted photos space is not released

    Delete all photos, delete also recently eliminated. But when I enter phone information photographs still occupy almost a gig and says I have 680 photos on the device. If I look at using iTunes tells me the same. How can I do to free that memory space

  • Evdre error using "dynamic hierarchy expansion" option

    Dear all, I'm trying to expand the evdre using the option "dynamic hierarchy expansion", but I get an error in function EVDRE(). This is the error: #ERR: Consolidation Mode ON - Only keyword ""Blank"" is applicable for dimension ENTITY when with dime