Sunday, 2 June 2013

Some Examples of Custom.pll in Oracle Apps



Some Examples of Custom.pll in Oracle Apps

--######################################
--Example: Force a Field to Uppercase
--######################################
BEGIN
IF (event_name = 'WHEN-NEW-FORM-INSTANCE')
THEN
IF (form_name = 'APXVENDR')
THEN
app_item_property2.set_property ('VENDOR.NAME',
case_restriction,
uppercase
);
END IF;
END IF;
END;
--
-------------------End of code --------------------
--
--######################################
--Example: Change a Field Prompt
--######################################
/* Formatted on 2014/12/19 22:40 (Formatter Plus v4.8.8) */
BEGIN
IF (event_name = 'WHEN-NEW-FORM-INSTANCE')
THEN
IF (form_name = 'APXVENDR')
THEN
app_item_property2.set_property (vendor.name1,
prompt_text,
'Supplier Name'
);
END IF;
END IF;
END;
--
-------------------End of code --------------------
--
--######################################
--Example: Change a Button Label
--######################################
/* Formatted on 2014/12/19 22:40 (Formatter Plus v4.8.8) */
BEGIN
IF (event_name = 'WHEN-NEW-FORM-INSTANCE')
THEN
IF (form_name = 'APXVENDR')
THEN
app_item_property2.set_property ('vendors.details',
label,
'More Details'
);
END IF;
END IF;
END;
--
-------------------End of code --------------------
--
--######################################
--Example: Change a Field Color
--######################################
/* Formatted on 2014/12/19 22:41 (Formatter Plus v4.8.8) */
BEGIN
IF (event_name = 'WHEN-NEW-FORM-INSTANCE')
THEN
IF (form_name = 'APXVENDR' AND block_name = 'VENDOR')
THEN
app_item_property2.set_property (vendor.note1,
background_color,
'r255g255b0'
); -- bright yellow
END IF;
END IF;
END;
--
-------------------End of code --------------------
--
--######################################
--Example: Hide a Field
--######################################
/* Formatted on 2014/12/19 22:41 (Formatter Plus v4.8.8) */
BEGIN
IF (event_name = 'WHEN-NEW-FORM-INSTANCE')
THEN
IF (form_name = 'APXVENDR')
THEN
app_item_property2.set_property (vendor.note1,
displayed,
property_off
); -- hide Notes field
END IF;
END IF;
END;
--
-------------------End of code --------------------
--
--######################################
--Example: Prevent Inserts or Updates to a Block
--######################################
/* Formatted on 2014/12/19 22:41 (Formatter Plus v4.8.8) */
BEGIN
IF (event_name = 'WHEN-NEW-BLOCK-INSTANCE')
THEN
IF (form_name = 'APXVENDR' AND block_name = 'VENDOR')
THEN
SET_BLOCK_PROPERTY (block_name, insert_allowed, property_false);
SET_BLOCK_PROPERTY (block_name, update_allowed, property_false);
END IF;
END IF;
END;
--
-------------------End of code --------------------
--
--######################################
--Special Menu Example
--Display the Special15 entry on the Tools menu.
--######################################
/* Formatted on 2014/12/19 22:41 (Formatter Plus v4.8.8) */
BEGIN
IF (event_name = 'WHEN-NEW-FORM- INSTANCE')
THEN
IF (form_name = 'DEMXXEOR')
THEN
app_special2.instantiate ('SPECIAL15',
'Print Order- &Again',
'',
TRUE,
'IiINE'
);
END IF;
END IF;
END;
--
-------------------End of code --------------------
--
--######################################
--Special Menu Example
--Toggle display of the Special15 Tools menu entry.
--######################################
begin
if (event_name = 'WHEN-NEW-BLOCK-INSTANCE') then
if (form_name = 'DEMIXXEOR' and block_name = 'ORDERS' ) then
app_special2.enable ( ' SPECIAL15',PROPERTY_ON);
elsif (form_name = 'DEMEXXEOR' and
block_name = 'LINES') then
app_special2.enable ( 'SPECIAL15',
PROPERTY_OFF) ;
end if;
end if;
end;
--
-------------------End of code --------------------
--
--######################################
--Special Menu Example
--Code the logic for the Special15 menu entry.
--######################################
/* Formatted on 2014/12/19 22:43 (Formatter Plus v4.8.8) */
BEGIN
IF (event_name = 'SPECIAL15')
THEN
IF (form_name = 'DEMMXXEOR' AND block_name = 'ORDERS')
THEN
/* Add your Print Order logic here */
RAISE form_trigger_failure;
END IF;
END IF;
END;
--
-------------------End of code --------------------
--
--######################################
--Function Security Example
--Functions must first be defined and on the menu.
--######################################
begin
if (event_name = 'WHEN_NEW_FORM_INSTANCE') then
if (form_name = 'DEMXXEOR') tlien
if (FND_FUNCTION.TEST(
' DEM__DEMXXEOR_AUTHORIZ ED ' ) ) then
/* Add your logic here */
end if;
end if;
end if;
end ;
--
-------------------End of code --------------------
--
--######################################
--For example, a user with the username OPERATIONS would not be affected by
--changes to the student libraries.
--Here is how the event procedure in the modified CUSTOM library calls out to
--the CUSTOMxx sublibraries:
--######################################
procedure event(event_name varchar2) is
begin
if FND_PROFILE.VALUE('USERNAME,)=,CUST01' then
custom01.event(event_name);
elsif FND_PROFILE.VALUE('USERNAME')='CUST25' then
custom25.event(event name);
end if;
end event;
--
-------------------End of code --------------------
--
--######################################
--Coding CUSTOM.ZOOM_AVAILABLE
--Coding CUSTOM.ZOOM_AVAILABLE
--If Zoom is available for this block, return TRUE;
--otherwise, return FALSE.
--######################################
/* Formatted on 2014/12/19 22:44 (Formatter Plus v4.8.8) */
FUNCTION zoom_available
RETURN BOOLEAN
IS
form_name VARCHAR2 (30) := NAME_IN (system.current_form’);
block_name VARCHAR2 (30) := NAME_IN (system.cursor_block’);
BEGIN
IF (form_name = ‘fndscaus’ AND block_name =user)
THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
END zoom_available;
--
-------------------End of code --------------------
--
--######################################
--CUSTOM.EVENT for Zoom
--######################################
BEGIN
IF (event_name = 'zoom')
THEN
IF (form_name = 'fndscaus' AND block_name = 'user')
THEN
param_to_pass := NAME_IN ('user.description');
fnd_function.EXECUTE (function_name => 'dem_demxxeor',
open_flag => 'y',
session_flag => 'y',
other_params => 'description ="'||
param_to_pass|| '"');
END IF;
ELSE
NULL;
END IF;
END;



No comments:

Post a Comment