Email Function Module

Hi Experts
Can anyone give the general Function module name that sends an email when there is any error occurs in the ABAP Code,
Thanks
PR

HI,
Try using FM:
SO_NEW_DOCUMENT_ATT_SEND_API1
You can go through the sample code below:
REPORT  ZBC_ITAB_TO_EXCEL_NEW                   .
CLASS: cl_abap_char_utilities DEFINITION LOAD.
DATA: docdata LIKE sodocchgi1,
      objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
      objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
      objbin1 LIKE solisti1 OCCURS 10 WITH HEADER LINE,
      objbin2 LIKE solisti1 OCCURS 10 WITH HEADER LINE,
      objbin_final LIKE solisti1 OCCURS 10 WITH HEADER LINE,
      reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE,
      tab_lines TYPE sy-tabix.
DATA: gd_sender_type LIKE soextreci1-adr_typ.
DATA: c_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
      c_ret TYPE c VALUE cl_abap_char_utilities=>cr_lf.
DATA: c_dev TYPE sy-sysid.
DATA: BEGIN OF i_data OCCURS 0,
      a(20),
      b(20),
      END OF i_data.
DATA: BEGIN OF st,
      f1(2) TYPE c,
      f2(2) TYPE n,
      END OF st.
DATA: itab1 LIKE TABLE OF st WITH HEADER LINE,
      itab2 LIKE TABLE OF st WITH HEADER LINE.
DATA: n TYPE i.
PARAMETER: p_email1 LIKE somlreci1-receiver,
           p_sender LIKE somlreci1-receiver.
START-OF-SELECTION.
  itab1-f1 = 'AA'. itab1-f2 = '01'. APPEND itab1.
  itab1-f1 = 'BB'. itab1-f2 = '02'. APPEND itab1.
  itab1-f1 = 'CC'. itab1-f2 = '03'. APPEND itab1.
  itab2-f1 = 'ZZ'. itab2-f2 = '26'. APPEND itab2.
  itab2-f1 = 'YY'. itab2-f2 = '25'. APPEND itab2.
  LOOP AT itab1.
    CONCATENATE itab1-f1 itab1-f2 INTO objbin1 separated BY c_tab.
    CONCATENATE c_ret objbin1 INTO objbin1.
    APPEND objbin1.
  ENDLOOP.
  LOOP AT itab2.
    CONCATENATE itab2-f1 itab2-f2 INTO objbin2 separated BY c_tab.
    CONCATENATE c_ret objbin2 INTO objbin2.
    APPEND objbin2.
  ENDLOOP.
  LOOP AT objbin1.
    MOVE objbin1-line TO objbin_final-line.
    APPEND objbin_final.
  ENDLOOP.
  LOOP AT objbin2.
    MOVE objbin2-line TO objbin_final-line.
    APPEND objbin_final.
  ENDLOOP.
  PERFORM process_email.
  c_dev = sy-sysid.
  IF sy-sysid = c_dev.
    wait up to 5 seconds.
    SUBMIT rsconn01 WITH mode = 'INT'
    WITH output = 'X'
    AND RETURN.
  ENDIF.
  IF sy-subrc = 0.
    WRITE: / 'Email succesfilly delivered'.
  ELSE.
    WRITE: / 'failure'.
  ENDIF.
FORM process_email.
  IF p_sender EQ space.
    gd_sender_type = space.
  ELSE.
    gd_sender_type = 'INT'.
  ENDIF.
*Body
  docdata-obj_name = 'Mail_Excel_File'.
  docdata-obj_descr = 'Excel file attachment'.
  objtxt = 'Attached is the sample Excel file'.
  APPEND objtxt.
  DESCRIBE TABLE objtxt LINES tab_lines.
  READ TABLE objtxt INDEX tab_lines.
  docdata-doc_size = ( tab_lines - 1 ) * 255 + strlen( objtxt ).
  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.
*Attachment
  n = 1.
  DESCRIBE TABLE objbin1 LINES tab_lines.
  objpack-doc_size = tab_lines * 255.
  objpack-transf_bin = 'X'.
  objpack-head_start = 1.
  objpack-head_num = 1.
  objpack-body_start = n.
  objpack-body_num = tab_lines.
  objpack-doc_type = 'XLS'.
  docdata-obj_name = 'Excel_File_Attachment1'.
  objpack-obj_descr = 'Excel File Attachment1'.
  APPEND objpack.
  n = n + tab_lines.
  DESCRIBE TABLE objbin2 LINES tab_lines.
  objpack-doc_size = tab_lines * 255.
  objpack-transf_bin = 'X'.
  objpack-head_start = 1.
  objpack-head_num = 1.
  objpack-body_start = n.
  objpack-body_num = tab_lines.
  objpack-doc_type = 'XLS'.
  docdata-obj_name = 'Excel_File_Attachment2'.
  objpack-obj_descr = 'Excel File Attachment2'.
  APPEND objpack.
*Create the list of recipients
  reclist-receiver = p_email1.
  reclist-rec_type = 'U'.
  reclist-express = 'X'.
  APPEND reclist.
*Send the e-mail
  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data              = docdata
      put_in_outbox              = 'X'
      commit_work                = 'X'
    TABLES
      packing_list               = objpack
      contents_bin               = objbin_final
      contents_txt               = objtxt
      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.
  COMMIT WORK.
