I'm using a UNION ALL in a CDS View but I'm having trouble matching up one of the fields in the projection list between the Select's. In the first Select, I have this:
case
when offer_level = '2' and decrep.decision = 'U' and decrep.reply = 'F' then count(*)
end as uf1
I'm not actually filling the field in the second Select from any tables but it seems that I need to add it into the projection list anyway, which I'm attempting to do with (I don't know how else to do it):
' ' as uf1
This throws up an error:
"View field UF1 (data element or type/length different in union)"
I've tried using CAST on the field in both Select's.It seems that I cannot use CAST on UF1 in the CASE statement. If I try to CAST the second one to an integer (which is what it looks like it needs to be) then, of course, I get an error saying I can't convert a char to an integer.
If I try to convert to numc, as follows:
cast( ' ' as abap.numc(5)) as uf1
Then I get this again:
"View field UF1 (data element or type/length different in union)"
So I'm stumped. Any ideas anyone?
Thanks,
Malcolm.