‎2005 Jul 05 8:21 AM
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
‎2005 Jul 05 8:30 AM
Hi,
Try this.
<b>itab-rec = 'ksjdksjdkjskjd
-lkskldlskdlksldklskd
-sdsdsdsds'.</b>
append itab.
‎2005 Jul 05 8:29 AM
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
‎2005 Jul 05 8:30 AM
Hi,
Try this.
<b>itab-rec = 'ksjdksjdkjskjd
-lkskldlskdlksldklskd
-sdsdsdsds'.</b>
append itab.
‎2005 Jul 05 8:36 AM
You can also use a concatenate for this:
concatenate 'ksjdksjdkjskjd' 'lkskldlskdlksldklskd' 'sdsdsdsds' into itab-rec.
‎2005 Jul 05 8:41 AM
...
or try:
concatenate 'ksjdksjdkjskjd' 'lkskldlskdlksldklskd' 'sdsdsdsds'
into itab-rec separated by '-'.
APPEND itab.regards Andreas
‎2005 Jul 05 9:22 AM
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
‎2005 Jul 05 9:33 AM
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.
‎2005 Jul 05 11:01 AM
Hi Usha,
but you can condense the gaps:
with:
itab-rec = 'ksjdksjdkjskjd
-lkskldlskdlksldklskd
-sdsdsdsds'.
CONDENSE itab-rec NO-GAPS.
APPEND itab.regards Andreas
‎2005 Jul 05 11:18 AM
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.