10.5Bloom · AnNot started

AMDP & ABAP Cloud pitfalls

Reading depth

What you'll learn

An AMDP whose USING omits a referenced table activates fine but dumps at first run, and missing OPTIONS READ-ONLY costs you reader-node routing.

  • USING must list ALL referenced DB objects — a missing entry activates fine but fails at first execution.
  • AMDP parameters are SQLScript types, not ABAP types — implicit conversions can lose precision.
  • Forgetting OPTIONS READ-ONLY on a read-only AMDP forfeits reader-node routing in scale-out.

Two AMDP traps cause runtime failures rather than wrong answers. The USING clause must list *every* DB object the SQLScript body references; the dependency analyzer uses it to build the procedure's read/write set. Miss one and activation still succeeds — then the first execution fails because the runtime cannot resolve the unlisted object. And the parameters you pass in are *SQLScript* types, not ABAP types: an ABAP packed amount or a long decimal can lose precision crossing the boundary, so reason about the SQLScript type, not the ABAP declaration.

OPTIONS READ-ONLY is a scale-out concern. On a read-only AMDP it tells HANA the procedure performs no DML, which lets the platform route it to a reader node in a scale-out landscape. Omit it on a genuinely read-only procedure and you forfeit that routing — the work is pinned to the writer, degrading throughput under load even though the result is correct.

On the ABAP Cloud side, the pitfall is *time*. The ABAP_CLOUD_DEVELOPMENT_DEFAULT ATC variant gains checks with each release: a pipeline that is green today can turn red after an FPS, not because your code changed but because the rules tightened — so re-run ATC after every upgrade. And for emitting messages, IF_T100_MESSAGE is the released text approach; the classic MESSAGE i001(zx) form is permitted in Standard ABAP but forbidden in Cloud development.

Key points

  • USING must list ALL referenced DB objects — a missing entry activates fine but fails at first execution.
  • AMDP parameters are SQLScript types, not ABAP types — implicit conversions can lose precision.
  • Forgetting OPTIONS READ-ONLY on a read-only AMDP forfeits reader-node routing in scale-out.
  • ABAP_CLOUD_DEVELOPMENT_DEFAULT gains checks each release (green today, red after an FPS); IF_T100_MESSAGE is the released text approach.

Examples

BeforeIncomplete USING

The body also reads zorder_item, but only zorder_hdr is listed — this activates yet dumps on first execution.

ABAPmethod get by database function for hdb
  language sqlscript options read-only
  using zorder_hdr.
  " ... body also selects from zorder_item
AfterComplete USING, read-only

Every referenced object is listed and READ-ONLY is set, so dependencies resolve and the platform can route to a reader.

ABAPmethod get by database function for hdb
  language sqlscript options read-only
  using zorder_hdr zorder_item.

Source notes: clean-core-curriculum §10.5

Ask Claude

Build a prompt from this lesson + your question and open a fresh Claude chat with it pre-filled — handy for adapting a before/after pattern to your own object.