on 09-03-2014 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.
Hi Maria,
I had exactly the same problem, and the error was the length of the binary. When you convert the file from binary to xstring, the parameter "input_length" should be exactly the length of the binary.
If the length doesn't fit, the file is downloaded ok, but the "corrupted file error" appears...
I hope it helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear
I guess it has problem with .doc extension but
.txt you can read
and also .docx and .xlsx will provide the content
it is only this .doc and .xls which will create problem.
e.g. .docx after downloading will give one .zip file.
change its extension to .doc or .docx. the content will be there.
thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear
Check which msoffice installed on your system install msoffice 2010 then it will read docx properly
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
on my System i have msoffice 2010. I need to make some adjustments when downloading the binary file from the content server to application server. With msoffice 2007 I didnt have any problem with the code. The Binary file is retrieved from the content server using the FM SCMS_DOC_READ and is written on the application server using OPEN DATASET xxxx FOR OUTPUT IN BINARY MODE. I need to keep it in binary mode. As I said it works fine with .doc files.
Thanks.
Hi,
both the CV02N and the report DMS_KPRO_READ are not working for me because we have our own implementation.
Is there any alternative FM to SCMS_DOC_READ to read the office 2010 file (in binary) from the content server?
Should they be some additional steps to do with the binary file before writting it on the application server for office 2010 documents?
Thanks
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.