Application Development 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: 

Add field > 255 in Z table

Former Member
0 Kudos

Hi!

I need to save in DB table a row from file. But my file has line with 1200 characters.

How can i do that?

It´s not a text, so i wont use FM SAVE_TEXT/READ_TEXT.

I try to create a field type RAW but appear a error message: Field & (Length > 255 for RAW only allowed for non-DB tables).

Please help!

1 ACCEPTED SOLUTION

Former Member
0 Kudos

your input field of 1200 bytes is all characters or alphanumeric....all fields would pass the test for type c or type n? Get your length lenth = strlen( your input row ).

Edited by: BreakPoint on Nov 21, 2011 8:03 PM

5 REPLIES 5

Former Member
0 Kudos

You can use a field of data type LCHR.

SAP requires that you also need to have a field of type INT2 preceding the LCHR type field, otherwise the table activation will lead to error

LENGTH        		INT2	5
LONG_FIELD		LCHR	1200

0 Kudos

You can use a field of data type LCHR.

>

> SAP requires that you also need to have a field of type INT2 preceding the LCHR type field, otherwise the table activation will lead to error

>

>

LENGTH        		INT2	5
> LONG_FIELD		LCHR	1200

I did that. But what function of field LENGTH? I have fill that?

I tried to insert data in table but i can´t read it.

In INSERT sy-subrc = 0 and register was save in DB. But when i do select, field return empty. When i fill LENGTH field, select statment return just first character of field LONG_FIELD.

How can i use that?

0 Kudos

Refer [documentation |http://help.sap.com/saphelp_45b/helpdata/en/bc/897415dc4ad111950d0060b03c6b76/content.htm]

2. Using LCHR

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.

Calculate the length of your record using STRLEN and put the length value in the INT2 type field. Then you should be able to INSERT the row

Former Member
0 Kudos

your input field of 1200 bytes is all characters or alphanumeric....all fields would pass the test for type c or type n? Get your length lenth = strlen( your input row ).

Edited by: BreakPoint on Nov 21, 2011 8:03 PM

Former Member
0 Kudos

Ok, i understand and work fine.

I found another way: declare field type string in DB table.

What´s the difference betwen declare LCHR or STRING?