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: 

max size of string data type

Former Member
0 Kudos
3,242

Hi,

Maybe a strange question, but does anyone know what the max size is of string data type. I wonder if I could put X meg in it.

Eddy

1 ACCEPTED SOLUTION

andreas_mann3
Active Contributor
0 Kudos
382

Hi Eddy, but system memory seems to be the limit -

my system dumps with mess.

"Unable to fulfil request for 127683972 bytes of memory space. "

here's the test prog.:

TABLES ekko.
DATA testmax TYPE string.
DATA z(16) TYPE i.

SELECT * FROM ekko.

  CONCATENATE testmax ekko INTO testmax.
  z = strlen( testmax ).

  IF  z = 63841496.
    BREAK-POINT.
  ENDIF.

ENDSELECT.    

regards Andreas

7 REPLIES 7

athavanraja
Active Contributor
0 Kudos
382

I was also tyring to find what can be the max size of a string ? is there any limitation? but didnt find anything so far.

<i>here is what ABAP key word documentation says about string</i>

The elementary data type STRING is similar to data type C and refers to a variable-length string. Accordingly, the elementary data type XSTRING is similar to data type X and refers to a variable-length byte sequence. 



In contrast to a C or X field, the length of a string is not static but variable and adjusts itself to the current field content at runtime. Dynamic memory management is used internally. Strings can have any length. 



The initial value of a string is an empty string with length 0. A structure containing a string is seen as deep. A deep structure cannot be used like a C field. Strings can be displayed in the ABAP Debugger and used in the ABAP Dictionary. 



It is not yet possible to use strings in screens or database tables. However, strings can be stored in database tables as clusters using EXPORT and transferred using IMPORT. 

Regards

Raja

0 Kudos
382

The documentation isn't clear on that indeed. One might think that system memery is the limit, but I need a method to calculate then in order to prevent surprises.

0 Kudos
382

Here is some sample code for finding the length of a string.

report zrich_0002 .

data: s type string,
      l type i.

s = '12345678901234567890'.
l = strlen( s ).
write:/ 'Length:', l, at 30 'String:', s.

s = '123456789012345678901234567890'.
l = strlen( s ).
write:/ 'Length:', l, at 30 'String:', s.

s = '1234567890123456789012345678901234567890'.
l = strlen( s ).
write:/ 'Length:', l, at 30 'String:', s.

Regards,

Rich Heilman

0 Kudos
382

Rich,

I know how to calculate the size of a string. I need to know the max capacity of a string.

Eddy

0 Kudos
382

I wondering if you could use the CATCH statement. I can't seem to get it to work in my system because I'm getting the SYSTEM_NO_ROLL error. If you could somehow configure your system to throw this error when a string is too big, then this may work for you.

catch system-exceptions string_length_too_large = 1.
* Build your string in here
endcatch.

Regards,

Rich Heilman

0 Kudos
382

As far as I know the limit is 4 Giga Byte which equals more or less no limit. I donnot expect that you will meet this limit in practice. Its very likely that will run out of memory before you reach this limit.

Kind Regards

Klaus

andreas_mann3
Active Contributor
0 Kudos
383

Hi Eddy, but system memory seems to be the limit -

my system dumps with mess.

"Unable to fulfil request for 127683972 bytes of memory space. "

here's the test prog.:

TABLES ekko.
DATA testmax TYPE string.
DATA z(16) TYPE i.

SELECT * FROM ekko.

  CONCATENATE testmax ekko INTO testmax.
  z = strlen( testmax ).

  IF  z = 63841496.
    BREAK-POINT.
  ENDIF.

ENDSELECT.    

regards Andreas