19 lines
751 B
Plaintext
19 lines
751 B
Plaintext
@AccessControl.authorizationCheck: #NOT_REQUIRED
|
|
@EndUserText.label: 'Container weight check'
|
|
define view entity {{P}}I_CONT_WEIGHT
|
|
as select from {{p}}cont as cont
|
|
inner join {{p}}weigh as weigh on weigh.cont_id = cont.cont_id
|
|
{
|
|
key cont.cont_id as cont_id,
|
|
cont.customer as customer,
|
|
cont.decl_kg as decl_kg,
|
|
weigh.meas_kg as meas_kg,
|
|
cast( abs( weigh.meas_kg - cont.decl_kg ) as abap.dec(15,2) ) as deviation_kg,
|
|
division( abs( weigh.meas_kg - cont.decl_kg ) * 100, cont.decl_kg, 2 ) as deviation_pct,
|
|
case
|
|
when weigh.meas_kg > cont.max_kg then 'HOLD'
|
|
when division( abs( weigh.meas_kg - cont.decl_kg ) * 100, cont.decl_kg, 2 ) > 5 then 'WARN'
|
|
else 'ZOAD'
|
|
end as status
|
|
}
|