2006 Oct 10 11:37 PM
Iam updating some records from internal table to Data base table.
Please suggest me
INSERT DBTable FROM TABLE itab.
UPDATE DBTable FROM itab.
Delete existing records.
DELETE DBTable FROM TABLE itab_old.
Please suggest me
2006 Oct 10 11:41 PM
I have collected some data from db and
chaged some dates and update again in data base table
at the same time i need to delete the modified ones
2006 Oct 10 11:42 PM
Hi,
If you are asking for the sequence..
Better to use UPDATE instead of DELETE and INSERT.
Otherwise..
UPDATE DBTABLE FROM TABLE ITAB..The only thing is you have to have all the table fields in the internal table ITAB..
If you are updating couple of fields..use the following.
UPDATE DBTABLE SET FIELD1 = 'SAP'
WHERE FIELD2 = 'X'.
Same for delete also..The internal table ITAB should have all the key fields of the internal table itab..
Hope this is what you want..
THanks,
Naren
2006 Oct 10 11:43 PM
Hi,
You want to update the record and then delete the record??Is this what you want..
Thanks,
Naren
2006 Oct 10 11:52 PM
2006 Oct 11 12:07 AM
Why do you want to update and then delete that record..You might delete the record directly...
Thanks,
Naren
2006 Oct 11 12:13 AM
Fist collect data and do some modification and then update
and then delete the old files
2006 Oct 11 12:17 AM
2006 Oct 11 12:17 AM
Hi,
For the first part..Use UPDATE statement to update the records..
For the second part..Do you want to delete a file or record from a database table??
Is there is any indicator that you have in your database table to indicate that it is a old record..
I am sorry..I am not able to understand your requirement..Please explain in detail..
Thanks,
Naren
2006 Oct 11 12:24 AM
Iam colecting some records to internal table from Data base table
based on year and month.
Then changing the date and months in interenla table
then inserrting this modified records of internal table into datta base table.
Finaly delete the old records with old dates.
Please suggest me
2006 Oct 11 12:29 AM
Got you..
Iam colecting some records to internal table from Data base table
based on year and month.
Then changing the date and months in interenla table
then inserrting this modified records of internal table into datta base table.
Finaly delete the old records with old dates.
Here is the suggestion..This is a logic and not the exact code..
DATA: ITAB TYPE STANDARD TABLE OF ZTABLE WITH HEADER LINE.
DATA: ITAB_OLD TYPE STANDARD TABLE OF ZTABLE WITH HEADER LINE.
SELECT * FROM ZTABLE
INTO TABLE ITAB.
ITAB_OLD = ITAB.
ITAB-NEW_DATE = SY-DATUM.
MODIFY ITAB TRANPORTING NEW_DATE WHERE KEY_FIELD = 'DS'.
Deletion part.
DELETE ZTABLE FROM TABLE ITAB_OLD.
Insertion part
INSERT ZTABLE FROM TABLE ITAB.
Thanks,
Naren
2006 Oct 11 12:31 AM
Please ignore multiple posts.
Message was edited by: Narendran Muthukumaran
2006 Oct 11 12:35 AM
Please ignore multiple posts.
Message was edited by: Narendran Muthukumaran
2006 Oct 11 12:35 AM
Got you..
Here is the suggestion..This is a logic and not the exact code..
DATA: ITAB TYPE STANDARD TABLE OF ZTABLE WITH HEADER LINE.
DATA: ITAB_OLD TYPE STANDARD TABLE OF ZTABLE WITH HEADER LINE.
SELECT * FROM ZTABLE
INTO TABLE ITAB.
ITAB_OLD = ITAB.
ITAB-NEW_DATE = SY-DATUM.
MODIFY ITAB TRANPORTING NEW_DATE WHERE KEY_FIELD = 'DS'.
Deletion part.
DELETE ZTABLE FROM TABLE ITAB_OLD.
Insertion part
INSERT ZTABLE FROM TABLE ITAB.
Thanks,
Naren
2006 Oct 11 12:33 PM
Naren thanks for your concern/helping nature. Thank you again.
Just neeed to know the difference between INSERT, UPDATE & MODIFY Commands. Thanks a tonne.
2006 Oct 11 3:39 PM
Hi,
INSERT is to insert records to the database table..If the record is already there then sy-subrc will be set to 4..
UPDATE is to update existing records to the database table..If the record is not there then sy-subrc will be set to 4..
MODIFY can be used for inserting/updating..If the record is there in the database table it will update the record..If the record is not there then it will insert the record..
Thanks,
Naren