@AbapCatalog.sqlViewName: 'PINSPCHARCCF'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@ClientHandling.algorithm: #SESSION_VARIABLE
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.viewType: #BASIC
@VDM.private:true
@ObjectModel.usageType: {
dataClass: #TRANSACTIONAL,
sizeCategory: #L,
serviceQuality: #D
}
define view P_InspCharcCalctFrmtdValues as select from qamv as _qamv
inner join P_InspCharcDecPlaces as _dec on _qamv.prueflos = _dec.InspectionLot
and _qamv.vorglfnr = _dec.InspPlanOperationInternalID
and _qamv.merknr = _dec.InspectionCharacteristic
{
key _qamv.prueflos as InspectionLot,
key _qamv.vorglfnr as InspPlanOperationInternalID,
key _qamv.merknr as InspectionCharacteristic,
case
when ( _qamv.sollwni is not initial ) and ( _dec.InspSpecDecimalPlaces = 0 )
then cast( cast( round( fltp_to_dec( _qamv.sollwert as abap.dec(20, 1) ), 0) as abap.dec(20, 0) ) as qsollwerte_f )
when ( _qamv.sollwni is not initial ) and ( _dec.InspSpecDecimalPlaces = 1 )
then cast( cast( round( fltp_to_dec( _qamv.sollwert as abap.dec(20, 2) ), 1) as abap.dec(20, 1) ) as qsollwerte_f )
when ( _qamv.sollwni is not initial ) and ( _dec.InspSpecDecimalPlaces = 2 )
then cast( cast( round( fltp_to_dec( _qamv.sollwert as abap.dec(20, 3) ), 2) as abap.dec(20, 2) ) as qsollwerte_f )
when ( _qamv.sollwni is not initial ) and ( _dec.InspSpecDecimalPlaces = 3 )
then cast( cast( round( fltp_to_dec( _qamv.sollwert as abap.dec(20, 4) ), 3) as abap.dec(20, 3) ) as qsollwerte_f )
when ( _qamv.sollwni is not initial ) and ( _dec.InspSpecDecimalPlaces = 4 )
then cast( cast( round( fltp_to_dec( _qamv.sollwert as abap.dec(20,5 ) ), 4) as abap.dec(20, 4) ) as qsollwerte_f )
when ( _qamv.sollwni is not initial ) and ( _dec.InspSpecDecimalPlaces = 5 )
then cast( cast( round( fltp_to_dec( _qamv.sollwert as abap.dec(20,6 ) ), 5) as abap.dec(20, 5) ) as qsollwerte_f )
when ( _qamv.sollwni is not initial ) and ( _dec.InspSpecDecimalPlaces = 6 )
then cast( cast( round( fltp_to_dec( _qamv.sollwert as abap.dec(20,7 ) ), 6) as abap.dec(20, 6) ) as qsollwerte_f )
when ( _qamv.sollwni is not initial ) and ( _dec.InspSpecDecimalPlaces = 7 )
then cast( cast( round( fltp_to_dec( _qamv.sollwert as abap.dec(20,8 ) ), 7) as abap.dec(20, 7) ) as qsollwerte_f )
when ( _qamv.sollwni is not initial ) and ( _dec.InspSpecDecimalPlaces = 8 )
then cast( cast( round( fltp_to_dec( _qamv.sollwert as abap.dec(20,9 ) ), 8) as abap.dec(20, 8) ) as qsollwerte_f )
when ( _qamv.sollwni is not initial ) and ( _dec.InspSpecDecimalPlaces = 9 )
then cast( cast( round( fltp_to_dec( _qamv.sollwert as abap.dec(20,10) ), 9) as abap.dec(20, 9) ) as qsollwerte_f )
when ( _qamv.sollwni is not initial ) and ( _dec.InspSpecDecimalPlaces = 10 )
then cast( cast( round( fltp_to_dec( _qamv.sollwert as abap.dec(20,11) ),10) as abap.dec(20,10) ) as qsollwerte_f )
else ''
end as InspSpecFrmtdTargetValue,
case
when ( _qamv.tolobni is not initial ) and ( _dec.InspSpecDecimalPlaces = 0 )
then cast( cast( round( fltp_to_dec( _qamv.toleranzob as abap.dec(20, 1) ), 0) as abap.dec(20, 0) ) as qtolob_f )
when ( _qamv.tolobni is not initial ) and ( _dec.InspSpecDecimalPlaces = 1 )
then cast( cast( round( fltp_to_dec( _qamv.toleranzob as abap.dec(20, 2) ), 1) as abap.dec(20, 1) ) as qtolob_f )
when ( _qamv.tolobni is not initial ) and ( _dec.InspSpecDecimalPlaces = 2 )
then cast( cast( round( fltp_to_dec( _qamv.toleranzob as abap.dec(20, 3) ), 2) as abap.dec(20, 2) ) as qtolob_f )
when ( _qamv.tolobni is not initial ) and ( _dec.InspSpecDecimalPlaces = 3 )
then cast( cast( round( fltp_to_dec( _qamv.toleranzob as abap.dec(20, 4) ), 3) as abap.dec(20, 3) ) as qtolob_f )
when ( _qamv.tolobni is not initial ) and ( _dec.InspSpecDecimalPlaces = 4 )
then cast( cast( round( fltp_to_dec( _qamv.toleranzob as abap.dec(20,5 ) ), 4) as abap.dec(20, 4) ) as qtolob_f )
when ( _qamv.tolobni is not initial ) and ( _dec.InspSpecDecimalPlaces = 5 )
then cast( cast( round( fltp_to_dec( _qamv.toleranzob as abap.dec(20,6 ) ), 5) as abap.dec(20, 5) ) as qtolob_f )
when ( _qamv.tolobni is not initial ) and ( _dec.InspSpecDecimalPlaces = 6 )
then cast( cast( round( fltp_to_dec( _qamv.toleranzob as abap.dec(20,7 ) ), 6) as abap.dec(20, 6) ) as qtolob_f )
when ( _qamv.tolobni is not initial ) and ( _dec.InspSpecDecimalPlaces = 7 )
then cast( cast( round( fltp_to_dec( _qamv.toleranzob as abap.dec(20,8 ) ), 7) as abap.dec(20, 7) ) as qtolob_f )
when ( _qamv.tolobni is not initial ) and ( _dec.InspSpecDecimalPlaces = 8 )
then cast( cast( round( fltp_to_dec( _qamv.toleranzob as abap.dec(20,9 ) ), 8) as abap.dec(20, 8) ) as qtolob_f )
when ( _qamv.tolobni is not initial ) and ( _dec.InspSpecDecimalPlaces = 9 )
then cast( cast( round( fltp_to_dec( _qamv.toleranzob as abap.dec(20,10) ), 9) as abap.dec(20, 9) ) as qtolob_f )
when ( _qamv.tolobni is not initial ) and ( _dec.InspSpecDecimalPlaces = 10 )
then cast( cast( round( fltp_to_dec( _qamv.toleranzob as abap.dec(20,11) ),10) as abap.dec(20,10) ) as qtolob_f )
else ''
end as InspSpecFrmtdUpperLimit,
case
when ( _qamv.tolunni is not initial ) and ( _dec.InspSpecDecimalPlaces = 0 )
then cast( cast( round( fltp_to_dec( _qamv.toleranzun as abap.dec(20, 1) ), 0) as abap.dec(20, 0) ) as qtolun_f )
when ( _qamv.tolunni is not initial ) and ( _dec.InspSpecDecimalPlaces = 1 )
then cast( cast( round( fltp_to_dec( _qamv.toleranzun as abap.dec(20, 2) ), 1) as abap.dec(20, 1) ) as qtolun_f )
when ( _qamv.tolunni is not initial ) and ( _dec.InspSpecDecimalPlaces = 2 )
then cast( cast( round( fltp_to_dec( _qamv.toleranzun as abap.dec(20, 3) ), 2) as abap.dec(20, 2) ) as qtolun_f )
when ( _qamv.tolunni is not initial ) and ( _dec.InspSpecDecimalPlaces = 3 )
then cast( cast( round( fltp_to_dec( _qamv.toleranzun as abap.dec(20, 4) ), 3) as abap.dec(20, 3) ) as qtolun_f )
when ( _qamv.tolunni is not initial ) and ( _dec.InspSpecDecimalPlaces = 4 )
then cast( cast( round( fltp_to_dec( _qamv.toleranzun as abap.dec(20,5 ) ), 4) as abap.dec(20, 4) ) as qtolun_f )
when ( _qamv.tolunni is not initial ) and ( _dec.InspSpecDecimalPlaces = 5 )
then cast( cast( round( fltp_to_dec( _qamv.toleranzun as abap.dec(20,6 ) ), 5) as abap.dec(20, 5) ) as qtolun_f )
when ( _qamv.tolunni is not initial ) and ( _dec.InspSpecDecimalPlaces = 6 )
then cast( cast( round( fltp_to_dec( _qamv.toleranzun as abap.dec(20,7 ) ), 6) as abap.dec(20, 6) ) as qtolun_f )
when ( _qamv.tolunni is not initial ) and ( _dec.InspSpecDecimalPlaces = 7 )
then cast( cast( round( fltp_to_dec( _qamv.toleranzun as abap.dec(20,8 ) ), 7) as abap.dec(20, 7) ) as qtolun_f )
when ( _qamv.tolunni is not initial ) and ( _dec.InspSpecDecimalPlaces = 8 )
then cast( cast( round( fltp_to_dec( _qamv.toleranzun as abap.dec(20,9 ) ), 8) as abap.dec(20, 8) ) as qtolun_f )
when ( _qamv.tolunni is not initial ) and ( _dec.InspSpecDecimalPlaces = 9 )
then cast( cast( round( fltp_to_dec( _qamv.toleranzun as abap.dec(20,10) ), 9) as abap.dec(20, 9) ) as qtolun_f )
when ( _qamv.tolunni is not initial ) and ( _dec.InspSpecDecimalPlaces = 10 )
then cast( cast( round( fltp_to_dec( _qamv.toleranzun as abap.dec(20,11) ),10) as abap.dec(20,10) ) as qtolun_f )
else ''
end as InspSpecFrmtdLowerLimit,
// Expose the used number of decimal places
_dec.InspSpecDecimalPlaces as InspSpecDecimalPlaces
}