cancel
Showing results for 
Search instead for 
Did you mean: 

How to realize if the character is Chinese in database?

Former Member
0 Kudos

Hi Experts,

I will select the txt50 in table SKAT, now some of the fields value contains Chinese. When display a Chinese, it's double lenth of English character. so I want to know the display lenth of txt50. So I have to realize that if the character is Chinese or English.

Thanks.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

data: result type i.

    result = count( val   = '1a-“五一'    regex = [[:unicode:]] ). 

Here the result will return value 3.

regular expression [[:unicode:]] is used for unicode character set with value > 255

Hope this will do for your question.

Former Member
0 Kudos

Hi,

As you know that sy-abcde is an constant string 'ABCDE..'. but if the txt50 contains character's like this '/,''-,_,+' , how do I compare. Do I have to add all these charaters to an internal table, and then compare. If it really don't have other solutions, I will do it this way....

Former Member
0 Kudos

And also what I want really is how to calculater the display lenth of a string contains Chinese charaters..

Former Member
0 Kudos

Hi, Thanks for your reply.

But I means that although use spras = '1', actualy the txt50 maybe also have English words. Such as : 'R-51化肥'. it has 6 characters , but when display it, the lenth is equal 8 English characters. and also if the txt50 value is 50 Chinese charaters, and the display lenth is 50, i have to only display 25 Chinese character.

So this is why I asked how to realize the charater is Chinese or English.

Also need you help..

Former Member
0 Kudos

Hi,

If you are logged in EN logon language, then use sy-abcde field. and look for each character in the TXT50 and compare it with SY-ABCDE or you can use string operations such as CS etc.

Regards,

Atish

former_member196280
Active Contributor
0 Kudos

You can always identify by the language key that is available in SKAT, i.e SPRAS.

Rgds,

Sairam

Former Member
0 Kudos

Hi,

You can just use the SPRAS as 1 when you query SKAT. In this way you will get the chinese text.

Regards,

Atish