ENDFORM.                    "process_email
Hope this helps
Regards
Mansi

Similar Messages

  • Function module to fetch pdf file from App. Server and print/email?

    Hi all,
    Is there any function module to fetch a PDF file from APPLICATION SERVER and print the PDF file or send it as an attachment in an email?
    Please help..
    Thanks in advance.
    Sandeep.

    Hi Sandeep,
    Is there any function module to fetch a PDF file from APPLICATION SERVER
    1) As far as i know there are no FMs to read a file from App server, you can do the same using *OPEN/READ/CLOSE dataset ABAP statements - There are tons of examples for this on the net.
    and print the PDF file or send it as an attachment in an email?
    You can send the file read from the app server(by the suggested method above) and use CL_BCS to send it as an attachment.
    Again there are many examples on the net on how to use CL_BCS for the same.
    Regards,
    Chen

  • 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.

  • Function module for background jobs email

    hi abaper's
                     i hace to create a function module for background jobs this function module have to send an email automatically when a background job is assigned or processed in background.
    thnks n regards
    pardeep kumar

    hi dear
    open this site
    https://weblogs.sdn.sap.com/pub/wlg/781. [original link is broken] [original link is broken] [original link is broken]
    <removed by moderator>
    Edited by: Mike Pokraka on Aug 8, 2008 12:48 PM

  • What is the function module which is used to trigger email

    Hi ALL,
    can u send me the function module which has to trigger email when sales order was saved.
    kindly send me the inputs
    thanks & regards
    naveen
    Moderator Message: Basic Question. Thread locked.
    Edited by: kishan P on Nov 11, 2010 10:56 AM

    Hi,
    This needs to coded in the Save User Exit of the Sales Order Include MV45AFZZ (USEREXIT_SAVE_DOCUMENT) and use the Function Module "SO_DOCUMENT_SEND_API1" to trigger a mail.
    Please try this and let me know if any.
    Regards,
    Srinivas
    Moderator Message: Do not answer Basic Question.
    Edited by: kishan P on Nov 11, 2010 10:58 AM

  • Function module to sent a email

    is there any function module to send report output to an email , this is alv report.
    when i am ru in batch mode then this should happen
    pls send me the parameters to pass for that function module.
    its urgent.

    The FM in comments is to just send it as email while the one is use is to send it as attachement.
    form SEND_EMAIL tables IT_MESSAGE type T_MESSAGE.
      data: IS_DOCDATA   type SODOCCHGI1,
            IS_RECEIVERS type SOMLRECI1,
            IS_RECEIVERS_COPY type SOMLRECI1,
            IT_RECEIVERS type table of SOMLRECI1,
            IS_CONTENT   type SOLISTI1,
            IT_CONTENT   type table of SOLISTI1,
    *500369789+
            l_txt(255)    type c,
            lt_objpack    TYPE TABLE OF sopcklsti1 WITH HEADER LINE,
            lt_objhead    TYPE TABLE OF solisti1   WITH HEADER LINE,
            lt_objtxt     TYPE TABLE OF solisti1   WITH HEADER LINE,
            l_tab_lines TYPE i,
            l_att_type  LIKE soodk-objtp.
    *500369789+
      IS_DOCDATA-OBJ_NAME = 'MAIL'.
      IS_DOCDATA-PRIORITY = 5.
      IS_DOCDATA-OBJ_LANGU = SY-LANGU.
      IS_DOCDATA-NO_CHANGE = 'X'.
      IS_DOCDATA-OBJ_DESCR = SY-CPROG.
      loop at IT_MESSAGE into IS_MESSAGE.
        clear : IS_CONTENT, l_txt.  "500369789+
        move is_message-line to l_txt. "500369789+
       move IS_MESSAGE-LINE to IS_CONTENT-LINE. "500369789-
        move l_txt to IS_CONTENT-LINE. "500369789+
        append IS_CONTENT to IT_CONTENT.
      endloop.
    *---select_email_address
      select single
             EMAILADDR
             CCEMAILADDR
        into (IS_RECEIVERS-RECEIVER, IS_RECEIVERS_COPY-RECEIVER)
        from ZGL_EMAILCTRL
       where IDENT = ''
         and ZPROGRAM = 'Z_L_SO_CREA'
         and ACTIVE = 'X'.
      if IS_RECEIVERS-RECEIVER is not initial.
        IS_RECEIVERS-REC_TYPE = 'U'.
        IS_RECEIVERS_COPY-REC_TYPE = 'U'.
        IS_RECEIVERS_COPY-COPY = 'X'.
        append IS_RECEIVERS to IT_RECEIVERS.
        append IS_RECEIVERS_COPY to IT_RECEIVERS.
    *500369789+
       lt_objhead-line = 'USA Order Report'.
       append lt_objhead.
       DESCRIBE TABLE lt_objhead LINES l_tab_lines.
       CLEAR lt_objpack-transf_bin.
       lt_objpack-doc_size = STRLEN( lt_objhead ).
       lt_objpack-head_start = 1.
       lt_objpack-head_num = 1.
       lt_objpack-body_start = 1.
       lt_objpack-body_num = 1.
       lt_objpack-doc_type = 'RAW'.
       APPEND lt_objpack.
       l_att_type = 'RAW'.
      DESCRIBE TABLE it_content LINES l_tab_lines.
      READ TABLE it_content into is_content INDEX l_tab_lines.
      lt_objpack-doc_size = ( l_tab_lines - 1 ) * 255.
      lt_objpack-doc_size = lt_objpack-doc_size + STRLEN( is_content ).
      lt_objpack-transf_bin = 'X'.
      lt_objpack-head_start = 1.
      lt_objpack-head_num = 2.
      lt_objpack-body_start = 1.
      lt_objpack-body_num = l_tab_lines.
      lt_objpack-doc_type = l_att_type.
      lt_objpack-obj_name = 'ATTACHMENT'.
      concatenate 'Usa' SY-DATUM+6(2) SY-DATUM+4(2) into
      lt_objpack-obj_descr.                   "#EC *
      APPEND lt_objpack.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
         EXPORTING
          document_data              = IS_DOCDATA
          commit_work                = 'X'
        TABLES
          packing_list               = lt_objpack
        object_header              = lt_objhead
          contents_txt               = lt_objhead
          contents_bin               = it_content
          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.
    *500369789+
    *500369789-
    SEND EMAIL FOR PLANTS
       call function 'SO_NEW_DOCUMENT_SEND_API1'
         exporting
           DOCUMENT_TYPE              = 'RAW'
           DOCUMENT_DATA              = IS_DOCDATA
           COMMIT_WORK                = 'X'
         tables
           OBJECT_CONTENT             = IT_CONTENT
           RECEIVERS                  = IT_RECEIVERS
         exceptions
           TOO_MANY_RECEIVERS         = 1
           DOCUMENT_NOT_SENT          = 2
           OPERATION_NO_AUTHORIZATION = 4
           others                     = 99.
    *500369789-
        if SY-SUBRC <> 0.
        endif.
      endif.
    endform.                    "send_email

  • Function Module to send email

    Hi All,
    Is there a Function Module in R/3 that can send external emails?
    Thanks!
    Roman D.

    I usually use the following function module.  I believe that it eventually calls the function module mentioned in the previous post.  Here is a sample program.
    report zrich_0003 .
    data: maildata type sodocchgi1.
    data: mailtxt  type table of solisti1 with header line.
    data: mailrec  type table of somlrec90 with header line.
    start-of-selection.
      clear:    maildata, mailtxt,  mailrec.
      refresh:  mailtxt, mailrec.
      maildata-obj_name = 'TEST'.
      maildata-obj_descr = 'Test'.
      maildata-obj_langu = sy-langu.
      mailtxt-line = 'This is a test'.
      append mailtxt.
      mailrec-receiver = '[email protected]'.
      mailrec-rec_type  = 'U'.
      append mailrec.
      call function 'SO_NEW_DOCUMENT_SEND_API1'
           exporting
                document_data              = maildata
                document_type              = 'RAW'
                put_in_outbox              = 'X'
           tables
                object_header              = mailtxt
                object_content             = mailtxt
                receivers                  = mailrec
           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.
    Regards,
    Rich Heilman

  • Sending pdf via email: pdf is not returned from function module

    Hi all.
    I am having trouble sending a pdf form as an attachment to an email.
    After calling the funtion module that is creating the PDF, field pdf of the return parameter /1bcdwb/formoutput should be used to create the attachment.
    But the field PDF is empty after calling the function module - only the field xml is given back.
    What did I miss?
    Thank you for your help and best regards, Kathrin!

    Hi Kathrin,
    See below for the example:
    ls_outputparams-getpdf = 'X'.
    CALL FUNCTION 'FP_JOB_OPEN'
         CHANGING
           ie_outputparams = ls_outputparams
         EXCEPTIONS
           cancel          = 1
           usage_error     = 2
           system_error    = 3
           internal_error  = 4
           OTHERS          = 5.
    If you setup the job like this then the pdf parameter will be filled with the XSTRING data for the generated PDF.
    Regards,
    Ryan Crosby

  • Unable to read excel attachment received thru email using function module ?

    Hi...
    I am using the function module 'SO_DOCUMENT_SEND_API1' to send an email attachement in EXCEL format.
    The email is getting received along with the attachment, but when i try to open the excel file, i am getting an error stating "Unable to Read File"......
    What could be the reason behind this error.......
    Plz Help......

    Hi,
    Firstly, convert Excel Format with FM: SAP_CONVERT_TO_TXT_FORMAT ,
    " Format convert(Excel content)
      CALL FUNCTION 'SAP_CONVERT_TO_TXT_FORMAT'
        EXPORTING
          I_LINE_HEADER        =  'X'
        TABLES
          I_TAB_SAP_DATA      = GIT_DATA                     "Before convert
        CHANGING
          I_TAB_CONVERTED_DATA = GIT_EXCEL           "After convert
      LOOP AT GIT_EXCEL INTO LFC_STMP.
        LI_ITMP = STRLEN( LFC_STMP ).
        LFC_STMP+LI_ITMP = CL_ABAP_CHAR_UTILITIES=>CR_LF.
        MODIFY GIT_EXCEL FROM LFC_STMP.
      ENDLOOP.
    Then, send Email with .xls attachment via FM: SO_DOCUMENT_SEND_API1.
    Best Regards
    Lily

  • Email using a function module

    hi experts,
                 i have been using SO_DOCUMENT_SEND_API1  function module to send a mail, i have sucessfully used it to send a mail but the subject line of the mail is coming empty. i want to display some text in it, how can it possible

    Hello ,
    Goto to the SE37 and open the FM and 
    Goto -> Documentation...
    This is the way to check the properties of FM related to Subject in Email
    And also look at this program....
    FORM mail_body.
      DATA:  l_l1 TYPE i.
      CONSTANTS: lc_0 VALUE '0',
                 lc_1 VALUE '1',
                 lc_raw(3) TYPE c VALUE 'RAW'.
      REFRESH: i_objtxt[],
               i_objpack[].
      CLEAR: wa_objtxt.
      SORT i_fail BY type.
    * MAIL BODY
    * Customer Number
      CONCATENATE text-t18
                  w_kunnr
                  INTO wa_objtxt
                  SEPARATED BY space.
      APPEND wa_objtxt TO i_objtxt.
      CLEAR wa_objtxt.                        "blank line
      APPEND wa_objtxt TO i_objtxt.
    *  Complete Payment Doc Nos
         wa_objtxt = text-t16.
        APPEND wa_objtxt TO i_objtxt.
        CLEAR: wa_fail, wa_objtxt.
        APPEND wa_objtxt TO i_objtxt.
        MOVE: text-t23   TO wa_objtxt,
              text-t24   TO wa_objtxt+17(5),
              text-t25   TO wa_objtxt+22(6),
              text-t26   TO wa_objtxt+40(18).
        APPEND wa_objtxt TO i_objtxt.
        CLEAR wa_objtxt.
        LOOP AT i_fail INTO wa_fail WHERE type EQ c_comp.
          DIVIDE wa_fail-disper BY 100.
          MOVE: wa_fail-belnr   TO wa_objtxt,
                wa_fail-buzei   TO wa_objtxt+17(5),
                wa_fail-wrbtr   TO wa_objtxt+22(16),
                wa_fail-disper  TO wa_objtxt+40(18).
          APPEND wa_objtxt TO i_objtxt.
          CLEAR: wa_fail, wa_objtxt.
        ENDLOOP.
    * MAIL BODY-LENGTH
      DESCRIBE TABLE i_objtxt LINES l_l1.
      CLEAR wa_objpack-transf_bin.
      wa_objpack-head_start = lc_1.
      wa_objpack-head_num = lc_0.
      wa_objpack-body_start = lc_1.
      wa_objpack-body_num = l_l1.
      wa_objpack-doc_type = lc_raw.
      APPEND wa_objpack TO i_objpack.
    *SUBJECT
      CLEAR wa_doc_chng.
      wa_doc_chng-obj_name  = text-t15.
      wa_doc_chng-obj_descr = text-t15.
    ENDFORM.                    " mail_body
    *&      Form  send_mail
    *       text
    FORM send_mail.
      CONSTANTS: lc_c       TYPE so_escape VALUE 'C',
                 lc_mode(3) TYPE c         VALUE 'INT'.
      CLEAR: wa_reclist, i_reclist[].
    *Recipient list
      wa_reclist-receiver = text-t14.       "DL
      wa_reclist-rec_type = lc_c.
      APPEND wa_reclist TO i_reclist.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
            document_data                    = wa_doc_chng
            put_in_outbox                    = c_x
    *     IMPORTING
    *       SENT_TO_ALL                      =
    *       NEW_OBJECT_ID                    =
          TABLES
            packing_list                     = i_objpack
    *       OBJECT_HEADER                    =
    *       CONTENTS_BIN                     =
            contents_txt                     = i_objtxt
    *       CONTENTS_HEX                     =
    *       OBJECT_PARA                      =
    *       OBJECT_PARB                      =
            receivers                        = i_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.
    *    ENDIF.
      IF sy-subrc IS INITIAL.
    *Send mail immediately
        SUBMIT rsconn01 USING SELECTION-SET lc_mode AND RETURN.
        CALL FUNCTION 'SO_DEQUEUE_UPDATE_LOCKS'.
      ELSE.
        RAISE mail_not_sent.
      ENDIF.
    ENDFORM.                    " send_mail

  • Function module for sending email

    Hi all,
    Can I know list of function modules for sending emails.
    Other than "SO_DOCUMENT_SEND_API1"
    pls let me know

    Hi Praveen,
    Below is the sample code to send the external mail.
    &**********Reward Points if helpful**********&
    DATA: ld_mtitle LIKE sodocchgi1-obj_descr,
            ld_format TYPE  so_obj_tp ,
            ld_attdescription TYPE  so_obj_nam ,
            ld_attfilename TYPE  so_obj_des .
           ld_receiver LIKE  sy-subrc.
      DATA:   it_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
              it_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
              it_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
              w_cnt TYPE i,
              w_sent_all(1) TYPE c,                             "#EC NEEDED
              w_doc_data LIKE sodocchgi1.
      REFRESH it_receivers . CLEAR it_receivers .
      IF v_trip_send = 'X'.
        it_receivers-receiver = it_trip_dload-approver_email .
      ELSE .
        it_receivers-receiver = it_adv_dload-approver_email .
      ENDIF.
      it_receivers-rec_type = c_u .
      APPEND it_receivers. CLEAR it_receivers.
    it_receivers-receiver = " ------> pass your reciever email id.
      IF v_trip_send = 'X' .
        it_receivers-receiver = it_trip_dload-requester_email .
      ELSE .
        it_receivers-receiver = it_adv_dload-requester_email .
      ENDIF .
      it_receivers-rec_type = c_u .
      it_receivers-copy     = 'X' .
      APPEND it_receivers. CLEAR it_receivers.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = c_saprpt.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = c_saprpt.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = c_f.
      CLEAR it_attachment.
      REFRESH it_attachment.
      it_attachment[] = it_attach[].
    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 = c_raw.
      APPEND it_packing_list.
    Create attachment notification
      it_packing_list-transf_bin = c_x.
      it_packing_list-head_start = 1.
      it_packing_list-head_num   = 1.
      it_packing_list-body_start = 1.
      DESCRIBE TABLE it_attachment LINES it_packing_list-body_num.
      it_packing_list-doc_type   =  ld_format.
      it_packing_list-obj_descr  =  ld_attdescription.
      it_packing_list-obj_name   =  ld_attfilename.
      it_packing_list-doc_size   =  it_packing_list-body_num * 255.
      APPEND it_packing_list.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          document_data = w_doc_data
          put_in_outbox = c_x
          commit_work   = c_x
        IMPORTING
          sent_to_all   = w_sent_all
        TABLES
          packing_list  = it_packing_list
          contents_bin  = it_attachment
          contents_txt  = it_message
          receivers     = it_receivers.

  • Sending email and alert notifcation using function module

    Hi All,
    I am trying to send email and alert notification messages using function modules in CRM. I am unable to send mail using 'SO_DOCUMENT_SEND_API1'. Getting a short dump message "dictionary mismatch". If anyone knows any FM which can be used for sending mails, please let me know. I also want to send alert messages using some FM. Please let me know any FM in this case as well.
    All help appreciated. This is urgent and please get back to me soon.
    Thanks
    Deno

    Hi Ranjit,
    Thanks a lot for the reply. I already tried these FMs and getting the error message
    Trigger Location of Runtime Error
        Program                                 SAPLBUPA_INTERFACE_TDTRANS
        Include                                 LBUPA_INTERFACE_TDTRANSTOP
        Row                                     4
    I dont know the reason behind the error. The SO_document_send FM is used inside all these FMs. So It wont work.
    Thanks
    Deno

  • Function module 'SO_NEW_DOCUMENT_ATT_SEND_API1' not sending detail in email

    Hello experts,
    I am using function module 'SO_NEW_DOCUMENT_ATT_SEND_API1' to send emails from a workflow method. The emails are being sent out and received but there is no detail in the email.
    The following are my parameters.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        DOCUMENT_DATA                    = gd_doc_d
        PUT_IN_OUTBOX                    = 'X'
        COMMIT_WORK                      = 'X'
    TABLES
       PACKING_LIST                     = it_packin
       OBJECT_HEADER                    =
       CONTENTS_BIN                     =
       CONTENTS_TXT                     = it_message
       CONTENTS_HEX                     =
       OBJECT_PARA                      =
       OBJECT_PARB                      =
       RECEIVERS                        = it_receiv
    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
    I am inserting the detail in internal table 'it_message' but this is not transmitted....can anybody point out what I need to do to get detail in the email.
    Thanks to all who might reply..

    Hi,
    Have you made sure that your code works without workflow? Just put it to a report and execute it with dummy values and see if it sends the email properly. If that works, then the problem might be in the workflow. I would first make sure that the bindings are correct - that your internal table containing the details is passed to the task. This you can see from the workflow log in the container.
    Regards,
    Karri

  • Function Module for send email

    hi experts,
    My aim to send message as email not any attachment
    what is the function module i need to use for sending mail from program?
    how to use the function module ? give some sample code and explain.
    please help me regarding this.
    thanks,
    nagarjuna.

    Hi
    i am sending a sample program.
    REPORT ZMAIL.
    TABLES: ekko.
    PARAMETERS: p_email TYPE somlreci1-receiver .
    TYPES: BEGIN OF t_ekpo,
    ebeln TYPE ekpo-ebeln,
    ebelp TYPE ekpo-ebelp,
    aedat TYPE ekpo-aedat,
    matnr TYPE ekpo-matnr,
    END OF t_ekpo.
    DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
    wa_ekpo TYPE t_ekpo.
    TYPES: BEGIN OF t_charekpo,
    ebeln(10) TYPE c,
    ebelp(5) TYPE c,
    aedat(8) TYPE c,
    matnr(18) TYPE c,
    END OF t_charekpo.
    DATA: wa_charekpo TYPE t_charekpo.
    DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
    WITH HEADER LINE.
    DATA: it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
    WITH HEADER LINE.
    DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
    t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
    t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    w_cnt TYPE i,
    w_sent_all(1) TYPE c,
    w_doc_data LIKE sodocchgi1,
    gd_error TYPE sy-subrc,
    gd_reciever TYPE sy-subrc.
    *START_OF_SELECTION
    START-OF-SELECTION.
    Retrieve sample data from table ekpo
    PERFORM data_retrieval.
    Populate table with detaisl to be entered into .xls file
    PERFORM build_xls_data_table.
    *END-OF-SELECTION
    END-OF-SELECTION.
    Populate message body text
    perform populate_email_message_body.
    Send file by email as .xls speadsheet
    PERFORM send_file_as_email_attachment
    tables it_message
    it_attach
    using p_email
    'Example .xls documnet attachment'
    'XLS'
    'filename'
    changing gd_error
    gd_reciever.
    Instructs mail send program for SAPCONNECT to send email(rsconn01)
    PERFORM initiate_mail_execute_program.
    *& Form DATA_RETRIEVAL
    Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
    SELECT ebeln ebelp aedat matnr
    UP TO 10 ROWS
    FROM ekpo
    INTO TABLE it_ekpo.
    ENDFORM. " DATA_RETRIEVAL
    *& Form BUILD_XLS_DATA_TABLE
    Build data table for .xls document
    FORM build_xls_data_table.
    data: ld_store(50) type c. "Leading zeros
    CONSTANTS: con_cret(5) TYPE c VALUE '0D', "OK for non Unicode
    con_tab(5) TYPE c VALUE '09'. "OK for non Unicode
    CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR' INTO it_attach SEPARATED
    BY con_tab.
    CONCATENATE con_cret it_attach INTO it_attach.
    APPEND it_attach.
    LOOP AT it_ekpo INTO wa_charekpo.
    concatenate '=REPLACE("' wa_charekpo-ebelp '",1,5,"'
    wa_charekpo-ebelp '")' into ld_store .
    CONCATENATE wa_charekpo-ebeln ld_store wa_charekpo-aedat
    wa_charekpo-matnr INTO it_attach SEPARATED BY con_tab.
    CONCATENATE con_cret it_attach INTO it_attach.
    APPEND it_attach.
    ENDLOOP.
    ENDFORM. " BUILD_XLS_DATA_TABLE
    *& Form SEND_FILE_AS_EMAIL_ATTACHMENT
    Send email
    FORM send_file_as_email_attachment tables pit_message
    pit_attach
    using p_email
    p_mtitle
    p_format
    p_filename
    p_attdescription
    p_sender_address
    p_sender_addres_type
    changing p_error
    p_reciever.
    DATA: ld_error TYPE sy-subrc,
    ld_reciever TYPE sy-subrc,
    ld_mtitle LIKE sodocchgi1-obj_descr,
    ld_email LIKE somlreci1-receiver,
    ld_format TYPE so_obj_tp ,
    ld_attdescription TYPE so_obj_nam ,
    ld_attfilename TYPE so_obj_des ,
    ld_sender_address LIKE soextreci1-receiver,
    ld_sender_address_type LIKE soextreci1-adr_typ,
    ld_receiver LIKE sy-subrc.
    ld_email = p_email.
    ld_mtitle = p_mtitle.
    ld_format = p_format.
    ld_attdescription = p_attdescription.
    ld_attfilename = p_filename.
    ld_sender_address = p_sender_address.
    ld_sender_address_type = p_sender_addres_type.
    Fill the document data.
    w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
    w_doc_data-obj_langu = sy-langu.
    w_doc_data-obj_name = 'SAPRPT'.
    w_doc_data-obj_descr = ld_mtitle .
    w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
    CLEAR w_doc_data.
    READ TABLE it_attach INDEX w_cnt.
    w_doc_data-doc_size =
    ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
    w_doc_data-obj_langu = sy-langu.
    w_doc_data-obj_name = 'SAPRPT'.
    w_doc_data-obj_descr = ld_mtitle.
    w_doc_data-sensitivty = 'F'.
    CLEAR t_attachment.
    REFRESH t_attachment.
    t_attachment[] = pit_attach[].
    Describe the body of the message
    CLEAR t_packing_list.
    REFRESH t_packing_list.
    t_packing_list-transf_bin = space.
    t_packing_list-head_start = 1.
    t_packing_list-head_num = 0.
    t_packing_list-body_start = 1.
    DESCRIBE TABLE it_message LINES t_packing_list-body_num.
    t_packing_list-doc_type = 'RAW'.
    APPEND t_packing_list.
    Create attachment notification
    t_packing_list-transf_bin = 'X'.
    t_packing_list-head_start = 1.
    t_packing_list-head_num = 1.
    t_packing_list-body_start = 1.
    DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
    t_packing_list-doc_type = ld_format.
    t_packing_list-obj_descr = ld_attdescription.
    t_packing_list-obj_name = ld_attfilename.
    t_packing_list-doc_size = t_packing_list-body_num * 255.
    APPEND t_packing_list.
    Add the recipients email address
    CLEAR t_receivers.
    REFRESH t_receivers.
    t_receivers-receiver = ld_email.
    t_receivers-rec_type = 'U'.
    t_receivers-com_type = 'INT'.
    t_receivers-notif_del = 'X'.
    t_receivers-notif_ndel = 'X'.
    APPEND t_receivers.
    *CALL FUNCTION 'SO_DOCUMENT_SEND_API1
    EXPORTING
    document_data = w_doc_data
    put_in_outbox = 'X'
    sender_address = ld_sender_address
    sender_address_type = ld_sender_address_type
    commit_work = 'X'
    IMPORTING
    sent_to_all = w_sent_all
    TABLES
    packing_list = t_packing_list
    contents_bin = t_attachment
    contents_txt = it_message
    receivers = t_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.
    Populate zerror return code
    ld_error = sy-subrc.
    Populate zreceiver return code
    LOOP AT t_receivers.
    ld_receiver = t_receivers-retrn_code.
    ENDLOOP.
    ENDFORM.
    *& Form INITIATE_MAIL_EXECUTE_PROGRAM
    Instructs mail send program for SAPCONNECT to send email.
    FORM initiate_mail_execute_program.
    WAIT UP TO 2 SECONDS.
    SUBMIT rsconn01 WITH mode = 'INT'
    WITH output = 'X'
    AND RETURN.
    ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
    *& Form POPULATE_EMAIL_MESSAGE_BODY
    Populate message body text
    form populate_email_message_body.
    REFRESH it_message.
    it_message = 'Please find attached a list test ekpo records'.
    APPEND it_message.
    endform. " POPULATE_EMAIL_MESSAGE_BODY

  • Design a function module to send email

    hii gurus ,    
                 i have to design a function module which takes three input  email id (reciever),   body (text of message) , and header  ie subject and  when executed should send email to the reciever.  pls  help
    Aditya Shrivastava.

    Hi Aditya,
    If you could not get your problem solved with predefined FMs, Try making this FM.. it will help you..as this FM is made in our server locally..
    name  :   z938_mailsend
    import parameters
    param name      type     associated type           shrt text
    I_TID           LIKE      THEAD-TDID                        Text ID of text to be read
    I_LAN           LIKE     THEAD-TDSPRAS                        Language of text to be read
    I_L_NAME     LIKE     THEAD-TDNAME                        Name of text to be read
    I_OID          LIKE     THEAD-TDOBJECT                        Object of text to be read
    W_RETURN     TYPE     SSFCRESCL                        Smart Forms: Return value at end of form printing
    I_POTITLE     TYPE     EBELN                               purchase order number
    W_DOC_CHNG     TYPE     SODOCCHGI1                       data of an object which can be changed
    I_ADDRNUM     LIKE     ADR6-ADDRNUMBER               Address number of Vendor
    source code :
    FUNCTION z938_mailsend.
    ""Local Interface:
    *"  IMPORTING
    *"     REFERENCE(I_TID) LIKE  THEAD-TDID
    *"     REFERENCE(I_LAN) LIKE  THEAD-TDSPRAS
    *"     REFERENCE(I_L_NAME) LIKE  THEAD-TDNAME
    *"     REFERENCE(I_OID) LIKE  THEAD-TDOBJECT
    *"     REFERENCE(W_RETURN) TYPE  SSFCRESCL
    *"     REFERENCE(I_POTITLE) TYPE  EBELN
    *"     REFERENCE(W_DOC_CHNG) TYPE  SODOCCHGI1
    *"     REFERENCE(I_ADDRNUM) LIKE  ADR6-ADDRNUMBER
    *data declaration
    *Internal Table declaration
      DATA : it_otf     TYPE STANDARD TABLE OF  itcoo ,
             it_tline   TYPE STANDARD TABLE OF  tline ,
             it_record  TYPE STANDARD TABLE OF  solisti1,
             it_objpack TYPE STANDARD TABLE OF  sopcklsti1,
             it_objtxt  TYPE STANDARD TABLE OF  solisti1 ,
             it_objbin  TYPE STANDARD TABLE OF  solisti1 ,
             it_reclist TYPE STANDARD TABLE OF  somlreci1 ,
             it_tdline  TYPE STANDARD TABLE OF  tline,
    *Work Area declarations
             wa_objhead     TYPE  soli_tab,
             wa_buffer      TYPE  string,       "To convert from 132 to 255
             wa_it_objtxt   TYPE  solisti1,
             wa_it_objpack  TYPE  sopcklsti1,
             wa_it_record   TYPE  solisti1,
             wa_it_reclist  TYPE  somlreci1,
             wa_it_tline    TYPE  tline,
             wa_tdline      TYPE  tline,
    *variable declaration
             v_lines_bin    TYPE  i,
             v_lines_txt    TYPE  i,
             v_len_in       TYPE  sood-objlen,         "#EC NEEDED
             v_mailaddr     TYPE  adr6-smtp_addr.
    *constant declaration
      CONSTANTS : c_msgtype TYPE c VALUE 'E',    " for declaring masseage type as error msg
                  c_X TYPE c VALUE 'X',
                  c_U TYPE c VALUE 'U'.
      it_otf[] = w_return-otfdata[].
    *calling function module to convert otf format of smartform to pdf format
      CALL FUNCTION 'CONVERT_OTF'
       EXPORTING
         format                      = text-001     "PDF
         max_linewidth               = 132
        ARCHIVE_INDEX              =
        COPYNUMBER                 =
        ASCII_BIDI_VIS2LOG         =
        PDF_DELETE_OTFTAB          =
       IMPORTING
         bin_filesize                = v_len_in
        BIN_FILE                   =
        TABLES
          otf                        = it_otf
          lines                      = it_tline
       EXCEPTIONS
         err_max_linewidth           = 1
         err_format                  = 2
         err_conv_not_possible       = 3
         err_bad_otf                 = 4
         OTHERS                      = 5  .
      IF sy-subrc NE 0.
        sy-msgid = text-002.     "some msg
        sy-msgty = c_msgtype.    " E
        sy-msgno = 040.
        sy-msgv1 = ' '.
        sy-msgv2 = ' '.
        sy-msgv3 = ' '.
        sy-msgv4 = ' '.
        EXIT.
      ELSE.
    Convert PDF from 132 to 255.
        LOOP AT it_tline INTO wa_it_tline.
          TRANSLATE wa_it_tline USING ' ~'.      " Replacing space by ~
          CONCATENATE wa_buffer wa_it_tline INTO wa_buffer.
        ENDLOOP.
        TRANSLATE wa_buffer USING '~ '.         " Replacing space by ~
        DO.
          wa_it_record = wa_buffer.
          APPEND wa_it_record TO it_record.     " Appending 255 characters as a record
          SHIFT wa_buffer LEFT BY 255 PLACES.
          IF wa_buffer IS INITIAL.
            EXIT.
          ENDIF.
        ENDDO.
        REFRESH:it_objbin.
        CLEAR wa_objhead.
    Object with PDF.
        it_objbin[] = it_record[].
        DESCRIBE TABLE it_objbin LINES v_lines_bin.
    *calling a function module read_text to get the text for the mail body
        CALL FUNCTION 'READ_TEXT'
         EXPORTING
            id                            = i_tid
            language                      = i_lan
            name                          = i_l_name
            object                        = i_oid
        IMPORTING
        HEADER                          =
         TABLES
            lines                         = it_tdline
         EXCEPTIONS
           id                             = 1
           language                       = 2
           name                           = 3
           not_found                      = 4
           object                         = 5
           reference_check                = 6
           wrong_access_to_archive        = 7
         OTHERS                           = 8
        IF sy-subrc <> 0.    "#EC
        ENDIF.
        IF it_tdline IS NOT INITIAL.
          LOOP AT it_tdline INTO wa_tdline.
            wa_it_objtxt = wa_tdline-tdline.
            APPEND wa_it_objtxt TO it_objtxt.
            CLEAR: wa_tdline,
                   wa_it_objtxt.
          ENDLOOP.
          DESCRIBE TABLE it_objtxt LINES v_lines_txt.
        ENDIF.
    Pack to main body as RAW.
        CLEAR wa_it_objpack-transf_bin.        "Obj. to be transported not in binary form
        wa_it_objpack-head_start = 1.          "Start line of object header in transport packet
        wa_it_objpack-head_num = 0.            "Number of lines of an object header in object packet
        wa_it_objpack-body_start = 1.          "Start line of object contents in an object packet
        wa_it_objpack-body_num = v_lines_txt.  "Number of lines of the object contents in an object packet
    Code for document class
        wa_it_objpack-doc_type = text-004.        "RAW
        APPEND wa_it_objpack TO it_objpack.
    Packing as PDF.
        wa_it_objpack-transf_bin = c_X.           " X
        wa_it_objpack-head_start = 1.
        wa_it_objpack-head_num = 1.
        wa_it_objpack-body_start = 1.
        wa_it_objpack-body_num = v_lines_bin.
        wa_it_objpack-doc_type = text-001.        "PDF
        wa_it_objpack-obj_name = text-006.        "SmartForm
        CONCATENATE i_potitle '.pdf' INTO wa_it_objpack-obj_descr.
        wa_it_objpack-doc_size = v_lines_bin * 255.
        APPEND wa_it_objpack TO it_objpack.
    Document information.
        CLEAR wa_it_reclist.
    e-mail receivers.
        SELECT SINGLE smtp_addr FROM adr6 INTO v_mailaddr    "#EC *
         WHERE addrnumber = i_addrnum.
        wa_it_reclist-receiver = v_mailaddr.
        wa_it_reclist-express = c_X.                        " X
        wa_it_reclist-rec_type = c_U.                       "U -> Internet address
        APPEND wa_it_reclist TO it_reclist.
    Sending Mail
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
         EXPORTING
          document_data                  = w_doc_chng
          put_in_outbox                  = c_X            "X
        COMMIT_WORK                    =
       IMPORTING
        SENT_TO_ALL                    =
        NEW_OBJECT_ID                  =
         TABLES
          packing_list                   = it_objpack
          object_header                  = wa_objhead
          contents_bin                   = it_objbin
          contents_txt                   = it_objtxt
        CONTENTS_HEX                   =
        OBJECT_PARA                    =
        OBJECT_PARB                    =
            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.
          sy-msgid = text-008.      "some msg
          sy-msgty = c_msgtype.     " E
          sy-msgno = 041.
          sy-msgv1 = ' '.
          sy-msgv2 = ' '.
          sy-msgv3 = ' '.
          sy-msgv4 = ' '.
          EXIT.
        ENDIF.
      ENDIF.
    ENDFUNCTION.
    Regards,,
    Nikita

Maybe you are looking for

  • Error in SSO between Portal and IDM

    Hi All, In my scenario i need to configure the IDM workflow in portal and do SSO between them. I followed the steps given in IDM-Workflow installation document and did following things. 1. Uploaded the par file available in IDM installation kit in to

  • Adobe Premiere Elements 10 And Flip MinoHD Generation III Compatibility

    I am considering buying Adobe Premiere Elements 10 to edit my videos and I want to know if it is compatible with the video from the Flip Mino HD Generation III camera?

  • Error message on ASR 1000 logs.

    Hi Everyone, Good day.  I am seeing the below errors from the ASR 1000 that I have and It is not very clear on what the error actually means.  If someone have had experience with this kind of similar error message, kindly assist:  Apr 11 12:02:08.744

  • If I buy "pages" for my daughters iPad can I use it on mine?

    If I buy "pages" for my daughter's iPad, can I download it to my iPad?

  • Output Type Determination

    Hi experts, I have a requirement wherein if an EDI invoice output type is selected during the creation of the billing document, then all the remaining output types below that should not be selected. Please find below the screen shot of the output pro