2010 Feb 19 2:19 PM
Hello gurus,
Am using the following logic to convert the customer name into Hexadecimal format.
DATA : l_name TYPE name1_gp,
l_value TYPE zhex36.
l_name = kunstruk-name1.
PERFORM hex_conversion USING l_name
CHANGING l_value.
FORM hex_conversion USING p_l_name
CHANGING p_l_value.
FIELD-SYMBOLS: <dummy>.
ASSIGN p_l_name TO <dummy> TYPE 'X'.
p_l_value = <dummy>.
ENDFORM.
MOVE l_value TO bytekna1-name1. "bytekna1-name1. has the same length as of l_value .
when customer name is ESW Customer 6,the result is 00450053005700200043007500730074006F006D00650072002000360020002000200020.
This value is used in JAVA at the front end & when ther are converting it in string the result is :
#E#S#W# #C#u#s#t#o#m#e#r# #6# # # #.
They are getting extra # in the output,whihc should not come.
Please suggest if any one has faced this type issue.
Regards,
Najmuddin
Hello gurus,
Am using the following logic to convert the customer name into Hexadecimal format.
DATA : l_name TYPE name1_gp,
l_value TYPE zhex36.
l_name = kunstruk-name1.
PERFORM hex_conversion USING l_name
CHANGING l_value.
FORM hex_conversion USING p_l_name
CHANGING p_l_value.
FIELD-SYMBOLS: <dummy>.
ASSIGN p_l_name TO <dummy> TYPE 'X'.
p_l_value = <dummy>.
ENDFORM.
MOVE l_value TO bytekna1-name1. "bytekna1-name1. has the same length as of l_value .
when customer name is ESW Customer 6,the result is 00450053005700200043007500730074006F006D00650072002000360020002000200020.
This value is used in JAVA at the front end & when ther are converting it in string the result is :
#E#S#W# #C#u#s#t#o#m#e#r# #6# # # #.
They are getting extra # in the output,whihc should not come.
Please suggest if any one has faced this type issue.
Regards,
Najmuddin
2010 Feb 19 4:09 PM
Hi,
the hex string you gave for example suggests, that you have unicode active on your system. Thus every character is represented by a 16bit value or 4 hex nibbles. Your java application shows '#' whenever a non printable character shows up. Obviously Java expects a single byte character and therefor interprets every second byte with '00' value as non printable.
Take care of the differnt expectations and your problem should be solved.
regards
Jörg
Edited by: Jörg Wulf on Feb 19, 2010 5:09 PM
2010 Feb 19 4:44 PM
2010 Feb 19 4:54 PM
Hi,
try the below function module which will convert the string to hexadeciaml.
NLS_STRING_CONVERT_FROM_SYS
FM SCMS_STRING_TO_FTEXT
2010 Feb 19 6:16 PM
This sample code converts a integer in an hexadecimal string:
FORM convert_int_to_hex USING pe_entero
CHANGING ps_hex.
DATA: l_mod TYPE i,
l_div TYPE i,
l_letra.
l_mod = pe_entero MOD 16.
l_div = pe_entero DIV 16.
CASE l_mod.
WHEN 10. l_letra = 'A'.
WHEN 11. l_letra = 'B'.
WHEN 12. l_letra = 'C'.
WHEN 13. l_letra = 'D'.
WHEN 14. l_letra = 'E'.
WHEN 15. l_letra = 'F'.
WHEN OTHERS. l_letra = l_mod.
ENDCASE.
CONCATENATE l_letra ps_hex INTO ps_hex.
IF l_div > 0.
PERFORM convert_int_to_hex USING l_div
CHANGING ps_hex.
ENDIF.
ENDFORM. " CONVERT_INT_TO_HEX
Edited by: andrespicazo on Feb 19, 2010 7:17 PM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |