Skip to Content
Author's profile photo Nagaraju Nadipudi

SAP List Viewer with Integrated Data Access (ALV with IDA)

Contents

SAP List Viewer with Integrated Data Access (ALV with IDA).

Overview.. 3

Examples. 3

Example#1: Display Sales Order Details. 3

Example#2: Apply Filtering. 4

Example#3: ALV Display Setting. 6

Example#4: Event Handling. 8

Example#5: Calculation Fields. 12

Example#6: Working with CDS Views. 15

Example#7: Authority Check. 16

Classes/Interfaces: 17

 

Overview

ALV with IDA (SAP List Viewer with Integrated Data Access) helps tables that contain very large quantities of data to be displayed on the UI. The results of operations such as sorting, grouping, or filtering are also delivered with a very fast response time. It uses the in-memory database, such as SAP HANA, without having to switch to a new programming environment. There is no change in the User interface and standard functions (also ALV services). ALV functions are adjusted to the use of in-memory databases. The new general programming model (Coding Pushdown) is also optimally supported when using in-memory databases.

 

Examples

Example#1: Display Sales Order Details

Following example demonstrates how to display sales order with SALV IDA.

Output:

Check DB Capabilities

CHECK cl_salv_gui_table_ida=>db_capabilities( )->is_table_supported( iv_ddic_table_name = ‘VBAK’).

Create IDA

DATA(o_ida) = cl_salv_gui_table_ida=>create( iv_table_name = ‘VBAK’ ).

Set Maximum Rows Recommended

IF cl_salv_gui_table_ida=>db_capabilities( )->is_max_rows_recommended( ).

o_ida->set_maximum_number_of_rows(  iv_number_of_rows = 2000 ).

ENDIF.

Display

o_ida->fullscreen( )->display( ).

Program

 

Output

Example#2: Apply Filtering

Following example demonstrates how to set filter by using PARAMETERS and SELECT-OPTIONS

Step#1: Define Selection Screen

Step#2: Convert Parameters and Select-Options to Range table using CL_SALV_RANGE_TAB_COLLECTOR

Step#3: Apply filtering in ALV IDA

Selection Screen

Set Filter

Output:

Selection Screen
Output

Example#3: ALV Display Setting

  • List of fields to be displayed
  • Set Sort Order
  • Display Options
  • Set Currency Reference Field

 

Restrict list of fields to be displayed

Step#1 Prepare internal table with list of fields in sorted order

Step#2: Pass the list of fields to SAL IDA

Output:

Set Sort Order

Step#1: Prepare table for fields for which sorting is needed

Step#2: Pass the sorted table to SALV IDA

Output

Display Options

Set Currency Reference field

Set the reference fields for currency and quantity fields

Example#4: Event Handling

User interactions on the ALV can be handled by implementing the event handler methods.

  • Double Click
  • Toolbar Button

 

Double Click

Step#1: Define Event Handler Class/Method

Step#2: Implement Event Handler Class/Method

Step#3: Enable Double Click for SALV Grid

Step#4: Set Event Handler Method

Implement Event handle method

Enable Double Click and Set Selection Mode
Instantiate Event Handler Class and Set Handler

Output

Toolbar Button

Create own buttons on toolbar

Step#1: Define Event Handler Class/Method

Step#2: Implement Event Handler Class/Method

Step#3: Add button to the Toolbar

Step#4: Enable Selection mode for SALV Grid

Step#4: Set Event Handler Method

1. Toolbar Event Handler Method Definition
2. Toolbar Event Handler Method Implementation

3.Add Button on to the Toolbar
4.Set Event Handler Method

Output

Click on Display Button

Example#5: Calculation Fields

We can also display calculated fields apart from the Standard database table fields using calculation fields

Implement Calculation field Handler

Interface: IF_SALV_IDA_CALC_FIELD_HANDLER

Step#1: Define Structure with custom fields. 

In our case we have two calculation fields namely TAXAMOUNT and NETAMOUNT

Step#2: Implement method to get calculation field structure

