cancel
Showing results for 
Search instead for 
Did you mean: 

How to handle null value in string and xstring?

0 Kudos

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 "0" 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.

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.

DoanManhQuynh
Active Contributor
0 Kudos

I dont know your source data but i dont think # is null in string. as far as i know, null value is not exist in abap...or at least not the same as java:

https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenopen_sql_null_values.htm

So i think that should be special character like CRLF, horizonal tab or some kind of font missing... I suggest to start digging from there...

Accepted Solutions (0)

Answers (1)

Answers (1)

nomssi
Active Contributor
0 Kudos

I suggest to first convert the xstring to BASE64 using cl_http_utility=>encode_x_base64( lv_bin ).

0 Kudos

Hi Jacques,

I tried this also but i am getting the same data with same problem.