Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8581

Re: How to change order of columns in wdp alv table

$
0
0

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

 

 

 

 

 

 

 


Viewing all articles
Browse latest Browse all 8581

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>