Sending Excel as attachment in Email (Unicode)

Hi,
I'm using SO_NEW_DOCUMENT_ATT_SEND_API1 FM to send excel attachments as emails to external addresses.
However, this the SAP upgrade to ECC6.0 from R/3 4.6B
then I cannot open BIG5 char excel, who does know how to sending Unicode excel as attachment in email.
the Excel can show Chinese , BIG5 code ,Japanese ,Korea .
OR which new funciton module in ECC6.0 like SO_NEW_DOCUMENT_ATT_SEND_API1 FM .
Regards,
Hank

Hey,
try this one.
    lv_string = str_data1.
      cl_bcs_convert=>string_to_solix(
        EXPORTING
          iv_string   = lv_string
          iv_codepage = '4103'  "suitable for MS Excel, leave empty
      iv_add_bom  = 'X'     "for other doc types
        IMPORTING
          et_solix  = binary_content
          ev_size   = size ).
    CATCH cx_bcs.
      MESSAGE e445(so).
  ENDTRY.
        send_request = cl_bcs=>create_persistent( ).
Now  create document object from internal table with text
document = cl_document_bcs=>create_document(
          i_type    = 'RAW'
          i_text    = main_text
          i_subject = l_var ).     
       document->add_attachment(
          i_attachment_type    = 'xls'                               i_attachment_subject = ' Details'                      i_attachment_size    = size
          i_att_content_hex    = binary_content ).
    add document object to send request
        send_request->set_document( document ).
    --------- add recipient (e-mail address) -----------------------
    create recipient object
        recipient = cl_cam_address_bcs=>create_internet_address( abc at abc.com).
       recipient = cl_cam_address_bcs=>create_internet_address( 'abc at abc.com' ).
    add recipient object to send request
        send_request->add_recipient( recipient ).
        sent_to_all = send_request->send( i_with_error_screen = 'X' ).
        COMMIT WORK.
This will definitely work .if any doubts aask me.
Neeraj

