DBA Data[Home] [Help]

PACKAGE BODY: APPS.PO_DISTRIBUTIONS_PKG2

Source


1 PACKAGE BODY PO_DISTRIBUTIONS_PKG2 as
2 /* $Header: POXP2PDB.pls 120.5 2006/02/06 11:46:11 dedelgad noship $ */
3 
4   PROCEDURE Lock_Row(X_Rowid                            VARCHAR2,
5                      X_Po_Distribution_Id               NUMBER,
6                      X_Po_Header_Id                     NUMBER,
7                      X_Po_Line_Id                       NUMBER,
8                      X_Line_Location_Id                 NUMBER,
9                      X_Set_Of_Books_Id                  NUMBER,
10                      X_Code_Combination_Id              NUMBER,
11                      X_Quantity_Ordered                 NUMBER,
12                      X_Po_Release_Id                    NUMBER,
13                      X_Quantity_Delivered               NUMBER,
14                      X_Quantity_Billed                  NUMBER,
15                      X_Quantity_Cancelled               NUMBER,
16                      X_Req_Header_Reference_Num         VARCHAR2,
17                      X_Req_Line_Reference_Num           VARCHAR2,
18                      X_Req_Distribution_Id              NUMBER,
19                      X_Deliver_To_Location_Id           NUMBER,
20                      X_Deliver_To_Person_Id             NUMBER,
21                      X_Rate_Date                        DATE,
22                      X_Rate                             NUMBER,
23                      X_Amount_Billed                    NUMBER,
24                      X_Accrued_Flag                     VARCHAR2,
25                      X_Encumbered_Flag                  VARCHAR2,
26                      X_Encumbered_Amount                NUMBER,
27                      X_Unencumbered_Quantity            NUMBER,
28                      X_Unencumbered_Amount              NUMBER,
29                      X_Failed_Funds_Lookup_Code         VARCHAR2,
30                      X_Gl_Encumbered_Date               DATE,
31                      X_Gl_Encumbered_Period_Name        VARCHAR2,
32                      X_Gl_Cancelled_Date                DATE,
33                      X_Destination_Type_Code            VARCHAR2,
34                      X_Destination_Organization_Id      NUMBER,
35                      X_Destination_Subinventory         VARCHAR2,
36                      X_Attribute_Category               VARCHAR2,
37                      X_Attribute1                       VARCHAR2,
38                      X_Attribute2                       VARCHAR2,
39                      X_Attribute3                       VARCHAR2,
40                      X_Attribute4                       VARCHAR2,
41                      X_Attribute5                       VARCHAR2,
42                      X_Attribute6                       VARCHAR2,
43                      X_Attribute7                       VARCHAR2,
44                      X_Attribute8                       VARCHAR2,
45                      X_Attribute9                       VARCHAR2,
46                      X_Attribute10                      VARCHAR2,
47                      X_Attribute11                      VARCHAR2,
48                      X_Attribute12                      VARCHAR2,
49                      X_Attribute13                      VARCHAR2,
50                      X_Attribute14                      VARCHAR2,
51                      X_Attribute15                      VARCHAR2,
52                      X_Wip_Entity_Id                    NUMBER,
53                      X_Wip_Operation_Seq_Num            NUMBER,
54                      X_Wip_Resource_Seq_Num             NUMBER,
55                      X_Wip_Repetitive_Schedule_Id       NUMBER,
56                      X_Wip_Line_Id                      NUMBER,
57                      X_Bom_Resource_Id                  NUMBER,
58                      X_Budget_Account_Id                NUMBER,
59                      X_Accrual_Account_Id               NUMBER,
60                      X_Variance_Account_Id              NUMBER,
61 
62                      --< Shared Proc FPJ Start >
63                      p_dest_charge_account_id           NUMBER,
64                      p_dest_variance_account_id         NUMBER,
65                      --< Shared Proc FPJ End >
66 
67                      X_Prevent_Encumbrance_Flag         VARCHAR2,
68                      X_Ussgl_Transaction_Code           VARCHAR2,
69                      X_Government_Context               VARCHAR2,
70                      X_Destination_Context              VARCHAR2,
71                      X_Distribution_Num                 NUMBER,
72                      X_Source_Distribution_Id           NUMBER,
73                      X_Project_Id                       NUMBER,
74                      X_Task_Id                          NUMBER,
75                      X_Expenditure_Type                 VARCHAR2,
76                      X_Project_Accounting_Context       VARCHAR2,
77                      X_Expenditure_Organization_Id      NUMBER,
78                      X_Gl_Closed_Date                   DATE,
79                      X_Accrue_On_Receipt_Flag           VARCHAR2,
80                      X_Expenditure_Item_Date            DATE,
81                      X_End_Item_Unit_Number             VARCHAR2 DEFAULT NULL,
82                      X_Recovery_Rate                    NUMBER,
83                      X_Tax_Recovery_Override_Flag       VARCHAR2,
84                      X_amount_ordered                   NUMBER,  -- <SERVICES FPJ>
85                      X_amount_to_encumber               NUMBER DEFAULT NULL, --<ENCUMBRANCE FPJ>
86                      X_distribution_type                VARCHAR2 DEFAULT NULL --<ENCUMBRANCE FPJ>
87   ) IS
88     CURSOR C IS
89         SELECT *
90         FROM   PO_DISTRIBUTIONS
91         WHERE  rowid = X_Rowid
92         FOR UPDATE of Po_Distribution_Id NOWAIT;
93     Recinfo C%ROWTYPE;
94   BEGIN
95     OPEN C;
96     FETCH C INTO Recinfo;
97     if (C%NOTFOUND) then
98       CLOSE C;
99       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_DELETED');
100       APP_EXCEPTION.Raise_Exception;
101     end if;
102     CLOSE C;
103 
104     IF
105                (Recinfo.po_distribution_id = X_Po_Distribution_Id)
106            AND (Recinfo.po_header_id = X_Po_Header_Id)
107    --<ENCUMBRANCE FPJ START>
108            AND (   (Recinfo.po_line_id = X_Po_Line_Id)
109                OR  (    (Recinfo.po_line_id IS NULL)
110                     AND (X_Po_Line_Id IS NULL)))
111            AND (   (Recinfo.line_location_id = X_Line_Location_Id)
112                OR  (    (Recinfo.line_location_id IS NULL)
113                     AND (X_Line_Location_Id IS NULL)))
114   --<ENCUMBRANCE FPJ END>
115            AND (Recinfo.set_of_books_id = X_Set_Of_Books_Id)
116    --<ENCUMBRANCE FPJ START>
117            AND (   (Recinfo.code_combination_id = X_Code_Combination_Id)
118                OR  (    (Recinfo.code_combination_id IS NULL)
119                     AND (X_Code_Combination_Id IS NULL)))
120            AND (   (Recinfo.quantity_ordered = X_Quantity_Ordered)
121                OR  (    (Recinfo.quantity_ordered IS NULL)
122                     AND (X_Quantity_Ordered IS NULL)))
123   --<ENCUMBRANCE FPJ END>
124            AND (   (Recinfo.po_release_id = X_Po_Release_Id)
125                 OR (    (Recinfo.po_release_id IS NULL)
126                     AND (X_Po_Release_Id IS NULL)))
127          /*  AND (   (Recinfo.quantity_delivered = X_Quantity_Delivered)
128                 OR (    (Recinfo.quantity_delivered IS NULL)
129                     AND (X_Quantity_Delivered IS NULL)))
130            AND (   (Recinfo.quantity_billed = X_Quantity_Billed)
131                 OR (    (Recinfo.quantity_billed IS NULL)
132                     AND (X_Quantity_Billed IS NULL)))
133            <Bug# 3464561> Following three lines commented out too.
134            AND (   (Recinfo.quantity_cancelled = X_Quantity_Cancelled)
135                 OR (    (Recinfo.quantity_cancelled IS NULL)
136                     AND (X_Quantity_Cancelled IS NULL))) */
137            AND (   (Recinfo.req_header_reference_num = X_Req_Header_Reference_Num)
138                 OR (    (Recinfo.req_header_reference_num IS NULL)
139                     AND (X_Req_Header_Reference_Num IS NULL)))
140            AND (   (Recinfo.req_line_reference_num = X_Req_Line_Reference_Num)
141                 OR (    (Recinfo.req_line_reference_num IS NULL)
142                     AND (X_Req_Line_Reference_Num IS NULL)))
143            AND (   (Recinfo.req_distribution_id = X_Req_Distribution_Id)
144                 OR (    (Recinfo.req_distribution_id IS NULL)
145                     AND (X_Req_Distribution_Id IS NULL)))
146            AND (   (Recinfo.deliver_to_location_id = X_Deliver_To_Location_Id)
147                 OR (    (Recinfo.deliver_to_location_id IS NULL)
148                     AND (X_Deliver_To_Location_Id IS NULL)))
149            AND (   (Recinfo.deliver_to_person_id = X_Deliver_To_Person_Id)
150                 OR (    (Recinfo.deliver_to_person_id IS NULL)
151                     AND (X_Deliver_To_Person_Id IS NULL)))
152            AND (   (trunc(Recinfo.rate_date) = trunc(X_Rate_Date))
153                 OR (    (Recinfo.rate_date IS NULL)
154                     AND (X_Rate_Date IS NULL)))
155            AND (   (Recinfo.rate = X_Rate)
156                 OR (    (Recinfo.rate IS NULL)
157                     AND (X_Rate IS NULL)))
158            AND (   (Recinfo.amount_billed = X_Amount_Billed)
159                 OR (    (Recinfo.amount_billed IS NULL)
160                     AND (X_Amount_Billed IS NULL)))
161            AND (   (Recinfo.recovery_rate = X_Recovery_Rate)
162                 OR (    (Recinfo.recovery_rate IS NULL)
163                     AND (X_Recovery_Rate IS NULL)))
164            AND (   (Recinfo.accrued_flag = X_Accrued_Flag)
165                 OR (    (Recinfo.accrued_flag IS NULL)
166                     AND (X_Accrued_Flag IS NULL)))
167            AND (   (Recinfo.encumbered_flag = X_Encumbered_Flag)
168                 OR (    (Recinfo.encumbered_flag IS NULL)
169                     AND (X_Encumbered_Flag IS NULL)))
170            AND (   (Recinfo.encumbered_amount = X_Encumbered_Amount)
171                 OR (    (Recinfo.encumbered_amount IS NULL)
172                     AND (X_Encumbered_Amount IS NULL)))
173            AND (   (Recinfo.unencumbered_quantity = X_Unencumbered_Quantity)
174                 OR (    (Recinfo.unencumbered_quantity IS NULL)
175                     AND (X_Unencumbered_Quantity IS NULL)))
176            AND (   (Recinfo.unencumbered_amount = X_Unencumbered_Amount)
177                 OR (    (Recinfo.unencumbered_amount IS NULL)
178                     AND (X_Unencumbered_Amount IS NULL)))
179    --<ENCUMBRANCE FPJ START>
180            AND (   (Recinfo.amount_to_encumber = X_amount_to_encumber)
181                 OR (    (Recinfo.amount_to_encumber IS NULL)
182                     AND (X_amount_to_encumber IS NULL)))
183            AND (   (Recinfo.distribution_type = X_distribution_type)
184                 OR (    (Recinfo.distribution_type IS NULL)
185                     AND (X_distribution_type IS NULL)))
186    --<ENCUMBRANCE FPJ END>
187            AND (   (Recinfo.failed_funds_lookup_code = X_Failed_Funds_Lookup_Code)
188                 OR (    (Recinfo.failed_funds_lookup_code IS NULL)
189                     AND (X_Failed_Funds_Lookup_Code IS NULL)))
190            AND (   (trunc(Recinfo.gl_encumbered_date) = trunc(X_Gl_Encumbered_Date))
191                 OR (    (Recinfo.gl_encumbered_date IS NULL)
192                     AND (X_Gl_Encumbered_Date IS NULL)))
193            AND (   (Recinfo.gl_encumbered_period_name = X_Gl_Encumbered_Period_Name)
194                 OR (    (Recinfo.gl_encumbered_period_name IS NULL)
195                     AND (X_Gl_Encumbered_Period_Name IS NULL)))
196            AND (   (trunc(Recinfo.gl_cancelled_date) = trunc(X_Gl_Cancelled_Date))
197                 OR (    (Recinfo.gl_cancelled_date IS NULL)
198                     AND (X_Gl_Cancelled_Date IS NULL)))
199            AND (   (Recinfo.destination_type_code = X_Destination_Type_Code)
200                 OR (    (Recinfo.destination_type_code IS NULL)
201                     AND (X_Destination_Type_Code IS NULL)))
202            AND (   (Recinfo.destination_organization_id = X_Destination_Organization_Id)
203                 OR (    (Recinfo.destination_organization_id IS NULL)
204                     AND (X_Destination_Organization_Id IS NULL)))
205            AND (   (Recinfo.destination_subinventory = X_Destination_Subinventory)
206                 OR (    (Recinfo.destination_subinventory IS NULL)
207                     AND (X_Destination_Subinventory IS NULL)))
208            -- <SERVICES FPJ START>
209            AND (   (Recinfo.amount_ordered = X_amount_ordered)
210                 OR (    (Recinfo.amount_ordered IS NULL)
211                     AND (X_amount_ordered IS NULL)))
212            -- <SERVICES FPJ END>
213            THEN
214            IF
215                (   (Recinfo.attribute_category = X_Attribute_Category)
216                 OR (    (Recinfo.attribute_category IS NULL)
217                     AND (X_Attribute_Category IS NULL)))
218            AND (   (Recinfo.attribute1 = X_Attribute1)
219                 OR (    (Recinfo.attribute1 IS NULL)
220                     AND (X_Attribute1 IS NULL)))
221            AND (   (Recinfo.attribute2 = X_Attribute2)
222                 OR (    (Recinfo.attribute2 IS NULL)
223                     AND (X_Attribute2 IS NULL)))
224            AND (   (Recinfo.attribute3 = X_Attribute3)
225                 OR (    (Recinfo.attribute3 IS NULL)
226                     AND (X_Attribute3 IS NULL)))
227            AND (   (Recinfo.attribute4 = X_Attribute4)
228                 OR (    (Recinfo.attribute4 IS NULL)
229                     AND (X_Attribute4 IS NULL)))
230            AND (   (Recinfo.attribute5 = X_Attribute5)
231                 OR (    (Recinfo.attribute5 IS NULL)
232                     AND (X_Attribute5 IS NULL)))
233            AND (   (Recinfo.attribute6 = X_Attribute6)
234                 OR (    (Recinfo.attribute6 IS NULL)
235                     AND (X_Attribute6 IS NULL)))
236            AND (   (Recinfo.attribute7 = X_Attribute7)
237                 OR (    (Recinfo.attribute7 IS NULL)
238                     AND (X_Attribute7 IS NULL)))
239            AND (   (Recinfo.attribute8 = X_Attribute8)
240                 OR (    (Recinfo.attribute8 IS NULL)
241                     AND (X_Attribute8 IS NULL)))
242            AND (   (Recinfo.attribute9 = X_Attribute9)
243                 OR (    (Recinfo.attribute9 IS NULL)
244                     AND (X_Attribute9 IS NULL)))
245            AND (   (Recinfo.attribute10 = X_Attribute10)
246                 OR (    (Recinfo.attribute10 IS NULL)
247                     AND (X_Attribute10 IS NULL)))
248            AND (   (Recinfo.attribute11 = X_Attribute11)
249                 OR (    (Recinfo.attribute11 IS NULL)
250                     AND (X_Attribute11 IS NULL)))
251            AND (   (Recinfo.attribute12 = X_Attribute12)
252                 OR (    (Recinfo.attribute12 IS NULL)
253                     AND (X_Attribute12 IS NULL)))
254            AND (   (Recinfo.attribute13 = X_Attribute13)
255                 OR (    (Recinfo.attribute13 IS NULL)
256                     AND (X_Attribute13 IS NULL)))
257            AND (   (Recinfo.attribute14 = X_Attribute14)
258                 OR (    (Recinfo.attribute14 IS NULL)
259                     AND (X_Attribute14 IS NULL)))
260            AND (   (Recinfo.attribute15 = X_Attribute15)
261                 OR (    (Recinfo.attribute15 IS NULL)
262                      AND (X_Attribute15 IS NULL)))           THEN
263 
264           IF
265               (   (Recinfo.wip_entity_id = X_Wip_Entity_Id)
266                 OR (    (Recinfo.wip_entity_id IS NULL)
267                     AND (X_Wip_Entity_Id IS NULL)))
268            AND (   (Recinfo.wip_operation_seq_num = X_Wip_Operation_Seq_Num)
269                 OR (    (Recinfo.wip_operation_seq_num IS NULL)
270                     AND (X_Wip_Operation_Seq_Num IS NULL)))
271            AND (   (Recinfo.wip_resource_seq_num = X_Wip_Resource_Seq_Num)
272                 OR (    (Recinfo.wip_resource_seq_num IS NULL)
273                     AND (X_Wip_Resource_Seq_Num IS NULL)))
274            AND (   (Recinfo.wip_repetitive_schedule_id = X_Wip_Repetitive_Schedule_Id)
275                 OR (    (Recinfo.wip_repetitive_schedule_id IS NULL)
276                     AND (X_Wip_Repetitive_Schedule_Id IS NULL)))
277            AND (   (Recinfo.wip_line_id = X_Wip_Line_Id)
278                 OR (    (Recinfo.wip_line_id IS NULL)
279                     AND (X_Wip_Line_Id IS NULL)))
280            AND (   (Recinfo.bom_resource_id = X_Bom_Resource_Id)
281                 OR (    (Recinfo.bom_resource_id IS NULL)
282                     AND (X_Bom_Resource_Id IS NULL)))
283            AND (   (Recinfo.budget_account_id = X_Budget_Account_Id)
284                 OR (    (Recinfo.budget_account_id IS NULL)
285                     AND (X_Budget_Account_Id IS NULL)))
289            AND (   (Recinfo.variance_account_id = X_Variance_Account_Id)
286            AND (   (Recinfo.accrual_account_id = X_Accrual_Account_Id)
287                 OR (    (Recinfo.accrual_account_id IS NULL)
288                     AND (X_Accrual_Account_Id IS NULL)))
290                 OR (    (Recinfo.variance_account_id IS NULL)
291                     AND (X_Variance_Account_Id IS NULL)))
292            AND (   (Recinfo.prevent_encumbrance_flag = X_Prevent_Encumbrance_Flag)
293                 OR (    (Recinfo.prevent_encumbrance_flag IS NULL)
294                     AND (X_Prevent_Encumbrance_Flag IS NULL)))
295            AND (   (Recinfo.government_context = X_Government_Context)
296                 OR (    (Recinfo.government_context IS NULL)
297                     AND (X_Government_Context IS NULL)))
298            AND (   (Recinfo.destination_context = X_Destination_Context)
299                 OR (    (Recinfo.destination_context IS NULL)
300                     AND (X_Destination_Context IS NULL)))
301            AND (Recinfo.distribution_num = X_Distribution_Num)
302            AND (   (Recinfo.source_distribution_id = X_Source_Distribution_Id)
303                 OR (    (Recinfo.source_distribution_id IS NULL)
304                     AND (X_Source_Distribution_Id IS NULL)))
305            AND (   (Recinfo.project_id = X_Project_Id)
306                 OR (    (Recinfo.project_id IS NULL)
307                     AND (X_Project_Id IS NULL)))
308            AND (   (Recinfo.task_id = X_Task_Id)
309                 OR (    (Recinfo.task_id IS NULL)
310                     AND (X_Task_Id IS NULL)))
311            AND (   (Recinfo.end_item_unit_number = X_End_Item_Unit_Number)
312                 OR (    (Recinfo.end_item_unit_number IS NULL)
313                     AND (X_End_Item_Unit_Number IS NULL)))
314            AND (   (Recinfo.expenditure_type = X_Expenditure_Type)
315                 OR (    (Recinfo.expenditure_type IS NULL)
316                     AND (X_Expenditure_Type IS NULL)))
317            AND (   (Recinfo.project_accounting_context = X_Project_Accounting_Context)
318                 OR (    (Recinfo.project_accounting_context IS NULL)
319                     AND (X_Project_Accounting_Context IS NULL)))
320            AND (   (Recinfo.expenditure_organization_id = X_Expenditure_Organization_Id)
321                 OR (    (Recinfo.expenditure_organization_id IS NULL)
322                     AND (X_Expenditure_Organization_Id IS NULL)))
323            AND (   (trunc(Recinfo.gl_closed_date) = trunc(X_Gl_Closed_Date))
324                 OR (    (Recinfo.gl_closed_date IS NULL)
325                     AND (X_Gl_Closed_Date IS NULL)))
326            AND (   (Recinfo.accrue_on_receipt_flag = X_Accrue_On_Receipt_Flag)
327                 OR (    (Recinfo.accrue_on_receipt_flag IS NULL)
328                     AND (X_Accrue_On_Receipt_Flag IS NULL)))
329            AND (   (trunc(Recinfo.expenditure_item_date) = trunc(X_Expenditure_Item_Date))
330                 OR (    (Recinfo.expenditure_item_date IS NULL)
331                     AND (X_Expenditure_Item_Date IS NULL)))
332 
333            --< Shared Proc FPJ Start >
334            AND ( (RECINFO.dest_charge_account_id = p_dest_charge_account_id)
335                 OR (    (RECINFO.dest_charge_account_id IS NULL)
336                     AND (p_dest_charge_account_id IS NULL)))
337            AND ( (RECINFO.dest_variance_account_id = p_dest_variance_account_id)
338                 OR (    (RECINFO.dest_variance_account_id IS NULL)
339                     AND (p_dest_variance_account_id IS NULL)))
340            --< Shared Proc FPJ End >
341 
342 
343                      THEN
344                   return;
345 
346               END IF;
347             END IF;
348          END IF;
349     /*
350     ** If we get to this point then a column has been changed.
351     */
352 
353       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
354       APP_EXCEPTION.RAISE_EXCEPTION;
355 
356   END Lock_Row;
357 
358 
359   PROCEDURE Delete_Row(X_Rowid VARCHAR2) IS
360 
361     l_return_status VARCHAR2(1);
362     l_msg_data VARCHAR2(2000);
363     l_msg_count NUMBER;
364     l_distribution_id PO_DISTRIBUTIONS_ALL.po_distribution_id%TYPE;
365 
366     --<eTax Integration R12 Start>
367     l_transaction_line_rec_type ZX_API_PUB.transaction_line_rec_type;
368     l_distribution_type   PO_DISTRIBUTIONS_ALL.distribution_type%TYPE;
369     l_line_location_id    PO_DISTRIBUTIONS_ALL.line_location_id%TYPE;
370     l_po_header_id        PO_DISTRIBUTIONS_ALL.po_header_id%TYPE;
371     l_po_release_id       PO_DISTRIBUTIONS_ALL.po_release_id%TYPE;
372     l_distribution_count  NUMBER;
373     l_org_id              PO_DISTRIBUTIONS_ALL.org_id%type;
374     --<eTax Integration R12 End>
375 
376   BEGIN
377     DELETE FROM PO_DISTRIBUTIONS
378     WHERE  rowid = X_Rowid
379     RETURNING po_distribution_id, line_location_id, po_header_id, po_release_id, distribution_type, org_id
380     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>
381 
382     if (SQL%NOTFOUND) then
383       Raise NO_DATA_FOUND;
384     end if;
385 
386     --<eTax Integration R12 Start> If any sibling distributions left, mark
387     -- parent shipment as DIST_DELETE so that its tax distributions get
388     -- redistributed with a call to determine_recovery later on.
389     -- If there are no sibling distributions left then call
390     -- delete_tax_distributions eTax API to delete corrsponding tax
391     -- distributions
392     IF l_distribution_type IN ('STANDARD','PLANNED','BLANKET','SCHEDULED') THEN
393 
394       -- count number of distributions
395       SELECT COUNT(1) INTO l_distribution_count
396       FROM po_distributions_all pd
397       WHERE pd.line_location_id=l_line_location_id;
398 
399       IF (l_distribution_count = 0) THEN -- there are no sibling distributions
400 
404         l_transaction_line_rec_type.event_class_code         := PO_CONSTANTS_SV.PO_EVENT_CLASS_CODE;
401         l_transaction_line_rec_type.internal_organization_id := l_org_id;
402         l_transaction_line_rec_type.application_id           := FND_GLOBAL.resp_appl_id;
403         l_transaction_line_rec_type.entity_code              := PO_CONSTANTS_SV.PO_ENTITY_CODE ;
405         l_transaction_line_rec_type.event_type_code          := PO_CONSTANTS_SV.PO_ADJUSTED;
406         l_transaction_line_rec_type.trx_id                   := NVL(l_po_release_id, l_po_header_id);
407         l_transaction_line_rec_type.trx_level_type           := 'SHIPMENT';
408         l_transaction_line_rec_type.trx_line_id              := l_line_location_id;
409 
410         -- Call eTax API to delete corrsponding tax distributions
411         ZX_API_PUB.delete_tax_distributions(
412           p_api_version             =>  1.0,
413           p_init_msg_list           =>  FND_API.G_TRUE,
414           p_commit                  =>  FND_API.G_FALSE,
415           p_validation_level        =>  FND_API.G_VALID_LEVEL_FULL,
416           x_return_status           =>  l_return_status,
417           x_msg_count               =>  l_msg_count,
418           x_msg_data                =>  l_msg_data,
419           p_transaction_line_rec    =>  l_transaction_line_rec_type
420         );
421         IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
422             RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
423         END IF;
424       ELSE -- there are sibling distributions
425 
426         -- Mark parent shipment as DIST_DELETE so that its tax distributions
427         -- get redistributed with a call to determine_recovery later on
428         UPDATE po_line_locations
429         SET tax_attribute_update_code = 'DIST_DELETE'
430         WHERE tax_attribute_update_code IS NULL
431         AND line_location_id=l_line_location_id;
432 
433       END IF; --IF (l_distribution_count = 0)
434     END IF; --IF l_distribution_type IN ...
435     --<eTax Integration R12 End>
436 
437 
438 EXCEPTION
439     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
440         -- Bug 3529594: vinokris
441         -- Had to remove the sql_error procedure, since
442         -- that was looking for a sql error number.
443         PO_MESSAGE_S.app_error(
444           error_name => 'PO_CUSTOM_MSG',
445           token1     => 'TRANSLATED_TOKEN',
446           value1     => l_msg_data);
447         -- End Bug 3529594
448         RAISE;
449 
450   END Delete_Row;
451 
452 
453 END PO_DISTRIBUTIONS_PKG2;