Files
abap-llm/tasks_gen/eval/G0122/spec.md

2.2 KiB

1. Goal

A brewery plans the bottling runs of its beer types. The planning program calls one function module. The function module reads the open bottling orders, groups them by beer type and stores the bottling plan.

2. Open questions

None.

3. Context

  • Function group {{P}}FG_BOT exists in package $TMP.
  • The database table {{P}}BOTORD exists in package $TMP. Its fields are client (key), order_id (key, NUMC 10), beer_type (CHAR 4) and volume_hl (DEC 13,3).
  • The database table {{P}}BOTPLN exists in package $TMP. Its fields are client (key), beer_type (key, CHAR 4), plan_pos (INT4), total_hl (DEC 13,3) and order_count (INT4).

4. Contract

Create the function module {{P}}BOT_PLAN in function group {{P}}FG_BOT. The interface of the function module is:

  • Importing parameter iv_min_hl TYPE decfloat34.
  • Exporting parameter ev_total_hl TYPE decfloat34.
  • Exporting parameter ev_plan_count TYPE int4.

5. Business rules

  1. Read all rows of the table {{P}}BOTORD.
  2. Ignore every order whose volume_hl is less than or equal to 0.
  3. Group the other orders by beer_type. Compare beer types exactly.
  4. For each group, total_hl is the sum of the volume_hl values of the orders of the group, and order_count is the number of orders of the group.
  5. Keep only the groups whose total_hl is greater than or equal to iv_min_hl.
  6. Delete all rows of the table {{P}}BOTPLN and write one row per kept group.
  7. The rows of {{P}}BOTPLN are numbered with plan_pos, starting at 1. The row with the largest total_hl gets plan_pos 1. If two rows have the same total_hl, the row with the smaller beer_type gets the smaller plan_pos.
  8. ev_total_hl is the sum of the total_hl values of the kept groups. If no group is kept, ev_total_hl is 0.
  9. ev_plan_count is the number of kept groups.
  10. {{P}}BOTPLN contains no rows other than the rows that rules 2 to 7 define.

6. Constraints

  • Release target: SAP_BASIS 8.16.
  • Use Clean ABAP. Keep every procedure below 40 statements.
  • Out of scope: do not change the tables {{P}}BOTORD and {{P}}BOTPLN.

7. Acceptance

  • The function module {{P}}BOT_PLAN is active and has no syntax error.
  • The hidden tests pass.
  • Write ABAP Unit tests for the function module in a global test class.