12-16-2014 5:47 AM
Hi experts,
I am using cl_salv_table to display the data.
1.Is it possible to pass my own field catalog to this class as we pass for cl_gui_alv_grid.
We can get the functions by the following code....
gr_funct = gr_table->get_functions( ).
gr_funct->set_all( Abap_True ).
But,
2.How to hide specific functions and display few extra functions like 'FIND' etc..
3.How to set the column heading.
4.How to optimize the width of the column.
If I can pass my own field catalog to this I will be able to solve maximum issues.
Best Regards,
Eshwar
12-16-2014 7:19 AM
Hi,
Below code can help you to change field catalog and column width.
You can go through Method of class cl_salv_functions_list, cl_salv_columns_table, cl_salv_column_table and cl_salv_table to find various functions or options that can be done.
DATA: o_col TYPE REF TO cl_salv_column_table,
o_columns TYPE REF TO cl_salv_columns_table.
*To set columns optimized
CALL METHOD o_columns->set_optimize
EXPORTING
value = abap_true.
*Setting Short Text, Max 10 characters
CALL METHOD o_col->set_short_text
EXPORTING
value = fp_stext.
*Setting Medium Text, Max 20 characters
CALL METHOD o_col->set_medium_text
EXPORTING
value = fp_mtext.
*Setting Long Text, Max 40 characters
CALL METHOD o_col->set_long_text
EXPORTING
value = fp_ltext.
*To change alignment
CALL METHOD o_col->set_alignment
EXPORTING
value = if_salv_c_alignment=>left.
Regards,
Ganesh Lathi.
12-16-2014 8:03 AM
Hi,
the SALV-classes are a strict(er) OO-approach (in contrast to cl_gui_alv_grid e.g.).
So, it's only consequent that we don't find a field-catalog here anymore (that means a huge structure with many flags). The OO-approach offers classes for the different components instead, like Ganesh has already posted.
I agree that switching to SALV is a little bit hard for the first time, having to find all the classes/methods instead of the "old" field-catalog. However, the documentation for the classes (se24) is quite helpful fortunatelly.
Regards,
Ulrich
12-16-2014 8:21 AM
Hi Eshwar,
Why you need fieldcatlog? It seems how many field columns in your itab then it will shows all field columns out.
2, Do not use set_all() method, to use set_function() with name and bool value.Just go class CL_SALV_FUNCTIONS_LIST to check.
3, Using cl_salv_columns_table to get_column(), then set_short_text().
4, there is class cl_salv_layout to set layout.
Detail please refer this link: http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/eac1fa0b-0e01-0010-0990-8530de490...
regards,
Archer.
12-16-2014 9:06 AM
Hi,
Data :lv_columns type ref to cl_salv_columns_table,
lv_column type ref to cl_salv_column_table.
lv_columns = gt_table->get_columns().
lv_columns->set_optimize( abap_true).
12-16-2014 12:54 PM