Excel-sheet attachment having encoding issues

Hi Everyone,
   I have an abap report that upon execution, needs to send pricing alerts to the customer through email. The details of the pricing order are there in the excel sheet that is attached to the email sent to the customer. The excel sheet that is received at the other end, shows the error message "The file is corrupt and cannot be opened", if the excel file is generated from systems using SolarisX86 OS. I suppose this is related to the encoding format of the excel sheet getting generated. Please assist me as to how can I solve this problem. Thanks for your help.

Can you provide any coding?
Maybe this is helpful to you:
http://wiki.sdn.sap.com/wiki/display/ABAP/Excelfiles-CSVformat

Similar Messages

  • 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

  • Excel sheet attached mail when opened shows a error message

    hi all,
        i have created a report for sending the output to the sap inbox as excel attachment . my problem is ;it always shows an error message when ever the attachment is opened.
        I have used the function 'SO_NEW_DOCUMENT_ATT_SEND_API1' and in the table parameters,   TABLES
                                   packing_list   =
    passing the .XLS format and excel sheet name.
       please provide me a solution to stop the display of this error message having the contents 'this file is not in a recognizable format'.
    thanks and regards\
    Thomas
    Coding :
    FORM sub_output_timeadm  USING lv_usrid TYPE gty_timhours-usrid.
      DATA : lv_emp1(10) TYPE c,
            lv_ename(40) TYPE c,
              lv_hour(10) ,
              lv_lgart(15),
              lv_scc(10),
              lv_rcc(10),
              lv_order(15),
              lv_ordtext(40),
              lv_act(10).
      DATA : lwa_content TYPE solisti1.
      DATA : lit_objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE,"#EC *
             lit_objbin  LIKE solisti1   OCCURS 0 WITH HEADER LINE,
             lit_objtxt  LIKE solisti1   OCCURS 2 WITH HEADER LINE,
             lit_reclist LIKE somlreci1  OCCURS 2 WITH HEADER LINE,
             lwa_docdat  LIKE sodocchgi1 OCCURS 1 WITH HEADER LINE,
             lv_tab_lines LIKE sy-tabix.
      DATA : lv_file LIKE rlgrap-filename,
             lv_line LIKE solisti1-line,
             lv_vt TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
      DATA : lwa_receivers   TYPE somlreci1 .
    *Object text details
      PERFORM sub_objtxt_data TABLES lit_objtxt
                                     lit_objpack
                              USING  lv_tab_lines.
    *Document data details
      PERFORM sub_document_data TABLES lwa_docdat
                                       lit_objtxt
                                USING  lv_file
                                       lv_tab_lines.
      PERFORM sub_topofpage TABLES lit_objbin
                            USING  lv_line
                                   lv_vt.
      PERFORM sub_fill_columnhead TABLES lit_objbin.
      LOOP AT git_content INTO lwa_content.
        lv_emp1 = lwa_content+2(10).
        CONDENSE lv_emp1.
        lv_ename = lwa_content+15(40).
        SHIFT lv_ename LEFT.
    *    CONDENSE lv_ename.
        IF lv_ename+0(7) = text-024.
          WRITE lv_ename TO lv_ename RIGHT-JUSTIFIED.
        ELSE.
          CONDENSE lv_ename.
        ENDIF.
        lv_hour = lwa_content+58(10).
        CONDENSE lv_hour.
        lv_lgart = lwa_content+70(15).
        CONDENSE lv_lgart.
        lv_scc = lwa_content+90(10).
        CONDENSE lv_scc.
        lv_rcc = lwa_content+103(10).
        CONDENSE lv_rcc.
        lv_order = lwa_content+115(15).
        CONDENSE lv_order.
        lv_ordtext = lwa_content+132(40).
        CONDENSE lv_ordtext.
        lv_act = lwa_content+174(10).
        CONDENSE lv_act.
        CONCATENATE lv_emp1
                    lv_ename
                    lv_hour
                    lv_lgart
                    lv_scc
                    lv_rcc
                    lv_order
                    lv_ordtext
                    lv_act INTO lv_line SEPARATED BY lv_vt.
        CONCATENATE gc_add lv_line lv_vt INTO lv_line.
        APPEND lv_line TO lit_objbin.
        CLEAR :lv_emp1,
                   lv_ename,
                   lv_hour,
                   lv_lgart,
                   lv_scc,
                   lv_rcc,
                   lv_order,
                   lv_ordtext,
                   lv_act ,lv_line,lwa_content.
      ENDLOOP.
      DESCRIBE TABLE lit_objbin LINES lv_tab_lines.
      lv_tab_lines = lv_tab_lines + 1.
    *  Object pack details
      PERFORM sub_objpack_data TABLES lit_objbin
                                      lit_objpack
                               USING  lv_tab_lines
                                      lv_file.
    *Receiver list details
      PERFORM sub_reclist_timeadm TABLES lit_reclist
                                  USING lv_usrid.
      READ TABLE lit_reclist INDEX 1.
      IF sy-subrc  = 0.
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
            document_data              = lwa_docdat
            put_in_outbox              = gc_x
            commit_work                = gc_x
          TABLES
            packing_list               = lit_objpack
            contents_bin               = lit_objbin
            contents_txt               = lit_objtxt
            receivers                  = lit_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.
        CASE sy-subrc.
    *    WHEN 0.
    *      MESSAGE i014.
    *    WHEN 1.
    *      MESSAGE i016.
    *    WHEN 2.
    *      MESSAGE i016.
    *    WHEN 4.
    *      MESSAGE i015.
    *    WHEN OTHERS.
    *      MESSAGE i017.
        ENDCASE.
      ENDIF.
      REFRESH git_content.
      CLEAR gwa_content.
    FORM sub_objtxt_data TABLES xt_objtxt STRUCTURE solisti1
                                xt_objpack STRUCTURE sopcklsti1
                         USING  xv_tab_lines .
      DATA : lv_zdat(10)  TYPE c,
             lv_zdat2(10) TYPE c.
      CONSTANTS: lc_hiphen(1) TYPE c VALUE '-'.
    *  write sy-datum to lv_zdat mm/dd/yyyy.
    *  concatenate text-022 lv_zdat into xt_objtxt separated by space.
    *  APPEND xt_objtxt.clear xt_objtxt.
      WRITE pnpbegda TO lv_zdat  MM/DD/YYYY.
      WRITE pnpendda TO lv_zdat2 MM/DD/YYYY.
      CONCATENATE text-080
                  lv_zdat
                  lc_hiphen
                  lv_zdat2   INTO xt_objtxt SEPARATED BY space.
      APPEND xt_objtxt.CLEAR xt_objtxt.
      xt_objtxt = text-067.
      APPEND xt_objtxt.CLEAR xt_objtxt.
      CLEAR: lv_zdat,
             lv_zdat2.
      DESCRIBE TABLE xt_objtxt LINES xv_tab_lines.
      READ TABLE xt_objtxt INDEX xv_tab_lines.
      CLEAR xt_objpack-transf_bin.
      xt_objpack-head_start = 1.
      xt_objpack-head_num   = 0.
      xt_objpack-body_start = 1.
      xt_objpack-body_num   = xv_tab_lines.
      xt_objpack-doc_type   = gc_raw.
      APPEND xt_objpack.
      CLEAR xt_objpack.
    ENDFORM.                    " sub_objtxt_data
    *&      Form  sub_document_data
    *To fix the size of the document
    *      -->XT_DOCDAT
    *      -->XT_OBJTXT
    *      -->XV_LV_FILE
    *      -->XV_TAB_LINES
    FORM sub_document_data TABLES xt_docdat STRUCTURE sodocchgi1
                                  xt_objtxt STRUCTURE solisti1
                           USING  xv_lv_file
                                  xv_tab_lines.                 "#EC *
      DATA : lv_subject     TYPE string,
             lv_open        TYPE c VALUE '(',
             lv_close       TYPE c VALUE ')',
             lv_slash       TYPE c VALUE '/'.
      xt_docdat-obj_name = xv_lv_file.
      CONCATENATE lv_open sy-sysid
                  lv_slash sy-mandt lv_close INTO lv_subject.
      xt_docdat-obj_descr = lv_subject.
      xt_docdat-doc_size
          = ( xv_tab_lines - 1 ) * 255 + STRLEN( xt_objtxt ).
    ENDFORM.                    " sub_document_data
    *&      Form  sub_topofpage
    *       text
    *      -->P_LIT_OBJBIN  text
    FORM sub_topofpage TABLES xt_objbin STRUCTURE solisti1
                       USING  xv_lv_line
                              xv_vt.
      DATA: lwa_line TYPE slis_listheader.
      LOOP AT git_header INTO lwa_line.
        CONCATENATE lwa_line-key lwa_line-info
                    INTO xv_lv_line SEPARATED BY xv_vt.
        CONCATENATE gc_add xv_lv_line xv_vt
                    xv_vt     "TAB space
                    xv_vt
                    xv_vt
                    xv_vt
                    xv_vt
                    xv_vt
    *                xv_vt
    *                xv_vt
    *                xv_vt
    *                xv_vt
    *                xv_vt
    *                xv_vt
    *                xv_vt
                    INTO xv_lv_line.
        APPEND xv_lv_line TO xt_objbin.
      ENDLOOP.
    ENDFORM.                    " sub_topofpage
    *&      Form  sub_fill_columnhead
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM sub_fill_columnhead TABLES xt_objbin STRUCTURE solisti1.
      DATA:  lv_line LIKE solisti1-line,
             lv_vt TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
             lv_zdat(10).
      DATA : lv_line1(40),
             lv_line2(10),
             lv_line3(10),
             lv_line4(3),
             lv_line5(40).
      lv_line1 = text-008.
      WRITE sy-datum TO lv_zdat MM/DD/YYYY.
      lv_line2 = lv_zdat.
      CONCATENATE lv_vt
                  lv_line1
                  lv_vt
                  lv_vt
                  lv_line2
                  lv_vt
                  lv_vt
                  lv_vt
                  lv_vt
    *              lv_vt
             INTO lv_line.
      CONCATENATE gc_add lv_line lv_vt INTO lv_line.
      APPEND lv_line TO xt_objbin.
      CLEAR : lv_line, lv_line1, lv_line2, lv_zdat.
      lv_line1 = text-009.
      lv_line2 = text-010.
      WRITE pnpbegda TO lv_zdat MM/DD/YYYY.
      lv_line3 = lv_zdat.
      CLEAR lv_zdat.
      lv_line4 = ' - '.
      WRITE pnpendda TO lv_zdat MM/DD/YYYY.
      lv_line5 = lv_zdat.
      CONCATENATE lv_vt
                  lv_line1
                  lv_vt
                  lv_vt
                  lv_line2
                  lv_vt
                  lv_line3
                  lv_line4
                  lv_line5
                  lv_vt
                  lv_vt
                  lv_vt
                  lv_vt
             INTO lv_line.
      CONCATENATE gc_add lv_line lv_vt INTO lv_line.
      APPEND lv_line TO xt_objbin.
      CLEAR : lv_line, lv_line1,
              lv_line2,lv_line3,
              lv_line4, lv_line5, lv_zdat.
      CONCATENATE lv_vt
                  lv_vt
                  lv_vt
                  lv_vt
                  lv_vt
                  lv_vt
                  lv_vt
                  lv_vt
                  lv_vt
             INTO lv_line.
      CONCATENATE gc_add lv_line lv_vt INTO lv_line.
      APPEND lv_line TO xt_objbin.
      CLEAR lv_line.
      CONCATENATE text-013
                  text-014
                  text-015
                  text-016
                  text-017
                  text-018
                  text-019
                  text-026
                  text-020
             INTO lv_line
        SEPARATED BY lv_vt.
      CONCATENATE gc_add lv_line
                  lv_vt         "TAB space
                  INTO lv_line.
      APPEND lv_line TO xt_objbin.
    ENDFORM.                    " sub_fill_columnhead
    *&      Form  sub_objpack_data
    *To fix the actual document size
    *      -->XT_OBJBIN
    *      -->XT_OBJPACK
    *      -->XV_TAB_LINES
    *      -->XV_LV_FILE
    FORM sub_objpack_data  TABLES  xt_objbin STRUCTURE solisti1
                                   xt_objpack STRUCTURE sopcklsti1
                            USING  xv_tab_lines
                                   xv_lv_file.                  "#EC *
      DATA : lwa_objpack TYPE sopcklsti1.
      lwa_objpack-transf_bin = gc_x.
      lwa_objpack-head_start = 1.
      lwa_objpack-head_num   = 0.
      lwa_objpack-body_start = 1.
      lwa_objpack-body_num   = xv_tab_lines.
      lwa_objpack-doc_type   = gc_xls.
      lwa_objpack-obj_name   = xv_lv_file.
      lwa_objpack-obj_descr = gc_descr.
      lwa_objpack-doc_size
                = ( xv_tab_lines - 1 ) * 255 + STRLEN( xt_objbin ).
      APPEND lwa_objpack TO xt_objpack.
      CLEAR lwa_objpack.
    ENDFORM.                    " sub_objpack_data
    *&      Form  sub_reclist_timeadm
    *       text
    *      -->P_LIT_RECLIST  text
    *      -->P_LV_USRID  text
    FORM sub_reclist_timeadm  TABLES xt_reclist STRUCTURE somlreci1
                              USING  lp_usrid TYPE gty_timhours-usrid."#EC *
    *local constant
      CONSTANTS :      lc_b TYPE   c VALUE 'B'.
    *local workarea.
      DATA : lwa_receivers   TYPE somlreci1 ,
             lwa_usrid       TYPE gty_usrid ,
             lwa_docdata     TYPE sodocchgi1.
      REFRESH : git_receivers.":, LIT_DOCDATA .
      CLEAR : lwa_receivers,lwa_docdata.
      IF p_timadm EQ 'X'.
        MOVE: lp_usrid TO lwa_receivers-receiver,
              text-002   TO  lwa_receivers-express,
              lc_b       TO lwa_receivers-rec_type.
        APPEND lwa_receivers TO xt_reclist.
      ELSEIF p_manger EQ 'X'.
        READ TABLE git_usrid INTO lwa_usrid WITH KEY pernr = gwa_emphours-magpernr
                                                    usrty = '0001' BINARY SEARCH.
        IF sy-subrc EQ 0.
          MOVE: lwa_usrid-usrid TO lwa_receivers-receiver,
                  text-002       TO  lwa_receivers-express,
                  lc_b       TO lwa_receivers-rec_type.
          APPEND lwa_receivers TO xt_reclist.
        ENDIF.
        CLEAR : lwa_usrid .
      ENDIF.

    Hi Tona,
                  Please go through the code and cross check....
              REPORT zcyborg_5 NO STANDARD PAGE HEADING.
    TABLES : eket.
    DATA : p_date TYPE d.
    DATA : w_lines TYPE sy-tabix.
    TYPES : BEGIN OF types_eket,
                ebeln TYPE eket-ebeln,
                ebelp TYPE eket-ebelp,
                eindt TYPE eket-eindt,
            END OF types_eket.
    DATA : t_eket TYPE STANDARD TABLE OF types_eket.
    Declaration for ALV display *********************
    DATA : w_grid TYPE REF TO cl_gui_alv_grid,
           w_custom_container TYPE REF TO cl_gui_custom_container.
    RANGES : r_eindt FOR eket-eindt.
    FIELD-SYMBOLS: <fs_eket> TYPE types_eket.
    INITIALIZATION.
      CALL FUNCTION 'CALCULATE_DATE'
           EXPORTING
                days        = '60-'
                months      = '0'
                start_date  = sy-datum
           IMPORTING
                result_date = p_date.
      r_eindt-low     = p_date.
      r_eindt-high    = sy-datum.
      r_eindt-sign    = 'I'.
      r_eindt-option  = 'BT'.
      APPEND r_eindt.
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM disp_data.
      PERFORM email_data.
    perform disp_alv.
    *&      Form  get_data
          text
    -->  p1        text
    <--  p2        text
    FORM get_data.
      SELECT ebeln
             ebelp
             eindt
             FROM eket
             INTO TABLE t_eket
             WHERE eindt IN r_eindt.
    ENDFORM.                    " get_data
    *&      Form  disp_data
          text
    -->  p1        text
    <--  p2        text
    FORM disp_data.
      DESCRIBE TABLE t_eket LINES w_lines.
      WRITE :/5 'No of rows : ', w_lines.
      WRITE :/5 'EBELN', 30 'EBELP', 50 'EINDT'.
      SORT t_eket DESCENDING BY  eindt.
      LOOP AT t_eket ASSIGNING <fs_eket>.
        AT NEW ebeln.
          ULINE.
        ENDAT.
        WRITE : /5 <fs_eket>-ebeln, 30 <fs_eket>-ebelp, 50 <fs_eket>-eindt.
      ENDLOOP.
    ENDFORM.                    " disp_data
    call function 'SEND_TABLE_TO_EXCEL'
       exporting
         structure_name       = 'EKET'
       tables
         exceltab             = t_eket
    FORM email_data.
    *Structures and internal table used to send data vai mail
      DATA : objpack     LIKE sopcklsti1 OCCURS 2  WITH HEADER LINE,
             objhead     LIKE solisti1   OCCURS 1  WITH HEADER LINE,
             objbin      LIKE solisti1   OCCURS 0  WITH HEADER LINE,
             objtxt      LIKE solisti1   OCCURS 10 WITH HEADER LINE,
             reclist     LIKE somlreci1  OCCURS 5  WITH HEADER LINE,
             tab_lines LIKE sy-tabix,
             doc_chng LIKE sodocchgi1.
    DATA  : it_attach  TYPE STANDARD TABLE OF solisti1,
             w_attach   TYPE solisti1.
      CONSTANTS : c_car TYPE x VALUE '0D',
                  c_tab TYPE x VALUE '09'.
      CONCATENATE 'EBELN'
                   c_tab
                  'EBELP'
                   c_tab
                  'EINDT'
                  c_car INTO w_attach.
      APPEND w_attach TO it_attach.
      LOOP AT t_eket INTO <fs_eket>.
         CONCATENATE <fs_eket>-ebeln
                     c_tab
                     <fs_eket>-ebelp
                     c_tab
                     <fs_eket>-eindt
                     c_car INTO w_attach.
         APPEND w_attach TO it_attach.
      ENDLOOP.
      MOVE it_attach[] TO objbin[].
    *assign a name to the email document
      doc_chng-obj_name  = 'Output'.
      doc_chng-obj_descr = 'Old Scheduling lines'."gives the subject line
      objtxt-line = 'Regards'.
      APPEND objtxt.
      objtxt-line = 'Shivaji'.
      APPEND objtxt.
    *determine the size of the body of the email
      DESCRIBE TABLE objtxt LINES tab_lines.
      READ TABLE objtxt INDEX tab_lines.
      doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
    *fill the fields of the packing list for the body of the email
    *doc needs no header
      objpack-head_start = 1.
      objpack-head_num   = 0.
    *but it has a body
      objpack-body_start = 1.
      objpack-body_num   = tab_lines.
      objpack-doc_type   = 'RAW'.
      APPEND objpack.
    *************fill the fields for packing list ***
         for attachment        ********
      DESCRIBE TABLE objbin LINES tab_lines.
    *************if it has no header ****************
      objpack-transf_bin = 'X'.
      objpack-head_start = 1.
      objpack-head_num   = 1.
    *************if it has a body ********
      objpack-body_start = 1.
      objpack-body_num   = tab_lines.
      objpack-doc_type   = 'XLS'.
      objpack-obj_name   = 'Attachement'.
      objpack-obj_descr  = 'file'.
      objpack-doc_size   =  tab_lines * 255.
      APPEND objpack.
    ************fill the mail recipient list*******
      reclist-receiver = sy-uname.
    **rec_type 'B' indicates sap user ,rec_type 'U' indicates internet user
      reclist-rec_type = 'B'.
      reclist-express  = 'X'.
      APPEND reclist.
    Function Module to send the data as an excel attachement ****
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data                    = doc_chng
          put_in_outbox                    = 'X'
    IMPORTING
      SENT_TO_ALL                      =
      NEW_OBJECT_ID                    =
        TABLES
          packing_list                     = objpack
      OBJECT_HEADER                    =
          contents_bin                     = objbin
          contents_txt                     = objtxt
      CONTENTS_HEX                     =
      OBJECT_PARA                      =
      OBJECT_PARB                      =
          receivers                        = reclist
       EXCEPTIONS
         too_many_receivers               = 1
         document_not_sent                = 2
         document_type_not_exist          = 3
         operation_no_authorization       = 4
         parameter_error                  = 5
         x_error                          = 6
         enqueue_error                    = 7
         OTHERS                           = 8
      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.

  • 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

  • How to send huge no. of excel sheet attachment to a mail ID

    HI ,
            I have mail functionality program which send mail to a mail id with multiple excel sheet attchment. I have done all these things.  When it sends small number of excel attchment  then it's ok. But when  it sends huge number of excel attchment (ex.- 1000 excel attchment) then it showing error message to the mail  id -
       'This message is larger than the size limit for messages. Please make it smaller and try sending it again.'
    I have used cl_bcs, cl_document_bcs these class. I have seen all related post in sdn but unable to get my requirement.
    i need your suggestion.

    Hi,
    Try this code::
    FORM MAIL_SEND .
      *Mail Body
      MOVE text-004 TO wa_text.  "Space
      APPEND wa_text TO wt_text.
      CLEAR wa_text.
      MOVE TEXT-003 TO wa_text.
      APPEND wa_text TO wt_text.
      CLEAR wa_text.
      MOVE text-005 TO wa_text.
      APPEND wa_text TO wt_text.
      CLEAR wa_text.
      MOVE TEXT-003 TO wa_text.
      APPEND wa_text TO wt_text.
      CLEAR wa_text.
      MOVE text-011 TO wa_text.
      APPEND wa_text TO wt_text.
      CLEAR wa_text.
      tl_contents[] = wt_text.
      TRY.
        TRY.
    **-- Create persistent send request
          l_send_request = cl_bcs=>create_persistent( ).
          CATCH CX_SEND_REQ_BCS.
       ENDTRY.
    *-- Get the length of the Document
          DESCRIBE TABLE tl_contents LINES l_cnt.
          READ TABLE tl_contents INTO wa_contents INDEX l_cnt.
          l_doc_len = ( l_cnt - 1 ) * 255 + STRLEN( wa_contents ).
    *-- Subject of the mail
          l_sub = 'TEST1'.
          I_SUBJECT = 'BP assignment report for Credit analyst and CrSeg'.
    **-- Create Document
          l_document = cl_document_bcs=>create_document(
                 i_type       = c_htm
                 i_text       = tl_contents
                 i_length     = l_doc_len
                 i_subject    = I_SUBJECT "'BP assignment report for Credit analyst and CrSeg
                 i_language   = sy-langu
                 i_importance = '1' ).
        CATCH CX_DOCUMENT_BCS.
    **-- Subject of the mail
          MOVE l_sub TO l_subj.
      ENDTRY.
      TRY.
    *-- Set the Message Subject
          CALL METHOD l_send_request->set_message_subject
            EXPORTING
              ip_subject = l_subj.
        CATCH CX_SEND_REQ_BCS.
      ENDTRY.
    **-- Add document to send request
      try.
          CALL METHOD l_send_request->set_document( l_document ).
        CATCH CX_SEND_REQ_BCS.
      endtry.
      CALL FUNCTION 'SPLIT_FILENAME'
        EXPORTING
          long_filename  = 'C:\BP_DETAILS.XLS'
        IMPORTING
          pure_filename  = p_name
          pure_extension = p_ext.
      TRANSLATE p_ext TO UPPER CASE.
      elpath = 'C:\BP_DETAILS.XLS'.
    *Upload the file
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = elpath
          filetype                = 'BIN'
        TABLES
          data_tab                = t_ann
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
      try.
          IF t_ann[] IS NOT INITIAL.
    *-- File name of the Attachment
            l_subject  = p_name.
    *-- Extension of the Attachment
            l_att_type = p_ext.
            TRY.
                w_document = l_document.
    *-- Add Attachment to the Document
                CALL METHOD L_document->add_attachment
                  EXPORTING
                    i_attachment_type    = l_att_type
                    i_attachment_subject = l_subject
                    i_att_content_hex    = t_ann. "t_mailhex.
              CATCH cx_document_bcs.
            ENDTRY.
          ENDIF.
    *-- Do send delivery info for successful mails
          lv_msg = 'E'.
          CALL METHOD l_send_request->set_status_attributes
            EXPORTING
              i_requested_status = lv_msg  "Error status
              i_status_mail      = lv_msg. "Error status
          TRY.
              send_request = l_send_request->send_request.
            CATCH cx_bcs.
          ENDTRY.
    set outbox flag
          TRY.
              CALL METHOD send_request->set_link_to_outbox( 'X' ).
            CATCH cx_bcs.
          ENDTRY.
    request error status
          TRY.
              CALL METHOD send_request->setu_requested_status( req_stat ).
            CATCH cx_bcs INTO l_bcs_exception.
          ENDTRY.
    *-- Set sender
          l_sender = cl_sapuser_bcs=>create( sy-uname ).
          CALL METHOD l_send_request->set_sender
            EXPORTING
              i_sender = l_sender.
          gs_mail-e_mail = 'mail ID1'.
          APPEND gs_mail TO gt_mail.
          CLEAR gs_mail.
          gs_mail-e_mail = 'mail ID2'.
          APPEND gs_mail TO gt_mail.
          CLEAR gs_mail.
          gs_mail-e_mail = 'mail ID3'.
          APPEND gs_mail TO gt_mail.
          CLEAR gs_mail.
          loop at gt_mail into gs_mail.
            try.
                l_recipient = cl_cam_address_bcs=>create_internet_address(
                                                                    gs_mail-e_mail ).
              catch cx_address_bcs.
            endtry.
            CALL METHOD l_send_request->add_recipient
              EXPORTING
                i_recipient = l_recipient
               i_express   = 'X'
                i_copy      = 'X'.
          endloop.
    *-- Send Email
          CALL METHOD l_send_request->send(
              EXPORTING
                i_with_error_screen = 'X'
              RECEIVING
                result              = l_result ).
        CATCH cx_bcs INTO l_bcs_exception.
      ENDTRY.
      COMMIT WORK.
    ENDFORM.
    Thanks

  • Excel sheet attachment Maximum Size Limit.

    I am trying to create Java.Io.ByteArrayOutputStream bos = "some data". Then adding this to instance variable as an attachment...
    Attachment.create(contents : bos.toByteArray(), name : "MyData.xls",
    description : "System generated file, These are existing items in your Inbox");
    It works for around 200 rows of data..But if I try for more rows(larger Attachment size), it gives following error. is there any limit for size? how can I increase it? Please help.....
    Error while persisting the transaction data: 'An error occurred while accesing the database.
    Detail:SQL statement: 'unknown'
    Details:
    An error occurred while accesing the database.
    Detail:SQL statement: 'unknown'
    Caused by: Unexpected exception while enlisting XAConnection java.sql.SQLException: XA error: XAResource.XAER_NOTA start() failed on resource 'XAENGINEDS': XAER_NOTA : The XID is not valid
    javax.transaction.xa.XAException: [BEA][Oracle JDBC Driver]Oracle XA Error Occurred. Native Error: 24756
         at weblogic.jdbcx.oracle.OracleImplXAResource.checkError(Unknown Source)
         at weblogic.jdbcx.oracle.OracleImplXAResource.start(Unknown Source)
    fuego.transaction.DatabaseException: An error occurred while accesing the database.
    Detail:SQL statement: 'unknown'
         at fuego.server.persistence.jdbc.JdbcProcessInstancePersMgr.executeUpdateInstance(JdbcProcessInstancePersMgr.java:3157)
         at fuego.server.persistence.jdbc.JdbcProcessInstancePersMgr.updateInstance(JdbcProcessInstancePersMgr.java:2384)
         at fuego.server.persistence.Persistence.updateProcessInstance(Persistence.java:1031)
    Caused by: java.sql.SQLException: Unexpected exception while enlisting XAConnection java.sql.SQLException: XA error: XAResource.XAER_NOTA start() failed on resource 'XAENGINEDS': XAER_NOTA : The XID is not valid
    javax.transaction.xa.XAException: [BEA][Oracle JDBC Driver]Oracle XA Error Occurred. Native Error: 24756
         at weblogic.jdbcx.oracle.OracleImplXAResource.checkError(Unknown Source)
         at weblogic.jdbcx.oracle.OracleImplXAResource.start(Unknown Source)
         at weblogic.jdbcx.base.BaseXAResource.start(Unknown Source)

    Hi michelle gonzles,
    Was it working fine in Mozilla Firefox?
    Were you able to checked with a different browser as suggested above?
    Would you send your PDF document to [email protected] as an email attachment? 
    I will check it from my end.Please add the link to this forum post for reference.
    Regards,
    Florence

  • Problem in Sending mail with attachment (Excel sheet)

    Hi
    Iam using this FM   SO_NEW_DOCUMENT_ATT_SEND_API1  for sending mail with an attachment (excel sheet).
    the application is running fine , mail is going to other system .   but the excel sheet attachment contain only few rows  not all.
    and the body of the mail is not displaying . 
    Can any one help me. Thanks in advance.

    Hi,
    you can use cl_bcs classes for the same. I am using below code for same thng
      CONSTANTS:c_tab  TYPE c VALUE cl_bcs_convert=>gc_tab.
      CONSTANTS:c_crlf TYPE c VALUE cl_bcs_convert=>gc_crlf.
      DATA o_send_request   TYPE REF TO cl_bcs.
      DATA o_document       TYPE REF TO cl_document_bcs.
      DATA o_recipient      TYPE REF TO if_recipient_bcs.
      DATA o_bcs_exception  TYPE REF TO cx_bcs.
      TRY.
        o_document = cl_document_bcs=>create_document(
          i_type    = 'RAW'
          i_text    = is_mail_text
          i_subject = text-005 ).
      ENDTRY.
    *create file header
    CONCATENATE
                    text-h00 c_tab text-h01 c_tab text-h02 c_tab text-h03 c_tab text-h04 c_tab
                    text-h52 c_tab text-h05 c_tab text-h06 c_tab text-h07 c_tab text-h08 c_tab text-h09 c_tab
                   c_crlf INTO w_data_string.
    Loop at itab which contains data to be send as attachment
    concatenate field1 field2 field3 c_crlf into your_string separated by  c_tab
    conatenate final string your_string into final_string.
    endloop.
    *Convert data into suitable excel format
      TRY.
          CALL METHOD cl_bcs_convert=>string_to_solix
            EXPORTING
              iv_string   = w_data_string
              iv_codepage = '4103'
              iv_add_bom  = 'X'
            IMPORTING
              et_solix    = w_binary_content.
        CATCH cx_bcs INTO o_bcs_exception.
          IF o_bcs_exception IS NOT INITIAL.
            w_exec_txt = o_bcs_exception->get_text( ).
            MESSAGE w_exec_txt TYPE 'S'.
          ENDIF.
      ENDTRY.
        add the spread sheet as attachment to document object
      CONCATENATE text-006 sy-datum INTO w_attach_name SEPARATED BY space.
      o_document->add_attachment(
        i_attachment_type    = 'xls'
        i_attachment_subject = w_attach_name
        i_att_content_hex    = w_binary_content ).
    *create persistent send request
      o_send_request = cl_bcs=>create_persistent( ).
        add document object to send request
      o_send_request->set_document( o_document ).
        create recipient object for external mail id
      w_mlrec = iw_recipent.
      TRY.
          o_recipient = cl_distributionlist_bcs=>getu_persistent(
              i_dliname = w_mlrec
              i_private = space ).
        CATCH cx_bcs INTO o_bcs_exception.
          IF o_bcs_exception IS NOT INITIAL.
            w_exec_txt = o_bcs_exception->get_text( ).
            MESSAGE w_exec_txt TYPE 'S'.
          ENDIF.
      ENDTRY.
        add recipient object to send request
      o_send_request->add_recipient( o_recipient ).
        ---------- send document ---------------------------------------
      w_sent_to_all = o_send_request->send( i_with_error_screen = 'X' ).
      IF w_sent_to_all EQ abap_true.
        COMMIT WORK.
      ENDIF.

  • How to Convert Report into Excel Sheet when Sending Mail.

    Dear Friends,
    i want to send mail to HOD of Product with an Excel Sheet .
    i want to send Pending Issue details to HOD in Excel Sheet attachment .
    here i have pending issue report now i need to send it in Excel Sheet attachment .
    i have table where i have manage Product ID and HOD OF PRODUCT.
    CREATE TABLE  "MAP_USER_PRODUCT_DTL"
       (     "ID" NUMBER NOT NULL ENABLE,
         "PRODUCT_ID"NUMBER,
         "USER_ID" VARCHAR2(5) NOT NULL ENABLE,
         "HOD_PROD" VARCHAR2(100)========================================Value is Y OR N IF HOD then Y else N
         CONSTRAINT "MAP_USER_PRODUCT_DTL_PK" PRIMARY KEY ("ID") ENABLE
    /i have one more table where all complete issue detail insert.
    CREATE TABLE  "CRM_ISSUE_PROBLEM"
       (     "ID" NUMBER,
         "SUBJECT" VARCHAR2(255) NOT NULL ENABLE,
         "CLIENT_ID" NUMBER,
         "ASSIGNED_TO_ID" VARCHAR2(100),
         "ASSIGNED_ON" DATE,
         "DESCRIPTION" VARCHAR2(4000),
         "PRODUCT_ID" NUMBER NOT NULL ENABLE,
         "STATUS_ID" NUMBER NOT NULL ENABLE,
          CONSTRAINT "CRM_ISSUE_PROBLEM_PK" PRIMARY KEY ("ID") ENABLE
    Here STATUS_ID is Like Pending ISsue,Open Issue and Close Issue .i want to send mail to HOD with Pending Issue Report convert into Excel Sheet and send to HOD?
    How can i do this.
    Thanks
    Edited by: Vedant on Oct 12, 2011 12:36 AM
    Edited by: Vedant on Oct 12, 2011 2:22 AM

    Hello Vedant,
    Would it suffice if you send a CSV file?
    If yes, then see following code.. run the code under APEX > Home > SQL Workshop > SQL Commands
    DECLARE
            ln_id NUMBER;
            lc_clob CLOB;
         lb_blob BLOB;
         li_in PLS_INTEGER := 1;
         li_out PLS_INTEGER := 1;
         li_lang PLS_INTEGER := 0;
         li_warning PLS_INTEGER := 0;
         lv_mail_rcpts VARCHAR2(2000) := '[email protected]';
         lv_mail_from VARCHAR2(100) := '[email protected]';     
           lv_clmn_separator VARCHAR2(1) := ',';
    BEGIN
         -- Build file content as CLOB
      -- Replace with your query
         FOR i IN (select object_id A, object_name B, object_type C, status D, temporary E, generated F, secondary G,namespace H from user_objects where rownum < 10)               
         LOOP
        IF lc_clob IS NULL THEN
          lc_clob := i.A||lv_clmn_separator||i.B||lv_clmn_separator||i.C||lv_clmn_separator||i.D||lv_clmn_separator||i.E||lv_clmn_separator||i.F||lv_clmn_separator||i.G||lv_clmn_separator||i.H;
        ELSE
          lc_clob := lc_clob||CHR(10)||i.A||lv_clmn_separator||i.B||lv_clmn_separator||i.C||lv_clmn_separator||i.D||lv_clmn_separator||i.E||lv_clmn_separator||i.F||lv_clmn_separator||i.G||lv_clmn_separator||i.H;
        END IF;
         END LOOP; 
         -- Convert CLOB to BLOB
         DBMS_LOB.CREATETEMPORARY(lb_blob,TRUE);
         DBMS_LOB.convertToBlob(lb_blob,lc_clob,DBMS_LOB.LOBMAXSIZE,li_in,li_out,DBMS_LOB.DEFAULT_CSID,li_lang,li_warning);
         -- Send mail
         ln_id:= APEX_MAIL.SEND(
           p_to        => lv_mail_rcpts,
                 p_from      => lv_mail_from,
                 p_subj      => 'Subject Goes here',
                 p_body      => 'Body goes here'
           -- add CSV file as attachment
         APEX_MAIL.ADD_ATTACHMENT
           p_mail_id   => ln_id,
           p_attachment => lb_blob,
           p_filename   => 'filename.csv',
           p_mime_type  => 'application/csv'
      -- push mail queue
      APEX_MAIL.PUSH_QUEUE;
         -- empty temporary space
         DBMS_LOB.FREETEMPORARY ( lob_loc =>  lb_blob);       
         COMMIT;
    END;Regards,
    Hari

  • Yellow boxes within excel sheet on iPad

    When I send an email with an excel sheet attached and I open it on my iPad (others have the same issue) it has yellow boxes in it. How can we get rid of them? It is blocking some data. I have checked formatting, comments and nothing seems to remove them.

    You can try converting the top row to a Header Row and the leftmost column to a Header Column.
    SG

  • How to find the OBIEE report  (Catelogue) path from BI enabled excel sheet

    Dear All,
    I have an excel sheet where the data is coming from BI server. How can I find the BI report name and path from the excel sheet.
    Regards
    Mustafa

    Sorry Friends,
    May be I am not conveying the message properly.
    Let me try to do it again.
    I have an excel sheet which is created by somebody else and send me by mail.
    This excel sheet is having connectivity to the BI server and pulling data from BI.
    What I want to know is to get the BI report and view name from the excel sheet so that I can do some modification in the report.
    Please not the owner of the excel file is un-reachable.
    Let say I have uploaded the sample Excel in the following URL http://www.fileflyer.com/view/VSHtOA8.
    This excel file is pulling data from our BI Server
    Could anybody tell me the report path, name and view name from the excel file
    Regards
    Mustafa

  • Encoding issue in email send from SAP

    Hi,
    I am currently having encoding issue in email send by SRM .
    Can some one help me ?
    My problem :
    When i key in my SC subject/desc through IE7 with encoding unicode (UHT-8). Everything look fine.
    After i order the SC, Email will be sending out to the approver.
    The email received by approver is including strange character.
    Example desciption i putting on SC : Testing Encoding from IE7
    Result : Email which received by approver : Testing Encoding from IE7Â.
    Can some one advice me on this?
    Thanks,
    Vanece

    Hello Vanece,
    >
    Vanece Hee wrote:
    > (...)
    > They look fine in BBP_PD as well.
    >
    > when i trace them in SOST, the word will be look weird.
    > (...)
    Problem could come from internal and external data format.
    Depending on your SRM release, check OSS notes for report you used to generate approval mail ( RSWUWFMLEC, RBBP_NOTIFICATION_APP, etc.).
    >
    Vanece Hee wrote:
    > (...)
    > When i change the encoding setting in outlook to unicode for the email, it work for some email only.
    > (...)
    Ask to your Outlook team to have a look at Outlook settings.
    You can also check OSS note 1319517 - Unicode Collection Note.
    Regards.
    Laurent.

  • Non-English string access from excel sheet through JDBC

    My excel sheet data is
    Test ������������
    I am using JDBC connectivity for accessing the Excel sheet.
    Code looks like,
    List Output = new List();
    try
    Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
    c = DriverManager.getConnection( "jdbc:odbc:qa-list", "", "" );
    stmnt = c.createStatement();
    ResultSet rs = stmnt.executeQuery("select * from [Sheet1$];");
    ResultSetMetaData rsmd = rs.getMetaData();
    int numberOfColumns = rsmd.getColumnCount();
    for(int i=1; i <= numberOfColumns; i++){
    Output.add(rsmd.getColumnLabel(i));
    catch( Exception e )
    System.err.println( e );
    finally
    try
    stmnt.close();
    c.close();
    catch( Exception e )
    System.err.println( e );
    Now. I am showing those data into the table(JTable) Applet programming.
    For, English string it is showing properly but, for non-English string are showing �???????????????????�
    I would like to know what could be the reason.
    Addional info:
    ava version "1.6.0_01"
    Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
    Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)
    If possible please send some reference code .

    I have one excel sheet which having differenct countries specific meaining of common words.
    I am using JDBC connectivity for accessing that Excel sheet.
    Code looks like,
    List Output = new List();
    try
    Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
    c = DriverManager.getConnection( "jdbc:odbc:qa-list", "", "" );
    stmnt = c.createStatement();
    ResultSet rs = stmnt.executeQuery("select * from [Sheet1$];");
    ResultSetMetaData rsmd = rs.getMetaData();
    int numberOfColumns = rsmd.getColumnCount();
    for(int i=1; i <= numberOfColumns; i++){
    Output.add(rsmd.getColumnLabel(i));
    catch( Exception e ){
    System.err.println( e );
    finally{
    try{
    stmnt.close();
    c.close();
    catch( Exception e ){
    System.err.println( e );
    Now. I am showing those output data into the table(JTable) in my Applet programming.
    For, English string it is showing properly but, for non-English strings are showing question marks like, �?????�
    I would like to know what could be the reason.
    Please help me, i am stuck in my project.

  • Hlp reqd: Urgent!!!! An Excel attachment Having recs more than 255 char len

    Hi.. I am using the FM "SO_NEW_DOCUMENT_ATT_SEND_API1" for sending a outlook mail with excel sheet as an attachment.
    The records having length upto 255 chars are coming properly in diff rows(which means the carriage return is considered).
      But when records have more than 255 chars, then the chars exceeding 255 length are coming in a single row of excel sheet which means the carraige returns are not considered.
    Hope my issue is explained clearly....request every one to provide the solution as early as possible.
    Regards
    Nanda

    Hi Nanda,
    build your XLS internal table X as usual (more then 255 char). Then format the table
    X to a new one Y with line size 255. (You can do your own routine or use the FM SWA_STRING_FROM_TABL  and  SWA_STRING_TO_TABLE in sequence; sorry but I'm on 4.6C and didn't find a FM in order to format directly the internal table from line size XXXX to the desired line size).
    sample code:
    t_att_tab with line size 4000 containing the excell data with carriage return and so on
    objbin with line size 255 used in FM SO_NEW_DOCUMENT_ATT_SEND_API1
        data: d_string type string.
        call function 'SWA_STRING_FROM_TABLE'
          exporting
            character_table                  = t_att_tab
      NUMBER_OF_CHARACTERS             =
            line_size                        = 4000
      KEEP_TRAILING_SPACES             = ' '
      CHECK_TABLE_TYPE                 = ' '
         importing
           character_string                 = d_string
         exceptions
           no_flat_charlike_structure       = 1
           others                           = 2
        if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        endif.
        call function 'SWA_STRING_TO_TABLE'
          exporting
            character_string                 = d_string
      APPEND                           = ' '
            line_size                        = 255
      CHECK_TABLE_TYPE                 = ' '
         importing
           character_table                  = objbin
      TOTAL_LENGTH                     =
      LINE_SIZE_USED                   =
      LINES_FILLED                     =
      LAST_LINE_LENGTH                 =
         exceptions
           no_flat_charlike_structure       = 1
           others                           = 2
        if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        endif.
    It works!!!
    Paolo

  • Error while sending excel sheet as attachment to Mail Receiver

    Hi everyone,
    I am facing the below error when I am trying to send data to Mail receiver adapter. The attachment is excel sheet.
    Delivery of the message to the application using connection Mail_http://sap.com/xi/XI/System failed, due to: com.sap.aii.af.ra.ms.api.RecoverableException: Object not found in lookup of MessageTransformBean.: com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Object not found in lookup of MessageTransformBean..
    I don't understand where the problem is. This has been running since long time and last month we have changed our web dispatcher details. I hope everything is fine. But not sure the root cause for this issue.
    Please help me in resolving this.
    Thank you.
    Regards
    Bhanu T.

    Check if this helps: MessageTransformBean module
    Confirm that you have configured the MessagetransformationBean properly.
    Are you trying to convert some payload into Excel and send it as an attachment in the Mail CC? If yes, then I hope that you have included the correct Content_type value.
    Check this for more info on Content_type: /people/community.user/blog/2006/09/08/email-report-as-attachment-excelword
    Regards,
    Abhishek.

  • A temporary solution for issue of excel sheet for SO_NEW_DOCUMENT_ATT_SEND_

    Hi,
    we all sometime or the other have faced the problem with SO_NEW_DOCUMENT_ATT_SEND_API1, it passes all the data into a single excel sheet. the following is the code i have written using the same standard FM to resolve the issue.
    Problem's Facing     : To send the output of a report as mail attachment (Excel sheet) from SAP, to the User's outlook or TCP/IP
    What is happening     : All the data which is being passed to the excel is being put in a single cell of the excel sheet.
    Cause               : the difficulty lies in getting the internal table from SAP report, passing it to email Function Module If the structure of the internal Table is unknown .
    Solution:
    if the user while sending data to the Function module ( created using the following code) puts a '#' between field values, all the fields gets separated into individual cells and the data gets printed as required.
    <b>advantages</b> of the following code are:
    1) User just need to type userid or multiple userid's separated by comma.
    2) Performs multiple tasks with one function module.
    3) It can be used to send file with subject only
    4) It can be used to send file with subject and body
    5) It can be used to send file with subject, body, and attachment
    6) Attachment can be of 'TXT' format or 'XLS' format depending upon the choice of the user.
    7) User specific parameters for EMAILID, subject, body and attachment type avoiding the dump error of  "Type conflict"
    8) If the user requires to send output of a report as an excel file, then a single internal table will store the total output separating the field values by ' # ' and the data gets printed evenly. the ' # '  symbol is used as Tab delimiter.
    FUNCTION zemail_attachment.
    ""Local Interface:
    *"  IMPORTING
    *"     REFERENCE(EMAILID)
    *"     REFERENCE(SUBJECT)
    *"     REFERENCE(ATYPE)
    *"  TABLES
    *"      ATTACH_FILE STRUCTURE  SOLISTI1
    *"      BODY OPTIONAL
    *"  EXCEPTIONS
    *"      INCORRECT_PARAMETERS
    This table requires information about how the data in the
    tables OBJECT_HEADER, CONTENTS_BIN and CONTENTS_TXT are
    to be distributed to the documents and its attachments.
      DATA it_objpack LIKE sopcklsti1 OCCURS  2 WITH HEADER LINE.
    This table must contain the summarized data dependent on each object type.
    SAPscript objects store information here about forms and styles,
    for example. Excel list viewer objects store the number of rows and columns
    amongst other things and PC objects store their original file name.
      DATA it_objhead LIKE solisti1   OCCURS  1 WITH HEADER LINE.
    This table must contain the summarized content of the objects identified as binary objects.
      DATA   it_objbin TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                     WITH HEADER LINE.
    This table must contain the summarized content of the objects identified as ASCII objects.
      DATA it_objtxt  LIKE solisti1   OCCURS 10 WITH HEADER LINE.
    This table must contain the document recipients.
      DATA  it_reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE .
    This structure must contain the attributes of the document to be sent.
      DATA: doc_ching LIKE sodocchgi1.
      DATA: tab_lines LIKE sy-tabix.
    Create the internal table for body , subject
      DATA: it_body LIKE solisti1 OCCURS 10 WITH HEADER LINE.
    *creation of internal table for Email-id.
      DATA: BEGIN OF it_mailid OCCURS 0,
            email LIKE kna1-name1 ,
            END OF it_mailid.
    *VARIABLES
      DATA : v_hash(1) TYPE c VALUE '#'.
      DATA: v_string1 LIKE kna1-name1,
            v_string2 LIKE kna1-name1,
            v_string3(12) TYPE c VALUE '@GMAIL.COM'.
    *CONSATNTS
      CONSTANTS: c_con_cret TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
                 c_con_tab  TYPE c VALUE cl_abap_char_utilities=>cr_lf,
                 c_raw(3)   TYPE c VALUE 'RAW',
                 c_comma(1) TYPE c VALUE ',',
                 c_rec_type(1) TYPE c VALUE 'U',
                 c_space(1)    TYPE c VALUE ''.
    Move Body to Internal Table (body into it_body)
      LOOP AT body .
        MOVE body TO it_body .
        APPEND it_body .
      ENDLOOP.
      doc_ching-obj_descr = subject.   "Subject of the Email
    Move the Subject and Body to OBJTXT
      it_objtxt[] = it_body[].
      DESCRIBE TABLE it_objtxt LINES tab_lines.
      READ TABLE it_objtxt INDEX tab_lines.
      doc_ching-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( it_objtxt ).
      CLEAR it_objpack-transf_bin.
    it_objpack-head_start = 1.
    it_objpack-head_num   = 0.
    it_objpack-body_start = 1.
    it_objpack-body_num   = tab_lines.
    it_objpack-doc_type   = c_raw.
      APPEND it_objpack.
    Convert to Excel format
    IF NOT attach_file[] IS INITIAL.
      IF atype IS INITIAL.
    RAISE INCORRECT_PARAMETERS.
      ELSEIF atype = 'XLS' .
        LOOP AT attach_file .
          CONCATENATE attach_file v_hash INTO attach_file.
          REPLACE ALL OCCURRENCES OF v_hash IN attach_file WITH c_con_cret.
          IF sy-tabix = 1.
            MOVE attach_file TO it_objbin.
          ELSE.
            CONCATENATE c_con_tab attach_file INTO it_objbin.
          ENDIF.
          APPEND  it_objbin.
        ENDLOOP.
      ELSEIF atype = 'TXT' .
    Convert to Text format
        LOOP AT attach_file .
          REPLACE ALL OCCURRENCES OF v_hash IN attach_file WITH c_con_cret.
          CONCATENATE attach_file c_con_tab  INTO it_objbin .
          APPEND it_objbin .
        ENDLOOP.
      ENDIF.
      DESCRIBE TABLE it_objbin LINES tab_lines.
      it_objhead = subject. APPEND it_objhead.
    Creating the entry for the compressed attachment
      it_objpack-transf_bin = 'X'.
      it_objpack-head_start = 1.
      it_objpack-head_num   = 1.
      it_objpack-body_start = 1.
      it_objpack-body_num   = tab_lines.
    *check for XLS ,TXT files
      IF atype = 'XLS'.
        it_objpack-doc_type   = atype.
      ELSEIF atype = 'TXT'.
        it_objpack-doc_type   = c_raw.
      ENDIF.
      it_objpack-obj_name   = 'ATTACHMENT'.
      it_objpack-obj_descr = 'ATTACHMENT'. "Attachment File Name
      it_objpack-doc_size   = tab_lines * 255.
      APPEND it_objpack..
    ENDIF.
    Entering names in the distribution list
    Concatenating the email with '@GMAIL.COM if the user doesnot specify any mail extension
    recipent type as U - for internet usage
      SPLIT emailid AT c_comma INTO TABLE it_mailid.
      APPEND it_mailid.
      LOOP AT it_mailid.
        SHIFT it_mailid-email LEFT DELETING LEADING c_space.
        SPLIT it_mailid-email AT '@' INTO: v_string1 v_string2.
        IF v_string2 IS INITIAL AND NOT it_mailid-email IS INITIAL.
          CONCATENATE v_string1 v_string3 INTO it_reclist-receiver.
          it_reclist-rec_type = c_rec_type.
          APPEND it_reclist.
          CLEAR: v_string1,v_string2.
        ELSE.
          it_reclist-receiver = it_mailid-email.
          it_reclist-rec_type = c_rec_type.
          APPEND it_reclist.
        ENDIF.
      ENDLOOP.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = doc_ching
          put_in_outbox              = 'X'
          commit_work                = 'X'
        TABLES
          packing_list               = it_objpack
          object_header              = it_objhead
          contents_bin               = it_objbin
          contents_txt               = it_objtxt
          receivers                  = it_reclist
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          operation_no_authorization = 4
          OTHERS                     = 99.
    ENDFUNCTION.
    If anyone, has a better solution, please share
    Cheers
    Ajay

    issue resolved

