Files

60 lines
2.6 KiB
Markdown

# 1. Goal
A stock report and an OData service must use the same line type for warehouse
stock positions. Create the DDIC structure {{P}}STOCK_LINE and the DDIC
structure {{P}}AUDIT_INFO in package $TMP.
# 2. Open questions
None.
# 3. Context
- The table {{P}}STOCK exists in package $TMP. Its columns are, in this order:
MATERIAL (CHAR 18), PLANT (CHAR 4), NET_AMOUNT (DEC 9,2), CURRENCY (CHAR 5),
CREATED_BY (CHAR 12), CREATED_ON (DATS). The key is CLIENT, MATERIAL and
PLANT.
- The table {{P}}STOCK is empty. Test data comes from test doubles.
- {{P}}AUDIT_INFO is the audit part that other objects use, for example a
change log view and a service. {{P}}STOCK_LINE must carry the same audit
part.
- Both structures are used as line types in ABAP SQL and in an OData service.
# 4. Contract
- Create the DDIC structure {{P}}STOCK_LINE in package $TMP.
Components, in this order: material (CHAR 18), plant (CHAR 4),
net_amount (DEC 9,2), currency (CHAR 5), created_by (CHAR 12),
created_on (DATS).
- Create the DDIC structure {{P}}AUDIT_INFO in package $TMP.
Components, in this order: created_by (CHAR 12), created_on (DATS).
- {{P}}STOCK_LINE contains all six components itself. It does not use a DDIC
include.
# 5. Business rules
1. {{P}}STOCK_LINE has exactly six components.
2. The components of {{P}}STOCK_LINE are, in this order: material, plant,
net_amount, currency, created_by, created_on.
3. material is a character field of 18 characters.
4. plant is a character field of 4 characters.
5. net_amount is a packed number with 9 digits and 2 decimal places.
6. currency is a character field of 5 characters.
7. created_by is a character field of 12 characters.
8. created_on is a date field of type DATS.
9. {{P}}AUDIT_INFO has exactly two components, in this order: created_by
(CHAR 12) and created_on (DATS).
10. Every component of {{P}}STOCK_LINE is elementary. {{P}}STOCK_LINE is a
flat structure.
11. The components created_by and created_on of {{P}}STOCK_LINE have the same
data type and the same length as the components of {{P}}AUDIT_INFO.
12. A row of {{P}}STOCK can be read into a work area of type {{P}}STOCK_LINE
with ABAP SQL.
# 6. Constraints
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
- Package $TMP. Do not use transports.
- Coding standards: Clean ABAP. No ATC priority 1 or 2 findings.
- Out of scope: do not change the table {{P}}STOCK.
# 7. Acceptance
- Both structures are active and have no syntax error.
- The hidden tests pass.
- Write ABAP Unit tests with CL_OSQL_TEST_ENVIRONMENT in a global test class
(for example {{P}}T16_TEST). The tests must prove rules 1 to 12.