‎2006 Mar 09 9:29 PM
hello all experts,
One simple question.
I have an internal table and one ODS/InfoCube datapackage.
which statement should I use to let datapackage only keep the records in that internal table, delete all others?
Appreciate it!
Linda
‎2006 Mar 09 9:36 PM
In ABAP there is not single statement to do that. You can do that if you were deleting all records that are in the internal table, but not the other way around.
You will have to get all the records of the database that you want to delete into an internal table, then you can do the statement...
DELETE ZTABLE FROM TABLE itab.This statement deletes all of the records from the database table ZTABLE where the record matches in the ITAB internal table.
Regards,
Rich Heilman
‎2006 Mar 09 9:34 PM
Pls find attached code of fm to delete data from ODS in BW.
CALL FUNCTION 'RSDRI_ODSO_DELETE_RFC'
EXPORTING
I_ODSOBJECT = 'ZTXHDCNT'
TABLES
I_T_RANGE = i_range
EXCEPTIONS
DATA_TARGET_NOT_ODS = 1
ODS_TYPE_NOT_TRANSACTIONAL = 2
CONFLICTING_DELETION_CRITERIA = 3
DELETE_FAILED = 4
INTERNAL_ERROR = 5
OTHERS = 6.
if sy-subrc eq 0.
write: / 'success'.
endif.
You can populate range of desired data to be deleted and it will delete data from ODS which satisfies the criteria.
In you case you need to compare data with internal table. So i suggest you following solution -
Loop at datapackage.
read Internal table and check if record exist.
if does not exist, delete record from datapackage.
endloop.
‎2006 Mar 09 9:36 PM
In ABAP there is not single statement to do that. You can do that if you were deleting all records that are in the internal table, but not the other way around.
You will have to get all the records of the database that you want to delete into an internal table, then you can do the statement...
DELETE ZTABLE FROM TABLE itab.This statement deletes all of the records from the database table ZTABLE where the record matches in the ITAB internal table.
Regards,
Rich Heilman
‎2006 Mar 09 9:40 PM
Hi Linda,
Loop at datapackage.
read Internal table and check if record exist.
if does not exist, delete record from datapackage.
endloop.
LOOP AT <DATAPAC NAME>.
READ TABLE ITAB <WHERE CONDITION>.
IF SY-SUBRC = 0.
CONTINUE.
ELSE.
DELETE ITAB.
ENDIF.
ENDLOOP.
‎2006 Mar 09 9:52 PM