ABAYTHON

How to do Sorting and grouping in ALV Table through CL_SALV_SORTS

The sorting and grouping of data in ALV Table can be programmatically achieved. The method add_sort( ) of the class CL_SALV_SORTS can be used to sort or group the data. This sorting object is created from the get_sorts( ) method of the ALV Object. DATA lr_salv_sorts TYPE REF TO cl_salv_sorts. Lr_salv_sorts = lr_salv_table->get_sorts( ). Lr_salv_sorts->add_sort( …

How to do Sorting and grouping in ALV Table through CL_SALV_SORTS Read More »

How to do Aggregation using the class CL_SALV_AGGREGATION

The column of the ALV Display can be aggregated using the add_aggregation( ) method of the class CL_SALV_AGGREGATION. DATA lr_salv_aggregation TYPE REF TO cl_salv_aggregation. Lr_salv_aggregation = lr_salv_table=>get_aggregations( ). Lr_salv_aggregation->set_aggregation_before_items( abap_true ). Lr_salv_aggregation->add_aggregation( columnname = ‘AGE’                                                                 aggregation  =  if_salv_c_aggregation=>average ). The following aggregation types are available. If_salv_c_aggregation=>minimum. If_salv_c_aggregation=>maximum. If_salv_c_aggregation=>average. If_salv_c_aggregation=>total. If_salv_c_aggregation=>none.

How to fill icons in SAP ALV Display of type CL_SALV_TABLE

In order to fill icons in ALV Table, we must add an additional field of type ICON_D. The type ICON_D is of datatype CHAR with length 4. This is later filled with the icon code. Step1: Define the icon field TYPE-POOLS: icon. TYPES: BEGIN OF ty_contact.                   INCLUDE STRUCTURE ztt_db_table2.                   TYPES: icon_field …

How to fill icons in SAP ALV Display of type CL_SALV_TABLE Read More »

How to color the cells of SAP ALV Display of type CL_SALV_COLUMNS_TABLE

Step 1: Desired cells of the SAP ALV Display can be colored using the structure lvc_s_scol. The color codes must be set to each line of record. Therefore the structure of the ALV Display must be extended with the additional field with an internal table of type lvc_t_scol. TYPES: BEGIN OF ty_contact.               INCLUDE STRUCTURE …

How to color the cells of SAP ALV Display of type CL_SALV_COLUMNS_TABLE Read More »

How to color the complete column of the SAP ALV Display of type CL_SALV_COLUMN_TABLE

The method set_color of the class CL_SALV_COLUMN_TABLE can be used to color the column of SAP ALV Display. The color codes are much similar to old ALV Display of type CL_GUI_ALV_GRID DATA lr_all_columns TYPE REF TO cl_salv_columns_table. DATA lr_single_column TYPE REF TO cl_salv_column_table. Lr_all_columns = lr_salv_table->get_columns( ). Lr_single_column ?= lr_all_columns->get_column(‘CONTACT_NAME’). DATA ls_color_column TYPE lvc_s_scol. Ls_color_column-col …

How to color the complete column of the SAP ALV Display of type CL_SALV_COLUMN_TABLE Read More »