Skip to Content

CONCAT_WITH_SPACE function is not working in CDS view custom calculated field

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

32195-image.png (6.3 kB)
Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Nov 01, 2019 at 02:25 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • 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

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.