Mail Excel as attachment with input as binary string

Hi Experts ,
I want to design BAPI which will have one string as import parameter.
I will get binary data in this string.
Now i want to mail this binary data string as excel attachment.
Anyody knows how to convert this binary string to internal table and then send this as attachment?
Thanks & Regards ,
JIgar.

check these sample programs
BCS_EXAMPLE*

Similar Messages

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

  • Mail having HTML attachment with images

    I am having a problem that when I send a mail which has an attachment report in html format that contains images, the resulting mail does not show the name of HTML attachment filename, even though it contains it
    Message-ID: <1236342.1033132049637.JavaMail.insoft@ins-2k>
    Date: Fri, 27 Sep 2002 14:06:49 +0100 (BST)
    From: [email protected]
    To: [email protected]
    Subject: This is your subject
    Mime-Version: 1.0
    Content-Type: multipart/mixed; boundary="----=_Part_0_2584319.1033132009259"
    X-Mailer: ins
    ------=_Part_0_2584319.1033132009259
    Content-Type: text/html
    Content-Transfer-Encoding: 7bit
    Content-Disposition: inline
    ------=_Part_0_2584319.1033132009259
    Content-Type: multipart/related; name="Report Containing Chart.html";
         boundary="----=_Part_1_2352159.1033132048786"
    Content-Description: this is my related part attachment
    Content-Disposition: attachment; filename="Report Containing Chart.html"
    ------=_Part_1_2352159.1033132048786
    Content-Type: text/html; name="Report Containing Chart.html"
    Content-Transfer-Encoding: quoted-printable
    Content-ID: ttt
    Content-Disposition: attachment; filename="Report Containing Chart.html"
    ------=_Part_1_2352159.1033132048786
    Content-Type: image/png
    Content-Transfer-Encoding: base64
    Content-Disposition: attachment
    Content-ID: attach_1
    Content-Location: cid:attach_1
    Content-Length: 1750
    // thats how it build up
    MimeBodyPart relParent = new MimeBodyPart();
       MimeMultipart relatedBodypart = new MimeMultipart("related");
       MimeBodyPart mainBodypart = new MimeBodyPart();
       mainBodypart.setContent("my html report in text form", "text/html");
       relatedBodypart.addBodyPart(mainBodypart);
       MimeBodyPart inBodyPart = new MimeBodyPart();
       inBodyPart.setDataHandler(new DataHandler(bds));
       relatedBodypart.addBodyPart(inBodyPart);
    relParent.setContent(relatedBodypart);
    relParent.setFileName(relAtt.getName());
    relParent.setDisposition(BodyPart.ATTACHMENT);
    // am i missing something here

    You are getting your file attached correctly, but you still need to reference it within your HTML text so it will be displayed. You can do this with the cid (content-id) tag. Something like this should work:
    <img src="cid:attach_1">
    "attach_1" can be any name you specify when you attach the file to the message.
    Hope this helps.
    --Rick                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • ABAP solution to read data from excel file attached with project document

    i have a project created through tcode cj20n and attach an excel file with it. now my objective is to read the contents of that attach file through abap. can any one please help me in this matter? how can i know the path of that file?

    Hi,
    you can't do it in 30 minutes if you never did before.
    Use[ DOI |http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCIOFFI/BCCIOFFI.pdf]
    Regards,
    Clemens

  • Creating an e-mail with excel file attachment

    Morning,
    Does anyone know how to create an e-mail with a spreadsheet attachment (in foreground and background). I can create an e-mail (in foreground and background) with a text (tab delimited) file attachment with a suffix of .xls. I have created the file by writing text to a string and then putting it into a text format using the function module SCMS_STRING_TO_FTEXT.
    Thanks and regards
    John.

    See the following simple ex:
    DATA: P_EMAIL TYPE SOMLRECI1-RECEIVER.
    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.
    DATA: IT_ATTACH TYPE STANDARD TABLE OF SOLISTI1 INITIAL SIZE 0
    WITH HEADER LINE.
    DATA: IT_MESSAGE TYPE STANDARD TABLE OF SOLISTI1 INITIAL SIZE 0
    WITH HEADER LINE.
    ***Sending mail to the receipients
      if not it_final[] is initial.
        PERFORM SUB_GET_MAIL_ADDR.
    Populate table with detaisl to be entered into .xls file
        PERFORM BUILD_XLS_DATA_TABLE.
        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
        'Sales Register Report - Set Top Box / Accessories'
        'XLS'
        'SSTB'
        CHANGING GD_ERROR
        GD_RECIEVER.
    Instructs mail send program for SAPCONNECT to send email(rsconn01)
        PERFORM INITIATE_MAIL_EXECUTE_PROGRAM.
      endif.
    *&      Form  BUILD_XLS_DATA_TABLE
          text
    -->  p1        text
    <--  p2        text
    FORM BUILD_XLS_DATA_TABLE .
      data: wa_itab like it_final.
      CONSTANTS:
      CON_TAB TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
      CON_CRET TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF.
      CONCATENATE 'Business Place' 'Region Code' 'Region' 'Branch Code'
                  'Branch' 'Material Desc' 'Area off Code'
                  'Area Name' 'Zone code' 'Zone Name' 'Cust No' 'Cust Name'
                  'Bill Doc No' 'Bill Date' 'Base Val' 'Total Val' 'Quantity'
      INTO IT_ATTACH SEPARATED BY CON_TAB.
      CONCATENATE CON_CRET IT_ATTACH INTO IT_ATTACH.
      APPEND IT_ATTACH.
      LOOP AT IT_FINAL INTO WA_ITAB.
        CONCATENATE   WA_ITAB-BUSINESS_PLACE
                  WA_ITAB-KVGR1
                  WA_ITAB-REGION
                  WA_ITAB-VKBUR
                  WA_ITAB-SALES_OFF
                  WA_ITAB-ARKTX
                  WA_ITAB-vkgrp
                  WA_ITAB-sales_grp
                  WA_ITAB-bzirk
                  WA_ITAB-zone
                  WA_ITAB-kunnr
                  WA_ITAB-name
                  WA_ITAB-vbeln
                  WA_ITAB-fkdat
                  WA_ITAB-base_value
                  WA_ITAB-total_value
                  WA_ITAB-fkimg
        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  POPULATE_EMAIL_MESSAGE_BODY
          text
    -->  p1        text
    <--  p2        text
    FORM POPULATE_EMAIL_MESSAGE_BODY .
      REFRESH IT_MESSAGE.
      CONCATENATE SY-DATUM6(2) '/' SY-DATUM4(2) '/' SY-DATUM+0(4) INTO G_DATE.
      IT_MESSAGE = 'Please find attached excel sheet.'.
      APPEND IT_MESSAGE.
      IT_MESSAGE = 'Report'.
      APPEND IT_MESSAGE.
      Concatenate 'Report generated date' ':' G_Date '.' into IT_MESSAGE.
      APPEND IT_MESSAGE.
      clear it_message.
      append it_message.
      IT_MESSAGE = 'This is an autogenerated mail, please do not reply'.
      APPEND IT_MESSAGE.
    ENDFORM.                    " POPULATE_EMAIL_MESSAGE_BODY
    *& 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.
      T_PACKING_LIST-OBJ_NAME = 'stb'.
      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-DOC_TYPE = 'XLS'.
    T_PACKING_LIST-OBJ_DESCR = LD_ATTDESCRIPTION.
      T_PACKING_LIST-OBJ_DESCR = 'Sales_STB'.
    T_PACKING_LIST-OBJ_NAME = LD_ATTFILENAME.
      T_PACKING_LIST-OBJ_NAME = 'stb'.
      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.
      LOOP AT IT_RECV.
        T_RECEIVERS-RECEIVER = IT_RECV-EMAIL.
        T_RECEIVERS-REC_TYPE = 'U'.
       T_RECEIVERS-COM_TYPE = 'INT'.
    T_RECEIVERS-COPY = 'X'.
       T_RECEIVERS-NOTIF_DEL = 'X'.
       T_RECEIVERS-NOTIF_NDEL = 'X'.
        APPEND T_RECEIVERS.
      ENDLOOP.
      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.                    "SEND_FILE_AS_EMAIL_ATTACHMENT
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
          text
    -->  p1        text
    <--  p2        text
    FORM INITIATE_MAIL_EXECUTE_PROGRAM .
      WAIT UP TO 2 SECONDS.
      SUBMIT RSCONN01 WITH MODE = 'INT'
      WITH OUTPUT = ''
      AND RETURN.
    ENDFORM.                    " INITIATE_MAIL_EXECUTE_PROGRAM

  • To Send HTML Format and excel file attachment  in same mail

    Dear All,
            Have requerment ,to send a mail options HTML table format and same data in excel file attachement.have capable to do the html format using methods BCS .but how to send excel format attachment in same  mail.
    Please guide me how to do it.
    Regards ,
    Santhu
    Edited by: santosh jajur on Apr 9, 2010 1:54 PM

    Santhosh,
    please check the code:
    report bcs_example_7.
    This report provides an example for sending an Excel
    attachment in Unicode Systems
    constants:
      gc_tab  type c value cl_bcs_convert=>gc_tab,
      gc_crlf type c value cl_bcs_convert=>gc_crlf.
    parameters:
      mailto type ad_smtpadr
       default 'ur mail id'.                    "#EC *
    data send_request   type ref to cl_bcs.
    data document       type ref to cl_document_bcs.
    data recipient      type ref to if_recipient_bcs.
    data bcs_exception  type ref to cx_bcs.
    data main_text      type bcsy_text.
    data binary_content type solix_tab.
    data size           type so_obj_len.
    data sent_to_all    type os_boolean.
    start-of-selection.
      perform create_content.
      perform send.
    form send.
      try.
          send_request = cl_bcs=>create_persistent( ).
        create document object from internal table with text
          append 'Hello world!' to main_text.                   "#EC NOTEXT
          document = cl_document_bcs=>create_document(
            i_type    = 'RAW'
            i_text    = main_text
            i_subject = 'Test Created By BCS_EXAMPLE_7' ).      "#EC NOTEXT
        add the spread sheet as attachment to document object
          document->add_attachment(
            i_attachment_type    = 'xls'                        "#EC NOTEXT
            i_attachment_subject = 'ExampleSpreadSheet'         "#EC NOTEXT
            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( mailto ).
        add recipient object to send request
          send_request->add_recipient( recipient ).
        ---------- send document ---------------------------------------
          sent_to_all = send_request->send( i_with_error_screen = 'X' ).
          commit work.
          if sent_to_all is initial.
            message i500(sbcoms) with mailto.
          else.
            message s022(so).
          endif.
      endtry.
    endform.                    "send
    form create_content.
      data lv_string type string.
      data ls_t100 type t100.
    columns are separated by TAB and each line ends with CRLF
      concatenate 'This Is Just Example Text!'                  "#EC NOTEXT
                  gc_crlf gc_crlf
                  into lv_string.
    header line
      concatenate lv_string
                  'MSGID'    gc_tab
                  'MSGNO'    gc_tab
                  'Language' gc_tab                             "#EC NOTEXT
                  'Text'     gc_crlf                            "#EC NOTEXT
                  into lv_string.
    data lines
      select * from t100 into ls_t100
        where arbgb = 'SO' and msgnr = '182'.
        concatenate lv_string
                    ls_t100-arbgb gc_tab
                    ls_t100-msgnr gc_tab
                    ls_t100-sprsl gc_tab
                    ls_t100-text  gc_crlf
                    into lv_string.
      endselect.
      select * from t100 into ls_t100
        where arbgb = 'SO' and msgnr = '316'.
        concatenate lv_string
                    ls_t100-arbgb gc_tab
                    ls_t100-msgnr gc_tab
                    ls_t100-sprsl gc_tab
                    ls_t100-text  gc_crlf
                    into lv_string.
      endselect.
      try.
          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.
    endform.                    "create_content
    Thanks.

  • Urgent: Sending an Email with Excel sheet attachment

    Hi All,
    I am preparing a report and has to send mail with excel sheet attachement. In report i am getting everything fine. But in the mail i am not getting the data, data is passing to the FM succesfully. But in the mail, excel is not having full data.
    the below mentioned is my code.
    i_texts-line = c_stern.
      i_texts-line+254(1) = c_newline.
      APPEND i_texts.
      LOOP AT i_texc.
        i_att_line-line = i_texc.
        APPEND i_att_line.
      ENDLOOP.
      DATA: wa_doc_chng LIKE sodocchgi1.
      DATA: w_tab_lines LIKE sy-tabix.
      STATICS: c_body_start TYPE i VALUE '1'.
      CONSTANTS: lc_filename(10) TYPE c VALUE 'Attachment',
                 lc_atthead(30)  TYPE c VALUE 'Manually released invoices'.
      DATA: i_objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
      DATA: w_doc_name(30) TYPE c.
      DATA: l_text1(15),
            l_text2(12),
            l_text3(15),
            l_text4(15),
            l_text5(14),
            l_text6(17),
            l_text7(10),
            l_text8(20),
            l_text9(19),
            l_text10(19),
            l_text11(19),
            l_text12(16),
            l_text13(20),
            l_text14(19),
            l_text15(19),
            l_text16(30).
      DATA: DATE(10),
            DT(2),
            MON(3),
            YR(4),
            lc_final(50).
      CLEAR: i_texts, i_reci,i_att_line.                "i_bname,
      REFRESH: i_texts, i_reci,i_att_line.              "i_bname,
      WRITE sy-datum TO w_datex.
      WRITE sy-uzeit TO w_timex.
      l_text1 = text-003.
      l_text2 = text-004.
      l_text3 = text-005.
      l_text4 = text-006.
      l_text5 = text-007.
      l_text6 = text-008.
      l_text7 = text-009.
      l_text8 = text-010.
      l_text9 = text-011.
      l_text10 = text-012.
      l_text11 = text-013.
      l_text12 = text-014.
      l_text13 = text-015.
      l_text14 = text-016.
      l_text15 = text-017.
      l_text16 = text-026.
      CONCATENATE
      l_text1
      l_text2
      l_text3
      l_text4
      l_text5
      l_text6
      l_text7
      l_text8
      l_text9
      l_text10
      l_text11
      l_text12
      l_text13
      l_text14
      l_text15
      l_text16
      INTO i_texts SEPARATED BY
      c_horz_tab.
      i_texts-line+254(1) = c_newline.
      APPEND i_texts.
      CLEAR  i_texts.
      LOOP AT i_texc.
        i_att_line-line = i_texc.
        APPEND i_att_line.
      ENDLOOP.
      LOOP AT so_rec.
        i_reci-receiver = so_rec-low.
        i_reci-express = 'X'.
        i_reci-rec_type = 'U'.
        APPEND i_reci.
      ENDLOOP.
      DESCRIBE TABLE i_texts LINES w_tab_lines.
      READ TABLE i_texts INDEX w_tab_lines.
      wa_doc_chng-doc_size = ( w_tab_lines - 1 ) * 255 + STRLEN( i_texts ).
      wa_obj_name   = 'ZFI_XX_REL_BLOCKED_INVOICE_01'.
      DT  = SY-DATUM+6(2).
      MON = SY-DATUM+4(2).
      YR  = SY-DATUM+0(4).
      CONCATENATE DT MON YR INTO DATE SEPARATED BY '-'.
      CONCATENATE lc_atthead date into lc_final separated by ' '.
      MOVE lc_final
                   TO wa_obj_descr .
      wa_doc_chng-obj_name  = wa_obj_name.
      wa_doc_chng-obj_descr = wa_obj_descr.
      CLEAR i_objpack-transf_bin.
      i_objpack-head_start = 1.
      i_objpack-head_num = 0.
      i_objpack-body_start = 0.
      i_objpack-body_num = w_tab_lines.
      i_objpack-doc_type = 'RAW'.
      APPEND i_objpack.
      APPEND LINES OF i_att_line TO i_texts.
      LOOP AT i_arseg INTO wa_arseg.
        i_xmplt_d-belnr = wa_arseg-belnr.
        i_xmplt_d-budat = wa_arseg-budat.
        i_xmplt_d-bukrs = wa_arseg-bukrs.
        i_xmplt_d-lifnr = wa_arseg-lifnr.
        i_xmplt_d-name1_lifnr = wa_arseg-name1_lifnr.
        i_xmplt_d-wrbtr = wa_arseg-wrbtr.
        i_xmplt_d-waers = wa_arseg-waers.
        i_xmplt_d-ebeln = wa_arseg-ebeln.
        i_xmplt_d-ebelp =  wa_arseg-ebelp.
        i_xmplt_d-reason = wa_arseg-reason.
        i_xmplt_d-dmeng = wa_arseg-dmeng.
        i_xmplt_d-dwert = wa_arseg-dwert.
        i_xmplt_d-bname = wa_arseg-bname.
        i_xmplt_d-name_text = wa_arseg-name_text.
        i_xmplt_d-udate = wa_arseg-udate.
        i_xmplt_d-comment =  wa_arseg-comment.
        APPEND i_xmplt_d.
      ENDLOOP.
      LOOP AT i_xmplt_d.
        CONCATENATE i_xmplt_d-belnr
                    i_xmplt_d-budat
                    i_xmplt_d-bukrs
                    i_xmplt_d-lifnr
                    i_xmplt_d-name1_lifnr
                    i_xmplt_d-wrbtr
                    i_xmplt_d-waers
                    i_xmplt_d-ebeln
                    i_xmplt_d-ebelp
                    i_xmplt_d-reason
                    i_xmplt_d-dmeng
                    i_xmplt_d-dwert
                    i_xmplt_d-bname
                    i_xmplt_d-name_text
                    i_xmplt_d-udate
                    i_xmplt_d-comment
                    INTO i_texts SEPARATED
                    BY c_horz_tab.
        i_texts-line+254(1) = c_newline.
        APPEND i_texts.
        CLEAR i_texts.
      ENDLOOP.
      DESCRIBE TABLE i_texts LINES w_tab_lines.
      READ TABLE i_texts INDEX w_tab_lines.
      wa_doc_chng-doc_size = ( w_tab_lines - 1 ) * 255 + STRLEN( i_texts ).
      DESCRIBE TABLE i_texts LINES w_tab_lines.
      i_objpack-transf_bin = ' '.
      i_objpack-head_start = 0.
      i_objpack-head_num = 0.
      i_objpack-body_start = 1.
      i_objpack-body_num = w_tab_lines.
      i_objpack-doc_type = 'XLS'.
      i_objpack-obj_name = 'Attachment'.
    i_objpack-obj_descr = w_doc_name.
      i_objpack-obj_descr = lc_filename.
      i_objpack-doc_size = w_tab_lines * 255.
      APPEND i_objpack.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = wa_doc_chng
        TABLES
          packing_list               = i_objpack
          contents_txt               = i_texts
          receivers                  = i_reci
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          operation_no_authorization = 4
          OTHERS                     = 99.
      IF sy-subrc = 0.
        COMMIT WORK.
      ELSE.
        WRITE: / 'Error in send E-Mail' .
      ENDIF.
    please revert me asap. It is very urgent to me. thanks in advance.
    Bye

    hI
    Have you build your Excel Data table to get attachement in Mail? If no then please find the Eg. code for your reference to send Excel attachment..
    * End of Selection Event : Displaying the selected data                *
    END-OF-SELECTION.
        PERFORM EMAIL_EXCEL_ATTACHMENT.
    ******///form
    FORM EMAIL_EXCEL_ATTACHMENT .
    * Populate table with detaisl to be entered into .xls file
      PERFORM BUILD_XLS_DATA_TABLE.
    * 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 S_EMAIL
                                          TEXT-042
                                          C_XLS
                                          'filename'
                                 CHANGING GD_ERROR
                                          GD_RECIEVER.
    *   Instructs mail send program for SAPCONNECT to send email(rsconn01)
      PERFORM INITIATE_MAIL_EXECUTE_PROGRAM.
    ENDFORM.                    " EMAIL_EXCEL_ATTACHMENT
    ********///form BUILD_XLS_DATA_TABLE
    FORM BUILD_XLS_DATA_TABLE .
      DATA :    LV_NETWR(20)     TYPE C,
                LV_BOL_DATE(20)  TYPE C,
                LV_KAWRT(20)     TYPE C,
                LV_FKDAT(20)     TYPE C,
                LV_WAERK(20)     TYPE C,
                LV_KURRF(20)     TYPE C,
                LV_SHIPDATE(20)  TYPE C,
                LV_DEPTDATE(20)  TYPE C.
      CONSTANTS:
          CON_TAB  TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
          CON_CRET TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF.  "#EC *
      DATA STR TYPE STRING.
    **********/ this parameter concatenate to get headers
      CONCATENATE STR
      'SLNO'
      'OWNER'
      'SERIAL NO'
      'FROM'
      'DESTINATION'
      'INVOICE VALUE'
      'DESCRIPTION'
      'CUSTOMER NAME'
      'BL NUMBER'
      'BL DATE'
      'VESSEL NAME/AIRLINE DETAILS'
      'MODE OF TRANSIT'
      'SHIPPING MARKS'
      'DUTY SUM INSURED'
      'FLAG'
      'OPEN COVERNO'
      'INVOICE DATE'
      'INVOICE NO'
      'LC WORDING'
      'QUANTITY'
      'PACKAGING DETAILS'
      'BASIS OF VALUATION'
      'EXCLUDE WAR SRCC'
      'CURRENCY'
      'EXCHANGE RATE'
      'ADDRESS'
      'VESSEL BUILT YEAR'
      'VESSEL FLAG'
      'VOYAGE NO'
      'SHIPMENT DATE'
      'DEPARTURE DATE'
      'SURVEYOR COUNTRY'
      'SURVEYOR CITY'
      'SURVEYOR AGENT'
      'SURVEYOR ADDRESS'
      'EXPORT CONSIGNMENT'
      'CONTAINER DETAILS'
      CL_ABAP_CHAR_UTILITIES=>CR_LF INTO STR SEPARATED BY CON_TAB.
      LOOP AT IT_FINAL.
    *******/ this is to pass body / row data
        WRITE : IT_FINAL-NETWR    TO LV_NETWR,              "#EC UOM_IN_MES
                IT_FINAL-BOL_DATE TO LV_BOL_DATE,
                IT_FINAL-KAWRT    TO LV_KAWRT,              "#EC UOM_IN_MES
                IT_FINAL-FKDAT    TO LV_FKDAT,
                IT_FINAL-WAERK    TO LV_WAERK,
                IT_FINAL-KURRF    TO LV_KURRF,
                IT_FINAL-SHIPDATE TO LV_SHIPDATE,
                IT_FINAL-DEPTDATE TO LV_DEPTDATE.
        CONCATENATE
               STR
               IT_FINAL-SLNO
               IT_FINAL-OWNER
               IT_FINAL-SRNO
               IT_FINAL-PORT_LOAD
               IT_FINAL-PORT_DSCHR
               LV_NETWR
               IT_FINAL-DESCRIP
               IT_FINAL-CUSTNAME
               IT_FINAL-BOL_NUM
               LV_BOL_DATE
               IT_FINAL-VESSELNAME
               IT_FINAL-SHP_TYPE
               IT_FINAL-SHP_MARK
               LV_KAWRT
               IT_FINAL-FLAG
               IT_FINAL-OPEN_CONO
               LV_FKDAT
               IT_FINAL-VBELN
               IT_FINAL-LC_WORD
               IT_FINAL-QUANT
               IT_FINAL-PACKDETL
               IT_FINAL-INCO1
               IT_FINAL-EXCWSR
               LV_WAERK
               LV_KURRF
               IT_FINAL-ADDPAY
               IT_FINAL-VESSBYR
               IT_FINAL-VESSFLG
               IT_FINAL-VOY_FLY_NO
               LV_SHIPDATE
               LV_DEPTDATE
               IT_FINAL-SURCOUNT
               IT_FINAL-INCO2
               IT_FINAL-EXPORT_CON
               IT_FINAL-SURAGT
               IT_FINAL-SURADD
               IT_FINAL-CONTRNO
       CL_ABAP_CHAR_UTILITIES=>CR_LF INTO STR SEPARATED BY CON_TAB.
      ENDLOOP.
      CALL FUNCTION 'SCMS_STRING_TO_FTEXT'
        EXPORTING
          TEXT      = STR
        TABLES
          FTEXT_TAB = IT_ATTACH.
    ENDFORM.                    " BUILD_XLS_DATA_TABLE
    ******// form POPULATE_EMAIL_MESSAGE_BODY
    FORM POPULATE_EMAIL_MESSAGE_BODY .
      REFRESH IT_MESSAGE.
      IT_MESSAGE = TEXT-043.  " Please find attached Insurance Certificate details
      APPEND IT_MESSAGE.
    ENDFORM.                    " POPULATE_EMAIL_MESSAGE_BODY
    *******'/ form SEND_FILE_AS_EMAIL_ATTACHMENT
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
    *       text
    *      -->PIT_MESSAGE           text
    *      -->PIT_ATTACH            text
    *      -->P_EMAIL               text
    *      -->P_MTITLE              text
    *      -->P_FORMAT              text
    *      -->P_FILENAME            text
    *      -->P_ATTDESCRIPTION      text
    *      -->P_SENDER_ADDRESS      text
    *      -->P_SENDER_ADDRES_TYPE  text
    *      -->P_ERROR               text
    *      -->P_RECIEVER            text
    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.       "#EC *
      DATA: LD_ERROR    TYPE SY-SUBRC,                          "#EC *
    *        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.                         "#EC *
    *  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.
      DESCRIBE TABLE IT_ATTACH LINES W_CNT.
      READ TABLE IT_ATTACH INDEX W_CNT.
      W_DOC_DATA-DOC_SIZE =
         W_CNT * 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.
      LOOP AT S_EMAIL.
        T_RECEIVERS-RECEIVER = S_EMAIL-LOW.
        T_RECEIVERS-REC_TYPE = 'U'.
        T_RECEIVERS-COM_TYPE = 'INT'.
        T_RECEIVERS-NOTIF_DEL = 'X'.
        T_RECEIVERS-NOTIF_NDEL = 'X'.
        APPEND T_RECEIVERS.
      ENDLOOP.
      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.                    " SEND_FILE_AS_EMAIL_ATTACHMENT
    *******/form
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
    *       text
    *  -->  p1        text
    *  <--  p2        text
    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
    *********end of code to trigger mail in excel format....
    If any other help please let me know......
    I am sure this example code will help you to resolve your problem...
    please analyse above code for your requirement...
    In my scenario the message you said is not displaying.....
    Reward Points

  • Sending an attachment with an e-mail

    Does anyone know how to send an attachment with an e-mail
    using a
    form page that is on our web site? I am using the TYPE
    attribute of
    the form tag as "File" to get the file I want to attach to
    the e-
    mail. Below is the code I have. The first page is where the
    user can
    click the browse button to search for a file to attach. The
    second
    page is where the e-mail should be sent to. Thanks for your
    help.
    Andy

    Ian,
    Do we have to set a folder up on our cold fusion server or do
    we just
    make a folder under our web site so when a user clicks on the
    browse
    menu, the file they attach has to be saved to our server
    first and then
    I can attach the saved file to an e-mail? How do we create
    this folder?
    Does it have to be an FTP site or just a folder on our web
    site? How do
    we make the permissions work correctly since a folder under
    our web site
    is not writable to except by the web editors that work here?
    Please let
    me know what I can do to get this to work. Thanks.
    Andy
    You can use any folder on the CF server or any system to
    which it has
    access. By default the CF service runs as a localsystem user,
    so would
    generally only have access to the local server file system.
    This is
    determined in the Services panel on window systems, I'm not
    sure how it
    works for other OS's.
    If you are talking about the "Browse" button that is
    displayed in the
    web page for the <input type="file" ..> that does not
    browse the server,
    it browses the local user's system. You do not and can not
    influence
    this in any way. When a user selects a file from their system
    and
    submits the form, the file is uploaded to the webserver
    through the HTTP
    response header or URL query string, depending on whether the
    form is a
    post or get form.
    You then use the <cffile action="upload" ...> tag on
    the form's action
    page to get the file from the web server and write it to a
    location you
    define the "file" parameter of the flag. This file system
    access is
    done under the permissions of the ColdFusion server, again
    'LocalSystem'
    by default.
    You can then use this newly saved file in you <cfmailparam
    ...> tag to
    attach it to an email. After this if you like you can use a
    <cffile
    action="delete" ...> to remove the file.

  • Want to Send smartform as pdf attachment with a Email to some mail id

    Hi ,
    I want to send a smartform as a PDF attachment with a mail to a mail id. And I can send a mail with the PDF attachment.
    But I am not able to open the PDF. It is throwing some error (Adobe reader could not open u2018fileu2019 because it is either not a supported file type or because the file has been damaged (for example , it was sent as an email attachment and was not correctly decoded)).
    By debugging I come to know that the file which is generating is in some encoding format.
    Please help me regard this. This is very urgent.
    here is the code,
    Main Program :
    REPORT Ztest_report.
    *--Top Include for Global Data Declarations.
    INCLUDE ztest_report_top.
    *--Form Include for Form Routines.
    INCLUDE ztest_report_form.
    START-OF-SELECTION.
    START-OF-SELECTION.
    *--Display data
      Perform display_data.
    END-OF-SELECTION.
    Top declaration :
    Internal table
    DATA :  i_otfdata TYPE tsfotf,          " Smart Forms: Table OTF
            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
            w_mailaddr TYPE ppfdmailad,
            w_mailtype TYPE so_escape,
            w_mailrecipient TYPE swotobjid,
            w_control 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
            wa_objhead TYPE soli_tab,
    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.
    Selection Screen
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-009.
    PARAMETER:      p_bukrs TYPE bukrs OBLIGATORY,            "Company Code
                    p_belnr TYPE belnr_d OBLIGATORY,          "Document No
                    p_gjahr TYPE gjahr OBLIGATORY,            "document type
                    p_mailid(50) TYPE c OBLIGATORY.
    "Mail Id
    SELECTION-SCREEN END OF BLOCK blk1.
    Form Logic :
    FORM display_data.
    *Local Variable declaration
      DATA: lc_fm TYPE rs38l_fnam,       "local variable to store the
            l_i_document_output_info TYPE ssfcrespd,
            l_i_struc_job_output_info TYPE ssfcrescl,
            l_i_struc_job_output_options TYPE ssfcrescl,
            i_lines TYPE TABLE OF tline WITH HEADER LINE,
            lv_job_output_info      TYPE ssfcrescl,
            lv_document_output_info TYPE ssfcrespd,
            lv_job_output_options   TYPE ssfcresop,
            lv_bin_filesize         LIKE sood-objlen.
    Determine the smartform name
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
           EXPORTING
                formname           = 'ZTEST_SMARTFORM'
           IMPORTING
                fm_name            = lc_fm
           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_control-getotf = 'X'.
      w_control-no_dialog = 'X'.
      w_control-preview = space.
    w_control-device = 'MAIL'.
    Call the smartform and pass the selection screen parameter
      CALL FUNCTION lc_fm
           EXPORTING
                control_parameters = w_control
                output_options     = w_compop
                user_settings      = 'X'
                t_bukrs            = p_bukrs
                t_belnr            = p_belnr
                t_gjahr            = p_gjahr
           IMPORTING
                job_output_info    = l_i_struc_job_output_info
           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.
    Moving the Smart Forms: Table OTF into an internal table
      i_otfdata[] = l_i_struc_job_output_info-otfdata[].
    CONVERT TO OTF TO PDF.
      CALL FUNCTION 'CONVERT_OTF'
           EXPORTING
                format                = 'PDF'
                max_linewidth         = 132
           IMPORTING
                bin_filesize          = lv_bin_filesize
           TABLES
                otf                   = i_otfdata
                lines                 = i_lines
           EXCEPTIONS
                err_max_linewidth     = 1
                err_format            = 2
                err_conv_not_possible = 3
                err_bad_otf           = 4
                OTHERS                = 5.
    IF sy-batch EQ l_c_no.
    To directly view the print-preview in PDF format
      CALL FUNCTION 'SSFCOMP_PDF_PREVIEW'
           EXPORTING
                i_otf                    = i_otfdata
           EXCEPTIONS
                convert_otf_to_pdf_error = 1
                cntl_error               = 2
                OTHERS                   = 3.
    For Sending the PDF file to a Mail ID.
    LOOP AT i_lines.
       TRANSLATE i_lines USING '~'.
       CONCATENATE wa_buffer i_lines 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.
      DATA: BEGIN OF zlines OCCURS 0,
      tline TYPE char255,
      END OF zlines.
    *Change the PDF format from 132 to 255.
      CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
           EXPORTING
                transfer_bin                = 'X'
           TABLES
                content_in                  = i_lines
                content_out                 = zlines
           EXCEPTIONS
                err_line_width_src_too_long = 1
                err_line_width_dst_too_long = 2
                err_conv_failed             = 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.
    Attachment
      REFRESH: i_reclist,
      i_objtxt,
      i_objbin,
      i_objpack.
      CLEAR wa_objhead.
      i_objbin[] = zlines[].
    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 = 1.
      i_objpack-body_start = 2.
      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 = 1.
      i_objpack-body_start = 2.
    I_OBJPACK-DOC_TYPE = 'RAW'.
      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 = p_mailid.
      i_reclist-rec_type = 'U'.
      APPEND i_reclist.
    Send new document with attachments via RFC
      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.
    ENDFORM.                    " display_data

    hi,
    i wrote a programm.for me it is working.i think it will help for u.
    DATA: t_otfdata TYPE ssfcrescl,
          t_lines LIKE tline OCCURS 0 WITH HEADER LINE,
          t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
          t_RECORD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
    Objects to send mail.
    DATA:T_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
         T_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
         T_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
         T_RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE.
    DATA: w_filesize TYPE i,
          w_bin_filesize TYPE i,
          wa_ctrlop TYPE ssfctrlop,
          wa_outopt TYPE ssfcompop,
          WA_BUFFER TYPE STRING,          "To convert from 132 to 255
          WA_OBJHEAD TYPE SOLI_TAB,
          WA_DOC_CHNG TYPE SODOCCHGI1,
          W_DATA TYPE SODOCCHGI1.
    DATA: form_name TYPE rs38l_fnam,
          V_LINES_TXT TYPE I,
          V_LINES_BIN TYPE I,
          nast-spras type sy-langu value 'DE'.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        FORMNAME                 = 'ZSR_DEMO1'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
    IMPORTING
       FM_NAME                  = 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.
    wa_ctrlop-LANGU = nast-spras.
    wa_ctrlop-getotf = 'X'.
    wa_ctrlop-no_dialog = 'X'.
    wa_outopt-tdnoprev = 'X'.
    CALL FUNCTION form_name
      EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
       CONTROL_PARAMETERS         = wa_ctrlop
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
       OUTPUT_OPTIONS             = wa_outopt
       USER_SETTINGS              = 'X'
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
       JOB_OUTPUT_INFO            = t_otfdata
      JOB_OUTPUT_OPTIONS         =
    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.
    t_otf[] = t_otfdata-otfdata[].
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
       FORMAT                      = 'PDF'
       MAX_LINEWIDTH               = 132
      ARCHIVE_INDEX               = ' '
      COPYNUMBER                  = 0
      ASCII_BIDI_VIS2LOG          = ' '
      PDF_DELETE_OTFTAB           = ' '
    IMPORTING
       BIN_FILESIZE                = w_bin_filesize
      BIN_FILE                    =
      TABLES
        OTF                         = t_otf
        LINES                       = t_lines
    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 t_lines.
    TRANSLATE t_lines USING '~'.
      CONCATENATE WA_BUFFER T_LINES INTO WA_BUFFER.
    ENDLOOP.
    TRANSLATE WA_BUFFER USING '~'.
    DO.
      t_RECORD = WA_BUFFER.
      APPEND t_RECORD.
      SHIFT WA_BUFFER LEFT BY 255 PLACES.
      IF WA_BUFFER IS INITIAL.
        EXIT.
      ENDIF.
    ENDDO.
    Attachment
    REFRESH: T_RECLIST,
    T_OBJTXT,
    T_OBJBIN,
    T_OBJPACK.
    CLEAR WA_OBJHEAD.
    T_OBJBIN[] = T_RECORD[].
    Create Message Body Title and Description
    T_OBJTXT = 'test with pdf-Attachment!'.
    APPEND T_OBJTXT.
    DESCRIBE TABLE T_OBJTXT LINES V_LINES_TXT.
    READ TABLE T_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 T_OBJPACK-TRANSF_BIN.
    T_OBJPACK-HEAD_START = 1.
    T_OBJPACK-HEAD_NUM = 0.
    T_OBJPACK-BODY_START = 1.
    T_OBJPACK-BODY_NUM = V_LINES_TXT.
    T_OBJPACK-DOC_TYPE = 'RAW'.
    APPEND T_OBJPACK.
    Attachment (pdf-Attachment)
    T_OBJPACK-TRANSF_BIN = 'X'.
    T_OBJPACK-HEAD_START = 1.
    T_OBJPACK-HEAD_NUM = 0.
    T_OBJPACK-BODY_START = 1.
    DESCRIBE TABLE T_OBJBIN LINES V_LINES_BIN.
    READ TABLE T_OBJBIN INDEX V_LINES_BIN.
    T_OBJPACK-DOC_SIZE = V_LINES_BIN * 255 .
    T_OBJPACK-BODY_NUM = V_LINES_BIN.
    T_OBJPACK-DOC_TYPE = 'PDF'.
    T_OBJPACK-OBJ_NAME = 'smart'.
    T_OBJPACK-OBJ_DESCR = 'test'.
    APPEND T_OBJPACK.
    CLEAR T_RECLIST.
    T_RECLIST-RECEIVER = 'mail id'.
    T_RECLIST-REC_TYPE = 'U'.
    APPEND T_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               = T_OBJPACK
        OBJECT_HEADER              = WA_OBJHEAD
        CONTENTS_BIN               = T_OBJBIN
        CONTENTS_TXT               = T_OBJTXT
        RECEIVERS                  = T_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.
    please reward me if helpful.

  • How to send a mail as an attachment in a mail with AppleScript?

    Hi,
    I want to manage my spam using the advices found in support.apple website :
    OS X Mail
    Open the message and choose “Forward as Attachment” from the Message menu.
    Forward the message to iCloud [email protected].
    Forward the message again to abuse@domain, replacing domain with the part of the sender's email address after the @ symbol. For example, if the sender's email address is [email protected], forward the message to [email protected].
    I don't know how to make a message as an attachment...
    set theAttachment to theMessage
    make new attachment with properties {file name:theAttachment} at after last paragraph
    Here is my whole script, if it runs, it could be useful :
    tell application "Mail"
      -- envoi les messages sélectionnés en PJ à [email protected]
              set theMessages to the selection
              repeat with theMessage in theMessages
                        set theAttachment to theMessage
                        set newMessage to make new outgoing message at end of outgoing messages
                        tell newMessage
                                  set subject to "Fwd: " & theMessage's subject
      make new to recipient with properties {address:"[email protected]"}
                                  tell content of theMessage
      make new attachment with properties {file name:theAttachment} at after last paragraph
                                  end tell
                        end tell
      send newMessage
              end repeat
      -- envoi les messages sélectionnés en PJ à abuse@<domaine du spammeur>
              set theMessages to the selection
              repeat with theMessage in theMessages
                        set theAttachment to theMessage
                        set newMessage to make new outgoing message at end of outgoing messages
                        tell newMessage
                                  set subject to "Fwd: " & theMessage's subject
                                  set theSpamAddress to theMessage's sender
                                  set AppleScript's text item delimiters to {"@"}
                                  set spamerDomainName to text item 2 of theSpamAddress
                                  set theNewSpamAddress to "abuse@" & spamerDomainName
      make new to recipient with properties {address:theNewSpamAddress}
                                  tell content of theMessage
      make new attachment with properties {file name:theAttachment} at after last paragraph
                                  end tell
                        end tell
      send newMessage
              end repeat
    end tell
    Thank you!

    Perfect!
    You clearly give me the way. Actually I have used the AppleScript Language Guide from https://developer.apple.com to finalize my AppleScript.
    You just need to select the spam message(s) in "Mail" application, then run the script.
    As I mentionned previously, it just do this automatically :
    OS X Mail
    Open the message and choose “Forward as Attachment” from the Message menu.
    Forward the message to iCloud [email protected].
    Forward the message again to abuse@domain, replacing domain with the part of the sender's email address after the @ symbol. For example, if the sender's email address is [email protected], forward the message to [email protected].
    Here is the entire working script :
    -- Ce script permet de lutter contre le spam.
    -- Je me suis appuyé sur les conseils sur http://support.apple.com/kb/TS4019?viewlocale=fr_FR
    tell application "Mail"
              set theMessages to the selection
              repeat with theMessage in theMessages
      -- enregistre le message dans un fichier pour le mettre en PJ ensuite
                        set msgContent to source of theMessage
                        set tmpFile to ((path to desktop) as rich text) & "ForwardedMessage"
                        set referenceNumber to open for access tmpFile with write permission
      write msgContent to referenceNumber
      close access referenceNumber
      -- envoi le message sélectionné en PJ à [email protected]
                        set newMessage to make new outgoing message at end of outgoing messages
                        tell newMessage
                                  set subject to "Fwd: " & theMessage's subject
      make new to recipient with properties {address:"[email protected]"}
                                  tell content of newMessage
      make new attachment with properties {file name:tmpFile} at after last paragraph
                                  end tell
                        end tell
      send newMessage
      -- envoi le message sélectionné en PJ à abuse@<domaine du spammeur>
                        set newMessage to make new outgoing message at end of outgoing messages
                        tell newMessage
                                  set subject to "Fwd: " & theMessage's subject
                                  set theSpamAddress to theMessage's sender
                                  set AppleScript's text item delimiters to {"@"}
                                  set theSpamAddress to text item 2 of theSpamAddress
                                  set AppleScript's text item delimiters to {">"}
                                  set spamerDomainName to text item 1 of theSpamAddress
                                  set theNewSpamAddress to "abuse@" & spamerDomainName
      make new to recipient with properties {address:theNewSpamAddress}
                                  tell content of newMessage
      make new attachment with properties {file name:tmpFile} at after last paragraph
                                  end tell
                        end tell
      send newMessage
              end repeat
    end tell

  • Mail attachment with UDF in SAP PI 7.1

    Hello,
    I need to reproduce this solution in PI 7.1
    /people/samuel.chandrasekaran2/blog/2008/10/06/xi-mail-adapter-dynamically-building-attachment-and-message-body-content-using-a-simple-udf
    It is about  adding lines of a message as an attachment to a mail.
    The UDF works for all elements except the lines for the attachment itself.
    In order to build the content of the attachment (for this particular requirement) they are using a global variable declared and initialized in the global sections.
    But the button for the Java Section to use an imported archive is no longer available in PI.....
    So how to solve that issue?
    I tried to use a graphical variable instead of a global variable but I have no idea how to add the n lines
    from the source message as one import object into the UDF via that graphical variable.
    Your ideas are very appreciated!
    Best Regards
    Dirk

    Hi,
    yes, it is a little bit different. This is the issue.....  
    But I am not sure if your links will help:
    1) /people/william.li/blog/2008/02/13/sap-pi-71-mapping-enhancements-series-using-graphical-variable
    is about a different solution. I do not need to count the number of lines of the source message.
    And the second variable is about concat line by line from unbound node to unbound node.
    My issue is:
    Souce:
    Message line (0...unbound) ! ! ! ! ! ! ! !
    .    ResultLine   (1..1)
    Mapping:
    =>   ResultLine1
           ResultLine2
           ResultLine........          => into UDF to an element  (1..1) in one mapping operation.
    So that all "ResultLine"s are included.
    The result is explained in the given link for Mail attachment with UDF.
    So I am not sure how to use this thread for my issue.
    In the comments of that blog Christoph Gerber writes that the new variable feature can only handle single values.
    So it is not suitable for my purposes as I have a list of values here that needs to be moved into the target message field.
    2) http://wiki.sdn.sap.com/wiki/display/Java/UsingEditJavaSectioninMessageMapping
    shows where to find the button "Java section" which is not available here in 7.1
    3) /people/sap.user72/blog/2005/10/01/xi-new-features-in-sp14
    too is about the nice little button for Java Section that is no longer existing on PI 7.1 screen for mappings.  
    So my issue is: How to replace the Java section function with global variables in PI 7.1?
    Best regards
    Dirk

  • Mail attachment with time stamp

    Hi
    My scenario is Proxy to Mail.
    On receiver side I am getting the data as an attachment but i want that attachment with time stamp.
    How to add time stamp to the attachment in reciever mail adapter.
    Regards
    Sowmya
    Edited by: Sowmya on Aug 28, 2008 12:24 PM

    hi sowmya,
       The bellow link for MessageTransformBean..
      [http://help.sap.com/saphelp_nw70/helpdata/EN/57/0b2c4142aef623e10000000a155106/content.htm]
      In that ContentDisposition is used to fill the value for Attachment file name..
      Its allows the value accordingly "RFC1806" Note..
      RFC1806 allows accordingly RFC822 ..
      Check RFC822 ..
        5.  DATE AND TIME SPECIFICATION
    Regards,
    Prakasu

  • XI Mail Adapter: sending emails with attachment with help of java mapping

    Hi ,
    On trying out the scenerio mentioned in the blog, using the java mapping provided
    "XI Mail Adapter: An approach for sending emails with attachment with help of Java mapping
    The scenerio works just fine.
    But the payload as the content of the attachment is not getting generated in proper XML format.
    I suppose it's because of the replace special characters code part..
    Can anyone help me state the modification required in the code.
    Thanks!
    Regards,
    Faria Mithani

    It might be a codepage issue. Is your original payload UTF-8?

  • Sending XI-Content as Mail Attachement with specific Filename

    Hi,
    I want to send the Message-Content as a mail attachment with a specific Filename (e.g. 2005-08-31.csv). The content is a CSV File, not a XML
    In the scenario an IDOC is sent to the XI mapped in a CSV-File (via Java-Mapping) and should be send as a Mail Attachment.
    Is this possible and how?
    Thank you for your help
    Thomas

    Hi Thomas,
    You can influence the filename with the ModuleTransformBean. You need at least SP9 for this feature.
    In the Mail Receiver Channel got to tab "Module"
    As first module (before the mail module) enter:
    localejbs/AF_Modules/MessageTransformBean as Local Enterprise Bean with any key
    For this module key you can use in the module configuration following entries:
    Transform.ContentDisposition inline|attachment;filename=<filename>
    Transform.ContentDescription <Filename>
    Transform.ContentType <MimeType>/<SubType>;name="<filename>"
    If you want to send an attachment, use:
    Transform.ContentDisposition attachment;filename="MyFile.csv"
    Transform.ContentDescription MyFile
    Transform.ContentType text/plain;name="MyFile.csv"
    If you use the Mail Package, you can set the file name that way:
    <ns:Mail xmlns:ns="http://sap.com/xi/XI/Mail/30">
      <Subject>Hello</Subject>
      <From>[email protected]</From>
      <To>[email protected]</To>
      <Content_Type>text/plain;name="MyFile.csv"</Content_Type>
      <Content>Here comes the CSV Data</Content>
    </ns:Mail>
    Hope that helps,
    Stefan

  • ALV Report to be send as a mail as an Excel sheet attachment

    Hi,
             I have designed a Report that has the mailing functionality by attaching the ALV report output in the Excel sheet.
    1. I am using SUBMITT PROGRAM....EXPORTING MEMORY ID.
              Here  I am retrieving the required ALV report.
    2. I am passing of ALV Report output to internal table, say XLS_TAB using FM LIST_TO_ASCI.
    I can see the data in the internal table. But the problem is when the report output has many columns (i.e) greater than 255 Char, the columns get truncated(data is missed).
    So, how to prevent the missing of the columns. I don't want split each record into new line. Because, when it is passed to Excel, each record should be in a single line without missing any column.
                   If you say the FM can be valid upto 255 Char, what can be the alternative solution?
    Immediate response is appreciated.
    Thanks for your help.
    Sravan.

    Hi deepan
    DESCRIBE TABLE objtxt LINES tab_lines.
      READ TABLE objtxt INDEX tab_lines.
    docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ) . <---- make it 1024 instead of 255
      CLEAR objpack-transf_bin.
    objpack-head_start = 1.
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = gv_tab_lines.
    objpack-doc_type = RAW
      APPEND objpack
    then looping contents of the final table to OBJBIN1.
    DESCRIBE TABLE objbin1 LINES tab_lines.
      objpack-doc_size = tab_lines * 255 .    <-------- make it has 1024 instead of 255
      objpack-transf_bin = 'X'.
      objpack-head_start = 1.
      objpack-head_num = 1.
      objpack-body_start = 1.
      objpack-body_num = tab_lines.
      objpack-doc_type = .XLS
      APPEND objpack.
    Regards
    vijay

