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

Typical ALV Problem - 2

Former Member
0 Likes
1,034

I have displayed the ALV basic list using controls. I have handled the events and added the pushbutton.

Now if i place the cursor on the PO and click the button that i placed, i have to perform another action with that PO.

How can i get the PO on which i placed the cursor ?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,004

if u want to click on button and process that po u need to select the row

and use get_selected_rows method then u will get selected row, read the index of output table with that row and get the PO.

8 REPLIES 8
Read only

Former Member
0 Likes
1,004

It's far more easier to define the PO number as hotspot. Clicking on the PO number will raise the appropriate event where you can check your number and do any action needed.

Regards,

John.

Read only

Former Member
0 Likes
1,005

if u want to click on button and process that po u need to select the row

and use get_selected_rows method then u will get selected row, read the index of output table with that row and get the PO.

Read only

Former Member
0 Likes
1,004

Hi,

Use this method:

*Get the index of rows selected by User

CALL METHOD gr_alvgrid->get_selected_rows

IMPORTING

  • et_index_rows =

et_row_no = lt_row.

From lt_row you will get index of rows selected by user.

Using that u can read the records from the internal table which u r passing to ALV.

LOOP AT lt_row INTO wa_row.

READ TABLE lt_disapp_doc_copy INDEX wa_row-row_id INTO wa_disapp_doc .

APPEND wa_disapp_doc TO lt_disapp_doc_bdc.

CLEAR : wa_disapp_doc,

wa_row.

ENDLOOP.

Reward if helpful.

Read only

0 Likes
1,004

In which class we have get_selected_rows ?

Read only

0 Likes
1,004

HI,

cl_gui_alv_grid Class having method get_selected_rows

Read only

0 Likes
1,004

HI manjunath ,

Sorry I thought you are using SLIS.

In class based ALV

You can use

cl_gui_alv_grid

here you define event for double clicking

as DOUNLE_CLICK

use e_row to get the value

for detail

refer to standard program 'BCALV_GRID_02'.

regards,

Ani

Read only

Former Member
0 Likes
1,004

Hi manjunath,

For trigerring the event you can use whatever you want.

i.e. if you want to trigger double clicking

use function code '&IC1'.

FOR TAKING VALUE OF THE PO NUMBER,

USE

SET PARAMETER ID .

like

CASE SY-UCOMM.

SET PARAMETER ID 'BES'.

WHEN '&IC1'.

CALL TRANSACTION 'ME21N'.

ENDCASE.

use this on user-command.

Regards,

Aniruddh

Edited by: aniruddha surve on Jun 13, 2008 12:22 PM

Read only

Former Member
0 Likes
1,004

Hi Manjunath CN

Use get cursor field and take the value. There by process your required code.

Venkat.