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

Why I am getting error...

Former Member
0 Likes
816

STR = 'INDIA IS A GREAT COUNTRY'.

WRITE STR+10(26).

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
765

Hi

declare the str type string

and you r printing 26 characters from 10th position but from 10th position u can print only 14 characters only 14 r available

give as following

write :str+10(14).

it will work

Regards

sandhya

7 REPLIES 7
Read only

Former Member
0 Likes
765

what have u declated str as?

Read only

Former Member
0 Likes
765

hi,

ur declared string is of length 24 n ur accessing the length which is exceed.

For ex:

write str+10(2).

the abv stmt retrives/output GR.

the string starts the count from the 0.

reward if helpful.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
765

If you define STR as a string as i suppose the offset 10 with a length of 26 is too great, as the string is initialized with a length of 24.

Dynamic memory management is used internally for strings, so ABAP cannot insure which field belongs the characters you asked for.

So use COMPUTE string_length = STRLEN( STR ).

Regards

Read only

Former Member
0 Likes
766

Hi

declare the str type string

and you r printing 26 characters from 10th position but from 10th position u can print only 14 characters only 14 r available

give as following

write :str+10(14).

it will work

Regards

sandhya

Read only

varma_narayana
Active Contributor
0 Likes
765

Hi Balaji..

data : str(100) type C.

STR = 'INDIA IS A GREAT COUNTRY'.

WRITE STR+10(26).

try this way.. You will not get error. Bcoz when you give STR+10(26)

It will try to access the characters from 11th position to 36th position. So the String may not have 36 characters.

<b>reward if Helfpul</b>

Read only

former_member404244
Active Contributor
0 Likes
765

HI,

do like this..

data : str(100) type c.

STR = 'INDIA IS A GREAT COUNTRY'.

WRITE STR+10(26).

Regards,

nagaraj

Read only

Former Member
0 Likes
765

Hi

str+10(26) means that str has a minimul lenght of 36 char,

but it has actuel only a lenght of 24 char. thats the problem.

Regards, Dieter