Skip to Content

How to handle null value in string and xstring?

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.

Add comment
10|10000 characters needed characters exceeded

1 Answer

  • Posted on Oct 01, 2018 at 03:25 PM

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

    Add comment
    10|10000 characters needed characters exceeded