Skip to Content
-3

GUI_Download: Error opennig the document, file is damaged and could not be repaired

Mar 13 at 09:40 AM

66

avatar image

Hi ,

I am using SCMS_XSTRING_TO_BINARY FM to convert the Xstring data to binary data.

And then using GUI_download to generate PDF.

but the generated pdf file is damaged and not able to read it.

Below is the code:

REPORT Z_XSTRING_TO_PDF.

data: data_tab type table of x255,
lv_content TYPE Xstring,
len type i,
filename TYPE STRING.
Filename = 'C:\Users\panchasa\Desktop\test1.pdf'.
"passing the Xstring data to lv_content .
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
BUFFER = lv_content
* APPEND_TO_TABLE = ' '
IMPORTING
OUTPUT_LENGTH = len
TABLES
BINARY_TAB = data_tab.
.
cl_gui_frontend_services=>gui_download(

exporting

BIN_FILESIZE = len

filename = FILENAME

filetype = 'BIN'

changing

data_tab = data_tab ).

cl_gui_frontend_services=>execute(
exporting
document = filename ) .

Can you please help me to findout, what I am doing wrong?

Regards,

Sachin.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Horst Keller
Mar 13 at 10:29 AM
1

"using GUI_download to convert it to pdf."

Since when does GUI_download convert data?

Why do you expect it to do so?

In binary mode it simply writes binary data and apparently you write wrong data.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi ,

Thank you for your response.

Sorry, that was a typo, i am using GUI_download to generate the PDF file by using the data in "data_tab[]" .

but the generated file is damaged , and not able to open it.

0
Sachin Panchal Mar 14 at 06:24 AM
-2

Closing the thread. Got the answer.

<moderator edit - reopened so OP can share answer>

Show 1 Share
10 |10000 characters needed characters left characters exceeded

We are a community. You came to the community asking for help. People were prrepared to share their knowledge, time and effort trying to help you. Therefore it's only fair that you share with us what the answer is, so that other people can share your knowledge.

I have reopened the thread for you to provide that information, since I'm sure that really, you are a community minded person.

4