Application Development and Automation 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: 
Read only

Binary to Text

Former Member
0 Likes
777

Hi i am using function module SCMS_BINARY_TO_STRING to convert Binary data [28*1000] to Text format.

DATA outrec TYPE string.

CALL FUNCTION 'SCMS_BINARY_TO_STRING'

EXPORTING

input_length = 28000

FIRST_LINE = 1

LAST_LINE = 28

  • MIMETYPE = ' '

IMPORTING

text_buffer = outrec

  • OUTPUT_LENGTH =

TABLES

binary_tab = l_pdf_data

  • EXCEPTIONS

  • FAILED = 1

  • OTHERS = 2

.

The resultant Text data is stored in "outrec" variable. But when i try to write this data to file, I notice that outrec does not contain all the data in the Binary format.

Can you please advice, if I am passing the parameters wrongly.

Thanks

Shital

3 REPLIES 3
Read only

Former Member
0 Likes
577

can u please explain what l_pdf_data holds...so that we can check and correct ur error.

Read only

0 Likes
577

This is how l_pdfdata gets populated. The below FM read data from PDF formated spool

*Read the spool content

CALL FUNCTION 'FPCOMP_CREATE_PDF_FROM_SPOOL'

EXPORTING

i_spoolid = p_spono

i_partnum = '1'

IMPORTING

e_pdf = pdf_data

  • e_pdf_file = file

EXCEPTIONS

ads_error = 1

usage_error = 2

system_error = 3

internal_error = 4

OTHERS = 5.

  • Modify the spool contents to prepare internal table

l_len = XSTRLEN( pdf_data ).

WHILE l_len >= 1000.

l_pdf_line = pdf_data+l_offset(1000).

APPEND l_pdf_line TO l_pdf_data.

ADD 1000 TO l_offset.

SUBTRACT 1000 FROM l_len.

ENDWHILE.

IF l_len > 0.

l_pdf_line = pdf_data+l_offset(l_len).

APPEND l_pdf_line TO l_pdf_data.

ENDIF.

Read only

Former Member
0 Likes
577

Unresolved