Maybe you are looking for

  • Help me Decide on OpenBSD or Solaris as my web and file server please

    Hi 5 questions i have been using OpenBSD as my Web and file server for a while now and FreeBSD as my Desktop i decided on OpenBSD as my Server because of its Security 1) But now i hear Solaris is the most Secure OS pn the Planet? is this true And whi

  • Is LR 3 compatible with Windows 8.1?

    I currently have LR 3 but just bought a new computer with windows 8.1.  Do I need to upgrade to LR 5 right now, or will LR 3 work with Windows 8.1 allowing me to wait a bit before upgrading to LR 5?

  • APEX 4.0.2 Project Gantt Chart - Error Code: 2002 Message: Empty input

    Hi I have created a brand new page containing a Project Gantt Chart region. The Gantt chart is designed to track the progress of a job over time. The page has one chart series containing the following SQL. SELECT null LINK, stage NAME, rownum ID, nul

  • SAP Implementation for Cement company.

    Hi Gurus, I want your help. I have been given an opportunity to implement SAP for Cement company. Being a basis consultant how should i go about it. I have support exp but  this is my first implementation so i m bit nervous. Please help me how to sta

  • ADOBE reader for ipad won't install

    I had adobe reader on my ipad for at least a year. Have a subscription to the pdf to word doc conversion. Adobe pushed an update on Oct 9. I tried to install it a lot of times, but it always hanged. So today I have figured I will just delete the app