‎2006 Sep 14 8:51 AM
Hello,
I will convert a xstring into a string. But I receive a runtime error (CX_SY_DYN_CALL_ILLEGAL_TYPE).
What did I wrong?
REPORT Z_TEST.
DATA:
STRING(255) TYPE C,
XSTRING TYPE XSTRING.
MOVE '1abd19bb' TO XSTRING.
CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
EXPORTING
* FROM_CODEPAGE = '8500'
IN_XSTRING = XSTRING
* OUT_LEN =
IMPORTING
OUT_STRING = STRING.
WRITE: / ' STRING: ', STRING.
‎2006 Sep 14 8:59 AM
i think...
problem is the function module is expecting an internal table as parameter and you are sending it a variable.
‎2006 Sep 14 8:59 AM
hi,
chk this.
DATA:
<b> out_STRING TYPE STRING,
in_STRING TYPE XSTRING.</b>
MOVE '1abd19bb' TO IN_STRING.
CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
EXPORTING
FROM_CODEPAGE = '8500'
IN_XSTRING = IN_STRING
OUT_LEN =
IMPORTING
OUT_STRING = OUT_STRING.
WRITE: / ' STRING: ', OUT_STRING.
rgds
anver
‎2006 Sep 14 9:03 AM
check ot the declarations for XSTRING and STRING in the fumction module and declate the same in program
‎2006 Sep 14 9:12 AM
Now I have a internal table, but the same error...
What can I do? I only will convert a xstring in a string...
REPORT Z_TEST.
DATA:
BEGIN OF OUTPUT OCCURS 0,
OUT_STRING(255) TYPE C,
IN_STRING TYPE XSTRING,
END OF OUTPUT.
MOVE '1abd19bb' TO OUTPUT-IN_STRING.
CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
EXPORTING
* FROM_CODEPAGE = '8500'
IN_XSTRING = OUTPUT-IN_STRING
* OUT_LEN =
IMPORTING
OUT_STRING = OUTPUT-OUT_STRING.
WRITE: / ' STRING: ', OUTPUT-OUT_STRING.
‎2006 Sep 14 9:22 AM
try this one
data: xl_content type xstring .
DATA: binary_content TYPE solix_tab.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = xl_content
TABLES
binary_tab = binary_content.
‎2006 Sep 14 9:37 AM
Hi
See the below declaration. It should work.
DATA: STRING TYPE string,
Regards
Srikanth M
‎2006 Sep 16 9:20 AM
you can use the following code to convert Xstring to String.
DATA: content TYPE STRING,
Xcontent TYPE XSTRING .
DATA: conv TYPE REF TO CL_ABAP_CONV_IN_CE.
conv = CL_ABAP_CONV_IN_CE=>CREATE( input = Xcontent ).
conv->READ( importing data = content ).
Regards
Raja
‎2023 Nov 21 7:25 AM
You can refer to below class-method set to convert instead of using unreleased FMs.*&---------------------------------------------------------------------*
*& " Convert XString to String
*&---------------------------------------------------------------------*
DATA: lv_string TYPE string,
lv_xstring TYPE xstring.
DATA: lo_conv_in TYPE REF TO CL_ABAP_CONV_IN_CE.
lo_conv_in = CL_ABAP_CONV_IN_CE=>CREATE( input = lv_xstring ).
lo_conv_in->READ( IMPORTING data = lv_string ).
*&---------------------------------------------------------------------*
*& " Convert String to XString
*&---------------------------------------------------------------------*
DATA: lo_conv TYPE REF TO cl_abap_conv_out_ce.
lo_conv = cl_abap_conv_out_ce=>create( encoding = '4110' ).
lo_conv->convert( EXPORTING data = lv_string
IMPORTING buffer = lv_xstring ).*&---------------------------------------------------------------------*
*& " Convert XString to Binary
*&---------------------------------------------------------------------*
data: lt_binary_tab TYPE solix_tab. " table of solix
CLEAR: lt_binary_tab.
lt_binary_tab = cl_document_bcs=>xstring_to_solix(
ip_xstring = lv_xstring ).