الثلاثاء، 28 أبريل 2020

Using rollback depreciation api before override depreciation

The Rollback Depreciation API FA_DEPRN_ROLLBACK_PUB.DO_ROLLBACK was introduced with Release 12.

In prior releases, FADRB - Rollback Depreciation program was available in order to rollback the depreciation calculation after it was run for a book without closing the period.
In Release 12, this program is no longer available because a new feature was introduced - automatic depreciation rollback.

With this new feature, after running depreciation for a book without closing the period, if additional transactions are needed on particular assets (adjustment, retirement etc.), the user can update those assets with whatever transaction is needed. For those particular assets, the depreciation data is automatically rolled back and the transactions can be performed on them. After this, the user can run depreciation again to depreciate these particular assets.

*Note that the rollback is also completed for asset description changes per Note 1463816.1.

Instead of entering additional transactions, in case it is not needed, you can manually rollback depreciation for an asset by running the Rollback Depreciation API which restores the asset to its state prior to running depreciation. This may be useful for the purpose of testing some setup behavior.

You can find details about this API in Oracle Assets Users' Guide Release 12.

A sample script is provided below.

The ASSET_HDR_REC_TYPE asset structure contains unique identification information for a given asset, such as the asset ID and book type code. Both variables are required when running the API.

Steps

1) Run depreciation without closing the period

2) Run the Rollback Depreciation API procedure FA_DEPRN_ROLLBACK_PUB.DO_ROLLBACK for an asset/book

Code (SQL):
SET serveroutput ON
    DECLARE
    l_asset_hdr_rec fa_api_types.asset_hdr_rec_type;
    l_return_status VARCHAR2(1);
    l_mesg_count NUMBER;
    l_mesg varchar2(4000);
    BEGIN
    dbms_output.enable(1000000);
    FA_SRVR_MSG.Init_Server_Message;
    -- asset header info
    l_asset_hdr_rec.asset_id := &asset_id;
    l_asset_hdr_rec.book_type_code := '&book';
    --call the api
    FA_DEPRN_ROLLBACK_PUB.do_rollback
    (p_api_version => 1.0,
    p_init_msg_list => FND_API.G_FALSE,
    p_commit => FND_API.G_FALSE,
    p_validation_level => FND_API.G_VALID_LEVEL_FULL,
    p_calling_fn => NULL,
    x_return_status => l_return_status,
    x_msg_count => l_mesg_count,
    x_msg_data => l_mesg,
    px_asset_hdr_rec => l_asset_hdr_rec);
    --dump messages
    l_mesg_count := fnd_msg_pub.count_msg;
    IF l_mesg_count > 0 THEN
    l_mesg := chr(10) || substr(fnd_msg_pub.GET
    (fnd_msg_pub.G_FIRST,
    fnd_api.G_FALSE),
    1, 250);
    dbms_output.put_line(l_mesg);
    FOR i IN 1..(l_mesg_count - 1) loop
    l_mesg :=
    substr(fnd_msg_pub.GET
    (fnd_msg_pub.G_NEXT,
    fnd_api.G_FALSE), 1, 250);
    dbms_output.put_line(l_mesg);
    END loop;
    fnd_msg_pub.delete_msg();
    END IF;
    IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
    dbms_output.put_line('FAILURE');
    ELSE
    dbms_output.put_line('SUCCESS');
    END IF;
    END;
    /
3) If the script returns SUCCESS, issue a commit.


Code (SQL):
COMMIT;

ليست هناك تعليقات:

إرسال تعليق

ADF: Programmatic View Object Using Ref Cursor.

ADF: Programmatic View Object Using Ref Cursor. Posted by:  Manish Pandey   April 25, 2013   in  ADF   Leave a comment   3758 Views Sometime...