E-mail functionality using so_new_document_att_send_api1

Hi
We Implemented E-mail functionality in our tool useing "so_new_document_att_send_api1" standard FM but here im unable to attach excel document .How to attach a excel document in this standard FM plz help.
Asif

hi try this code
*& Report  ZTEST_2                                                     *
*& Report  ZTEST_2                                                     *
REPORT  ztest_2                                 .
TYPES : BEGIN OF t_email_update_iw32,
         aufnr LIKE viaufks-aufnr,
         vornr LIKE afvc-vornr,
         text(220),
        END OF t_email_update_iw32.
DATA : gt_email_update_iw32 TYPE STANDARD TABLE OF t_email_update_iw32,
       gw_email_update_iw32 TYPE t_email_update_iw32.
TYPES : BEGIN OF t_email_date_error,
         aufnr LIKE viaufks-aufnr,
         prueflos LIKE qamr-prueflos,
         merknr  LIKE qamr-merknr,
         text(220),
        END OF t_email_date_error.
DATA : gt_email_date_error TYPE STANDARD TABLE OF t_email_date_error,
       gw_email_date_error TYPE t_email_date_error.
TYPES : BEGIN OF t_email_conf_doc_error,
         aufnr LIKE viaufks-aufnr,
         vornr LIKE afvc-vornr,
         text(220),
        END OF t_email_conf_doc_error.
DATA : gt_email_conf_doc_error TYPE STANDARD TABLE OF
t_email_conf_doc_error,
       gw_email_conf_doc_error TYPE t_email_conf_doc_error.
SELECTION-SCREEN : BEGIN OF BLOCK b4 WITH FRAME TITLE text-004.
PARAMETERS : cb_email AS CHECKBOX DEFAULT 'X'.
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT (16) text-007 FOR FIELD p_email1.
PARAMETERS : p_email LIKE somlreci1-receiver,
             p_email1 LIKE adr6-smtp_addr.
PARAMETERS : p_table1 AS CHECKBOX,
             p_table2 AS CHECKBOX,
             p_table3 AS CHECKBOX.
SELECTION-SCREEN : END OF BLOCK b4.
CLEAR gw_email_update_iw32.
REFRESH gt_email_update_iw32.
gw_email_update_iw32-aufnr = '1234567'.
gw_email_update_iw32-vornr = '0010'.
gw_email_update_iw32-text = 'This is table1'.
APPEND  gw_email_update_iw32 TO gt_email_update_iw32.
CLEAR gw_email_update_iw32.
gw_email_update_iw32-aufnr = '4564578'.
gw_email_update_iw32-vornr = '0020'.
gw_email_update_iw32-text = 'This is table1'.
APPEND  gw_email_update_iw32 TO gt_email_update_iw32.
gw_email_date_error-aufnr = '222615'.
gw_email_date_error-prueflos = '1111'.
gw_email_date_error-merknr = '2222'.
gw_email_date_error-text = 'This is table2'.
APPEND gw_email_date_error TO gt_email_date_error.
gw_email_date_error-aufnr = '222615'.
gw_email_date_error-prueflos = '3333'.
gw_email_date_error-merknr = '4444'.
gw_email_date_error-text = 'This is table2'.
APPEND gw_email_date_error TO gt_email_date_error.
gw_email_conf_doc_error-aufnr = '9900107987'.
gw_email_conf_doc_error-vornr = '999999'.
gw_email_conf_doc_error-text  = 'This is table3'.
APPEND gw_email_conf_doc_error TO gt_email_conf_doc_error.
gw_email_conf_doc_error-aufnr = '9900107987'.
gw_email_conf_doc_error-vornr = '999999'.
gw_email_conf_doc_error-text  = 'This is table3'.
APPEND gw_email_conf_doc_error TO gt_email_conf_doc_error.
DATA : lw_space VALUE ''.
SET PARAMETER ID 'ZPDF' FIELD lw_space.
DATA : pripar LIKE pri_params.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
  EXPORTING
    in_parameters          = pripar
    line_size              = 255
    layout                 = 'X_65_132'
    no_dialog              = 'X'
  IMPORTING
    out_parameters         = pripar
  EXCEPTIONS
    archive_info_not_found = 1
    invalid_print_params   = 2
    invalid_archive_params = 3
    OTHERS                 = 4.
