cancel
Showing results for 
Search instead for 
Did you mean: 

CONCAT_WITH_SPACE function is not working in CDS view custom calculated field

João_Terenas
Explorer
0 Kudos

Dear community,

I'm trying to add a new field to a custom CDS view. I want this field to be the concatenation of 4 other fields, but separated by space. 

I can see that the function CONCAT is working for those fields, but CONCAT_WITH_SPACE is not. 

concat_with_space(

concat_with_space( I_JournalEntryItem.ACCOUNTINGDOCUMENTTYPE, I_JournalEntryItem.ACCOUNTINGDOCUMENT, 1 ),

concat_with_space( I_JournalEntryItem.ASSIGNMENTREFERENCE, I_JournalEntryItem.CUSTOMER, 1 ), 1 )

I've tried, as a workaround, to use the function CONCAT with the string ' ', but it seems like the string is ignored.

concat( concat( concat( 

I_JournalEntryItem.ACCOUNTINGDOCUMENTTYPE, ' '), concat( 

I_JournalEntryItem.ACCOUNTINGDOCUMENT, ' ') ) , concat( concat( 

I_JournalEntryItem.ASSIGNMENTREFERENCE, ' ') , 

I_JournalEntryItem.CUSTOMER ) )

And the message error I have is not very explicit...

Has anyone faced the same issue?

Best regards,

João

Accepted Solutions (1)

Accepted Solutions (1)

Enda
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello João

please refer to SAP Note 2540696 ( https://launchpad.support.sap.com/#/notes/2540696 ) which contains the Content Rules for Custom CDS Views.

This Note includes the following section:

Changing Custom CDS views

If a custom CDS view is already used in either another custom CDS view, a custom query, a communication scenario or otherwise it can from then on only be changed in a compatible way unless the usages are removed.

Compatible changes are adding fields and references or changing the title. Be aware of that when publishing your changes: As soon as you add a field or reference to a view that is used it cannot be removed any more. It is therefore strongly recommended to work with drafts until your changes are solid before publishing them. Drafts can be discarded at any time without harming the published view.

-----

In your case, you are attempting to change an existing field and such changes cannot be done when the Custom CDS View is referenced elsewhere.

Best Regards

Enda

João_Terenas
Explorer
0 Kudos

Hey Enda,

thank you very much for your reply, it was helpful!

In my case, I was trying to change an already added field (and published).

To accomplish my requirement I had to edit Draft, add the new field, and insert the formula as I wanted:

concat_with_space(

concat_with_space( I_JournalEntryItem.ACCOUNTINGDOCUMENTTYPE, I_JournalEntryItem.ACCOUNTINGDOCUMENT, 1 ),

concat_with_space( I_JournalEntryItem.ASSIGNMENTREFERENCE, I_JournalEntryItem.CUSTOMER, 1 ), 1 )

Saved the draft, published, and it worked!

Thank you very much once again.

Best regards,

João

Answers (0)