1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

How to Delete Asset in FA

Discussion in 'Oracle Apps Technical' started by Iwanhe, Nov 26, 2013.

  1. Iwanhe

    Iwanhe Active Member

    Messages:
    30
    Likes Received:
    2
    Trophy Points:
    135
    Location:
    Indonesia
    Introduction

    This script is used for delete Asset

    Background

    For troubleshooting

    The code

    Code (SQL):
    REM
    REM  Name : del_asset.SQL
    REM  Release : 10.4 OR later
     
    REM  This script deletes ALL DATA FOR one asset IN ALL the books.
    REM  TO run FROM command line, do:  
    REM   sqlplus fa/ @del_asset
    REM  AND enter the asset NUMBER.
     
    REM  CAUTION :
    REM  1) This IS an IRREVERSIBLE PROCEDURE.
    REM  2) IF the asset has been posted TO General Ledger, manual adjustments IN  
    REM     GL are needed TO maintain DATA integrity.
    REM  3) The audit trail FOR this asset will be PERMANENTLY lost.  The reports
    REM     produced prior TO running this script should NOT be used anymore.
    REM  4) IF the asset was created FROM Account Payables via Mass Additions, the  
    REM     link BETWEEN the asset AND the invoice IN AP will be LOST.
    REM  5) You may do ROLLBACK IF you feel that something was NOT done correctly.  
    REM
     
    PROMPT CAUTION :
    PROMPT 1) This IS an IRREVERSIBLE PROCEDURE.
    PROMPT 2) IF the asset has been posted TO General Ledger, manual adjustments IN
    PROMPT    GL are needed TO maintain DATA integrity.
    PROMPT 3) The audit trail FOR this asset will be PERMANENTLY lost.  The reports
    PROMPT    produced prior TO running this script should NOT be used anymore.
    PROMPT 4) IF the asset was created FROM Account Payables via Mass Additions,
    the
    PROMPT    link BETWEEN the asset AND the invoice IN AP will be LOST.
    PROMPT 5) You may do ROLLBACK IF you feel that something was NOT done
    correctly.
    PROMPT    You may also USE Control-C anytime TO interrupt the script.
     
    SELECT ASSET_ID FROM FA_ADDITIONS_B
    WHERE ASSET_NUMBER = '&ASSET_NUMBER';
     
    DELETE FROM FA_INVOICE_TRANSACTIONS
    WHERE INVOICE_TRANSACTION_ID IN ( SELECT INVOICE_TRANSACTION_ID_IN
                                        FROM FA_ASSET_INVOICES
                                       WHERE ASSET_ID = &&ASSET_ID )
      OR INVOICE_TRANSACTION_ID IN ( SELECT INVOICE_TRANSACTION_ID_OUT
                                       FROM FA_ASSET_INVOICES
                                      WHERE ASSET_ID = &&ASSET_ID );
     
    DELETE FROM FA_TRANSFER_DETAILS
    WHERE DISTRIBUTION_ID IN ( SELECT FDH.DISTRIBUTION_ID
                                 FROM FA_DISTRIBUTION_HISTORY FDH
                                WHERE ASSET_ID = &&ASSET_ID );
     
    DELETE FROM FA_ACE_BOOKS WHERE ASSET_ID = &&ASSET_ID;
     
    DELETE FROM FA_ADDITIONS_B WHERE ASSET_ID = &&ASSET_ID;
     
    DELETE FROM FA_ADJUSTMENTS WHERE ASSET_ID = &&ASSET_ID;
     
    DELETE FROM FA_ASSET_HISTORY WHERE ASSET_ID = &&ASSET_ID;
     
    DELETE FROM FA_ASSET_INVOICES WHERE ASSET_ID = &&ASSET_ID;
     
    DELETE FROM FA_BALANCES_REPORT WHERE ASSET_ID = &&ASSET_ID;
     
    DELETE FROM FA_BOOKS WHERE ASSET_ID = &&ASSET_ID;
     
    DELETE FROM FA_CAPITAL_BUDGET WHERE ASSET_ID = &&ASSET_ID;
     
    DELETE FROM FA_DEFERRED_DEPRN WHERE ASSET_ID = &&ASSET_ID;
     
    DELETE FROM FA_DEPRN_DETAIL WHERE ASSET_ID = &&ASSET_ID;
     
    DELETE FROM FA_DEPRN_SUMMARY WHERE ASSET_ID = &&ASSET_ID;
     
    DELETE FROM FA_DISTRIBUTION_HISTORY WHERE ASSET_ID = &&ASSET_ID;
     
    DELETE FROM FA_MASS_REVALUATION_RULES WHERE ASSET_ID = &&ASSET_ID;
     
    DELETE FROM FA_PERIODIC_PRODUCTION WHERE ASSET_ID = &&ASSET_ID;
     
    DELETE FROM FA_RESERVE_LEDGER WHERE ASSET_ID = &&ASSET_ID;
     
    DELETE FROM FA_RETIREMENTS WHERE ASSET_ID = &&ASSET_ID;
     
    DELETE FROM FA_TRANSACTION_HEADERS WHERE ASSET_ID = &&ASSET_ID;

    DELETE FROM FA_BOOKS_SUMMARY WHERE ASSET_ID = &&ASSET_ID;

    -- mc

    DELETE FROM FA_MC_ADJUSTMENTS WHERE ASSET_ID = &&ASSET_ID;
     
    DELETE FROM FA_MC_ASSET_INVOICES WHERE ASSET_ID = &&ASSET_ID;
     
    DELETE FROM FA_MC_BOOKS WHERE ASSET_ID = &&ASSET_ID;
     
    DELETE FROM FA_MC_DEPRN_DETAIL WHERE ASSET_ID = &&ASSET_ID;
     
    DELETE FROM FA_MC_DEPRN_SUMMARY WHERE ASSET_ID = &&ASSET_ID;
       
    DELETE FROM FA_MC_BOOKS_SUMMARY WHERE ASSET_ID = &&ASSET_ID;
     
    DELETE FROM FA_MC_RETIREMENTS WHERE ASSET_ID = &&ASSET_ID;

     

    undef asset_id

    References

    http://sites.google.com/site/jazzurhytm/documentation/fixed-asset/howtodeleteassetinoraclefa