Sunteți pe pagina 1din 8

Hi, I want to default custom rule in Sales Order from whenever I select Item.

After selecting item from the sales order from, it should populate Warehouse value in Shipping tab. I am using custom PL/SQL API option. I wrote one function and kept in package. I was disabled all defaulting rules. Now If I select Item in sales order form, I am not getting warehouse value. The steps are: Step 1. Select Warehouse attribute and define defaulting rule Application: Order Management Entry: Order Line Select Attribute as Warehouse Click on Defaulting Rules Step 2: Define Defaulting Sourcing Rule Select Source type as PL/SQL API. In the Defaulting Source/Value field give Package Name and Function Name. Open Catalog Groups window from the below path: Setup Specify Name and Description for Catalog Group Click on Details button. Step 3: Create Catalog Group Step 4: Specify Descriptive Elements for the Item Catalog Group Step 5: Code preparation -- My Custom Code Create or replace FUNCTION custom_default_rule RETURN VARCHAR2 AS l_line_type_rec oe_order_cache.line_type_rec_type; CURSOR cus_l IS SELECT a.organization_code, b.element_name, b.element_value FROM mtl_parameters a, mtl_descr_element_values b, mtl_system_items_b c WHERE b.inventory_item_id = c.inventory_item_id AND a.organization_id = c.organization_id AND a.organization_id = c.organization_id AND c.inventory_item_id = 12924 GROUP BY a.organization_code, b.element_name, b.element_value ORDER BY a.organization_code, b.element_name, b.element_value; BEGIN l_line_type_rec := oe_order_cache.load_line_type (ont_line_def_hdlr.g_record.line_type_id); FOR cur_rec IN cus_l LOOP IF cur_rec.element_name IN ('Frequency', 'Emission Norms', 'Voltage', 'Duty Rating', 'Phase', 'Product' ) Items Catalog Groups

