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

SCMS_TEXT_TO_BINARY - Problems converting data

Former Member
0 Likes
7,119

HI

I have to convert an internal table in a binary string.

I red several threads referring to this FM.

This is my code

*OUTPUT STRUCTURE

TYPES: BEGIN OF tp_tab,

vbeln LIKE vbak-vbeln,

erdat LIKE vbak-erdat,

kunnr LIKE vbak-kunnr,

name1 LIKE kna1-name1.

TYPES: END OF tp_tab.

*GENERAL TABLE

DATA: it_data TYPE standard table of tp_tab,

lt_att_content_hex TYPE TABLE OF solix.

.....omissis

CALL FUNCTION 'SCMS_TEXT_TO_BINARY'

EXPORTING

FIRST_LINE = 1

LAST_LINE = 10

APPEND_TO_TABLE = 'X'

  • MIMETYPE = ' '

  • IMPORTING

  • OUTPUT_LENGTH =

TABLES

text_tab = it_data

binary_tab = lt_att_content_hex

EXCEPTIONS

FAILED = 1

OTHERS = 2

.

As you can see my internal table consist of 4 fields. the table consist of 10 rows

The problem is that the binary table contains only the first fields of the table (so VBELN)

Any Idea?

Thanks in advance

3 REPLIES 3
Read only

venkat_o
Active Contributor
0 Likes
2,662

Hi, <li>Once you get Binary data using SCMS_TEXT_TO_BINARY, You need call SCMS_BINARY_TO_XSTRING to convert that binary data to xstring format, use it . Thanks Venkat.O

Read only

Former Member
0 Likes
2,662

i agree with Venkat.O as he told u do like

Example:


*- Convert the string into xstring
  call function 'SCMS_STRING_TO_XSTRING'
   exporting
     TEXT     =k_string
   IMPORTING
     BUFFER   = v_xstring
   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.
 
*-  Convert the string into binary table
 CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
   EXPORTING
     buffer     = v_xstring
   TABLES
     binary_tab = ta_excelx.

Read only

0 Likes
2,662

Hello Krupa janiji,

i am also following same way. first i am converting my document path to xstring format using scms_text_to_xstring. then next i want convert xstring to binary format i am using this fm scms_xstring_to_binary. still i am getting xstring format only. can you please suggest me. how solve this  issue.

i am pasting my code here.

data: buffer type xstring,

        lv_string type string.

        lv_string = 'file name'.

call function 'SCMS_STRING_TO_XSTRING'

   exporting

     TEXT             = lv_string

   IMPORTING

     BUFFER        = buffer

   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.

*-  Convert the string into binary table

CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'

   EXPORTING

     buffer     = buffer

   TABLES

     binary_tab = lt_binary.