Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

how to build field catalog and pass to CL_SALV_TABLE?

Hello SDN Community, I have researched this extensively both on the internet and in SDN forums. It seems like a common thing to do, but I cannot seem to connect the dots from what I have read. I have done this using the function module, but am now needing to code for new CL_SALV_TABLE class.

Does anyone have an example coding of how to build a field catalog and pass it to CL_SALV_TABLE? (with data definitions of all structures)

Thank you,

Dean Atteberry.


In SALV model, system creates the Field cataloge automatically based on the structure of the table. Yes, you need to get the COLUMNS objects to be able to work with it.

Try like this:

* Get the column object
  DATA: lo_cols      TYPE REF TO cl_salv_columns.
  lo_cols = me->wo_salv->get_columns( ).

* modify individual properties
  DATA: lo_column    TYPE REF TO cl_salv_column.
      lo_column = lo_cols->get_column( 'AVAILDATE' ).
      lo_column->set_long_text( 'Avl Date' ).               "#EC NOTEXT
      lo_column->set_medium_text( 'Avl Date' ).             "#EC NOTEXT
      lo_column->set_short_text( 'Avl Date' ).              "#EC NOTEXT
      lo_column->set_output_length( 10 ).
    CATCH cx_salv_not_found.                            "#EC NO_HANDLER

Explore class CL_SALV_COLUMN for different methods to change the properties of the column.


You can also check: [SALV Table Display - Column Properties|]


Naimesh Patel

2 View this answer in context
Not what you were looking for? View more on this topic or Ask a question