SALV IDA framework also provides the flexibility to change Column settings. Lets check how to change to change the column settings in SALV IDA.
Preface
In the last article – SALV IDA – New Calculated Fields, we added couple of new columns in the ALV. Since these calculated fields are not part of the DB structure obviously they don’t have proper column headings. Lets try to make it better!
SALV IDA Columns Settings
Columns setting is being handled by the FIELD_CATALOG method. This provides the column object which has different methods. Here is the overview of the Column settings:
- Use the method FIELD_CATALOG( ) to get back the column object
- Every method as part of the Field catalog object, you can supply the Column Name in the specific method
- Column Description
- SET_FIELD_HEADER_TEXTS
- SET_DATA_ELEMENT
- Currency and UOM related methods
- SET_CURRENCY_REFERENCE_FIELD
- SET_FIXED_CURRENCY
- SET_FIXED_UNIT
- SET_UNIT_REFERENCE_FIELD
- Disable methods
- DISABLE_SORT
- DISABLE_FILTER
- DISABLE_AGGREGATION
- Text Search – ENABLE_TEXT_SEARCH
Code Lines
Code lines to set the settings for the columns. This code is based on the template available in article SALV IDA Introduction
*$*$1 METHODS: column_settings. *$*$1 *$*$2 me->column_settings( ). *$*$2 METHOD column_settings. * Column Description TRY. o_salv_ida->field_catalog( )->set_field_header_texts( iv_field_name = 'UCASE_TEXT' iv_header_text = 'Text in Upper case' ). CATCH cx_salv_ida_unknown_name cx_salv_call_after_1st_display. ENDTRY. TRY. * Column Description o_salv_ida->field_catalog( )->set_field_header_texts( iv_field_name = 'COUNT_PH' iv_header_text = 'Placeholder Count' ). CATCH cx_salv_ida_unknown_name cx_salv_call_after_1st_display. ENDTRY. * Disable Sort TRY. o_salv_ida->field_catalog( )->disable_sort( iv_field_name = 'MSGNR' ). CATCH cx_salv_ida_unknown_name cx_salv_call_after_1st_display. ENDTRY. * Disable Filter TRY. o_salv_ida->field_catalog( )->disable_filter( iv_field_name = 'SPRSL' ). CATCH cx_salv_ida_unknown_name cx_salv_call_after_1st_display. ENDTRY. TRY. o_salv_ida->field_catalog( )->enable_text_search( iv_field_name = 'TEXT' ). CATCH cx_salv_ida_unknown_name cx_salv_call_after_1st_display. ENDTRY. ENDMETHOD. *$*$3
Output
So, now the added columns has description
Sort is disabled on the Message Number
Filter is disabled on Language key
Next Article
SALV IDA – Add and Handle Hotspot (hyperlink)