Skip to content

Avoid Unnecessary Dynamic Programming Constructs (SQL Injection Prevention) ​

WarningSecurity & Robustness#EC NO_DYNAMIC_STMTRemote Enabled

Overview ​

No Dynamic Constructs (CALL, ASSIGN, CREATE, etc.).

ATC Finding Message: Avoid dynamic calls and language constructs

Rationale ​

Dynamic ABAP statements (like dynamic SQL SELECT (lt_fields) FROM (lv_table) WHERE (lv_cond), dynamic method calls CALL METHOD (lv_class)=>(lv_meth), or dynamic assignments ASSIGN (lv_var) TO <fs>) bypass compile-time syntax checks, cannot be analyzed by static ATC security tools, and introduce severe SQL Injection (CWE-89) risks.

Security Standard: Write static, strongly-typed OpenSQL and OOP code wherever possible. When dynamic SQL is unavoidable (e.g. in generic analytics engines), escape input variables thoroughly using cl_abap_dyn_prg.

Non-Compliant ​

abap
" Critical Security Vulnerability: SQL Injection via unsanitized WHERE string
DATA(lv_where) = |CUSTOMER_ID = '{ iv_user_input }'|.
SELECT * FROM zcustomers WHERE (lv_where) INTO TABLE @DATA(lt_cust).

Compliant ​

abap
" Secure: Static typed OpenSQL with host variable binding
SELECT customer_id, customer_name
  FROM zcustomers
  WHERE customer_id = @iv_user_input
  INTO TABLE @DATA(lt_cust).

Configuration & Thresholds ​

This check can be fine-tuned directly in the ATC Check Variant Editor (CHKV) in Eclipse ADT:

Parameter NameData TypeDefault ValueDescription & Guidance
CHECK_DYNAMIC_SQLBooleantrueDetect dynamic table names, column projections, and WHERE clauses in OpenSQL
IGNORE_RAP_QUERY_PROVIDERBooleantrueAllow dynamic queries inside custom RAP query provider implementations (IF_RAP_QUERY_PROVIDER)

Suppression ​

To suppress findings for this rule, append the pseudo-comment to the statement:

abap
" Standard pseudo-comment:
... "#EC NO_DYNAMIC_STMT

" SAP CI_ prefix format:
... "#EC CI_NO_DYNAMIC_STMT

Technical Details ​

Released under the MIT License.