Hi Sri
Can you try this piece of code:
**************************************************************************************************************************************************
data : ls_tab type _ty_s_SC_1,
ls_srs type _ty_s_SC_1,
lt_tab TYPE STANDARD TABLE OF _ty_s_SC_1.
refresh lt_tab .
sort SOURCE_PACKAGE by COMP_CODE ASSET_MAIN ASSET TRANSTYP.
lt_tab = SOURCE_PACKAGE[] .
LOOP AT lt_tab into ls_tab WHERE TRANSTYPE BETWEEN '001' AND '999' .
DELETE SOURCE_PACKAGE
WHERE
COMP_CODE = ls_tab-COMP_CODE AND
ASSET_MAIN = ls_tab-ASSET_MAIN AND
ASSET = ls_tab_ASSET AND
FISCYEAR = ls_tab-FISCYEAR AND
( TRANSTYPE = 'PLN' OR TRANSTYPE = '***').
clear ls_tab.
ENDLOOP .
DELETE SOURCE_PACKAGE WHERE TRANSTYPE = 'PLN' .
******************************************************************************************************************************************************************
In the first loop pass you would be deleting all records for which numerical transtype exists keeping only numerical ones.
Second delete statement would delete PLN , essentially keeping only Numeric values and ***.
One doubt here, if PLN is never required, can you not restrict it in DTP filter itself ?
In that case your code should be.
*****************************************************************************************************************************
LOOP AT lt_tab into ls_tab WHERE TRANSTYPE BETWEEN '001' AND '999' .
DELETE SOURCE_PACKAGE
WHERE
COMP_CODE = ls_tab-COMP_CODE AND
ASSET_MAIN = ls_tab-ASSET_MAIN AND
ASSET = ls_tab_ASSET AND
FISCYEAR = ls_tab-FISCYEAR AND
TRANSTYPE = '***' .
clear ls_tab.
ENDLOOP .
**************************************************************************************************************************************