Application Development 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: 

CALL METHOD ALV_GRID->GET_SELECTED_ROWS in HOTSPOT_CLICK Event, not working

Former Member
0 Kudos

Hi All.

I am new to Alv with OOPs. I am trying to Modify a program , which developed by using alv oops.

in the layout, we used USER_COMMAND and HOTSPOT_CLICK events.

I required the row numbers which are selected (Multiple rows selection by Ctrl button).

by using the following method, I am getting the row numbers selected in USER_COMMAND event,

CALL METHOD ALV_GRID->GET_SELECTED_ROWS

IMPORTING

ET_INDEX_ROWS = ROWS.

but by using the same methos, I am unable to get the rows selected in HOTSPOT_CLICK event.

I know that in HOTSPOT_CLICK event ,only related clicked row information can get.

but my requirement is that, by multiple selection in layout and in HOTSPOT_CLICK event , I require to get the Rows selected.

Please help me to sort this issue.

Thanks in advance,

Regards,

Rahul

7 REPLIES 7

Former Member
0 Kudos

HI

You can achieve this without calling events.

In layout pass SEL_MODE = A.

in program call method

GET_SELECTED_ROWS of Cl_GUI_ALv_GRID

Through this method.

For the selection mode u2018Au2019, u2018Cu2019 or u2018Du2019 you can select rows. To get information about selected rows, this method is utilized. It has two output table parameters. However, the parameter u201Cet_index_rowsu201D is obsolete. The other parameter u201Cet_row_nou201D is of type u201CLVC_T_ROIDu201D and returns row indexes for selected rows (but not cells or columns) in it.

Edited by: Anurag_n on Apr 6, 2010 10:50 AM

Former Member
0 Kudos

HI,

With the hotspot_click it will return that row id only,

I can suggest you a way round with this that,

as in the user_command you get the no. of rows.

add a column in the row where you are applying the hotspot,

Update the column in the hotspot row with the 'user action rows' for that row when the hotspot event is triggered.

And then with that read the table and get the entries wanted.

Regards,

Richa

0 Kudos

Hi Richa.

Thank you .

could you please explaing me in detail.

Thanks in advance,

Regards,

Rahul.

deepak_dhamat
Active Contributor
0 Kudos

AT LINE-SELECTION .

DATA: hotspot(10) VALUE 'Click me!',

f(30), off TYPE i, lin TYPE i, val(40), len TYPE i.

GET CURSOR FIELD f OFFSET off

LINE lin VALUE val LENGTH len.

READ TABLE it_test WITH KEY nldat = val .

WINDOW STARTING AT 20 6 ENDING AT 45 20.

WRITE: / 'Ref Master: ', it_test-userc1,

/ 'Remarks: ' , it_test-remarks,

/ 'USER: ', it_test-w_pruefer .

use Hott spot on for that field with color for identification

Regards

Deepak .

HOTSPOT ON COLOR 5

deepak_dhamat
Active Contributor
0 Kudos

hi ,

OR

You can also use This MEthod for alv

When you are creating ALV output and want one field with hot spot then you have to pass parameter p_hotspot

PERFORM get_fieldcat USING 'BISMT' 'Die.No ' 12 'R' 'N' '000' 'Y' 'N' 'N' 'N' 'N' 'N' .

FORM get_fieldcat USING p_fieldname

p_txtname

p_length

p_justfy

p_keyfld

p_color

p_hotspt

p_total

p_sort

p_subtot

p_para1

p_zero .

endform .

i.e p_hotspt ='Y'

for that field

after clicking on that line it will select that line and read that line and will place value in

fieldnm = us_selfield-fieldname.

v_para = us_selfield-value .

At user-command

FORM user_command USING u_ucomm TYPE sy-ucomm us_selfield TYPE slis_selfield.

DATA : fieldnm(15) TYPE c .

DATA : v_para(15) TYPE c.

fieldnm = us_selfield-fieldname.

READ TABLE it_zmseg2 INDEX us_selfield-tabindex.

IF sy-subrc EQ 0.

IF us_selfield-fieldname = 'BISMT'.

v_para = us_selfield-value .

endform .

regards

Deepak .

Former Member
0 Kudos

It works just like your double-click, but most of us probably add importing parameter column. I would suggest that a check on the column name is essential, or you end up doing something the user didn't intend (a click must occur one one specific cell containing the hotspot or you need to ignore the click).

If you're using current ALV technology (NetWeaver SALV), read Rich Heilman's excellent tutorials found on SCN for how to do this.

Former Member
0 Kudos

self solved