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

Why preceding length field is required while creating Fields in Data base dictionary with type LCHAR or LRAW

former_member298409
Participant
0 Kudos
5,377

Hello ABAP Guru's

I am trying to create table Fields With giving the Data type as LCHAR or LRAW in se11..It is giving error like ' Z<Field> does not have a preceding length field of type INT4'

and when I created another field (above to LCHAR or LRAW field ) with data type with INT4 is not showing error.

Please let me know what is the reason behind of this....

Thanks In Advance,

Sekhar

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Kudos
2,178

Those data type were created (back to the 45b version, or 4.0 ?) to replace the now disabled VARC type.

One of those fields can only be the last field of a table, and must be preceded by a INT2 field which contains the actual length required. (Depending on the actual DB those fields are not actually in the DB table so cannot be used in a WHERE clause)

Regards,

Raymond

3 REPLIES 3
Read only

AbhishekV
Explorer
0 Kudos
2,178

Hi,


When create table Fields With giving the Data type as LCHAR or LRAW you need to create the preceeding length field, this field will contain the length of the data contained in the LChar or Lraw datatype field.

For example, if field xyz of type lchar has contents : 'hello people how are you'

the preceeding length field should have the length of the data contained in field XYZ.

Additionally:this LCHAR field has to be the last field in the table and there can be only one fiel of LCHAR in one database table.

Such fields cannot be used in where clause of a select query!

Read only

Former Member
0 Kudos
2,178

Hi,

The data type LCHR should be used for character strings of arbitrary length, but with at least 256 characters.
Unlike binary data (LRAW), character data (LCHR) is converted automatically in heterogeneous environments, providing the database system used supports ASCII-EBCDIC or code page conversion in heterogeneous networks. Type LCHR is therefore suitable for long texts that are to be stored. Fields of type LCHR can occur in structures and tables. Fields of this type must be placed at the end in tables and have a preceding length field of the type INT2. When using INSERT or UPDATE in ABAP/4 programs, the preceding length field must be filled with the length actually required. LCHR fields cannot be used in WHERE conditions.

Read only

RaymondGiuseppi
Active Contributor
0 Kudos
2,179

Those data type were created (back to the 45b version, or 4.0 ?) to replace the now disabled VARC type.

One of those fields can only be the last field of a table, and must be preceded by a INT2 field which contains the actual length required. (Depending on the actual DB those fields are not actually in the DB table so cannot be used in a WHERE clause)

Regards,

Raymond