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

String-Line Extension

Former Member
0 Likes
1,322

Friends,

Can anyone of you resolve the below issue.

I am having a field called rec in an internal table.

I am passing a string to this field which might run for

few lines. To consider this line extension I am using the

extension character "-".

The code is given below.

data : source type string.

data : begin of itab occurs 0,

rec type string,

end of itab.

itab-rec = 'ksjdksjdkjskjd'

-'lkskldlskdlksldklskd'

-'sdsdsdsds'.

append itab.

itab-rec =

'MangoApplejhfkkghhkglkjl;ghkjl;ghkjlkgh;ljkl;;jkl;ljk;'.

append itab.

write source.

loop at itab into itab.

concatenate source itab-rec into source.

endloop.

write source.

On execution of below code, I am getting the following error

Unable to interpret "ksjdksjdkjskjd" as an number.

What might be the problem friends.

Regards,

Usha

1 ACCEPTED SOLUTION
Read only

jayanthi_jayaraman
Active Contributor
0 Likes
1,202

Hi,

Try this.

<b>itab-rec = 'ksjdksjdkjskjd

-lkskldlskdlksldklskd

-sdsdsdsds'.</b>

append itab.

8 REPLIES 8
Read only

Former Member
0 Likes
1,202

Hi,

The ABAP interpreter probably tries to evaluate the assignment as a calculation, i.e. 'ksjdksjdkjskjd'-'lkskldlskdlksldklskd' as <first string> <minus> <second string>.

Regards, Joerg

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
1,203

Hi,

Try this.

<b>itab-rec = 'ksjdksjdkjskjd

-lkskldlskdlksldklskd

-sdsdsdsds'.</b>

append itab.

Read only

0 Likes
1,202

You can also use a concatenate for this:

concatenate 'ksjdksjdkjskjd' 'lkskldlskdlksldklskd' 'sdsdsdsds' into itab-rec.

Read only

0 Likes
1,202

...

or try:

concatenate 'ksjdksjdkjskjd' 'lkskldlskdlksldklskd' 'sdsdsdsds'
             into itab-rec separated by '-'.
             APPEND itab.

regards Andreas

Read only

Former Member
0 Likes
1,202

Hi,

Jeorge, you are right-that is the real scenario.

Jayanthi, I tried working as suggested by you-I am

getting the following error "Literals that take up more

than one line are not allowed in OO".

Others, I do welcome your suggestions, but I wanted

to know how to hard-code some literals which are

running to muliple lines.

Regards,

Usha

Read only

0 Likes
1,202

Hi,

That is warning.You can activate it and run.

But spaces will come in output.

you can even try this.But let me know whether you want the output in multiple lines like

ksjdksjdkjskjd

lkskldlskdlksldklskd

....

If so, try split.

itab-rec = 'ksjdksjdkjskjd-lkskldlskdlksldklskd-sdsdsdsds'.

append itab.

Read only

0 Likes
1,202

Hi Usha,

but you can condense the gaps:

with:

itab-rec = 'ksjdksjdkjskjd
-lkskldlskdlksldklskd
-sdsdsdsds'.
CONDENSE itab-rec NO-GAPS.
APPEND itab.

regards Andreas

Read only

Former Member
0 Likes
1,202

Hi Usha,

The problem is with this statement -

<b>itab-rec = 'ksjdksjdkjskjd'

-'lkskldlskdlksldklskd'

-'sdsdsdsds'.</b>

The Hyphen does not come under any set of quotes (' '). So the rest of the stuff is being interpreted as a number and this hyphen as the minus sign.

Regards,

Anand Mandalika.