NEW-PAGE PRINT ON PARAMETERS pripar NO DIALOG .
RESERVE 5 LINES.
DATA : text1(10) TYPE c  VALUE 'AUFNR',
       text2(10) TYPE c VALUE 'VORNR',
       text3(50) TYPE c VALUE 'TEXT'.
IF p_table1 = 'X'.
  WRITE  AT 10   text1. WRITE AT 30  text2 . WRITE AT 30 text3.
  LOOP AT  gt_email_update_iw32 INTO  gw_email_update_iw32.
    WRITE : /  gw_email_update_iw32-aufnr , gw_email_update_iw32-vornr ,
gw_email_update_iw32-text.
  ENDLOOP.
ENDIF.
WRITE : / sy-uline .
IF p_table2 = 'X'.
  WRITE : / 'AUFNR' , 'PRUEFLOS' ,  'MERKNR', 'TEXT' .
  LOOP AT gt_email_date_error INTO gw_email_date_error.
    WRITE : / gw_email_date_error-aufnr, gw_email_date_error-prueflos,
gw_email_date_error-merknr,gw_email_date_error-text.
  ENDLOOP.
ENDIF.
WRITE : / sy-uline .
IF p_table3 = 'X'.
  WRITE : / 'AUFNR' , 'VORNR' , 'TEXT' .
  LOOP AT gt_email_conf_doc_error INTO gw_email_conf_doc_error.
    WRITE : / gw_email_conf_doc_error-aufnr,
gw_email_conf_doc_error-vornr, gw_email_conf_doc_error-text.
  ENDLOOP.
ENDIF.
NEW-PAGE PRINT OFF.
DATA : mtab_pdf LIKE tline OCCURS 0 WITH HEADER LINE.
DATA : rqident LIKE tsp01-rqident ,
       rqcretime LIKE tsp01-rqcretime .
SELECT  rqident  rqcretime FROM tsp01
       INTO (rqident,rqcretime)
       WHERE rqowner = sy-uname
       ORDER BY rqcretime DESCENDING.
  EXIT.
ENDSELECT.
DATA: spool_id LIKE tsp01-rqident.
MOVE  rqident TO spool_id.
DATA : p_file LIKE rlgrap-filename VALUE 'C:\file.pdf' ,
       numbytes TYPE i,
       cancel.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
  EXPORTING
    src_spoolid = spool_id
      NO_DIALOG =
      DST_DEVICE =
      PDF_DESTINATION =
IMPORTING
    pdf_bytecount = numbytes
      PDF_SPOOLID =
      LIST_PAGECOUNT =
      BTC_JOBNAME =
      BTC_JOBCOUNT =
  TABLES
    pdf = mtab_pdf
EXCEPTIONS
   err_no_abap_spooljob = 1
   err_no_spooljob = 2
   err_no_permission = 3
   err_conv_not_possible = 4
   err_bad_destdevice = 5
   user_cancelled = 6
   err_spoolerror = 7
   err_temseerror = 8
   err_btcjob_open_failed = 9
   err_btcjob_submit_failed = 10
   err_btcjob_close_failed = 11
   OTHERS = 12
IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
end
DATA :  w_buffer TYPE string. "To convert from 132 to 255
DATA : i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE.
LOOP AT mtab_pdf.
Replacing space by ~
  TRANSLATE mtab_pdf USING ' ~'.
  CONCATENATE w_buffer mtab_pdf INTO w_buffer.
ENDLOOP.
Replacing ~ by space
TRANSLATE w_buffer USING '~ ' .
DO.
  i_record = w_buffer.
Appending 255 characters as a record
  APPEND i_record.
  SHIFT w_buffer LEFT BY 255 PLACES.
  IF w_buffer IS INITIAL.
    EXIT.
  ENDIF.
