ERPClimb logoERPClimb
AMDP
RAP / CDS / ODataadvanced 9 min read

AMDP Part 4: Parameters, Internal Tables and Client Handling

Preview · a free account unlocks the full lesson

Key takeaway

Pass data correctly between ABAP and SQLScript: allowed parameter types, internal tables as input, table variables, NULL and type differences, and safe client handling for tables and CDS views.

In this lessonShow sections

Visual overview

AMDP Part 4: Parameters, Internal Tables and Client Handling — learning sheetFlow: Add IMPORTING VALUE(it_customers) to the procedure → Join it in SQLScript as a table variable → Add COALESCE for aggregated amounts → Check every client-dependent source has a client filter. Key ideas: PARAMETER RULES; INTERNAL TABLES AS INPUT; TABLE VARIABLES INSIDE SQLSCRIPT; NULL AND TYPE DIFFERENCES. Watch out: SQL NULL is not ABAP initial — use COALESCE for aggregates and outer joins.ERPClimb.com / RAP / LESSON 4/6 / LEARNING SHEETAMDP Part 4: Parameters, Internal Tables and ClientHandling1 · HOW IT FLOWS1Add IMPORTINGVALUE(it_customers)to the procedure2Join it inSQLScript as atable variable3Add COALESCE foraggregatedamounts4Check everyclient-dependentsource has a…2 · KEY IDEAS EXPLAINEDParameter RulesAlways "VALUE( … )" — no referencepassing.Allowed: elementary types, and internal tableswith flat (non-nested) line types; no references,no nested structures, no strings in structures on…Internal Tables As InputIn ABAP: IMPORTING VALUE(it_customers) TYPEtt_customers.In SQLScript it is a table variable: SELECT … FROMzsales_item AS i INNER JOIN :it_customers AS c ONc.customer = i.customer.Table Variables Inside Sqlscriptlt_open = SELECT …; — then use :lt_open in laterstatements. HANA optimizes the whole block, sosteps stay set-based.Null And Type DifferencesOuter joins and aggregates over no rows returnNULL, not 0 or ''. ABAP receives initial values,but calculations inside SQLScript with NULL yield…Use COALESCE( SUM( amount ), 0 ).3 · REMEMBER · WATCH OUTRememberAll AMDP parameters are passed BY VALUE; elementary types and flatinternal tables are allowed.Input internal tables arrive as table variables (read with :it_name);outputs are assigned (et_x = SELECT …).Client: filter tables with SESSION_CONTEXT('CLIENT'); for CDS viewsuse the CDS SESSION CLIENT option.!Watch outSQL NULL is not ABAP initial — useCOALESCE for aggregates and outerjoins.4 · IN A REAL PROJECTAn AMDP report showed customers with no sales as missing, and in one test system some totals were doubled. Twocauses: an inner join dropped customers without items, and the join to a customer text table had no clientfilter, so texts from two clients multiplied rows. The fix used the input table as the driving table with a…Original ERPClimb learning sheet • Verify against your SAP release and edition

Explanation

Parts 1 through 3 covered the different AMDP method types. This part is about the boundary between ABAP and the database — the parameters that cross it.

A few rules govern parameters. They're always passed "VALUE( … )", with no reference passing allowed. Only elementary types and internal tables with flat, non-nested line types are allowed — no references, no nested structures, and on some releases no strings inside structures, so it's worth checking the keyword documentation for the specific release in use. Types also need to be compatible with database types, which means using DDIC-based or clearly typed fields — dates as d or dats, amounts as p or dec.

Internal tables as input come up often, for example passing a list of customers already selected in ABAP: the ABAP side declares IMPORTING VALUE(it_customers) TYPE tt_customers, and in SQLScript it arrives as a table variable, usable directly in a join such as SELECT … FROM zsales_item AS i INNER JOIN :it_customers AS c ON c.customer = i.customer — a much better approach than dynamically building an IN list.

Free account

Create a free account to keep reading

You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.

  • Full explanation
  • Code example
  • Real project scenario
  • Common mistakes
  • Best practices
  • Interview angle

One tap with Google works too. Every topic keeps its first lesson open to everyone.

Keep exploring

Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.