‎2010 May 04 3:18 PM
Hi All,
I have a ztable and need to create a ALV(Grid) report with the functionality of Editable, Insert a new row to ALV, Delete (on clicking the delete button the specific row has to enable in the database table as flagged for deletion) on executing the report, I will be having 2 button in pf-status(Insert, Delete). All changes has to replicate in the ztable.
Im new to such kind of interactive ALV. Can anyone guide me.
Thanks n advance,
Vichu
‎2010 May 04 3:23 PM
SE38-> BCALV_EDIT*
There are many and easy example to start to manage an editable ALV Grid
‎2010 May 04 3:23 PM
SE38-> BCALV_EDIT*
There are many and easy example to start to manage an editable ALV Grid
‎2010 May 04 3:45 PM
Hi Simone,
Thanks for your very quick response...... I have a small doubt like whether i need to use Classes or Function module for alv??
whether inserting a row dynamically and saving to the database table is possible???
‎2010 May 04 3:52 PM
My suggestion: use classes.
They are more flexible and got less limitation.
For your second question: yes, it's possible, just look at the examples and you can quickly find how.
I'm sorry, but believe me, you got quickly answer looking at examples instead reading me
‎2010 May 04 4:22 PM
Hi Simone,
Once again thanks for your quick response. I will look into those example and let you know if I have any queries.
Thanks,
Vichu
‎2010 May 04 4:34 PM
‎2010 May 05 7:28 AM
Hi Simone,
I have another small doubt in alv. ie., is it possible to have a alv output without creating a screen bcos i have selection option in my report. if so how can i acheive as the examples(bcalv_edit*) have created screen and used module.... end module concept.
Hope you got my question.
‎2010 May 05 8:22 AM
The screen created in BCALV_EDIT reports is an output screen. If you navigate via SE80 the BCALV_EDIT_04 Report you can see there is a screen (1000) automatically generated by select-options (as any other report) and a screen (100) that is for the output of the ALV grid.
You need to create this screen (100) and work with PBO - PAI module for create - destroy - change the alv grid.
‎2010 May 05 1:18 PM
Hi Simone,
I checked those programs the code is fine for editting i couldnt find/understand for saving to the database(Edited values, newly Inserted values)...... as im new to oops concept may be i would have missed i suppose.. can you please guide me in this. How to save the Edited values and newly inserted row values to the database(for inserting the alv itself provided the option in the toolbar i used that).
Hope you understand my situation.
Thanks n advance,
Vichu
‎2010 May 05 1:46 PM
hi,
to handle change data u have to do something like this.
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION .
METHODS: HANDLE_DATA_CHANGED
FOR EVENT DATA_CHANGED OF CL_GUI_ALV_GRID
IMPORTING ER_DATA_CHANGED.
ENDCLASS.
CLASS LCL_EVENT_HANDLER IMPLEMENTATION .
METHOD HANDLE_DATA_CHANGED.
PERFORM HANDLE_DATA_CHANGED USING ER_DATA_CHANGED.
ENDMETHOD. "HANDLE_DATA_CHANGED
ENDCLASS.
______________________-form______________________________
FORM HANDLE_DATA_CHANGED USING ER_DATA_CHANGED
TYPE REF TO CL_ALV_CHANGED_DATA_PROTOCOL.
DATA : LWA_MOD_CELL TYPE LVC_S_MODI.
LOOP AT ER_DATA_CHANGED->MT_GOOD_CELLS INTO LWA_MOD_CELL.
WA_MOD-ROW = LWA_MOD_CELL-ROW_ID.
APPEND WA_MOD TO IT_MOD.
ENDLOOP.
ENDFORM.
i would suggest to insert new row use this code.
clear wa_ouptut.
append wa_ouptut to it_output. " append a blank row.
call method c_alv-> refresh_table_display.
to delete a particular row from grid do it like this .
from the form u will get the row index user selected for deleting into itab it_mod.
LOOP AT IT_MOD INTO WA_MOD.
READ TABLE IT_OUTPUT INTO WA_OUTPUT INDEX WA_MOD-ROW.
if sy-subrc = 0.
DELETE IT_OUTPUT INDEX WA_MOD-ROW.
if sy-subrc = 0.
DELETE ZDATA FROM WA_ouptut.
endif.
endif.
try it out if any issue reply back.
Thanks,
Gaurav
‎2010 May 05 2:32 PM
Hi Gaurav,
Thanks for your reply. Actually i am using single alv so i think Event handling is not necessary. On clicking the save button in pf-status the changed data and newly inserted data has to save in the database table.
And regarding the Insert the user has to insert a row at runtime/output(dynamically) in alv. So just by clicking the toolbar of ALV a new row can be inserted/deleted i just want to save that record to database.
This is how my task is...
‎2010 May 26 1:12 PM
hi,
i have a grid in an interactive report,i want to clear the contents of the grid when i press the back button.please help.
rahul
‎2010 May 12 7:51 AM
Hey,
I followed the following link to edit the row and the same link works for the Inserting a new row to save the data in database table.
http://wiki.sdn.sap.com/wiki/display/Snippets/ALV-Editingandsavingtheeditedvaluesin+Database%28OOPS%29
and the standard program BCALV_EDIT_04
Thanks for your support guys.....