Files
abap-llm/tasks_gen/train/G1305/spec.md

1.5 KiB

Create function module {{P}}AD_PRICE in function group {{P}}FG_AD. The sales desk calls it for each advertisement order before saving. The function module calculates the price of a classified advertisement for a newspaper. The interface is: importing iv_lines type i for the number of lines; importing iv_insertions type i for the number of insertions; importing iv_photo type abap_bool, which is abap_true if the advertisement has a photo; exporting ev_price type decfloat34 for the price in euro; exceptions invalid_lines and invalid_insertions. If iv_lines is less than 1, raise invalid_lines. If iv_insertions is less than 1, raise invalid_insertions. One line costs 12.45 euro. A photo costs 25.00 euro once for each order. The discount applies to the sum of the line price and the photo price. For 1 or 2 insertions, there is no discount. For 3, 4, or 5 insertions, the discount is 10%. For 6 or more insertions, the discount is 20%. Round the price half up to 2 decimals. The minimum price is 20.00 euro. Apply the minimum price after the discount and after the rounding. Use only ABAP syntax that release 7.40 SP05 supports. Do not use inline declarations or constructor expressions. Follow Clean ABAP. Keep each method below 40 statements. Out of scope: database tables, reports, ALV lists, and other function modules. The function module must be active and have no syntax error. The hidden tests must pass. Write ABAP Unit tests for the function module in a global test class.