2005 Mar 21 11:22 AM
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
2005 Mar 21 2:55 PM
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
2005 Mar 21 11:49 AM
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
2005 Mar 21 2:40 PM
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.
2005 Mar 21 2:55 PM
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
2005 Mar 21 2:58 PM
Rich,
I know how to calculate the size of a string. I need to know the max capacity of a string.
Eddy
2005 Mar 21 3:09 PM
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
2005 Mar 21 8:49 PM
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
2005 Mar 21 2:55 PM
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