Maybe you are looking for

  • Enterprise Manager Configin a new host after recovery from cold backup

    Dear friends , we have recovered a DB in new host(windows) from the cold backup. Listener is configured and EM is also configured . I am able to login through the EM . In the front page i get an error like java.lang.exception:unknownhost exception se

  • Photoshop CS5 Trail Extracting error -4960

    I am trying a Trial Download of Photoshop CS5 and during Extracting, I recieve "The following disk images couldn't be opened" The image is Photoshop-12-1-LS1.dmg and the error -4960. What must I do? Thanks, ymlevyrsa

  • File to ABAP proxy with EOIO

    Hi Experts, I am working on File to ABAP proxy scenario. The requirement is to have EOIO from end to end. Which means the files have to be sent to target system (R/3) in the same order as they are placed in the file location. I have two questions reg

  • ID : interface determination - Interface mapping (file- IDOC with externa)

    Hi, scenario : XML file read and mapped to Multiple IDOC in single message all IR stuf are done but in the ID I cannot choose the mapping interface here is a document of everything that was done...http://docs.google.com/Doc?id=dcsvs2n3_51jnrfw6 Thank

  • EMail Marketing Question

    Hello, As a first-time user/admin of email marketing On Demand, I wanted to pose a question for the group. It's apparent that you can only load "Contacts" as recipients of email campaigns, but what if you wanted to load "Leads" instead? I realize tha