Skip to Content
author's profile photo Former Member
Former Member

XString to string conversion

Hi All,

I want to display contents of XString to String from a text file which has got generated from a excel file having multiple worksheets. I am using CL_ABAP_CONV_IN_CE class to convert the xstring to string. While converting to the string format lots of hashes '#' [not fix in number sometimes 1 or 2 or may be 13] are getting added to the result string variable. I have tried to remove these hashes with the help of REPLACE function, but ABAP code is not able to recognise those hashes. Is there any way to control remove these hashes? or Is there any other solution to convert the XString to the string?

Pl. reply to this at an earliest.

Thanks in advance,

Regards - Navneet

Add comment
10|10000 characters needed characters exceeded

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on May 17, 2004 at 06:17 PM

    Hi Navneet,

    In SAP, the unprintable characters are displayed as '#'s on the screen. This doesn't mean that the variable at that position contains a '#'. It could have been any unprintable character (typically, Ascii < 32 or > 127).

    From what you have stated, I guess you are trying to read an 'excel' file directly as a text file into XString. This will NOT work. You have convert the excel file to a flat text file, either manually or using some tool (or function modules) - say a tab or comma delimited flat file.

    If you really do want to remove those '#'s in your program, instead of Replace, try positional operations (after evaluating if the ascii value is < 32 or > 127).

    Regards,

    Venky Varadadesigan.

    SAP NetWeaver consulting.

    Add comment
    10|10000 characters needed characters exceeded