AND cur_rec.element_value IN ('50', '', '230', 'Medium', 'Single', 'QSK60') THEN RETURN cur_rec.organization_code; ELSIF cur_rec.element_name IN ('Frequency', 'Emission Norms', 'Voltage', 'Duty Rating', 'Phase', 'Product' ) AND cur_rec.element_value IN ('50', '', '230', 'Medium', 'Three', 'QSK15') THEN RETURN cur_rec.organization_code; ELSIF cur_rec.element_name IN ('Frequency', 'Emission Norms', 'Voltage', 'Duty Rating', 'Phase', 'Productfamily' ) AND cur_rec.element_value IN ('50', '', '230', 'Medium', 'Single', 'DQK50') THEN RETURN cur_rec.organization_code; END IF; END LOOP; EXCEPTION WHEN OTHERS THEN IF oe_msg_pub.check_msg_level (oe_msg_pub.g_msg_lvl_unexp_error) THEN oe_msg_pub.add_exc_msg ('OE_Default_PVT', 'CUSTOM_DEFAULT_RULE'); END IF; RAISE fnd_api.g_exc_unexpected_error; END custom_default_rule; Sales Orders) Step 6: Create a Sales Order (Order Returns Select Customer and Order Type and select Line Items Tab. Select Item from the Ordered Item Field. Press Tab. After pressing tab in the Shipping Tab Warehouse value Should be populated. But it is not working. Can anyone guide me in this. It is very urgent. If possible, Please send u r details to my official id: s.sateeshkumar@igate.com Thanks in Advance, sateesh

625425

: 1,817 : 08-03-13 Re: PL/SQL API + Defaulting Rules in OM : 2008.04.09. 3:32 Sateesh Kumar S... Sateesh, Before going further I see that you are returning organization_code (from cursor ). You have to return organization_id. Change the cursor to SELECT a.organization_id, b.element_name, b.element_value FROM mtl_parameters a, mtl_descr_element_values b, mtl_system_items_b c WHERE b.inventory_item_id = c.inventory_item_id AND a.organization_id = c.organization_id AND a.organization_id = c.organization_id AND c.inventory_item_id = 12924 GROUP BY a.organization_code, b.element_name, b.element_value ORDER BY a.organization_code, b.element_name, b.element_value; And RETURN cur_rec.organization_id; Change this and test. If this does not work, let us know. Thanks Nagamohan

Sateesh Kumar S... : 44 : 07-12-16 Re: PL/SQL API + Defaulting Rules in OM : 2008.04.09. 4:40 625425 Thanks Nagamohan, I tried with organization_id, but still I am unable to get the warehouse value. Please help me out Thanks sateesh

AhmadBilal : 18 : 06-09-19 Re: PL/SQL API + Defaulting Rules in OM : 2008.04.09. 23:57 Sateesh Kumar S... Can you please send me screen shots of problematic rule on my email id abmian198 1@gmail.com

625425 : 1,817 : 08-03-13 Re: PL/SQL API + Defaulting Rules in OM : 2008.04.10. 2:55 Sateesh Kumar S... Sateesh, This is working fine for me here: -------------------------------------------------------------------------------CREATE OR REPLACE PACKAGE xx_def_wh AS FUNCTION custom_default_rule (p_database_object_name IN VARCHAR2, p_attribute_co de IN VARCHAR2) RETURN NUMBER; END; / CREATE OR REPLACE PACKAGE BODY xx_def_wh AS FUNCTION custom_default_rule (p_database_object_name IN VARCHAR2, p_attribute_co de IN VARCHAR2) RETURN NUMBER AS l_line_type_rec oe_order_cache.line_type_rec_type; l_item_id NUMBER; CURSOR cus_l(p_item_id in number) IS SELECT a.organization_id, b.element_name, b.element_value FROM mtl_parameters a, mtl_descr_element_values b, mtl_system_items_b c WHERE b.inventory_item_id = c.inventory_item_id AND a.organization_id = c.organization_id AND a.organization_id = c.organization_id AND c.inventory_item_id = p_item_id and a.organization_ida.master_organization_id ORDER BY a.organization_id; BEGIN l_line_type_rec := oe_order_cache.load_line_type (ont_line_def_hdlr.g_record.lin e_type_id); l_item_id:= ONT_LINE_DEF_HDLR.g_record.inventory_item_id; FOR cur_rec IN cus_l(l_item_id) LOOP IF cur_rec.element_name IN ('Frequency', 'Emission Norms', 'Voltage', 'Duty Rati ng', 'Phase', 'Product') AND cur_rec.element_value IN ('50', '', '230', 'Medium', 'Single', 'QSK60') THEN RETURN cur_rec.organization_id; ELSIF cur_rec.element_name IN ('Frequency', 'Emission Norms', 'Voltage', 'Duty R ating', 'Phase', 'Product') AND cur_rec.element_value IN ('50', '', '230', 'Medium', 'Three', 'QSK15') THEN RETURN cur_rec.organization_id; ELSIF cur_rec.element_name IN ('Frequency', 'Emission Norms', 'Voltage', 'Duty R ating', 'Phase', 'Productfamily') AND cur_rec.element_value IN ('50', '', '230', 'Medium', 'Single', 'DQK50')

THEN RETURN cur_rec.organization_id; END IF; END LOOP; EXCEPTION WHEN OTHERS THEN IF oe_msg_pub.check_msg_level (oe_msg_pub.g_msg_lvl_unexp_error) THEN oe_msg_pub.add_exc_msg ('OE_Default_PVT', 'CUSTOM_DEFAULT_RULE'); END IF; RAISE fnd_api.g_exc_unexpected_error; END custom_default_rule; END; -------------------------------------------------------------------------------Thanks Nagamohan

Sateesh Kumar S... : 44 : 07-12-16 Re: PL/SQL API + Defaulting Rules in OM : 2008.04.10. 23:10 625425 Thanks Nagamohan... It is working fine. But If all the conditions fails, then I want to display default value like V1. I wrote like this: ELSIF cur_rec.element_name IN ('Frequency', 'Emission Norms', 'Voltage', 'Duty R ating', 'Phase', 'Product Family') AND cur_rec.element_value IN ('60', '230', '440', 'Low', 'Medium', 'Heavy', 'Sin gle', 'Three', 'DQK10', 'DQK50') THEN RETURN cur_rec.organization_id; ELSE RETURN 'V1'; It is not working. Other than above items like Prod1, Prod2..If i select any item I am not getting any value in warehouse. And One More Error: When I open Sales Order Form Lines Tab, every time I am gett ing following error: ORA_01403: no data found ORA-06503: PL/SQL: Function returned without value in Package OE_ORDER_UTIL Procedure GET_ATTRIBUTE_NAME CLICK OK AFTER CLICKING OK I AM GETTING ERROR LIKE

User-Defined Exception in Package OE_DEF_UTIL Procedure Add_Invalid_Rule_Message . Please help me out. Please send me u r mail id. Thanks a lot Nagamohan, Regards, sateesh

625425 : 1,817 : 08-03-13 Re: PL/SQL API + Defaulting Rules in OM : 2008.04.11. 3:28 Sateesh Kumar S... You have to return a number, but you are returning character (V1). Find the orga nization_id of V1 and return that. In the exception you are not returning any value. Here retun organization_id (nu mber) of V1. Thanks Nagamohan

Sateesh Kumar S... : 44 : 07-12-16 Re: PL/SQL API + Defaulting Rules in OM : 2008.04.13. 20:52 625425 Thanks Nagamohan... Now it is working fine. Thanks a lot for u r information

Sateesh Kumar S... : 44 : 07-12-16 Re: PL/SQL API + Defaulting Rules in OM : 2008.04.14. 21:36 Sateesh Kumar S... Hi, I have query like: SELECT a.organization_id, b.element_name, b.element_value

FROM mtl_parameters a, mtl_descr_element_values b, mtl_system_items_b c WHERE b.inventory_item_id = c.inventory_item_id AND a.organization_id = c.organization_id AND a.organization_id = c.organization_id AND c.inventory_item_id = 12924 AND a.organization_id a.master_organization_id ORDER BY a.organization_id; When I pass inventory_item_id as 12924 it is returning multiple rows order by a.organization_id; 207 207 207 207 207 207 209 209 209 209 209 209 606 606 606 606 606 606 Duty Rating Medium Emission Norms Frequency 50 Phase Single Product Family QSK60 Voltage 230 Duty Rating Medium Emission Norms Frequency 50 Phase Single Product Family QSK60 Voltage 230 Duty Rating Medium Emission Norms Frequency 50 Phase Single Product Family QSK60 Voltage 230

But i want to populate corresponding organization (Ex: For this prod 606(M3)). H ow can I populate M3 value when i select ordered item in the sales order window. Shall I change my query? Please help me out Thanks in Advance, Sateesh Kumar S

625425 : 1,817 : 08-03-13 Re: PL/SQL API + Defaulting Rules in OM : 2008.04.15. 3:03 Sateesh Kumar S... Sateesh Actually this query does not help much. If the catalog is maintained at the mast er org level, this query will return as many organizations that the item is assi gned to. As you are simply looping through you will always get the last organiza tion the function is returning. Yes you have to change the query. But we do not know the requirement that drove you to write this query.

Thanks Nagamohan

Sateesh Kumar S... : 44 : 07-12-16 Re: PL/SQL API + Defaulting Rules in OM : 2008.04.15. 4:08 625425 Hi Nagamohan, l_line_type_rec := oe_order_cache.load_line_type (ont_line_def_hdlr.g_record.line_type_id); l_item_id := ont_line_def_hdlr.g_record.inventory_item_id; -- l_item_id := 12924; dbms_output.put_line('l_item_id in before for loop' || l_item_id); FOR cur_rec IN cus_l (l_item_id) LOOP I have code like above. But I am not getting l_item_id to my cursor. If i hot co de the value with 12924 I am getting my corresponding organization id. IF I pass item id value as a parameter to my cursor dynamically, I think my work is over. I think "ont_line_def_hdlr.g_record.line_type_id" package is not returning inven tory_item_id value. can u please help me out. Thanks in Advance Sateesh Kumar

user632748 : 5 : 08-04-23 pick release : 2008.04.23. 12:54 Hi, Can Anyone please share the pick_release/pick_confirm process document using API ...This is very urgent help from you. Thanks Satya Pal Satyanpal@gmail.com

Sateesh Kumar S...

S-ar putea să vă placă și