on 2014 Sep 03 5:30 AM
Hi Guys,
While downloading the .docx file in code the file gets downloaded properly. But when opening it locally it a message is shown that the file is corrupted and can be repared. When I clickon ok. It gets repaired. I didnt have the problem with .doc file. Internally, the MIME type of the .docx file is saved as 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'. The .docx file is read from a content server as a binary file and also written on the application server as a binary file (line lenght 1022)
Can anyone tell why the contents of the file could not be viewed while opening in the application the file but can be viewed when saved as local file( the pop up information with a message that the file was corrupted and could be repaired appeared first. I choose the ok button for the file to be repaired and the content was then showed)?
Thanks in advance
DATA: lt_access_info TYPE TABLE OF sdokfilaci,
lt_ascii_content TYPE TABLE OF sdokcntasc,
lt_binary_content TYPE TABLE OF sdokcntbin.
DATA: lv_doc_lenght TYPE i,
lv_qty_lines TYPE i,
lv_xstring TYPE xstring.
CALL FUNCTION 'SDOK_PHIO_LOAD_CONTENT'
EXPORTING
object_id = w_object_id
raw_mode = 'X'
TABLES
file_access_info = lt_access_info
file_content_ascii = lt_ascii_content
file_content_binary = lt_binary_content
EXCEPTIONS
not_existing = 1
not_authorized = 2
no_content = 3
bad_storage_type = 4
OTHERS = 5.
IF sy-subrc <> 0.
RETURN.
ENDIF.
FIELD-SYMBOLS: <lt_access_info> LIKE LINE OF lt_access_info.
READ TABLE lt_access_info ASSIGNING <lt_access_info> INDEX 1.
IF sy-subrc IS INITIAL AND <lt_access_info>-file_size IS NOT INITIAL.
lv_doc_lenght = <lt_access_info>-file_size.
ELSE.
lv_qty_lines = lines( lt_binary_content ).
lv_doc_lenght = lv_qty_lines * 1022.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
103 | |
9 | |
8 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.