转自http://guanhuaing.iteye.com/blog/1498891
代码如下
report zrich_0001.
data: s type string,
h(1) type x,
c(1) type c,
byte(2) type c,
length type i,
l_bindata type xstring,
l_cntbin TYPE sdokcntbins.
FIELD-SYMBOLS: .
s = 'This Is A String!'.
length = strlen( s ).
* Use Write to Convert String to XSTRING
write:/ 'Use Write to Convert String to XSTRING' .
ULINE /1(80).
New-line.
do length times.
byte = ( sy-index - 1 ).
c = s+byte(1).
* You can do this
ASSIGN h TO TYPE 'X'.
WRITE c TO .
write: h.
enddo.
* Use Function to Convert String to XSTRING
call function 'SCMS_STRING_TO_XSTRING'
exporting
text = s
* MIMETYPE = ' '
impor