cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CDS entity view cast

chrisgr
Explorer
4,031

Hello,

I have defined a CDS view entity and I get the error message: "CASE (THEN): Maximum data type cannot be determined (CURR,000015) (CURR,000015)"

define view entity ZI_CCS_SettlItems
  as select from wbrp
  association to parent ZI_CCS_SettlHead as _Head on $projection.SettlmtMgmtDoc = _Head.SettlmtMgmtDoc
{
  key wbeln                      as SettlmtMgmtDoc,
  key posnr                      as SettlmtMgmtDocItem,
  @Semantics.amount.currencyCode: 'SettlmtDocCurrency'
  case when wbrp.netwr <> 0.00 then wbrp.netwr
                         else wbrp.netwr
              end as test,
      @Semantics.amount.currencyCode: 'SettlmtDocCurrency'
      cast( case when wbrp.netwr <> 0 then wbrp.netwr
                         else wbrp.netwrd
              end as netwr_lfp ) as ItemNetAmount,
      matnr                      as Product,
      arktx                      as SettlmtMgmtDocItemText,
      //     _Head.SettlmtDocCurrency as SettlmtDocCurrency,
      waers_bv                   as SettlmtDocCurrency,
      _Head // Make association public
}

I tried to cast the field from a data element and also from abap.curr but I get the same error message.

Any idea?

Thank you

Christophe

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member824042
Discoverer
0 Likes

...

 @Semantics.amount.currencyCode: 'SettlmtDocCurrency'
cast( case
when wbrp.netwr <> 0.00
then cast( wbrp.netwr as abap.dec(15,2) )
else cast( wbrp.netwr as abap.dec(15,2) )
end as NETWR_LFP ) as test,
@Semantics.amount.currencyCode: 'SettlmtDocCurrency'
cast( case
when wbrp.netwr <> 0
then cast( wbrp.netwr as abap.dec(15,2) )
else cast( wbrp.netwrd as abap.dec(15,2) )
end as netwr_lfp ) as ItemNetAmount,
...
0 Likes

Hi Christophe,

I think there are some Quantity, Currency field related issues in older versions of View entities. Either you can use old DDIC views or you may upgrade the system to latest release. For us in OP2020 we faced the similar error.

Best regards,

Akhilesh.

Rhythm_Wang
Explorer
0 Likes
Is there any Note released by SAP to fix this issue? That's very critical for customer.