‎2008 Mar 12 11:40 AM
Data:
str1(10) type c,
str2(10) type c,
str3(30) type c.
str1 = 'street1 '.
str2 = 'street2 '.
CONCATENATE str1 str2 INTO str3 SEPARATED BY ';'.
Write / str3
the output obviously will become:
street1;street2.
but what i wanted is to maintain the existing trailings
so it should be:
street1<blank><blank><blank>;street2<blank><blank><blank>.
It seems the forum also does not allow trailing spaces.
What should I do?
‎2008 Mar 12 11:47 AM
HI,
TRU OFFSET IDEA.
DATA:SRC(100).
SRC+0(40) = STREET1
SRC+40(42) = ' '.
SRC+42(40) = STREET2
SRC+82(42) = ' '.
REWARD POINTS,
KUMAR
‎2008 Mar 12 11:47 AM
HI,
TRU OFFSET IDEA.
DATA:SRC(100).
SRC+0(40) = STREET1
SRC+40(42) = ' '.
SRC+42(40) = STREET2
SRC+82(42) = ' '.
REWARD POINTS,
KUMAR
‎2008 Mar 12 11:53 AM
Hi ,
Try this out using offset,
str3+0(15) = str1.
str3+15(15) = str2.
u will get the spaces as it is.
Regards,
Balakumar.G.
‎2008 Mar 12 11:47 AM
Hi Mizan,
You can use this for your requirement.
Data:
str1(10) type c,
str2(10) type c,
str3(30) type c.
str1 = 'street1 '.
str2 = 'street2 '.
CONCATENATE str1 str2 INTO str3 SEPARATED BY ';' RESPECTING BLANKS .
Write / str3.
Regards,
Samson Rodrigues.
‎2008 Mar 12 11:55 AM
Hi,
DATA:
str1(10) TYPE c,
str2(10) TYPE c,
str3(30) TYPE c.
str1 = 'street1 '.
str2 = 'street2 '.
str3+0(7) = str1.
str3+11(1) = ';'.
str3+12(7) = str2.
WRITE / str3.
Regards,
V.Balaji
‎2008 Mar 12 11:57 AM
use : RESPECTING BLANKS
CONCATENATE str1 str2 INTO str3 SEPARATED BY ';' RESPECTING BLANKS
‎2008 Mar 12 12:01 PM
Hi,
Check the help on Keyword CONCATENATE, there you find an option 'RESPECTING BLANKS'.
Use this option while concatenating two strings, it will keep the blanks intact.
Regards,
Mayank
PS: Reward points if its helpful.
‎2008 Mar 12 12:05 PM
Data:
str1(10) type c,
str2(10) type c,
str3(30) type c,
str4(10) type c.
str4 = ' '.
str1 = 'street1 '.
str2 = 'street2 '.
CONCATENATE str1 str2 INTO str3 SEPARATED BY str4.
Write / str3.
hi
i hv changed ur code like this i have add str4 for space now it will display all trailing spaces please check
‎2008 Mar 13 2:16 AM
Doesn't seem too practical for the separator if the data extracted is dynamicly but based on the field length specified locally. But anyhow seems 'RESPECTING BLANKS' do not work for 4.7. I heard there is a way to use TRANSLATE still testing it out right now.
‎2008 Mar 12 12:07 PM
Try using the the addition for CONCATENATE statement
... RESPECTING BLANKS
Effect
The addition RESPECTING BLANKS is only allowed during string processing and causes the closing spaces for data objects dobj1 dobj2 ... or rows in the internal table itab to be taken into account. Without the addon, this is only the case with string.
Note
With addition RESPECTING BLANKS, statement CONCATENATE can be used in order to assign any character strings EX>text - taking into account the closing empty character - to target str of type string: CLEAR str. CONCATENATE str text INTO str RESPECTING BLANKS.
TYPES text TYPE c LENGTH 10.
DATA itab TYPE TABLE OF text.
DATA result TYPE string.
APPEND 'When' TO itab.
APPEND 'the' TO itab.
APPEND 'music' TO itab.
APPEND 'is' TO itab.
APPEND 'over' TO itab.
CONCATENATE LINES OF itab INTO result SEPARATED BY space.
...
CONCATENATE LINES OF itab INTO result RESPECTING BLANKS.
After the first CONCATENATE statement, result contains "When_the_music_is_over", after the second statement it contains "When______the_______music_____is________ over______" . The underscores here represent blank characters.
Hope this helps.
Thanks,
Balaji
‎2008 Mar 13 5:37 AM
do this
Data:
str1(10) type c,
str2(10) type c,
str3(30) type c,
str4(10) type c.
str4 = ' ;'.
str1 = 'street1 '.
str2 = 'street2 '.
CONCATENATE str1 str2 INTO str3 SEPARATED BY str4.
Write / str3.
‎2008 Mar 13 5:53 AM