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: 

How can i read data from an alv grid?

Former Member
0 Kudos
2,158

Hi.

I have a program that display info in alv grid, using the function REUSE_ALV_GRID_DISPLAY.

I need to allow the user to edit a entire column, and i found that this could be done using:

slis_fieldcat_alv-edit = 'X'.

And it works pretty good, but after the user change the values in the grid, i would like to obtain a internal table with the new data from the alv grid.

How could i do this?

Thank you.

Regards,

Albio.-

Message was edited by: Albio Vivas

1 ACCEPTED SOLUTION

Former Member
0 Kudos
177

Hi

First you need to read the data into itab...by using event..Data changed of LAV grid...

there u can ge the data changed in ALV...capture that data and populate back to u r itab....

then call method...refresh_table_display

hope this helps

Thanks

Balu

8 REPLIES 8

Former Member
0 Kudos
177

hi

Try this.. CALL METHOD cl_gui_cfw=>dispatch.

Thanks

Balu

Former Member
0 Kudos
178

Hi

First you need to read the data into itab...by using event..Data changed of LAV grid...

there u can ge the data changed in ALV...capture that data and populate back to u r itab....

then call method...refresh_table_display

hope this helps

Thanks

Balu

Former Member
0 Kudos
177

If you are not using the OO ALV, pass a routine name to the USER_COMMAND parameter of your call. In that routine, system will return you the updated internal table.

Srinivas

0 Kudos
177

Thanks friends,

Excuse me, Srinivas Adavi could you tell me a litle more about your anwser?.

I'm new with the alv grid, how could i know if i'm using the oo alv or not?

Thanks,

Albio

Former Member
0 Kudos
177

Hi, my friend.

If you want to get the inputted data from ALV, no need to use OO ALV, FM also can achieve the target. try the follow way:

DATA:

LC_GLAY TYPE LVC_S_GLAY.

  • this is the critical point

LC_GLAY-EDT_CLL_CB = 'X'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_GRID_SETTINGS = LC_GLAY

IT_FIELDCAT = L_ALV_FILEDCAT

TABLES

T_OUTTAB = ITAB.

Please aware that you should move the cursor leave the cell, after finish the input.

Otherwise, the inputted date won't be update into internal table.

Actually, I have replied this question for serveral times.

Hope it will be helpful.

Thanks

Former Member
0 Kudos
177

If OOps u can do

In PBO,

call method o_alvgrid->register_edit_event

exporting

i_event_id = cl_gui_alv_grid=>mc_evt_modified.

In PAI,

If u r going to save the values modified if some function code is activated the do as,

CASE sy-ucomm.

WHEN 'SAVE'.

Loop at i_output into w_output.

modify i_output from w_output.

endloop.

if some values are changed then it will have all the new values.

Former Member
0 Kudos
177

Hi Albio,

I thought the updated contents are always reflected back in the internal table you passed to the ALV. did you not try that ?

reuse_alv_grid_display

...

TABLES

T_OUTTAB = itab.

The contents should be updated in itab.

And this you can read at user command or something.

Because the user will ahve to finally press some button provided by you to indicate that he is doen with the editing.

Reg,

Prashanth.

jayanthi_jayaraman
Active Contributor
0 Kudos
177

Hi,

Check this link.It contains sample code to refresh ALV Grid.

http://www.geocities.com/mpioud/Z_DEMO_ALV_REFRESH_BUTTON.html

If it is useful,kindly reward points by clicking on the star on the left of reply.