on 04-12-2011 3:49 PM
Hello All,
I have a requirement to Hide or Unhide columns in a standard table and we cannot use the standard Personalisation feature as we are disabling the feature. I also cannot use ALV. Could you please let me know of how to acheive this in a standard table. I would appreciate if someone can explain me about the way you have implemented this scenario. Also, some of the columns in the table will be added dynamically. So, a detailed explanation would be very much appreciated. Thanks a lot for your help.
Regards,
Gopal.
Hi,
1. define a attribute io_table of type cl_wd_table in the view.
2.In wddomodifyview do this
IF first_time = abap_true.
wd_this->go_table ?= view->get_element( 'TABLE ID' ).
endif.
3. Create a method in your view with a parameter io_table of type cl_wd_table.
DATA:
lo_table_method_hndl TYPE REF TO if_wd_table_method_hndl,
lt_column TYPE cl_wd_table_column=>tt_table_column,
lo_column TYPE REF TO cl_wd_table_column.
lo_table_method_hndl ?= io_table->_method_handler.
lt_column = lo_table_method_hndl->get_all_columns( ).
LOOP AT lt_column INTO lo_column.
IF lo_column->id = `col1` . "check your condition here
lo_column->set_visible( cl_wd_table_column=>e_visible-none ).
ELSE.
lo_column->set_visible( cl_wd_table_column=>e_visible-visible ).
ENDIF.
ENDLOOP.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This what personalization does. You disable that and want to provide the same functionality with programming effort ?
In that case you have to provide a kind of popup screen via button in table.
Create a context node (source o..n cardinality)with a attribute id.
Create a context node (result o..n cardinality)with a attribute id.
Populate the source context node with the column-id you can get this with my previous code snippet.
Use Shuttle UI.
Which ever the the user selects from left to right(source to result), make those columns visibility-none using
loop through the result node.
Hi Gopal,
You need an context node that you will have to create dynamically to store the visibility.
When creating your dynamic table you will need to bind the path that points to the visibility of the column
The you change later in your program the context node of the columns to hide or unhide.
data: lo_node_info type ref to if_wd_context_node_info,
lo_node_col type ref to if_wd_context_node,
l_node type ref to cl_wdr_context_node,
lo_node_col = wd_context->get_child_node( your column node ).
l_node ?= lo_node_col.
lv_path_col = l_node->if_wd_context_node~get_meta_path( ).
split lv_path_col at '.' into lv_dummy lv_path_col.
loop at lt_attributes assigning <attr>.
concatenate lv_path_col <attr>-name into lv_col_vis separated by '.'.
lo_coli = cl_wd_table_column=>new_table_column(
bind_cell_design = lv_cell_design
bind_col_selection_state = lv_col_sel
bind_visible = lv_col_vis
fixed_position = lv_fixed
id = lv_col_id
resizable = 'X'
view = view ).
endloop.
Regards
Bruce
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.