Thursday 19 July 2018

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

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

ABAP Development, SAP ABAP Study Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials

Output

ABAP Development, SAP ABAP Study Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials

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

ABAP Development, SAP ABAP Study Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials

Set Filter
ABAP Development, SAP ABAP Study Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials

Output:

Selection Screen

ABAP Development, SAP ABAP Study Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials

Output
ABAP Development, SAP ABAP Study Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials

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

ABAP Development, SAP ABAP Study Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials

Output:

ABAP Development, SAP ABAP Study Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials

Set Sort Order

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

Step#2: Pass the sorted table to SALV IDA

ABAP Development, SAP ABAP Study Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials

Output

ABAP Development, SAP ABAP Study Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials

Display Options
Set Currency Reference field
Set the reference fields for currency and quantity fields

ABAP Development, SAP ABAP Study Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials

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

ABAP Development, SAP ABAP Study Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials

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

ABAP Development, SAP ABAP Study Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials

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

ABAP Development, SAP ABAP Study Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials

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

ABAP Development, SAP ABAP Study Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials

Output

ABAP Development, SAP ABAP Study Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials

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

ABAP Development, SAP ABAP Study Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials

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

ABAP Development, SAP ABAP Study Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials

Output:

ABAP Development, SAP ABAP Study Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials

Example#6: Working with CDS Views


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

CDS Views

ABAP Development, SAP ABAP Study Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials

ALV Program

ABAP Development, SAP ABAP Study Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials

Output

ABAP Development, SAP ABAP Study Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials

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

ABAP Development, SAP ABAP Study Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials

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 

2 comments:

  1. Great Content. For more information about Payroll and HR Systems visit us at:


    Payroll Philippines

    ReplyDelete
  2. wow really superb you had posted one nice information through this. Definitely it will be useful for many people. So please keep update like this.sap-pp training

    ReplyDelete