Skip to Content
0
Dec 05, 2022 at 03:18 AM

自定义CDS中添加的计算,数值出现错误

172 Views

各专家们:

中午好。

我们在开发一个采购对账表时,在自定义CDS的阶段,定义了一个计算把系统中的税码转换成数值。比如:税码J2的税率等于0.13.但是,我们在实际测试过程中出现了部分的数值错误,比如:R2定义为0.03,实际显示为0.02;J4定义为0.09,实际显示为0.08;JB定义为0.06,实际显示0.05。其它定义为0.16、0.13、0.10、0.01的没有错误。请问,这可能是什么原因?

计算逻辑如下:

case when I_PurchaseOrderItemAPI01.TaxCode = 'J1'

then

cast( 0.16 as ABAP.DEC( 5, 2 ) )

when I_PurchaseOrderItemAPI01.TaxCode = 'J2'

then

cast( 0.13 as ABAP.DEC( 5, 2 ) )

when I_PurchaseOrderItemAPI01.TaxCode = 'J3'

then

cast( 0.10 as ABAP.DEC( 5, 2 ) )

when I_PurchaseOrderItemAPI01.TaxCode = 'J4'

then

cast( 0.09 as ABAP.DEC( 5, 2 ) )

when I_PurchaseOrderItemAPI01.TaxCode = 'J5'

then

cast( 0.01 as ABAP.DEC( 5, 2 ) )

when I_PurchaseOrderItemAPI01.TaxCode = 'JB'

then

cast( 0.06 as ABAP.DEC( 5, 2 ) )

when I_PurchaseOrderItemAPI01.TaxCode = 'R2'

then

cast( 0.03 as ABAP.DEC( 5, 2 ) )

else

0

end