Register Structure type to the SALV IDA Grid

Step#3: Implement method to get requested fields

What are the database fields needed to calculate the custom calculation fields

Step#4: Implement method to calculate Line

Perform the Calculation

Step#5: Pass the calculation fields handler object to SALV IDA Create method

Output:

Example#6: Working with CDS Views

We can use CDS Views as a data source to display data using SALV IDA

CDS Views

ALV Program

Output

Example#7: Authority Check

Authority check can be applied when working with SALV IDA. We have to use the method ADD_AUTHORIZATION_FOR_OBJECT of the interface IF_SALV_GUI_TABLE_IDA

Classes/Interfaces:

Class/Interface Purpose
IF_SALV_GUI_TABLE_IDA ALV with integrated data access (ALV with IDA)
CL_SALV_GUI_TABLE_IDA ALV with integrated data access (ALV with IDA)
CL_SALV_RANGE_TAB_COLLECTOR Class for collecting range tables for multiple fields
IF_SALV_GUI_TYPES_IDA ALV IDA API : Public data types
IF_SALV_IDA_CALC_FIELD_HANDLER IDA API: Handler for Calculated Fields
IF_SALV_GUI_TABLE_DISPLAY_OPT IDA ALV: Table Display Options API
IF_SALV_GUI_TOOLBAR_IDA IDA API Toolbar Manipulation Object

 

Reference

https://help.sap.com/doc/saphelp_scm700_ehp03/7.0.3/en-US/f0/1df4a12b0c41c59fc72d007915ea43/frameset.htm

 

 

Assigned Tags

      10 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Inderpreet Singh
      Inderpreet Singh

      Hi,

      We are using the ALV IDA in our project and we noticed that the layout button of the ALV list is placed on the extreme right as shown below:

      and other icons are on the left side.
      Our client wants to display all the buttons together on the left side.

      Is there any way to align the layout button to left.

      Thanks in advance!!!

      Author's profile photo paula galliussi
      paula galliussi

      Buen dia! como resolviste esto?

      Author's profile photo Daniel Klein
      Daniel Klein

      Same issue still exists with S/4HANA 1909 (SAP_BASIS 754). Can anyone create an Incident to SAP?

      Author's profile photo Michael Smith
      Michael Smith

      Did anyone ever follow up on this?

      Author's profile photo Charles Tan
      Charles Tan

      Hi

      May I know how to work with CDS view which has parameters?

      Thanks in advance.

      Author's profile photo paula galliussi
      paula galliussi

      Te recomiendo los videos de LOGALI que explica eso:  tiene desde el inicio son 10 videos te paso el primero asi ligas los 10  https://youtu.be/hihQzSlE2ds

      y ademas mirate este "Webinar Aplicaciones basadas en vistas CDS - Core Data Services" : https://youtu.be/lGc-L9b-nRo

       

      cuentame si te sirvió  saludos1

      Author's profile photo Olivier Souksamran
      Olivier Souksamran

      Hey,

      The interface IF_SALV_GUI_TABLE_IDA has method SET_VIEW_PARAMETERS. So just after creating your instance by calling CL_SALV_GUI_TABLE_IDA=>CREATE_FOR_CDS_VIEW( ... ), you just need to set the view parameters with the corresponding method.

      Cheers,

      Olivier

      Author's profile photo Wanderson Carvalho
      Wanderson Carvalho

      Hi,

       

      Is it possible for the color of the key column to be the same as the other columns?

      Author's profile photo Navinkumar S
      Navinkumar S

      Hi,

       

      Is it possible to add Top-Of-Page in ALV IDA. I have explored some options and not successful yet. Pls share any info related to it . Thanks.

      Author's profile photo Thomas Wolf
      Thomas Wolf

      Hi,

      regarding calculated fields...it is not possible to aggregate, filter ... for calculated fields.

      Can anybody tell me why? even If I do a calculation and set the corresponding unit field  with field_catalog)->set_unit_reference_field(  )

      Regards,

      Thomas