Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

String to Hex conversion

Former Member
0 Kudos
1,541

Good morning,

I need advice please - we have obtained a piece of code from another SAP customer as we urgently had to use a formula to generate some data.

ws_seedno = '123456789ABCDEF123456789ABCDEF12'.

ws_length = STRLEN( ws_seedno ).

ASSIGN ws_seedno(ws_length) TO <fs> TYPE 'X'.

MOVE <fs> TO ws_khex.

The first step is to convert a seed number to hexadecimal - the customer that gave us the code obtains this result out of that code :

3132333435 3637383941 4243444546 3132333435 3637383941 4243444546

3132000000 0000000000 0000000000 0000000000 0000000000 0000000000 00000000

we on the other hand get this result :

0031003200 3300340035 0036003700 3800390041 0042004300 4400450046

0031003200 3300340035 0036003700 3800390041 0042004300 4400450046 00310032

Would someone know why the results differ? We are on different SPs and operating systems but both are ECC6,

Any advice would be greatly appreciated.

Anette

4 REPLIES 4

Former Member

Former Member
0 Kudos
333

Hi

try this function module for conversion of string into xstring then evaluate the results.

CRM_IC_XML_STRING2XSTRING.

Thanks

Vishal Kapoor

Former Member
0 Kudos
333

Thank-you Jay and Vishal,

Unfortunately both the suggested solutions delivers the same result as the code I posted

0031003200 3300340035 0036003700 3800390041 0042004300 4400450046

0031003200 3300340035 0036003700 3800390041 0042004300 4400450046 00310032

what is VERY interesting is that the person that supplied us the code is on ECC5, we also have an ECC5 SAP HR installation and this supplies the correct string :

3132333435 3637383941 4243444546 3132333435 3637383941 4243444546

3132000000 0000000000 0000000000 0000000000 0000000000 0000000000 00000000

This does not seem to be an ABAP issue - quite possible a basis?

Anette

Former Member
0 Kudos
333

Hi Anette,

I suppose you solved this problem a year ago. But maybe someone watch this post with the same problem . I used the function 'CRM_IC_XML_STRING2XSTRING' and broke through that if a string contais the string ' xml version =" 1.0 "encoding =" utf-8 "? ', the string is turned correctly.

Well, I ckecked the result leaving the string in a xml file and reading it through the function 'GUI_UPLOAD' with filetype = 'BIN' and obtain the same result.

So I didn´t have any problem to use 'CRM_IC_XML_STRING2XSTRING' because I needed to converted a string that contained "xml version =" 1.0 "encoding =" utf-8 "? ' .

I hope someone find it useful