cancel
Showing results for 
Search instead for 
Did you mean: 

Selecting/Highlighting an ALV column

Former Member
0 Kudos

Hi All,

Iam trying to select/highlight an ALV column. Iam unable to select a column from output. If I click on each row I would see that particular row is highlighted. Similarly if I click on column I would like to see that column highlighted.

I tried different methods. Its not working. Iam just wondering if it's possible to select a column. Could someone help me out with this please?

Thank You,

Gajendra.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Juda,

Iam just wondering what that r_table->display() does. Let me tell you my scenario. I have a view container where in I have embeded the TABLE view of component SALV_WD_TABLE. I also have a button on that view. when I press that button I would like the data to be displayed.

In ONACTION of the button Iam writing the following functionality.I have data in my internal table and Iam binding it the CONTEXT NODE. Then Iam Instantiating and setting the data to ALV.Everthing is fine so far.

Now r_table->display( ) is giving a runtime error "Screen output without connection to user". Is there any specific place where I have to code this. I have tried this method to select cell and row as well. It didn't work.

In help it says this class is used to select Cells and Rows aswell, but Iam not able to select a Cell from the output.

Pls suggest.

Thank You,

Gajendra.

Former Member
0 Kudos

Hi Juda,

Thank you for your reply. I have tried doing like that. But I dont see any difference in my output table. Iam aslo providing the sample code.pls suggest if there is something wrong.

DATA : lr_select TYPE REF TO cl_salv_selections,

lt_columns type salv_t_column,

ls_columns type lvc_fname.

CREATE OBJECT lr_select.

**set column selections

ls_columns = 'SCARRID'.

append ls_columns to lt_columns.

lr_select->SET_SELECTED_COLUMNS( exporting value = lt_columns ).

ENDMETHOD.

Thank you,

Gajendra.

0 Kudos

Ok.

try something like this:


DATA: r_table TYPE REF TO cl_salv_table.

DATA : lr_select TYPE REF TO cl_salv_selections,
	lt_columns TYPE salv_t_column,
	ls_columns TYPE lvc_fname.

    TRY.
        cl_salv_table=>factory(
          IMPORTING
            r_salv_table   = r_table
          CHANGING
            t_table        = itab_alv ).
      CATCH cx_salv_msg.      
        EXIT.
    ENDTRY.

    r_table->display( ).

* NOT create an object, take the object of cl_salv_table
* CREATE OBJECT lr_select.

    lr_select = r_table->GET_SELECTIONS( ).


* set column selections
      ls_columns = 'SCARRID'.
      APPEND ls_columns TO lt_columns.

      lr_select->set_selected_columns( EXPORTING value = lt_columns ).
    
   r_table->refresh( ).

   

my code have errors, but this may help you

0 Kudos

Hi.

If you use <b>CL_GUI_ALV_GRID</b>, the method to select a column is: SET_SELECTED_COLUMNS.

      DATA grid TYPE REF TO cl_gui_alv_grid.
      DATA: r_cell_row TYPE lvc_s_row,
          r_cell_col TYPE lvc_s_col,
          rt_cell_col TYPE LVC_T_COL.

      r_cell_col-fieldname = 'colum1'.
      APPEND r_cell_col to rt_cell_col.

      CALL METHOD grid->SET_SELECTED_COLUMNS
        EXPORTING
          it_col_table             = rt_cell_col.

-


if you use <b>CL_SALV_TABLE</b>, check this: http://help.sap.com/saphelp_nw04/helpdata/en/a9/e6eb40c4f8712ae10000000a155106/frameset.htm

CL_SALV_TABLE->GET_SELECTIONS

CL_SALV_SELECTIONS->SET_SELECTED_COLUMNS

Message was edited by:

Juda