2017 Apr 06 10:32 AM
I want to convert Text to binary..which is further added into mail attachment and sent to mail..
But when I am using SCMS_TEXT_TO_BINARY , it adds up zeros in the back
Test example .
data : begin of t_dwn occurs 0,
text1(30) type c,
end of t_dwn .
data: filesize type i,
lt_bin type solix_tab .
t_dwn-text1 = 'AB'.
append t_dwn.
call function 'SCMS_TEXT_TO_BINARY'
importing
output_length = filesize
tables
text_tab = t_dwn[]
binary_tab = lt_bin
exceptions
failed = 1
others = 2.
HERE t_dwn having AB is converted into binary...41420D0A but its add up zeroes into
lt_bin : looks like .41420D0A000000000000000000000000000000000000000000000
I don't want zeros at the back .
.I tried looking at other solution which suggested to use SCMS_STRING_TO_XSTRING and SCMS_XSTRING_TO_BINARY ..but was not able to do that.
Please suggest.
I want to convert Text to binary..which is further added into mail attachment and sent to mail..
But when I am using SCMS_TEXT_TO_BINARY , it adds up zeros in the back
Test example .
data : begin of t_dwn occurs 0,
text1(30) type c,
end of t_dwn .
data: filesize type i,
lt_bin type solix_tab .
t_dwn-text1 = 'AB'.
append t_dwn.
call function 'SCMS_TEXT_TO_BINARY'
importing
output_length = filesize
tables
text_tab = t_dwn[]
binary_tab = lt_bin
exceptions
failed = 1
others = 2.
HERE t_dwn having AB is converted into binary...41420D0A but its add up zeroes into
lt_bin : looks like .41420D0A000000000000000000000000000000000000000000000
I don't want zeros at the back .
.I tried looking at other solution which suggested to use SCMS_STRING_TO_XSTRING and SCMS_XSTRING_TO_BINARY ..but was not able to do that.
Please suggest.
2017 Apr 06 11:19 AM
The zeroes at the end represent the "blank" spaces.
What is exactly the problem you are facing with the trailing zeroes?
2017 Apr 06 11:41 AM
begin of t_dwn occurs 0Oh please, pretty please, not in 2017!
And if you'd used contemporary instead of obsolete ABAP you might also find classes as CL_ABAP_CODEPAGE instead of (undocumented) function modules
2017 Apr 07 6:08 AM
Hello Horst,
Do we have any alternative to the FM SCMS_XSTRING_TO_BINARY ?
Thanks,
K.Kiran
2017 Apr 07 11:47 AM
WYCIWYG
DATA xstr TYPE xstring VALUE '0123456789ABCDEF'.
DATA binary_line TYPE xstring.
DATA binary_tab LIKE TABLE OF line.
data(len) = 3.
DATA(length) = xstrlen( xstr ).
WHILE length >= len.
APPEND xstr(len) TO binary_tab.
SHIFT xstr BY len PLACES LEFT IN BYTE MODE.
length = xstrlen( xstr ).
ENDWHILE.
IF length > 0.
APPEND xstr TO binary_tab.
ENDIF.
cl_demo_output=>display( binary_tab ).
2017 Apr 06 11:44 AM
Are you sure? Shouldn't bLank spaces be something like 200020002000200020002000200020002000200020002000...
2017 Apr 06 12:18 PM
I want to remove...the zeros which are creating extra space...
Eg :
Suppose my File has two line items..
Hello
Hello India
When my file is sent in mail..the extra zeroes..we got on converting text to binary....add up as space ..in 3rd line and cursor goes
1 line Hello
2 line Hello India
3 line (this will be the blank line with cursor at some random place..generated due to extra 000 creating blank space)
So my problem is ..The cursor should stop exactly on 3rd line staring ..or second line end at HELLO INDIA .
This format is further uploaded..so extra 3rd line space...is creating problem
Thanks in Advance.
2017 Apr 06 12:58 PM
My wording was incorrect, thanks for pointing it out.
I meant SOLIX line of length 255 bytes, the trailing zeroes are because of the empty bytes. Is "empty byte" the correct term here?
2017 Apr 07 12:54 PM
you can send text via the email standard features, why do you need to convert into binary? Maybe it is for getting it in a given code page, but otherwise it's not needed.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |