2012 Jul 16 2:20 PM
Dear Team,
Need a solution while converting value to Hexadecimal
A is of type C.
case 1
At the time of initial run, value of A = 0
Used the following code :
the below code is within
Loop
IF NOT <X> IS ASSIGNED.
ASSIGN A TO <X> CASTING.
ENDIF.
**endloop
the issue is the value of <X> for A=0 in my system is 0030, whereas when i debug the same in user systemfrom china, i got the value as 3000 and when A=1, the value in my system is 0031 whereas in the user system it is 3001. This is happening only in users production system only, in Quality system the value is coming correctly like if A=0, the hexadecimal value is 0030 and for 1 the Hexa value as 0031.
reference ascii is from http://www.asciitable.com/
Kindly help me how to handle this.
Dear Team,
Need a solution while converting value to Hexadecimal
A is of type C.
case 1
At the time of initial run, value of A = 0
Used the following code :
the below code is within
Loop
IF NOT <X> IS ASSIGNED.
ASSIGN A TO <X> CASTING.
ENDIF.
**endloop
the issue is the value of <X> for A=0 in my system is 0030, whereas when i debug the same in user systemfrom china, i got the value as 3000 and when A=1, the value in my system is 0031 whereas in the user system it is 3001. This is happening only in users production system only, in Quality system the value is coming correctly like if A=0, the hexadecimal value is 0030 and for 1 the Hexa value as 0031.
reference ascii is from http://www.asciitable.com/
Kindly help me how to handle this.
2012 Jul 17 5:44 AM
Hi,
I dont know solution for above problem.
But I think you can use function module in place of using casting.
DATA: conv TYPE REF TO cl_abap_conv_out_ce,
l_data TYPE string,
l_buffer TYPE xstring.
" l_data holds char data
conv = cl_abap_conv_out_ce=>create( encoding = 'UTF-8'
endian = 'L'
ignore_cerr = 'X'
replacement = '#' ).
CALL METHOD conv->write( data = l_data ).
l_buffer = conv->get_buffer( ). " l_buffer holds the hexa values
Thanks
Santosh.
2012 Jul 18 9:09 AM
Hello,
You could do F1 on 'CASTING' keyword and see that it highlights byte order which could be of two types and is also platform dependent. I ran your code and it shows me 3000 for 0, 3100 for 1, 3200 for 2 and likewise. You could check the data element ABAP_ENDIA. Default value would be different in your client system. In your system it would be 'L' . If it's 'B' the order of digits reverses.
However, coding given by Santosh works fine.If you execute the same code with parameter endian = 'B' you would see the digits reversed.
F1 shows many other details, you might be interested in.
Regards,
Kumud
Message was edited by: Kumud Singh