2006 Sep 07 4:38 PM
Hi Abaper's
I have one problem in concatenation.While concatenation the spaces in the variable are getting removed.Is there any other way so that I can get the concatenated value with spaces.
For eg:
matnr = '100300 '
maktx = 'description '
CONCATENATE matnr maktx INTO Temp.
After concatenation the temp should contain 100300$$$$$$$ description$$$$$$$$$$$$
<b>
Where $ indicates a space.</b>
How to achieve this,kindly suggest
2006 Sep 07 4:43 PM
You can do something like this, notice that the length of the output field is 58.
[code]
report zrich_0001.
data: matnr type mara-matnr.
data: maktx type makt-maktx.
data: tmp type string.
data: len type i.
matnr = 'ABCDE'.
maktx = 'description'.
translate matnr using ' $'.
translate maktx using ' $'.
concatenate matnr maktx into tmp.
translate tmp using '$ '.
len = strlen( tmp ).
write:/ len, tmp.
[/code]
Regards,
RIch Heilman
2006 Sep 07 4:40 PM
hi Sapient,
Pass spaces here..
[code]matnr = '100300$$$$$$$$ '
maktx = 'description$$$$$ '[/code]
or
[code]CONCATENATE matnr maktx INTO Temp separated by SPACE.[/code]
Regards,
Santosh
Message was edited by: Santosh Kumar P
2006 Sep 07 4:41 PM
2006 Sep 07 4:41 PM
hi,
Instead of concatenate, make use of <b>offset</b>. It retains the spaces.
as you already know the length of matnr and maktx..
temp+0(10) = 100300.
temp+10(40) = 'description'.
write:/ temp.
regards,
Sailaja.
2006 Sep 07 4:42 PM
There are two ways to resolve it...
translate matnr using ' $'.
translate maktx using ' $'.
concatenate matnr maktx into temp separated by '$'.
translate temp using '$ '.
Second option is to write the value into Temp variable using offset and length.
offset = 0.
describe field matnr length llen in character mode.
write matnr to temp+offset(llen).
offset = offset + llen + 1.
describe field maktxr length llen in character mode.
write maktx to temp+offset(llen).
Message was edited by: Anurag Bankley
2006 Sep 07 4:42 PM
sorry,I missed to mention one thing
In the above eg
matnr = '100300 '
maktx = 'description '
CONCATENATE matnr maktx INTO Temp.
<b>In the above matnr and maktx value has some space after 100300$$$$$$ and description$$$$$$,</b>
<b>
Where $ indicates a space</b>
so after concatenation these spaces should not be supressed.
2006 Sep 07 4:43 PM
then you can use OFFSET.
data : temp(60) type c.
temp+0(13) = matnr.
temp+14(23)= maktx.
now if you check the value it will have blank spaces betwen the 2.
Regards
srikanth
2006 Sep 07 4:43 PM
You can do something like this, notice that the length of the output field is 58.
[code]
report zrich_0001.
data: matnr type mara-matnr.
data: maktx type makt-maktx.
data: tmp type string.
data: len type i.
matnr = 'ABCDE'.
maktx = 'description'.
translate matnr using ' $'.
translate maktx using ' $'.
concatenate matnr maktx into tmp.
translate tmp using '$ '.
len = strlen( tmp ).
write:/ len, tmp.
[/code]
Regards,
RIch Heilman
2006 Sep 07 4:51 PM
Hi,
Do like this,you will surely get
data:matnr like mara-matnr,maktx like makt-maktx,temp(50) type n,sp(10) type c.
<b>sp = ' '.</b> <b><<declare a variable with 5 spaces in single quotes>></b>
matnr = '100300'.
maktx = 'description'.
<b>concatenate matnr maktx into temp separated by sp.
concatenate temp sp into temp.</b>
write:/ temp.
Regards,
Sowjanya.
2007 Feb 14 1:54 PM
2007 Feb 14 2:01 PM
Hi there,
Try this:
CONCATENATE matnr maktx INTO Temp SEPARATED BY SPACE.Hope this helps.
2007 Feb 15 4:33 AM
Hi,
use
<b>CONCATENATE matnr maktx INTO Temp SEPARATED BY SPACE.</b>
reward if useful.
2007 Feb 15 5:23 AM
try this
data : text1(240),
matnr(18) type c value '1234',
maktx(40) type c value'material',
len type i,
pos1 type i,
spaces(18).
len = strlen( matnr ).
do len times.
spaces+pos1(1) = ' '.
pos1 = pos1 + 1.
enddo.
concatenate matnr(18) maktx(40) into text1 separated by spaces.
regards
shiba dutta
2007 Feb 15 5:24 AM
data : text1(240),
matnr(18) type c value '1234',
maktx(40) type c value'material',
len type i,
pos1 type i,
spaces(18).
len = strlen( matnr ).
do len times.
spaces+pos1(1) = ' '.
pos1 = pos1 + 1.
enddo.
concatenate matnr(18) maktx(40) into text1 separated by spaces.
regards
shiba dutta
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |