2011 Jul 21 11:24 AM
Dear experts,
I would like to concatenate a string with three spaces, for example,
CONCATENATE 'X' SPACE SPACE SPACE 'Y' INTO LV_RESULT.
However, the result I got from executing the above statement is not 'X Y' as I want, but rather 'XY'.
I did try
CONCATENATE 'X' '***' 'Y' INTO LV_RESULT.
REPLACE '***' with ' ' INTO LV_RESULT.
still doesn't work.
How can I write ABAP code to archive such a result?
Any idea would be appreciated.
Vitthavat A.
2011 Jul 21 11:33 AM
Dear experts,
I would like to concatenate a string with three spaces, for example,
CONCATENATE 'X' SPACE SPACE SPACE 'Y' INTO LV_RESULT.
However, the result I got from executing the above statement is not 'X Y' as I want, but rather 'XY'.
I did try
CONCATENATE 'X' '***' 'Y' INTO LV_RESULT.
REPLACE '***' with ' ' INTO LV_RESULT.
still doesn't work.
How can I write ABAP code to archive such a result?
Any idea would be appreciated.
Vitthavat A.
2011 Jul 21 11:33 AM
2011 Jul 21 11:36 AM
Dear ssm and koolspy,
thank you for your answer. however, I want THREE spaces between 'X' and 'Y'. Your code will give me only one space.
2011 Jul 21 11:40 AM
Hi,
do not use ' but ` to surround your string (`text ` instead of 'text ').
And then do not use "separeted by".
Best regards,
Oliver
Edited by: Oliver Hütköper on Jul 21, 2011 12:40 PM
2011 Jul 21 11:35 AM
hi
try this
concenate 'x' 'y' into lv_string seperated by space.
2011 Jul 21 11:39 AM
data: lv_string type string.
data: lv_str2 type string.
CONCATENATE 'x' ' ' into lv_string SEPARATED BY space.
CONCATENATE ' ' ' ' into lv_str2 SEPARATED BY space.
CONCATENATE lv_string lv_str2 into lv_str2 SEPARATED BY space.
CONCATENATE lv_str2 'y' into lv_string SEPARATED BY space.
write: lv_string.
2011 Jul 21 11:40 AM
Hi,
Try this.
CONSTANTS lc_str(3) type c VALUE ' '.
DATA lv_string TYPE string.
CONCATENATE 'x' lc_str lc_str 'y' INTO lv_string SEPARATED BY space.
WRITE lv_string.Regards
HM
2011 Jul 21 11:58 AM
2011 Jul 21 11:49 AM
try this
constants temp(1) type c value ' '.
DATA lv_string TYPE string.
concatenate 'x' temp temp 'y' into lv_string separated by space. " use temp no of times for no of spaces.
" i.e if you want 4 spaces then write temp 3 times.
write:/ lv_string.
2011 Jul 21 11:53 AM
Hi,
Try this
CONCATENATE A space space space B INTO C RESPECTING BLANK.
Thanks,
Anmol
2011 Jul 21 11:56 AM
Try RESPECTING BLANKS...
CONCATENATE 'X' SPACE SPACE SPACE 'Y' INTO LV_RESULT RESPECTING BLANKS.
Regards,
Angelo.
2021 Jul 30 6:58 PM
2011 Jul 21 11:57 AM
solved.
thank you everyone.
i do this:
concatenate IBASIC-KUNNR IBASIC-MATNR into E1KOMG-VAKEY.
lv_len = strlen( E1KOMG-VAKEY ).
lv_shift = 100 - lv_len.
lv_shift = lv_shift - 3.
lv_shift = lv_len + lv_shift.
shift E1KOMG-VAKEY by lv_shift places circular.
concatenate IBASIC-VKORG E1KOMG-VAKEY into E1KOMG-VAKEY.
*while 100 is the length of E1KOMG-VAKEY.
2011 Jul 21 12:10 PM
dear Oliver Hütköper and koolspy,
I tried your solutions, and it works.
so i awarded points to you.
anyway, while trying the 'respecting blanks', i got an error:
"".", "IN BYTE MODE", "SEPARATED BY ..." or "IN CHARACTER MODE" expected"
not sure what it means. but it's ok. the problem has been solved.
thanks again.
2011 Jul 21 12:53 PM
Hi,
DATA: lv_str TYPE string, lv_space(5) TYPE c.
CONCATENATE 'abc' 'def' INTO lv_str SEPARATED BY lv_space.
WRITE:/ lv_str.
Ram.
2015 May 06 8:23 AM
2020 Feb 05 5:45 PM
Contants: lv_space(3) type c value ' '.
Concatenate var1 var2 into var3 separated by lv_space.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |