on 06-05-2012 12:08 PM
HI Friends,
Can anyone tell me..How to resize or drag & drop the column widths of the standard or ALV tables, when it is in the output..?
Hi,
Try this if it is 7.0 Enhancement Package1.
data lr_table type ref to cl_salv_wd_config_table.
lr_table->if_salv_wd_table_settings~set_fixed_table_layout( abap_true ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shalini,
You can use the below code to programatically set the width:
DATA: lv_ref_cmp_usage TYPE REF TO if_wd_component_usage,
lv_salv_wd_table TYPE REF TO iwci_salv_wd_table,
lv_table TYPE REF TO cl_salv_wd_config_table,
lv_column TYPE REF TO cl_salv_wd_column.
* create an instance of ALV component
lv_ref_cmp_usage = wd_this->wd_cpuse_alv_table_inst( ). " Use your component name
IF lv_ref_cmp_usage->has_active_component( ) IS INITIAL.
lv_ref_cmp_usage->create_component( ).
ENDIF.
* get ALV component
lv_salv_wd_table = wd_this->wd_cpifc_alv_table_inst( ).
lv_table = lv_salv_wd_table->get_model( ).
lv_column = lv_table->if_salv_wd_column_settings~get_column( 'COLUMN_NAME').
lv_column->set_width( '50%').
If you want to set the width in the output display you can always drag the column header in the ALV output like any other table
Regards,
Gayathri Shanbhag
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your response,
But by trying both of your codes i am only able to set the widths..but i
cant able to change them in the output itself.
I want to resize the column widths when posted to IE like dis..
Here is a video of it:
http://www.flickr.com/photos/tjung/2806011790/
Pls help me out
Hi Shalini,
Use below code to set the width of column and replace the column names in place of FIELD1,FIELD2...
DATA: l_columns TYPE salv_wd_t_column_ref,
ls_columns LIKE LINE OF l_columns
DATA: lr_column TYPE REF TO cl_salv_wd_column,
lr_column_text TYPE REF TO cl_salv_wd_column_header,
l_value TYPE REF TO cl_salv_wd_config_table,
lv_text TYPE string.
lo_cmp_usage = wd_this->wd_cpuse_alv_table( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
lo_interfacecontroller = wd_this->wd_cpifc_alv_table( ).
l_value = lo_interfacecontroller->get_model( ).
l_value->if_salv_wd_column_settings~get_columns(
RECEIVING
value = l_columns
) .
LOOP AT l_columns INTO ls_columns.
lr_column = l_value->if_salv_wd_column_settings~get_column( ls_columns-id ).
* change colomun text.
CALL METHOD lr_column->get_header
RECEIVING
value = lr_column_text.
IF ls_columns-id EQ 'FIELD1'.
lv_text = 'Description'.
lr_column->SET_WIDTH( "90" ) .
ELSEIF ls_columns-id EQ 'FIELD2'.
lv_text = 'Driver Charges'.
lr_column->SET_WIDTH( '120' ) .
ELSEIF ls_columns-id EQ 'FIELD3'.
lv_text = 'Month-Year'.
lr_column->SET_WIDTH( '120' ) .
lr_column_text = ls_columns-r_column->get_header( ).
CALL METHOD ls_columns-r_column->create_header
RECEIVING
value = lr_column_text.
CALL METHOD lr_column_text->set_text
EXPORTING
value = lv_text.
ENDLOOP.
Regards,
venkat.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
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.