2 lines
1.6 KiB
Markdown
2 lines
1.6 KiB
Markdown
Please create the CDS view entity {{P}}I_CONT_WEIGHT in package $TMP. The view shows the weight check for each container at a container terminal. A report and an OData service will read this check. Therefore the calculation must be in the database, in a CDS view. The view uses table {{P}}CONT (container master) in package $TMP. Its key is CONT_ID (CHAR 10). Its fields are CUSTOMER (CHAR 10), DECL_KG (DEC 15,2, declared weight in kilograms), and MAX_KG (DEC 15,2, maximum permitted weight in kilograms). The view also uses table {{P}}WEIGH (weighbridge record) in package $TMP. Its key is CONT_ID (CHAR 10). Its field is MEAS_KG (DEC 15,2, measured weight in kilograms). The view elements have these names: CONT_ID (key), CUSTOMER, DECL_KG, MEAS_KG, DEVIATION_KG, DEVIATION_PCT, and STATUS. The view has no authorization check (#NOT_REQUIRED). Show one row for each container that has a weighbridge record. Do not show a container without a weighbridge record. DEVIATION_KG is the difference between MEAS_KG and DECL_KG, without a sign. It is always positive or zero and has 2 decimals. DEVIATION_PCT is DEVIATION_KG as a percentage of DECL_KG. It has 2 decimals. STATUS is 'HOLD' if MEAS_KG is greater than MAX_KG. STATUS is 'WARN' if MEAS_KG is not greater than MAX_KG and DEVIATION_PCT is greater than 5. STATUS is 'LOAD' in all other cases. DECL_KG is always greater than zero. The release target is 8.16. Use Clean ABAP. Keep every method below 40 statements. Do not change {{P}}CONT and {{P}}WEIGH. The view must be active and have no syntax error. The hidden tests must pass. Write ABAP Unit tests with CL_CDS_TEST_ENVIRONMENT in a global test class.
|