Skip to content

Lesson 5 Companion — Object APIs, Validation & Collaboration ​

1. Why derive is_low_stock ​

Storing both stock and low_stock risks inconsistency. If one can always be computed from the other, deriving the value reduces duplicated state.

2. xsdbool ​

xsdbool( logical_expression ) is a concise way to produce the conventional ABAP Boolean representation from a logical expression.

3. Validation strategy ​

This lesson uses simple normalization/Boolean return values because custom exception classes have not been introduced. In production APIs, invalid inputs may instead be rejected through class-based exceptions or richer result contracts.

4. Collaboration over global state ​

Objects should generally receive references to collaborators rather than depending on mutable global/static state.

5. Reference table ​

abap
TYPES tt_products TYPE STANDARD TABLE OF REF TO zcl_validated_product_###
  WITH EMPTY KEY.

can also be used directly, but a named reference type can improve readability.

SAP references ​