Hello everyone, in this ABAP in Eclipse tutorial, we are going to learn about new version of SAP ABAP List Viewer.
ALV with Integrated Data Access
In short we call it as ALV with IDA. SAP has revamped the classical ALV to this version to leverage the capabilities of in-memory computing of SAP HANA.
How it works?
Classical ABAP ALV
In classical ALV we write SELECT queries to get the set of data from database to application layer.
All the data processing logic happens in application layer and finally the data is stored in internal table and then this final internal table is used in ALV to display the data.
All UI operations like grouping,sorting,aggregation and paging are also done in application layer itself on selected data.
ABAP ALV with IDA
But, in ALV with Integrated Data Access( aka ALV with IDA ) only selected data is sent to the UI to display the data.
All other operations like grouping,sorting,aggregation and paging are performed in SAP HANA database, by this the data sent to the application layer is reduced.
To start developing the abap alv report using ALV with IDA we need to get familiar with class CL_SALV_GUI_TABLE_IDA. There are 3 methods available in this class.
- CREATE – Create ALV with integrated data access (IDA)
- CREATE_FOR_CDS_VIEW – Create ‘ALV with IDA’ for Core Data Services(CDS)
- DB_CAPABILITIES – Capabilities supported by current DB
In this tutorial we use the method CREATE to display the ALV. So lets get started.
We assume you know how to create an ABAP program in Eclipse, if you don’t click here to know and a prerequisite to go with this tutorial.
1. Create an ABAP program in Eclipse by providing the Name and Description.Click on Next.
2. In the Selection of Transport Request window, choose the transport request. As we are saving the program in $TMP package in our case no transport request is required.Click on Finish.
3. In this tutorial, i am displaying the data of products in ALV using ALV with IDA from single table. Below is the ABAP code to create and display ALV with IDA.
REPORT zdemo_alv_ida. DATA: lo_alv TYPE REF TO if_salv_gui_table_ida. cl_salv_gui_table_ida=>create( EXPORTING iv_table_name = 'SNWD_PD' "Name of table for database access * io_gui_container = "Container for ALV display * io_calc_field_handler = "IDA API: Handler for calculated fields RECEIVING ro_alv_gui_table_ida = lo_alv "ALV with integrated data access (IDA) ). * CATCH cx_salv_db_connection. " * CATCH cx_salv_db_table_not_supported. " * CATCH cx_salv_ida_contract_violation. " * Display ALV lo_alv->FULLSCREEN( )->display( ).
4. What we have written in the above step. If you clearly look at the code, i have not used any SELECT query and Internal table to get the data from database into application layer.Instead we pushed this code to HANA database with Integrated Data Access class and this way of development paradigm is called Code Push Down.
5. Copy and paste the code. Save and activate the ABAP program.Now execute the ABAP program to see the output.The output will look like below.
- Full Screen – We showed this method in this tutorial
- In-Container display – Create a custom container and display the ALV inside the container.You can use the importing parameter IO_GUI_CONTAINER in the CREATE method to achieve this.
- Hierarchical or Tree structures, Sequential lists is not possible with ALV with IDA.
You have successfully created an ALV using ALV with Integrated Data Access on HANA. In our next tutorial we will explore the full features of ALV with IDA.
Please stay tuned to us for ABAP on HANA and ABAP in Eclipse tutorials.Please feel free to comment and let us know your feedback. You feedback will keep us alive.