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: 

length of a string

Former Member
0 Kudos
12,009

hi all,

can anybody tell me what is the length of the string in abap.

if it is given as

a type string ,

what is the length of the string.

7 REPLIES 7

Former Member
0 Kudos
1,084

hi

Former Member
0 Kudos
1,084

Strings can have any length

Former Member
0 Kudos
1,084

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.

he 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.

Former Member
0 Kudos
1,084

STRING is variable length elementry type and XSTRING is another.

Check this out...

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

G@urav.

Former Member
1,084

STRLEN is the string length function used in ABAP. It counts the number of characters.

Example:

Data: v_test type c value 'sdfksdafkjsadk'.

Data: v_field_count type i.

v_field_count = strlen( v_test ).

Then it gives the number of characters in v_test variable.

Thanks,

Srinivas

Former Member
0 Kudos
1,084

hi ,

i think there is no limit to length to the string...check this...

data : data1 type string value

'jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjlllllllllllllllllllllllllllllllllllllllaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'.

data : data2 type string value

'jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjlllllllllllllllllllllllllllllllllllllllaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'.

data : data type string.

concatenate data1 data2 into data.

data: i type i.

i = strlen( data ).

write:/ i.

regards,

venkat.

Former Member
0 Kudos
1,084

hi all thanks a lot for your replies