Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

not able to open file in XLS format of email attachement, error 'it is not recognized format'

Former Member
0 Kudos

Hi,

I have to send data in excel format using attachment, I have code accordingly,but when I open the attachement that came in the mail box,and save it, it shows the error message that 'it is not recognized format'. so how can i resolve this issue?

Currently I am using the Office 2003  ,and to open  office 2007  file , i have installed the office Compability pack .

So, please let me know that how can i solve this problem?

Thanks,

Dhaval

4 REPLIES 4

Former Member
0 Kudos

Hi,

File which your are sending as an attachment will be in 2010 word format so while saving you have to change it to your compatibly format which would be '.xla' for excel 1997-2003.

Hope this is useful.

0 Kudos

Hi Uma,

I give brief about error.

when I execute my program, it create attachement in excel, and send it as attachment on Mail and also Blackberry phone,but when I Open it from Mailbox , it show first error '' it is not in recognized format'., and when i click on OK button ,it shows data

But In Blackberrry phone,that file does not open due to this error

for that, to check out file, I have used GUI_DOWNLOAD,but having the same problem ''' it is not in recognized format', so how can solve this error?

Here I have installed Microsoft 2003, and to open 2007 file, I have installed Office Compability Pack... There is no office 2010

0 Kudos

Hi

The problem is that when you download a file from SAP as excel it stored as a tab delimited file not as excel format(even its extension is XLS, XLSX, etc.).. The MS excel recognize automatically these tab delimited files and opens them after the information message but the blackberry office suite cannot recognize them correctly.  A solution is to save the file as CSV or to change the extension from *.xls to *.txt

0 Kudos

Hi George,

Thanks...

Can you look into this code...where I am missing Something  .

And I can resolve the error that "it is not in recognized format"

   form SEND_MAIL_ATTACH_ZO .
  DATA: i_messageZO TYPE STANDARD TABLE OF solisti1,
        wa_messageZO TYPE solisti1,
        i_receiversZO TYPE STANDARD TABLE OF somlreci1,
        wa_receiversZO TYPE somlreci1,
        i_Packing_listZO TYPE STANDARD TABLE OF sopcklsti1,
        wa_Packing_listZO TYPE sopcklsti1.

  DATA: t_contentsZO LIKE solisti1 OCCURS 0 WITH HEADER LINE,
        t_object_headerZO LIKE solisti1 OCCURS 0 WITH HEADER LINE,
        w_cntZO TYPE i,
        w_sent_allZO(1) TYPE c,
        w_doc_dataZO LIKE sodocchgi1.

  DATA: 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,
        l_userdata TYPE qisrsuser_data.

  CLEAR l_userdata.
  CALL FUNCTION 'ISR_GET_USER_DETAILS'
    EXPORTING
      id_user_id     = sy-uname
    CHANGING
      is_user_data   = l_userdata
    EXCEPTIONS
      user_not_found = 1
      OTHERS         = 2.
  IF sy-subrc NE 0.
  ENDIF.


  REFRESH i_messageZO.
  wa_messageZO = 'Hi,'.
  APPEND wa_messageZO TO i_messageZO.
  CLEAR wa_messageZO. APPEND wa_messageZO TO i_messageZO.
  CONCATENATE 'PFA the Customerwise Sales Flash Report of Sales Office :'
              wa_finalZO-vkbur INTO wa_messageZO
              SEPARATED BY space.
  APPEND wa_messageZO TO i_messageZO.
  CLEAR wa_messageZO. APPEND wa_messageZO TO i_messageZO.
  wa_messageZO = 'Thanks & Regards,'.
  APPEND wa_messageZO TO i_messageZO.
  wa_messageZO = l_userdata-fullname.
  APPEND wa_messageZO TO i_messageZO.


  ld_mtitle         = 'Sales Flash Report'.
  ld_format         = 'XLS'" 'XLS'.
  ld_attdescription = 'Sales Flash Report'.
  ld_attfilename    = 'Sales Flash Report'.


* Fill the document data and get size of attachment
  CLEAR: w_doc_dataZO,wa_attachZO.
* Fill the document data.
  w_doc_dataZO-obj_langu = sy-langu.
  w_doc_dataZO-obj_name  = 'SAPRPT'.
  w_doc_dataZO-obj_descr = 'Sales Flash Report'.
  w_doc_dataZO-sensitivty = 'O'"  'F'.

  DESCRIBE TABLE i_attachZO LINES w_cntZO.
  READ TABLE i_attachZO INTO wa_attachZO INDEX w_cntZO.
  w_doc_dataZO-doc_size =
     ( w_cntZO - 1 ) * 3 * 255 + STRLEN( wa_attachZO ) + 2 .


* Describe the body of the messageZO
  CLEAR wa_Packing_listZO.
  REFRESH i_Packing_listZO.
  wa_Packing_listZO-transf_bin = space.
  wa_Packing_listZO-head_start = 1.
  wa_Packing_listZO-head_num = 0.
  wa_Packing_listZO-body_start = 1.
  DESCRIBE TABLE i_messageZO LINES wa_Packing_listZO-body_num.
  wa_Packing_listZO-doc_type =  'RAW'.
  APPEND wa_Packing_listZO TO i_Packing_listZO.

* Create attachment notification
  wa_Packing_listZO-transf_bin = 'X'.
  wa_Packing_listZO-head_start = 1.
  wa_Packing_listZO-head_num   = 1.
  wa_Packing_listZO-body_start = 1.

  DESCRIBE TABLE i_attachZO LINES wa_Packing_listZO-body_num.
  wa_Packing_listZO-doc_type   =  ld_format.
  wa_Packing_listZO-obj_descr  =  ld_attdescription.
  wa_Packing_listZO-obj_name   =  ld_attfilename.


  DESCRIBE TABLE i_attachZO LINES w_cntZO.
  READ TABLE i_attachZO INTO wa_attach INDEX w_cntZO.
  wa_Packing_listZO-doc_size =
     ( w_cntZO - 1 ) * 3 * 255 + STRLEN( wa_attachZO ) + 2 .
  APPEND wa_Packing_listZO TO i_Packing_listZO.


* Add the recipients email address
  REFRESH i_receiversZO.
  LOOP AT i_zsdZOemail INTO wa_zsdZOemail
  WHERE vkbur EQ wa_finalZO-vkbur.
    CLEAR wa_receiversZO.
    wa_receiversZO-receiver = wa_zsdZOemail-smtp_addr.
    wa_receiversZO-rec_type = 'U'.
    wa_receiversZO-com_type = 'INT'.
    wa_receiversZO-notif_del = 'X'.
    wa_receiversZO-notif_ndel = 'X'.    APPEND wa_receiversZO TO i_receiversZO.
  ENDLOOP.

   IF NOT i_receiversZO[] IS INITIAL.
    CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
      EXPORTING
        document_data              = w_doc_dataZO
        put_in_outbox              = 'X'
        commit_work                = 'X'
      IMPORTING
        sent_to_all                = w_sent_allZO
      TABLES
        Packing_list               = i_Packing_listZO
        contents_bin               = IT_VALUE[]"i_attachZO[]
        contents_txt               = i_messageZO
        receivers                  = i_receiversZO
      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.


*   Instructs mail send program for SAPCONNECT to send email(rsconn01)
    WAIT UP TO 2 SECONDS.
    SUBMIT rsconn01 WITH mode = 'INT'
                  WITH output = 'X'
                  AND RETURN.
  CLEAR : IT_VALUE," Dhaval
          IT_VALUE[].

  ENDIF.