Keep the order even when no event matches

Some parcels have not been scanned yet. An inner join would discard those orders. A left outer join preserves each left-side order and supplies matching scan information when it exists.

Write the join and its matching condition

SELECT FROM zi_dispatch_order AS orders
  LEFT OUTER JOIN zi_scan_event AS scans
    ON orders~dispatchorder = scans~dispatchorder
  FIELDS orders~dispatchorder, scans~scannedat
  INTO TABLE @DATA(order_scans).

Rows with no event have no matching value on the right side. SQL models that missing value as NULL; an ABAP target may represent it as an initial value unless null indicators are requested. Therefore, a blank timestamp alone may not tell you whether the source was absent or the actual field was blank.

Handle missing values explicitly

ABAP SQL supports null-handling features such as null indicators and, for suitable expressions/releases, COALESCE. Choose a representation that preserves the distinction your business rule needs. Verify availability and syntax for your release, especially before using IS NULL patterns or moving nullable values into ABAP targets.

A common join-filter trap

Adding a condition on the right-side table in WHERE can discard rows with no match, effectively changing the intended outer-join behavior. Put relationship matching in ON; decide carefully whether additional filters belong in ON or WHERE.

Practice

Complete the left join and count result rows. The checker verifies structure only and does not model nulls or execute SQL.

Sources

Version note: Null indicators and SQL expression support depend on the ABAP release and query source.

Developer practice · ABAP

Practice: retain orders without a scan event

Keep every order and attach matching scan events if they exist. Join by DispatchOrder and store the results in a table.

Choose your ABAP environment

This choice changes the output pattern checked here: WRITE belongs in a classic executable report, while out->write( ) uses the supplied output reference in an ABAP Cloud class-run method. It does not switch the language version of the other code; check release and API availability in your target system.

Complete the task and include the output statement shown for your selected environment. Variable names can differ if you use them consistently. This browser checker checks structure only; it does not compile or run ABAP.

0 required structures detected · 0 checks