分类:
2009-11-01 16:15:55
data lo_cmp_usage type ref to if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_alv( ).
if lo_cmp_usage->has_active_component( ) is initial.
lo_cmp_usage->create_component( ).
endif.
DATA lo_interface TYPE REF TO iwci_salv_wd_table.
lo_interface = wd_this->wd_cpifc_alv( ).
DATA lo_config_table TYPE REF TO CL_SALV_WD_CONFIG_TABLE.
CALL METHOD LO_INTERFACE->GET_MODEL
RECEIVING
VALUE = lo_config_table.
DATA:
lo_table_settings TYPE REF TO if_salv_wd_table_settings.
WD_THIS->R_TABLE = LO_INTERFACE->GET_MODEL( ).
lo_table_settings ?= WD_THIS->R_TABLE .
lo_table_settings->SET_WIDTH('100%').
Lo_TABLE_SETTINGS->SET_READ_ONLY( ABAP_FALSE ).
* 去掉ALV上的标准按钮
CALL METHOD lo_config_table->IF_SALV_WD_STD_FUNCTIONS~SET_DIALOG_SETTINGS_ALLOWED
EXPORTING
VALUE = ''.
CALL METHOD lo_config_table->IF_SALV_WD_STD_FUNCTIONS~SET_EXPORT_ALLOWED
EXPORTING
VALUE = ''.
CALL METHOD lo_config_table->IF_SALV_WD_STD_FUNCTIONS~SET_PDF_ALLOWED
EXPORTING
VALUE = ''.
CALL METHOD lo_config_table->IF_SALV_WD_STD_FUNCTIONS~SET_VIEW_LIST_ALLOWED
EXPORTING
VALUE = ''.
CALL METHOD lo_config_table->IF_SALV_WD_STD_FUNCTIONS~SET_FILTER_FILTERLINE_ALLOWED
EXPORTING
VALUE = ''.
CALL METHOD lo_config_table->IF_SALV_WD_STD_FUNCTIONS~SET_EDIT_INSERT_ROW_ALLOWED
EXPORTING
VALUE = ''.
CALL METHOD lo_config_table->IF_SALV_WD_STD_FUNCTIONS~SET_EDIT_CHECK_AVAILABLE
EXPORTING
VALUE = ''.
CALL METHOD lo_config_table->IF_SALV_WD_STD_FUNCTIONS~SET_EDIT_APPEND_ROW_ALLOWED
EXPORTING
VALUE = ''.
CALL METHOD lo_config_table->IF_SALV_WD_STD_FUNCTIONS~SET_EDIT_DELETE_ROW_ALLOWED
EXPORTING
VALUE = ''.
DATA:
lv_header TYPE string.
* cl_salv_wd_model_table_util=>if_salv_wd_table_util_stdfuncs~set_all(
* r_model = lo_config_table ).
DATA:
lo_column_settings TYPE REF TO if_salv_wd_column_settings.
lo_column_settings ?= lo_config_table.
DATA:
lt_columns TYPE salv_wd_t_column_ref.
lt_columns = lo_column_settings->get_columns( ).
DATA:
ls_column TYPE salv_wd_s_column_ref,
lr_col_header TYPE REF TO cl_salv_wd_column_header.
DATA lo_column TYPE REF TO cl_salv_wd_column.
LOOP AT lt_columns INTO ls_column.
lo_column = ls_column-r_column.
CASE ls_column-id.
WHEN 'Z_TITLE'.
ls_column-r_column->delete_header( ).
lr_col_header = ls_column-r_column->create_header( ).
lr_col_header->set_text( '标题' ).
when 'Z_NAME'.
ls_column-r_column->delete_header( ).
lr_col_header = ls_column-r_column->create_header( ).
lr_col_header->set_text( '反馈人' ).
when 'ZAT_TYPE'.
ls_column-r_column->delete_header( ).
lr_col_header = ls_column-r_column->create_header( ).
lr_col_header->set_text( '态度' ).
DATA:
LR_DROPDOWNBYKEY1 TYPE REF TO CL_SALV_WD_UIE_DROPDOWN_BY_KEY.
CREATE OBJECT LR_DROPDOWNBYKEY1
EXPORTING
SELECTED_KEY_FIELDNAME = LS_COLUMN-ID.
LR_DROPDOWNBYKEY1->SET_READ_ONLY( 'X' ).
LS_COLUMN-R_COLUMN->SET_CELL_EDITOR( LR_DROPDOWNBYKEY1 ).
when 'ZFB_TYPE'.
ls_column-r_column->delete_header( ).
lr_col_header = ls_column-r_column->create_header( ).
lr_col_header->set_text( '来源' ).
DATA:
LR_DROPDOWNBYKEY2 TYPE REF TO CL_SALV_WD_UIE_DROPDOWN_BY_KEY.
CREATE OBJECT LR_DROPDOWNBYKEY2
EXPORTING
SELECTED_KEY_FIELDNAME = LS_COLUMN-ID.
LR_DROPDOWNBYKEY2->SET_READ_ONLY( 'X' ).
LS_COLUMN-R_COLUMN->SET_CELL_EDITOR( LR_DROPDOWNBYKEY2 ).
when 'Z_DEPART'.
ls_column-r_column->delete_header( ).
lr_col_header = ls_column-r_column->create_header( ).
lr_col_header->set_text( '针对部门' ).
when 'ZSUBJ_NAME'.
ls_column-r_column->delete_header( ).
lr_col_header = ls_column-r_column->create_header( ).
lr_col_header->set_text( '针对栏目' ).
when 'ZDUTY_PERSON'.
ls_column-r_column->delete_header( ).
lr_col_header = ls_column-r_column->create_header( ).
lr_col_header->set_text( '针对人' ).
when 'ZREPLY_PERSON'.
ls_column-r_column->delete_header( ).
lr_col_header = ls_column-r_column->create_header( ).
lr_col_header->set_text( '回复人' ).
when 'ZREPLY_DATE'.
ls_column-r_column->delete_header( ).
lr_col_header = ls_column-r_column->create_header( ).
lr_col_header->set_text( '回复日期' ).
when 'ZREPLY_FLAG'.
DATA : LR_CHECKBOX TYPE REF TO CL_SALV_WD_UIE_CHECKBOX.
CREATE OBJECT LR_CHECKBOX
EXPORTING
CHECKED_FIELDNAME = LS_COLUMN-ID
.
LR_CHECKBOX->SET_READ_ONLY_FIELDNAME( 'ZREPLY_FLAG' ).
* if ls_column-id is not INITIAL.
* LR_CHECKBOX->SET_READ_ONLY( 'X' ).
* endif.
LS_COLUMN-R_COLUMN->SET_CELL_EDITOR( LR_CHECKBOX ).
ls_column-r_column->delete_header( ).
lr_col_header = ls_column-r_column->create_header( ).
lr_col_header->set_text( '回复' ).
WHEN 'MANDT' .
LS_COLUMN-R_COLUMN->SET_VISIBLE( CL_WD_UIELEMENT=>E_VISIBLE-NONE ).
WHEN 'Z_AUD_ID' .
LS_COLUMN-R_COLUMN->SET_VISIBLE( CL_WD_UIELEMENT=>E_VISIBLE-NONE ).
WHEN 'Z_LETTER_ID' .
LS_COLUMN-R_COLUMN->SET_VISIBLE( CL_WD_UIELEMENT=>E_VISIBLE-NONE ).
WHEN 'ZPRO_NM' .
LS_COLUMN-R_COLUMN->SET_VISIBLE( CL_WD_UIELEMENT=>E_VISIBLE-NONE ).
WHEN 'ZCONTET_ABSTRACT' .
LS_COLUMN-R_COLUMN->SET_VISIBLE( CL_WD_UIELEMENT=>E_VISIBLE-NONE ).
WHEN 'ZFILE_PATH' .
LS_COLUMN-R_COLUMN->SET_VISIBLE( CL_WD_UIELEMENT=>E_VISIBLE-NONE ).
* WHEN 'MANDT' .
* LS_COLUMN-R_COLUMN->SET_VISIBLE( CL_WD_UIELEMENT=>E_VISIBLE-NONE ).
* WHEN 'MANDT' .
* LS_COLUMN-R_COLUMN->SET_VISIBLE( CL_WD_UIELEMENT=>E_VISIBLE-NONE ).
ENDCASE.
ENDLOOP.