02-17-2015 4:54 PM
Hi,
I am creating CDS view and i have requirement like below.
I have one field suppose 1200 and other field is TEXT
The output should be 1200-TEXT
I am using concat(1200, '-', TEXT) but its not accepting.
Thanks,
Charu
Message was edited by: Jasmin Gruschke
02-18-2015 7:11 AM
Hi,
You do it by this way....
(1200, concat('-', TEXT) ) as Column_Name,
-Amol
02-18-2015 7:02 AM
Hi Charu,
please have a look at the ABAP Language Documentation (ABAP Keyword Documentation).
CONCAT(arg1, arg2) only takes two arguments, so you might need to use the function twice like CONCAT(arg1, CONCAT(arg2, arg3)).
Best,
Jasmin
05-29-2015 11:37 AM
hi Jasmin, on the concat function itself, is there anyway to get a space/blank character between string values?
e.g. this strips out the blank space, is there anyway to protect it/force it in?
concat(b.mc_name1,concat(' ',b.mc_name2)) as mc_fname
Even the replace function won't inject it below, the concat does add it in the '-' value, but the replace strips it out. Not sure if that's correct?
replace(concat(b.mc_name1,concat('-',b.mc_name2)),'-',' ') as mc_fname
Thanks,
Sean.
05-29-2015 12:19 PM
This would place a blank between Part_1 and Part_2:
REPLACE
( CONCAT( CONCAT( 'Part_1', '- -' ), 'Part_2' ), '-', '' )
05-29-2015 12:29 PM
hi Christian, Yes.. it does. Nice workaround. Thank you for that.
It would be nice to see the pipe | for concat similar to what we have on the HANA db, more flexible that the two argument concat function in cds. But for now, this helps me out, so thanks again.
Sean
08-25-2021 10:07 AM
02-18-2015 7:11 AM
Hi,
You do it by this way....
(1200, concat('-', TEXT) ) as Column_Name,
-Amol