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

Add field > 255 in Z table

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!

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2011 at 07:02 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 21, 2011 at 06:30 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • 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

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2011 at 07:22 PM

    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?

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.