Excel attachment in external email sending

Hi guys.
Just having a bit problem in my excel attachment in external email sending (internet). The contents of my attachment are being considered as one column per line item, which is supposedly divided into columns according to its tab or space.
example: i sent this :
PO# Poitem
A 1
it will be displayed in excel as:
column1
PO# Poitem
A 1
it should be like this:
column1
column2
PO#
Poitem
A
1
can anyone tell me what additional fm(s) do I need to implement before calling fm: SO_NEW_DOCUMENT_ATT_SEND_API1 to send the email.
thanks a lot!
cheers,

jagan,
  Comapare your code with this program.
I need a create a excel file (or tab delimited file) and send it as attachment by mail to the user (in background processing). I use SO_NEW_DOCUMENT_ATT_SEND_API1. I have a problem, that 1 Excel line is splited into 2 lines in mail, because there is more then 255 chars in Excel line.
Can anybody help me?
report y_cr17_mail .
data method1 like sy-ucomm.
data g_user like soudnamei1.
data g_user_data like soudatai1.
data g_owner like soud-usrnam.
data g_receipients like soos1 occurs 0 with header line.
data g_document like sood4 .
data g_header like sood2.
data g_folmam like sofm2.
data g_objcnt like soli occurs 0 with header line.
data g_objhead like soli occurs 0 with header line.
data g_objpara  like selc occurs 0 with header line.
data g_objparb  like soop1 occurs 0 with header line.
data g_attachments like sood5 occurs 0 with header line.
data g_references like soxrl occurs 0 with header line.
data g_authority like sofa-usracc.
data g_ref_document like sood4.
data g_new_parent like soodk.
data: begin of g_files occurs 10 ,
  text(4096) type c,
   end of g_files.
data : fold_number(12) type c,
       fold_yr(2) type c,
       fold_type(3) type c.
parameters ws_file(4096) type c default 'c:\debugger.txt'.
Can me any file fromyour pc ....either xls or word or ppt etc ...
g_user-sapname = sy-uname.
call function 'SO_USER_READ_API1'
exporting
   user                            = g_user
   PREPARE_FOR_FOLDER_ACCESS       = ' '
importing
   user_data                       = g_user_data
EXCEPTIONS
   USER_NOT_EXIST                  = 1
   PARAMETER_ERROR                 = 2
   X_ERROR                         = 3
   OTHERS                          = 4
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
fold_type = g_user_data-outboxfol+0(3).
fold_yr = g_user_data-outboxfol+3(2).
fold_number =  g_user_data-outboxfol+5(12).
clear g_files.
refresh : g_objcnt,
  g_objhead,
  g_objpara,
  g_objparb,
  g_receipients,
  g_attachments,
  g_references,
  g_files.
method1 = 'SAVE'.
g_document-foltp  = fold_type.
g_document-folyr   = fold_yr.
g_document-folno   = fold_number.
g_document-objtp   = g_user_data-object_typ.
*g_document-OBJYR   = '27'.
*g_document-OBJNO   = '000000002365'.
*g_document-OBJNAM = 'MESSAGE'.
g_document-objdes   = 'Manohar testing by program'.
g_document-folrg   = 'O'.
*g_document-okcode   = 'CHNG'.
g_document-objlen = '0'.
g_document-file_ext = 'TXT'.
g_header-objdes =  'Manohar testing by program'.
g_header-file_ext = 'TXT'.
call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
  exporting
    method             = method1
   office_user        = sy-uname
   ref_document       = g_ref_document
   new_parent         =  g_new_parent
importing
   authority          =  g_authority
tables
   objcont            = g_objcnt
   objhead            = g_objhead
   objpara            = g_objpara
   objparb            = g_objparb
   recipients         = g_receipients
   attachments        = g_attachments
   references         = g_references
   files              = g_files
  changing
    document           = g_document
   header_data        = g_header
  FOLMEM_DATA        =
  RECEIVE_DATA       =
File from the pc to send...
method1 = 'ATTCREATEFROMPC'.
g_files-text = ws_file.
append g_files.
call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
  exporting
    method             = method1
   office_user        = g_owner
   ref_document       = g_ref_document
   new_parent         =  g_new_parent
importing
   authority          =  g_authority
tables
   objcont            = g_objcnt
   objhead            = g_objhead
   objpara            = g_objpara
   objparb            = g_objparb
   recipients         = g_receipients
   attachments        = g_attachments
   references         = g_references
   files              = g_files
  changing
    document           = g_document
   header_data        = g_header
method1 = 'SEND'.
g_receipients-recnam = 'MK085'.
g_receipients-recesc = 'B'.
g_receipients-sndex = 'X'.
append  g_receipients.
call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
  exporting
    method             = method1
   office_user        = g_owner
   ref_document       = g_ref_document
   new_parent         =  g_new_parent
importing
   authority          =  g_authority
tables
   objcont            = g_objcnt
   objhead            = g_objhead
   objpara            = g_objpara
   objparb            = g_objparb
   recipients         = g_receipients
   attachments        = g_attachments
   references         = g_references
   files              = g_files
  changing
    document           = g_document
   header_data        = g_header.

