‎2008 Jan 01 1:56 PM
Hi All,
Could anyone of you clarrify whether 'concatenate' could be used to append a string to a integer (int4) variable..?
If not which keyword should be used to add a string variable to integer variable?
‎2008 Jan 01 2:54 PM
Why would you need to that? Just use a STRING variable...Integer variables are not supposed to hold char values...
Greetings,
Blag.
‎2008 Jan 01 3:07 PM
data: lv_int type i value '04',
lv_char type char4 value 'Abap',
lv_string type string.
u can use it as
concatenate lv_int lv_char into lv_string.
‎2008 Jan 01 4:53 PM
Hi SINDHURI,
one of the ABAP features is implicit type conversion.
DATA:
lv_string type string,
lv_int type i.
lv_string = '575'.
lv_int = 5.
lv_int = lv_int + lv_string.
lv_string = lv_string + lv_int.
works good. Did you even try?
If you really want to concatenate, you should first put the values into string or character variables and then concatenate them. There is no type conversion within concatenate. Concatenate is for strings and characters.
Regards,
Clemens
‎2010 Apr 16 4:43 PM
DATA : n_val TYPE N,
s_val TYPE STRING VALUE 'PO',
i_val TYPE INTEGER VALUE 40,
result TYPE STRING.
n_val = ival.
CONCATENATE n_val s_val INTO result.
Cheers,
Naveen
‎2010 Apr 16 5:05 PM
Hi,
You will Not Concatenate String or Character type with Integer type.
You can conatenate by moving integer type to character type . because cocatenate only work with character type variables.
You can Directly add string variable to a integer variable but provide that alphabets and special character should not appeae in that if appeared it goes to dump.
I hope this clarifies you doubt.
Regards,
Raghava Channooru.
‎2010 Apr 16 5:22 PM
Before anyone else answers, look at the date of the original post.
Rob
‎2011 Apr 06 7:31 AM
Hi
Its not permitted to concatenate the integer value directly with string. Instead you can move the integer value to a string and use concatenate of string
eg:
Data v_count type i,
v_string type string,
v_value type string value 'abap',
v_final type string.
v_count = 68.
v_string = v_count.
concatenate v_value v_string into v_final.
Output
-
abap68