ENDDO.
*start try
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 TYPE c.
doc_chng-obj_name = 'TEST'.
doc_chng-obj_descr = 'Mail came successfully'.
objtxt = 'Regards'.
APPEND objtxt.
objtxt = 'Nitin'.
APPEND objtxt.
objtxt = 'hahaha'.
APPEND objtxt.
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
* ERSTELLEN DES EINTRAGS ZUM KOMPRIMIERTEN DOKUMENT
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.
* ERSTELLEN DER ANLAGE FUR DAS DOKUMENT
**OBJBIN = '\O/ '. APPEND OBJBIN.
**OBJBIN = ' '. APPEND OBJBIN.
**OBJBIN = ' / \ '. APPEND OBJBIN.
LOOP AT i_record.
  objbin[] =  i_record[].
ENDLOOP.
DESCRIBE TABLE objbin LINES tab_lines.
*objhead = 'picasso.txt'. APPEND objhead.
* Erstellen des Eintrags zur komprimierten Anlage
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'PDF'.
objpack-obj_name = 'PDF File received '.
objpack-obj_descr = 'PDF File received '.
*objpack-doc_size = ( tab_lines ) * 255 .
APPEND objpack.
* Fullen der Empfangerliste
refresh reclist.
reclist-rec_type = 'U'.
reclist-receiver = p_email1.
APPEND reclist.
reclist-rec_type = 'B'.
reclist-receiver = sy-uname.
APPEND reclist.
reclist-rec_type = 'U'.
reclist-receiver = p_email.
APPEND reclist.
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.

