DBA Data[Home] [Help]

PACKAGE BODY: APPS.MTL_MOVEMENT_STATISTICS2_PKG

Source


1 PACKAGE BODY MTL_MOVEMENT_STATISTICS2_PKG as
2 /* $Header: INVTTM2B.pls 120.1 2005/07/01 13:23:42 appldev ship $ */
3 
4 procedure lock_row(v_rowid varchar2,
5 	v_movement_id number,
6 	v_parent_movement_id number,
7 	v_Organization_Id      number,
8       v_Last_Update_Date date,
9       v_Last_Updated_By  number,
10       v_Creation_Date    date,
11       v_Created_By       number,
12       v_Last_Update_Login number,
13 	v_movement_type varchar2,
14 	v_document_source_type varchar2,
15 	v_entity_org_id number,
16 	v_Transaction_date date,
17 	v_movement_status varchar2,
18 	v_go_detail varchar2,
19 	v_from_org_id number,
20 	v_from_org_name varchar2,
21 	v_to_org_id number,
22 	v_to_org_name varchar2,
23 	v_customer_name varchar2,
24 	v_customer_number varchar2,
25 	v_customer_location varchar2,
26 	v_ship_to_customer_id number,
27 	v_ship_to_site_use_id number,
28 	v_vendor_name varchar2,
29 	v_vendor_number varchar2,
30 	v_vendor_site varchar2,
31 	v_vendor_id number,
32 	v_vendor_site_id number,
33 	v_po_header_id number,
34 	v_order_header_id number,
35 	v_requisition_header_id number,
36 	v_doc_reference varchar2,
37         v_po_line_id number,
38 	v_order_line_id number,
39 	v_requisition_line_id number,
40 	v_doc_line_reference varchar2,
41 	v_shipment_header_id number,
42 	v_shipment_reference varchar2,
43 	v_shipment_line_id number,
44 	v_shipment_line_reference varchar2,
45 	v_po_line_location_id number,
46 	v_picking_line_id number,
47 	v_picking_line_detail_id number,
48 	v_pick_slip_reference varchar2,
49 	v_bill_to_name varchar2,
50 	v_bill_to_number varchar2,
51 	v_bill_to_site varchar2,
52 	v_bill_to_customer_id number,
53 	v_bill_to_site_use_id number,
54 	v_invoice_batch_id number,
55 	v_invoice_batch_reference varchar2,
56 	v_invoice_id number,
57 	v_invoice_reference varchar2,
58 	v_customer_trx_line_id number,
59 	v_invoice_line_reference varchar2,
60  	v_invoice_qty number,
61  	v_invoice_unit_price number,
62  	v_invoice_line_ext_val number,
63 	v_invoice_date_reference date,
64 	v_inventory_item_id number,
65 	v_item_cost number,
66 	v_item_desc varchar2,
67 	v_commodity_code varchar2,
68 	v_commodity_description varchar2,
69 	v_category_id number,
70 	v_transaction_uom_code varchar2,
71 	v_transaction_qty number,
72  	v_document_unit_price number,
73 	v_document_line_ext_value number,
74 	v_primary_qty number,
75 	v_dispatch_terr_code varchar2,
76 	v_destination_terr_code varchar2,
77 	v_origin_terr_code varchar2,
78 	v_txn_nature varchar2,
79 	v_delivery_terms varchar2,
80 	v_transport_mode varchar2,
81 	v_area varchar2,
82 	v_port varchar2,
83 	v_stat_type varchar2,
84 	v_weight_method varchar2,
85 	v_unit_weight number ,
86 	v_total_weight number ,
87  	v_stat_adj_pct number ,
88  	v_stat_adj_amt number ,
89 	v_stat_ext_val number ,
90 	v_stat_method varchar2,
91 	v_comments varchar2,
92 	v_alt_qty number,
93 	v_alt_uom_code varchar2,
94 	v_outside_code varchar2,
95  	v_outside_unit_price number,
96  	v_outside_ext_val number,
97 	v_currency_code varchar2,
98 	v_attribute_category varchar2,
99 	v_attribute1 varchar2 ,
100 	v_attribute2 varchar2 ,
101 	v_attribute3 varchar2 ,
102 	v_attribute4 varchar2 ,
103 	v_attribute5 varchar2 ,
104 	v_attribute6 varchar2 ,
105 	v_attribute7 varchar2 ,
106 	v_attribute8 varchar2 ,
107 	v_attribute9 varchar2 ,
108 	v_attribute10 varchar2 ,
109 	v_attribute11 varchar2 ,
110 	v_attribute12 varchar2 ,
111 	v_attribute13 varchar2 ,
112 	v_attribute14 varchar2 ,
113 	v_attribute15 varchar2
114       , v_triangulation_country_code VARCHAR2
115       , v_csa_code                   VARCHAR2
116       , v_set_of_books_period        VARCHAR2
117       , v_oil_reference_code         VARCHAR2
118       , v_container_type_code        VARCHAR2
119       , v_flow_indicator_code        VARCHAR2
120       , v_affiliation_reference_code VARCHAR2
121 ) IS
122 
123     CURSOR C IS
124     SELECT
125 	 MOVEMENT_ID			,
126  ORGANIZATION_ID		,
127  ENTITY_ORG_ID			,
128  MOVEMENT_TYPE			,
129  MOVEMENT_STATUS		,
130  TRANSACTION_DATE		,
131  LAST_UPDATE_DATE		,
132  LAST_UPDATED_BY		,
133  CREATION_DATE			,
134  CREATED_BY			,
135  LAST_UPDATE_LOGIN		,
136  DOCUMENT_SOURCE_TYPE		,
137  CREATION_METHOD		,
138  DOCUMENT_REFERENCE		,
139  DOCUMENT_LINE_REFERENCE	,
140  DOCUMENT_UNIT_PRICE		,
141  DOCUMENT_LINE_EXT_VALUE	,
142  RECEIPT_REFERENCE		,
143  SHIPMENT_REFERENCE		,
144  SHIPMENT_LINE_REFERENCE	,
145  PICK_SLIP_REFERENCE		,
146  CUSTOMER_NAME			,
147  CUSTOMER_NUMBER		,
148  CUSTOMER_LOCATION		,
149  TRANSACTING_FROM_ORG		,
150  TRANSACTING_TO_ORG		,
151  VENDOR_NAME			,
152  VENDOR_NUMBER			,
153  VENDOR_SITE			,
154  BILL_TO_NAME			,
155  BILL_TO_NUMBER 		,
156  BILL_TO_SITE			,
157  PO_HEADER_ID			,
158  PO_LINE_ID			,
159  PO_LINE_LOCATION_ID		,
160  ORDER_HEADER_ID		,
161  ORDER_LINE_ID			,
162  REQUISITION_HEADER_ID		,
163  REQUISITION_LINE_ID		,
164  PICKING_LINE_ID		,
165  PICKING_LINE_DETAIL_ID		,
166  SHIPMENT_HEADER_ID		,
167  SHIPMENT_LINE_ID		,
168  SHIP_TO_CUSTOMER_ID		,
169  SHIP_TO_SITE_USE_ID		,
170  BILL_TO_CUSTOMER_ID		,
171  BILL_TO_SITE_USE_ID		,
172  VENDOR_ID			,
173  VENDOR_SITE_ID 		,
174  FROM_ORGANIZATION_ID		,
175  TO_ORGANIZATION_ID		,
176  PARENT_MOVEMENT_ID		,
177  INVENTORY_ITEM_ID		,
178  ITEM_DESCRIPTION		,
179  ITEM_COST			,
180  TRANSACTION_QUANTITY		,
181  TRANSACTION_UOM_CODE		,
182  PRIMARY_QUANTITY		,
183  INVOICE_BATCH_ID		,
184  INVOICE_ID			,
185  CUSTOMER_TRX_LINE_ID		,
186  INVOICE_BATCH_REFERENCE	,
187  INVOICE_REFERENCE		,
188  INVOICE_LINE_REFERENCE 	,
189  INVOICE_DATE_REFERENCE 	,
190  INVOICE_QUANTITY		,
191  INVOICE_UNIT_PRICE		,
192  INVOICE_LINE_EXT_VALUE 	,
193  OUTSIDE_CODE			,
194  OUTSIDE_EXT_VALUE		,
195  OUTSIDE_UNIT_PRICE		,
196  CURRENCY_CODE			,
197  CATEGORY_ID			,
198  COMMODITY_CODE 		,
199  COMMODITY_DESCRIPTION		,
200  WEIGHT_METHOD			,
201  UNIT_WEIGHT			,
202  TOTAL_WEIGHT			,
203  TRANSACTION_NATURE		,
204  DELIVERY_TERMS 		,
205  TRANSPORT_MODE 		,
206  ALTERNATE_QUANTITY		,
207  ALTERNATE_UOM_CODE		,
208  DISPATCH_TERRITORY_CODE	,
209  DESTINATION_TERRITORY_CODE	,
210  ORIGIN_TERRITORY_CODE		,
211  STAT_METHOD			,
212  STAT_ADJ_PERCENT		,
213  STAT_ADJ_AMOUNT		,
214  STAT_EXT_VALUE 		,
215  AREA				,
216  PORT				,
217  STAT_TYPE			,
218  COMMENTS			,
219  ATTRIBUTE_CATEGORY		,
220  ATTRIBUTE1			,
221  ATTRIBUTE2			,
222  ATTRIBUTE3			,
223  ATTRIBUTE4			,
224  ATTRIBUTE5			,
225  ATTRIBUTE6			,
226  ATTRIBUTE7			,
227  ATTRIBUTE8			,
228  ATTRIBUTE9			,
229  ATTRIBUTE10			,
230  ATTRIBUTE11			,
231  ATTRIBUTE12			,
232  ATTRIBUTE13			,
233  ATTRIBUTE14			,
234  ATTRIBUTE15
235 , TRIANGULATION_COUNTRY_CODE
236 , CSA_CODE
237 , SET_OF_BOOKS_PERIOD
238 , OIL_REFERENCE_CODE
239 , CONTAINER_TYPE_CODE
240 , FLOW_INDICATOR_CODE
241 , AFFILIATION_REFERENCE_CODE
242 
243 FROM mtl_movement_statistics
244         WHERE  rowid = v_RowId
245         FOR UPDATE of  movement_id NOWAIT;
246 
247 
248     Recinfo C%ROWTYPE;
249     partone boolean := FALSE;
250     parttwo boolean := FALSE;
251 
252   BEGIN
253         OPEN C;
254         FETCH C INTO Recinfo;
255         if (C%NOTFOUND) then
256           CLOSE C;
257           FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_DELETED');
258 	  app_exception.raise_exception;
259         end if;
260         CLOSE C;
261 
262 	/* This was split in to two sections because for some reason,
263 	the PL/SQL compiler was unable to handle the entire section at
264 	once */
265         if (
266                (Recinfo.movement_id =  v_Movement_Id)
267            AND (Recinfo.organization_id =  v_Organization_Id)
268            AND (Recinfo.entity_org_id =  v_Entity_Org_Id)
269            AND (Recinfo.movement_type =  v_Movement_Type)
270            AND (Recinfo.movement_status =  v_Movement_Status)
271            AND (Recinfo.transaction_date =  v_Transaction_Date)
272            AND (Recinfo.document_source_type =  v_Document_Source_Type)
273            AND (   (Recinfo.document_reference =  v_Doc_Reference)
274                 OR (    (Recinfo.document_reference IS NULL)))
275            AND (   (Recinfo.document_line_reference =  v_Doc_Line_Reference)
276                 OR (    (Recinfo.document_line_reference IS NULL)))
277            AND (   (Recinfo.document_unit_price =  v_Document_Unit_Price)
278                 OR (    (Recinfo.document_unit_price IS NULL)
279                     AND (v_Document_Unit_Price IS NULL)))
280            AND (   (Recinfo.document_line_ext_value =  v_Document_Line_Ext_Value)
281                 OR (    (Recinfo.document_line_ext_value IS NULL)
282                     AND (v_Document_Line_Ext_Value IS NULL)))
283            AND (   (Recinfo.shipment_reference =  v_Shipment_Reference)
284                 OR (    (Recinfo.shipment_reference IS NULL)))
285            AND (   (Recinfo.shipment_line_reference =  v_Shipment_Line_Reference)
286                 OR (    (Recinfo.shipment_line_reference IS NULL)))
287            AND (   (Recinfo.pick_slip_reference =  v_Pick_Slip_Reference)
288                 OR (    (Recinfo.pick_slip_reference IS NULL)))
289            AND (   (Recinfo.customer_name =  v_Customer_Name)
290                 OR (    (Recinfo.customer_name IS NULL)))
291            AND (   (Recinfo.customer_number =  v_Customer_Number)
292                 OR (    (Recinfo.customer_number IS NULL)))
293            AND (   (Recinfo.customer_location =  v_Customer_Location)
294                 OR (    (Recinfo.customer_location IS NULL)))
295            AND (   (Recinfo.transacting_from_org =  v_From_Org_Name)
296                 OR (    (Recinfo.transacting_from_org IS NULL)))
297            AND (   (Recinfo.transacting_to_org =  v_To_Org_Name)
298                 OR (    (Recinfo.transacting_to_org IS NULL)))
299            AND (   (Recinfo.vendor_name =  v_Vendor_Name)
300                 OR (    (Recinfo.vendor_name IS NULL)))
301            AND (   (Recinfo.vendor_number =  v_Vendor_Number)
302                 OR (    (Recinfo.vendor_number IS NULL)))
303            AND (   (Recinfo.vendor_site =  v_Vendor_Site)
304                 OR (    (Recinfo.vendor_site IS NULL)))
305            AND (   (Recinfo.bill_to_name =  v_Bill_To_Name)
306                 OR (    (Recinfo.bill_to_name IS NULL)))
307            AND (   (Recinfo.bill_to_number =  v_Bill_To_Number)
308                 OR (    (Recinfo.bill_to_number IS NULL)))
309            AND (   (Recinfo.bill_to_site =  v_Bill_To_Site)
310                 OR (    (Recinfo.bill_to_site IS NULL)))
311            AND (   (Recinfo.po_header_id =  v_Po_Header_Id)
312                 OR (    (Recinfo.po_header_id IS NULL)
313                     AND (v_Po_Header_Id IS NULL)))
314            AND (   (Recinfo.po_line_id =  v_Po_Line_Id)
315                 OR (    (Recinfo.po_line_id IS NULL)
316                     AND (v_Po_Line_Id IS NULL)))
317            AND (   (Recinfo.po_line_location_id =  v_Po_Line_Location_Id)
318                 OR (    (Recinfo.po_line_location_id IS NULL)
319                     AND (v_Po_Line_Location_Id IS NULL)))
320            AND (   (Recinfo.order_header_id =  v_Order_Header_Id)
321                 OR (    (Recinfo.order_header_id IS NULL)
322                     AND (v_Order_Header_Id IS NULL)))
323            AND (   (Recinfo.order_line_id =  v_Order_Line_Id)
324                 OR (    (Recinfo.order_line_id IS NULL)
325                     AND (v_Order_Line_Id IS NULL)))
326 	   AND (   (Recinfo.requisition_header_id =  v_Requisition_Header_Id)
327                 OR (    (Recinfo.requisition_header_id IS NULL)
328                     AND (v_Requisition_Header_Id IS NULL)))
329            AND (   (Recinfo.requisition_line_id =  v_Requisition_Line_Id)
330                 OR (    (Recinfo.requisition_line_id IS NULL)
331                     AND (v_Requisition_Line_Id IS NULL)))
332            AND (   (Recinfo.picking_line_id =  v_Picking_Line_Id)
333                 OR (    (Recinfo.picking_line_id IS NULL)
334                     AND (v_Picking_Line_Id IS NULL)))
335 	   AND (   (Recinfo.picking_line_detail_id =  v_Picking_Line_Detail_Id)
336                 OR (    (Recinfo.picking_line_detail_id IS NULL)
337                     AND (v_Picking_Line_Detail_Id IS NULL)))
338            AND (   (Recinfo.shipment_header_id =  v_Shipment_Header_Id)
339                 OR (    (Recinfo.shipment_header_id IS NULL)
340                     AND (v_Shipment_Header_Id IS NULL)))
341            AND (   (Recinfo.shipment_line_id =  v_Shipment_Line_Id)
342                 OR (    (Recinfo.shipment_line_id IS NULL)
343                     AND (v_Shipment_Line_Id IS NULL)))
344            AND (   (Recinfo.ship_to_customer_id =  v_Ship_To_Customer_Id)
345                 OR (    (Recinfo.ship_to_customer_id IS NULL)
346                     AND (v_Ship_To_Customer_Id IS NULL)))
347            AND (   (Recinfo.ship_to_site_use_id =  v_Ship_To_Site_Use_Id)
348                 OR (    (Recinfo.ship_to_site_use_id IS NULL)
349                     AND (v_Ship_To_Site_Use_Id IS NULL)))
350            AND (   (Recinfo.bill_to_customer_id =  v_Bill_To_Customer_Id)
351                 OR (    (Recinfo.bill_to_customer_id IS NULL)
352                     AND (v_Bill_To_Customer_Id IS NULL)))
353            AND (   (Recinfo.bill_to_site_use_id =  v_Bill_To_Site_Use_Id)
354                 OR (    (Recinfo.bill_to_site_use_id IS NULL)
355                     AND (v_Bill_To_Site_Use_Id IS NULL)))
356            AND (   (Recinfo.vendor_id =  v_Vendor_Id)
357                 OR (    (Recinfo.vendor_id IS NULL)
358                     AND (v_Vendor_Id IS NULL)))
359            AND (   (Recinfo.vendor_site_id =  v_Vendor_Site_Id)
360                 OR (    (Recinfo.vendor_site_id IS NULL)
361                     AND (v_Vendor_Site_Id IS NULL)))
362            AND (   (Recinfo.from_organization_id =  v_From_Org_Id)
363                 OR (    (Recinfo.from_organization_id IS NULL)
364                     AND (v_From_Org_Id IS NULL)))
365            AND (   (Recinfo.to_organization_id =  v_To_Org_Id)
366                 OR (    (Recinfo.to_organization_id IS NULL)
367                     AND (v_To_Org_Id IS NULL)))
368            AND (Recinfo.parent_movement_id =  v_Parent_Movement_Id)
369            AND (   (Recinfo.inventory_item_id =  v_Inventory_Item_Id)
370                 OR (    (Recinfo.inventory_item_id IS NULL)
371                     AND (v_Inventory_Item_Id IS NULL)))
372            AND (   (Recinfo.item_description =  v_Item_Desc)
373                 OR (    (Recinfo.item_description IS NULL)
374                     AND (v_Item_Desc IS NULL)))
375            AND (   (Recinfo.item_cost =  v_Item_Cost)
376                 OR (    (Recinfo.item_cost IS NULL)
377                     AND (v_Item_Cost IS NULL)))
378            AND (   (Recinfo.transaction_quantity =  v_Transaction_Qty)
379                 OR (    (Recinfo.transaction_quantity IS NULL)
380                     AND (v_Transaction_Qty IS NULL)))
381            AND (   (Recinfo.transaction_uom_code =  v_Transaction_Uom_Code)
382                 OR (    (Recinfo.transaction_uom_code IS NULL)
383                     AND (v_Transaction_Uom_Code IS NULL)))
384            AND (   (Recinfo.primary_quantity =  v_Primary_Qty)
385                 OR (    (Recinfo.primary_quantity IS NULL)
386                     AND (v_Primary_Qty IS NULL)))
387            AND (   (Recinfo.invoice_batch_id =  v_Invoice_Batch_Id)
388                 OR (    (Recinfo.invoice_batch_id IS NULL)
389                     AND (v_Invoice_Batch_Id IS NULL)))
390            AND (   (Recinfo.invoice_id =  v_Invoice_Id)
391                 OR (    (Recinfo.invoice_id IS NULL)
392                     AND (v_Invoice_Id IS NULL)))
393            AND (   (Recinfo.customer_trx_line_id =  v_Customer_Trx_Line_Id)
394                 OR (    (Recinfo.customer_trx_line_id IS NULL)
395                     AND (v_Customer_Trx_Line_Id IS NULL)))
396            AND (   (Recinfo.invoice_batch_reference =  v_Invoice_Batch_Reference)
397                 OR (    (Recinfo.invoice_batch_reference IS NULL)))
398            AND (   (Recinfo.invoice_reference =  v_Invoice_Reference)
402            AND (   (Recinfo.invoice_date_reference =  v_Invoice_Date_Reference)
399                 OR (    (Recinfo.invoice_reference IS NULL)))
400            AND (   (Recinfo.invoice_line_reference =  v_Invoice_Line_Reference)
401                 OR (    (Recinfo.invoice_line_reference IS NULL)))
403                 OR (    (Recinfo.invoice_date_reference IS NULL)
404                     AND (v_Invoice_Date_Reference IS NULL)))
405            AND (   (Recinfo.invoice_quantity =  v_Invoice_Qty)
406                 OR (    (Recinfo.invoice_quantity IS NULL)
407                     AND (v_Invoice_Qty IS NULL)))
408            AND (   (Recinfo.invoice_unit_price =  v_Invoice_Unit_Price)
409                 OR (    (Recinfo.invoice_unit_price IS NULL)
410                     AND (v_Invoice_Unit_Price IS NULL)))
411            AND (   (Recinfo.invoice_line_ext_value =  v_Invoice_Line_Ext_Val)
412                 OR (    (Recinfo.invoice_line_ext_value IS NULL)
413                     AND (v_Invoice_Line_Ext_Val IS NULL)))
414            AND (   (Recinfo.outside_code =  v_Outside_Code)
415                 OR (    (Recinfo.outside_code IS NULL)
416                     AND (v_Outside_Code IS NULL)))
417 	) then
418 		partone := TRUE;
419 	end if;
420 	if (
421            (   (Recinfo.outside_ext_value =  v_Outside_Ext_Val)
422                 OR (    (Recinfo.outside_ext_value IS NULL)
423                     AND (v_Outside_Ext_Val IS NULL)))
424            AND (   (Recinfo.outside_unit_price =  v_Outside_Unit_Price)
425                 OR (    (Recinfo.outside_unit_price IS NULL)
426                     AND (v_Outside_Unit_Price IS NULL)))
427            AND (   (Recinfo.currency_code =  v_Currency_Code)
428                 OR (    (Recinfo.currency_code IS NULL)
429                     AND (v_Currency_Code IS NULL)))
430            AND (   (Recinfo.category_id =  v_Category_Id)
431                 OR (    (Recinfo.category_id IS NULL)
432                     AND (v_Category_Id IS NULL)))
433            AND (   (Recinfo.commodity_code =  v_Commodity_Code)
434                 OR (    (Recinfo.commodity_code IS NULL)
435                     AND (v_Commodity_Code IS NULL)))
436            AND (   (Recinfo.commodity_description =  v_Commodity_Description)
437                 OR (    (Recinfo.commodity_description IS NULL)
438                     AND (v_Commodity_Description IS NULL)))
439            AND (   (Recinfo.weight_method =  v_Weight_Method)
440                 OR (    (Recinfo.weight_method IS NULL)
441                     AND (v_Weight_Method IS NULL)))
442            AND (   (Recinfo.unit_weight =  v_Unit_Weight)
443                 OR (    (Recinfo.unit_weight IS NULL)
444                     AND (v_Unit_Weight IS NULL)))
445            AND (   (Recinfo.total_weight =  v_Total_Weight)
446                 OR (    (Recinfo.total_weight IS NULL)
447                     AND (v_Total_Weight IS NULL)))
448            AND (   (Recinfo.transaction_nature =  v_Txn_Nature)
449                 OR (    (Recinfo.transaction_nature IS NULL)
450                     AND (v_Txn_Nature IS NULL)))
451            AND (   (Recinfo.delivery_terms =  v_Delivery_Terms)
452                 OR (    (Recinfo.delivery_terms IS NULL)
453                     AND (v_Delivery_Terms IS NULL)))
454            AND (   (Recinfo.transport_mode =  v_Transport_Mode)
455                 OR (    (Recinfo.transport_mode IS NULL)
456                     AND (v_Transport_Mode IS NULL)))
457            AND (   (Recinfo.alternate_quantity =  v_Alt_Qty)
458                 OR (    (Recinfo.alternate_quantity IS NULL)
459                     AND (v_Alt_Qty IS NULL)))
460            AND (   (Recinfo.alternate_uom_code =  v_Alt_Uom_Code)
461                 OR (    (Recinfo.alternate_uom_code IS NULL)
462                     AND (v_Alt_Uom_Code IS NULL)))
463            AND (   (Recinfo.dispatch_territory_code =  v_Dispatch_Terr_Code)
464                 OR (    (Recinfo.dispatch_territory_code IS NULL)
465                     AND (v_Dispatch_Terr_Code IS NULL)))
466            AND (   (Recinfo.destination_territory_code =  v_Destination_Terr_Code)
467                 OR (    (Recinfo.destination_territory_code IS NULL)
468                     AND (v_Destination_Terr_Code IS NULL)))
469            AND (   (Recinfo.origin_territory_code =  v_Origin_Terr_Code)
470                 OR (    (Recinfo.origin_territory_code IS NULL)
471                     AND (v_Origin_Terr_Code IS NULL)))
472            AND (   (Recinfo.stat_adj_percent =  v_Stat_Adj_Pct)
473                 OR (    (Recinfo.stat_adj_percent IS NULL)
474                     AND (v_Stat_Adj_Pct IS NULL)))
475            AND (   (Recinfo.stat_adj_amount =  v_Stat_Adj_Amt)
476                 OR (    (Recinfo.stat_adj_amount IS NULL)
477                     AND (v_Stat_Adj_Amt IS NULL)))
478            AND (   (Recinfo.stat_ext_value =  v_Stat_Ext_Val)
479                 OR (    (Recinfo.stat_ext_value IS NULL)
480                     AND (v_Stat_Ext_Val IS NULL)))
481            AND (   (Recinfo.area =  v_Area)
482                 OR (    (Recinfo.area IS NULL)
483                     AND (v_Area IS NULL)))
484            AND (   (Recinfo.port =  v_Port)
485                 OR (    (Recinfo.port IS NULL)
486                     AND (v_Port IS NULL)))
487            AND (   (Recinfo.stat_type =  v_Stat_Type)
488                 OR (    (Recinfo.stat_type IS NULL)
489                     AND (v_Stat_Type IS NULL)))
490            AND (   (Recinfo.comments =  v_Comments)
491                 OR (    (Recinfo.comments IS NULL)
492                     AND (v_Comments IS NULL)))
493            AND (   (Recinfo.attribute_category =  v_Attribute_Category)
494                 OR (    (Recinfo.attribute_category IS NULL)
495                     AND (v_Attribute_Category IS NULL)))
496            AND (   (Recinfo.attribute1 =  v_Attribute1)
497                 OR (    (Recinfo.attribute1 IS NULL)
498                     AND (v_Attribute1 IS NULL)))
499            AND (   (Recinfo.attribute2 =  v_Attribute2)
500                 OR (    (Recinfo.attribute2 IS NULL)
501                     AND (v_Attribute2 IS NULL)))
502            AND (   (Recinfo.attribute3 =  v_Attribute3)
503                 OR (    (Recinfo.attribute3 IS NULL)
504                     AND (v_Attribute3 IS NULL)))
505            AND (   (Recinfo.attribute4 =  v_Attribute4)
506                 OR (    (Recinfo.attribute4 IS NULL)
507                     AND (v_Attribute4 IS NULL)))
508            AND (   (Recinfo.attribute5 =  v_Attribute5)
509                 OR (    (Recinfo.attribute5 IS NULL)
510                     AND (v_Attribute5 IS NULL)))
511            AND (   (Recinfo.attribute6 =  v_Attribute6)
512                 OR (    (Recinfo.attribute6 IS NULL)
513                     AND (v_Attribute6 IS NULL)))
514            AND (   (Recinfo.attribute7 =  v_Attribute7)
515                 OR (    (Recinfo.attribute7 IS NULL)
516                     AND (v_Attribute7 IS NULL)))
517            AND (   (Recinfo.attribute8 =  v_Attribute8)
518                 OR (    (Recinfo.attribute8 IS NULL)
519                     AND (v_Attribute8 IS NULL)))
520            AND (   (Recinfo.attribute9 =  v_Attribute9)
521                 OR (    (Recinfo.attribute9 IS NULL)
522                     AND (v_Attribute9 IS NULL)))
523            AND (   (Recinfo.attribute10 =  v_Attribute10)
524                 OR (    (Recinfo.attribute10 IS NULL)
525                     AND (v_Attribute10 IS NULL)))
526            AND (   (Recinfo.attribute11 =  v_Attribute11)
527                 OR (    (Recinfo.attribute11 IS NULL)
528                     AND (v_Attribute11 IS NULL)))
529            AND (   (Recinfo.attribute12 =  v_Attribute12)
530                 OR (    (Recinfo.attribute12 IS NULL)
531                     AND (v_Attribute12 IS NULL)))
532            AND (   (Recinfo.attribute13 =  v_Attribute13)
533                 OR (    (Recinfo.attribute13 IS NULL)
534                     AND (v_Attribute13 IS NULL)))
535            AND (   (Recinfo.attribute14 =  v_Attribute14)
536                 OR (    (Recinfo.attribute14 IS NULL)
537                     AND (v_Attribute14 IS NULL)))
538            AND (   (Recinfo.attribute15 =  v_Attribute15)
539                 OR (    (Recinfo.attribute15 IS NULL)
540                     AND (v_Attribute15 IS NULL)))
541            AND (   (Recinfo.triangulation_country_code = v_Triangulation_Country_Code)
542                OR  (    (Recinfo.triangulation_country_code IS NULL)
543                    AND  (v_Triangulation_Country_Code IS NULL)))
544            AND (   (Recinfo.csa_code = v_Csa_Code)
545                OR  (    (Recinfo.csa_code IS NULL)
546                    AND  (v_Csa_Code IS NULL)))
547            AND (   (Recinfo.set_of_books_period = v_Set_Of_Books_Period)
548                OR  (    (Recinfo.set_of_books_period IS NULL)
549                    AND  (v_Set_Of_Books_Period IS NULL)))
550            AND (   (Recinfo.oil_reference_code = v_Oil_Reference_Code)
551                OR  (    (Recinfo.oil_reference_code IS NULL)
552                    AND  (v_Oil_Reference_Code IS NULL)))
553            AND (   (Recinfo.flow_indicator_code = v_Flow_Indicator_Code)
554                OR  (    (Recinfo.flow_indicator_code  IS NULL)
555                    AND  (v_Flow_Indicator_Code IS NULL)))
556            AND (   (Recinfo.container_type_code = v_Container_Type_Code)
557                OR  (    (Recinfo.container_type_code IS NULL)
558                    AND  (v_Container_Type_Code IS NULL)))
559            AND (   (Recinfo.affiliation_reference_code = v_Affiliation_Reference_Code)
560                OR  (    (Recinfo.affiliation_reference_code IS NULL)
561                    AND  (v_Affiliation_Reference_Code IS NULL)))
562 	) then
563           parttwo := TRUE;
564 	end if;
565 	if (partone and parttwo) then
566 		return;
567         else
568           FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
569 	  app_exception.raise_exception;
570         end if;
571   END Lock_Row;
572 
573 END MTL_MOVEMENT_STATISTICS2_PKG;