cancel
Showing results for 
Search instead for 
Did you mean: 

CDS view field date element alpha routine

raffinkira
Participant
0 Kudos
530

Hi experts,

I have a field that displays a document number. For some kinds of document type, document number should be display as it is in the DB, while for some kinds of document type, document number should remove leading zeroes and this can be done by alpha routine in data element.

My question is, can I use different date elements casting against the document type? I tried the below code but looks like only the first date element is working.

SELECT from tableA { cast(DocNumber as DE1) } where DocType = 'X' UNION all SELECT from tableB { cast(DocNumber as DE2) } where DocType = 'Y.'

Anyone could give some help here?

Regards,

Ming

Accepted Solutions (0)

Answers (1)

Answers (1)

junwu
SAP Champion
SAP Champion
0 Kudos

in your case expression, do what you need to do(removing 0...), the final output(cast to a normal type if needed) should display as it is(no conversion here).

raffinkira
Participant
0 Kudos
I tried to apply two date elements for this field by using CASE WHEN, but looks like only the first date element took effect.
junwu
SAP Champion
SAP Champion
0 Kudos
do you really understand what I am talking?