on 11-20-2007 2:33 PM
Hello Friend,
I need to convert xString to String and I am planning to use ECATT_CONV_XSTRING_TO_STRING but the output for the functional module is of type string with 255 as a length.
what would happen if my input is longer than 255?
I have tested for couple of cases and found that my input got truncated to 255 chars.
Does anyone had any idea on this or any other alternative
Hi Pranav,
i dont think so. Just the test field has 255.
check out this report:
data:
int type i,
chr type string,
str type string,
xstr type xstring.
do 300 times.
int = int + 1.
chr = int.
concatenate
chr
str
into
str.
enddo.
CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
EXPORTING
im_xstring = xstr
IM_ENCODING = 'UTF-8'
IMPORTING
EX_STRING = str
.
write str+300(10)
It must dump if str is less than 255.
Regards,
Udo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Udo,
I believe in your code xstr and str has been swapped because you are filling the value in str and hence str should be there with the exporting parameter.
Correct me if I am going wrong .
When I changed the call as follows :
<b>CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
EXPORTING
im_xstring = str
IM_ENCODING = 'UTF-8'
IMPORTING
EX_STRING = xstr</b>
I got a program dump with an error as follows CALL_FUNCTION_CONFLICT_TYPE.
Thanks
HI Udo,
The most weird behavior I see while debugging the code the ECATT_CONV_XSTRING_TO_STRING is
The return<b> "ex_string"</b> has following vales
<u>technical type </u>= CString and the<u> value </u>contains the 255 char string
<u> technical type</u> = CString and the<u> value</u> contains the 255 char string
<u> technical type</u> = CString and the <u>value</u> contains the 255 char string
Why does the technical size doesn't affect the value string length ?
Seems that I have wrong understanding of the functional module.
Can anyone uncover the hidden portion of the functional module?
<b></b>
thanks Udo for your response.
I was not debugging the standard FM but I was debugging my code wherein I have used the ECATT_CONV_XSTRING_TO_STRING functional module.
Well the fm takes XSTRING and returns STRING.
In the given example you have added values to the variable String str and xstr is empty when you are calling the functional module.
I think we need to fill the xstr and the fm would return the values in the str...
Correct me, if I am going in the wrong direction.
Hi PD,
had to change the code:
data:
int type i,
chr type string,
str type string,
xstr type ETXML_LINE_STR.
*create a long string
do 300 times.
int = int + 1.
chr = int.
concatenate
chr
str
into
str.
enddo.
*convert to Xstring
CALL FUNCTION 'ECATT_CONV_STRING_TO_XSTRING'
EXPORTING
im_string = str
IM_ENCODING = 'UTF-8'
IMPORTING
EX_XSTRING = xstr.
*convert to string
CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
EXPORTING
im_xstring = xstr
IM_ENCODING = 'UTF-8'
IMPORTING
EX_STRING = str.
*offsett of 300 would dump if output only 255
write: sy-subrc, str+300(10).
Everything should be clear. XSTRING is created and longer as 255, as well the STRING. Program would dump in case of string less than 255.
Regards,
Udo
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.