12-15-2008 6:16 AM
Hi all,
I want to insert and as well as update a database table with values in an internal table.
The new records should be inserted from the internal table and the existing records should be modified from the internal table.
is there any keyword to do both insertion and updation. or else, please suggest me a logic to do this.
Thanks in advance,
rajan
Use SAP Documentation or Press F1
Edited by: Vijay Babu Dudla on Dec 15, 2008 11:24 PM
12-15-2008 6:49 AM
Hi,
use key word MODIFY , this will do your purpose.
if record is not there it INSERTS else it UPDATES the record in the database
Take F1 help for more info
Regards
Ramchander Rao.K
Edited by: ramchander krishnamraju on Dec 15, 2008 7:50 AM
12-15-2008 6:22 AM
<<removed_by_moderator>>
Edited by: Vijay Babu Dudla on Dec 15, 2008 11:24 PM
Edited by: Vijay Babu Dudla on Dec 15, 2008 11:27 PM
12-15-2008 6:24 AM
Hi,
Firsr fill the internal table with the values which u want to insert into database table
Then Use INSERT,UPDATE ....
For more details how to use INSERT ,UPDATE for database table Press F1 on that ....
12-15-2008 6:33 AM
12-15-2008 6:49 AM
Hi,
use key word MODIFY , this will do your purpose.
if record is not there it INSERTS else it UPDATES the record in the database
Take F1 help for more info
Regards
Ramchander Rao.K
Edited by: ramchander krishnamraju on Dec 15, 2008 7:50 AM
12-16-2008 5:05 AM
Hi,
Use MODIFY statement to update the database table.
This will check the primary key, if it is already present then it updates the database otherwise inserts a new record.
Press F1 help on Modify statement for the syntax and hope this solves your problem.
Regards,
Lavanya.
12-17-2008 3:25 AM
Hi usman,
key words are INSERT and UPDATE chek this example.
CASE SY-UCOMM.
WHEN 'INSERT'.
MOVE LFA1 TO ITAB.
APPEND ITAB.
INSERT INTO LFA1 VALUES ITAB.
IF SY-SUBRC = 0.
MESSAGE I000(0) WITH 'RECORD INSERTED'.
WHEN 'UPDATE'.
MOVE LFA1 TO ITAB.
APPEND ITAB.
UPDATE LFA1 FROM TABLE ITAB.
IF SY-SUBRC = 0.
MESSAGE I000(0) WITH 'RECORD UPDATED'.
ELSE.
MESSAGE E000(0) WITH 'RECORD NOT UPDATED'.
ENDIF.
Edited by: SHAIK JAILABDIN on Dec 17, 2008 4:25 AM
12-17-2008 5:11 AM
MODIFY dbtab FROM TABLE itab.or
MODIFY (dbtabname) FROM TABLE itab.
Effect
Mass modify: Inserts new lines or updates existing lines of a database table. The primary keys for identifying the lines to be inserted or updated and the relevant values are taken from the internal table itab. The lines of the internal table itab must satisfy the same conditions as the work area wa in addition 1 to variant 1.
12-17-2008 5:51 AM
Hi,
use key word MODIFY , this will do your purpose.
if record is not there it INSERTS else it UPDATES the record in the database
Take F1 help for more information.
Regards
Amit.
12-19-2008 9:47 AM
Hi,
INSERT statement only inserts record into database table from internal table. But MODIFY statement to update the database table and also it checks primary key.if the record already present then it updates the database otherwise inserts a new record.
Regards
Md.MahaboobKhan