‎2008 Jan 29 12:47 PM
Hi. I've got a TABLEVIEW in one of my subscreens. But when load itab into that tableview with 'LOOP AT...' tableview appears but I can't add rows to it. I can't delete existing rows too. What should I add to my programm to have possibility of adding/removing rows from my tablewiev? Greetings. P.
‎2008 Jan 29 12:56 PM
Hi Friend,
To add/delete rows in your table view.
You have to add/delete rows from internal table fro where you are displaying values.
You have to write code in PAI..
In LOOP ... ENDLOOP check the OK_CODE if it is ADD (for eg.) you have to add a blank row to internal table by just passing a blank work area.
And if it is DELETE (for eg.) delete the row of that index (TABLEVIEW-CURRENT_LINE)...
for these two excersies you have to readjust lines of tableview...after taking number of lines from internal table (DESCRIBE TABLE INT_EX LINES WS_LINES
TABLEVIEW-LINES = WS_LINES) write this piece of code in Intialization.
Hope it will solve the problem.
Regards
Krishnendu
‎2008 Jan 29 12:52 PM
Just add a few empty lines to your internal table and set the number of lines for the table control accordingly.
e.g.
itab has 5 lines with data
append 3 empty lines to itab
Set TABLECONTROL-LINES to 8 where TABLECONTROL is the name of your table control.
Hope that helps,
Michael
‎2008 Jan 29 12:56 PM
Hi Friend,
To add/delete rows in your table view.
You have to add/delete rows from internal table fro where you are displaying values.
You have to write code in PAI..
In LOOP ... ENDLOOP check the OK_CODE if it is ADD (for eg.) you have to add a blank row to internal table by just passing a blank work area.
And if it is DELETE (for eg.) delete the row of that index (TABLEVIEW-CURRENT_LINE)...
for these two excersies you have to readjust lines of tableview...after taking number of lines from internal table (DESCRIBE TABLE INT_EX LINES WS_LINES
TABLEVIEW-LINES = WS_LINES) write this piece of code in Intialization.
Hope it will solve the problem.
Regards
Krishnendu
‎2008 Jan 29 12:59 PM
You can place buttons for add and subtract..
when clicking add:
describe table <itab> lines < line>.
<tblctrl>-lines = line + 1.
when clicking subtract:
dealete <itba> index <index of the row>.
describe table <itab> lines < line>.
<tblctrl>-lines = line .
itab : internal table used for populating data.
line : is a variable type i.
tblctrl : is the anme of table control.
regards.