SO_OBJECT_SEND Function Module

Hello All,
I am using this function module to send mails to the users. When i run the program that uses the function module its working fine and when i run the program in bacground its giving me a short dump saying
The termination occurred in the ABAP/4 program "SAPLZMAIL " in
"SEND_MAIL".
The main program was "ZMDI0090 ".
The termination occurred in line 53
of the source code of program "LZMAILS01 " (when calling the editor 530).
The program "SAPLZMAIL " was started as a background job.
This function module is used internally by another function module in my program..
Please suggest or clarify me wat is that i have to do to avoid this error..
Thank You,
Suresh

CALL FUNCTION 'Z_TABLE_ERR_RTN'
       EXPORTING
            Z_PGM        = z_jobname   "Jobname for Tivoli
            Z_FLG1       = p_o_tpm     "TPM for Table Owner
            Z_FLG2       = p_o_eml     "Email for Table Owner
            Z_FLG3       = p_i_eml     "Email Interface Owner
            Z_SVRITY     = p_o_svr     "TPM Severity
       IMPORTING
            Z_RETCODE    = z_g_subrc
            Z_ERRMSG     = z_g_submsg
       TABLES
            a00_CONTENTS = a01_err_itab"Error Table
            a00_EMAILS   = s_email.    "Email recipients
The function module internally calls SO_OBJECT_SEND.

