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

Function Module : SCMS_BINARY_TO_TEXT

Former Member
0 Likes
3,139

Hi,

I use the follwoing Function Module to convert from Binary to Text.I call it in the following way:

DO 10 times.

CALL FUNCTION 'SCMS_BINARY_TO_TEXT'

EXPORTING

INPUT_LENGTH = 255

APPEND_TO_TABLE = 'X'

WRAP_LINES = 'X'

TABLES

BINARY_TAB = LT_BINARY

TEXT_TAB = LT_TEXT_OUT

ENDDO.

This is because my input table LT_BINARY has binary fields of length 255 and i want the result to be returned as a concatenated text in the output table LT_TEXT_OUT.

But every time the next 255 chars are appended to the output table LT_TEXT_OUT, i get the text in a new line and not continuously.

So instead of getting continous text, i am getting text seperated by a new line after every 255 chars.

How can i get continuous text????

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,602

Hi,

Step 1:

After using the Function module 'SCMS_BINARY_TO_TEXT'.

Step 2:

Use below function module inorder to convert as string from a given internal table(that fetched from(step 1)).

CALL FUNCTION 'SCMS_TEXT_TO_XSTRING'

  • EXPORTING

  • FIRST_LINE = 0

  • LAST_LINE = 0

  • MIMETYPE = ' '

IMPORTING

BUFFER = lv_XSTRING

TABLES

TEXT_TAB = LT_TEXT_OUT

EXCEPTIONS

FAILED = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Thanks,

Naga

4 REPLIES 4
Read only

Former Member
0 Likes
1,602

Hi,

Every time this internal table <b>LT_TEXT_OUT</b> will be appended with the converted text, it is not possible from this Function module to get the data in a single line.

if you want to meet your requirment, then use the same code which you have written, then add this code.

create one more internal table and loop the Internale table <b>LT_TEXT_OUT</b> and move to the new internal table,

lets take an example, if you want the first 2 lines in a single row, then write with in the loop..

move: LT_TEXT_OUT to New_inernal table.

if sy-tabix = 2.

move: LT_TEXT_OUT to New_inernal table+255(255).

endif.

like this way you can write the code to meet your requirment.

hope this helps you to solve the Problem

Regards

Sudheer

Read only

Former Member
0 Likes
1,603

Hi,

Step 1:

After using the Function module 'SCMS_BINARY_TO_TEXT'.

Step 2:

Use below function module inorder to convert as string from a given internal table(that fetched from(step 1)).

CALL FUNCTION 'SCMS_TEXT_TO_XSTRING'

  • EXPORTING

  • FIRST_LINE = 0

  • LAST_LINE = 0

  • MIMETYPE = ' '

IMPORTING

BUFFER = lv_XSTRING

TABLES

TEXT_TAB = LT_TEXT_OUT

EXCEPTIONS

FAILED = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Thanks,

Naga

Read only

0 Likes
1,602

If you want the output in single line use FM

SCMS_BINARY_TO_STRING .

if you want the resulting string to be in an itab.

declare a itab type string.

data: stringtab type standard table of string.

append <result string from FM> to stringtab .

Hope this helps.

Regards

Raja

Read only

0 Likes
1,602

if the question is answered, can you mark it so and close it.

Regards

Raja