cancel
Showing results for 
Search instead for 
Did you mean: 

UI Table - Column order change

Former Member
0 Kudos

Hi,

I enhanced below table to display one customer column. It displays but at the end. It needs to displayed 3rd column. I couldn't succeded with move 'UP' and 'DOwn' or drag and drop because it enhancment to standard. I also need to hide one standard column.

I am trying to do it in 'modifyview' method. It would be nice to have some sample coding to change the Table Column in runtime. also would like to know best practice to do it.

Thanks!

....Naddy

System Component Release: 702 and Level 9.

HRRCF_C_REQUI_MONITOR_UI
WDW_MAIN
VW_REQUI_LIST
Information on Field
REQUI_TABLE
TABLE
STANDARD

Accepted Solutions (1)

Accepted Solutions (1)

former_member184578
Active Contributor
0 Kudos

Hi,

Delete the Table UI and then create a new table UI and bind it, then you can arrange the columns. For more info see this article :  Enhancing Standard WDA component

You can do it in WDDOMODIFYVIEW also, but the above approach is easy i feel.

Hope this helps u.,

Thanks & Regards,

Kiran.

Former Member
0 Kudos

Hi Kiran,

I wouldn't prefer to delete and recreate approach. May be I would consider it as last option.

The approach 'Enhancing Standard WDA component ' was propossed by 3 years ago. I am sure there must be simple way to do it. I personally feel that, manipulating Column orders in WDDOMODIFYVIEW is the easiest way and less maintananec in future.

If you have sample coding to manipulating thr Column orders in WDDOMODIFYVIEW. please share with me.

Thanks for your suggestion!

...Naddy

Former Member
0 Kudos

Hi,

1 . Get the table reference using VIEW attribute of WDMODIFYVIEW by passing the table Id.

2. Using the table reference (cl_wd_table) use the method get_columns that returns internal table CL_WD_TABLE_COLUMN=>TT_TABLE_COLUMN.

3. Loop at the columns, using column reference (cl_wd_table_column) use the method SET_FIXED_POSITION and pass the column order to be displayed.

Hope this helps.

Former Member
0 Kudos

Lekha reply helped to solve the issue in a best way.

Actual coding....

    DATA: lo_column        TYPE REF TO cl_wd_table_column
      , lv_fix_pos       TYPE wdui_table_column_fixed_pos
      .

  IF first_time = abap_true.

    " Remove Column 'Request'
    lo_column ?= view->get_element( `REQUI_REQUEST` ).
    IF lo_column IS BOUND.
      CALL METHOD lo_column->set_visible
        EXPORTING
          value = 1. " None
    ENDIF.

    " Rearrange Enhanced Custom Column 'Job Title'
    lo_column ?= view->get_element( `REQUI_TABLE_HEADER` ).
    IF lo_column IS BOUND.
      lv_fix_pos = lo_column->get_fixed_position( ).
      lv_fix_pos = lv_fix_pos + 1.
      lo_column ?= view->get_element( `REQUI_TABLE_JOBTITLE` ).
      IF lo_column IS BOUND.
        CALL METHOD lo_column->set_fixed_position
          EXPORTING
            value = lv_fix_pos.
      ENDIF.
    ENDIF.

  ENDIF.

Answers (0)