on 12-28-2011 6:19 AM
Hi,
I am formating a ABAP Webdynpro ALV: I remove a field by using :
l_value->if_salv_wd_column_settings~delete_column( lv_field_name).
How will I be able to add the field again ?
I tried the following :
l_value->if_salv_wd_column_settings~CREATE_COLUMN( lv_field_name).
but getting a 'null' object reference in the following standard code :
if ls_column-r_column->r_cell_editor->visible_fieldname is initial.
Regards
Hi.
After create_column method you have to create cl_salv_wd_uie_text_view object:
data:
" Variables para configurar los ALVs.
lr_alv_config_table type ref to cl_salv_wd_config_table,
lr_lr_wd_table_usage TYPE REF TO if_wd_component_usage,
lr_wd_table TYPE REF TO iwci_salv_wd_table,
lr_table_settings TYPE REF TO if_salv_wd_table_settings,
lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lr_column TYPE REF TO cl_salv_wd_column,
lr_text type ref to cl_salv_wd_uie_text_view,
lr_header type ref to cl_salv_wd_column_header.
" Initialize variables
lr_lr_wd_table_usage = wd_this->wd_cpuse_alv_1001( ).
if lr_lr_wd_table_usage->has_active_component( ) is initial.
lr_lr_wd_table_usage->create_component( ).
endif.
lr_wd_table = wd_this->wd_cpifc_alv_1001( ).
lr_alv_config_table = lr_wd_table->get_model( ).
lr_column_settings ?= lr_alv_config_table.
lr_table_settings ?= lr_alv_config_table.
" Delete Column.
lr_column_settings->delete_column( 'OBJID' ).
" Create column.
lr_column = lr_column_settings->create_column( 'OBJID' ).
create object lr_text.
lr_text->set_text_fieldname( 'OBJID' ).
lr_column->set_cell_editor( lr_text ).
" Change the header of the column.
lr_column->GET_HEADER( receiving value = lr_header ).
if lr_header is bound.
lr_column->delete_HEADER( receiving value = lr_header ).
endif.
lr_column->create_HEADER( receiving value = lr_header ).
lr_header->SET_TEXT( exporting value = 'Objid Field' ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hope this column/attribute is availabe in that NODE...please check it in debugging ..If that attribute exists to which the ALV DATA node is bound...ideally..create column should work.. Or else first try to get the COLUMN reference using GET_COLUMN..
When you have deleted it usually GET_COLUMNS willnot list that deleted column...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
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.