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

Integer to string

Former Member
46,885

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
Read only

Former Member
14,922

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
Read only

Former Member
14,923

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

Read only

Former Member
0 Likes
14,922

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

Read only

Former Member
14,922

Hi Andrew,

Just move the integer to string variable.

Regards,

Atish

Read only

former_member196280
Active Contributor
0 Likes
14,922

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

Read only

0 Likes
14,922

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

Read only

varma_narayana
Active Contributor
0 Likes
14,922

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>

Read only

Former Member
14,922

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

Read only

Former Member
0 Likes
14,922

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

Read only

Former Member
0 Likes
14,922

Thanks a lot

Andrew