Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

object oriented alv how to get selected cell values

Former Member
0 Likes
3,125

hi guys,

in object oriented alv's how can ı get value of selected cell?

hi guys,

in object oriented alv's how can ı get value of selected cell?

9 REPLIES 9
Read only

Sm1tje
Active Contributor
0 Likes
1,827

use method:

CALL METHOD <ref.var. to CL_GUI_ALV_GRID > ->get_selected_cells

IMPORTING

ET_CELL = <internal table of type LVC_T_CELL > .

Read only

Former Member
0 Likes
1,827

using that method &#305; can select cell and then &#305; send that cell to another alv but problem is &#305; have to take value of cell but method doesn't work because each time, &#305; don't why, cell value is empty.

do you have any suggesstion ?

Read only

Sm1tje
Active Contributor
0 Likes
1,827

Does it return nothing at all, or only row and column ID? If row and column ID are returned just use these to determine value through your internal table.

I'm not quite sure why this method isn't working correct. Can you select individual cells, or can you only select entire rows and columns. Maybe the sel_mode of the layout structure is not set correct. Try and set it to SEL_MODE = D and then try method get_selected_cells again.

Alternative method would be to use get_current_cell.

Hope this helps, else I'm out of suggestions.

Read only

Former Member
0 Likes
1,827

get_selected_cell return 3 parameters, in my code i can take 2 of them but third one which is the value of cell, can not return from method, &#305; don not why :DDD

&#305; try other methods, D

Read only

0 Likes
1,827

Hello Selcuk

I assume you mean method GET_CURRENT_CELL (because I do not see any method GET_SELECTED_CELL in this class on ECC6.0).

The problem that you do not get the value of parameter E_VALUE might by the type of your local variable.

I assume you are using a STRING variable. Replace it with a simple C-type variable, e.g.:


DATA: ld_value   TYPE lvc_value.
DATA: ld_row     TYPE i.
DATA: ld_col      TYPE i.

CALL METHOD go_grid->get_current_cell
  IMPORTING
    e_row = ld_row
    e_value = ld_value
    e_column = ld_col.

Regards

Uwe

Read only

Former Member
0 Likes
1,827

&#305; find sel_mode in structure but how can &#305; set sel_mode ? such as;

layout-sel_mode = 'X'.

Read only

0 Likes
1,827

Hello Secul

Below you find some explanations:

NO_ROWMARK

If this field is set, the button at the beginning of a row is hidden in selection modes cell selection ( SEL_MODE = 'D' ) and column/row selection ( SEL_MODE = 'A' ).

Possible values: SPACE, 'X'

SEL_MODE

Set the selection mode (see table at C.4.).

Possible values: SPACE, 'A', 'B', 'C', 'D'

Value
Mode
Possible selections
Comment

SPACE
same as 'B'
see 'B'
Default setting

'A'
Column and row selection
Multiple columns
Multiple rows
The user selects the rows through pushbuttons at the left border of the grid control.

'B'
Simple selection, list box
Multiple columns
Multiple rows

'C'
Multiple selection, list box
Multiple columns
Multiple rows

'D'
Cell selection
Multiple columns
Multiple rows
Any cells

The user selects the rows through pushbuttons at the left border of the grid control.

Regards

Uwe

Read only

Former Member
0 Likes
1,827

thks &#305; solve my problem

Read only

Former Member
0 Likes
1,827

Hello selcuck,

I am also facing the same problem.

Can you please tell me how u solved this issue..

If u have any sample coding.. it will be really helpful.

Regards,

Linda.