Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
55 lines
2.6 KiB
Markdown
55 lines
2.6 KiB
Markdown
# 1. Goal
|
|
A customs broker calculates the import duty for a shipment. The broker program
|
|
calls one function module for each shipment. The function module
|
|
{{P}}CUSTOMS_DUTY_OLD calculates the duty rate and the duty. Users report
|
|
several defects. Fix the function module in place. All other behavior stays the
|
|
same.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- Function group {{P}}FG_CUST exists in package $TMP.
|
|
- Function module {{P}}CUSTOMS_DUTY_OLD exists in this group. It is the only
|
|
function module in the group. Read its source. It defines the duty rates of
|
|
the goods categories and all the other behavior that must stay the same.
|
|
- The broker program calls the function module with a customs value, a country
|
|
of origin and a goods category. The program reads the duty rate and the duty.
|
|
|
|
# 4. Contract
|
|
- Fix the function module {{P}}CUSTOMS_DUTY_OLD in function group {{P}}FG_CUST.
|
|
- Do not change the interface. The parameters are:
|
|
- IV_VALUE, importing, decfloat34: the customs value in euro.
|
|
- IV_COUNTRY, importing, string: the country of origin.
|
|
- IV_CATEGORY, importing, string: the goods category.
|
|
- EV_RATE, exporting, decfloat34: the duty rate in percent.
|
|
- EV_DUTY, exporting, decfloat34: the duty in euro.
|
|
- The exception INVALID_VALUE stays.
|
|
|
|
# 5. Business rules
|
|
1. The duty is rounded half up to 2 decimals. Users report duties with more
|
|
than 2 decimals, for example 6.185 instead of 6.19.
|
|
2. The minimum duty is 5.00. The minimum applies only to a shipment that has a
|
|
duty. A shipment with a duty of zero keeps a duty of zero. Users report that
|
|
duty-free shipments are charged 5.00.
|
|
3. A shipment with a preferential origin is duty-free: the duty is 0 and the
|
|
rate is 0. The preferential origins are Switzerland (CH), Germany (DE),
|
|
France (FR), Italy (IT) and Spain (ES). Users report that shipments from
|
|
France, Italy and Spain are charged duty.
|
|
4. A negative customs value is not valid. Users report that a negative value is
|
|
accepted and gives a duty. The function module must raise the exception
|
|
INVALID_VALUE for a negative customs value.
|
|
5. The duty rates of the goods categories and all other behavior stay the same
|
|
as they are in {{P}}CUSTOMS_DUTY_OLD today.
|
|
|
|
# 6. Constraints
|
|
- Release target: 8.16 (SAP_BASIS 816, ABAP Platform 2025).
|
|
- Package $TMP. Do not use transports.
|
|
- Out of scope: do not change other objects.
|
|
- Clean ABAP. Keep the methods below 40 statements.
|
|
|
|
# 7. Acceptance
|
|
- The function module {{P}}CUSTOMS_DUTY_OLD is active and has no syntax error.
|
|
- The hidden tests pass.
|
|
- Write ABAP Unit tests for the function module in a global test class.
|