Similar Messages

  • Send mails with attachment to external email id

    Hi Folks,
    I have an ALV report, the output of which needs to be sent as an excel attachment to an external email id. Can I use SO_NEW_DOCUMENT_ATT_SEND_API1 in this case? What about the SAP Connect settings? Any documents/help files/code samples describing the same will be useful.
    /Sagar

    HI,
    If you want to send the ALV output as it is then you need send it to Spool and then convert it to a PDF then send it via email as an attachment,
    or else, if you want to send the data of the output you can send it by the final internal table i mean by using the final Internal table you can send the data by passing this final interanl table to <b>'SO_NEW_DOCUMENT_ATT_SEND_API1'</b>
    <u>example for your understanding:</u>
    DATA: OBJPACK   LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
      DATA: OBJHEAD   LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
      DATA: OBJBIN    LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
      DATA: OBJTXT    LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
      DATA: RECLIST   LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
      DATA: DOC_CHNG  LIKE SODOCCHGI1.
      DATA: TAB_LINES LIKE SY-TABIX.
      DATA L_NUM(3).
    Creation of the document to be sent
    File Name
      DOC_CHNG-OBJ_NAME = 'SENDFILE'.
    Mail Subject
      DOC_CHNG-OBJ_DESCR = 'Delivered Mail'.
    Mail Contents
      OBJTXT = 'Object text'.
      APPEND OBJTXT.
      DESCRIBE TABLE OBJTXT LINES TAB_LINES.
      READ TABLE OBJTXT INDEX TAB_LINES.
      DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
    Creation of the entry for the compressed document
      CLEAR OBJPACK-TRANSF_BIN.
      OBJPACK-HEAD_START = 1.
      OBJPACK-HEAD_NUM = 0.
      OBJPACK-BODY_START = 1.
      OBJPACK-BODY_NUM = TAB_LINES.
      OBJPACK-DOC_TYPE = 'RAW'.
      APPEND OBJPACK.
    Creation of the document attachment
      LOOP AT ITAB_DATA.
        CONCATENATE ITAB_DATA-PRODUCTOR
                    ITAB_DATA-VBELN
                    ITAB_DATA-POSNR
                    ITAB_DATA-MATNR INTO OBJBIN.
        APPEND OBJBIN.
      ENDLOOP.
      DESCRIBE TABLE OBJBIN LINES TAB_LINES.
      OBJHEAD = 'ORDERS'.
      APPEND OBJHEAD.
    Creation of the entry for the compressed attachment
      OBJPACK-TRANSF_BIN = 'X'.
      OBJPACK-HEAD_START = 1.
      OBJPACK-HEAD_NUM   = 1.
      OBJPACK-BODY_START = 1.
      OBJPACK-BODY_NUM   = TAB_LINES.
      OBJPACK-DOC_TYPE   = 'TXT'.
      OBJPACK-OBJ_NAME   = 'WEBSITE'.
      OBJPACK-OBJ_DESCR  = 'ORDERS.TXT'.
      OBJPACK-DOC_SIZE   = TAB_LINES * 255.
      APPEND OBJPACK.
    Completing the recipient list
    target recipent
      clear RECLIST.
      RECLIST-RECEIVER = '[email protected]'.
      RECLIST-EXPRESS  = 'X'.
      RECLIST-REC_TYPE = 'U'.
      APPEND RECLIST.
    copy recipents
      clear RECLIST.
      RECLIST-RECEIVER = '[email protected]'.
      RECLIST-EXPRESS  = 'X'.
      RECLIST-REC_TYPE = 'U'.
      RECLIST-COPY     = 'X'.
      APPEND RECLIST.
    Sending the document
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           EXPORTING
                DOCUMENT_DATA              = DOC_CHNG
           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.
    ENDFORM.                    " SEND_MAIL

  • Order output send with attachment to external email recipient

    Hello,
    We have a requirement that we should be able to send an email with an orderconfirmation attached (like BA00) to specific contact persons (maybe one, maybe multiple contact persons) But this should be not the email in the customer master general data. This email is not internal, we need to send external emails with the document attached (PDF).
    Also this requirement should be also for invoices (RD00), it could be that this is an other person than the contact person for the order confirmation.
    Our first thought was to use the contact persons and create 2 new entries, order confirmation recipient and invoice recipient. In this contact person we can add an e-mail address .
    First, we created a condition record for output BA00 in VV12. We use standard communication strategy CS01 and with partner function CP (Contact Person) and add the number of the contact person (which is found in customer master).
    Only then we get the following messages:
    Message no. AM016
    Please enter an address number     
    Message no. SVN000
    Communication type  cannot be used
    Ok, this is due to that CP is missing in partner functions, so we add this then the output is send to the contact person. This is fine and working.
    But the problem is that we want to have this for multiple recipients, so for example 2 contact persons. You cannot create the same condition record for two recipients, so you can leave the partner empty in VV12. But when you enter an order, you get a popup for which CP you want to create this order. So only one is possible.
    Now we saw that there is a partner function MA (Mail partner address) is available. I have looked and searched but cannot find the exact function of this partner function. Like the MP (Mail partner) is internal, I expect this one to be external mail.
    But the only problem is with this partner function, we cannot add this to the partner determination for customer master.
    So how are we able to set this up? Any suggestion is appreciated and when usable also awarded.

    Read note 191470 - Purchase order as an e-mail.pdf

  • Facing problem in excel attachment in the Email

    Hi,
    I am facing one issue while sending an email with an excel attachment . In the excel attachment the actual number of line items are not displaying . For example if i have 4 rows in my internal table the excel shows only the first row of the internal table.
    Can anybody suggest what is the issue.
    Regards,
    Ratheesh BS

    Hi ,
    Please find the code used.
       WRITE: sy-datum TO l_date MM/DD/YY.
        CONCATENATE  text-014   "Enterprise workflow(s) are in ERROR status
                     l_date
                     INTO l_text
                     SEPARATED BY c_colon.
        wa_doc_data-obj_langu  = sy-langu.
        wa_doc_data-obj_name   = text-013.  "SAPRPT
        wa_doc_data-obj_descr  = l_text.
        wa_doc_data-sensitivty = c_false.
    Fill the document data and get size of attachment
         DESCRIBE TABLE i_attach LINES l_cnt.
         READ TABLE i_attach INTO wa_attach INDEX l_cnt.
        IF sy-subrc EQ 0.
          l_size = STRLEN( wa_attach ).
          l_docsize =   ( ( l_cnt - 1 ) * c_length255 + l_size ).
          wa_doc_data-doc_size   = l_docsize.
          wa_doc_data-obj_langu  = sy-langu.
          wa_doc_data-obj_name   = text-013.  "SAPRPT
          wa_doc_data-obj_descr  = l_text.
          wa_doc_data-sensitivty = c_false.
        ENDIF.
        lt_attachment[] = i_attach[]." XLS attachment details
    Describe the body of the message
        CLEAR wa_packing_list.
        REFRESH lt_packing_list.
        wa_packing_list-transf_bin = space.
        wa_packing_list-head_start = 1.
        wa_packing_list-head_num   = 0.
        wa_packing_list-body_start = 1.
       DESCRIBE TABLE lt_message LINES wa_packing_list-body_num .
        wa_packing_list-doc_type   = c_raw.
        APPEND wa_packing_list TO lt_packing_list.
        CLEAR wa_packing_list.
    *l_docsize = 5000.
    Create attachment notification
        wa_packing_list-transf_bin = c_active.
        wa_packing_list-head_start = 1.
        wa_packing_list-head_num   = 1.
        wa_packing_list-body_start = 1.
        DESCRIBE TABLE lt_attachment LINES wa_packing_list-body_num.
        wa_packing_list-doc_type   =  c_xls.
        wa_packing_list-obj_descr  =  text-022.
        wa_packing_list-doc_size  =  wa_packing_list-body_num * c_length255.
        APPEND wa_packing_list TO lt_packing_list.
        CLEAR: wa_packing_list,l_cnt.
    Email to be sent for multiple receivers
    Add the recipients email address
        LOOP AT s_receiv INTO wa_email.
          l_email = wa_email-low.
          wa_receivers-rec_type   = c_rectyp.
          wa_receivers-receiver   = l_email.
          wa_receivers-com_type   = c_internet.
          wa_receivers-notif_del  = c_true.
          wa_receivers-notif_ndel = c_true.
          APPEND wa_receivers  TO lt_receivers.
          CLEAR : wa_receivers, wa_email, l_email.
        ENDLOOP.
        IF lt_receivers[] IS NOT INITIAL AND
           i_itemrecord[] IS NOT INITIAL.
    email sender
          l_sender_address = sy-uname.   " Stores the sender's address
    *Function  module to handel mail sending.
          CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
            EXPORTING
              document_data                    = wa_doc_data
              put_in_outbox                    = c_true
              sender_address                   = l_sender_address
              sender_address_type              = c_sender_address_type
              commit_work                      = c_true
        IMPORTING
          SENT_TO_ALL                      =
            TABLES
              packing_list                     = lt_packing_list
              contents_bin                     = lt_attachment
             contents_hex                     = lt_attachment1
              contents_txt                     = lt_message
              receivers                        = lt_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

  • 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

  • Please help in senplease help in smartform send external email send.

    hii all,
    pleaseeeeeeeee help in sending external email in smartform print program.
    i need for RLB_INVOICE order confirmation to send thru email.
    what to code in ZRLN_INVOICE . i copied RLB_INVOICE in zprog.
    so  what rthe changes i need to code in driver program?
    pleaseeeeeeee help with sample coding..

    Here is the code to send the Smartform to mail as PDF attachment.
    *& Report ZTEST_PDF_MAIL
    REPORT ZTEST_PDF_MAIL.
    Internal Table declarations
    DATA: I_OTF TYPE ITCOO OCCURS 0 WITH HEADER LINE,
    I_TLINE TYPE TABLE OF TLINE WITH HEADER LINE,
    I_RECEIVERS TYPE TABLE OF SOMLRECI1 WITH HEADER LINE,
    I_RECORD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
    Objects to send mail.
    I_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
    I_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
    I_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
    I_RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
    Work Area declarations
    WA_OBJHEAD TYPE SOLI_TAB,
    W_CTRLOP TYPE SSFCTRLOP,
    W_COMPOP TYPE SSFCOMPOP,
    W_RETURN TYPE SSFCRESCL,
    WA_DOC_CHNG TYPE SODOCCHGI1,
    W_DATA TYPE SODOCCHGI1,
    WA_BUFFER TYPE STRING, "To convert from 132 to 255
    Variables declarations
    V_FORM_NAME TYPE RS38L_FNAM,
    V_LEN_IN LIKE SOOD-OBJLEN,
    V_LEN_OUT LIKE SOOD-OBJLEN,
    V_LEN_OUTN TYPE I,
    V_LINES_TXT TYPE I,
    V_LINES_BIN TYPE I.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    FORMNAME = 'ZTEST'
    IMPORTING
    FM_NAME = V_FORM_NAME
    EXCEPTIONS
    NO_FORM = 1
    NO_FUNCTION_MODULE = 2
    OTHERS = 3.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    W_CTRLOP-GETOTF = 'X'.
    W_CTRLOP-NO_DIALOG = 'X'.
    W_COMPOP-TDNOPREV = 'X'.
    CALL FUNCTION V_FORM_NAME
    EXPORTING
    CONTROL_PARAMETERS = W_CTRLOP
    OUTPUT_OPTIONS = W_COMPOP
    USER_SETTINGS = 'X'
    IMPORTING
    JOB_OUTPUT_INFO = W_RETURN
    EXCEPTIONS
    FORMATTING_ERROR = 1
    INTERNAL_ERROR = 2
    SEND_ERROR = 3
    USER_CANCELED = 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.
    I_OTF[] = W_RETURN-OTFDATA[].
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
    FORMAT = 'PDF'
    MAX_LINEWIDTH = 132
    IMPORTING
    BIN_FILESIZE = V_LEN_IN
    TABLES
    OTF = I_OTF
    LINES = I_TLINE
    EXCEPTIONS
    ERR_MAX_LINEWIDTH = 1
    ERR_FORMAT = 2
    ERR_CONV_NOT_POSSIBLE = 3
    OTHERS = 4.
    IF SY-SUBRC <> 0.
    ENDIF.
    LOOP AT I_TLINE.
    TRANSLATE I_TLINE USING '~'.
    CONCATENATE WA_BUFFER I_TLINE INTO WA_BUFFER.
    ENDLOOP.
    TRANSLATE WA_BUFFER USING '~'.
    DO.
    I_RECORD = WA_BUFFER.
    APPEND I_RECORD.
    SHIFT WA_BUFFER LEFT BY 255 PLACES.
    IF WA_BUFFER IS INITIAL.
    EXIT.
    ENDIF.
    ENDDO.
    Attachment
    REFRESH: I_RECLIST,
    I_OBJTXT,
    I_OBJBIN,
    I_OBJPACK.
    CLEAR WA_OBJHEAD.
    I_OBJBIN[] = I_RECORD[].
    Create Message Body Title and Description
    I_OBJTXT = 'test with pdf-Attachment!'.
    APPEND I_OBJTXT.
    DESCRIBE TABLE I_OBJTXT LINES V_LINES_TXT.
    READ TABLE I_OBJTXT INDEX V_LINES_TXT.
    WA_DOC_CHNG-OBJ_NAME = 'smartform'.
    WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
    WA_DOC_CHNG-OBJ_DESCR = 'smartform'.
    WA_DOC_CHNG-SENSITIVTY = 'F'.
    WA_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
    Main Text
    CLEAR I_OBJPACK-TRANSF_BIN.
    I_OBJPACK-HEAD_START = 1.
    I_OBJPACK-HEAD_NUM = 0.
    I_OBJPACK-BODY_START = 1.
    I_OBJPACK-BODY_NUM = V_LINES_TXT.
    I_OBJPACK-DOC_TYPE = 'RAW'.
    APPEND I_OBJPACK.
    Attachment (pdf-Attachment)
    I_OBJPACK-TRANSF_BIN = 'X'.
    I_OBJPACK-HEAD_START = 1.
    I_OBJPACK-HEAD_NUM = 0.
    I_OBJPACK-BODY_START = 1.
    DESCRIBE TABLE I_OBJBIN LINES V_LINES_BIN.
    READ TABLE I_OBJBIN INDEX V_LINES_BIN.
    I_OBJPACK-DOC_SIZE = V_LINES_BIN * 255 .
    I_OBJPACK-BODY_NUM = V_LINES_BIN.
    I_OBJPACK-DOC_TYPE = 'PDF'.
    I_OBJPACK-OBJ_NAME = 'smart'.
    I_OBJPACK-OBJ_DESCR = 'test'.
    APPEND I_OBJPACK.
    CLEAR I_RECLIST.
    I_RECLIST-RECEIVER = '[email protected]'.
    I_RECLIST-REC_TYPE = 'U'.
    APPEND I_RECLIST.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    DOCUMENT_DATA = WA_DOC_CHNG
    PUT_IN_OUTBOX = 'X'
    COMMIT_WORK = 'X'
    TABLES
    PACKING_LIST = I_OBJPACK
    OBJECT_HEADER = WA_OBJHEAD
    CONTENTS_BIN = I_OBJBIN
    CONTENTS_TXT = I_OBJTXT
    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.
    WRITE:/ 'Error When Sending the File', SY-SUBRC.
    ELSE.
    WRITE:/ 'Mail sent'.
    ENDIF.
    If you want to send some text as Body of the Mail then follow this once
    when u r callin the FM'SO_NEW_DOCUMENT_ATT_SEND_API1'.. points to remember
    1.u have to pass the body of content in table CONTENTS_TXT(ia m using I_OBJBIN) (each line a record) then. suppose i have appended 11 records to the table CONTENTS_TXT .
    2.PACKING_LIST(iam usign I_OBJPACK) table u ahve to append a redord as follows
    I_OBJPACK-TRANSF_BIN = ' '.
    I_OBJPACK-HEAD_START = 000000000000001.
    I_OBJPACK-HEAD_NUM = 000000000000001.
    I_OBJPACK-BODY_START = 000000000000002
    I_OBJPACK-BODY_NUM = 000000000000010.
    I_OBJPACK-DOC_TYPE = 'RAW'.
    append I_OBJPACK-.
    by the above code system treat the first line in table I_OBJBIN as header and the 2nd line to 10 lines tread as body.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    DOCUMENT_DATA = WA_DOC_CHNG
    PUT_IN_OUTBOX = 'X'
    TABLES
    PACKING_LIST = I_OBJPACK
    OBJECT_HEADER = WA_OBJHEAD
    CONTENTS_BIN = I_OBJBIN
    CONTENTS_TXT = I_OBJTXT
    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.
    regards,
    srinivas

  • DISTRIBUTION LIST WITH EXTERNAL EMAIL SEND FROM OUTSIDE

    Hello to all,
    I'm new in the foruum.
    i have the following problem with Distribution Lists.
    I have create one Distribution List which include email address from our company and external email address.
    When i send from inside all works fine.
    But when i send from outside the email received from inside users(email addresses of my domain) but never received from outside email addresses.
    How can resolve this issue?
    Pls help

    Read carefully my question.
    i have change this setting when create the group.But my problem isn't that users from outside can't send to distribution list. The problem is that in my distribution list i have email addresses from my company (@domain.com) and external email addresses (@gmail.com,@yahoo.com).
    When a user from inside send to the Distribution List all works fine. When a user from outside send to the Distribution List, users from my company(@domain.com) which include in the Distribution List receive the email but user with external email addresses(@gmail.com,@yahoo.com)
    didn't receive the email.

  • External Email Sending Configuration

    How to configure NW4s server for external email communication.
    Help will be appreciated

    Check this link...
    http://help.sap.com/saphelp_nw2004s/helpdata/en/55/a8b538891b11d2a25a00a0c943858e/frameset.htm
    If useful reward points
    Regards

  • CP4 Access/Excell import - Quiz result email sending

    Hi - sorry for my bad english - i'm good in order a beer, but in technik a loser, so don't beat me.
    First question: is there any way to fill up a quiz-pool from a Access or Excel database?
    Second question: What can i do to send the result of the quiz to a email-account?
    I have insert a email-address, but it is not working - maybe i have to do more ?
    Thanks a lot for your help.
    Friendly regards, Wolvo
    PS.: If it helps for more understanding i can send this in german too

    Hi Lilybiri - thanks a lot for your help.
    If a customer like to create a big quiz perhaps for schools a.s.o. is the work on the base very time expensiv.
    The quiz-pool in CP4 is helpfull, but not very good to handle - so it's maybe a good idea, to got a extern data base.
    I have reporting to a email address anabled, and on the end of the quiz appears a buttun "send" without any function.
    Maybe it is a problem of CP4 with W7 64 bit?
    It would be very helpfull to report the resolved test to a email.
    Friendly greetings, Wolvo

  • Not able to open MS Excel attachment in the email Using SO_NEW_DOCUMENT_ATT

    Hi, I am not able to open the attached MS excel in the mail its giving error as "Problems came up in the following areas during load Table". My requirement is to send a colored excel as attachment through mail when the program is executed in background. For this i have reffered the following link " http://wiki.sdn.sap.com/wiki/display/Snippets/FormattedExcelasEmailAttachment". That is i have used the XML method for this . I would be thankful if you can let me know where i am doing the mistake For refference i am pasting my code: * Send mail when executed in background mode IF sy-batch eq 'X'. PERFORM send_mail_bkgrnd. ELSE. " Foreground mode PERFORM build_layout. PERFORM build_field_cat. PERFORM display. ENDIF. FORM SEND_MAIL_BKGRND . PERFORM process_xml_data. PERFORM disatch_mail. ENDFORM. " SEND_MAIL_BKGRND &---- *& Form PROCESS_XML_DATA &---- FORM PROCESS_XML_DATA . DATA lv_xlwidth TYPE i. * Creating a ixml Factory l_ixml = cl_ixml=>create( ). * Creating the DOM Object Model l_document = l_ixml->create_document( ). * Create Root Node 'Workbook' l_element_root = l_document->create_simple_element( name = 'Workbook' parent = l_document ). l_element_root->set_attribute( name = 'xmlns' value = 'urn:schemas-microsoft-com:office:spreadsheet' ). ns_attribute = l_document->create_namespace_decl( name = 'ss' prefix = 'xmlns' uri = 'urn:schemas-microsoft-com:office:spreadsheet' ). l_element_root->set_attribute_node( ns_attribute ). ns_attribute = l_document->create_namespace_decl( name = 'x' prefix = 'xmlns' uri = 'urn:schemas-microsoft-com:office:excel' ). l_element_root->set_attribute_node( ns_attribute ). * Create node for document properties. r_element_properties = l_document->create_simple_element( name = 'TEST_REPORT' parent = l_element_root ). l_value = sy-uname. l_document->create_simple_element( name = 'Author' value = l_value parent = r_element_properties ). * Styles r_styles = l_document->create_simple_element( name = 'Styles' parent = l_element_root ). * Style for Header r_style = l_document->create_simple_element( name = 'Style' parent = r_styles ). r_style->set_attribute_ns( name = 'ID' prefix = 'ss' value = 'Header' ). r_format = l_document->create_simple_element( name = 'Font' parent = r_style ). r_format->set_attribute_ns( name = 'Bold' prefix = 'ss' value = '1' ). r_format = l_document->create_simple_element( name = 'Interior' parent = r_style ). r_format->set_attribute_ns( name = 'Color' prefix = 'ss' value = '#92D050' ). r_format->set_attribute_ns( name = 'Pattern' prefix = 'ss' value = 'Solid' ). r_format = l_document->create_simple_element( name = 'Alignment' parent = r_style ). r_format->set_attribute_ns( name = 'Vertical' prefix = 'ss' value = 'Center' ). r_format->set_attribute_ns( name = 'WrapText' prefix = 'ss' value = '1' ). r_border = l_document->create_simple_element( name = 'Borders' parent = r_style ). r_format = l_document->create_simple_element( name = 'Border' parent = r_border ). r_format->set_attribute_ns( name = 'Position' prefix = 'ss' value = 'Bottom' ). r_format->set_attribute_ns( name = 'LineStyle' prefix = 'ss' value = 'Continuous' ). r_format->set_attribute_ns( name = 'Weight' prefix = 'ss' value = '1' ). r_format = l_document->create_simple_element( name = 'Border' parent = r_border ). r_format->set_attribute_ns( name = 'Position' prefix = 'ss' value = 'Left' ). r_format->set_attribute_ns( name = 'LineStyle' prefix = 'ss' value = 'Continuous' ). r_format->set_attribute_ns( name = 'Weight' prefix = 'ss' value = '1' ). r_format = l_document->create_simple_element( name = 'Border' parent = r_border ). r_format->set_attribute_ns( name = 'Position' prefix = 'ss' value = 'Top' ). r_format->set_attribute_ns( name = 'LineStyle' prefix = 'ss' value = 'Continuous' ). r_format->set_attribute_ns( name = 'Weight' prefix = 'ss' value = '1' ). r_format = l_document->create_simple_element( name = 'Border' parent = r_border ). r_format->set_attribute_ns( name = 'Position' prefix = 'ss' value = 'Right' ). r_format->set_attribute_ns( name = 'LineStyle' prefix = 'ss' value = 'Continuous' ). r_format->set_attribute_ns( name = 'Weight' prefix = 'ss' value = '1' ). * Style for Data "Color properties are set over here r_style1 = l_document->create_simple_element( name = 'Style' parent = r_styles ). r_style1->set_attribute_ns( name = 'ID' prefix = 'ss' value = 'Data' ). r_border = l_document->create_simple_element( name = 'Borders' parent = r_style1 ). r_format = l_document->create_simple_element( name = 'Border' parent = r_border ). r_format->set_attribute_ns( name = 'Position' prefix = 'ss' value = 'Bottom' ). r_format->set_attribute_ns( name = 'LineStyle' prefix = 'ss' value = 'Continuous' ). r_format->set_attribute_ns( name = 'Weight' prefix = 'ss' value = '1' ). r_format = l_document->create_simple_element( name = 'Border' parent = r_border ). r_format->set_attribute_ns( name = 'Position' prefix = 'ss' value = 'Left' ). r_format->set_attribute_ns( name = 'LineStyle' prefix = 'ss' value = 'Continuous' ). r_format->set_attribute_ns( name = 'Weight' prefix = 'ss' value = '1' ). r_format = l_document->create_simple_element( name = 'Border' parent = r_border ). r_format->set_attribute_ns( name = 'Position' prefix = 'ss' value = 'Top' ). r_format->set_attribute_ns( name = 'LineStyle' prefix = 'ss' value = 'Continuous' ). r_format->set_attribute_ns( name = 'Weight' prefix = 'ss' value = '1' ). r_format = l_document->create_simple_element( name = 'Border' parent = r_border ). r_format->set_attribute_ns( name = 'Position' prefix = 'ss' value = 'Right' ). r_format->set_attribute_ns( name = 'LineStyle' prefix = 'ss' value = 'Continuous' ). r_format->set_attribute_ns( name = 'Weight' prefix = 'ss' value = '1' ). * Worksheet r_worksheet = l_document->create_simple_element( name = 'Worksheet' parent = l_element_root ). r_worksheet->set_attribute_ns( name = 'Name' prefix = 'ss' value = 'Sheet1' ). * Table r_table = l_document->create_simple_element( name = 'Table' parent = r_worksheet ). r_table->set_attribute_ns( name = 'FullColumns' prefix = 'x' value = '1' ). r_table->set_attribute_ns( name = 'FullRows' prefix = 'x' value = '1' ). * Column Formatting DO 32 TIMES. CASE sy-index. WHEN 1. lv_xlwidth = '300'. WHEN 2. lv_xlwidth = '300'. WHEN OTHERS. lv_xlwidth = '300'. ENDCASE. PERFORM clmn_formatting USING lv_xlwidth. ENDDO. * Blank Row r_row = l_document->create_simple_element( name = 'Row' parent = r_table ). * Column Headers Row r_row = l_document->create_simple_element( name = 'Row' parent = r_table ). r_row->set_attribute_ns( name = 'AutoFitHeight' prefix = 'ss' value = '1' ). * VC. No. r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ). r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header' ). r_data = l_document->create_simple_element( name = 'Data' value = 'VC No.' parent = r_cell ). r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ). * Source r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ). r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header' ). r_data = l_document->create_simple_element( name = 'Data' value = 'Source' parent = r_cell ). r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ). DO 30 TIMES. * * TPLGRP r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ). r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header' ). r_data = l_document->create_simple_element( name = 'Data' value = '' parent = r_cell ). r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ). ENDDO. * Blank Row after Column Headers r_row = l_document->create_simple_element( name = 'Row' parent = r_table ). DO 32 TIMES. r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ). r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Data' ). ENDDO. * Data Table CLEAR gs_output. LOOP AT gt_output INTO gs_output. r_row = l_document->create_simple_element( name = 'Row' parent = r_table ). DO 32 TIMES. CASE sy-index. WHEN 1. a_dvalue = gs_output-vc_number. WHEN 2. a_dvalue = gs_output-source. WHEN 3. a_dvalue = gs_output-tplgrp_01. WHEN 4. a_dvalue = gs_output-tplgrp_02. WHEN 5. a_dvalue = gs_output-tplgrp_03. WHEN 6. a_dvalue = gs_output-tplgrp_04. WHEN 7. a_dvalue = gs_output-tplgrp_05. WHEN 8. a_dvalue = gs_output-tplgrp_06. WHEN 9. a_dvalue = gs_output-tplgrp_07. WHEN 10. a_dvalue = gs_output-tplgrp_08. WHEN 11. a_dvalue = gs_output-tplgrp_09. WHEN 12. a_dvalue = gs_output-tplgrp_10. WHEN 13. a_dvalue = gs_output-tplgrp_11. WHEN 14. a_dvalue = gs_output-tplgrp_12. WHEN 15. a_dvalue = gs_output-tplgrp_13. WHEN 16. a_dvalue = gs_output-tplgrp_14. WHEN 17. a_dvalue = gs_output-tplgrp_15. WHEN 18. a_dvalue = gs_output-tplgrp_16. WHEN 19. a_dvalue = gs_output-tplgrp_17. WHEN 20. a_dvalue = gs_output-tplgrp_18. WHEN 21. a_dvalue = gs_output-tplgrp_19. WHEN 22. a_dvalue = gs_output-tplgrp_20. WHEN 23. a_dvalue = gs_output-tplgrp_21. WHEN 24. a_dvalue = gs_output-tplgrp_22. WHEN 25. a_dvalue = gs_output-tplgrp_23. WHEN 26. a_dvalue = gs_output-tplgrp_24. WHEN 27. a_dvalue = gs_output-tplgrp_25. WHEN 28. a_dvalue = gs_output-tplgrp_26. WHEN 29. a_dvalue = gs_output-tplgrp_27. WHEN 30. a_dvalue = gs_output-tplgrp_28. WHEN 31. a_dvalue = gs_output-tplgrp_29. WHEN 32. a_dvalue = gs_output-tplgrp_30. ENDCASE. PERFORM fill_data_val_excel USING a_dvalue. ENDDO. CLEAR gs_output. ENDLOOP. * Creating a Stream Factory l_streamfactory = l_ixml->create_stream_factory( ). * Connect Internal XML Table to Stream Factory l_ostream = l_streamfactory->create_ostream_itable( table = l_xml_table ). * Rendering the Document l_renderer = l_ixml->create_renderer( ostream = l_ostream document = l_document ). l_rc = l_renderer->render( ). * Saving the XML Document l_xml_size = l_ostream->get_num_written_raw( ). ENDFORM. " PROCESS_XML_DATA &---- *& Form DISATCH_MAIL &---- FORM DISATCH_MAIL . DATA: objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE. DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE. DATA: objbin LIKE solix OCCURS 10 WITH HEADER LINE. DATA: objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE. DATA: reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE. DATA: doc_chng LIKE sodocchgi1. DATA: tab_lines LIKE sy-tabix. DATA: l_num(3). DATA: subj_date(10) TYPE c. * Mail Subject data lv_date TYPE d. lv_date = sy-datum. CONCATENATE lv_date6(2) '-' lv_date4(2) '-' lv_date+0(4) INTO subj_date. CONCATENATE 'SAP Application Usage Report ' subj_date INTO doc_chng-obj_descr SEPARATED BY space. * Mail Contents objtxt = 'Dear User,'. APPEND objtxt. CLEAR objtxt. APPEND objtxt. CONCATENATE 'Please find the attached SAP Application Usage Report for ' subj_date INTO objtxt SEPARATED BY space. " Mail Contents APPEND objtxt. CLEAR objtxt. APPEND objtxt. objtxt = 'Thanks & Regards,'. APPEND objtxt. objtxt = 'Himanshu Kanekar'. APPEND objtxt. DESCRIBE TABLE objtxt LINES tab_lines. READ TABLE objtxt INDEX tab_lines. doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ). * Packing List For the E-mail Body objpack-head_start = 1. objpack-head_num = 0. objpack-body_start = 1. objpack-body_num = tab_lines. objpack-doc_type = 'RAW'. APPEND objpack. * Creation of the Document Attachment LOOP AT l_xml_table INTO wa_xml. CLEAR objbin. objbin-line = wa_xml-data. APPEND objbin. ENDLOOP. DESCRIBE TABLE objbin LINES tab_lines. objhead = 'SAP Login Details'. APPEND objhead. * Packing List For the E-mail Attachment objpack-transf_bin = ''."'X'. objpack-head_start = 1. objpack-head_num = 0. objpack-body_start = 1. objpack-body_num = tab_lines. CONCATENATE 'SAP_Login_Details' subj_date INTO objpack-obj_descr SEPARATED BY space. objpack-doc_type = 'XLS'. objpack-doc_size = tab_lines * 255. APPEND objpack. * Target Recipent CLEAR reclist. reclist-receiver = reclist-rec_type = 'U'. APPEND reclist. * Sending the document CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1' EXPORTING document_data = doc_chng put_in_outbox = 'X' commit_work = 'X' TABLES packing_list = objpack object_header = objhead contents_txt = objtxt contents_hex = objbin receivers = reclist EXCEPTIONS too_many_receivers = 1 document_not_sent = 2 operation_no_authorization = 4 OTHERS = 99. ENDFORM. " DISATCH_MAIL

    Refer:
    http://www.sap-img.com/abap/sending-mail-with-attachment-report-in-background.htm
    http://www.saptechies.com/sending-mail-with-attachment-report-in-background/

  • I attempted to eprint an email with an excel attachment. The attachment didn't print

    I attempted to eprint an email with an Excel attachment.  The email message printed but the Excel attachment does not print

    Hi DaveF100,
    You may want to refer to the help section of ePrintCenter.com here about attachments. In general though, Excel documents will have difficulty if they have complex variables in the document, such as pivot tables, macros, etc. 
    If I have solved your issue, please feel free to provide kudos and make sure you mark this thread as solution provided!
    Although I work for HP, my posts and replies are my own opinion and not those of HP.

  • Emailing the report to external email -  Background job

    HI
    We are creating background job for running the report in background...but i want the output(report) to send an email in Excel format after the job run successfully...
    Here the email is External email not SAP inbox..
    Do you have any idea how to achieve this? any user-exit or even handling will help this?
    Please let me know
    Thanks
    Govi

    Iam not using custom program to send the email...I know about the FM SO_DOCUMENT_SEND_API1...to send email.
    My requirement is to send email to user the report in Excel after the background job runs.
    we will define the job in SM36 with variant for the report with program name and variant.
    after the job runs the spool request will be created and we can also setup the output of the report to be sent to SAP inbox.
    my question is to how to send the output of this report in Excel format to external email i.e. Gmail, yahoo etc...
    I hope u r clear now...
    Please let me know if you know the answer.
    Thanks

  • Tab Delimited Text File to be Emailed (External Email ID) from SAP

    Hi,
    I have a requirement to email a tab delimited text file as an attachment to external email id from SAP. The text file is of line with type string and the length of each line is about 1024 char size. Can you please suggest me a suitable solution to this requirement? It looks like the FM: SO_NEW_DOCUMENT_ATT_SEND_API1 can handle a text file of 255 char length. I am not sure how to attach a text file of records with length more than 1025 char size.
    Appreciate your help in advance.
    Thanks,
    Kannan

    Hi,
    I have a requirement to email a tab delimited text file as an attachment to external email id from SAP. The text file is of line with type string and the length of each line is about 1024 char size. Can you please suggest me a suitable solution to this requirement? It looks like the FM: SO_NEW_DOCUMENT_ATT_SEND_API1 can handle a text file of 255 char length. I am not sure how to attach a text file of records with length more than 1025 char size.
    Appreciate your help in advance.
    Thanks,
    Kannan

  • Email send to SAPoffice inbox by KRML(credit processing)

    Hi,
    Output type KRML can send a email to SAPoffice inbox for credit blocked order.
    I would like to know if I can add some attachment through the mail.
    if yes, how can I?
    Many Thanks
    Jean

    Hi iimnava,
    Thank you very much for your kind help.
    Temporarily, I rewarded 6 points to you. After it realize, I will reward you with 10.
    I will explain you with my detail requirement.
    I need to send the email with attachment when I save the credit hold sales order.
    Now output type KRML has been set to send mail to the SAP inbox when saving the order(I don't want to use SAP-SBWP).
    But the problem is that I don't how to add the attachment with this email send by KRML.
    If you have some code example, could you please also send to me?
    In addition, the content in the attachement can not be maintained in the text id, the information has to be retrieved by function module.
    Many Thanks
    Jean
    Message was edited by:
            Jean Chang

  • Issue in Sending email with EXCEL attachment

    Hi,
    Im using the FM SO_NEW_DOCUMENT_ATT_SEND_API1 for sending emails to a list of recipients with an excel attachment. In the attachment data, as the field length is 255 for the structure SOLISTI1, for the records having more than 255 characters, data is being truncated. I did a search in this forum and done some changes , still it is not working properly.
    I have used SCMS_TEXT_TO_XSTRING, SCMS_XSTRING_TO_BINARY FMs for converting the data to hexa format. This case, records having more than 255 are displayed properly in the attachment, but there are blank lines inserted between two records.
    Please suggest me to resolve this isssue.
    Thanks in advance.
    Jayashree

    Hi Jayashree,
    you might want to check out the example link by Saso in his post Send external email from within ABAP program to xls.
    For the rest I can only guess that there might be some issues with the format you use for Excel. In case of empty lines and using a text format for Excel the issue is in most cases that there are too many carriage return line feeds in the text fiel (cl_abap_char_utilities=>cr_lf).
    Hope that helps.
    Best Regards
    Michael

Maybe you are looking for