标签:
PROCEDURE event (event_name VARCHAR2)
IS
--
-- This procedure allows you to execute your code at specific events
-- including:
--
-- ZOOM
-- WHEN-NEW-FORM-INSTANCE
-- WHEN-NEW-BLOCK-INSTANCE
-- WHEN-NEW-RECORD-INSTANCE
-- WHEN-NEW-ITEM-INSTANCE
-- WHEN-VALIDATE-RECORD
--
-- Additionally, product-specific events will be passed via this
-- interface (see the Applications Technical Reference manuals for
-- a list of events that are available).
--
-- By default this routine must perform ‘null;‘.
--
-- Oracle Corporation reserves the right to change the events
-- available through this interface at any time.
--
/* Sample code:
form_name varchar2(30) := name_in(‘system.current_form‘);
block_name varchar2(30) := name_in(‘system.cursor_block‘);
param_to_pass1 varchar2(255);
param_to_pass2 varchar2(255);
begin
-- Zoom event opens a new session of a form and
-- passes parameter values to the new session. The parameters
-- already exist in the form being opened.
if (event_name = ‘ZOOM‘) then
if (form_name = ‘DEMXXEOR‘ and block_name = ‘ORDERS‘) then
param_to_pass1 := name_in(‘ORDERS.order_id‘);
param_to_pass2 := name_in(‘ORDERS.customer_name‘);
fnd_function.execute(FUNCTION_NAME=>‘DEM_DEMXXEOR‘,
OPEN_FLAG=>‘Y‘,
SESSION_FLAG=>‘Y‘,
OTHER_PARAMS=>‘ORDER_ID="‘||param_to_pass1||
‘" CUSTOMER_NAME="‘||param_to_pass2||‘"‘);
-- all the extra single and double quotes account for
-- any spaces that might be in the passed values
end if;
-- This is an example of a product-specific event. Note that as
-- of Prod 15, this event doesn‘t exist.
elsif (event_name = ‘OE_LINES_PRICING‘) then
get_custom_pricing(‘ORDERS.item_id‘, ‘ORDERS.price‘);
-- This is an example of enforcing a company-specific business
-- rule, in this case, that all vendor names must be uppercase.
elsif (event_name = ‘WHEN-VALIDATE-RECORD‘) then
if (form_name = ‘APXVENDR‘) then
if (block_name = ‘VENDOR‘) then
copy(upper(name_in(‘VENDOR.NAME‘)), ‘VENDOR.NAME‘);
end if;
end if;
else
null;
end if;
end event;
*/
--
-- Real code starts here
--
BEGIN
IF event_name = ‘WHEN-NEW-ITEM-INSTANCE‘
AND NAME_IN (‘system.cursor_item‘) = ‘LINES.ITEM_NUMBER‘
THEN
FND_KEY_FLEX.UPDATE_DEFINITION (
BLOCK => ‘LINES‘,
FIELD => ‘ITEM_NUMBER‘,
WHERE_CLAUSE => ‘1 = 1
AND MTL_SYSTEM_ITEMS_VL.ENABLED_FLAG = ‘‘Y‘‘
AND TO_DATE ( SYSDATE, ‘‘YYYY/MM/DD HH24:MI:SS‘‘) BETWEEN NVL (
TRUNC (
MTL_SYSTEM_ITEMS_VL.START_DATE_ACTIVE),
TO_DATE (
SYSDATE,
‘‘YYYY/MM/DD HH24:MI:SS‘‘))
AND NVL (
TRUNC (
MTL_SYSTEM_ITEMS_VL.END_DATE_ACTIVE),
TO_DATE (
SYSDATE,
‘‘YYYY/MM/DD HH24:MI:SS‘‘))
AND MTL_SYSTEM_ITEMS_VL.SEGMENT1 LIKE :LINES.ITEM_NUMBER || ‘‘%‘‘
AND MTL_SYSTEM_ITEMS_VL.ORGANIZATION_ID = (SELECT OD.ORGANIZATION_ID FROM ORG_ORGANIZATION_DEFINITIONS OD WHERE OD.ORGANIZATION_CODE <> ‘‘MST‘‘ AND OD.OPERATING_UNIT = :PO_REQ_HDR.ORG_ID)
AND ( ( PURCHASING_ENABLED_FLAG = ‘‘Y‘‘
OR NVL (INTERNAL_ORDER_ENABLED_FLAG, ‘‘N‘‘) = ‘‘Y‘‘)
AND NVL (BOM_ITEM_TYPE, 0) NOT IN (1, 2)
AND NVL (OUTSIDE_OPERATION_FLAG, ‘‘N‘‘) = ‘‘N‘‘)
AND MTL_SYSTEM_ITEMS_VL.MRP_PLANNING_CODE = 7 ‘);
END IF;
END event;
标签:
原文地址:http://www.cnblogs.com/quanweiru/p/5291498.html