‎2007 Oct 29 10:28 AM
hi experts!!
i am working on ALv using OO.I have to insert the datas in the grid for which i have a Insert Button.
when i insert the row i am geetting the values in the ITAB from which i am modifying my DB table. but when i insert anew row its getting modifed in the existing top row insted of ineserting a new row.
plz guide me wats wrong with teh same.
plzzz replye me.
‎2007 Oct 29 10:34 AM
Hi,
First ask the user to select the row and click on insert button.
Ask option whether he wants to insert before or after current row.
Then you can find the index of the current selected row. based up on the option he selects, insert the row into the GRID.
l_index = sy-index +1 (or -1).
INSERT
INTO it_tab INDEX l_index
Reward points if useful.
Regards,
Niyaz
‎2007 Oct 29 10:34 AM
Hi,
First ask the user to select the row and click on insert button.
Ask option whether he wants to insert before or after current row.
Then you can find the index of the current selected row. based up on the option he selects, insert the row into the GRID.
l_index = sy-index +1 (or -1).
INSERT
INTO it_tab INDEX l_index
Reward points if useful.
Regards,
Niyaz
‎2007 Oct 29 10:38 AM
hii thankx..
i have used Get_selected_row and after inserting a row and preseing 'save button also its not updating the DB table as new row but updating in same row..
but in ITAb i used index like:
l_index = l_row-index.
read table pt_102[] into lt_102 index l_index .
modify y4arc_res_period from lt_102 .
please help me..
‎2007 Oct 29 10:35 AM
how u r inserting into ITAB.
Try Appending to ITAB and then SORT...
It will work.
‎2007 Oct 29 10:38 AM
hii thankx..
i have used Get_selected_row and after inserting a row and preseing 'save button also its not updating the DB table as new row but updating in same row..
but in ITAb i used index like:
l_index = l_row-index.
read table pt_102[] into lt_102 index l_index .
modify y4arc_res_period from lt_102 .
please help me..
‎2007 Oct 29 10:43 AM
Hi,
Use the following.
data: itab1 like itab(ur internal table used in prog) occurs 0 with header line.
data: l_index like sy-index.
read current line.
l_index = line + 1.
OR
l_index = line - 1.
INSERT
INTO itab1 INDEX l_index.
Reward points if helpful
Srimanta