Similar Messages

  • Mail Send Functionality using SO_NEW_DOCUMENT_ATT_SEND_API1

    hi,
    i m using Fn Module "SO_NEW_DOCUMENT_ATT_SEND_API1" to send email with attachment.
    I have written  a program which will fetch data in excel format . this excel should be sent as attachment to specified receiver. however i m having difficulties adding attachment to function module.
    I specified under parameter "contents_bin" but its giving some error message related wth structure.
    I chkd SDN and wasnt able to find any resolution yet.
    Any suggestion or idea which can be useful on this.
    Thanks.

    REPORT  zsendemail                    .
    PARAMETERS: psubject(40) type c default  'Hello',
                p_email(40)   type c default 'write email address' .
    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

  • Sending mails to UWL using SO_NEW_DOCUMENT_ATT_SEND_API1 function module

    Hi all,
    is it possible to view mails send using SO_NEW_DOCUMENT_ATT_SEND_API1 function module to UWL?
    I am receving emails in my SAP Inbox.
    Please guide.
    thanks.

    Hi,
    You can only get the SAP mails into UWL notification tab with the Sonic connector (well of course with some custom development everything is possible).
    One trick to get the workflow for sending "mails" to UWL is to NOT use email sending step, but instead use a decision step in the workflow and send this work item to the user. The decision step can include the same message as the email, and have onl one option "Confirm" (or whatever). These you can easily display in UWL since they are normal work items.
    Regards,
    Karri

  • Mails in UWL using SO_NEW_DOCUMENT_ATT_SEND_API1

    Hi all,
    is it possible to view mails send using SO_NEW_DOCUMENT_ATT_SEND_API1 function module to UWL?
    I am receving emails in my SAP Inbox.
    Please guide.
    thanks.

    I believe you can use SONiC. You might want to do some research on that.

  • Can you send encrypted e-mails using SO_NEW_DOCUMENT_ATT_SEND_API1

    We use SO_NEW_DOCUMENT_ATT_SEND_API1 to send e-mails to employees for various notifications.  The e-mails go out through SCOT and are sent to our lotus notes.
    We have a project being implemented, where the data we are sending in the note is kind of sensitive, so we'd like to see if we could send the e-mail as encrypted.   Does anyone know if there is some parameter we can set upon sending that would encrypt the text in the e-mail for sending?

    FORM pssword_prot_encryptpdf .
      DATA: BEGIN OF command_list OCCURS 0.
              INCLUDE STRUCTURE sxpgcolist.
      DATA: END OF command_list .
      DATA: BEGIN OF exec_protocol OCCURS 0.
              INCLUDE STRUCTURE btcxpm.
      DATA: END OF exec_protocol.
      DATA: status LIKE btcxp3-exitstat,
      commandname LIKE sxpgcolist-name VALUE 'ZTEST',
      sel_no LIKE sy-tabix.
    * GET LIST OF EXTERNAL COMMANDS
      CALL FUNCTION 'SXPG_COMMAND_LIST_GET'
        EXPORTING
          commandname     = commandname
          operatingsystem = sy-opsys
        TABLES
          command_list    = command_list
        EXCEPTIONS
          OTHERS          = 1.
      CALL FUNCTION 'SXPG_COMMAND_CHECK'
        EXPORTING
          commandname                = command_list-name
          operatingsystem            = sy-opsys
        EXCEPTIONS
          no_permission              = 1
          command_not_found          = 2
          parameters_too_long        = 3
          security_risk              = 4
          wrong_check_call_interface = 5
          x_error                    = 6
          too_many_parameters        = 7
          parameter_expected         = 8
          illegal_command            = 9
          communication_failure      = 10
          system_failure             = 11
          OTHERS                     = 12.
      CLEAR command_list.
      REFRESH command_list.
      DATA: v_dir_input      TYPE sxpgcolist-parameters.
      DATA: v_dir_input1      TYPE sxpgcolist-parameters.
      break developer.
      command_list-name = 'ZTEST'.
      command_list-opsystem = 'Windows NT'.
      CONCATENATE   'd:\pdf\' main_dtl-vbeln '.PDF' INTO name.
      CONCATENATE 'cmd /c d:\pdf\encryptpdf.exe' '-i' name  '-o ' name  '-u'  hdr-password INTO v_dir_input SEPARATED BY space .
      READ TABLE command_list INDEX sel_no.
      break developer.
      CONCATENATE command_list-opcommand v_dir_input INTO command_list-opcommand SEPARATED BY space.
    * CHECK AUTHORIZATION
      command_list-addpar = 'X'.
      APPEND command_list.
      CONSTANTS: c_extcom    TYPE sxpgcolist-name VALUE 'ZTEST',
                 c_oper      TYPE syopsys VALUE 'Windows NT'.
      DATA: t_result         TYPE STANDARD TABLE OF btcxpm.
      v_dir_input  =  command_list-opcommand.
      CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
        EXPORTING
          commandname                   = c_extcom
          additional_parameters         = v_dir_input
          operatingsystem               = c_oper
        TABLES
          exec_protocol                 = t_result
        EXCEPTIONS
          no_permission                 = 1
          command_not_found             = 2
          parameters_too_long           = 3
          security_risk                 = 4
          wrong_check_call_interface    = 5
          program_start_error           = 6
          program_termination_error     = 7
          x_error                       = 8
          parameter_expected            = 9
          too_many_parameters           = 10
          illegal_command               = 11
          wrong_asynchronous_parameters = 12
          cant_enq_tbtco_entry          = 13
          jobcount_generation_error     = 14
          OTHERS                        = 15.
    ENDFORM.                    " PSSWORD_PROT

  • Status of the mail sending option using SO_NEW_DOCUMENT_ATT_SEND_API1

    Hi experts,
    I m using SO_NEW_DOCUMENT_ATT_SEND_API1 function moduel for sending mails to dealers. That is, whenver i execute a Z transaction, the customer invoice details are getting displayed in report output. At the same time, the same output data is sent as mail to the respective dealers.
    Now teh user is asking whether there is any possiblity for the end users to have a proof of the mail which is being sent from the Z transaction. If the mail is sent, the end user who executes the Z transaction (mail sending transaction) should have that mail in his/her SENT ITEMS. If the mail not reaches the dealer, then the user must identify the mail bounce identification.
    Pls tell me how to achve the same..
    Regards,
    Shanthi

    Hi,
    Yes it is possible..
    Just pass 'X' to the exporting parameter 'put_in_outbox'. The user can check the send mail in 'sost'. All the details of the mail will be there. This will be the proof that the mail was sent.
    Reg the 2nd part of your query, if the mail is not delivered to any reciepent or to particular recipient, the details will be there in the SAP outbox, that also you can see through transaction 'sost'.
    Thanks & Regards
    Rocky

  • 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 = '[email protected]'.
      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.

    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.

  • How to update the sent mail using SO_NEW_DOCUMENT_ATT_SEND_API1

    I have a requirement to update/ append the sent mail like a trail.Since i am sending mails using SO_NEW_DOCUMENT_ATT_SEND_API1, how can i update new contents to sent mails using this RFC???Please help me.

    you may have to store content of each time mail send then only, you can send with history.

  • How to use Mail functionality OPTT in the Schema

    Dear All,
        We have a requirement where we need to send a mail to the Time Administrator if Time Evalution ends in Error.  We have implemented the functionality OPTT MAIL option in the schema, but it is not sending the mail to Time Administrator. We have maintained the Time Administrator table T526 with the SAP ID.
    Could anybody tell us, we have to do anyother configuration to enable the mail function
    Thanks in Advance
    Rajesh.S

    Hello Folks,
        Can anyone please let me know How to send a mail notification to the Time Administrator.
    In the Schema, OPTT MAIL 1 has declared.
    The Time Administrator is maintained in T526 table.
    Do we need to do other than above to send mail.
    Kindly let me know.
    Note. The COLER function is not used in the Schema.

  • Cannot use php mail() function in leopard's localhost

    <?php
    $to = "[email protected]";
    $subject = "test subject";
    $message = "test message";
    $from = "[email protected]";
    $headers = "From: $from";
    mail($to, $subject, $message, $headers)
    ?>
    This code doesn't work on my localhost but when I uploaded it to my sever it run normaly. Then how can I use the mail function on my localhost to test it before I need to publish it to my server

    Have you started the mail server on your machine?
    By default PHP will try to use the local mail server to send the message. If you haven't started Postfix the message will go nowhere.

  • Still cant use mail function

    Dear Apple Support,
    Although you guys say the iClouds' servers are running correctly,
    however, i still can't access mail function with my Apple ID on all my devices like, Macbook Air and iPad,
    I felt very frastrated on using the iCloud. :'(

    That stinks, if you had an Advisor on the phone, they are supposed to call you back if you get disconnected.
    But most of my emails, familly emails are forwarded to a saved folder, and when accessing from webmail, I can't read their emails. 

  • How can we extend the subject line using SO_NEW_DOCUMENT_ATT_SEND_API1??

    Hi,
    I am triggering a mail using the function module SO_NEW_DOCUMENT_ATT_SEND_API1, where in the subject of the mail is passed using the DOC_CHNG-OBJ_DESCR, here the object_descr can only accomadate 50 characters.
    But requirement is to have more than 50 characters may be 100 to 150 in the subject line.Please help me to extend.
    Thanks in advance.

    Hi,
    Searched in the forum for the above requirement but didnt find the required info..
    Please help me in finding a solution to this
    Thanks in advance

  • Regarding EMAIL in inbox using SO_NEW_DOCUMENT_ATT_SEND_API1

    HI all,
    I am using SO_NEW_DOCUMENT_ATT_SEND_API1 module to sent emails on external email IDs.Can anyone guide me if this function module also sends email to SAP inbox correspoding to email addrees on which email is sent?
    Also guide me how to send doc to sap inbox of these email adrees using SO_NEW_DOCUMENT_ATT_SEND_API1.
    Thanks.

    Hi,
    Yes you can even send mails to the SAp inbox, by simply setting the receiver type as B in the RECEIVERS tables parameter.
    Regards
    Pavan

  • Issue with function module SO_NEW_DOCUMENT_ATT_SEND_API1

    Hi,
    I am new to web dynpro abap.In my application ,im using  'SO_NEW_DOCUMENT_ATT_SEND_API1 function module to send mail.
    Application is working fine ,but in code inspector im get error like
    Undesirable statement SUBMIT !
    Plz help me to solve
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = lt_mailsubject
          put_in_outbox              = 'X'
          commit_work                = 'X'
        TABLES
          packing_list               = lt_packing_list
          contents_bin               = lt_attachment
          contents_txt               = lt_mailtxt
          receivers                  = lt_mailrecipients
        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 EQ 0.
        SUBMIT rsconn01 WITH MODE = 'INT' AND RETURN.
      ENDIF.
    Edited by: amrutha_prabhu2000 on Mar 29, 2011 6:32 AM

    Hi Amrutha and roopa,
    Please go through this.. it might solve your problem.
    WebDynpro ABAP
    Re: how to send an email with an attachment using webdynpros
    Cheers,
    Kris.

  • Function module SO_NEW_DOCUMENT_ATT_SEND_API1

    Hi All,
    I'm using function module SO_NEW_DOCUMENT_ATT_SEND_API1 for sending data in internal table to an email address with excel sheet attachment .
    The problem is in attachment i'm not getting the data in formatted.
    The whole data which is in internal table is being populated in the first cell of the excel sheet only.
    How can we format the data in the excel sheet.
    Thanks & Regards,
    Anil.

    Check the link below for how it works......
    /people/thomas.jung3/blog/2004/09/07/sending-e-mail-from-abap--version-46d-and-lower--api-interface
    Also check the Code below
    REPORT test.
    DATA: att_size TYPE i,                             " att Size
          att_itab_size TYPE i,                        " Attachment size
          mailtxt_size TYPE i.                         " Text in mail size
    DATA:
    it_mailpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE, " Dist details
    it_mailhead LIKE solisti1   OCCURS  1 WITH HEADER LINE," Header data
    it_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,   " Rec List
    it_mailtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,    " Mail Text
    it_att_data LIKE solisti1 OCCURS 0 WITH HEADER LINE,   " Attachment data
    it_doc_att LIKE sodocchgi1.                          " Attri of new doc
    * Text in the mail.
    it_mailtxt-line  = ' This is a test mail,  Line Number--1'.
    APPEND it_mailtxt.
    it_mailtxt-line = ' This is a test mail,  Line Number--2' &
                      ' This is a test mail,  Line Number--2'.
    APPEND it_mailtxt.
    it_mailtxt-line = ' This is a test mail,  Line Number--3' &
                      ' This is a test mail,  Line Number--3' &
                      ' This is a test mail,  Line Number--3'.
    APPEND it_mailtxt.
    DESCRIBE TABLE it_mailtxt LINES mailtxt_size.
    * Create the att File
    concatenate 'Attachment Line Number 1' space into it_att_data-line.
    APPEND it_att_data.
    concatenate 'Attachment Line Number 2' space into it_att_data-line.
    APPEND it_att_data.
    concatenate 'Attachment Line Number 3' space into it_att_data-line.
    APPEND it_att_data.
    DESCRIBE TABLE it_att_data LINES att_itab_size.
    * Attributes of new doc
    CONCATENATE 'Attach' space 'mail'
                INTO it_doc_att-obj_descr SEPARATED BY space.
    it_doc_att-sensitivty = 'F'.
    it_doc_att-doc_size   = mailtxt_size * 255.
    * Create Pack to text in mail body.
    it_mailpack-transf_bin   = space.
    it_mailpack-head_start   = 1.
    it_mailpack-head_num     = 0.
    it_mailpack-body_start   = 1.
    it_mailpack-body_num     = mailtxt_size.
    it_mailpack-doc_type     = 'RAW'.
    APPEND it_mailpack.
    * Create Pack for Attach.
    it_mailpack-transf_bin   = 'X'.
    it_mailpack-head_start   = 1.
    it_mailpack-head_num     = 1.
    it_mailpack-body_start   = 1.
    it_mailpack-body_num     = att_itab_size.
    it_mailpack-doc_type     = 'XLS'.
    CONCATENATE 'My' space 'Attachment' INTO it_mailpack-obj_descr.
    it_mailpack-doc_size     = att_itab_size * 255.
    APPEND it_mailpack.
    it_reclist-receiver   = '[email protected]'.
    it_reclist-express    = 'X'.
    it_reclist-rec_type   = 'U'.
    it_reclist-notif_del  = 'X'. " request delivery notification
    it_reclist-notif_ndel = 'X'. " request not delivered notification
    APPEND it_reclist.
    * Call FM to send email
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
         EXPORTING
              document_data              = it_doc_att
              put_in_outbox              = 'X'
         TABLES
              packing_list               = it_mailpack
              object_header              = it_mailhead
              contents_txt               = it_mailtxt
              contents_bin               = it_att_data
              receivers                  = it_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 ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    Cheers,
    Thomas.

Maybe you are looking for