Similar Messages

  • Send Excel as attachment in Email

    Hi,
    I have an excel file attached as the original to a DIR.
    I want to send this excel file as an attachment in the external email.
    I am retrieving the data contents of original file in binary format using CVAPI_DOC_CHECKOUTVIEW
    Then I am converting binary to text using SCMS_BINARY_TO_TEXT
    and then sending the email with the data file as attachment using SO_DOCUMENT_SEND_API1.
    However, this attachment does not open when its type is .xls
    It does open with .txt, but the file is distorted and in non-understanable format.
    Regards,
    Reema

    hi,
    Check this Out...
    REPORT  ZEMAIL_ATTACH                   .
    TABLES: ekko.
    PARAMETERS: p_email   TYPE somlreci1-receiver
                                      DEFAULT '[email protected]'.
    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.
      CONSTANTS: con_cret TYPE x VALUE '0D',  "OK for non Unicode
                 con_tab TYPE x VALUE '09'.   "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    *class cl_abap_char_utilities definition load.
    *constants:
       con_tab  type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
       con_cret type c value cl_abap_char_utilities=>CR_LF.
      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 wa_charekpo-ebeln wa_charekpo-ebelp
                    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
    Regards,
    Santosh

  • Facing problem with the code for sending an .xls attachment via email, a field value contains leading zeros but excel automatically removes these from display i.e. (00444 with be displayed as 444).kindly guide .

    Facing problem with the code for sending an .xls attachment via email, a field value contains leading zeros but excel automatically removes these from display i.e. (00444 with be displayed as 444).kindly guide .

    Hi Chhayank,
    the problem is not the exported xls. If you have a look inside with Notepad or something like that, you will see that your leading zeros are exported correct.Excel-settings occurs this problem, it is all about how to open the document. If you use the import-assistant you will have no problems because there are options available how to handle the different columns.
    Another solution might be to get familiar with ABAP2XLS-Project. I got in my mind, that there is a method implemented, that will help you solving this problem. But that is not a five minute job
    ~Florian

  • Sending a binary attachment via email, looking for a more clean way

    Hi experts.
    I finally managed to send a binary attachment via email. Why "finally"? Never done before!
    Also I got to manage the "not standard" .SAP file extension, because the attachment is a transaction link.
    So let me explain how i did it:
    take SO_NEW_DOCUMENT_ATT_SEND_API1, filling following input data:
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = st_docdata
          commit_work                = 'X'
        TABLES
          packing_list               = lt_packlist
          contents_hex               = lt_hex
          contents_txt               = lt_content
          receivers                  = lt_recv
        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.
    But how to fill lt_hex? Well I did not found a way to transfer text data into raw data structure (lt_hex is type SOLIX).
    So, here is the trick:
    fill another table, lt_bin type SOLISTI1, with attachment content (text data);
    dump lt_bin content to a file on application server, having care to specify TEXT MODE and UTF-8 encoding;
    now reopen the same file in BINARY MODE and transfer content to lt_hex.
    Why I did not use parameter
    content_bin
    ? Because SAP ECC 6 is unicode enabled (I think UTF-16) and file has got to be UTF-8 or ASCII. Also, packing_list for attachment must specify binary tranfer mode. And doing so each UTF-16 character (2 bytes) is split into 2 characters (1 char + 1 NUL byte). Attachment is now unusable.
    What is the question? Here it is: how to fill lt_hex data directly from text (UTF-16) data, avoiding conversion errors?
    Thank you in advance.

    Hi Chhayank,
    the problem is not the exported xls. If you have a look inside with Notepad or something like that, you will see that your leading zeros are exported correct.Excel-settings occurs this problem, it is all about how to open the document. If you use the import-assistant you will have no problems because there are options available how to handle the different columns.
    Another solution might be to get familiar with ABAP2XLS-Project. I got in my mind, that there is a method implemented, that will help you solving this problem. But that is not a five minute job
    ~Florian

  • Problem while sending excel as attachment

    Hi,
    I am trying to send excel as attachment through an email.
    I am using the fm: SO_DOCUMENT_SEND_API1
    In english, I am able to get the data properly. However, when I try to send the same in Chinese, I am getting junk characters in excel file.
    Could you please help me out to solve my issue.
    I am clueless, why only for chinese, I am getting the issue.
    Thanks,
    Sandeep

    Hi Rushi,
    In this FM, I am unable to find the parameter for code page. Could you please help me how exactly I can use this code page?
    Thanks,
    Sandeep

  • Send Excel as attachment with colors in coloums

    Hi,
    I need to send Excel as attachment and some particular columns should be coloured.
    I am sending Excel attachment using FM SO_DOCUMENT_SEND_API1 when report executed in foreground.
    Please help how to make columns coloured.
    Thanks,
    Phani

    hi,
    This report demonstrates how to send some ABAP data to an EXCEL sheet using OLE automation by this it makes EXCEL columns colorful.
    TYPE-POOLS OLE2 .
    * handles for OLE objects
    DATA: H_EXCEL TYPE OLE2_OBJECT,        " Excel object
           H_MAPL TYPE OLE2_OBJECT,         " list of workbooks
           H_MAP TYPE OLE2_OBJECT,          " workbook
           H_ZL TYPE OLE2_OBJECT,           " cell
           H_F TYPE OLE2_OBJECT,            " font
           H_C TYPE OLE2_OBJECT.            " color
    DATA: FILENAME LIKE RLGRAP-FILENAME.
    TABLES: SPFLI.
    DATA  H TYPE I.
    * table of flights
    DATA: IT_SPFLI LIKE SPFLI OCCURS 10 WITH HEADER LINE.
    *&   Event START-OF-SELECTION
    START-OF-SELECTION.
    * read flights
       SELECT * FROM SPFLI INTO TABLE IT_SPFLI.
    * display header
       ULINE (61).
       WRITE: /     SY-VLINE NO-GAP,
               (3)  'Flg'(001) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
               (4)  'Nr'(002) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
               (20) 'Von'(003) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
               (20) 'Nach'(004) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
               (8)  'Zeit'(005) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP.
       ULINE /(61).
    * display flights
       LOOP AT IT_SPFLI.
         WRITE: / SY-VLINE NO-GAP,
                  IT_SPFLI-CARRID COLOR COL_KEY NO-GAP, SY-VLINE NO-GAP,
                  IT_SPFLI-CONNID COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
                  IT_SPFLI-CITYFROM COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
                  IT_SPFLI-CITYTO COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
                  IT_SPFLI-DEPTIME COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP.
       ENDLOOP.
       ULINE /(61).
    * tell user what is going on
       CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
          EXPORTING
    *           PERCENTAGE = 0
                TEXT       = TEXT-007
            EXCEPTIONS
                 OTHERS     = 1.
    * start Excel
       CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
    *  PERFORM ERR_HDL.
       SET PROPERTY OF H_EXCEL  'Visible' = 1.
    *  CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:\kis_excel.xls'  .
    *  PERFORM ERR_HDL.
    * tell user what is going on
       CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
          EXPORTING
    *           PERCENTAGE = 0
                TEXT       = TEXT-008
            EXCEPTIONS
                 OTHERS     = 1.
    * get list of workbooks, initially empty
       CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
       PERFORM ERR_HDL.
    * add a new workbook
       CALL METHOD OF H_MAPL 'Add' = H_MAP.
       PERFORM ERR_HDL.
    * tell user what is going on
       CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
          EXPORTING
    *           PERCENTAGE = 0
                TEXT       = TEXT-009
            EXCEPTIONS
                 OTHERS     = 1.
    * output column headings to active Excel sheet
       PERFORM FILL_CELL USING 1 1 1 200 'Carrier id'(001).
       PERFORM FILL_CELL USING 1 2 1 200 'Connection id'(002).
       PERFORM FILL_CELL USING 1 3 1 200 'City from'(003).
       PERFORM FILL_CELL USING 1 4 1 200 'City to'(004).
       PERFORM FILL_CELL USING 1 5 1 200 'Dep. Time'(005).
       LOOP AT IT_SPFLI.
    * copy flights to active EXCEL sheet
         H = SY-TABIX + 1.
         IF IT_SPFLI-CARRID CS 'AA'.
           PERFORM FILL_CELL USING H 1 0 000255000 IT_SPFLI-CARRID.
         ELSEIF IT_SPFLI-CARRID CS 'AZ'.
           PERFORM FILL_CELL USING H 1 0 168000000 IT_SPFLI-CARRID.
         ELSEIF IT_SPFLI-CARRID CS 'JL'.
           PERFORM FILL_CELL USING H 1 0 168168000 IT_SPFLI-CARRID.
         ELSEIF IT_SPFLI-CARRID CS 'LH'.
           PERFORM FILL_CELL USING H 1 0 111111111 IT_SPFLI-CARRID.
         ELSEIF IT_SPFLI-CARRID CS 'SQ'.
           PERFORM FILL_CELL USING H 1 0 100100100 IT_SPFLI-CARRID.
         ELSE.
           PERFORM FILL_CELL USING H 1 0 000145000 IT_SPFLI-CARRID.
         ENDIF.
         IF IT_SPFLI-CONNID LT 400.
           PERFORM FILL_CELL USING H 2 0 255000255 IT_SPFLI-CONNID.
         ELSEIF IT_SPFLI-CONNID LT 800.
           PERFORM FILL_CELL USING H 2 0 077099088 IT_SPFLI-CONNID.
         ELSE.
           PERFORM FILL_CELL USING H 2 0 246156138 IT_SPFLI-CONNID.
         ENDIF.
         IF IT_SPFLI-CITYFROM CP 'S*'.
           PERFORM FILL_CELL USING H 3 0 155155155 IT_SPFLI-CITYFROM.
         ELSEIF IT_SPFLI-CITYFROM CP 'N*'.
           PERFORM FILL_CELL USING H 3 0 189111222 IT_SPFLI-CITYFROM.
         ELSE.
           PERFORM FILL_CELL USING H 3 0 111230222 IT_SPFLI-CITYFROM.
         ENDIF.
         IF IT_SPFLI-CITYTO CP 'S*'.
           PERFORM FILL_CELL USING H 4 0 200200200 IT_SPFLI-CITYTO.
         ELSEIF IT_SPFLI-CITYTO CP 'N*'.
           PERFORM FILL_CELL USING H 4 0 000111222 IT_SPFLI-CITYTO.
         ELSE.
           PERFORM FILL_CELL USING H 4 0 130230230 IT_SPFLI-CITYTO.
         ENDIF.
         IF IT_SPFLI-DEPTIME LT '020000'.
           PERFORM FILL_CELL USING H 5 0 145145145 IT_SPFLI-DEPTIME.
         ELSEIF IT_SPFLI-DEPTIME LT '120000' .
           PERFORM FILL_CELL USING H 5 0 015215205 IT_SPFLI-DEPTIME.
         ELSEIF IT_SPFLI-DEPTIME LT '180000' .
           PERFORM FILL_CELL USING H 5 0 000215205 IT_SPFLI-DEPTIME.
         ELSE.
           PERFORM FILL_CELL USING H 5 0 115115105 IT_SPFLI-DEPTIME.
         ENDIF.
       ENDLOOP.
    * EXCEL FILENAME
       CONCATENATE SY-REPID '_' SY-DATUM+6(2) '_' SY-DATUM+4(2) '_'
                   SY-DATUM(4) '_' SY-UZEIT '.XLS' INTO FILENAME.
       CALL METHOD OF H_MAP 'SAVEAS' EXPORTING #1 = FILENAME.
       FREE OBJECT H_EXCEL.
       PERFORM ERR_HDL.
    *       FORM FILL_CELL                                                *
    *       sets cell at coordinates i,j to value val boldtype bold       *
    FORM FILL_CELL USING I J BOLD COL VAL.

  • Excel file attachment to email with password protection

    Hi Experts,
    I have a req. to run an payroll interface and send the o/p to email ids as password protected excel attachment.
    Searched in the SDN and found the way to generate excel files with protection in presentation server. But as the job would be run in background, presentation server file will not help in this case.
    Please let me know if someone has come across with similar situation and have any solution. After many research and searching in SDN also I did not get any good solution. Please let me know if any of you have any solution.  
    Thanks & Regards,
    Manas

    Hey Manas,
    Try this.....
    -> [ Password protection for excel file - not urgent|Password protection for excel file - not urgent]
    -> [http://wiki.sdn.sap.com/wiki/display/Snippets/DownloadDataintoMultipleSheetExcelDocumentwithNonEditableColumns%28Passwordprotected%29UsingABAPOLE|http://wiki.sdn.sap.com/wiki/display/Snippets/DownloadDataintoMultipleSheetExcelDocumentwithNonEditableColumns%28Passwordprotected%29UsingABAPOLE]
    Hope it helps!!
    Thanks,
    Muktar

  • Send  XML as attachment in Email activity

    Hi
    My requirement is to send XML as an attachment through email .
    In the attachment if i select the MIME type as "XML" then no email notification is sent,
    but if i select the MIME type as "text/html" , then attachement is sent through email , but attachment is in different format( with no content inside attachment) .
    Can anyone help me on this .

    have you tried the example on this page : http://java.net/projects/oraclesoasuite11g/pages/Notification

  • Send HTML as attachment in email in Stored Procedure

    Hi Guys,
    I am writing a stored procedure to send HTML attachment. Below is my code but no html attachment sent in mail. Kindly advise.
    USE [CarsemERP]
    GO
    /****** Object: StoredProcedure [dbo].[DBA_CarsemERP_SQLBlocks] Script Date: 04/01/2015 15:14:15 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    -- =============================================
    -- Author: <THARMENDRAN>
    -- Create date: <2014FEB21>
    -- Description: TO CHECK ANY LOCKS MORE THN 20 SEC IN SQL SERVER
    -- =============================================
    ALTER PROCEDURE [dbo].[DBA_CarsemERP_SQLBlocks]
    AS
    BEGIN
    DECLARE @iCnt As Int
    DECLARE @ICnt2 As Int
    DECLARE @SendEmail AS VARCHAR(3)
    DECLARE @Temp_DetailReq1 TABLE (
    idx smallint Primary Key IDENTITY(1,1),
    DBName varchar(30), RequestId Int, BlockingId Int, BlockedObjectName varchar(30),LockType varchar(30), RequestingText varchar(max), BlockingText varchar(max),
    LoginName varchar (30), HostName varchar (30))
    DECLARE @Temp_DetailReq2 TABLE (
    idx smallint Primary Key IDENTITY(1,1),
    DBName varchar(30), RequestId Int, BlockingId Int, BlockedObjectName varchar(30),LockType varchar(30), RequestingText varchar(max), BlockingText varchar(max),
    LoginName varchar (30), HostName varchar (30))
    SET @SendEmail = 'NO'
    SELECT @iCnt= COUNT(*) FROM DBA_SQLBlocksViewTharmen
    IF @iCnt > 0
    BEGIN
    Insert Into @Temp_DetailReq1
    Select DBName, request_session_id, blocking_session_id, BlockedObjectName,resource_type, RequestingText, BlockingTest, LoginName, HostName From DBA_SQLBlocksViewTharmen
    END
    WAITFOR DELAY '00:00:20'
    select @iCnt2= COUNT(*) FROM DBA_SQLBlocksViewTharmen
    IF @iCnt2 > 0
    BEGIN
    DECLARE @columnHeaders NVARCHAR(MAX)
    DECLARE @tableHTML NVARCHAR(MAX)
    DECLARE @body NVARCHAR(MAX)
    Insert Into @Temp_DetailReq2
    Select DBName, request_session_id, blocking_session_id, BlockedObjectName,resource_type, RequestingText, BlockingTest, LoginName, HostName From DBA_SQLBlocksViewTharmen
    SET @SendEmail = 'YES'
    BEGIN
    SET @columnHeaders = 'DBName</th><th>RequestId</th><th>BlockingId</th><th>BlockedObjectName</th><th>LockType</th><th>RequestingText</th><th>BlockingText</th><th>LoginName</th><th>HostName'
    set @tableHTML =
    '<div><b>There is blocking in VERPSVR02-02.</b></div><br>' + -- This is the bold text at the top of your email
    '<table border="0" cellpadding="5"><font face="Calibri" size=2>' +
    '<tr><th>' + @columnHeaders + '</th></tr>' +
    convert(nvarchar(max),
    select td = [DBName], '', -- Here we put the column names
    td = [RequestId], '',
    td = [BlockingId], '',
    td = [BlockedObjectName], '',
    td = [LockType], '',
    td = [RequestingText], '',
    td = [BlockingText], '',
    td = [LoginName], '',
    td = [HostName], '' -- Here we put the column names
    from @Temp_DetailReq2
    for xml path('tr'), type)) +'</font></table>'
    END
    END
    IF @SendEmail = 'YES'
    BEGIN
    EXEC msdb.dbo.sp_send_dbmail
    @profile_name = 'MyDBMailProfileName',
    @recipients = '[email protected]',
    @body = 'Please refer the attachment' ,
    @body_format = 'HTML',
    @subject = 'Alert! Blocking On ERPSVR02-02 Live Server',
    @file_attachments = @tableHTML,
    @importance = 'High';
    END
    END

    Hi Guys,
    I need help on how to generated HTML as attachment to email. I have write below stored procedure but the html did not send as attachment. Kindly guide me on how to save the generated HTML as a file and send it as attachment.
    USE [CarsemERP]
    GO
    /****** Object: StoredProcedure [dbo].[DBA_CarsemERP_SQLBlocks] Script Date: 04/01/2015 15:14:15 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    -- =============================================
    -- Author: <THARMENDRAN>
    -- Create date: <2014FEB21>
    -- Description: TO CHECK ANY LOCKS MORE THN 20 SEC IN SQL SERVER
    -- =============================================
    ALTER PROCEDURE [dbo].[DBA_CarsemERP_SQLBlocks]
    AS
    BEGIN
    DECLARE @iCnt As Int
    DECLARE @ICnt2 As Int
    DECLARE @SendEmail AS VARCHAR(3)
    DECLARE @Temp_DetailReq1 TABLE (
    idx smallint Primary Key IDENTITY(1,1),
    DBName varchar(30), RequestId Int, BlockingId Int, BlockedObjectName varchar(30),LockType varchar(30), RequestingText varchar(max), BlockingText varchar(max),
    LoginName varchar (30), HostName varchar (30))
    DECLARE @Temp_DetailReq2 TABLE (
    idx smallint Primary Key IDENTITY(1,1),
    DBName varchar(30), RequestId Int, BlockingId Int, BlockedObjectName varchar(30),LockType varchar(30), RequestingText varchar(max), BlockingText varchar(max),
    LoginName varchar (30), HostName varchar (30))
    SET @SendEmail = 'NO'
    SELECT @iCnt= COUNT(*) FROM DBA_SQLBlocksViewTharmen
    IF @iCnt > 0
    BEGIN
    Insert Into @Temp_DetailReq1
    Select DBName, request_session_id, blocking_session_id, BlockedObjectName,resource_type, RequestingText, BlockingTest, LoginName, HostName From DBA_SQLBlocksViewTharmen
    END
    WAITFOR DELAY '00:00:20'
    select @iCnt2= COUNT(*) FROM DBA_SQLBlocksViewTharmen
    IF @iCnt2 > 0
    BEGIN
    DECLARE @columnHeaders NVARCHAR(MAX)
    DECLARE @tableHTML NVARCHAR(MAX)
    DECLARE @body NVARCHAR(MAX)
    Insert Into @Temp_DetailReq2
    Select DBName, request_session_id, blocking_session_id, BlockedObjectName,resource_type, RequestingText, BlockingTest, LoginName, HostName From DBA_SQLBlocksViewTharmen
    SET @SendEmail = 'YES'
    BEGIN
    SET @columnHeaders = 'DBName</th><th>RequestId</th><th>BlockingId</th><th>BlockedObjectName</th><th>LockType</th><th>RequestingText</th><th>BlockingText</th><th>LoginName</th><th>HostName'
    set @tableHTML =
    '<div><b>There is blocking in VERPSVR02-02.</b></div><br>' + -- This is the bold text at the top of your email
    '<table border="0" cellpadding="5"><font face="Calibri" size=2>' +
    '<tr><th>' + @columnHeaders + '</th></tr>' +
    convert(nvarchar(max),
    select td = [DBName], '', -- Here we put the column names
    td = [RequestId], '',
    td = [BlockingId], '',
    td = [BlockedObjectName], '',
    td = [LockType], '',
    td = [RequestingText], '',
    td = [BlockingText], '',
    td = [LoginName], '',
    td = [HostName], '' -- Here we put the column names
    from @Temp_DetailReq2
    for xml path('tr'), type)) +'</font></table>'
    END
    END
    IF @SendEmail = 'YES'
    BEGIN
    EXEC msdb.dbo.sp_send_dbmail
    @profile_name = 'MyDBMailProfileName',
    @recipients = '[email protected]',
    @body = 'Please refer the attachment' ,
    @body_format = 'HTML',
    @subject = 'Alert! Blocking On ERPSVR02-02 Live Server',
    @file_attachments = @tableHTML,
    @importance = 'High';
    END
    END

  • Not Able to send pdf as attachment through email

    Hi,
    I am trying to send the generated pdf as attachment throught email and for the same i am referring to this blog
    http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417100)ID1409662650DB01562818410448928630End?blog=/pub/wlg/8551
    but when i am trying to send the mail using the method given in this blog , i am getting this error
    com.sap.tc.adobe.pdfobject.core.PDFObjectRuntimeException: Processing exception during a "MergeData" operation. Request start time: Fri Dec 11 18:05:24 IST 2009 com.adobe.ProcessingException: PDF is not interactive. Data can only be imported into interactive forms. Exception Stack Trace: com.adobe.ProcessingException: PDF is not interactive
    and at the backend i am getting the error as
    #com.sun.mail.smtp.SMTPSendFailedException: 501 Bad address syntax
    Can any one please help me out with a solution ?? Any suggestions are welcomed
    Thanks a lot in advance

    Hi,
    Thanks for your reply , but i cannot set the enabled property of the form as true as we are not using the licensed version of the live cycle designer . But if i try the example step by step then even by setting the enabled property as false , the pdf is generated and sent through the email and when i am trying to do the same thing in one of my applications its not working . The pdf is generated but as soon as i click on the button send mail the above told error is displayed .
    There needs to be some other explaination for the error

  • How to send file as attachment in Email in Oracle UCM

    Hi All,
    I have created a simple html form which executes my custom service( internally calls java method) to send a email "forms data" to the user. I need to send file as attchment in email so how i can do it in oracle ucm.Currently i am using intradoc api.I am using a jquery plugin for sending forms data including uploaded file.
    function which i am using in java for sending emails:-
    InternetFunctions.sendMailTo(emailStr, "MyMail", subject, this.m_service);
    I have set method="post" and enctype="multipart/form-data" in the form
    So plz help to provide a solution to send a file as attchment in email
    Thanks,
    user9018217

    From what I remember, there isn't an "out of the box" solution since InternetFunctions only provides some basic email functions (try decompiling the class to see what's available).
    Here's the link for the original Stellent 10gR3 sample components: http://www.oracle.com/technetwork/middleware/content-management/index-092832.html. Take a look at the AcmeMail component within the HowTo Components sample. It shows how to create a custom idcservice that sends basic emails. You can use that as a baseline for creating your own email service and then use something like JavaMail to implement attachments. That's what I did.
    Good luck, and please award points as necessary.

  • Send Output as attachment to email address

    Hi friends,
    My requirement is to send the Output as attachment to a specific email address.
    I have created a new output type and using transmission medium as External Send.
    If I use SH/BP/SP it is picking the mail address and working fine.
    Now my requirement is to send to fixed standard email address irrelevant of document.
    Can anyone help me to explain how can I achieve this by setting in Parner functions of that output type?
    I dont want to add any parner function in partner determination.
    Thanks in advance.
    Rgds,
    AK

    Hi there,
    Define a new customized Z table & maintain the required mail ids in the table.
    in the O/p processing prog, call the Z table & send the mail to the mail ids mentioned in it.
    For formality, assign the O/p to an partner function in your condition records.
    Regards,
    Sivanand

  • Problem in sending CSV as attachment in email

    Hi All,
    I'm working on ECC 5.0. I have an internal table with the data. I have to send this data as an attachment in an email. I sending a sample code which i used. When i try to open the attachment it is giving as warning popup 'File type is not recognized' and also the entire record in coming in the first column only.
    *& Report  ZTEST_EMAIL_SEND_ATTACH_PDF
    REPORT  ZTEST_EMAIL_SEND_ATTACH_PDF.
    class CL_ABAP_CHAR_UTILITIES definition load.
    constants:v_nl type ABAP_CHAR1 value CL_ABAP_CHAR_UTILITIES=>newline,
         v_ht type ABAP_CHAR1 value CL_ABAP_CHAR_UTILITIES=>horizontal_TAB,
         v_bs type ABAP_CHAR1 value CL_ABAP_CHAR_UTILITIES=>CR_LF.
    data: begin of i_records occurs 0,
            data(30) type c,
            reason(225) type c,
          end of i_records.
    DATA: v_dest LIKE tsp01-rqdest,
          v_handle LIKE sy-tabix,
          v_spool_id LIKE tsp01-rqident,
          v_rc TYPE c,
          v_errmessage(100) TYPE c,
          v_text(200) TYPE c,
          i_pdf type standard table of tline.
    DATA: OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
    START-OF-SELECTION.
    i_records-data = '1002'.
    i_records-reason = 'date is empty'.
    append i_records.
    clear i_records.
    i_records-data = '1005'.
    i_records-reason = 'time is empty'.
    append i_records.
    clear i_records.
    loop at i_records.
    concatenate i_records-data i_records-reason into objbin-line separated by ','.
    concatenate v_nl objbin-line into objbin-line.
    append objbin.
    clear: i_records, objbin.
    endloop.
    perform f_mail_send.
    *&      Form  f_mail_send
          text
    -->  p1        text
    <--  p2        text
    form f_mail_send .
    DATA: i_email TYPE TABLE OF somlreci1 WITH HEADER LINE,
          i_mess TYPE TABLE OF solisti1 WITH HEADER LINE,
          w_subject TYPE so_obj_des,
         w_name TYPE so_obj_nam.
          w_name TYPE char30.
    i_email-receiver = '[email protected]'.
    APPEND i_email.
    i_mess-line = 'This is a test message. Customer Statements'.
    APPEND i_mess.
    w_name = 'Statements_345594_344455_conv'.
    w_subject = 'Your Customer Statement for'.
    PERFORM send_mail_out_raw TABLES i_email
                                     i_mess
                              USING  w_subject
                                     w_name.
    endform.                    " f_mail_send
    *&      Form  send_mail_out_raw
          text
         -->PI_EMAIL   text
         -->PI_MESS    text
         -->PI_PDF     text
         -->PV_SUBJECT text
         -->PV_NAME    text
    FORM send_mail_out_raw TABLES pi_email STRUCTURE somlreci1
                                  pi_mess STRUCTURE solisti1 "Message
                            USING pv_subject TYPE so_obj_des
                                  pv_name TYPE char30.
      DATA :
        li_receivers TYPE STANDARD TABLE OF somlreci1,
        li_head TYPE STANDARD TABLE OF solisti1,
        li_packing_list TYPE STANDARD TABLE OF sopcklsti1,
        li_pdf TYPE STANDARD TABLE OF solisti1.
      DATA : lst_doc_data TYPE sodocchgi1,
             lw_lines    TYPE i,
             lw_name(34) TYPE c,
             lw_subject TYPE sodocchgi1-obj_descr.
      DATA : lst_pemail TYPE somlreci1,
             lst_pmess TYPE solisti1,
             lst_receivers TYPE somlreci1,
             lst_head TYPE solisti1,
             lst_packing_list TYPE sopcklsti1,
             lst_mess TYPE solisti1.
      lw_subject = pv_subject.
      lw_name = pv_name.
      CONCATENATE lw_name '.csv' INTO lw_name.
      CONDENSE lw_name NO-GAPS.
    Fill the email content
      DESCRIBE TABLE pi_mess LINES lw_lines.
    Populate the subject/generic message attributes
      lst_doc_data-obj_langu = sy-langu.
      lst_doc_data-obj_name  = lw_name.
      lst_doc_data-obj_descr = lw_subject.
      READ TABLE pi_mess INTO lst_mess INDEX lw_lines.
      lst_doc_data-doc_size = ( lw_lines - 1 ) * 255 +
                              STRLEN( lst_mess ).
    Describe the body of the message
      REFRESH li_packing_list.
      lst_packing_list-transf_bin = space.
      lst_packing_list-head_start = 1.
      lst_packing_list-head_num = 0.
      lst_packing_list-body_start = 1.
      lst_packing_list-body_num = lw_lines.
      lst_packing_list-doc_type = 'RAW'.
      lst_packing_list-doc_size = ( lw_lines - 1 ) * 255 +
                                  STRLEN( lst_mess ).
      APPEND lst_packing_list TO li_packing_list.
      CLEAR lst_packing_list.
    Create attachment
      CLEAR lw_lines.
      DESCRIBE TABLE objbin LINES lw_lines.
      lst_packing_list-transf_bin = 'X'.
      lst_packing_list-head_start = 1.
      lst_packing_list-head_num   = 1.
      lst_packing_list-body_start = 1.
      lst_packing_list-body_num   = lw_lines.
      lst_packing_list-doc_type   =  'CSV'.
      lst_packing_list-obj_descr  =  lw_subject.
      lst_packing_list-obj_name   =  lw_name.
      lst_packing_list-doc_size   =  ( lw_lines ) * 255.
      APPEND lst_packing_list TO li_packing_list.
    Header
      REFRESH li_head.
      CLEAR lst_head. REFRESH li_head.
      lst_head-line = lw_name. APPEND lst_head TO li_head.
    Add the recipients email address
      REFRESH li_receivers.
      LOOP AT pi_email INTO lst_pemail.
        lst_receivers-receiver = lst_pemail-receiver.
        lst_receivers-rec_type = 'U'.
        lst_receivers-com_type = 'INT'.
        APPEND lst_receivers TO li_receivers.
        CLEAR lst_receivers.
      ENDLOOP.
    *Send mail to external address
    CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
       EXPORTING
         document_data              = lst_doc_data
         put_in_outbox              = 'X'
         commit_work                = 'X'
       TABLES
         packing_list               = li_packing_list
         object_header              = li_head
         contents_bin               = objbin
         contents_txt               = pi_mess
         receivers                  = li_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.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data                   = lst_doc_data
         PUT_IN_OUTBOX                    = 'X'
         COMMIT_WORK                      = 'X'
      IMPORTING
        SENT_TO_ALL                      =
        NEW_OBJECT_ID                    =
        tables
          packing_list                     = li_packing_list
         OBJECT_HEADER                    = li_head
         CONTENTS_BIN                     = objbin
         CONTENTS_TXT                     = pi_mess
        CONTENTS_HEX                     =
        OBJECT_PARA                      =
        OBJECT_PARB                      =
          receivers                        = li_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 .
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "Send_mail
    Sai

    Hi sai,
    1. I just tried it now.
    2. And it works ok now.
    3. Just make 2 corrections.
      a) replace your definition of new_line with.
    <b>constants:v_nl(2) type c value CL_ABAP_CHAR_UTILITIES=>CR_LF,</b>
    b) Instead of using    concatenate v_nl objbin-line into objbin-line.
       use
    <b>  concatenate  objbin-line v_nl into objbin-line.</b>
    regards,
    amit m.

  • Send Excel as attachment in SAP

    Hello All,
    My requirement is to send a mail with the contents of an ALV once it is displayed on the screen. This is working fine. Now the users want that 3 fields Quantity,NETPR and NETWR fields should send data to excel with 0,3 and 2 decimal places. We are able to display the same in ALV but when the data is sent as excel attachment in some cells it is text and in some it is number causing it to display the same for some records. Is there a way to get the out similar to the one we get via Export to spreadsheet in ALV ?
    Note the user needs the file to be XLS and we can not use ' in front of these fields to convert them to text for display purpose.
    Any suggestions are welcome.
    Thanks and Regards
    Sachin

    Please check
    [http://wiki.sdn.sap.com/wiki/display/Snippets/FormattedExcelasEmailAttachment]
    Nabheet

  • Upload a .xls file and send it as attachment on email

    Hi guys,
    I have a program that creates a .xls file using the function module call method cl_gui_frontend_services=>gui_download. I've been trying to upload the file as an attachment to send it via email but still haven't found a way to do this task.
    Appreciate your help,
    Thanks 

    Hi Orlando,
    convert content to Hex format then,
    lw_document = cl_document_bcs=>create_document(
               i_type    = 'RAW / HTM'
               i_text    = lw_main_text
               i_subject = lw_subject ).
          w_document->add_attachment(
             i_attachment_type    = 'XLS'
             i_attachment_subject = lw_att_sub
             i_att_content_text   = p_int_soli[]
             i_att_content_hex    = p_int_solix[] ).
    w_int_address = lw_smtp-low.
                 w_camuser = cl_cam_address_bcs=>create_internet_address( w_int_address ).
                 w_recipient = w_camuser.
    thanks,
    Anil

Maybe you are looking for

  • Need to disable script or ActiveX control in WebHelp project

    Two of our WebHelp projects display the following two messages prior to loading the first page: 1) "To help protect your security, Internet Explorer has restricted this file form showing active content that could access your computer. Click here for

  • Troubleshooting Photo Stream on Apple TV

    I've created a Photo Stream in I-Photo on a Mac Book Pro.  I've turned on "File Sharing" in I-Tunes and have selected "Photo Stream" (under column heading "Events") under "Choose Photos to Share".  When I try to view on Apple TV only the first photo

  • Identify missing files ("The file could not be opened")

    Hello, I purposely deleted photos outside of LR. The photos are still in the catalog. When I attempt to develop a photo in the catalog which I forgot was deleted outside of LR the message "The file could not be opened" appears after a short delay. Th

  • FM8.0 Internal Memory error

    Hi, I have developed a custom client plug-in that converts structured FM documents into xml files. Normal files containing character is working fine but if any fm document that contains graphics file and my client app is try to convert into xml it gi

  • SAP Upgrade - Features

    Hi, We are working in a sap upgrade project ECC 5.0 to ECC6.0. We have found a issue in the features ( PE03) after the upgrade of the dev system. The modifications done to the features has now been overwritten by sap. eg: The dates maintained in the