Hi Guys,
I am facing problem with null values in string and it's hex code xstring. I have some data in one field with data type LCHR. This field contains data like :
"SAPMSDYP MBatch-Input ####%PC 60317081539#?"
I have one abap program. I am just appending this data to a string variable and then converting this string to xstring data. The length of the string is 53 and after conversion to xstring the length of xstring data is more then the string data. In string data wherever the "#" is there it is coming as "0000" in raw data(xstring). After this conversion i am just sending this data to my java program using http_client. At java side if the incoming data is having null value in-between data then this java program will reject this data. The main problem is i have to handle these null value in my abap program only.
At debugging time in variable details box also its hex value is showing as 0000 that is sap's default string to hex conversion. And if i move the mouse cursor on this variable then in hint box this single '#' is showing as 5 characters as CString.
For string to xstring conversion i am using the below code: CL_ABAP_CONV_OUT_CE=>create(
encoding = 'UTF-8'
endian = 'L' ).
conv->convert( EXPORTING data = text
IMPORTING buffer = buffer1 ).
Here i have to handle this null("#") value either in string data or in xstring data in ABAP program only. I don't know how to do this.
Request clarification before answering.
Hallo Ompal shekhawat,
I think you have to check your XSTRING and if you found this 0x00, then you can remove it. By the way you may get this ### if there is new line 0x0a or break line 0x0D and you can remove them from your XSTRING.
So, just these could help you
Check if the string has 0x00 or 0x0a or 0x0D, then remove it.
So, I would like you to read about these ASCII chart:
Char Dec Oct Hex WhatAreThey
---------------------------------------
(nul) 0 0000 0x00 Null
(ht) 9 0011 0x09 Horizontal Tab
(nl) 10 0012 0x0a New Line
(vt) 11 0013 0x0b Vertical Tab
(cr) 13 0015 0x0d Carriage Return
(sp) 32 0040 0x20 Space
Ref: http://www.bluesock.org/~willg/dev/ascii.html
For String, you can check this class
CL_ABAP_CHAR_UTILITIES=>NEWLINE

Best regards
Ebrahim Hatem
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ebrahim Hatem,
Thanks for the reply, I have tried all of the above solutions but nothing is working. In SAP GUI debugging window the hex value of # is showing as 0000 and in CString it shows as . I have tried all the above solution. Instead of this umlaut # if we have normal # then i am able to do any modification and for this normal # the SAP GUI will show the hex as 0023 which is correct. But this particular character is not normal #, only it looks like as #. Can you suggest me if it is null or anything other character. And this character is available in the table D345T and field is BLOCK(LCHR type).
Why don't you handle the # sign with abap before sending it to your java application? You can build a construct with string functions.
So you don't have to deal on the java-side:-)
Here are some keywords to point you the correct documentation.
String Functions, count, find, and match
~Florian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 10 | |
| 5 | |
| 5 | |
| 5 | |
| 4 | |
| 2 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.