SAP WHERE DYNAMIC ABAP Statements

Get Example source ABAP code based on a different SAP table
  


ABAP Code Snippet

What does it do? Dynamic WHERE Condition cond_syntax can be specified as a character-like data object or standard table with character-like row type that, when the statement is executed and with the following exceptions, contains the syntax of a logical expression (in accordance with the rules of the static WHERE condition) or is initial. The following are not supported in a dynamic WHERE condition: String expressions and bit expressions String functions and bit functions Constructor expressions Table expressions

The syntax in cond_syntax is, as in the ABAP Editor, not case-sensitive. When an internal table is specified, the syntax can be distributed across multiple rows. If cond_syntax is initial when the statement is executed, the logical expression is true. Invalid logical expressions raises an exception from the class CX_SY_ITAB_DYN_LOOP.
ABAP Code Snippet

Security Note

ABAP Code Snippet If used wrongly, dynamic programming techniques can present a serious security risk. Any dynamic content that is passed to a program from the outside must be checked thoroughly or escaped before being used in dynamic statements. This can be done using the system class CL_ABAP_DYN_PRG or the predefined function escape.
ABAP Code Snippet
ABAP Code Snippet See Security Risks of Dynamic Programming.



Latest notes:The dynamic WHERE conditions is not evaluated for a
blank table for optimization reasons. Therefore, if an internal table is blank, and a logical expression has errors, no exception is raised.

Return to menu