Skip to Content
author's profile photo Former Member
Former Member

PDF Attachements are corrupted and can not be opened with Adobe Reader XI

Hi colleagues.

In our system we want to sent attachments from DMS to email addresses

We use the FM SCMS_XSTRING_TO_BINARY

to create the attachment

eg the code

CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lv_data_string
* APPEND_TO_TABLE = ' '
* IMPORTING
* OUTPUT_LENGTH =
TABLES
binary_tab = et_bin[]

However in the resulting internal table binary_tab there are a few blank lines (ie lines filled with 0000)

in the end.

I delete these lines (blank lines) and the attachement can be read with Adobe Reader.

ie I added the code:

* count of lines of internal table
clear lv_lines_hex_tab .
describe table et_bin lines lv_lines_hex_tab .

if lv_lines_hex_tab gt 0 .

* create the blank line
clear ls_blank_line .

* finding the last lines of et_bin , which are blank
clear : lv_ndx , lv_limit1 , lv_limit2 .
lv_ndx = lv_lines_hex_tab .

do lv_lines_hex_tab times.
clear ls_hex_line .
read table et_bin index lv_ndx into ls_hex_line .
if ls_hex_line eq ls_blank_line .
if lv_limit2 is initial .
lv_limit2 = lv_ndx .
endif .
lv_limit1 = lv_ndx .
else .
exit .
endif .
lv_ndx = lv_ndx - 1 .
enddo.


* deleting the last lines of et_bin , which are blank
if ( lv_limit2 gt 0 )
and ( lv_limit1 gt 1 )
and ( lv_limit1 le lv_limit2 ) .
delete et_bin from lv_limit1 to lv_limit2 .
endif .

endif .

Is this correct or should I use the OUTPUT_LENGTH of the FM SCMS_XSTRING_TO_BINARY

Thanks a lot.

Stefanos

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Feb 10, 2014 at 05:18 PM

    Output length should be used.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 10, 2014 at 05:49 PM

    Hello,

    Data: lv_input_length TYPE i.

    lv_input_length = lv_lines_hex_tab * sy-tleng .

    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'

    EXPORTING

    buffer = lv_data_string

    * APPEND_TO_TABLE = ' '

    * IMPORTING

    OUTPUT_LENGTH = lv_input_length

    TABLES

    binary_tab = et_bin[]


    Thanks & Regards,


    Abhijit

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 11, 2014 at 11:08 AM

    Its because you are not properly calculating the output width for the pdf.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.