on 06-21-2014 6:08 PM
Hi Experts,
Can anybody tell me how to change the order of columns in webdynpro alv table ,i have tried following code ,but this hav'nt worked,Please
let me know is there any other way ........advance thanks
CALL
METHOD
lo_value->
if_salv_wd_column_settings~get_columns
RECEIVING
value = lt_columns.
*
Get reference to each column and set the column position
LOOP
AT
lt_columns
INTO
ls_column.
lo_column = ls_column-r_column.
CASE
ls_column-id.
WHEN
'VBELN'
.
lo_column->
set_position(
'1'
).
WHEN
'MATKL'
.
lo_column->
set_position(
'2'
).
WHEN
'POSNR'
.
lo_column->
set_position(
'3'
).
WHEN
'MATNR'
.
lo_column->
set_position(
'4'
).
ENDCASE
.
ENDLOOP
.
ENDMETHOD
.
Regards
Sandesh
Hi Sandesh,
When we use the SALV_WD_TABLE component to display ALV, by default, all columns are arranged in the same order as the attributes in the context node of your
application.
You need to add the following code in the wddomodifyview( ) method of your View.
METHOD wddomodifyview
data:lt_columns type salv_wd_t_column_ref,
ls_column type salv_wd_s_column_ref,
lo_column type ref to cl_salv_wd_column ,
lo_ref_cmp_usage type ref to if_wd_component_usage,
lo_ref_interfacecontroller type ref to iwci_salv_wd_table ,
lo_value type ref to cl_salv_wd_config_table.
* Get reference to the Component usage of the ALV.
lo_ref_cmp_usage = wd_this->wd_cpuse_alv( ).
IF lo_ref_cmp_usage->has_active_component( ) IS INITIAL.
lo_ref_cmp_usage->create_component( ).
ENDIF.
* Get reference to the Interface controller of the ALV.
lo_ref_interfacecontroller= wd_this->wd_cpifc_alv( ).
lo_value = lo_ref_interfacecontroller->get_model( ).
* Get the Columns of the ALV
CALL METHOD lo_value->if_salv_wd_column_settings~get_columns
RECEIVING
value = lt_columns.
* Get reference to each column and set the column position
LOOP AT lt_columns INTO ls_column.
lo_column = ls_column-r_column.
CASE ls_column-id.
WHEN 'VBELN'.
lo_column->set_position('1').
WHEN 'MATKL'.
lo_column->set_position('2').
WHEN 'POSNR'.
lo_column->set_position('3').
WHEN 'MATNR'.
lo_column->set_position('4').
ENDCASE.
ENDLOOP.
ENDMETHOD.
Hope this helps you to resolve your issue.
Thanks
KH
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sandesh,
Your code should work fine.
What is the behavior of the alv table upon application run? is anything changed in the order of columns.
Regards,
Rama
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ramakrishnappa ,
Thanks for your reply,the columns are not changing in the table acoording to the order i specifies,and even i added a extra field in the table it also not displaying instead when Iam going to settings in table it is displaying in hidden columns, I have updated the Node also.with added attribute.
Regards,
Sandesh
User | Count |
---|---|
96 | |
11 | |
11 | |
10 | |
9 | |
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.