DBA Data[Home] [Help]

PACKAGE BODY: APPS.PO_DISTRIBUTIONS_PKG2

Source


1 PACKAGE BODY PO_DISTRIBUTIONS_PKG2 as
2 /* $Header: POXP2PDB.pls 120.5.12020000.3 2013/02/10 23:58:36 vegajula ship $ */
3 c_log_head    CONSTANT VARCHAR2(35) := 'po.plsql.PO_DISTRIBUTIONS_PKG2.';
4 
5 g_fnd_debug CONSTANT VARCHAR2(1) := NVL(FND_PROFILE.VALUE('AFLOG_ENABLED'),'N');
6 
7   PROCEDURE Lock_Row(X_Rowid                            VARCHAR2,
8                      X_Po_Distribution_Id               NUMBER,
9                      X_Po_Header_Id                     NUMBER,
10                      X_Po_Line_Id                       NUMBER,
11                      X_Line_Location_Id                 NUMBER,
12                      X_Set_Of_Books_Id                  NUMBER,
13                      X_Code_Combination_Id              NUMBER,
14                      X_Quantity_Ordered                 NUMBER,
15                      X_Po_Release_Id                    NUMBER,
16                      X_Quantity_Delivered               NUMBER,
17                      X_Quantity_Billed                  NUMBER,
18                      X_Quantity_Cancelled               NUMBER,
19                      X_Req_Header_Reference_Num         VARCHAR2,
20                      X_Req_Line_Reference_Num           VARCHAR2,
21                      X_Req_Distribution_Id              NUMBER,
22                      X_Deliver_To_Location_Id           NUMBER,
23                      X_Deliver_To_Person_Id             NUMBER,
24                      X_Rate_Date                        DATE,
25                      X_Rate                             NUMBER,
26                      X_Amount_Billed                    NUMBER,
27                      X_Accrued_Flag                     VARCHAR2,
28                      X_Encumbered_Flag                  VARCHAR2,
29                      X_Encumbered_Amount                NUMBER,
30                      X_Unencumbered_Quantity            NUMBER,
31                      X_Unencumbered_Amount              NUMBER,
32                      X_Failed_Funds_Lookup_Code         VARCHAR2,
33                      X_Gl_Encumbered_Date               DATE,
34                      X_Gl_Encumbered_Period_Name        VARCHAR2,
35                      X_Gl_Cancelled_Date                DATE,
36                      X_Destination_Type_Code            VARCHAR2,
37                      X_Destination_Organization_Id      NUMBER,
38                      X_Destination_Subinventory         VARCHAR2,
39                      X_Attribute_Category               VARCHAR2,
40                      X_Attribute1                       VARCHAR2,
41                      X_Attribute2                       VARCHAR2,
42                      X_Attribute3                       VARCHAR2,
43                      X_Attribute4                       VARCHAR2,
44                      X_Attribute5                       VARCHAR2,
45                      X_Attribute6                       VARCHAR2,
46                      X_Attribute7                       VARCHAR2,
47                      X_Attribute8                       VARCHAR2,
48                      X_Attribute9                       VARCHAR2,
49                      X_Attribute10                      VARCHAR2,
50                      X_Attribute11                      VARCHAR2,
51                      X_Attribute12                      VARCHAR2,
52                      X_Attribute13                      VARCHAR2,
53                      X_Attribute14                      VARCHAR2,
54                      X_Attribute15                      VARCHAR2,
55                      X_Wip_Entity_Id                    NUMBER,
56                      X_Wip_Operation_Seq_Num            NUMBER,
57                      X_Wip_Resource_Seq_Num             NUMBER,
58                      X_Wip_Repetitive_Schedule_Id       NUMBER,
59                      X_Wip_Line_Id                      NUMBER,
60                      X_Bom_Resource_Id                  NUMBER,
61                      X_Budget_Account_Id                NUMBER,
62                      X_Accrual_Account_Id               NUMBER,
63                      X_Variance_Account_Id              NUMBER,
64 
65                      --< Shared Proc FPJ Start >
66                      p_dest_charge_account_id           NUMBER,
67                      p_dest_variance_account_id         NUMBER,
68                      --< Shared Proc FPJ End >
69 
70                      X_Prevent_Encumbrance_Flag         VARCHAR2,
71                      X_Ussgl_Transaction_Code           VARCHAR2,
72                      X_Government_Context               VARCHAR2,
73                      X_Destination_Context              VARCHAR2,
74                      X_Distribution_Num                 NUMBER,
75                      X_Source_Distribution_Id           NUMBER,
76                      X_Project_Id                       NUMBER,
77                      X_Task_Id                          NUMBER,
78                      X_Expenditure_Type                 VARCHAR2,
79                      X_Project_Accounting_Context       VARCHAR2,
80                      X_Expenditure_Organization_Id      NUMBER,
81                      X_Gl_Closed_Date                   DATE,
82                      X_Accrue_On_Receipt_Flag           VARCHAR2,
83                      X_Expenditure_Item_Date            DATE,
84                      X_End_Item_Unit_Number             VARCHAR2 DEFAULT NULL,
85                      X_Recovery_Rate                    NUMBER,
86                      X_Tax_Recovery_Override_Flag       VARCHAR2,
87                      X_amount_ordered                   NUMBER,  -- <SERVICES FPJ>
88                      X_amount_to_encumber               NUMBER DEFAULT NULL, --<ENCUMBRANCE FPJ>
89                      X_distribution_type                VARCHAR2 DEFAULT NULL --<ENCUMBRANCE FPJ>
90   ) IS
91     CURSOR C IS
92         SELECT *
93         FROM   PO_DISTRIBUTIONS
94         WHERE  rowid = X_Rowid
95         FOR UPDATE of Po_Distribution_Id NOWAIT;
96     Recinfo C%ROWTYPE;
97     -- For debug purposes(lswamy)
98     l_api_name CONSTANT VARCHAR2(30) := 'Lock_Row';
99   BEGIN
100     IF (g_fnd_debug = 'Y') THEN
101       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name || '.begin','lock rows');
102     END IF;
103     OPEN C;
104     FETCH C INTO Recinfo;
105     if (C%NOTFOUND) then
106       CLOSE C;
107       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_DELETED');
108       APP_EXCEPTION.Raise_Exception;
109     end if;
110     CLOSE C;
111 
112     IF
113                (Recinfo.po_distribution_id = X_Po_Distribution_Id)
114            AND (Recinfo.po_header_id = X_Po_Header_Id)
115    --<ENCUMBRANCE FPJ START>
116            AND (   (Recinfo.po_line_id = X_Po_Line_Id)
117                OR  (    (Recinfo.po_line_id IS NULL)
118                     AND (X_Po_Line_Id IS NULL)))
119            AND (   (Recinfo.line_location_id = X_Line_Location_Id)
120                OR  (    (Recinfo.line_location_id IS NULL)
121                     AND (X_Line_Location_Id IS NULL)))
122   --<ENCUMBRANCE FPJ END>
123            AND (Recinfo.set_of_books_id = X_Set_Of_Books_Id)
127                     AND (X_Code_Combination_Id IS NULL)))
124    --<ENCUMBRANCE FPJ START>
125            AND (   (Recinfo.code_combination_id = X_Code_Combination_Id)
126                OR  (    (Recinfo.code_combination_id IS NULL)
128            AND (   (Recinfo.quantity_ordered = X_Quantity_Ordered)
129                OR  (    (Recinfo.quantity_ordered IS NULL)
130                     AND (X_Quantity_Ordered IS NULL)))
131   --<ENCUMBRANCE FPJ END>
132            AND (   (Recinfo.po_release_id = X_Po_Release_Id)
133                 OR (    (Recinfo.po_release_id IS NULL)
134                     AND (X_Po_Release_Id IS NULL)))
135          /*  AND (   (Recinfo.quantity_delivered = X_Quantity_Delivered)
136                 OR (    (Recinfo.quantity_delivered IS NULL)
137                     AND (X_Quantity_Delivered IS NULL)))
138            AND (   (Recinfo.quantity_billed = X_Quantity_Billed)
139                 OR (    (Recinfo.quantity_billed IS NULL)
140                     AND (X_Quantity_Billed IS NULL)))
141            <Bug# 3464561> Following three lines commented out too.
142            AND (   (Recinfo.quantity_cancelled = X_Quantity_Cancelled)
143                 OR (    (Recinfo.quantity_cancelled IS NULL)
144                     AND (X_Quantity_Cancelled IS NULL))) */
145            AND (   (TRIM(Recinfo.req_header_reference_num) = TRIM(X_Req_Header_Reference_Num))
146                 OR (    (TRIM(Recinfo.req_header_reference_num) IS NULL)
147                     AND (TRIM(X_Req_Header_Reference_Num) IS NULL)))
148            AND (   (TRIM(Recinfo.req_line_reference_num) = TRIM(X_Req_Line_Reference_Num))
149                 OR (    (TRIM(Recinfo.req_line_reference_num) IS NULL)
150                     AND (TRIM(X_Req_Line_Reference_Num) IS NULL)))
151            AND (   (Recinfo.req_distribution_id = X_Req_Distribution_Id)
152                 OR (    (Recinfo.req_distribution_id IS NULL)
153                     AND (X_Req_Distribution_Id IS NULL)))
154            AND (   (Recinfo.deliver_to_location_id = X_Deliver_To_Location_Id)
155                 OR (    (Recinfo.deliver_to_location_id IS NULL)
156                     AND (X_Deliver_To_Location_Id IS NULL)))
157            AND (   (Recinfo.deliver_to_person_id = X_Deliver_To_Person_Id)
158                 OR (    (Recinfo.deliver_to_person_id IS NULL)
159                     AND (X_Deliver_To_Person_Id IS NULL)))
160            AND (   (trunc(Recinfo.rate_date) = trunc(X_Rate_Date))
161                 OR (    (Recinfo.rate_date IS NULL)
162                     AND (X_Rate_Date IS NULL)))
163            AND (   (Recinfo.rate = X_Rate)
164                 OR (    (Recinfo.rate IS NULL)
165                     AND (X_Rate IS NULL)))
166            AND (   (Recinfo.amount_billed = X_Amount_Billed)
167                 OR (    (Recinfo.amount_billed IS NULL)
168                     AND (X_Amount_Billed IS NULL)))
169            AND (   (Recinfo.recovery_rate = X_Recovery_Rate)
170                 OR (    (Recinfo.recovery_rate IS NULL)
171                     AND (X_Recovery_Rate IS NULL)))
172            AND (   (TRIM(Recinfo.accrued_flag) = TRIM(X_Accrued_Flag))
173                 OR (    (TRIM(Recinfo.accrued_flag) IS NULL)
174                     AND (TRIM(X_Accrued_Flag) IS NULL)))
175            AND (   (TRIM(Recinfo.encumbered_flag) = TRIM(X_Encumbered_Flag))
176                 OR (    (TRIM(Recinfo.encumbered_flag) IS NULL)
177                     AND (TRIM(X_Encumbered_Flag) IS NULL)))
178            AND (   (Recinfo.encumbered_amount = X_Encumbered_Amount)
179                 OR (    (Recinfo.encumbered_amount IS NULL)
180                     AND (X_Encumbered_Amount IS NULL)))
181            AND (   (Recinfo.unencumbered_quantity = X_Unencumbered_Quantity)
182                 OR (    (Recinfo.unencumbered_quantity IS NULL)
183                     AND (X_Unencumbered_Quantity IS NULL)))
184            AND (   (Recinfo.unencumbered_amount = X_Unencumbered_Amount)
185                 OR (    (Recinfo.unencumbered_amount IS NULL)
186                     AND (X_Unencumbered_Amount IS NULL)))
187    --<ENCUMBRANCE FPJ START>
188            AND (   (Recinfo.amount_to_encumber = X_amount_to_encumber)
189                 OR (    (Recinfo.amount_to_encumber IS NULL)
190                     AND (X_amount_to_encumber IS NULL)))
191            AND (   (TRIM(Recinfo.distribution_type) = TRIM(X_distribution_type))
192                 OR (    (TRIM(Recinfo.distribution_type) IS NULL)
193                     AND (TRIM(X_distribution_type) IS NULL)))
194    --<ENCUMBRANCE FPJ END>
195            AND (   (TRIM(Recinfo.failed_funds_lookup_code) = TRIM(X_Failed_Funds_Lookup_Code))
196                 OR (    (TRIM(Recinfo.failed_funds_lookup_code) IS NULL)
197                     AND (TRIM(X_Failed_Funds_Lookup_Code) IS NULL)))
198            AND (   (trunc(Recinfo.gl_encumbered_date) = trunc(X_Gl_Encumbered_Date))
199                 OR (    (Recinfo.gl_encumbered_date IS NULL)
200                     AND (X_Gl_Encumbered_Date IS NULL)))
204            AND (   (trunc(Recinfo.gl_cancelled_date) = trunc(X_Gl_Cancelled_Date))
201            AND (   (TRIM(Recinfo.gl_encumbered_period_name) = TRIM(X_Gl_Encumbered_Period_Name))
202                 OR (    (TRIM(Recinfo.gl_encumbered_period_name) IS NULL)
203                     AND (TRIM(X_Gl_Encumbered_Period_Name) IS NULL)))
205                 OR (    (Recinfo.gl_cancelled_date IS NULL)
206                     AND (X_Gl_Cancelled_Date IS NULL)))
207            AND (   (TRIM(Recinfo.destination_type_code) = TRIM(X_Destination_Type_Code))
208                 OR (    (TRIM(Recinfo.destination_type_code) IS NULL)
209                     AND (TRIM(X_Destination_Type_Code) IS NULL)))
210            AND (   (Recinfo.destination_organization_id = X_Destination_Organization_Id)
211                 OR (    (Recinfo.destination_organization_id IS NULL)
212                     AND (X_Destination_Organization_Id IS NULL)))
213            AND (   (TRIM(Recinfo.destination_subinventory) = TRIM(X_Destination_Subinventory))
214                 OR (    (TRIM(Recinfo.destination_subinventory) IS NULL)
215                     AND (TRIM(X_Destination_Subinventory) IS NULL)))
216            -- <SERVICES FPJ START>
217            AND (   (Recinfo.amount_ordered = X_amount_ordered)
218                 OR (    (Recinfo.amount_ordered IS NULL)
219                     AND (X_amount_ordered IS NULL)))
220            -- <SERVICES FPJ END>
221            THEN
222            IF
223                (   (TRIM(Recinfo.attribute_category) = TRIM(X_Attribute_Category))
224                 OR (    (TRIM(Recinfo.attribute_category) IS NULL)
225                     AND (TRIM(X_Attribute_Category) IS NULL)))
226            AND (   (TRIM(Recinfo.attribute1) = TRIM(X_Attribute1))
227                 OR (    (TRIM(Recinfo.attribute1) IS NULL)
228                     AND (TRIM(X_Attribute1) IS NULL)))
229            AND (   (TRIM(Recinfo.attribute2) = TRIM(X_Attribute2))
230                 OR (    (TRIM(Recinfo.attribute2) IS NULL)
231                     AND (TRIM(X_Attribute2) IS NULL)))
232            AND (   (TRIM(Recinfo.attribute3) = TRIM(X_Attribute3))
233                 OR (    (TRIM(Recinfo.attribute3) IS NULL)
234                     AND (TRIM(X_Attribute3) IS NULL)))
235            AND (   (TRIM(Recinfo.attribute4) = TRIM(X_Attribute4))
236                 OR (    (TRIM(Recinfo.attribute4) IS NULL)
237                     AND (TRIM(X_Attribute4) IS NULL)))
238            AND (   (TRIM(Recinfo.attribute5) = TRIM(X_Attribute5))
239                 OR (    (TRIM(Recinfo.attribute5) IS NULL)
240                     AND (TRIM(X_Attribute5) IS NULL)))
241            AND (   (TRIM(Recinfo.attribute6) = TRIM(X_Attribute6))
242                 OR (    (TRIM(Recinfo.attribute6) IS NULL)
243                     AND (TRIM(X_Attribute6) IS NULL)))
244            AND (   (TRIM(Recinfo.attribute7) = TRIM(X_Attribute7))
245                 OR (    (TRIM(Recinfo.attribute7) IS NULL)
246                     AND (TRIM(X_Attribute7) IS NULL)))
247            AND (   (TRIM(Recinfo.attribute8) = TRIM(X_Attribute8))
248                 OR (    (TRIM(Recinfo.attribute8) IS NULL)
249                     AND (TRIM(X_Attribute8) IS NULL)))
250            AND (   (TRIM(Recinfo.attribute9) = TRIM(X_Attribute9))
251                 OR (    (TRIM(Recinfo.attribute9) IS NULL)
252                     AND (TRIM(X_Attribute9) IS NULL)))
253            AND (   (TRIM(Recinfo.attribute10) = TRIM(X_Attribute10))
254                 OR (    (TRIM(Recinfo.attribute10) IS NULL)
255                     AND (TRIM(X_Attribute10) IS NULL)))
256            AND (   (TRIM(Recinfo.attribute11) = TRIM(X_Attribute11))
257                 OR (    (TRIM(Recinfo.attribute11) IS NULL)
258                     AND (TRIM(X_Attribute11) IS NULL)))
259            AND (   (TRIM(Recinfo.attribute12) = TRIM(X_Attribute12))
260                 OR (    (TRIM(Recinfo.attribute12) IS NULL)
261                     AND (TRIM(X_Attribute12) IS NULL)))
262            AND (   (TRIM(Recinfo.attribute13) = TRIM(X_Attribute13))
263                 OR (    (TRIM(Recinfo.attribute13) IS NULL)
264                     AND (TRIM(X_Attribute13) IS NULL)))
265            AND (   (TRIM(Recinfo.attribute14) = TRIM(X_Attribute14))
266                 OR (    (TRIM(Recinfo.attribute14) IS NULL)
267                     AND (TRIM(X_Attribute14) IS NULL)))
268            AND (   (TRIM(Recinfo.attribute15) = TRIM(X_Attribute15))
269                 OR (    (TRIM(Recinfo.attribute15) IS NULL)
270                      AND (TRIM(X_Attribute15) IS NULL)))           THEN
271 
272           IF
273               (   (Recinfo.wip_entity_id = X_Wip_Entity_Id)
274                 OR (    (Recinfo.wip_entity_id IS NULL)
275                     AND (X_Wip_Entity_Id IS NULL)))
276            AND (   (Recinfo.wip_operation_seq_num = X_Wip_Operation_Seq_Num)
277                 OR (    (Recinfo.wip_operation_seq_num IS NULL)
278                     AND (X_Wip_Operation_Seq_Num IS NULL)))
279            AND (   (Recinfo.wip_resource_seq_num = X_Wip_Resource_Seq_Num)
280                 OR (    (Recinfo.wip_resource_seq_num IS NULL)
281                     AND (X_Wip_Resource_Seq_Num IS NULL)))
282            AND (   (Recinfo.wip_repetitive_schedule_id = X_Wip_Repetitive_Schedule_Id)
283                 OR (    (Recinfo.wip_repetitive_schedule_id IS NULL)
284                     AND (X_Wip_Repetitive_Schedule_Id IS NULL)))
285            AND (   (Recinfo.wip_line_id = X_Wip_Line_Id)
286                 OR (    (Recinfo.wip_line_id IS NULL)
287                     AND (X_Wip_Line_Id IS NULL)))
288            AND (   (Recinfo.bom_resource_id = X_Bom_Resource_Id)
289                 OR (    (Recinfo.bom_resource_id IS NULL)
290                     AND (X_Bom_Resource_Id IS NULL)))
291            AND (   (Recinfo.budget_account_id = X_Budget_Account_Id)
292                 OR (    (Recinfo.budget_account_id IS NULL)
293                     AND (X_Budget_Account_Id IS NULL)))
294            AND (   (Recinfo.accrual_account_id = X_Accrual_Account_Id)
295                 OR (    (Recinfo.accrual_account_id IS NULL)
296                     AND (X_Accrual_Account_Id IS NULL)))
300            AND (   (TRIM(Recinfo.prevent_encumbrance_flag) = TRIM(X_Prevent_Encumbrance_Flag))
297            AND (   (Recinfo.variance_account_id = X_Variance_Account_Id)
298                 OR (    (Recinfo.variance_account_id IS NULL)
299                     AND (X_Variance_Account_Id IS NULL)))
301                 OR (    (TRIM(Recinfo.prevent_encumbrance_flag) IS NULL)
302                     AND (TRIM(X_Prevent_Encumbrance_Flag) IS NULL)))
303            AND (   (TRIM(Recinfo.government_context)= TRIM(X_Government_Context))
304                 OR (    (TRIM(Recinfo.government_context) IS NULL)
305                     AND (TRIM(X_Government_Context) IS NULL)))
306            AND (   (TRIM(Recinfo.destination_context) = TRIM(X_Destination_Context))
307                 OR (    (TRIM(Recinfo.destination_context) IS NULL)
308                     AND (TRIM(X_Destination_Context) IS NULL)))
309            AND (Recinfo.distribution_num = X_Distribution_Num)
310            AND (   (Recinfo.source_distribution_id = X_Source_Distribution_Id)
311                 OR (    (Recinfo.source_distribution_id IS NULL)
312                     AND (X_Source_Distribution_Id IS NULL)))
313            AND (   (Recinfo.project_id = X_Project_Id)
314                 OR (    (Recinfo.project_id IS NULL)
315                     AND (X_Project_Id IS NULL)))
316            AND (   (Recinfo.task_id = X_Task_Id)
317                 OR (    (Recinfo.task_id IS NULL)
318                     AND (X_Task_Id IS NULL)))
319            AND (   (TRIM(Recinfo.end_item_unit_number) = TRIM(X_End_Item_Unit_Number))
320                 OR (    (TRIM(Recinfo.end_item_unit_number) IS NULL)
321                     AND (TRIM(X_End_Item_Unit_Number) IS NULL)))
322            AND (   (TRIM(Recinfo.expenditure_type) = TRIM(X_Expenditure_Type))
323                 OR (    (TRIM(Recinfo.expenditure_type) IS NULL)
324                     AND (TRIM(X_Expenditure_Type) IS NULL)))
325            AND (   (TRIM(Recinfo.project_accounting_context) = TRIM(X_Project_Accounting_Context))
326                 OR (    (TRIM(Recinfo.project_accounting_context) IS NULL)
327                     AND (TRIM(X_Project_Accounting_Context) IS NULL)))
328            AND (   (Recinfo.expenditure_organization_id = X_Expenditure_Organization_Id)
329                 OR (    (Recinfo.expenditure_organization_id IS NULL)
330                     AND (X_Expenditure_Organization_Id IS NULL)))
331            AND (   (trunc(Recinfo.gl_closed_date) = trunc(X_Gl_Closed_Date))
332                 OR (    (Recinfo.gl_closed_date IS NULL)
333                     AND (X_Gl_Closed_Date IS NULL)))
334            AND (   (TRIM(Recinfo.accrue_on_receipt_flag) = TRIM(X_Accrue_On_Receipt_Flag))
335                 OR (    (TRIM(Recinfo.accrue_on_receipt_flag) IS NULL)
336                     AND (TRIM(X_Accrue_On_Receipt_Flag) IS NULL)))
337            AND (   (trunc(Recinfo.expenditure_item_date) = trunc(X_Expenditure_Item_Date))
338                 OR (    (Recinfo.expenditure_item_date IS NULL)
339                     AND (X_Expenditure_Item_Date IS NULL)))
340 
341            --< Shared Proc FPJ Start >
345            AND ( (RECINFO.dest_variance_account_id = p_dest_variance_account_id)
342            AND ( (RECINFO.dest_charge_account_id = p_dest_charge_account_id)
343                 OR (    (RECINFO.dest_charge_account_id IS NULL)
344                     AND (p_dest_charge_account_id IS NULL)))
346                 OR (    (RECINFO.dest_variance_account_id IS NULL)
347                     AND (p_dest_variance_account_id IS NULL)))
348            --< Shared Proc FPJ End >
349 
350 
351                      THEN
352                   IF (g_fnd_debug = 'Y') THEN
353                     FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name || '.end','no lock error');
354                   END IF;
355 
356                   return;
357 
358               END IF;
359             END IF;
360          END IF;
361     /*
362     ** If we get to this point then a column has been changed.
363     */
364 
365     --only display discrepancy when fnd debug is enabled
366     IF (g_fnd_debug = 'Y') THEN
367 
368 
369     if (nvl(X_Po_Distribution_Id,-999) <> nvl(Recinfo.Po_Distribution_Id,-999)   ) then
370       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Po_Distribution_Id '||X_Po_Distribution_Id ||' Database  Po_Distribution_Id '||Recinfo.Po_Distribution_Id);
371     end if;
372     if (nvl(X_Po_Header_Id ,-999) <> nvl(Recinfo.Po_Header_Id,-999)   ) then
373      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Po_Header_Id '||X_Po_Header_Id ||' Database  Po_Header_Id '||Recinfo.Po_Header_Id);
374     end if;
375     if (nvl(X_Po_Line_Id,-999) <> nvl(Recinfo.Po_Line_Id,-999)) then
376      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Po_Line_Id '||X_Po_Line_Id||' Database  Po_Line_Id '||Recinfo.Po_Line_Id);
377     end if;
378     if (nvl(X_Line_Location_Id ,-999) <> nvl( Recinfo.Line_Location_Id,-999)) then
382      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Set_Of_Books_Id '||X_Set_Of_Books_Id ||' Database  Set_Of_Books_Id '||Recinfo.Set_Of_Books_Id);
379      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Line_Location_Id '||X_Line_Location_Id ||' Database  Line_Location_Id '||Recinfo.Line_Location_Id);
380     end if;
381     if (nvl(X_Set_Of_Books_Id,-999) <> nvl( Recinfo.Set_Of_Books_Id,-999)) then
383     end if;
384     if (nvl(X_Code_Combination_Id,-999) <> nvl( Recinfo.Code_Combination_Id,-999)) then
385      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Code_Combination_Id '||X_Code_Combination_Id ||' Database  Code_Combination_Id '||Recinfo.Code_Combination_Id);
386     end if;
387 
388     po_wf_debug_pkg.insert_Debug('lak','lak','foloing should fail 1');
389     if (nvl(X_Quantity_Ordered ,-999) <> nvl( Recinfo.Quantity_Ordered ,-999)) then
390     po_wf_debug_pkg.insert_Debug('lak','lak','foloing should fail 5');
391      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Quantity_Ordered '||X_Quantity_Ordered ||' Database  Quantity_Ordered '||Recinfo.Quantity_Ordered);
392     end if;
393     if (nvl(X_Po_Release_Id ,-999) <> nvl( Recinfo.Po_Release_Id ,-999)) then
394      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Po_Release_Id '||X_Po_Release_Id ||' Database  Po_Release_Id '||Recinfo.Po_Release_Id);
395     end if;
396     if (nvl(X_Req_Header_Reference_Num,-999) <> nvl( Recinfo.Req_Header_Reference_Num,-999)) then
397      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Req_Header_Reference_Num '||X_Req_Header_Reference_Num ||' Database  Req_Header_Reference_Num '||Recinfo.Req_Header_Reference_Num);
398     end if;
399     if (nvl(X_Req_Line_Reference_Num,-999) <> nvl( Recinfo.Req_Line_Reference_Num,-999)) then
400      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Req_Line_Reference_Num '||X_Req_Line_Reference_Num ||' Database  Req_Line_Reference_Num '||Recinfo.Req_Line_Reference_Num);
401     end if;
402     if (nvl(X_Req_Distribution_Id,-999) <> nvl( Recinfo.Req_Distribution_Id,-999)) then
403      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Req_Distribution_Id '||X_Req_Distribution_Id ||' Database  Req_Distribution_Id '||Recinfo.Req_Distribution_Id);
404     end if;
405     if (nvl(X_Deliver_To_Location_Id,-999) <> nvl( Recinfo.Deliver_To_Location_Id   ,-999)) then
406      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Deliver_To_Location_Id '||X_Deliver_To_Location_Id ||' Database  Deliver_To_Location_Id '||Recinfo.Deliver_To_Location_Id);
407     end if;
408     if (nvl(X_Deliver_To_Person_Id,-999) <> nvl( Recinfo.Deliver_To_Person_Id,-999)) then
409      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Deliver_To_Person_Id '||X_Deliver_To_Person_Id ||' Database  Deliver_To_Person_Id '||Recinfo.Deliver_To_Person_Id);
410     end if;
411     if (trunc(X_Rate_Date)  <>  trunc(Recinfo.Rate_Date) ) then
412       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Rate_Date '||X_Rate_Date ||' Database  Rate_Date '||Recinfo.Rate_Date);
413     end if;
414     if (nvl(X_Rate,-999) <> nvl(Recinfo.Rate,-999)) then
415       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Rate '||X_Rate ||' Database  Rate '||Recinfo.Rate);
416     end if;
417     if (nvl(X_Amount_Billed,-999) <> nvl(Recinfo.Amount_Billed,-999)) then
418       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Amount_Billed '||X_Amount_Billed ||' Database  Amount_Billed '||Recinfo.Amount_Billed);
419     end if;
420     if (nvl(X_Accrued_Flag,'-999') <> nvl(Recinfo.Accrued_Flag,'-999')) then
421       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Accrued_Flag '||X_Accrued_Flag ||' Database  Accrued_Flag '||Recinfo.Accrued_Flag);
422     end if;
423     if (nvl(X_Encumbered_Flag,'-999') <>  nvl(Recinfo.Encumbered_Flag ,'-999')) then
424       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Encumbered_Flag '||X_Encumbered_Flag ||' Database  Encumbered_Flag '||Recinfo.Encumbered_Flag);
425     end if;
426     if (nvl(X_Encumbered_Amount,-999) <> nvl(Recinfo.Encumbered_Amount,-999)) then
427      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Encumbered_Amount '||X_Encumbered_Amount ||' Database  Encumbered_Amount '||Recinfo.Encumbered_Amount);
428     end if;
429     if (nvl(X_Unencumbered_Quantity,-999) <> nvl(Recinfo.Unencumbered_Quantity,-999)) then
430       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Unencumbered_Quantity '||X_Unencumbered_Quantity ||' Database  Unencumbered_Quantity '||Recinfo.Unencumbered_Quantity);
431     end if;
432     if (nvl(X_Unencumbered_Amount,-999)  <>  nvl(Recinfo.Unencumbered_Amount,-999)) then
433       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Unencumbered_Amount '||X_Unencumbered_Amount ||' Database  Unencumbered_Amount '||Recinfo.Unencumbered_Amount);
434     end if;
435     if (nvl(X_Failed_Funds_Lookup_Code,'-999') <> nvl(Recinfo.Failed_Funds_Lookup_Code,'-999')) then
436       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Failed_Funds_Lookup_Code '||X_Failed_Funds_Lookup_Code ||' Database  Failed_Funds_Lookup_Code '||Recinfo.Failed_Funds_Lookup_Code);
437     end if;
438     if ( trunc(X_Gl_Encumbered_Date) <> trunc(Recinfo.Gl_Encumbered_Date) ) then
439       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Gl_Encumbered_Date '||X_Gl_Encumbered_Date ||' Database  Gl_Encumbered_Date '||Recinfo.Gl_Encumbered_Date);
440     end if;
441     if (nvl(X_Gl_Encumbered_Period_Name,'-999') <> nvl(Recinfo.Gl_Encumbered_Period_Name,'-999')) then
442       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Gl_Encumbered_Period_Name '||X_Gl_Encumbered_Period_Name ||' Database  Gl_Encumbered_Period_Name '||Recinfo.Gl_Encumbered_Period_Name);
443     end if;
444     if ( trunc(X_Gl_Cancelled_Date) <>  trunc(Recinfo.Gl_Cancelled_Date) ) then
445       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Gl_Cancelled_Date '||X_Gl_Cancelled_Date ||' Database  Gl_Cancelled_Date '||Recinfo.Gl_Cancelled_Date);
446     end if;
447     if (nvl(X_Destination_Type_Code,'-999') <> nvl(Recinfo.Destination_Type_Code,'-999')) then
451       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Destination_Organization_Id '||X_Destination_Organization_Id ||' Database  Destination_Organization_Id '||Recinfo.Destination_Organization_Id);
448       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Destination_Type_Code '||X_Destination_Type_Code ||' Database  Destination_Type_Code '||Recinfo.Destination_Type_Code);
449     end if;
450     if (nvl(X_Destination_Organization_Id,-999) <> nvl(Recinfo.Destination_Organization_Id,-999)) then
452     end if;
453     if (nvl(X_Destination_Subinventory,'-999') <> nvl(Recinfo.Destination_Subinventory,'-999')) then
454       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Destination_Subinventory '||X_Destination_Subinventory ||' Database  Destination_Subinventory '||Recinfo.Destination_Subinventory);
455     end if;
456     if (nvl(X_Attribute_Category,'-999') <> nvl( Recinfo.Attribute_Category,'-999')) then
457      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Attribute_Category '||X_Attribute_Category ||' Database  Attribute_Category '||Recinfo.Attribute_Category);
458     end if;
459     if (nvl(X_Attribute1,'-999') <> nvl( Recinfo.Attribute1,'-999')) then
460      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Attribute1 '||X_Attribute1 ||' Database  Attribute1 '||Recinfo.Attribute1);
461     end if;
462     if (nvl(X_Attribute2,'-999') <> nvl( Recinfo.Attribute2,'-999')) then
463      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Attribute2 '||X_Attribute2 ||' Database  Attribute2 '||Recinfo.Attribute2);
464     end if;
465     if (nvl(X_Attribute3,'-999') <> nvl( Recinfo.Attribute3,'-999')) then
466      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Attribute3 '||X_Attribute3 ||' Database  Attribute3 '||Recinfo.Attribute3);
467     end if;
468     if (nvl(X_Attribute4,'-999')  <> nvl( Recinfo.Attribute4,'-999')) then
469      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Attribute4 '||X_Attribute4 ||' Database  Attribute4 '||Recinfo.Attribute4);
470     end if;
471     if (nvl(X_Attribute5,'-999')  <> nvl( Recinfo.Attribute5,'-999')) then
472      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Attribute5 '||X_Attribute5 ||' Database  Attribute5 '||Recinfo.Attribute5);
473     end if;
474     if (nvl(X_Attribute6,'-999')   <> nvl( Recinfo.Attribute6,'-999')) then
475      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Attribute6 '||X_Attribute6 ||' Database  Attribute6 '||Recinfo.Attribute6);
476     end if;
477     if (nvl(X_Attribute7,'-999')  <> nvl( Recinfo.Attribute7,'-999')) then
478      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Attribute7 '||X_Attribute7 ||' Database  Attribute7 '||Recinfo.Attribute7);
479     end if;
480     if (nvl(X_Attribute8,'-999')  <> nvl( Recinfo.Attribute8,'-999')) then
481      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Attribute8 '||X_Attribute8 ||' Database  Attribute8 '||Recinfo.Attribute8);
482     end if;
483     if (nvl(X_Attribute9,'-999')  <> nvl( Recinfo.Attribute9,'-999')) then
484      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Attribute9 '||X_Attribute9 ||' Database  Attribute9 '||Recinfo.Attribute9);
485     end if;
486     if (nvl(X_Attribute10,'-999')  <> nvl( Recinfo.Attribute10,'-999')) then
487      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Attribute10 '||X_Attribute10 ||' Database  Attribute10 '||Recinfo.Attribute10);
488     end if;
489     if (nvl(X_Attribute11,'-999')  <> nvl( Recinfo.Attribute11,'-999')) then
490      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Attribute11 '||X_Attribute11 ||' Database  Attribute11 '||Recinfo.Attribute11);
491     end if;
492     if (nvl(X_Attribute12,'-999')  <> nvl( Recinfo.Attribute12,'-999')) then
493      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Attribute12 '||X_Attribute12 ||' Database  Attribute12 '||Recinfo.Attribute12);
494     end if;
495     if (nvl(X_Attribute13,'-999')  <> nvl( Recinfo.Attribute13,'-999')) then
496      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Attribute13 '||X_Attribute13 ||' Database  Attribute13 '||Recinfo.Attribute13);
497     end if;
498     if (nvl(X_Attribute14,'-999')  <> nvl( Recinfo.Attribute14,'-999')) then
499      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Attribute14 '||X_Attribute14 ||' Database  Attribute14 '||Recinfo.Attribute14);
500     end if;
501     if (nvl(X_Attribute15,'-999')  <> nvl( Recinfo.Attribute15,'-999')) then
502      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Attribute15 '||X_Attribute15 ||' Database  Attribute15 '||Recinfo.Attribute15);
503     end if;
504     if (nvl(X_Wip_Entity_Id,-999)  <>  nvl(Recinfo.Wip_Entity_Id,-999)) then
505       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Wip_Entity_Id '||X_Wip_Entity_Id ||' Database  Wip_Entity_Id '||Recinfo.Wip_Entity_Id);
506     end if;
507     if (nvl(X_Wip_Operation_Seq_Num,-999) <> nvl(Recinfo.Wip_Operation_Seq_Num,-999)) then
508       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Wip_Operation_Seq_Num '||X_Wip_Operation_Seq_Num ||' Database  Wip_Operation_Seq_Num '||Recinfo.Wip_Operation_Seq_Num);
509     end if;
510     if (nvl(X_Wip_Resource_Seq_Num,-999) <> nvl(Recinfo.Wip_Resource_Seq_Num,-999)) then
511       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Wip_Resource_Seq_Num '||X_Wip_Resource_Seq_Num ||' Database  Wip_Resource_Seq_Num '||Recinfo.Wip_Resource_Seq_Num);
512     end if;
513     if (nvl(X_Wip_Repetitive_Schedule_Id,-999) <> nvl(Recinfo.Wip_Repetitive_Schedule_Id,-999)) then
514       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Wip_Repetitive_Schedule_Id '||X_Wip_Repetitive_Schedule_Id ||' Database  Wip_Repetitive_Schedule_Id '||Recinfo.Wip_Repetitive_Schedule_Id);
515     end if;
516     if (nvl(X_Wip_Line_Id,-999) <>  nvl(Recinfo.Wip_Line_Id ,-999)) then
517       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Wip_Line_Id '||X_Wip_Line_Id ||' Database  Wip_Line_Id '||Recinfo.Wip_Line_Id);
518     end if;
519     if (nvl(X_Bom_Resource_Id,-999) <> nvl(Recinfo.Bom_Resource_Id,-999)) then
523       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Budget_Account_Id '||X_Budget_Account_Id ||' Database  Budget_Account_Id '||Recinfo.Budget_Account_Id);
520      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Bom_Resource_Id '||X_Bom_Resource_Id ||' Database  Bom_Resource_Id '||Recinfo.Bom_Resource_Id);
521     end if;
522     if (nvl(X_Budget_Account_Id,-999) <> nvl(Recinfo.Budget_Account_Id,-999)) then
524     end if;
525     if (nvl(X_Accrual_Account_Id,-999) <> nvl(Recinfo.Accrual_Account_Id,-999)   ) then
526      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Accrual_Account_Id '||X_Accrual_Account_Id ||' Database  Accrual_Account_Id '||Recinfo.Accrual_Account_Id);
527     end if;
528     if (nvl(X_Variance_Account_Id ,-999) <> nvl(Recinfo.Variance_Account_Id,-999)   ) then
529      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Variance_Account_Id '||X_Variance_Account_Id ||' Database  Variance_Account_Id '||Recinfo.Variance_Account_Id);
530     end if;
531     if (nvl(X_Prevent_Encumbrance_Flag,'-999') <> nvl(Recinfo.Prevent_Encumbrance_Flag,'-999')) then
532      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Prevent_Encumbrance_Flag '||X_Prevent_Encumbrance_Flag||' Database  Prevent_Encumbrance_Flag '||Recinfo.Prevent_Encumbrance_Flag);
533     end if;
534     if (nvl(X_Ussgl_Transaction_Code ,'-999') <> nvl( Recinfo.Ussgl_Transaction_Code,'-999')) then
535      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Ussgl_Transaction_Code '||X_Ussgl_Transaction_Code ||' Database  Ussgl_Transaction_Code '||Recinfo.Ussgl_Transaction_Code);
536     end if;
537     if (nvl(X_Government_Context,'-999') <> nvl( Recinfo.Government_Context,'-999')) then
538      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Government_Context '||X_Government_Context ||' Database  Government_Context '||Recinfo.Government_Context);
539     end if;
540     if (nvl(X_Destination_Context,'-999') <> nvl( Recinfo.Destination_Context,'-999')) then
541      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Destination_Context '||X_Destination_Context ||' Database  Destination_Context '||Recinfo.Destination_Context);
542     end if;
543     if (nvl(X_Distribution_Num,-999) <> nvl( Recinfo.Distribution_Num,-999)) then
544      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Distribution_Num '||X_Distribution_Num ||' Database  Distribution_Num '||Recinfo.Distribution_Num);
545     end if;
546     if (nvl(X_Source_Distribution_Id ,-999) <> nvl( Recinfo.Source_Distribution_Id ,-999)) then
547      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Source_Distribution_Id '||X_Source_Distribution_Id ||' Database  Source_Distribution_Id '||Recinfo.Source_Distribution_Id);
548     end if;
549     if (nvl(X_Project_Id ,-999) <> nvl( Recinfo.Project_Id ,-999)) then
550      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Project_Id '||X_Project_Id ||' Database  Project_Id '||Recinfo.Project_Id);
551     end if;
552     if (nvl(X_Task_Id,-999) <> nvl( Recinfo.Task_Id,-999)) then
553      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Task_Id '||X_Task_Id ||' Database  Task_Id '||Recinfo.Task_Id);
554     end if;
555     if (nvl(X_Expenditure_Type,'-999') <> nvl( Recinfo.Expenditure_Type,'-999')) then
556      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Expenditure_Type '||X_Expenditure_Type ||' Database  Expenditure_Type '||Recinfo.Expenditure_Type);
557     end if;
558     if (nvl(X_Project_Accounting_Context,'-999') <> nvl( Recinfo.Project_Accounting_Context,'-999')) then
559      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Project_Accounting_Context '||X_Project_Accounting_Context ||' Database  Project_Accounting_Context '||Recinfo.Project_Accounting_Context);
560     end if;
561     if (nvl(X_Expenditure_Organization_Id,-999) <> nvl( Recinfo.Expenditure_Organization_Id   ,-999)) then
562      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Expenditure_Organization_Id '||X_Expenditure_Organization_Id ||' Database  Expenditure_Organization_Id '||Recinfo.Expenditure_Organization_Id);
563     end if;
564     if ( trunc(X_Gl_Closed_Date)  <>  trunc(Recinfo.Gl_Closed_Date) ) then
565      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Gl_Closed_Date '||X_Gl_Closed_Date ||' Database  Gl_Closed_Date '||Recinfo.Gl_Closed_Date);
566     end if;
567     if (nvl(X_Accrue_On_Receipt_Flag,'-999')  <>  nvl(Recinfo.Accrue_On_Receipt_Flag,'-999')) then
568       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Accrue_On_Receipt_Flag '||X_Accrue_On_Receipt_Flag ||' Database  Accrue_On_Receipt_Flag '||Recinfo.Accrue_On_Receipt_Flag);
569     end if;
570     if ( trunc(X_Expenditure_Item_Date)  <> trunc(Recinfo.Expenditure_Item_Date) ) then
571       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Expenditure_Item_Date '||X_Expenditure_Item_Date ||' Database  Expenditure_Item_Date '||Recinfo.Expenditure_Item_Date);
572     end if;
573     if (nvl(X_End_Item_Unit_Number,-999) <> nvl(Recinfo.End_Item_Unit_Number,-999)) then
574       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form End_Item_Unit_Number '||X_End_Item_Unit_Number ||' Database  End_Item_Unit_Number '||Recinfo.End_Item_Unit_Number);
575     end if;
576     if (nvl(X_Recovery_Rate,-999) <> nvl(Recinfo.Recovery_Rate,-999)) then
577       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Recovery_Rate '||X_Recovery_Rate ||' Database  Recovery_Rate '||Recinfo.Recovery_Rate);
578     end if;
579     if (nvl(X_Tax_Recovery_Override_Flag,'-999') <>  nvl(Recinfo.Tax_Recovery_Override_Flag ,'-999')) then
580       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form Tax_Recovery_Override_Flag '||X_Tax_Recovery_Override_Flag ||' Database  Tax_Recovery_Override_Flag '||Recinfo.Tax_Recovery_Override_Flag);
581     end if;
582     if (nvl(p_dest_charge_account_id,-999)  <>  nvl(Recinfo.dest_charge_account_id,-999)) then
583       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form dest_charge_account_id '||p_dest_charge_account_id ||' Database  dest_charge_account_id '||Recinfo.dest_charge_account_id);
584     end if;
588     if (nvl(X_amount_ordered,-999) <> nvl(Recinfo.amount_ordered,-999)) then
585     if (nvl(trunc(p_dest_variance_account_id),-999) <> nvl(trunc(Recinfo.dest_variance_account_id),-999)) then
586       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form dest_variance_account_id '||p_dest_variance_account_id ||' Database  dest_variance_account_id '||Recinfo.dest_variance_account_id);
587     end if;
589       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form amount_ordered '||X_amount_ordered ||' Database  amount_ordered '||Recinfo.amount_ordered);
590     end if;
594     if (nvl(X_distribution_type,'-999') <>  nvl(Recinfo.distribution_type ,'-999')) then
591     if (nvl(X_amount_to_encumber,-999) <> nvl(Recinfo.Recovery_Rate,-999)) then
592       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form amount_to_encumber '||X_amount_to_encumber ||' Database  amount_to_encumber '||Recinfo.amount_to_encumber);
593     end if;
595       FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name,' Form distribution_type '||X_distribution_type ||' Database  distribution_type '||Recinfo.distribution_type);
596     end if;
597 
598      FND_LOG.string(FND_LOG.LEVEL_STATEMENT,c_log_head || l_api_name || '.end','Failed when comparing fields');
599 
600     END IF;       --end g_fnd_debug = 'Y'
601       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
602       APP_EXCEPTION.RAISE_EXCEPTION;
603 
604   END Lock_Row;
605 
606 
607   PROCEDURE Delete_Row(X_Rowid VARCHAR2) IS
608 
609     l_return_status VARCHAR2(1);
610     l_msg_data VARCHAR2(2000);
611     l_msg_count NUMBER;
612     l_distribution_id PO_DISTRIBUTIONS_ALL.po_distribution_id%TYPE;
613 
614     --<eTax Integration R12 Start>
615     l_transaction_line_rec_type ZX_API_PUB.transaction_line_rec_type;
616     l_distribution_type   PO_DISTRIBUTIONS_ALL.distribution_type%TYPE;
617     l_line_location_id    PO_DISTRIBUTIONS_ALL.line_location_id%TYPE;
618     l_po_header_id        PO_DISTRIBUTIONS_ALL.po_header_id%TYPE;
619     l_po_release_id       PO_DISTRIBUTIONS_ALL.po_release_id%TYPE;
620     l_distribution_count  NUMBER;
621     l_org_id              PO_DISTRIBUTIONS_ALL.org_id%type;
622     --<eTax Integration R12 End>
623 
624   BEGIN
625     DELETE FROM PO_DISTRIBUTIONS
626     WHERE  rowid = X_Rowid
627     RETURNING po_distribution_id, line_location_id, po_header_id, po_release_id, distribution_type, org_id
628     INTO l_distribution_id, l_line_location_id, l_po_header_id, l_po_release_id, l_distribution_type, l_org_id; --<eTax Integration R12>
629 
630     if (SQL%NOTFOUND) then
631       Raise NO_DATA_FOUND;
632     end if;
633 
634     --<eTax Integration R12 Start> If any sibling distributions left, mark
635     -- parent shipment as DIST_DELETE so that its tax distributions get
636     -- redistributed with a call to determine_recovery later on.
637     -- If there are no sibling distributions left then call
638     -- delete_tax_distributions eTax API to delete corrsponding tax
639     -- distributions
640     IF l_distribution_type IN ('STANDARD','PLANNED','BLANKET','SCHEDULED') THEN
641 
642       -- count number of distributions
643       SELECT COUNT(1) INTO l_distribution_count
644       FROM po_distributions_all pd
645       WHERE pd.line_location_id=l_line_location_id;
646 
647       IF (l_distribution_count = 0) THEN -- there are no sibling distributions
648 
649         l_transaction_line_rec_type.internal_organization_id := l_org_id;
650         l_transaction_line_rec_type.application_id           := PO_CONSTANTS_SV.APPLICATION_ID;
651         /* Bug 14004400: Applicaton id being passed to EB Tax was responsibility id rather than 201 which
652                is pased when the tax lines are created. Same should be passed when they are deleted.  */
653         l_transaction_line_rec_type.entity_code              := PO_CONSTANTS_SV.PO_ENTITY_CODE ;
654         l_transaction_line_rec_type.event_class_code         := PO_CONSTANTS_SV.PO_EVENT_CLASS_CODE;
655         l_transaction_line_rec_type.event_type_code          := PO_CONSTANTS_SV.PO_ADJUSTED;
656         l_transaction_line_rec_type.trx_id                   := NVL(l_po_release_id, l_po_header_id);
657         l_transaction_line_rec_type.trx_level_type           := 'SHIPMENT';
658         l_transaction_line_rec_type.trx_line_id              := l_line_location_id;
659 
660         -- Call eTax API to delete corrsponding tax distributions
661         ZX_API_PUB.delete_tax_distributions(
662           p_api_version             =>  1.0,
663           p_init_msg_list           =>  FND_API.G_TRUE,
664           p_commit                  =>  FND_API.G_FALSE,
665           p_validation_level        =>  FND_API.G_VALID_LEVEL_FULL,
666           x_return_status           =>  l_return_status,
667           x_msg_count               =>  l_msg_count,
668           x_msg_data                =>  l_msg_data,
669           p_transaction_line_rec    =>  l_transaction_line_rec_type
670         );
671         IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
672             RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
673         END IF;
677         -- get redistributed with a call to determine_recovery later on
674       ELSE -- there are sibling distributions
675 
676         -- Mark parent shipment as DIST_DELETE so that its tax distributions
678         UPDATE po_line_locations
679         SET tax_attribute_update_code = 'DIST_DELETE'
680         WHERE tax_attribute_update_code IS NULL
681         AND line_location_id=l_line_location_id;
682 
683       END IF; --IF (l_distribution_count = 0)
684     END IF; --IF l_distribution_type IN ...
685     --<eTax Integration R12 End>
686 
687 
688 EXCEPTION
689     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
690         -- Bug 3529594: vinokris
691         -- Had to remove the sql_error procedure, since
692         -- that was looking for a sql error number.
693         PO_MESSAGE_S.app_error(
694           error_name => 'PO_CUSTOM_MSG',
695           token1     => 'TRANSLATED_TOKEN',
696           value1     => l_msg_data);
697         -- End Bug 3529594
698         RAISE;
699 
700   END Delete_Row;
701 
702 
703 END PO_DISTRIBUTIONS_PKG2;