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: 

Integer to string

Former Member

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

1 ACCEPTED SOLUTION

Former Member

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

9 REPLIES 9

Former Member

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

Former Member
0 Kudos

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

Former Member

Hi Andrew,

Just move the integer to string variable.

Regards,

Atish

former_member196280
Active Contributor
0 Kudos

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

0 Kudos

This method was wrong because my same codes got warning just before.

varma_narayana
Active Contributor
0 Kudos

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>

Former Member

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Thanks a lot

Andrew