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)
Naimesh Patel replied
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. TRY. 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 ENDTRY.
Explore class CL_SALV_COLUMN for different methods to change the properties of the column.
See program SALV_DEMO_TABLE_COLUMNS
You can also check: [SALV Table Display - Column Properties|http://help-abap.blogspot.com/2008/09/salv-model-7-changing-column-settings.html]