There are numerous scenarios for each customer to customize the standard Application. The following sample code demonstrate how to pop up an error message when customer business validation fails.
This note provides a detail steps for customizing the standard application using custom library.
The code attached here will validate number of digits entered in Customer PO Number field from the sales order form. If the number of digits exceeds 3 digits an error message needs to be populated.
Sample
Modify the code CUSTOM package body as follows in the appropriate sections
procedure event(event_name varchar2) is
form_name varchar2(30) := name_in(‘system.current_form’);
block_name varchar2(30) := name_in(‘system.cursor_block’);
item_name varchar2(30) := name_in(‘system.cursor_item’);
Begin
if (form_name = ‘OEXOEORD’and block_name = ‘ORDER’) then
if LENGTH(name_in(‘ORDER.CUST_PO_NUMBER’)) > 3 then
fnd_message.set_name(‘FND’,’Cust PO Number should be less than 4 digits’);
fnd_message.Error;
RAISE FORM_TRIGGER_FAILURE;
End if;
End if;
End Event;
Output
If the customer PO Number in sales order form has less than 4 digits the form will not populate any error message. If the customer po number field has more than for 3 digits the error message will be populated.
Retry it from following steps:
1. Open the Application Navigator
2. Navigate to Order Management Responsibility
3. Open the Sales Order Form
4. Enter the values in Custom PO Number field with 4 digits
5. While navigating to next field the following error message pops up
Cust PO Number should be less than 4 digits
+91 7028476376