Am working for one of the ABAP CDS view to display the report in FIORI APP. I have created a Consumption view with annotations. I have used the Sales related tables and CDHDR, CDPOS tables.
There is a requirement for one column, I need to divide the delivery quantity from VBEP with Old Value from CDPOS table. Here CDPOS-VALUE_OLD is character field.
When I try to write the logic in CDS view as DIVISION( vbep.dlvqty_su,CDPOS-VALUE_OLD,2) * 100. Due to VALUE_OLD is a character field, system throwing an error like "Function DIVISION: parameter at position 2 has incorrect data type CHAR". I tried to use CAST operation to convert the char to QUAN then that time am getting error like "CAST OLD_VALUE of type CHAR to type QUAN is not possible".
Can you please help me how to convert CDPOS-VALUE_OLD value to Quantity so that I can write the DIVISION operator in Consumption view.
Thanks and Regards,
I had a requirement to convert Char to currency. As direct casting of char to currency is not possible, we need to cast char to numc first and then to currency. So, I converted Char to Currency , by concatenating '.00' to char value , then casting it to numc , an again casting it to Currency.
cast( cast(concat(amountchar, '.00') as abap.numc(30) ) as wrbtr_z) as Amountcurrency
muralikrishna.peravali2 Hope the same can be applied to quantity conversion.