Skip to Content
avatar image
Former Member

Integer to string

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

8 Answers

  • Best Answer
    avatar image
    Former Member
    Aug 17, 2007 at 06: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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 17, 2007 at 06:17 AM

    Hi Andrew,

    Just move the integer to string variable.

    Regards,

    Atish

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 17, 2007 at 06: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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 17, 2007 at 06: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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 17, 2007 at 06: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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 17, 2007 at 06: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

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 17, 2007 at 06: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>

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 17, 2007 at 07:29 AM

    Thanks a lot

    Andrew

    Add comment
    10|10000 characters needed characters exceeded