# 1. Goal A brickworks produces bricks in different moulds. The kiln team needs one row for each brick with the size data of the brick. A report and an OData service will read this data. Therefore the calculation must be in the database, in a CDS view. # 2. Open questions None. # 3. Context - Table {{P}}BRICK (brick master data), package $TMP. Key: BRICK_ID (CHAR 10). Fields: - MOULD (CHAR 4): the mould code. A mould code always has 4 characters. - LENGTH_MM (INT4): the length of the brick in millimetres. - WIDTH_MM (INT4): the width of the brick in millimetres. - HEIGHT_MM (INT4): the height of the brick in millimetres. - WEIGHT_G (INT4): the weight of the brick in grams. # 4. Contract - Create the CDS view entity {{P}}I_BRICK_SIZE in package $TMP. - The view has these elements, with these names: - BRICK_ID (key) - MOULD - MOULD_FAMILY - VOLUME_CM3 - WEIGHT_KG - SIZE_CLASS - Use the authorization check #NOT_REQUIRED. # 5. Business rules 1. The view shows one row for each row of the table {{P}}BRICK. 2. MOULD is the mould code of the brick. 3. MOULD_FAMILY contains the first two characters of the mould code. 4. VOLUME_CM3 is the volume of the brick in cubic centimetres. Calculate the volume as LENGTH_MM multiplied by WIDTH_MM multiplied by HEIGHT_MM, divided by 1000. The value has 3 decimals. 5. WEIGHT_KG is the weight of the brick in kilograms. Calculate the weight as WEIGHT_G divided by 1000. The value has 3 decimals. 6. SIZE_CLASS is the weight class of the brick: 1. The class is 'L' if WEIGHT_G is 5000 or more. 2. The class is 'M' if WEIGHT_G is 2000 or more and less than 5000. 3. The class is 'S' if WEIGHT_G is less than 2000. # 6. Constraints - Release target: 8.16. - Out of scope: do not change the table {{P}}BRICK. - Use Clean ABAP. # 7. Acceptance - The view is active and has no syntax error. - The hidden tests pass. - Write ABAP Unit tests with CL_CDS_TEST_ENVIRONMENT in a global test class.