How to Save Values from table control to database table

Question:
Hi to All Experts ,
How to Save the Values From Table Control .
If User Enters Any Value Any Value in Table cONTROL .
hOW CAN I SAVE IT IN DATABASE .
HOW TO PASS VALUE FROM TABLE CONTROL TO INTERNAL TABLE .
AND FROM INTERNAL TABLE to database table .
i only know that this code should be written in PAI.
THANKS IN ADVANCE
MAHESH
Answer:
Hi maheshgarud,
Example...
ZSTRUCTURE (structure SE11)
ITAB (your internal table LIKE zstructure)
TC1 (name of table control)
PBO
****
LOOP AT itab WITH CONTROL tc1 CURSOR tc1-current_line.
MODULE status_tc1.
ENDLOOP.
PAI
****
LOOP AT itab.
MODULE move_tc1.
ENDLOOP.
*&---------------------------------------------------------------------*
*& Module status_tc1 OUTPUT
*&---------------------------------------------------------------------*
MODULE status_tc1 OUTPUT.
MOVE-CORRESPONDING itab TO zstructure.
ENDMODULE. " status_tc1 OUTPUT
*&---------------------------------------------------------------------*
*& Module move_tc1 INPUT
*&---------------------------------------------------------------------*
MODULE move_tc1 INPUT.
MOVE-CORRESPONDING zstructure TO itab.
MODIFY itab INDEX tc1-current_line.
ENDMODULE. " move_tc1 INPUT
To update the database, delete old entries and insert the new ones looping your internal table.
Good luck!

More Articles:

GRIDs?
Mail Attachment with record width 450 Char?
How to display Report documentation by pressing F1 on list ?
Function module to return table structure?
Stop Backgroup process?
Writing data to SQL Server from SAP using OLE?