Gyan Factory

Gyan Factory
SAP Technical Project Support

Wednesday, January 6, 2016

Conversions (2) : XSTRING to STRING

Conversions : XSTRING to STRING
Code:
---------------------------------------------------------------------------------------------------------------
PARAMETERS str TYPE string.
DATA xstr TYPE xstring,
       strc TYPE string.
" converting string to xstring *
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
  EXPORTING
    text   str
  IMPORTING
    buffer xstr.
WRITE :'string:'str.
WRITE :'xstring:',xstr.
ULINE.
" converting xstring to string *
CALL METHOD cl_abap_conv_in_ce=>create
  EXPORTING
    input xstr    " Input Buffer (X, XSTRING)
  RECEIVING
    conv  DATA(lr_conv).

lr_conv->read(
  IMPORTING
    data    strc ).    " Data Object To Be Read

WRITE :'xstring:'xstr.
WRITE :'string:',strc. 
---------------------------------------------------------------------------------------------------------------
Steps.






No comments:

Post a Comment