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_XSTRING_TO_BINARY' add zero '0000000' to xstring

Former Member
0 Likes
2,209

I have a RAWSTRING xxx (get from DB) and want download it using GUI_DOWNLOAD.

According to some posts, I call 'SCMS_XSTRING_TO_BINARY'

data: data_tab type table of x255.

call function 'SCMS_XSTRING_TO_BINARY'

exporting

buffer = xxx

tables

binary_tab = data_tab.

But I find that 'SCMS_XSTRING_TO_BINARY' add many '0000000000' after xxx, for example:

xxx:..............2FF84D8592BDC35AEA507762

data_tab: .....2FF84D8592BDC35AEA5077620000000000000000

I don't want the '0000000000' , How can I do?

Thanks!

2 REPLIES 2
Read only

Former Member
0 Likes
890

Hi,

In addition to the 'binary_tab' the FM returns the string length 'output_length' . Use this length in reading the 'data_tab'

and restrict the Zero's.

CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'

EXPORTING

buffer = xxx

IMPORTING

output_length = lv_strlen

TABLES

binary_tab = data_tab.

Regards,

Srini.

Read only

Former Member
0 Likes
890

Thanks. The code :

data: xxx type xstring.

data: data_tab type table of x255.

data: len type i.

call function 'SCMS_XSTRING_TO_BINARY'

exporting

buffer = xxx

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 ).