Get Example source ABAP code based on a different SAP table
SQL Injections Using Dynamic Tokens The AB_SQL > syntax allows almost every clause of an AB-SQL statement to be specified dynamically as the content of a data object specified in parentheses. If all of part of the content of one of these data objects originates from outside of the program, there is a risk of one of the following SQL injections: ITOC
Latest notes: In a dynamic token, it is more secure to specify the name of an ABAP data object as an operand, instead of entering a value as a literal. ABAP_HINT_END
Example ABAP Coding
The first dynamic WHERE> condition is insecure compared to an SQL injection, if input> is an external input, which is not checked or escaped beforehand. This is not necessary for the second dynamic WHERE> condition. DATA(sql_cond1) = `CARRID = '` input `'`. SELECT SINGLE * FROM scarr WHERE (sql_cond1) INTO @wa.
DATA(sql_cond2) = `CARRID = @input`. SELECT SINGLE * FROM scarr WHERE (sql_cond2) INTO @wa.> ABAP_EXAMPLE_END
Access to Non-Permitted Database Tables If dynamically specified database tables source_syntax>> (for the statement SELECT>> or target_syntax> for writes>) originate in full or in part from outside the program, users could potentially access databases for which they usually do not have authorization. If the use of external input in dynamically specified database tables is unavoidable, the input must be properly checked. For example, the class CL_ABAP_DYN_PRG>> can be used to make a comparison with a include list.