‎2007 Jul 12 11:19 PM
Hi Gurus,
I have a problem using CL_SALV_COLUMNS_TABLE class. I need to remove a colum from the report output and the method that i think it could help me is REMOVE_COLUM. However, this method is protected.
An alternative soluction is to use the method SET_VISIBLE from class CL_SALV_COLUMN, but in this way i cannot eliminate the colum and that is my necesity.
¿Can you help me with this?
Thanks
‎2007 Jul 12 11:25 PM
Hi,
I am not sure of an other method..
You can try this..
Create a local class in you program and inherit the class CL_SALV_COLUMNS_TABLE ...
In the new class create a method ..
In the new method..call the protected method using the object ME
Ex..
CALL METHOD me->remove_column
.............
Now in your program create an object for your local class and call the method you created..
Thanks
Naren
‎2007 Jul 12 11:25 PM
Hi,
I am not sure of an other method..
You can try this..
Create a local class in you program and inherit the class CL_SALV_COLUMNS_TABLE ...
In the new class create a method ..
In the new method..call the protected method using the object ME
Ex..
CALL METHOD me->remove_column
.............
Now in your program create an object for your local class and call the method you created..
Thanks
Naren
‎2007 Jul 13 12:11 AM
Hi Naren,
Finally i can use the method REMOVE_COLUMN thanks to your answer.
However, my problem continue. I used the method GET_COLUMNS from CL_SALV_TABLE class to obtain all columns that belong to the internal table that contain the data to be display in the report. It returned an instance from CL_SALV_COLUMNS_TABLE. I need to link the object that i instantiated from the local class to the object which contains the name of all columns in order to delete from the columns table the column that i don´t need.
Thanks for your help, excuse me if my question is a little complicated.
‎2007 Jul 13 12:52 AM
‎2007 Jul 13 1:50 AM
Here is a complete example of what I mean.
REPORT zrich_0001.
DATA: ispfli TYPE TABLE OF spfli.
DATA: gr_table TYPE REF TO cl_salv_table.
DATA: gr_columns TYPE REF TO cl_salv_columns_table.
DATA: gr_column TYPE REF TO cl_salv_column_table.
DATA: gr_functions TYPE REF TO cl_salv_functions.
START-OF-SELECTION.
SELECT * INTO TABLE ispfli FROM spfli.
cl_salv_table=>factory(
IMPORTING
r_salv_table = gr_table
CHANGING
t_table = ispfli ).
gr_functions = gr_table->get_functions( ).
gr_functions->set_all( abap_true ).
gr_columns = gr_table->get_columns( ).
gr_column ?= gr_columns->get_column( 'MANDT' ).
gr_column->set_technical( abap_true ).
gr_table->display( ).
Regards,
Rich Heilman
‎2007 Jul 13 2:05 PM
‎2014 Apr 01 4:04 AM
Hi Narendran ,
CL_SALV_COLUMNS_TABLE is a final class. So it will show a syntax error.
So could you please suggest.
Thanks.
Regards,
Saurabh
‎2007 Jul 13 12:37 AM
Hi,
I think I understood your question..
When you create an object for the local class(that you inherited the CL_SALV_COLUMNS_TABLE )..That will be your main object to do all the operations..Use this object to remove the columns and call the methods that is available in the class CL_SALV_COLUMNS_TABLE..
Do not create another instance for the class CL_SALV_COLUMNS_TABLE again..
Hope I understood your question..
Thanks
Naren