DBA Data[Home] [Help]

PACKAGE BODY: APPS.PO_HEADERS_PKG_S1

Source


1 PACKAGE BODY PO_HEADERS_PKG_S1 as
2 /* $Header: POXP2PHB.pls 120.2 2005/07/05 16:13:36 shsiung noship $ */
3 
4 -- Read the profile option that enables/disables the debug log
5 g_fnd_debug CONSTANT VARCHAR2(1) := NVL(FND_PROFILE.VALUE('AFLOG_ENABLED'),'N');
6 
7 g_module_prefix CONSTANT VARCHAR2(50) := 'po.plsql.PO_HEADERS_PKG_S1.';
8 
9 
10 /*===========================================================================
11 
12   PROCEDURE NAME:	Lock_Row()
13 
14 ===========================================================================*/
15 
16   PROCEDURE Lock_Row(X_Rowid                            VARCHAR2,
17                      X_Po_Header_Id                     NUMBER,
18                      X_Agent_Id                         NUMBER,
19                      X_Type_Lookup_Code                 VARCHAR2,
20                      X_Segment1                         VARCHAR2,
21                      X_Summary_Flag                     VARCHAR2,
22                      X_Enabled_Flag                     VARCHAR2,
23                      X_Segment2                         VARCHAR2,
24                      X_Segment3                         VARCHAR2,
25                      X_Segment4                         VARCHAR2,
26                      X_Segment5                         VARCHAR2,
27                      X_Start_Date_Active                DATE,
28                      X_End_Date_Active                  DATE,
29                      X_Vendor_Id                        NUMBER,
30                      X_Vendor_Site_Id                   NUMBER,
31                      X_Vendor_Contact_Id                NUMBER,
32                      X_Ship_To_Location_Id              NUMBER,
33                      X_Bill_To_Location_Id              NUMBER,
34                      X_Terms_Id                         NUMBER,
35                      X_Ship_Via_Lookup_Code             VARCHAR2,
36                      X_Fob_Lookup_Code                  VARCHAR2,
37                      X_Pay_On_Code                      VARCHAR2,
38                      X_Freight_Terms_Lookup_Code        VARCHAR2,
39                      X_Status_Lookup_Code               VARCHAR2,
40                      X_Currency_Code                    VARCHAR2,
41                      X_Rate_Type                        VARCHAR2,
42                      X_Rate_Date                        DATE,
43                      X_Rate                             NUMBER,
44                      X_From_Header_Id                   NUMBER,
45                      X_From_Type_Lookup_Code            VARCHAR2,
46                      X_Start_Date                       DATE,
47                      X_End_Date                         DATE,
48                      X_Blanket_Total_Amount             NUMBER,
49                      X_Authorization_Status             VARCHAR2,
50                      X_Revision_Num                     NUMBER,
51 -- Bug 902976, zxzhang, 10/04/99
52 -- Change REVISED_DATE from VarChar(25) to Date.
53 --                   X_Revised_Date                     VARCHAR2,
54                      X_Revised_Date                     DATE,
55                      X_Approved_Flag                    VARCHAR2,
56                      X_Approved_Date                    DATE,
57                      X_Amount_Limit                     NUMBER,
58                      X_Min_Release_Amount               NUMBER,
59                      X_Note_To_Authorizer               VARCHAR2,
60                      X_Note_To_Vendor                   VARCHAR2,
61                      X_Note_To_Receiver                 VARCHAR2,
62                      X_Print_Count                      NUMBER,
63                      X_Printed_Date                     DATE,
64                      X_Vendor_Order_Num                 VARCHAR2,
65                      X_Confirming_Order_Flag            VARCHAR2,
66                      X_Comments                         VARCHAR2,
67                      X_Reply_Date                       DATE,
68                      X_Reply_Method_Lookup_Code         VARCHAR2,
69                      X_Rfq_Close_Date                   DATE,
70                      X_Quote_Type_Lookup_Code           VARCHAR2,
71                      X_Quotation_Class_Code             VARCHAR2,
72                      X_Quote_Warning_Delay_Unit         VARCHAR2,
73                      X_Quote_Warning_Delay              NUMBER,
74                      X_Quote_Vendor_Quote_Number        VARCHAR2,
75                      X_Acceptance_Required_Flag         VARCHAR2,
76                      X_Acceptance_Due_Date              DATE,
77                      X_Closed_Date                      DATE,
78                      X_User_Hold_Flag                   VARCHAR2,
79                      X_Approval_Required_Flag           VARCHAR2,
80                      X_Cancel_Flag                      VARCHAR2,
81                      X_Firm_Status_Lookup_Code          VARCHAR2,
82                      X_Firm_Date                        DATE,
83                      X_Frozen_Flag                      VARCHAR2,
84                      X_Attribute_Category               VARCHAR2,
85                      X_Attribute1                       VARCHAR2,
86                      X_Attribute2                       VARCHAR2,
87                      X_Attribute3                       VARCHAR2,
88                      X_Attribute4                       VARCHAR2,
89                      X_Attribute5                       VARCHAR2,
90                      X_Attribute6                       VARCHAR2,
91                      X_Attribute7                       VARCHAR2,
92                      X_Attribute8                       VARCHAR2,
93                      X_Attribute9                       VARCHAR2,
94                      X_Attribute10                      VARCHAR2,
95                      X_Attribute11                      VARCHAR2,
96                      X_Attribute12                      VARCHAR2,
97                      X_Attribute13                      VARCHAR2,
98                      X_Attribute14                      VARCHAR2,
99                      X_Attribute15                      VARCHAR2,
100                      X_Closed_Code                      VARCHAR2,
101                      X_Ussgl_Transaction_Code           VARCHAR2,
102                      X_Government_Context               VARCHAR2,
103                      X_Supply_Agreement_flag            VARCHAR2,
104                      X_Global_Agreement_Flag            VARCHAR2,
105                      X_Price_Update_Tolerance           NUMBER,
106                      X_Global_Attribute_Category        VARCHAR2,
107                      X_Global_Attribute1                VARCHAR2,
108                      X_Global_Attribute2                VARCHAR2,
109                      X_Global_Attribute3                VARCHAR2,
110                      X_Global_Attribute4                VARCHAR2,
111                      X_Global_Attribute5                VARCHAR2,
112                      X_Global_Attribute6                VARCHAR2,
113                      X_Global_Attribute7                VARCHAR2,
114                      X_Global_Attribute8                VARCHAR2,
115                      X_Global_Attribute9                VARCHAR2,
116                      X_Global_Attribute10               VARCHAR2,
117                      X_Global_Attribute11               VARCHAR2,
118                      X_Global_Attribute12               VARCHAR2,
119                      X_Global_Attribute13               VARCHAR2,
120                      X_Global_Attribute14               VARCHAR2,
121                      X_Global_Attribute15               VARCHAR2,
122                      X_Global_Attribute16               VARCHAR2,
123                      X_Global_Attribute17               VARCHAR2,
124                      X_Global_Attribute18               VARCHAR2,
125                      X_Global_Attribute19               VARCHAR2,
126                      X_Global_Attribute20               VARCHAR2,
127                      x_new_print_count       OUT NOCOPY NUMBER,
128                      x_new_printed_date      OUT NOCOPY DATE,
129                      p_shipping_control      IN         VARCHAR2    -- <INBOUND LOGISTICS FPJ>
130                     ,p_conterms_exist_flag   IN         VARCHAR2    -- <CONTERMS FPJ>
131                     ,p_encumbrance_required_flag IN VARCHAR2 --<ENCUMBRANCE FPJ>
132   ) IS
133     CURSOR C IS
134         SELECT *
135         FROM   PO_HEADERS
136         WHERE  rowid = X_Rowid
137         FOR UPDATE of Po_Header_Id NOWAIT;
138     Recinfo C%ROWTYPE;
139   BEGIN
140     OPEN C;
141     FETCH C INTO Recinfo;
142     if (C%NOTFOUND) then
143       CLOSE C;
144       IF (g_fnd_debug = 'Y') THEN
145           IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_ERROR) THEN
146             FND_LOG.string(FND_LOG.level_error, g_module_prefix || 'lock_row.000',
147                          'Cursor failed with rowid = ' || nvl(x_rowid,'null'));
148           END IF;
149       END IF;
150       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_DELETED');
151       APP_EXCEPTION.Raise_Exception;
152     end if;
153     CLOSE C;
154 /* Bug 2032728. Modified the lock row procedures for headers to compare truncated
155                 dates so that the time stamp is not compared as the time stamp
156                 was causing the problem.
157 */
158     if (
159 
160                (Recinfo.po_header_id = X_Po_Header_Id)
161            AND (Recinfo.agent_id = X_Agent_Id)
162            AND (Recinfo.type_lookup_code = X_Type_Lookup_Code)
163            AND (Recinfo.segment1 = X_Segment1)
164            AND (Recinfo.summary_flag = X_Summary_Flag)
165            AND (Recinfo.enabled_flag = X_Enabled_Flag)
166            AND (   (Recinfo.segment2 = X_Segment2)
167                 OR ((Recinfo.segment2 IS NULL)
168                     AND (X_Segment2 IS NULL)))
169            AND (   (Recinfo.segment3 = X_Segment3)
170                 OR (    (Recinfo.segment3 IS NULL)
171                     AND (X_Segment3 IS NULL)))
172            AND (   (Recinfo.segment4 = X_Segment4)
173                 OR (    (Recinfo.segment4 IS NULL)
174                     AND (X_Segment4 IS NULL)))
175            AND (   (Recinfo.segment5 = X_Segment5)
176                 OR (    (Recinfo.segment5 IS NULL)
177                     AND (X_Segment5 IS NULL)))
178            AND (   (trunc(Recinfo.start_date_active) = trunc(X_Start_Date_Active))
179                 OR (    (Recinfo.start_date_active IS NULL)
180                     AND (X_Start_Date_Active IS NULL)))
181            AND (   (trunc(Recinfo.end_date_active) = trunc(X_End_Date_Active))
182                 OR (    (Recinfo.end_date_active IS NULL)
183                     AND (X_End_Date_Active IS NULL)))
184            AND (   (Recinfo.vendor_id = X_Vendor_Id)
185                 OR (    (Recinfo.vendor_id IS NULL)
186                     AND (X_Vendor_Id IS NULL)))
187            AND (   (Recinfo.vendor_site_id = X_Vendor_Site_Id)
188                 OR (    (Recinfo.vendor_site_id IS NULL)
189                     AND (X_Vendor_Site_Id IS NULL)))
190            AND (   (Recinfo.vendor_contact_id = X_Vendor_Contact_Id)
191                 OR (    (Recinfo.vendor_contact_id IS NULL)
192                     AND (X_Vendor_Contact_Id IS NULL)))
193            AND (   (Recinfo.ship_to_location_id = X_Ship_To_Location_Id)
194                 OR (    (Recinfo.ship_to_location_id IS NULL)
195                     AND (X_Ship_To_Location_Id IS NULL)))
196            AND (   (Recinfo.bill_to_location_id = X_Bill_To_Location_Id)
197                 OR (    (Recinfo.bill_to_location_id IS NULL)
198                     AND (X_Bill_To_Location_Id IS NULL)))
199            AND (   (Recinfo.terms_id = X_Terms_Id)
200                 OR (    (Recinfo.terms_id IS NULL)
201                     AND (X_Terms_Id IS NULL)))
202            AND (   (Recinfo.ship_via_lookup_code = X_Ship_Via_Lookup_Code)
203                 OR (    (Recinfo.ship_via_lookup_code IS NULL)
204                     AND (X_Ship_Via_Lookup_Code IS NULL)))
205            AND (   (Recinfo.fob_lookup_code = X_Fob_Lookup_Code)
206                 OR (    (Recinfo.fob_lookup_code IS NULL)
207                     AND (X_Fob_Lookup_Code IS NULL)))
208            AND (   (Recinfo.pay_on_code = X_Pay_On_Code)
209                 OR (    (Recinfo.pay_on_code IS NULL)
210                     AND (X_Pay_On_Code IS NULL)))
211            AND (   (Recinfo.freight_terms_lookup_code = X_Freight_Terms_Lookup_Code)
212                 OR (    (Recinfo.freight_terms_lookup_code IS NULL)
213                     AND (X_Freight_Terms_Lookup_Code IS NULL)))
214            AND (   (Recinfo.status_lookup_code = X_Status_Lookup_Code)
215                 OR (    (Recinfo.status_lookup_code IS NULL)
216                     AND (X_Status_Lookup_Code IS NULL)))
217            AND (   (Recinfo.currency_code = X_Currency_Code)
218                 OR (    (Recinfo.currency_code IS NULL)
219                     AND (X_Currency_Code IS NULL)))
220            AND (   (Recinfo.rate_type = X_Rate_Type)
221                 OR (    (Recinfo.rate_type IS NULL)
222                     AND (X_Rate_Type IS NULL)))
223            AND (   (trunc(Recinfo.rate_date) = trunc(X_Rate_Date))
224                 OR (    (Recinfo.rate_date IS NULL)
225                     AND (X_Rate_Date IS NULL)))
226            AND (   (Recinfo.rate = X_Rate)
227                 OR (    (Recinfo.rate IS NULL)
228                     AND (X_Rate IS NULL)))
229            AND (   (Recinfo.from_header_id = X_From_Header_Id)
230                 OR (    (Recinfo.from_header_id IS NULL)
231                     AND (X_From_Header_Id IS NULL)))
232            AND (   (Recinfo.from_type_lookup_code = X_From_Type_Lookup_Code)
233                 OR (    (Recinfo.from_type_lookup_code IS NULL)
234                     AND (X_From_Type_Lookup_Code IS NULL)))
235            AND (   (trunc(Recinfo.start_date) = trunc(X_Start_Date))
236                 OR (    (Recinfo.start_date IS NULL)
237                     AND (X_Start_Date IS NULL)))
238            AND (   (trunc(Recinfo.end_date) = trunc(X_End_Date))
239                 OR (    (Recinfo.end_date IS NULL)
240                     AND (X_End_Date IS NULL)))
241            AND (   (Recinfo.blanket_total_amount = X_Blanket_Total_Amount)
242                 OR (    (Recinfo.blanket_total_amount IS NULL)
243                     AND (X_Blanket_Total_Amount IS NULL)))
244            AND (   (Recinfo.authorization_status = X_Authorization_Status)
245                 OR (    (Recinfo.authorization_status IS NULL)
246                     AND (X_Authorization_Status IS NULL)))
247            AND (   (Recinfo.revision_num = X_Revision_Num)
248                 OR (    (Recinfo.revision_num IS NULL)
249                     AND (X_Revision_Num IS NULL)))
250            AND (   (trunc(Recinfo.revised_date) = trunc(X_Revised_Date))
251                 OR (    (Recinfo.revised_date IS NULL)
252                     AND (X_Revised_Date IS NULL)))
253            AND (   (Recinfo.approved_flag = X_Approved_Flag)
254                 OR (    (Recinfo.approved_flag IS NULL)
255                     AND (X_Approved_Flag IS NULL)))
256            AND (   (trunc(Recinfo.approved_date) = trunc(X_Approved_Date))
257                 OR (    (Recinfo.approved_date IS NULL)
258                     AND (X_Approved_Date IS NULL)))
259            AND (   (Recinfo.amount_limit = X_Amount_Limit)
260                 OR (    (Recinfo.amount_limit IS NULL)
261                     AND (X_Amount_Limit IS NULL)))
262            AND (   (Recinfo.min_release_amount = X_Min_Release_Amount)
263                 OR (    (Recinfo.min_release_amount IS NULL)
264                     AND (X_Min_Release_Amount IS NULL)))
265            AND (   (rtrim(Recinfo.note_to_authorizer) = rtrim(X_Note_To_Authorizer))
266                 OR (    (Recinfo.note_to_authorizer IS NULL)
267                     AND (X_Note_To_Authorizer IS NULL)))
268            AND (   (rtrim(Recinfo.note_to_vendor) = rtrim(X_Note_To_Vendor))
269                 OR (    (Recinfo.note_to_vendor IS NULL)
270                     AND (X_Note_To_Vendor IS NULL)))
271            AND (   (rtrim(Recinfo.note_to_receiver) = rtrim(X_Note_To_Receiver))
272                 OR (    (Recinfo.note_to_receiver IS NULL)
273                     AND (X_Note_To_Receiver IS NULL)))
274            AND (   (Recinfo.vendor_order_num = X_Vendor_Order_Num)
275                 OR (    (Recinfo.vendor_order_num IS NULL)
276                     AND (X_Vendor_Order_Num IS NULL)))
277            AND (   (Recinfo.confirming_order_flag = X_Confirming_Order_Flag)
278                 OR (    (Recinfo.confirming_order_flag IS NULL)
279                     AND (X_Confirming_Order_Flag IS NULL)))
280            AND (   (rtrim(Recinfo.comments) = rtrim(X_Comments))  -- Bug 3308189
281                 OR (    (Recinfo.comments IS NULL)
282                     AND (X_Comments IS NULL)))
283            AND (   (trunc(Recinfo.reply_date) = trunc(X_Reply_Date))
284                 OR (    (Recinfo.reply_date IS NULL)
285                     AND (X_Reply_Date IS NULL)))
286            AND (   (Recinfo.reply_method_lookup_code = X_Reply_Method_Lookup_Code)
287                 OR (    (Recinfo.reply_method_lookup_code IS NULL)
291                     AND (p_shipping_control IS NULL)))    -- <INBOUND LOGISTICS FPJ>
288                     AND (X_Reply_Method_Lookup_Code IS NULL)))
289            AND (   (Recinfo.shipping_control = p_shipping_control)
290                 OR (    (Recinfo.shipping_control IS NULL)
292 	   --<CONTERMS FPJ START>
293            AND (   (Recinfo.conterms_exist_flag = p_conterms_exist_flag)
294                 OR (    (Recinfo.conterms_exist_flag IS NULL)
295                     AND (p_conterms_exist_flag IS NULL)))
296 	   -- <CONTERMS FPJ END>
297            --<ENCUMBRANCE FPJ START>
298            AND (   (Recinfo.encumbrance_required_flag = p_encumbrance_required_flag)
299                 OR (    (Recinfo.encumbrance_required_flag IS NULL)
300                     AND (p_encumbrance_required_flag IS NULL)))
301            -- <ENCUMBRANCE FPJ END>
302          )  then
303 
304             if (
305                (   (trunc(Recinfo.rfq_close_date) = trunc(X_Rfq_Close_Date))
306                 OR (    (Recinfo.rfq_close_date IS NULL)
307                     AND (X_Rfq_Close_Date IS NULL)))
308            AND (   (Recinfo.quote_type_lookup_code = X_Quote_Type_Lookup_Code)
309                 OR (    (Recinfo.quote_type_lookup_code IS NULL)
310                     AND (X_Quote_Type_Lookup_Code IS NULL)))
311            AND (   (Recinfo.quotation_class_code = X_Quotation_Class_Code)
312                 OR (    (Recinfo.quotation_class_code IS NULL)
313                     AND (X_Quotation_Class_Code IS NULL)))
314            AND (   (Recinfo.quote_warning_delay_unit = X_Quote_Warning_Delay_Unit)
315                 OR (    (Recinfo.quote_warning_delay_unit IS NULL)
316                     AND (X_Quote_Warning_Delay_Unit IS NULL)))
317            AND (   (Recinfo.quote_warning_delay = X_Quote_Warning_Delay)
318                 OR (    (Recinfo.quote_warning_delay IS NULL)
319                     AND (X_Quote_Warning_Delay IS NULL)))
320            AND (   (Recinfo.quote_vendor_quote_number = X_Quote_Vendor_Quote_Number)
321                 OR (    (Recinfo.quote_vendor_quote_number IS NULL)
322                     AND (X_Quote_Vendor_Quote_Number IS NULL)))
323            AND (   (Recinfo.acceptance_required_flag = X_Acceptance_Required_Flag)
324                 OR (    (Recinfo.acceptance_required_flag IS NULL)
325                     AND (X_Acceptance_Required_Flag IS NULL)))
326            AND (   (trunc(Recinfo.acceptance_due_date) = trunc(X_Acceptance_Due_Date))
327                 OR (    (Recinfo.acceptance_due_date IS NULL)
328                     AND (X_Acceptance_Due_Date IS NULL)))
329            AND (   (trunc(Recinfo.closed_date) = trunc(X_Closed_Date))
330                 OR (    (Recinfo.closed_date IS NULL)
331                     AND (X_Closed_Date IS NULL)))
332            AND (   (Recinfo.user_hold_flag = X_User_Hold_Flag)
333                 OR (    (Recinfo.user_hold_flag IS NULL)
334                     AND (X_User_Hold_Flag IS NULL)))
335            AND (   (Recinfo.approval_required_flag = X_Approval_Required_Flag)
336                 OR (    (Recinfo.approval_required_flag IS NULL)
337                     AND (X_Approval_Required_Flag IS NULL)))
338            AND (   (Recinfo.cancel_flag = X_Cancel_Flag)
339                 OR (    (Recinfo.cancel_flag IS NULL)
340                     AND (X_Cancel_Flag IS NULL)))
341            AND (   (Recinfo.firm_status_lookup_code = X_Firm_Status_Lookup_Code)
342                 OR (    (Recinfo.firm_status_lookup_code IS NULL)
343                     AND (X_Firm_Status_Lookup_Code IS NULL)))
344            AND (   (trunc(Recinfo.firm_date) = trunc(X_Firm_Date))
345                 OR (    (Recinfo.firm_date IS NULL)
346                     AND (X_Firm_Date IS NULL)))
347            AND (   (Recinfo.frozen_flag = X_Frozen_Flag)
348                 OR (    (Recinfo.frozen_flag IS NULL)
349                     AND (X_Frozen_Flag IS NULL)))
350            AND (   (Recinfo.attribute_category = X_Attribute_Category)
351                 OR (    (Recinfo.attribute_category IS NULL)
352                     AND (X_Attribute_Category IS NULL)))
353            AND (   (Recinfo.attribute1 = X_Attribute1)
354                 OR (    (Recinfo.attribute1 IS NULL)
355                     AND (X_Attribute1 IS NULL)))
356            AND (   (Recinfo.attribute2 = X_Attribute2)
357                 OR (    (Recinfo.attribute2 IS NULL)
358                     AND (X_Attribute2 IS NULL)))
359            AND (   (Recinfo.attribute3 = X_Attribute3)
360                 OR (    (Recinfo.attribute3 IS NULL)
361                     AND (X_Attribute3 IS NULL)))
362            AND (   (Recinfo.attribute4 = X_Attribute4)
363                 OR (    (Recinfo.attribute4 IS NULL)
364                     AND (X_Attribute4 IS NULL)))
365            AND (   (Recinfo.attribute5 = X_Attribute5)
366                 OR (    (Recinfo.attribute5 IS NULL)
367                     AND (X_Attribute5 IS NULL)))
368            AND (   (Recinfo.attribute6 = X_Attribute6)
369                 OR (    (Recinfo.attribute6 IS NULL)
370                     AND (X_Attribute6 IS NULL)))
371            AND (   (Recinfo.attribute7 = X_Attribute7)
372                 OR (    (Recinfo.attribute7 IS NULL)
373                     AND (X_Attribute7 IS NULL)))
374            AND (   (Recinfo.attribute8 = X_Attribute8)
375                 OR (    (Recinfo.attribute8 IS NULL)
376                     AND (X_Attribute8 IS NULL)))
377            AND (   (Recinfo.attribute9 = X_Attribute9)
378                 OR (    (Recinfo.attribute9 IS NULL)
379                     AND (X_Attribute9 IS NULL)))
380            AND (   (Recinfo.attribute10 = X_Attribute10)
381                 OR (    (Recinfo.attribute10 IS NULL)
385                     AND (X_Attribute11 IS NULL)))
382                     AND (X_Attribute10 IS NULL)))
383            AND (   (Recinfo.attribute11 = X_Attribute11)
384                 OR (    (Recinfo.attribute11 IS NULL)
386            AND (   (Recinfo.attribute12 = X_Attribute12)
387                 OR (    (Recinfo.attribute12 IS NULL)
388                     AND (X_Attribute12 IS NULL)))
389            AND (   (Recinfo.attribute13 = X_Attribute13)
390                 OR (    (Recinfo.attribute13 IS NULL)
391                     AND (X_Attribute13 IS NULL)))
392            AND (   (Recinfo.attribute14 = X_Attribute14)
393                 OR (    (Recinfo.attribute14 IS NULL)
394                     AND (X_Attribute14 IS NULL)))
395            AND (   (Recinfo.attribute15 = X_Attribute15)
396                 OR (    (Recinfo.attribute15 IS NULL)
397                     AND (X_Attribute15 IS NULL)))
398            AND (   (Recinfo.closed_code = X_Closed_Code)
399                 OR (    (Recinfo.closed_code IS NULL)
400                     AND (X_Closed_Code IS NULL)))
401            AND (   (Recinfo.government_context = X_Government_Context)
402                 OR (    (Recinfo.government_context IS NULL)
403                     AND (X_Government_Context IS NULL)))
404            AND (   (Recinfo.Supply_Agreement_Flag = X_Supply_Agreement_Flag)
405                 OR (    (Recinfo.Supply_Agreement_Flag IS NULL)
406                     AND (X_Supply_Agreement_Flag IS NULL)))
407            AND (   (Recinfo.Price_Update_Tolerance = X_Price_Update_Tolerance)
408                 OR (    (Recinfo.Price_Update_Tolerance IS NULL)
409                     AND (X_Price_Update_Tolerance IS NULL)))
410            AND (   (Recinfo.global_attribute_category = X_Global_Attribute_Category)
411                 OR (    (Recinfo.global_attribute_category IS NULL)
412                     AND (X_Global_Attribute_Category IS NULL)))
413            AND (   (Recinfo.global_attribute1 = X_Global_Attribute1)
414                 OR (    (Recinfo.global_attribute1 IS NULL)
415                     AND (X_Global_Attribute1 IS NULL)))
416            AND (   (Recinfo.global_attribute2 = X_Global_Attribute2)
417                 OR (    (Recinfo.global_attribute2 IS NULL)
418                     AND (X_Global_Attribute2 IS NULL)))
419            AND (   (Recinfo.global_attribute3 = X_Global_Attribute3)
420                 OR (    (Recinfo.global_attribute3 IS NULL)
421                     AND (X_Global_Attribute3 IS NULL)))
422            AND (   (Recinfo.global_attribute4 = X_Global_Attribute4)
423                 OR (    (Recinfo.global_attribute4 IS NULL)
424                     AND (X_Global_Attribute4 IS NULL)))
425            AND (   (Recinfo.global_attribute5 = X_Global_Attribute5)
426                 OR (    (Recinfo.global_attribute5 IS NULL)
427                     AND (X_Global_Attribute5 IS NULL)))
428            AND (   (Recinfo.global_attribute6 = X_Global_Attribute6)
429                 OR (    (Recinfo.global_attribute6 IS NULL)
430                     AND (X_Global_Attribute6 IS NULL)))
431            AND (   (Recinfo.global_attribute7 = X_Global_Attribute7)
432                 OR (    (Recinfo.global_attribute7 IS NULL)
433                     AND (X_Global_Attribute7 IS NULL)))
434            AND (   (Recinfo.global_attribute8 = X_Global_Attribute8)
435                 OR (    (Recinfo.global_attribute8 IS NULL)
436                     AND (X_Global_Attribute8 IS NULL)))
437            AND (   (Recinfo.global_attribute9 = X_Global_Attribute9)
438                 OR (    (Recinfo.global_attribute9 IS NULL)
439                     AND (X_Global_Attribute9 IS NULL)))
440            AND (   (Recinfo.global_attribute10 = X_Global_Attribute10)
441                 OR (    (Recinfo.global_attribute10 IS NULL)
442                     AND (X_Global_Attribute10 IS NULL)))
443            AND (   (Recinfo.global_attribute11 = X_Global_Attribute11)
444                 OR (    (Recinfo.global_attribute11 IS NULL)
445                     AND (X_Global_Attribute11 IS NULL)))
446            AND (   (Recinfo.global_attribute12 = X_Global_Attribute12)
447                 OR (    (Recinfo.global_attribute12 IS NULL)
448                     AND (X_Global_Attribute12 IS NULL)))
449            AND (   (Recinfo.global_attribute13 = X_Global_Attribute13)
450                 OR (    (Recinfo.global_attribute13 IS NULL)
451                     AND (X_Global_Attribute13 IS NULL)))
452            AND (   (Recinfo.global_attribute14 = X_Global_Attribute14)
453                 OR (    (Recinfo.global_attribute14 IS NULL)
454                     AND (X_Global_Attribute14 IS NULL)))
455            AND (   (Recinfo.global_attribute15 = X_Global_Attribute15)
456                 OR (    (Recinfo.global_attribute15 IS NULL)
457                     AND (X_Global_Attribute15 IS NULL)))
458            AND (   (Recinfo.global_attribute16 = X_Global_Attribute16)
459                 OR (    (Recinfo.global_attribute16 IS NULL)
460                     AND (X_Global_Attribute16 IS NULL)))
461            AND (   (Recinfo.global_attribute17 = X_Global_Attribute17)
462                 OR (    (Recinfo.global_attribute17 IS NULL)
463                     AND (X_Global_Attribute17 IS NULL)))
464            AND (   (Recinfo.global_attribute18 = X_Global_Attribute18)
465                 OR (    (Recinfo.global_attribute18 IS NULL)
466                     AND (X_Global_Attribute18 IS NULL)))
467            AND (   (Recinfo.global_attribute19 = X_Global_Attribute19)
468                 OR (    (Recinfo.global_attribute19 IS NULL)
469                     AND (X_Global_Attribute19 IS NULL)))
470            AND (   (Recinfo.global_attribute20 = X_Global_Attribute20)
471                 OR (    (Recinfo.global_attribute20 IS NULL)
472                     AND (X_Global_Attribute20 IS NULL)))
473             ) then
474 
475         -- Bug 2701425. If print_count and printed_date are different, then
476         -- update the new parameters with the values from the database.
477         IF (nvl(recinfo.print_count,-99) <> nvl(x_print_count,-99)) THEN
478             x_new_print_count := recinfo.print_count;
479         END IF;
480 
481         IF ((TRUNC(recinfo.printed_date) <> TRUNC(x_printed_date)) OR
482             (recinfo.printed_date IS NULL AND x_printed_date IS NOT NULL) OR
483             (recinfo.printed_date IS NOT NULL AND x_printed_date IS NULL))
484         THEN
485             x_new_printed_date := recinfo.printed_date;
486         END IF;
487 
488         return;
489     else
490       IF (g_fnd_debug = 'Y') THEN
491           IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_ERROR) THEN
492             FND_LOG.string(FND_LOG.level_error, g_module_prefix || 'lock_row.010',
493                          'Failed second if statement when comparing fields');
494           END IF;
495       END IF;
496       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
497       APP_EXCEPTION.RAISE_EXCEPTION;
498     end if;
499   else
500       IF (g_fnd_debug = 'Y') THEN
501           IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_ERROR) THEN
502             FND_LOG.string(FND_LOG.level_error, g_module_prefix || 'lock_row.020',
503                          'Failed first if statement when comparing fields');
504           END IF;
505       END IF;
506       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
507       APP_EXCEPTION.RAISE_EXCEPTION;
508 
509   end if;
510 
511   END Lock_Row;
512 
513 END PO_HEADERS_PKG_S1;