Inline declaration in SQL

Index

 

ABAP HANA 751 : Inline Field-symbol Declaration

SAP ABAP 7.51 Inline Declaration make it possible to define Internal Table, Work area and Variable on the fly from within the query. There is no need to write a separate line for Internal Table, Work area, and Variable declaration. This construct effectively helps to reduce lines of code and saves costly effort.

Declaring Variables, work areas and internal table inline in SQL statements are emerging as a  good programming practice. This also gives flexibility that if in future programmer plans to select one/more field(s) in the query, in that case, there is no need to adjust internal table’s/work area’s type. This saves effort during maintenance also.

Sample Source Code: Variant 1 – Internal tables

Inline_decl_sql_Var1_source

Output: Variant 1

Inline_decl_sql_Var1_output

Sample Source Code: Variant – Work area and Variable

Check video and GitHub link for inline declarations of Work area and Variable in SQL statements

Check the video for Code and Execution:

 

Find the code on GitHub:

Go to Code

Index

 

Leave a Reply