Similar Messages

  • How to use SO_OBJECT_SEND function module

    Hi friends,
       how to use SO_OBJECT_SEND function module in 4.0B Server .

    hi
    good
    check this code
    REPORT ZTSAPMAIL.
    DATA: X_OBJECT_TYPE LIKE SOOD-OBJTP.
    DATA: BEGIN OF X_OBJECT_HD_CHANGE.
    INCLUDE STRUCTURE SOOD1.
    DATA: END OF X_OBJECT_HD_CHANGE.
    DATA: BEGIN OF X_OBJCONT OCCURS 10.
    INCLUDE STRUCTURE SOLI.
    DATA: END OF X_OBJCONT.
    DATA: BEGIN OF X_OBJHEAD OCCURS 0.
    INCLUDE STRUCTURE SOLI.
    DATA: END OF X_OBJHEAD.
    DATA: BEGIN OF RAW_HEAD.
    INCLUDE STRUCTURE SORH.
    DATA: END OF RAW_HEAD.
    DATA: BEGIN OF X_RECEIVERS OCCURS 0.
    INCLUDE STRUCTURE SOOS1.
    DATA: END OF X_RECEIVERS.
    PARAMETERS: RECEIVER LIKE X_RECEIVERS-RECNAM. " Name
    *BUILD MESSAGE HEADER
    MOVE 'Sort field goes here' TO X_OBJECT_HD_CHANGE-OBJSRT. " Sort field
    MOVE 'Name of the object goes here' TO X_OBJECT_HD_CHANGE-OBJNAM. " Name
    MOVE 'Document title goes here' TO X_OBJECT_HD_CHANGE-OBJDES. " Title
    MOVE 'F' TO X_OBJECT_HD_CHANGE-OBJSNS. " Functional OBJECT
    MOVE 'E' TO X_OBJECT_HD_CHANGE-OBJLA. " Language
    Object type of the new document
    MOVE 'RAW' TO X_OBJECT_TYPE.
    CLEAR X_OBJCONT.
    MOVE 'Contents of mail' TO X_OBJCONT-LINE.
    APPEND X_OBJCONT.
    CLEAR X_OBJCONT-LINE. APPEND X_OBJCONT.
    MOVE 'More contents' TO X_OBJCONT-LINE.
    APPEND X_OBJCONT.
    MOVE 'Still more contents'
    to x_objcont-line.
    APPEND X_OBJCONT.
    MOVE ' ' TO X_OBJCONT-LINE.
    APPEND X_OBJCONT.
    Specific header (Dependent on the object type, here RAW)
    REFRESH X_OBJHEAD.
    DESCRIBE TABLE X_OBJCONT LINES RAW_HEAD-RAWSIZ.
    MOVE RAW_HEAD TO X_OBJHEAD.
    APPEND X_OBJHEAD.
    *RECEIVERS table
    CLEAR X_RECEIVERS.
    REFRESH X_RECEIVERS.
    MOVE RECEIVER TO X_RECEIVERS-RECNAM. " Name
    MOVE 'B' TO X_RECEIVERS-RECESC. " Receiver type
    MOVE 'X' TO X_RECEIVERS-SNDCP. " Send as a copy
    MOVE 'X' TO X_RECEIVERS-SNDEX. " EXPRESS DOCUMENT
    APPEND X_RECEIVERS.
    CALL FUNCTION 'SO_OBJECT_SEND'
    EXPORTING
    folder_id = 'OUTBOX'
    forwarder = x_forwarder
    object_fl_change = x_object_fl_change
    OBJECT_HD_CHANGE = X_OBJECT_HD_CHANGE
    object_id = x_object_id
    OBJECT_TYPE = X_OBJECT_TYPE
    OUTBOX_FLAG = 'X'
    OWNER = SY-UNAME
    store_flag = x_store_flag
    importing
    object_id_new = x_object_id_new
    sent_to_all = x_sent_to_all "May need to use
    TABLES
    OBJCONT = X_OBJCONT
    OBJHEAD = X_OBJHEAD
    objpara = x_objpara
    objparb = x_objparb
    RECEIVERS = X_RECEIVERS.
    reward point if hlepful.
    thanks
    mrutyun^

  • Runtime Error in execution of 'SO_OBJECT_SEND' function module

    Hi friends,
    We are going for upgradation from 4.6c to ECC6.0. There is one program which is used to send external mails thru 'SO_OBJECT_SEND', but the function module is giving runtime error(line no:515) in ECC6.
    what could be the reason?
    rewarded,
    Steve

    Hi,
    Plz check if any latest release notes of SAP for the function module 'SO_OBJECT_SEND' are available. If so you may apply those.
    If you have valid SAP service username and password you can get the notes from service.sap.com. Else your BASIS people can help you.
    Which is the highest patch level you have applied?
    Regards,
    Renjith Michael.

  • Mail sending using sender importing parameter using so_object_send function

    Hi all,
            I using so_object_send function module to send mail. My requirement is with respect to any user 
            logged in the sender mail address should be taken by V_SENDER parameter in exporting
            parameter.
    <code>
    CALL FUNCTION 'SO_OBJECT_SEND'
           EXPORTING
                folder_id                  = wa_folder_id
                forwarder                  = w_forwarder
                object_fl_change           = wa_object_fl_change
                object_hd_change           = wa_object_hd_change
                object_id                  = wa_object_id
                object_type                = w_object_type
                outbox_flag                = w_outbox_flag
                owner                      = w_owner
                store_flag                 = w_store_flag
           IMPORTING
                object_id_new              = wa_object_id_new
                sent_to_all                = w_sent_to_all
                sender                     =  v_sender
           TABLES
                objcont                    = i_objcont
                objhead                    = i_objhead
                objpara                    = i_objpara
                objparb                    = i_objparb
                receivers                  = i_receivers
           EXCEPTIONS
                active_user_not_exist      = 1
                communication_failure      = 2
                component_not_available    = 3
                folder_not_exist           = 4
                folder_no_authorization    = 5
                forwarder_not_exist        = 6
                note_not_exist             = 7
                object_not_exist           = 8
                object_not_sent            = 9
                object_no_authorization    = 10
                object_type_not_exist      = 11
                operation_no_authorization = 12
                owner_not_exist            = 13
                parameter_error            = 14
                substitute_not_active      = 15
                substitute_not_defined     = 16
                system_failure             = 17
                too_much_receivers         = 18
                user_not_exist             = 19
                originator_not_exist       = 20
                x_error                    = 21
                OTHERS                     = 22.
      IF sy-subrc  0.
      ENDIF.
    </code>    
    My Requirement is V_SENDER can be any user of that SAP system,noot particularly logged in user.
    I tried using this functionality my sy-subrc is zero. but i am not able to get any mails with that user name in V_SENDER.
    Do i need to do any further settings or any more code is required.
    Even i tired giving SUBMIT rsconn01 .
    still its not working.
    Please suggest any solutions if we have.
    Thanks,
    satish

    Hi,
    to send mails check this:
    FORM docu_send_email USING pv_otfdata TYPE tsfotf
    pv_emailid TYPE any
    pv_formname TYPE any.
    DATA: lv_filesize TYPE i,
    lv_buffer TYPE string,
    lv_attachment TYPE i,
    lv_testo TYPE i.
    DATA: li_pdfdata TYPE STANDARD TABLE OF tline,
    li_mess_att TYPE STANDARD TABLE OF solisti1,
    li_mtab_pdf TYPE STANDARD TABLE OF tline,
    li_objpack TYPE STANDARD TABLE OF sopcklsti1,
    li_objtxt TYPE STANDARD TABLE OF solisti1,
    li_objbin TYPE STANDARD TABLE OF solisti1,
    li_reclist TYPE STANDARD TABLE OF somlreci1,
    li_objhead TYPE soli_tab.
    DATA: lwa_pdfdata TYPE tline,
    lwa_objpack TYPE sopcklsti1,
    lwa_mess_att TYPE solisti1,
    lwa_objtxt TYPE solisti1,
    lwa_objbin TYPE solisti1,
    lwa_reclist TYPE somlreci1,
    lwa_doc_chng TYPE sodocchgi1.
    CONSTANTS: lc_u TYPE char1 VALUE 'U',
    lc_0 TYPE char1 VALUE '0',
    lc_1 TYPE char1 VALUE '1',
    lc_pdf TYPE char3 VALUE 'PDF',
    lc_raw TYPE char3 VALUE 'RAW',
    lc_ordform TYPE char15 VALUE 'ZORDCONFIRM_01',
    lc_attachment TYPE char10 VALUE 'ATTACHMENT'.
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
    format = lc_pdf
    max_linewidth = 132
    IMPORTING
    bin_filesize = lv_filesize
    TABLES
    otf = pv_otfdata
    lines = li_pdfdata
    EXCEPTIONS
    err_max_linewidth = 1
    err_format = 2
    err_conv_not_possible = 3
    err_bad_otf = 4
    OTHERS = 5.
    IF sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LOOP AT li_pdfdata INTO lwa_pdfdata.
    TRANSLATE lwa_pdfdata USING ' ~'.
    CONCATENATE lv_buffer lwa_pdfdata INTO lv_buffer.
    CLEAR lwa_pdfdata.
    ENDLOOP.
    TRANSLATE lv_buffer USING '~ '.
    DO.
    lwa_mess_att = lv_buffer.
    APPEND lwa_mess_att TO li_mess_att.
    CLEAR lwa_mess_att.
    SHIFT lv_buffer LEFT BY 255 PLACES.
    IF lv_buffer IS INITIAL.
    EXIT.
    ENDIF.
    ENDDO.
    Object with PDF.
    REFRESH li_objbin.
    li_objbin] = li_mess_att[.
    DESCRIBE TABLE li_objbin LINES lv_attachment.
    Object with main text of the mail.
    lwa_objtxt = space.
    APPEND lwa_objtxt TO li_objtxt.
    CLEAR lwa_objtxt.
    DESCRIBE TABLE li_objtxt LINES lv_testo.
    Create the document which is to be sent
    lwa_doc_chng-obj_name = text-008.
    lwa_doc_chng-obj_descr = text-008.
    lwa_doc_chng-sensitivty = lc_0.
    lwa_doc_chng-obj_prio = lc_1.
    lwa_doc_chng-doc_size = lv_testo * 225.
    Pack to main body.
    CLEAR lwa_objpack-transf_bin.
    header
    lwa_objpack-head_start = 1.
    The document needs no header (head_num = 0)
    lwa_objpack-head_num = 0.
    body
    lwa_objpack-body_start = 1.
    lwa_objpack-body_num = lv_testo.
    lwa_objpack-doc_type = lc_raw.
    APPEND lwa_objpack TO li_objpack.
    CLEAR lwa_objpack.
    Create the attachment.
    Fill the fields of the packing_list for the attachment:
    lwa_objpack-transf_bin = gc_x .
    header
    lwa_objpack-head_start = 1.
    lwa_objpack-head_num = 1.
    body
    lwa_objpack-body_start = 1.
    lwa_objpack-body_num = lv_attachment.
    lwa_objpack-doc_type = lc_pdf.
    lwa_objpack-obj_name = lc_attachment.
    lwa_objpack-obj_descr = text-008.
    lwa_objpack-doc_size = lv_attachment * 255.
    APPEND lwa_objpack TO li_objpack.
    CLEAR lwa_objpack.
    lwa_reclist-receiver = pv_emailid.
    lwa_reclist-rec_type = lc_u.
    lwa_reclist-notif_del = gc_x.
    lwa_reclist-notif_ndel = gc_x.
    APPEND lwa_reclist TO li_reclist.
    IF li_reclist IS NOT INITIAL.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = lwa_doc_chng
    put_in_outbox = gc_x
    TABLES
    packing_list = li_objpack
    object_header = li_objhead
    contents_bin = li_objbin
    contents_txt = li_objtxt
    receivers = li_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 'I' NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDIF.
    ENDFORM. " DOCU_SEND_EMAIL

  • Exits in the function module - SO_OBJECT_SEND

    Hi,
    As per my requirement, I need to add a common line to the body of the E-mail that is sent via the function module SO_OBJECT_SEND.
    So please let me know if any Exit/BADI exists that I can use to modify the body of the E-mail.
    Thanks & Regargs,
    Madhuri.

    USER EXIT
    http://www.sap-img.com/abap/a-short-tutorial-on-user-exits.htm
    http://www.sapgenie.com/abap/code/abap26.htm
    http://www.sap-img.com/abap/what-is-user-exits.htm
    http://wiki.ittoolbox.com/index.php/HOWTO:Implement_a_screen_exit_to_a_standard_SAP_transaction
    http://www.easymarketplace.de/userexit.php
    http://www.sap-img.com/abap/a-short-tutorial-on-user-exits.htm
    http://www.sappoint.com/abap/userexit.pdfUser-Exit
    http://www.sap-img.com/ab038.htm
    http://help.sap.com/saphelp_46c/helpdata/en/64/72369adc56d11195100060b03c6b76/frameset.htm
    http://www.sap-img.com/abap/a-short-tutorial-on-user-exits.htm
    http://www.sap-img.com/abap/what-is-user-exits.htm
    http://expertanswercenter.techtarget.com/eac/knowledgebaseAnswer/0,295199,sid63_gci982756,00.html
    BADI
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/40921dd7-d5cf-2910-1894-bb62316afbd1
    http://help.sap.com/saphelp_erp2005/helpdata/en/73/7e7941601b1d09e10000000a155106/frameset.htm
    http://support.sas.com/rnd/papers/sugi30/SAP.ppt
    http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/abapindx.htm
    http://members.aol.com/_ht_a/skarkada/sap/
    http://www.ct-software.com/reportpool_frame.htm
    http://www.saphelp.com/SAP_Technical.htm
    http://www.kabai.com/abaps/q.htm
    http://www.guidancetech.com/people/holland/sap/abap/
    http://www.planetsap.com/download_abap_programs.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c8/1975cc43b111d1896f0000e8322d00/content.htm
    /people/thomas.weiss/blog/2006/04/03/how-to-define-a-new-badi-within-the-enhancement-framework--part-3-of-the-series
    /people/thomas.weiss/blog/2006/04/18/how-to-implement-a-badi-and-how-to-use-a-filter--part-4-of-the-series-on-the-new-enhancement-framework
    http://esnips.com/doc/e06e4171-29df-462f-b857-54fac19a9d8e/ppt-on-badis.ppt
    http://esnips.com/doc/43a58f51-5d92-4213-913a-de05e9faac0d/Business-Addin.doc
    http://esnips.com/doc/10016c34-55a7-4b13-8f5f-bf720422d265/BADIs.pdf
    http://esnips.com/doc/1e10392e-64d8-4181-b2a5-5f04d8f87839/badi.doc
    http://esnips.com/doc/365d4c4d-9fcb-4189-85fd-866b7bf25257/customer-exits--badi.zip
    http://esnips.com/doc/3b7bbc09-c095-45a0-9e89-91f2f86ee8e9/BADI-Introduction.ppt
    http://help.sap.com//saphelp_470/helpdata/EN/eb/3e7cee940e11d295df0000e82de14a/frameset.htm
    Rewards if useful.........
    Minal

  • Input data for Function module SO_OBJECT_SEND for testing

    Hi,
    can anyone help me in providing the test data for the function module SO_OBJECT_SEND so that i can test it out.
    regards.

    Hi,
    Plese check the below link
    [http://www.thespot4sap.com/articles/SAP_Mail_SO_Object_Send.asp]
    Cheers,
    Surinder

  • Function Module SO_OBJECT_SEND

    Hi Gurus,
    Can we send the attachments using Function Module 'SO_OBJECT_SEND'. ?
    If so please do let me know the code for filling the attachment and using this FM.
    Promise to reward points.
    Thanks & Regards
    Mac

    Hai ,
    SAP supplies a function module 'SO_OBJECT_SEND' to allow you send SAPOffice mails from within your ABAP programs.
    Just try this.
    Author: Kevin Wilson
    FUNCTION z_send_email_itab_uname.
    ""Local interface:
    *"  IMPORTING
    *"     VALUE(APPLICATION) LIKE  SOOD1-OBJNAM
    *"     VALUE(EMAILTITLE) LIKE  SOOD1-OBJDES
    *"     VALUE(RECEXTNAM) LIKE  SOOS1-RECEXTNAM OPTIONAL
    *"     VALUE(SENDER) LIKE  SOUD-USRNAM DEFAULT SY-UNAME
    *"     VALUE(UNAME) LIKE  SOOS1-RECEXTNAM OPTIONAL
    *"  EXPORTING
    *"     VALUE(RETURN_CODE) LIKE  SY-SUBRC
    *"  TABLES
    *"      TEXTTAB STRUCTURE  SOLI
    tables
      TABLES: pa0105,   "Employee detail for username and email address
              usr21,    "Login addition address data
              adr6.     "Address table for email addresses
    *- local data declaration
      DATA: ohd    LIKE sood1,
            oid    LIKE soodk,
            to_all LIKE sonv-flag,
            t_uname LIKE sy-uname,
            okey   LIKE swotobjid-objkey.
      DATA: BEGIN OF receivers OCCURS 0.
              INCLUDE STRUCTURE soos1.
      DATA: END OF receivers.
    *- fill odh
      CLEAR ohd.
      ohd-objla    = sy-langu.
      ohd-objnam   = application.
      ohd-objdes   = emailtitle.
      ohd-objpri   = 3.
      ohd-objsns   = 'F'.
      ohd-ownnam   = sy-uname.
      IF NOT uname IS INITIAL.
    Find personnel number of username
        CONDENSE uname NO-GAPS.
        WHILE uname CS ','.
          t_uname = uname+0(sy-fdpos).
          ADD 1 TO sy-fdpos.
          SHIFT uname LEFT BY sy-fdpos PLACES.
          PERFORM find_email_address USING t_uname
                                     CHANGING recextnam.
        ENDWHILE.
    *Do the last record
        IF uname <> space.
          t_uname = uname.
          PERFORM find_email_address USING t_uname
                                     CHANGING recextnam.
        ENDIF.
      ENDIF.
    *- send Email
      IF NOT recextnam IS INITIAL.
        CONDENSE recextnam NO-GAPS.
        CHECK recextnam CS '@'.
      ENDIF.
    *- for every individual recipient send an Email
    (see OSS message 0120050409/0000362105/1999)
      WHILE recextnam CS ','.
        PERFORM init_rec TABLES receivers.
        READ TABLE receivers INDEX 1.
        receivers-recextnam = recextnam+0(sy-fdpos).
        ADD 1 TO sy-fdpos.
        SHIFT recextnam LEFT BY sy-fdpos PLACES.
        MODIFY receivers INDEX 1.
        PERFORM so_object_send_rec
         TABLES texttab receivers
          USING ohd
                sender.
      ENDWHILE.
    *- check last recipient in recipient list
      IF recextnam <> space.
        PERFORM init_rec TABLES receivers.
        READ TABLE receivers INDEX 1.
        receivers-recextnam = recextnam.
        MODIFY receivers INDEX 1.
        PERFORM so_object_send_rec
         TABLES texttab receivers
          USING ohd
                sender.
      ENDIF.
    ENDFUNCTION.
          FORM SO_OBJECT_SEND_REC                                       *
    FORM  so_object_send_rec
    TABLES  objcont      STRUCTURE soli
            receivers    STRUCTURE soos1
    USING   object_hd    STRUCTURE sood1
            sender LIKE soud-usrnam.
      DATA:   oid     LIKE soodk,
              to_all  LIKE sonv-flag,
              okey    LIKE swotobjid-objkey.
      CALL FUNCTION 'SO_OBJECT_SEND'
           EXPORTING
                extern_address             = 'X'
                object_hd_change           = object_hd
                object_type                = 'RAW'
                outbox_flag                = 'X'
                sender                     = sender
           IMPORTING
                object_id_new              = oid
                sent_to_all                = to_all
                office_object_key          = okey
           TABLES
                objcont                    = objcont
                receivers                  = receivers
           EXCEPTIONS
                active_user_not_exist      = 1
                communication_failure      = 2
                component_not_available    = 3
                folder_not_exist           = 4
                folder_no_authorization    = 5
                forwarder_not_exist        = 6
                note_not_exist             = 7
                object_not_exist           = 8
                object_not_sent            = 9
                object_no_authorization    = 10
                object_type_not_exist      = 11
                operation_no_authorization = 12
                owner_not_exist            = 13
                parameter_error            = 14
                substitute_not_active      = 15
                substitute_not_defined     = 16
                system_failure             = 17
                too_much_receivers         = 18
                user_not_exist             = 19
                x_error                    = 20
                OTHERS                     = 21.
      IF sy-subrc <> 0.
        CASE sy-subrc.
          WHEN 1.
            MESSAGE i999(b1) WITH 'Activer user does not exist.'
                              'Send Mail failed!'.
          WHEN 2.
            MESSAGE i999(b1) WITH 'Communication Failure.'
                              'Send Mail failed!'.
          WHEN 3.
            MESSAGE i999(b1) WITH 'Component not available.'
                              'Send Mail failed!'.
          WHEN 4.
            MESSAGE i999(b1) WITH 'Folder does not exist..'
                              'Send Mail failed!'.
          WHEN 5.
            MESSAGE i999(b1) WITH 'No authorization for folder.'
                              'Send Mail failed!'.
          WHEN 6.
            MESSAGE i999(b1) WITH 'Forwarder does not exist.'
                              'Send Mail failed!'.
          WHEN 7.
            MESSAGE i999(b1) WITH 'Note does not exist.'
                              'Send Mail failed!'.
          WHEN 8.
            MESSAGE i999(b1) WITH 'Object does not exist.'
                              'Send Mail failed!'.
          WHEN 9.
            MESSAGE i999(b1) WITH 'Object not sent.'
                              'Send Mail failed!'.
          WHEN 10.
            MESSAGE i999(b1) WITH 'No authorization for object.'
                              'Send Mail failed!'.
          WHEN 11.
            MESSAGE i999(b1) WITH 'Object type does not exist.'
                              'Send Mail failed!'.
          WHEN 12.
            MESSAGE i999(b1) WITH 'No authorization for operation.'
                              'Send Mail failed!'.
          WHEN 13.
            MESSAGE i999(b1) WITH 'Owner does not exist.'
                              'Send Mail failed!'.
          WHEN 14.
            MESSAGE i999(b1) WITH 'Parameter Error.'
                              'Send Mail failed!'.
          WHEN 15.
            MESSAGE i999(b1) WITH 'Substitute not active.'
                              'Send Mail failed!'.
          WHEN 16.
            MESSAGE i999(b1) WITH 'Substitute not defined.'
                              'Send Mail failed!'.
          WHEN 17.
            MESSAGE i999(b1) WITH 'System failure.'
                              'Send Mail failed!'.
          WHEN 18.
            MESSAGE i999(b1) WITH 'Too many receivers.'
                              'Send Mail failed!'.
          WHEN 19.
            MESSAGE i999(b1) WITH 'User does not exist.'
                              'Send Mail failed!'.
          WHEN 20.
            MESSAGE i999(b1) WITH 'Unknown error ocurred.'
                              'Send Mail failed!'.
          WHEN 21.
            MESSAGE i999(b1) WITH 'Unknown error ocurred.'
                              'Send Mail failed!'.
        ENDCASE.
      ENDIF.
    ENDFORM.
          FORM INIT_REC                                                 *
    FORM init_rec TABLES receivers STRUCTURE soos1.
      CLEAR receivers.
      REFRESH receivers.
      MOVE sy-datum  TO receivers-rcdat .
      MOVE sy-uzeit  TO receivers-rctim.
      MOVE '1'       TO receivers-sndpri.
      MOVE 'X'       TO receivers-sndex.
      MOVE 'U-'      TO receivers-recnam.
      MOVE 'U'       TO receivers-recesc.
      MOVE 'INT'     TO receivers-sndart.
      MOVE '5'       TO receivers-sortclass.
      APPEND receivers.
    ENDFORM.
    *&      Form  find_email_address
          Returns the email address for a USERID whether they are an
          employee or just a user.
         <--P_RECEXTNAM  Email address
         -->P_UNAME      USERID
    FORM find_email_address USING    p_uname
                            CHANGING p_recextnam LIKE soos1-recextnam.
      DATA:   t_pernr LIKE pa0105-pernr,
              t_email LIKE pa0105-usrid_long.
    STEP 1 - Find personnel number for UNAME
      SELECT SINGLE pernr INTO t_pernr
        FROM pa0105
        WHERE subty = '0001' AND
              endda >= sy-datum AND
              begda <= sy-datum AND
              usrid = p_uname.
    Employee record found
      IF sy-subrc = 0.
    STEP 2 - Find email address for personnel number
        SELECT SINGLE usrid_long INTO t_email
          FROM pa0105
          WHERE pernr = t_pernr AND
                subty = '0022' AND
                endda >= sy-datum AND
                begda <= sy-datum.
        IF sy-subrc = 0.
          IF NOT p_recextnam IS INITIAL.
            CONCATENATE p_recextnam t_email
              INTO p_recextnam SEPARATED BY ','.
          ELSE.
            p_recextnam = t_email.
          ENDIF.
        ELSE.  "Never found an email address for employee
    WHO SHOULD WE SEND TO HERE??? ***
        ENDIF.
    Employee number not found. Search in ADR6 table
      ELSE.
    See if user name is in the username table.
    i.e. The user is not an employee
        SELECT SINGLE addrnumber persnumber
          INTO (usr21-addrnumber, usr21-persnumber)
          FROM usr21
          WHERE bname = p_uname.
        IF sy-subrc = 0.
    Found user name now let's get the email address
          SELECT SINGLE smtp_addr INTO t_email
            FROM adr6
            WHERE addrnumber = usr21-addrnumber AND
                  persnumber = usr21-persnumber.
          IF sy-subrc <> 0 OR t_email IS INITIAL.
    WHO SHOULD WE SEND TO HERE??? ***
          ELSE.  "Found email
            IF NOT p_recextnam IS INITIAL.
              CONCATENATE p_recextnam t_email
                INTO p_recextnam SEPARATED BY ','.
            ELSE.
              p_recextnam = t_email.
            ENDIF.
          ENDIF.
        ELSE.   "UNAME just does not have an email address addigned at all
    WHO SHOULD WE SEND TO HERE??? ***
        ENDIF.
      ENDIF.
    ENDFORM.                    " find_email_address
    Regards.
    Sowjanya.B.

  • Function Module "SO_OBJECT_SEND" not working in ECC6

    Hi experts,
    We have upgraded our SAP version from 4.6c to EEC6, in 4.6C one of our
    Z program has used function module u201CSO_OBJECT_SENDu201D for sending mails
    to external user.  But the same prog throws error in SOST "Message cannot be processed as it cannot be
    converted ".
    If I try with another  FM u201CSO_NEW_DOCUMENT_ATT_SEND_AP1u201D is not fulfill our requirement. ie. we can send the mail to external user but we cannot send output List as attachement.
    Our requirement is first we have to convert the list into a object and
    send that object to external user. We are using following FM for
    sending mails.
    SAVE_LIST - Save the list as Object.
    TABLE_COMPRESS u2013 Compress the object to compressed attachment.
    SO_OBJECT_SENT u2013 Finally send the attachment to external user.
    Pl. suggest me, how to sort it out.
    Thanks,
    Regards
    M.Veerabadran

    Hi
    Answer is pure assumption
    Pls check the OSS Note 170175 - SAPconnect: Message not convertable
    Pls take opinion from SAP / BASIS before implementing the note
    Regards
    Madhan D

  • Function Modules - Urgent

    Hi,
    I need to create a Function Module where this FM should send a document as attachment to the internet mail id , example [email protected]
    Please help me out.
    Thanks,
    Pavan.

    Hi,
    Will a prog. be fine for sending a mail to xternal mail id??
    Mail with attachments: SO_NEW_DOCUMENT_ATT_SEND_API1
    Mail without attachments: SO_NEW_DOCUMENT_SEND_API1
    For Understanding the Function Module
    SO_OBJECT_Send:
    http://www.thespot4sap.com/articles/SAP_Mail_Understanding_SO_Object_Send.asp
    Try this:
    REPORT  zsendemail                    .
    PARAMETERS: psubject(40) type c default  'Testing',
                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 'Line1' to it_message.
      Append 'Line2' to it_message.
      Append 'Line3' to it_message.
      Append 'Test- 1' 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
    * Information about structure of data tables
      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'.
      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
    Regards,
    Anjali

  • Function Module to send a mail in PDF/ XLS format

    Can you please tell me the name of a function module where a mail to be send in a non-sap box. And then mail which will be send is in a PDF/ XLS format.
    Regards,
    Subhasish

    Hi Subhasish,
    These are the FM for sending external email :-
    SO_DOCUMENT_SEND_API1 
    SAPoffice: Send new document with attachments via RFC 
    SO_NEW_DOCUMENT_ATT_SEND_API1
    (In 4.6C only, You can go to SE37 and click the documentation on how to use it. A sample program is provided there.)
    SAPoffice: Send new document with attachments via RFC 
    Note : If you are using FM SO_NEW_DOCUMENT_ATT_SEND_API1 then Export Parameter DOCUMENT_DATA-OBJ_DESCR contains the Subject. 
    SO_NEW_DOCUMENT_SEND_API1 
    SAPoffice: Send new document 
    How to send a report to an external mail-id?
    Try this sample code :-
    REPORT ZREPORT_TO_EMAIL NO STANDARD PAGE HEADING LINE-SIZE 200.
    DATA : BEGIN OF ITAB OCCURS 0,
    PERNR LIKE PA0001-PERNR,
    ENAME LIKE PA0001-ENAME,
    END OF ITAB.
    DATA: message_content LIKE soli OCCURS 10 WITH HEADER LINE,
    receiver_list LIKE soos1 OCCURS 5 WITH HEADER LINE,
    packing_list LIKE soxpl OCCURS 2 WITH HEADER LINE,
    listobject LIKE abaplist OCCURS 10,
    compressed_attachment LIKE soli OCCURS 100 WITH HEADER LINE,
    w_object_hd_change LIKE sood1,
    compressed_size LIKE sy-index.
    START-OF-SELECTION.
    SELECT PERNR ENAME
    INTO CORRESPONDING FIELDS OF TABLE ITAB
    FROM PA0001
    WHERE PERNR < 50.
    LOOP AT ITAB.
    WRITE :/02 SY-VLINE , ITAB-PERNR, 15 SY-VLINE , ITAB-ENAME, 50
    SY-VLINE.
    ENDLOOP.
    Receivers
    receiver_list-recextnam = '[email protected]'. "-->
    EMAIL ADDRESS
    RECEIVER_list-RECESC = 'E'. "<-
    RECEIVER_list-SNDART = 'INT'."<-
    RECEIVER_list-SNDPRI = '1'."<-
    APPEND receiver_list.
    General data
    w_object_hd_change-objla = sy-langu.
    w_object_hd_change-objnam = 'Object name'.
    w_object_hd_change-objsns = 'P'.
    Mail subject
    w_object_hd_change-objdes = 'Message subject'.
    Mail body
    APPEND 'Message content' TO message_content.
    Attachment
    CALL FUNCTION 'SAVE_LIST'
    EXPORTING
    list_index = '0'
    TABLES
    listobject = listobject.
    CALL FUNCTION 'TABLE_COMPRESS'
    IMPORTING
    compressed_size = compressed_size
    TABLES
    in = listobject
    out = compressed_attachment.
    DESCRIBE TABLE compressed_attachment.
    CLEAR packing_list.
    packing_list-transf_bin = 'X'.
    packing_list-head_start = 0.
    packing_list-head_num = 0.
    packing_list-body_start = 1.
    packing_list-body_num = sy-tfill.
    packing_list-objtp = 'ALI'.
    packing_list-objnam = 'Object name'.
    packing_list-objdes = 'Attachment description'.
    packing_list-objlen = compressed_size.
    APPEND packing_list.
    CALL FUNCTION 'SO_OBJECT_SEND'
    EXPORTING
    object_hd_change = w_object_hd_change
    object_type = 'RAW'
    owner = sy-uname
    TABLES
    objcont = message_content
    receivers = receiver_list
    packing_list = packing_list
    att_cont = compressed_attachment.
    Reward points if useful..
    Regards,
    Goutham.

  • SO_OBJECT_SEND function does not work without an explicit COMMIT WORK

    Hi,
    We have used this Function module (SO_OBJECT_SEND) inside a custom BAdI Implementation , which sends e-mails when some of the fields inside an infotype are modified using transaction PA30 (HR-Maintain master data).
    After the system was upgraded to BASIS version 7.0 , as per SAP note 489286 ,the calling program of the send interface must execute an explicit COMMIT WORK.But inside an update , COMMIT WORK should not be executed.
    So we did not execute explicit COMMIT WORK  inside BAdI.
    But after this upgrade, the emails are not sent out of R/3 , and the status message 672 (Still no entry in queue) is displayed on the program 'Administration of External Send Processes' - Transaction SOST.
    Can anyone suggest a solution , if you have used this Function module (SO_OBJECT_SEND) inside a BAdI during update?
    Thanks,
    Kiran

    Hi Kiran,
    create one remote enable function module, write your required logic in this remote enableD function module.
    Now call this function module in Badi as below,
    eg. suppose Remote enable function module created is 'ztest'.
    then,
    In BadI write logic,
    CALL FUNCTION 'ZTEST' SEPARATE TASK 'T'
    EXPORTING ......
    IMPORTING.......
    also inside this function module
    call function 'SO_OBJECT_SEND' separate task 'T'
    exporting....
    importing....
    committwork.
    after doing this what will happen is your mail logic will be in saperate session, so your current program will pass the data and execution of this RFC and Program having BADI, will be in two saperate sessions, so although you are using committ work standred program will not get affected.
    This will improve performance too...:)
    Please Give points if it is going to help you.

  • Issue in 'SO_NEW_DOCUMENT_SEND_API1' Function Module

    Hi All,
    I have a problem when using the Function Module 'SO_NEW_DOCUMENT_SEND_API1'.
    I am able to send data to SAP Users Email ID's using this function module, but the issue here is when i am sending
    the content and receivers lists all are working fine.
    But In The 'From:' part of Email receiver is getting
    My Name[SAP User [email protected]]
    like Shaik Rayeezuddin[[email protected]
    But i want it to be shown as it is sent by SAP but not by me. If we can put any constant as 'SAP' also it is ok, But it should not show my details in 'FROM:' Part os Email.
    Can anybody solve my problem as i need it urgent.
    Thanks in advance.
    Thanks & Regards,
    Rayeezuddin.

    Hi All,
    Thanks for all your replies.
    I resolved the issue By passing parameter           
    originator                 = '[email protected]'
    to F.M 'SO_OBJECT_SEND' that is in F.M
    SO_NEW_DOCUMENT_SEND_API1.
    we can pass anything we want here, that will come in 'From:' part of Email ID.
    once again thanks for those replies.
    Thanks & Regards,
    Rayeezuddin.

  • Better way of Sending E-Mail Notifications -- Workflow or Function Module ?

    Hi All,
    I have an implicit enhancement written in a t-code and based on some conditions I am creating event which inturn will trigger the workflow which inturn send e-mail notification via send mail step.
    My question is:
    Which one of the ways is better in terms of performance or overhead to send an e-mail notification. (There are no Approval processes in the workflow.. Just One Step E-mail Notification).
    1) In the Implicit Enhancement, Trigger an event which inturn will trigger the workflow and e-mail is sent via send mail step.
    2) In the Implicit Enhancement, Send the e-mail notification via standard function modules available... such as
       "SO_OBJECT_SEND", "SO_DOCUMENT_SEND_API1".........
    Would be grateful if someone can post the Advantages and Disadvantages in the above 2 ways of sending e-mail notifications..
    Regards,
    PR.

    Just to throw in some additional factors, consider exception handling:
    An event-based send mail step is decoupled and thus independent of your application. This means your exception handling is separate. It means you do not need to hold up the transaction if there is a failure. All this depends on how important the mail is. You could of course add validation code to ensure the mail address is valid and send it elsewhere if not.
    Regarding performance, consider how often this happens. If it's an infrequent occurrence then I wouldn't worry about performance. Hundreds or thousands a day is a different story.
    So the answer is:
    Workflow for low-volume scenarios (low performance impact) that are important (better error handling in WF),
    Direct mail for high volume and noncritical
    In between these, use whatever you like
    One more thing to perhaps consider the future. What are the chances of the mail being replaced by a work item in furture? Sometimes it's only by observing a process after go live that you can identify the best solution. e.g. you may decide to replace the mail with a "Please go fix this" work item because you need deadline monitoring

  • Sending mail function module problem in WAS.

    We have one custom function module Z_SEND_MAIL_ALL
    which is sending mails successfully with in the SAP 4.7 E system.
    Our function module Z_SEND_MAIL_ALL uses internally function modules like SO_OBJECT_SEND and SO_OBJECT_INSERT...
    Now we copied the same function module Z_SEND_MAIL_ALL into another system which is running in WAS server and
    when we run the function module it seems it is sending as attachment, however when I try to open the attachement...it gives dump. I clicked debugger.
    It shows  while CALL FUNCTION 'TABLE_DECOMPRESS' execution...
    it gives exception ( Error in compressed table ) as below  ...
    <b>raise COMPRESS_ERROR.</b>....
    I don't understand what is the problem ?
    Is it because of WAS is fully unicode compliance,  these function modules are not working . or is there any thing else I can do ....
    YOUR help is highly appreciated and respected.

    You have to declare the table using any specific type.
    The type table in the FM is generic so you can pass any type you need.
    For instance:
    TYPES: BEGIN OF ty_fields,
             fieldname LIKE dfies-fieldname,
           END OF ty_fields,
    TYPES: TY_T_GLU1              LIKE GLU1                     OCCURS 0,
           ty_t_fields            type ty_fields                occurs 0.
      DATA: lt_info_struct_fields TYPE ty_t_fields WITH HEADER LINE,
            lt_matching_fields    TYPE ty_t_fields WITH HEADER LINE.
        CALL FUNCTION 'AS_API_INFOSTRUC_FIND'
             EXPORTING
                  i_fieldcat         = ft_fieldcat-fieldcat
                  i_fields           = ft_fields_filled[]
             IMPORTING
                  e_infostruc        = lv_info_struct_name
                  e_all_fields       = lt_info_struct_fields[]
                  e_matching_fields  = lt_matching_fields[]
             EXCEPTIONS
                  no_infostruc_found = 1.

  • URGENT: Function modules or BAPIs

    Hi Experts,
    I need function modules or BAPI to get the open items and cleared items G/L Account wise.
    Useful replies will be surely awarded.

    Hi Chakradhar,
    Check tcode : BAPI
    u will get all bapis there.
    Regards,
    Hemant

Maybe you are looking for