10-04-2005 9:31 PM
how do i record changes to an existing record in a table control..
and how do i record insert or delete rows?
i believe i can do the latter by comapring with the old records but what abt the former...
in chain and endchain do i have to place module for all the field names that could be potentially changed?
but how do i validate and keep those changes..
thanks a lot...
10-04-2005 9:36 PM
If you used the table control wizard, it should have written some code in the flow logic of the screen. Inside the LOOP in the PAI module, there should be a module with the word MODIFY in it. Double click it, now you should be in the code of the MODULE. There should be a line of code already there that is updating the internal table. Here is where you can write the record to another internal table with the same structure, for example.....
ITAB is the main table
ITAB_CHG is the table which will hold the changed records.
For deleting, you can do something simular, have an ITAB_DLT, where you are adding records that are being deleted from the main ITAB. When saving at the end of the transaction you would process these ITABs accordingly. Make sense?
Regards,
Rich Heilman
10-05-2005 4:16 PM
hi,
in the table control you can add two flags at the end of the internal table, one for modified lines and one for deleted lines. Mark the flags in a PAI module when data is changed or data is selected to being deleted.
PROCESS AFTER INPUT.
LOOP AT I_TABLE.
CHAIN.
FIELD: D_XXX,
D_YYY,
D_ZZZ.
MODULE FLAG_TABLE.
ENDCHAIN.
ENDLOOP.
It would be easier to save data if you only select modified and deleted lines to update your table.
Regards.