08-17-2007 7:12 AM
Hello
I'm new to ABAP and I'm trying to do a simple thing.
I want to add a integer to a string.
i.e.
Data: ANumber : I,
AString : String,
NewString : String.
Concatenate AString ANumber into NewString.
I don't know how to convert the integer into a string type?
Any ideas
Andrew
08-17-2007 7:16 AM
Just assign the number to the string directly.
data lv_num type i.
data lv_str type string.
lv_str = lv_num.
Please mark points and close the thread if the solution was useful.
Regards,
Manoj
08-17-2007 7:16 AM
Just assign the number to the string directly.
data lv_num type i.
data lv_str type string.
lv_str = lv_num.
Please mark points and close the thread if the solution was useful.
Regards,
Manoj
08-17-2007 7:16 AM
Hi,
try this
data: a type i,
c(10) type c value 'adfadf',
d(30) type c,
b(10) type c.
a = 988.
write a to b.
concatenate b c into d.
write:/ d.
thanks & regards,
Venkatesh
08-17-2007 7:17 AM
08-17-2007 7:17 AM
Write like this....
DATA : anumber type i value '35',
astring(30),
newstring(50).
asting = 'anumber contains'.
CONCATENATE astring anumber INTO newstring.
Write : Newstring.
Close the thread once your question is answered.
Regards,
SaiRam
10-06-2019 7:51 PM
This method was wrong because my same codes got warning just before.
08-17-2007 7:18 AM
Hii
Numeric fields like INTEGER, PACKED DECIMALS CANNOT BE USED IN STRING COMMANDS LIKE CONCATENATE, SPLIT ETC.
Try this...
Data : VAR1 TYPE I VALUE 10,
Var2 type string value 'HELLO'.
Var3(10) type N .
Data : Result type String.
**First Copy Integer field to Type N(Numeric text) field
Var3 = Var1.
Concatenate Var2 Var3 into Result.
Write : Result.
<b>Reward if Helpful</b>
08-17-2007 7:18 AM
here is the solution:
Data: ANumber : I,
ANumberStr type string,
AString : String,
NewString : String.
ANumberStr = ANumber.
Concatenate AString ANumberStr into NewString.
don't forget to reward
thnks
S@meer
08-17-2007 7:35 AM
Hi!
Cannot concatenate number with string.
1. Convert your Integer to Character Form.
2. Try Concatenation.
data: data1 type i,
data2 type string,
data_temp type string,
data type string.
data_temp = data1.
Concatenate dta_temp data2 into data.
If its Useful Reward me.
Thanks ,
Nagulan
08-17-2007 8:29 AM