on 08-28-2009 10:34 AM
Hi Experts
I have 2 views, view1 and view2. In View2 I have an ALV grid but in the wddoinit I hide certain columns using if_salv_wd_column_settings~delete_column. Lets say the context node has attribute a,b,c,d and I hide columns a and b. When I navigate from view1 to view2 the alv displays columns c & d perfectly with their data. But if I navigate from view2 to view1 and then back to view2, the data is out of sync with the columns. In other words column c and d has context a and b data in it?
I have changed the lifetime to "when visible" for view2 so that the wddoinit method is called each time but the result is the same. Please help
I've fixed it.
When I call the method set_cell_editor the columns were out of sync second time around. Thanks for your responses.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The data that you see in your ALV is the data which you bind to your context attributes. Please debug and check at the place where you are binding the data if the data is getting binded to the correct attributes.
Regards,
Viqar.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
Check whether your Wddoinit () of View2 is called second time or not ?
If yes, make the columns invisible in Wddoinit().
If your wddoinit() of view 2 is not called , then you can hide the columns while firing the view 2.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Please write the code of WDDOINIT in the handler(iplug) of 2nd view.
Regards,
Lekha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Lekha
The code is modularised but wddoinit calls method set_fields where I setup read only fields
and then method configure alv where I change column descriptions and hide columns. See below:
*method wddoinit*
DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
lo_interfacecontroller = wd_this->wd_cpifc_delnotes_alv( ).
DATA lo_value TYPE REF TO cl_salv_wd_config_table.
lo_value = lo_interfacecontroller->get_model(
).
wd_this->set_fields(
CHANGING
cx_table = lo_value
).
METHOD set_fields .
TYPES:BEGIN OF ty_name,
name TYPE string,
END OF ty_name.
DATA: lt_name TYPE TABLE OF ty_name,
ls_name TYPE ty_name.
DATA lo_nd_delnotes TYPE REF TO if_wd_context_node.
DATA lo_el_delnotes TYPE REF TO if_wd_context_element.
DATA ls_delnotes TYPE wd_this->element_delnotes.
DATA ls_final TYPE wd_this->element_delnotes.
DATA lt_delnotes TYPE TABLE OF wd_this->element_delnotes.
DATA lt_final TYPE TABLE OF wd_this->element_delnotes.
navigate from <CONTEXT> to <delnotes> via lead selection
lo_nd_delnotes = wd_context->get_child_node( name = wd_this->wdctx_delnotes ).
*Get the data from context node
CALL METHOD lo_nd_delnotes->get_static_attributes_table
IMPORTING
table = lt_delnotes.
FIELD-SYMBOLS <lfs_delnote> TYPE zce_delnotes_s.
LOOP AT lt_delnotes ASSIGNING <lfs_delnote>.
*Set flags for read only fields
wd_this->set_data(
CHANGING
cs_delnote = <lfs_delnote> " zce_delnotes_s
).
ENDLOOP.
CALL METHOD lo_nd_delnotes->bind_table
EXPORTING
new_items = lt_delnotes. "lt_final.
DATA: lt_columns TYPE salv_wd_t_column_ref,
ls_columns TYPE salv_wd_s_column_ref,
lr_input TYPE REF TO cl_salv_wd_uie_input_field,
lr_column TYPE REF TO cl_salv_wd_column,
lt_node_info TYPE wdr_context_attr_info_map,
ls_node_info TYPE wdr_context_attribute_info,
lv_tabix TYPE sy-tabix,
lr_info TYPE REF TO if_wd_context_node_info.
*-Get the context node information
lr_info = lo_nd_delnotes->get_node_info( ).
lt_node_info = lr_info->get_attributes( ).
LOOP AT lt_node_info INTO ls_node_info.
ls_name-name = ls_node_info-name.
APPEND ls_name TO lt_name.
ENDLOOP.
CALL METHOD cx_table->if_salv_wd_table_settings~set_visible_row_count
EXPORTING
value = 15.
*-Get all the columns to make row editable where read only
CALL METHOD cx_table->if_salv_wd_column_settings~get_columns
RECEIVING
value = lt_columns.
*-Now loop the columns table and change the cell editor of a column
LOOP AT lt_columns INTO ls_columns.
lr_column = ls_columns-r_column.
lv_tabix = sy-tabix.
READ TABLE lt_name INTO ls_name INDEX lv_tabix.
CREATE OBJECT lr_input
EXPORTING
value_fieldname = ls_name-name.
CALL METHOD lr_column->set_cell_editor
EXPORTING
value = lr_input.
*To make the required row is editable
wd_this->set_read_only(
EXPORTING
iv_name = ls_name-name " string
CHANGING
cx_input = lr_input " ref to cl_salv_wd_uie_input_field
).
ENDLOOP.
**Set the table Editable
cx_table->if_salv_wd_table_settings~set_read_only( value = abap_false ).
endmethod.
METHOD configure_alv .
*-Change column Header
wd_this->change_column(
EXPORTING
iv_column = 'MENGE'
iv_text = 'Quantity'
iv_tooltip =
CHANGING
cx_table = cx_table
).
wd_this->change_column(
EXPORTING
iv_column = 'BEDNR'
iv_text = 'Delivery Note'
iv_tooltip =
CHANGING
cx_table = cx_table
).
*-Delete column STATUS
cx_table->if_salv_wd_column_settings~delete_column( 'MANDT' ).
cx_table->if_salv_wd_column_settings~delete_column( 'LIFNR' ).
cx_table->if_salv_wd_column_settings~delete_column( 'LIFNRX' ).
cx_table->if_salv_wd_column_settings~delete_column( 'WERKS' ).
cx_table->if_salv_wd_column_settings~delete_column( 'ERNAM' ).
*etc.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.