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

maximum length of a variable that is declared as string.

Former Member
0 Likes
10,428

Hi

If we declare a variable as suppose

data:name types string.

Then what is the maximum length of the data can be stored in name.

Thanking you

Chandrika.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,956

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.

Hi

If we declare a variable as suppose

data:name types string.

Then what is the maximum length of the data can be stored in name.

Thanking you

Chandrika.

7 REPLIES 7
Read only

Former Member
0 Likes
2,957

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.

Read only

Former Member
0 Likes
2,956

hi ,

intially the value of the string is '0',

at the run time the legth of the string is equal to the filed length specified

Regards,

GUDURI

Read only

Former Member
0 Likes
2,956

Hi Chandrika,

You can store data upto 2 GB inside a string variable.

Regards,

Chetan.

PS:Reward points if this helps.

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
2,956

Hi,

There are two predefined types in ABAP with variable length:

STRING for character strings

XSTRING for byte strings

Check this link for more information.

http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3357358411d1829f0000e829fbfe/frameset.htm

Read only

Former Member
0 Likes
2,956

Hi Sarath ,

There is a limit to the length of the sting , i feel it is based on the basis settings , how much memory is allocated to various areas.

For e.g consider the program

Data : vlabst type  string.

vlabst = '000000000000000000000000000000000000000000000000000000000000'.
do 50 times.
concatenate vlabst vlabst into vlabst.
enddo.
write: vlabst.

the program dumps , if i execute it this way , but if i change the do statement and do the iteration 10 times it works.

So please ask your basis team about it.

Regards

Arun

Read only

sourabhshah
Product and Topic Expert
Product and Topic Expert
0 Likes
2,956

hi,

A string is a sequence of characters with variable length. A string can contain any number of alphanumeric characters. The length of a string is the number of characters multiplied by the length required for the internal representation of a single character

When you create a string as a data object, only a string header is created statically. This contains administrative information. The actual data objects are created and modified dynamically at runtime by operational statements.

The initial value of a string is the empty string with length 0. A structure that contains a string is handled like a deep structure. This means that there are no conversion rules for structures that contain strings.

Here is a helpful link

http://help.sap.com/saphelp_erp2005vp/helpdata/en/fc/eb2fcc358411d1829f0000e829fbfe/frameset.htm

Regards,

Sourabh

Read only

Former Member
0 Likes
2,956

Hi Sarath ,

Please try to execute the code which i have given in my previous post and please tell does it also dump in your system.

Regards

Arun