‎2009 May 14 1:14 PM
Hi All,
the problem scenario is :
I have a varaible of type c and length 10, and its filled with only 6 characters. Further there is another Variable of type c and size 4 , both need to concatenated .
The problem is when I concatenate both variables they come up joined. I need to have the 4 characters space between both variables.
‎2009 May 14 1:26 PM
Hello,
CONCATENATE is not going to be of any help.
Try like this:
DATA:
V_STR1 TYPE CHAR10 VALUE '123456',
V_STR2 TYPE CHAR4 VALUE '1234',
V_STR TYPE STRING.
MOVE V_STR1 TO V_STR.
V_STR+10 = V_STR2.
WRITE: V_STR.Hope this helps.
BR,
Suhas
‎2009 May 14 1:16 PM
Hi,
If the variable has spaces at the end, these spaces are generally ignored.
So, when you concatenate both the variables, you would not get spaces in between.
If the variable is sure to have only 6 digits,
you can use the concatenate statement to separate it by 4 spaces:
concatenate varA varB separated by ' '.
‎2009 May 14 1:21 PM
DATA: w_num1(10) TYPE c VALUE '123456',
w_num2(4) TYPE c VALUE '1234',
w_space(4) TYPE c,
w_num(20) TYPE c.
CONCATENATE w_num1 w_num2 INTO w_num SEPARATED BY w_space.
WRITE w_num.
‎2009 May 14 1:21 PM
Hi,
please check the code below. give d as 4spaces in quotes.
data: a type string value 'sudarsan',
b TYPE string value 'dande',
c type string,
d(4) type c value ' '.
CONCATENATE a b INTO c SEPARATED BY d.
WRITE c.
‎2009 May 14 1:21 PM
Hi,
Try using offset.
e.g data: v1 type char10 value '666666',
v2 type char4 value '4444',
v3 type char30.
v3(10) = v1.
v3+10(4) = v2.
‎2009 May 14 1:23 PM
USE Below.
DATA: a(10) type c.
a = 'sixsix'.
DATA: b(4) type c.
b = 'four'.
DATA c(12) type c.
CONCATENATE a b INTO c SEPERATED BY SPACE.
‎2009 May 14 1:23 PM
Hi;
data: lv_var4 type char4,
lv_var10 type char10,
lv_var14 type char14.
concatenate lv_var10
space(4)
lv_var4 into lv_var14 seperated by space(1).
Regards
Shashi
‎2009 May 14 1:25 PM
data: a type string value 'sudarsan',
b TYPE string value 'dande',
c type string,
d(4) type c value ' '.
CONCATENATE a b INTO c SEPARATED BY d.
WRITE c.
‎2009 May 14 1:26 PM
Hello,
CONCATENATE is not going to be of any help.
Try like this:
DATA:
V_STR1 TYPE CHAR10 VALUE '123456',
V_STR2 TYPE CHAR4 VALUE '1234',
V_STR TYPE STRING.
MOVE V_STR1 TO V_STR.
V_STR+10 = V_STR2.
WRITE: V_STR.Hope this helps.
BR,
Suhas
‎2009 May 14 1:31 PM
Try this:
DATA: var1(10) type c value 'MAHESH'.
DATA: var2(4) type c value 'ABAP'.
DATA: var3(14) type c.
data: var4(4) type c .
var4 = SPACE.
concatenate var1(10) var2(4) into var3 SEPARATED BY var4.
write:/ var3.
‎2009 May 14 1:32 PM
hi,
if my understanding is correct
you can use the below method for this:
data: ct(10) TYPE c VALUE '123456',
gt(4) TYPE c VALUE '7890'.
CONCATENATE ct GT INTO result RESPECTING BLANKS.
ouput will be :
123456 7890
‎2009 May 14 1:39 PM
Hello,
Your code does not even SYNTAX check !!! Plz verify before posting.
AFAIK the OP's req. cannot be met using CONCATENATE stmt.
BR,
Suhas
‎2009 May 14 2:44 PM
Thanks for your replies...
BUT in case when the length first variable keeps on changing as its being returned by a function ex it becomes 7 or 8 then how can i insert 2 or 3 spaces ...
‎2009 May 14 7:00 PM
find the lenght of the first_variable and then use OFFSET accordingly.
apart from the above replies, u can also try like, put some speacial characters like $, in the place where do u want see the space, then REPLACE these $ with SPACES.
thanq