HANA SQL- Use of ARRAY

light111Use 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.

1

The table type for the above declared structure.

2

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.

3

The report that calls the method. Execute the report.

4

Here us the debug details- see the highlight part.

5

The table details.

6

In the report the importing table details.

7


 

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.

8Execute the report and see the debug details.9


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.

10

Debug details-

11


 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s