Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

regarding unicode problem

Former Member
0 Likes
555

Hi friends,

Declarations:

FIELD-SYMBOLS: <f>.

data: len TYPE i,

typ(1),

dec TYPE i.

Statement:

DESCRIBE FIELD <f> LENGTH len TYPE typ DECIMALS dec.

Error:

In Unicode, DESCRIBE LENGTH can only be used with the IN BYTE MODE or in character mode addition.

Thanks,

Vamsykrishna.

2 REPLIES 2
Read only

Former Member
0 Likes
499

Hi,

eg:
DATA: text  TYPE c LENGTH 1, 
      blen  TYPE i, 
      clen  TYPE i, 
      bytes TYPE i. 

DESCRIBE FIELD text: LENGTH blen IN BYTE MODE, 
                     LENGTH clen IN CHARACTER MODE. 

bytes = blen / clen. 

If you want the length in bytes give the addition IN BYTE MODE and if you want the characters, give IN CHARACTER MODE.

Regards,

Subramanian

Read only

uwe_schieferstein
Active Contributor
0 Likes
499

Hello Vamsy

Simply speaking Unicode means: 1 Character <> 1 Byte

Unicode characters are either 2 or 4 Bytes large. A SAP Unicode system is a 2-Byte system yet internally characters may be represented by up to 4 Bytes ([ABAP and Unicode: Character Codes|http://help.sap.com/saphelp_nw04/helpdata/en/62/3f2cb0b35311d5993800508b6b8b11/content.htm]).

Conclusion: You need to specify which type of length (IN BYTE MODE or IN TEXT MODE) you want to have because the result is different:

DESCRIBE FIELD <f> LENGTH len TYPE typ DECIMALS dec   IN TEXT MODE / IN BYTE MODE.

Regards

Uwe.