Hello Experts,
I have been trying to convert this value:
99000124997700
to this value:
256691434010057472
As it is done in at this website:
http://www.meidconverter.net/index.php#Results
My problem is my code does not convert it correctly.
Input:
99000124997700
Output:
172805295610057472
Can anyone advise to what is the issue or in theory how these conversion work?
DATA: lv_input TYPE /sapdmc/ls_value, lv_dec_1 TYPE string, lv_dec_2 TYPE string, ev_export TYPE to_dec, lv_hex(4) TYPE x. lv_input = iv_hex_value(8). *-- input first part of HEX value CALL FUNCTION 'Z_HEX_TO_DEC_CONVERT' EXPORTING pin = lv_input IMPORTING ra = ev_export. *-- store in tmp variable lv_dec_1 = ev_export. CONDENSE lv_dec_1. lv_input = iv_hex_value+8(8). CLEAR ev_export. *-- input the rest of the HEX value CALL FUNCTION 'Z_HEX_TO_DEC_CONVERT' EXPORTING pin = lv_input IMPORTING ra = ev_export. lv_dec_2 = ev_export. CONDENSE lv_dec_2. CONCATENATE lv_dec_1 lv_dec_2 INTO lv_input SEPARATED BY ''. REPLACE '-' in lv_input WITH ''. CONDENSE lv_input NO-GAPS. ev_decimal_value = lv_input.
Code of Z_HEX_TO_DEC_CONVERT
data: i_ra(15) type x, i_ra2(4) type x, i_pin like pin, n_pin(30) type n, i_len type i, i_ra3 type xstring. if pin co '1234567890 '. move pin to i_pin. move i_pin to n_pin. i_pin = n_pin. i_ra = i_pin. ra = i_ra. else. move pin to i_pin. i_len = strlen( i_pin ). if i_len = 8. i_ra2 = i_pin. i_ra = i_pin. i_ra3 = i_pin. ra = i_ra2. ra = i_ra. ra = i_ra3. else. while i_len lt 30. concatenate '0' i_pin into i_pin. i_len = strlen( i_pin ). endwhile. i_ra = i_pin. ra = i_ra. * ra = i_num. endif. endif.
:Thanks