SALV IDA – Column Settings

By | August 1, 2016 | SALV IDA, SALV Tutorial | 23,795 | 0

SALV IDA framework also provides the flexibility to change Column settings. Lets check how to change to change the column settings in SALV IDA.

SALV_IDA_Column_Setting_Code

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

SALV_IDA_Column_Setting_Output

Sort is disabled on the Message Number

SALV_IDA_Column_Disable_Sort

Filter is disabled on Language key

SALV_IDA_Column_Disable_Filter

Next Article

SALV IDA – Add and Handle Hotspot (hyperlink)

ToC

Like It? Share!!

Don't miss an Update

Get notified of the new post, right into your inbox

Naimesh Patel{274 articles}

I'm SAP ABAP Consultant for more than a decade. I like to experiment with ABAP especially OO. I have been SDN Top Contributor.
Follow :

Explore all of his 274 articles.

Load comments

Comments on this Post are now closed. If you have something important to share, you can always contact me.

You seem to be new here. Subscribe to stay connected.