How to Create Amendment and Version in the Oracle Custom Form EBS R12
Write the Code in the Program
Unit to Create Version when the User Click
on the Amendment Button.
--################### ---- CREATE_AMENDMENT Code is here:
-----################### ----
PROCEDURE CREATE_AMENDMENT
IS
LV_USER_ID NUMBER;
BEGIN
LV_USER_ID :=
FND_PROFILE.VALUE ('USER_ID');
DECLARE
LV_VERSION_NUMBER NUMBER;
LV_FAB_HEADER_ID NUMBER;
BEGIN
------- FAB
Version Created using Sequence
----------
BEGIN
SELECT NVL
(MAX (VERSION_NO), 0) + 1
INTO
LV_VERSION_NUMBER
FROM
XXNAG_FA_BUDGET_HEADER
WHERE
FISCAL_YEAR = :XXNAG_FA_BUDGET_HEADER_V.FISCAL_YEAR
AND
ORG_ID =
:XXNAG_FA_BUDGET_HEADER_V.ORG_ID;
END;
---- FND_MESSAGE.DEBUG ('1111111111111');
------------
XXNAG_FA_BUDGET_HEADER -----------
BEGIN
SELECT
XXNAG_FAB_HEADER_ID_SEQ.NEXTVAL
INTO
LV_FAB_HEADER_ID
FROM DUAL;
INSERT INTO
XXNAG_FA_BUDGET_HEADER
VALUES
( LV_FAB_HEADER_ID,
:XXNAG_FA_BUDGET_HEADER_V.LEGAL_ENITY_ID,
:XXNAG_FA_BUDGET_HEADER_V.FISCAL_YEAR,
:XXNAG_FA_BUDGET_HEADER_V.CURRENCY_CODE,
:XXNAG_FA_BUDGET_HEADER_V.PLAN_NAME,
:XXNAG_FA_BUDGET_HEADER_V.PLAN_NO,
LV_VERSION_NUMBER,
:PARAMETER.P_ORG_ID,
'N',--:XXNAG_FA_BUDGET_HEADER_V.APPROVED_FLAG,
:XXNAG_FA_BUDGET_HEADER_V.ATTRIBUTE_CATEGORY,
:XXNAG_FA_BUDGET_HEADER_V.ATTRIBUTE1,
:XXNAG_FA_BUDGET_HEADER_V.ATTRIBUTE2,
:XXNAG_FA_BUDGET_HEADER_V.ATTRIBUTE3,
:XXNAG_FA_BUDGET_HEADER_V.ATTRIBUTE4,
:XXNAG_FA_BUDGET_HEADER_V.ATTRIBUTE5,
:XXNAG_FA_BUDGET_HEADER_V.ATTRIBUTE6,
:XXNAG_FA_BUDGET_HEADER_V.ATTRIBUTE7,
:XXNAG_FA_BUDGET_HEADER_V.ATTRIBUTE8,
:XXNAG_FA_BUDGET_HEADER_V.ATTRIBUTE9,
:XXNAG_FA_BUDGET_HEADER_V.ATTRIBUTE10,
SYSDATE,
SYSDATE,
:PARAMETER.P_USER_ID,
:PARAMETER.P_USER_ID,
:PARAMETER.P_USER_ID
);
----
FND_MESSAGE.DEBUG ('333333333333333333');
END; ------------
XXNAG_FA_BUDGET_HEADER --------
BEGIN ----------------Start
XXNAG_FA_BUDGET_LINES -------
GO_BLOCK
('XXNAG_FA_BUDGET_LINES_V');
FIRST_RECORD;
LOOP
--------
FND_MESSAGE.DEBUG ('444444444444444');
INSERT INTO
XXNAG_FA_BUDGET_LINES
VALUES
( XXNAG_FAB_LINE_ID_SEQ.NEXTVAL,
XXNAG_FAB_HEADER_ID_SEQ.CURRVAL,
:parameter.p_org_id,
:XXNAG_FA_BUDGET_LINES_V.PROJECT_REF_NO,
:XXNAG_FA_BUDGET_LINES_V.MAJOR_CATEGORY_ID,
:XXNAG_FA_BUDGET_LINES_V.ACCOUNT_CODE_ID,
:XXNAG_FA_BUDGET_LINES_V.ITEM_ID,
:XXNAG_FA_BUDGET_LINES_V.JUL,
:XXNAG_FA_BUDGET_LINES_V.AUG,
:XXNAG_FA_BUDGET_LINES_V.SEP,
:XXNAG_FA_BUDGET_LINES_V.OCT,
:XXNAG_FA_BUDGET_LINES_V.NOV,
:XXNAG_FA_BUDGET_LINES_V.DEC,
:XXNAG_FA_BUDGET_LINES_V.JAN,
:XXNAG_FA_BUDGET_LINES_V.FEB,
:XXNAG_FA_BUDGET_LINES_V.MAR,
:XXNAG_FA_BUDGET_LINES_V.APR,
:XXNAG_FA_BUDGET_LINES_V.MAY,
:XXNAG_FA_BUDGET_LINES_V.JUN,
:XXNAG_FA_BUDGET_LINES_V.FIRST_YR_TOTAL,
:XXNAG_FA_BUDGET_LINES_V.SECOND_YR_TOTAL,
:XXNAG_FA_BUDGET_LINES_V.THIRD_YR_TOTAL,
:XXNAG_FA_BUDGET_LINES_V.ATTRIBUTE_CATEGORY,
:XXNAG_FA_BUDGET_LINES_V.ATTRIBUTE1,
:XXNAG_FA_BUDGET_LINES_V.ATTRIBUTE2,
:XXNAG_FA_BUDGET_LINES_V.ATTRIBUTE3,
:XXNAG_FA_BUDGET_LINES_V.ATTRIBUTE4,
:XXNAG_FA_BUDGET_LINES_V.ATTRIBUTE5,
:XXNAG_FA_BUDGET_LINES_V.ATTRIBUTE6,
:XXNAG_FA_BUDGET_LINES_V.ATTRIBUTE7,
:XXNAG_FA_BUDGET_LINES_V.ATTRIBUTE8,
:XXNAG_FA_BUDGET_LINES_V.ATTRIBUTE9,
:XXNAG_FA_BUDGET_LINES_V.ATTRIBUTE10,
SYSDATE,
SYSDATE,
:parameter.p_user_id,
:parameter.p_user_id,
:parameter.p_user_id,
:XXNAG_FA_BUDGET_LINES_V.ASSET_DESCRIPTION
);
EXIT WHEN
:SYSTEM.LAST_RECORD = 'TRUE';
NEXT_RECORD;
END LOOP;
END; ----------------END
XXNAG_FA_BUDGET_LINES ---
FORMS_DDL
('commit');
CLEAR_FORM
(no_validate);
-------- FND_MESSAGE.DEBUG ('55555555555555');
GO_BLOCK
('XXNAG_FA_BUDGET_HEADER_V');
:GLOBAL.FAB_HEADER_ID := LV_FAB_HEADER_ID;
SET_BLOCK_PROPERTY
('XXNAG_FA_BUDGET_HEADER_V',onetime_where,'FAB_HEADER_ID =
:Global.FAB_HEADER_ID' );
EXECUTE_QUERY;
--------
FND_MESSAGE.DEBUG ('7777777777777777');
END;
END;
--------------------********************* END of Amendment Code **********--------------------
Then Call the Procedure in Amendment Button –
WHEN-BUTTON-PRESSED trigger.
IF :XXNAG_FA_BUDGET_HEADER_V.APPROVED_FLAG = 'Y' THEN
--- Calling Create Version Program Unit Procedure to create
Version in LC ----
fnd_message.set_string('Version has been created..');
fnd_message.show();
CREATE_AMENDMENT;
END IF;
------------------------------------------------------------------------------------
When User Click on the Amendment Button Then the version is increment
with +1 value with new records also.
Eg : Version No is 0 ,
after Amendment It will be Version No. =1
No comments:
Post a Comment