從屬值集-級聯設定
2.從屬值集 在form表單程式單元中寫入 建塊名為包名的包 在包頭中寫入 PACKAGE CMS_CMP_ACC IS PROCEDURE ERP_ACCOUNT_CODE(EVENT VARCHAR2); PROCEDURE ERP_SUBACCOUNT_CODE(EVENT VARCHAR2); END CMS_CMP_ACC;
在包體中寫入 PACKAGE BODY CMS_CMP_ACC IS PROCEDURE ERP_ACCOUNT_CODE(EVENT VARCHAR2) IS BEGIN IF (EVENT = ‘WHEN-VALIDATE-ITEM’) THEN – Any validation logic goes here. ERP_SUBACCOUNT_CODE(‘INIT’); :CMS_CMP_ACC.ERP_SUBACCOUNT_CODE_DESC:=null;–注意注意 –此處,有一個LOV帶出的欄位,當父集被改變時,子集自動清空,子集帶出的欄位也要被清空,這種方法不是正常的方法,但是可以實現清除功能。 ELSE fnd_message.debug('Invalid event passed to CMS_CMP_ACC.ERP_ACCOUNT_CODE: ’ || EVENT); END IF; END ERP_ACCOUNT_CODE;
PROCEDURE ERP_SUBACCOUNT_CODE(EVENT VARCHAR2) IS BEGIN IF ((EVENT = 'PRE-RECORD') OR (EVENT = 'INIT')) THEN APP_FIELD.SET_DEPENDENT_FIELD(EVENT, 'CMS_CMP_ACC.ERP_ACCOUNT_CODE', 'CMS_CMP_ACC.ERP_SUBACCOUNT_CODE'); ELSE fnd_message.debug('Invalid event passed to CMS_CMP_ACC.ERP_SUBACCOUNT_CODE: '|| EVENT); END IF; END ERP_SUBACCOUNT_CODE;
END CMS_CMP_ACC;
–Trigger: WHEN–VALIDATE–ITEM on ERP_ACCOUNT_CODE: 這個觸發器寫在父集ERP_ACCOUNT_CODE這個item的觸發器中,程式碼如下 CMS_CMP_ACC.ERP_ACCOUNT_CODE(’WHEN–VALIDATE–ITEM’);
–Trigger: PRE–RECORD on CMS_CMP_ACC (Fire in Enter–Query Mode: No): 這個觸發器寫在塊級觸發器下 CMS_CMP_ACC.ERP_SUBACCOUNT_CODE(’PRE–RECORD’); 此段程式碼中,CMS_CMP_ACC為塊名,也是包名,ERP_ACCOUNT_CODE為父集,ERP_SUBACCOUNT_CODE為子集
3.從屬值集 LOV查詢 當使用了父集子集之後,當父集填入之後,子集才可以填寫,子集帶出的LOV欄位需要在進行LOV查詢或者塊查詢時自動帶出,以下是程式碼例項 BEGIN SELECT FVL.DESCRIPTION INTO :CMS_CMP_ACC.ERP_SUBACCOUNT_CODE_DESC FROM FND_FLEX_VALUES_VL FVL, FND_FLEX_VALUE_SETS FVS WHERE FVL.FLEX_VALUE_SET_ID = FVS.FLEX_VALUE_SET_ID AND FVL.PARENT_FLEX_VALUE_LOW = :CMS_CMP_ACC.ERP_ACCOUNT_CODE–父集 AND FVS.FLEX_VALUE_SET_NAME = ‘GFS_B00_COA_SUBACCOUNT’;–子集欄位 AND FVL.FLEX_VALUE = :CMS_CMP_ACC.ERP_SUBACCOUNT_CODE;–子集LOV帶出欄位
EXCEPTION WHEN NO_DATA_FOUND THEN NULL; END;