Conversions : XSTRING to STRING
Code:
---------------------------------------------------------------------------------------------------------------
PARAMETERS : str TYPE string.
DATA : xstr TYPE xstring.
* converting string to xstring*
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = str " pass the string
* MIMETYPE = ' '
* ENCODING =
IMPORTING
buffer = xstr " get the xstring
EXCEPTIONS
FAILED = 1
OTHERS = 2.
WRITE :/ 'string:', str.
WRITE :/ 'xstring', xstr.
ULINE.
* converting string to string*
data : ls_bin type c LENGTH 255,
lt_bin like TABLE OF ls_bin,
len type i,
strc TYPE string.
*converting xstring to binary *
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = xstr
* APPEND_TO_TABLE = ' '
IMPORTING
OUTPUT_LENGTH = len
TABLES
binary_tab = lt_bin.
*converting binary to string *
CALL FUNCTION 'SCMS_BINARY_TO_STRING'
EXPORTING
input_length = len
IMPORTING
TEXT_BUFFER = strc
tables
binary_tab = lt_bin
EXCEPTIONS
FAILED = 1
OTHERS = 2.
WRITE :/ 'xstring:', xstr.
WRITE :/ 'string:', strc.
---------------------------------------------------------------------------------------------------------------
Steps.
--------------------------------------------------------------------------------------
Code:
---------------------------------------------------------------------------------------------------------------
PARAMETERS : str TYPE string.
DATA : xstr TYPE xstring.
* converting string to xstring*
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = str " pass the string
* MIMETYPE = ' '
* ENCODING =
IMPORTING
buffer = xstr " get the xstring
EXCEPTIONS
FAILED = 1
OTHERS = 2.
WRITE :/ 'string:', str.
WRITE :/ 'xstring', xstr.
ULINE.
* converting string to string*
data : ls_bin type c LENGTH 255,
lt_bin like TABLE OF ls_bin,
len type i,
strc TYPE string.
*converting xstring to binary *
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = xstr
* APPEND_TO_TABLE = ' '
IMPORTING
OUTPUT_LENGTH = len
TABLES
binary_tab = lt_bin.
*converting binary to string *
CALL FUNCTION 'SCMS_BINARY_TO_STRING'
EXPORTING
input_length = len
IMPORTING
TEXT_BUFFER = strc
tables
binary_tab = lt_bin
EXCEPTIONS
FAILED = 1
OTHERS = 2.
WRITE :/ 'xstring:', xstr.
WRITE :/ 'string:', strc.
---------------------------------------------------------------------------------------------------------------
Steps.
--------------------------------------------------------------------------------------
No comments:
Post a Comment