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

ALV GRID

Former Member
0 Likes
756

Is there a Method in CL_gui_alv_grid to read the rows that are modified or all the rows in an alv grid?

As i can update the changes in database table.

Thanks in Advance.

Azee

Is there a Method in CL_gui_alv_grid to read the rows that are modified or all the rows in an alv grid?

As i can update the changes in database table.

Thanks in Advance.

Azee

5 REPLIES 5
Read only

Former Member
0 Likes
721

Azee,

Use method <b>get_selected_rows</b> of Class cl_gui_alv_grid.

This method exports a Table to us that contains the row id of the selected row.

Sample Code:

data: iRowIndex type LVC_T_ROID,

waRowIndex like line of iRowIndex.

In PAI:

call method

grid->get_selected_rows(

importing

  • et_index_rows =

et_row_no = iRowIndex ).

  • Check the no of rows selected.

describe table iRowIndex lines sy-tfill.

  • Read the Row Number

read table iRowIndex into waRowIndex index 1.

  • get the corresponding record

read table iQdql into waQdql index

waRowIndex-row_id.

  • Modify the database

modify qdql from waQdql.

commit work.

Thanks

Kam

Note: Allot points for all the worthful helps!!!

Message was edited by: Kam

Read only

0 Likes
721

Hi Kam,

U r true for get_selected_rows,

but my requirement is i am giving user an editable grid and the user will not select any single row to change instead it ill make changes where ever required ,

So i thought if there is a method that will read modified row would make my work easy.

or is there a method tat will give u all the rows of the grid.

Regards,

Azee

Read only

0 Likes
721

Azee,

Then go with the method CHECK_CHANGED_DATA.

This method will Verify for Changes and Triggers an event DATA_CHANGED automatically.

I think,u could also use GET_CHANGED_DATA method too.

Thank

Kam

Read only

Former Member
0 Likes
721

Use

CALL METHOD W_GRID1->CHECK_CHANGED_DATA

IMPORTING

E_VALID = L_VALID.

Before calling the method store the internal table data to be displayed in the grid in a temporary internal table.

If L_VALID = 'X'.

the records in the internal table will be changed with ur changed data. Then u can compare the temporary internal table with the current internal table and the changed contents u can save in the database

cheers

sharmistha

Read only

Former Member
0 Likes
721

Hi,

there is one method for get_selected_rows.

Thanks & Regards,

Siri.