Use of Array, Converting Array to Table, While Loop in HANA SQL
The below post shows how to declare an ARRAY in HANA SQL, converting Array to Internal Table, Use of While Loop in HANA SQL.
Below We have a DDIC structure with one column NUM.
The table type for the above declared structure.
Here we have a class with AMDL marker interface and a method which is AMDP Procedure.
The method implementation shows how to declare an array and its initialization.
The UNNEST( ) method is used to convert an ARRAY to an internal table.
The report that calls the method. Execute the report.
Here us the debug details- see the highlight part.
The table details.
In the report the importing table details.
Now let’s change the AMDP Procedure method code, instead of initializing the array, let’s use the WHILE loop to fill the ARRAY and then using UNNEST( ) method convert the array to table.
Execute the report and see the debug details.
Let’s use the UNNEST( ) method, where two array are passed, and it forms a internal table with two columns/fields i.e num1 and num2.
Execute the report and check debug details.
Debug details-