Ok… now I finally got to the really important stuff for me. I have a configuration table that tells how columns are available, and how they sequenced by default. So obviously, if I’m going to use the ALV simple table versus the “standard” Table Class, I need to control the ALV Table Columns, this includes sequence, visibility and column header text.
So, again, I’m doing all of this in the WDDOINIT method, since it’s a one time read. Here’s how you can do it yourself.
data lo_cmp_usage type ref to if_wd_component_usage.
DATA lo_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE .
DATA lv_value TYPE ref to cl_salv_wd_config_table.
*** instantiate the component
lo_cmp_usage = wd_this->wd_cpuse_alv_comp( ).
if lo_cmp_usage->has_active_component( ) is initial.
lo_INTERFACECONTROLLER = wd_this->wd_cpifc_alv_comp( ).
*** get the ALV table
lv_value = lo_interfacecontroller->get_model( ).
** first, get all of the columns from the table.
lt_cols = lv_value->if_salv_wd_column_settings~get_columns( ).
READ TABLE lt_cols INTO ls_cols with key ID = <TABLE FIELD NAME>.
*** For visibility, you the following values
* WHen ‘VISIBLE’
lv_vis = ’02’.
* when ‘INVISIBLE’.
lv_vis = ’01’.
ls_cols-r_column->set_visible( lv_vis ).
*** set the sequence of the columns
lv_seq = lv_sequence.
ls_cols-r_column->set_position( lv_seq ).
*** Set the header text and tooltip
ls_col_hdr = ls_cols-r_column->get_header( ).
lv_col_text = lv_text.
ls_col_hdr->set_text( lv_col_text ).
ls_col_hdr->set_tooltip( lv_col_text ).
Of course, you can loop through and find your values from anywhere. The important thing to notice is that it’s pretty simple. Especially in comparison to the process I was using that had to delete a column and re-add it in order to sequence it properly. This is a lot less involved. So far, I haven’t found anything that I do that would force me away from the ALV Table. I guess I’ll see what happens, but I may start converting my SM Portal to the ALV Tables. The processing time doesn’t seem bad, so if you happen to know why the “standard” vs SALV table is preferable, I’d love to hear from you.
As always, Thanks for reading,As always, thanks for reading and don't forget to check out our SAP Service Management Products at my other company JaveLLin Solutions,