on 04-21-2011 9:56 AM
Hi all,
I am using ALV table in my application. It contains more than 20 columns. I set the column width as flexible means it will adopt upto the length of column header and data. Now the problem is, user wants to arrange the column width manually. But when i points to cursor in between the columns, i didnt get any symbol to expand/minimize the column.
How to solve this.
Please help me on this.
Thanks,
GS
Hi Sathishkumar,
You have to set ALV table as "fixed_table_layout".
DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
DATA lv_value TYPE REF TO cl_salv_wd_config_table.
DATA: lr_table_settings TYPE REF TO if_salv_wd_table_settings.
lo_interfacecontroller = wd_this->wd_cpifc_cu_alv( ).
*--> Get the ALV Model
lv_value = lo_interfacecontroller->get_model(
).
*--> Set it as Fixed Layout
lr_table_settings ?= lv_value.
lr_table_settings->set_fixed_table_layout( abap_true ).
Thanks and Regards,
Vijay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vijay,
Thank you very much for your reply. But when we use this fixed layout, we can get hat the scroll to maximize and minimize the column. But it automatically, wont arrange as per the column width. If we remove that fixed layout and give the follwing functioanlity,
cl_salv_wd_model_table_util=>if_salv_wd_table_util_stdfuncs~set_all(
r_model = r_table ).
automatic functionality is working. if we give both, then fixed alyout is only working. So i want both the functionality, automatically it should arrange and if user want to make it manually, he should get that symbol to rearrange it.
Thanks,
GS
Hi ,
Try like this...
create an instance of ALV component
DATA: LR_IF_CONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE,
LR_CMP_USAGE TYPE REF TO IF_WD_COMPONENT_USAGE,
LR_CMDL TYPE REF TO CL_SALV_WD_CONFIG_TABLE,
LR_TABLE_SETTING TYPE REF TO IF_SALV_WD_TABLE_SETTINGS.
LR_CMP_USAGE = WD_THIS->WD_CPUSE_ALV( ).
IF LR_CMP_USAGE->HAS_ACTIVE_COMPONENT( ) IS INITIAL.
LR_CMP_USAGE->CREATE_COMPONENT( ).
ENDIF.
get reference to the ALV model
LR_IF_CONTROLLER = WD_THIS->WD_CPIFC_ALV( ).
LR_CMDL = LR_IF_CONTROLLER->GET_MODEL( ).
LR_TABLE_SETTING ?= LR_CMDL.
Set column width
DATA LR_COL TYPE REF TO CL_SALV_WD_COLUMN.
LR_COL = LR_CMDL->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMN( 'PERNR' ).
LR_COL->SET_WIDTH( '70' ) .
LR_COL = LR_CMDL->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMN( 'ENAME' ).
LR_COL->SET_WIDTH( '100' ) .
LR_TABLE_SETTING->SET_FIXED_TABLE_LAYOUT( ABAP_TRUE ).
and go through this...it mightr helps..
Cheers,
Kris.
Edited by: kissnas on Apr 26, 2011 6:34 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sathishkumar,
You can set the Width for each columns. Please refer the below code,
DATA: lr_table_settings TYPE REF TO if_salv_wd_table_settings.
lr_table_settings ?= lo_value.
lr_table_settings->set_fixed_table_layout( abap_true ).
lr_table_settings->set_scrollable_col_count( 15 ).
lt_cols_ref = lo_value->if_salv_wd_column_settings~get_columns( ).
LOOP AT lt_cols_ref INTO ls_col_ref.
CASE ls_col_ref-id.
WHEN 'CARRID' OR 'CONNID'.
*--> Set the Column Width
CALL METHOD ls_col_ref-r_column->set_width
EXPORTING
value = '3%'.
ENDCASE.
ENDLOOP.
Thanks and Regards,
Vijay
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.