‎2009 Feb 04 8:41 AM
Hello everyone,
I have a problem inserting a space into a string. It has to be between gs_ma-prename and gs_ma-name.
I don't want to use "SEPARATED BY SPACE" at the end, because that's not the layout I want and just ' ' doesn't work...
DATA lv_body TYPE string.
CONCATENATE 'Bitte genehmigen.'
CL_ABAP_CHAR_UTILITIES=>NEWLINE
CL_ABAP_CHAR_UTILITIES=>NEWLINE
'Mit freundlichen Grüßen'
CL_ABAP_CHAR_UTILITIES=>NEWLINE
CL_ABAP_CHAR_UTILITIES=>NEWLINE
gs_ma-prename gs_ma-name
INTO lv_body.Thanks for help!
Best regards!
‎2009 Feb 04 8:56 AM
Hi Patrick,
Here's the logic:
data: v_str type string.
concatenate 'mahesh' '&' 'reddy' into v_str.
replace '&' WITH SPACE INTO v_str.
write:/ v_str.
output: mahesh reddy
cheers\
Mahesh
Edited by: Mahesh Reddy on Feb 4, 2009 9:56 AM
‎2009 Feb 04 8:44 AM
‎2009 Feb 04 8:49 AM
Hi,
thanks for your fast answer, but that doesn't work
Background of my questions is, that I want to have this string into an Outlook E-Mail body.
Regards!
‎2009 Feb 04 8:47 AM
‎2009 Feb 04 8:50 AM
‎2009 Feb 04 8:53 AM
‎2009 Feb 04 8:51 AM
Hi Patrick ,
To get a space between 2 strings without using 'Separted by Space' , you can use a delimeter where you can have the value 'SPACE' and use it in your concatenate statement .
Here's a sample code :
DATA :
w_name1 TYPE string ,
w_name2 TYPE string ,
w_name3 TYPE string ,
w_deli TYPE c .
w_deli = space .
w_name1 = 'SAP' .
w_name2 = 'ABAP' .
CONCATENATE w_name1 w_name2 INTO w_name3 SEPARATED BY w_deli .
Regards ,
Amuktha .
‎2009 Feb 04 9:03 AM
>
> Hi Patrick ,
> To get a space between 2 strings without using 'Separted by Space' , you can use a delimeter where you can have the value 'SPACE' and use it in your concatenate statement .
>
> Here's a sample code :
>
>
> DATA :
> w_name1 TYPE string ,
> w_name2 TYPE string ,
> w_name3 TYPE string ,
> w_deli TYPE c .
>
> w_deli = space .
> w_name1 = 'SAP' .
> w_name2 = 'ABAP' .
>
> CONCATENATE w_name1 w_name2 INTO w_name3 SEPARATED BY w_deli .
>
> Regards ,
> Amuktha .
This is identical to SEPARATED BY space. The only difference is using a variable rather than a literal. So what's the point?
Please note, that all answers involving CONCATENATE a ' ' b INTO c or variants along these lines have been rejected, because THEY DON'T WORK. Please take the time to test your suggestions before posting.
matt
‎2009 Feb 04 8:55 AM
‎2009 Feb 04 9:03 AM
Still no result...maybe it has something to do with Outlook...
‎2009 Feb 04 9:04 AM
Patrick - what layout do you want?
If it's what I think you want, you have to do it in two steps:
DATA lv_body TYPE string.
CONCATENATE gs_ma-prename gs_ma-name INTO lv_body SEPARATED BY space.
CONCATENATE 'Bitte genehmigen.'
CL_ABAP_CHAR_UTILITIES=>NEWLINE
CL_ABAP_CHAR_UTILITIES=>NEWLINE
'Mit freundlichen Grüßen'
CL_ABAP_CHAR_UTILITIES=>NEWLINE
CL_ABAP_CHAR_UTILITIES=>NEWLINE
lv_body
INTO lv_body.This will give you Bitte genehmigen##Mit freundlichen Grüßen##firstname@lastname where # is newline and @ is space.
matt
Edited by: Matt on Feb 4, 2009 10:07 AM
‎2009 Feb 04 8:56 AM
Hi Patrick,
Here's the logic:
data: v_str type string.
concatenate 'mahesh' '&' 'reddy' into v_str.
replace '&' WITH SPACE INTO v_str.
write:/ v_str.
output: mahesh reddy
cheers\
Mahesh
Edited by: Mahesh Reddy on Feb 4, 2009 9:56 AM
‎2009 Feb 04 9:04 AM
try this
DATA lv_body TYPE string.
CONCATENATE 'Bitte genehmigen' ' = ' space INTO lv_body SEPARATED BY space.
CONCATENATE lv_body 'x' INTO lv_body .
write: lv_body.
‎2009 Feb 04 9:04 AM
‎2009 Feb 04 9:10 AM
Mahesh Reddy solved the problem
Thanks to everybody who tried to help!
Best regards!
‎2009 Feb 04 9:09 AM
‎2012 Dec 10 3:20 PM
Simplest way:
CONCATENATE {dobj1 dobj2 ...}
INTO result
[RESPECTING BLANKS].
‎2012 Dec 10 5:04 PM
‎2015 Feb 24 9:12 AM
I understand that this is a very old thread. For what it's worth, the following is the correct way of adding a space to a string. Hopefully it'll provide someone with the answer they're looking for in the future.
CONCATENATIVE 'my string' ` ` 'second string after space' INTO lv_whatever_variable.
Use ` ` (not ' ') to have ABAP interpret it as an actual space.
‎2023 Sep 15 12:46 PM