DBA Data[Home] [Help]

PACKAGE BODY: APPS.OE_BULK_TAX_UTIL

Source


1 PACKAGE BODY OE_BULK_TAX_UTIL AS
2 /* $Header: OEBUTAXB.pls 120.0.12010000.7 2009/01/21 13:02:12 smanian noship $ */
3 
4 G_PKG_NAME         CONSTANT     VARCHAR2(30):= 'OE_BULK_TAX_UTIL';
5 
6 Procedure Debug_msg(p_index         IN  NUMBER,
7 		    x_return_status OUT NOCOPY Varchar2) ;
8 
9 
10 Function get_le_id(p_order_type_id NUMBER
11                   , p_sold_to_customer_id NUMBER
12                   , p_bill_to_customer_id NUMBER
13                   , p_org_id NUMBER
14 ) RETURN NUMBER IS
15 
16 l_invoice_source_id     NUMBER;
17 l_invoice_source        VARCHAR2(50);
18 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
19 l_order_type_rec  OE_ORDER_CACHE.ORDER_TYPE_REC_TYPE;
20  l_customer_type                VARCHAR2(30);
21  l_customer_id                  NUMBER;
22  l_batch_source_id              NUMBER;
23  l_sold_to_customer_id          NUMBER;
24 l_cust_trx_type_id              NUMBER;
25 l_return_status         VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
26 l_legal_entity_id NUMBER;
27 l_msg_data                     VARCHAR2(1000);
28 BEGIN
29 
30       IF p_sold_to_customer_id IS NOT NULL THEN
31         l_customer_type := 'SOLD_TO';
32         l_customer_id := p_sold_to_customer_id;
33       ELSIF p_bill_to_customer_id IS NOT NULL THEN
34         l_customer_type := 'BILL_TO';
35         l_customer_id := p_bill_to_customer_id;
36       END IF;
37 
38      IF l_debug_level > 0 THEN
39        oe_debug_pub.add('l_customer_type:'||l_customer_type, 3);
40        oe_debug_pub.add('l_customer_id:'||l_customer_id, 3);
41      END IF;
42 l_order_type_rec := OE_ORDER_CACHE.Load_Order_Type(p_order_type_id);
43      l_invoice_source_id := l_order_type_rec.invoice_source_id;
44      l_cust_trx_type_id := l_order_type_rec.cust_trx_type_id;
45 
46      IF l_invoice_source_id IS NOT NULL THEN
47         IF l_debug_level  > 0 THEN
48           oe_debug_pub.add(  'INVOICE SOURCE ID IS ( 3 ) : '||L_INVOICE_SOURCE_ID , 5 ) ;
49         END IF;
50      ELSE
51         l_invoice_source := oe_sys_parameters.value('INVOICE_SOURCE', p_org_id);
52 
53                    IF (l_invoice_source IS NOT NULL) THEN
54                    SELECT batch_source_id
55                      INTO l_invoice_source_id
56                      FROM ra_batch_sources
57                     WHERE name = l_invoice_source;
58 
59                    END IF;
60 
61                    IF l_debug_level  > 0 THEN
62                        oe_debug_pub.add(  'INVOICE_SOURCE_ID IS ( 4 ) : '||L_INVOICE_SOURCE_ID , 5 ) ;
63                    END IF;
64     END IF;
65 
66     IF l_cust_trx_type_id IS NULL THEN
67           l_cust_trx_type_id := oe_sys_parameters.value('OE_INVOICE_TRANSACTION_TYPE_ID',p_org_id);
68           IF l_debug_level  > 0 THEN
69               oe_debug_pub.add(  'CUSTOMER TRANSACTION TYPE ID FROM sys parameter : '||L_CUST_TRX_TYPE_ID , 5 ) ;
70           END IF;
71    END IF;
72 
73    IF l_debug_level > 0 THEN
74        oe_debug_pub.add('customer type:'||l_customer_type,3);
75        oe_debug_pub.add('customer id:'||l_customer_id,3);
76        oe_debug_pub.add('ar trx type:'||l_cust_trx_type_id,3);
77        oe_debug_pub.add('batch source:'||l_invoice_source_id,3);
78        oe_debug_pub.add('OU:'||p_org_id,3);
79    END IF;
80 l_legal_entity_id := XLE_BUSINESSINFO_GRP.Get_OrdertoCash_Info(
81      x_return_status => l_return_status,                -- OUT
82      x_msg_data => l_msg_data,          -- OUT
83      p_customer_type => l_customer_type,                -- IN   P_customer_type
84      p_customer_id => l_customer_id,            -- IN   P_customer_id (sold_to/bill_to customer_id)
85      p_transaction_type_id => l_cust_trx_type_id,       -- IN   P_transaction_type_id
86      p_batch_source_id => l_invoice_source_id,          -- IN   P_batch_source_id
87      p_operating_unit_id => p_org_id    -- IN   P_operating_unit_id (org_id)
88      );
89 
90      IF l_return_status <> FND_API.G_RET_STS_SUCCESS OR l_legal_entity_id = -1 THEN
91 
92         IF l_debug_level > 0 THEN
93             oe_debug_pub.add('In getting legal_entity_id, return status error'||l_msg_data);
94         END IF;
95            IF l_msg_data is not null then
96              FND_MESSAGE.SET_NAME('ONT','ONT_AVAIL_GENERIC');
97              FND_MESSAGE.SET_TOKEN('TEXT',l_msg_data);
98              OE_MSG_PUB.Add;
99            ELSE
100              OE_MSG_PUB.Add_text('XLE call raised Error ' );  --For bug # 4206796
101            END IF;
102          RETURN -1;
103      END IF;
104 
105      IF l_debug_level > 0 THEN
106         oe_debug_pub.add('legal_entity_id is '||l_legal_entity_id);
107      END IF;
108 
109      RETURN l_legal_entity_id;
110   EXCEPTION
111       WHEN OTHERS THEN
112 
113         IF l_debug_level  > 0 THEN
114            oe_debug_pub.add(  'Error getting legal_entity_id'||sqlerrm);
115         END IF;
116       RETURN -1;
117 END get_le_id;
118 
119 PROCEDURE Get_Default_Tax_Code
120 IS
121 l_index                   NUMBER;
122 l_header_index            NUMBER;
123 l_index_inc               NUMBER;
124 l_error_inc               NUMBER;
125 l_remaining_lines         NUMBER;
126 x_tax_code                VARCHAR2(50);
127 x_vat_tax_id	          NUMBER;
128 x_amt_incl_tax_flag       VARCHAR2(1);
129 x_amt_incl_tax_override   VARCHAR2(1);
130 
131 
132 l_AR_Sys_Param_Rec       AR_SYSTEM_PARAMETERS_ALL%ROWTYPE;
133 l_sob_id                 NUMBER;
134 l_dummy                  VARCHAR2(10);
135 l_start_time             NUMBER;
136 l_end_time               NUMBER;
137 --
138 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
139 --
140 BEGIN
141 
142   IF l_debug_level  > 0 THEN
143     oe_debug_pub.add(  'ENTERING OE_BULK_TAX_UTIL.GET_DEFAULT_TAX_CODE' ) ;
144   END IF;
145   --Loop over the loaded lines to default the tax code
146   l_index := 1;
147   WHILE l_index <= OE_Bulk_Order_PVT.G_LINE_REC.LINE_ID.COUNT LOOP
148     l_index_inc := 1;
149 
150     --IF (OE_Bulk_Order_PVT.G_LINE_REC.tax_exempt_flag(l_index) = 'R'
151     --    OR
152      --   OE_Bulk_Order_PVT.G_LINE_REC.tax_calculation_flag(l_index) = 'Y')
153     --THEN
154    --bug7685103
155 
156       l_header_index := OE_Bulk_Order_PVT.G_LINE_REC.header_index(l_index);
157 
158 
159       IF l_debug_level  > 0 THEN
160         oe_debug_pub.add(  'line index: ' || l_index || '   line id: '|| OE_Bulk_Order_PVT.G_LINE_REC.line_id(l_index) || '    header index: ' || l_header_index || '    header id: ' || OE_Bulk_Order_PVT.G_HEADER_REC.header_id(l_header_index));
161       END IF;
162 
163       IF nvl(OE_Bulk_Order_PVT.G_HEADER_REC.lock_control(l_header_index),0) = -99
164       THEN
165         IF l_debug_level  > 0 THEN
166           oe_debug_pub.add(  'lock control set.  skipping header with header id: '|| OE_Bulk_Order_PVT.G_HEADER_REC.header_id(l_header_index));
167         END IF;
168         --Skip the remaining lines in this header as it is marked for error
169         l_remaining_lines := OE_Bulk_Order_PVT.G_HEADER_REC.end_line_index(l_header_index) - l_index;
170         l_index_inc := l_remaining_lines + 1;
171       ELSE
172 
173         --default the tax_date with the following precedence:  1. schedule_ship_date, 2. request_date, 3. promise_date, 4. sysdate
174         IF OE_Bulk_Order_PVT.G_LINE_REC.schedule_ship_date(l_index) IS NOT NULL
175         THEN
176           IF l_debug_level  > 0 THEN
177             oe_debug_pub.add(  'defaulting tax date from schedule ship date');
178           END IF;
179           OE_Bulk_Order_PVT.G_LINE_REC.tax_date(l_index) := OE_Bulk_Order_PVT.G_LINE_REC.schedule_ship_date(l_index);
180         ELSIF OE_Bulk_Order_PVT.G_LINE_REC.request_date(l_index) IS NOT NULL
181         THEN
182           IF l_debug_level  > 0 THEN
183             oe_debug_pub.add(  'defaulting tax date from request date');
184           END IF;
185           OE_Bulk_Order_PVT.G_LINE_REC.tax_date(l_index) := OE_Bulk_Order_PVT.G_LINE_REC.request_date(l_index);
186         ELSIF OE_Bulk_Order_PVT.G_LINE_REC.promise_date(l_index) IS NOT NULL
187         THEN
188           IF l_debug_level  > 0 THEN
189             oe_debug_pub.add(  'defaulting tax date from promise date');
190           END IF;
191           OE_Bulk_Order_PVT.G_LINE_REC.tax_date(l_index) := OE_Bulk_Order_PVT.G_LINE_REC.promise_date(l_index);
192         ELSE
193           IF l_debug_level  > 0 THEN
194             oe_debug_pub.add(  'defaulting tax date from sysdate');
195           END IF;
196           OE_Bulk_Order_PVT.G_LINE_REC.tax_date(l_index) := sysdate;
197         END IF;  --end of schedule_ship_date is not null
198 
199         --get the tax code
200         IF OE_Bulk_Order_PVT.G_LINE_REC.tax_code(l_index) IS NULL
201         THEN
202 
203           BEGIN
204 
205             IF l_debug_level  > 0 THEN
206               oe_debug_pub.add(  'before calling ZX_AR_TAX_CLASSIFICATN_DEF_PKG.GET_DEFAULT_TAX_CLASSIFICATION');
207 	      oe_debug_pub.add(  'OE_Bulk_Order_PVT.G_LINE_REC.org_id('||l_index||') :'||OE_Bulk_Order_PVT.G_LINE_REC.org_id(l_index) );
208             END IF;
209 
210  SELECT hsecs INTO l_start_time from v$timer;
211 
212 	ZX_AR_TAX_CLASSIFICATN_DEF_PKG.GET_DEFAULT_TAX_CLASSIFICATION
213 	      (     p_ship_to_site_use_id => OE_Bulk_Order_PVT.G_LINE_REC.ship_to_org_id(l_index) ,
214 	          p_bill_to_site_use_id => OE_Bulk_Order_PVT.G_LINE_REC.invoice_to_org_id(l_index),
215 	          p_inventory_item_id =>OE_Bulk_Order_PVT.G_LINE_REC.inventory_item_id(l_index) ,
216 	          p_organization_id     => OE_Bulk_Order_PVT.G_ITEM_ORG,
217 	          p_set_of_books_id     => OE_Bulk_Order_PVT.G_SOB_ID,
218 	          p_trx_date            => OE_Bulk_Order_PVT.G_LINE_REC.tax_date(l_index),
219 	          p_trx_type_id         => OE_Bulk_Order_PVT.G_LINE_REC.cust_trx_type_id(l_index),
220 	          p_tax_classification_code => x_tax_code,
221 	         -- p_cust_trx_id         => l_ra_cust_trx_type_id,
222 	         -- p_customer_id         => nvl(l_shipment_rec.ship_to_cust_party_id,l_shipment_header_rec.ship_to_cust_party_id),
223 	          appl_short_name       => 'ONT',
224 	          p_entity_code         => 'OE_ORDER_HEADERS',
225 	          p_event_class_code    => 'SALES_TRANSACTION_TAX_QUOTE',
226 	          p_application_id      => 660,
227 	          p_internal_organization_id => OE_Bulk_Order_PVT.G_LINE_REC.org_id(l_index) --bug7759207
228 	        );
229 
230 
231 
232 
233  SELECT hsecs INTO l_end_time from v$timer;
234 
235    FND_FILE.PUT_LINE(FND_FILE.LOG,'Time spent in GET_DEFAULT_TAX_CLASSIFICATION is (sec) '||((l_end_time-l_start_time)/100));
236 
237             IF l_debug_level  > 0 THEN
238               oe_debug_pub.add(  'after calling AZX_AR_TAX_CLASSIFICATN_DEF_PKG.GET_DEFAULT_TAX_CLASSIFICATION');
239               oe_debug_pub.add(  'tax code: ' || x_tax_code);
240               oe_debug_pub.add(  'vat tax id: ' || x_vat_tax_id);
241               oe_debug_pub.add(  'tax inclusive flag: ' || x_amt_incl_tax_flag);
242               oe_debug_pub.add(  'tax inclusive override: ' || x_amt_incl_tax_override);
243             END IF;
244 
245      --bug7685103
246      IF x_tax_code IS NULL
247          THEN
248 
249              /* Handle_Tax_Code_Error(p_index => l_index,
250                                     p_header_index => l_header_index,
251                                     x_index_inc => l_error_inc);
252 
253               IF l_error_inc IS NOT NULL
254               THEN
255               l_index_inc := l_error_inc;
256               END IF;
257 	     */
258 	     NULL;
259 
260       ELSE
261          OE_Bulk_Order_PVT.G_LINE_REC.tax_code(l_index) := x_tax_code;
262          oe_debug_pub.add(  ' Tax Code  :'|| OE_Bulk_Order_PVT.G_LINE_REC.tax_code(l_index),1);
263       END IF; -- tax_code IS NULL
264 
265 
266           EXCEPTION
267             WHEN OTHERS THEN
268 
269               IF l_debug_level  > 0 THEN
270                 oe_debug_pub.add(  'in others exception in get default tax: ' || SQLERRM);
271               END IF;
272 
273 	      OE_Bulk_Order_PVT.G_LINE_REC.tax_code(l_index) := x_tax_code;
274 
275 	      /*Handle_Tax_Code_Error(p_index => l_index,
276                                     p_header_index => l_header_index,
277                                     x_index_inc => l_error_inc);
278 
279               IF l_error_inc IS NOT NULL
280               THEN
281               l_index_inc := l_error_inc;
282               END IF;*/
283 	      --bug7685103
284 
285           END;
286         END IF;  --end of IF tax_code is NULL
287 
288  SELECT hsecs INTO l_start_time from v$timer;
289 
290    --bug7685103
291    --This validation will be done in OEBLLINB.pls
292    /* -- Validating Tax Information
293         IF OE_Bulk_Order_PVT.G_LINE_REC.tax_code(l_index) IS NOT NULL AND
294            OE_Bulk_Order_PVT.G_LINE_REC.tax_date(l_index) IS NOT NULL
295         THEN
296           BEGIN
297             IF oe_code_control.code_release_level >= '110510' THEN
298 
299               l_AR_Sys_Param_Rec := OE_Sys_Parameters_Pvt.Get_AR_Sys_Params(OE_GLOBALS.G_ORG_ID);
300               l_sob_id := l_AR_Sys_Param_Rec.set_of_books_id;
301 
302               SELECT 'VALID'
303               INTO   l_dummy
304               FROM   AR_VAT_TAX V
305               WHERE  V.TAX_CODE = OE_Bulk_Order_PVT.G_LINE_REC.tax_code(l_index)
306               AND V.SET_OF_BOOKS_ID = l_sob_id
307               AND NVL(V.ENABLED_FLAG,'Y')='Y'
308               AND NVL(V.TAX_CLASS,'O')='O'
309               AND NVL(V.DISPLAYED_FLAG,'Y')='Y'
310               AND TRUNC(OE_Bulk_Order_PVT.G_LINE_REC.tax_date(l_index))
311               BETWEEN TRUNC(V.START_DATE) AND
312               TRUNC(NVL(V.END_DATE, OE_Bulk_Order_PVT.G_LINE_REC.tax_date(l_index)))
313               AND ROWNUM = 1;
314 
315               ELSE
316 
317               SELECT 'VALID'
318               INTO   l_dummy
319               FROM   AR_VAT_TAX V,
320                      AR_SYSTEM_PARAMETERS P
321               WHERE  V.TAX_CODE = OE_Bulk_Order_PVT.G_LINE_REC.tax_code(l_index)
322               AND V.SET_OF_BOOKS_ID = P.SET_OF_BOOKS_ID
323               AND NVL(V.ENABLED_FLAG,'Y')='Y'
324               AND NVL(V.TAX_CLASS,'O')='O'
325               AND NVL(V.DISPLAYED_FLAG,'Y')='Y'
326               AND TRUNC(OE_Bulk_Order_PVT.G_LINE_REC.tax_date(l_index))
327               BETWEEN TRUNC(V.START_DATE) AND
328               TRUNC(NVL(V.END_DATE, OE_Bulk_Order_PVT.G_LINE_REC.tax_date(l_index)))
329               AND ROWNUM = 1;
330 
331             END IF;
332 
333 
334  SELECT hsecs INTO l_end_time from v$timer;
335 
336    FND_FILE.PUT_LINE(FND_FILE.LOG,'Time spent validating tax information is (sec) '||((l_end_time-l_start_time)/100));
337 
338           EXCEPTION
339             WHEN OTHERS THEN
340               IF l_debug_level  > 0 THEN
341                 oe_debug_pub.add(  'OTHERS WHEN VALIDATING TAX CODE ' || SQLERRM ) ;
342               END IF;
343               fnd_message.set_name('ONT','OE_INVALID_ATTRIBUTE');
344               FND_MESSAGE.SET_TOKEN('ATTRIBUTE','Entity: Tax Code');
345               OE_BULK_MSG_PUB.Add('Y','ERROR');
346 
347               Handle_Tax_Code_Error(p_index => l_index,
348                                     p_header_index => l_header_index,
349                                     x_index_inc => l_error_inc);
350 
351               IF l_error_inc IS NOT NULL
352               THEN
353               l_index_inc := l_error_inc;
354               END IF;
355 
356           END; -- BEGIN
357         END IF;
358 
359 */
360 
361     END IF;  -- end of IF lock_control = -99
362 
363     --END IF;  -- end of IF tax_exempt_flag = R or tax_calculation_flag = Y
364 
365     l_index := l_index + l_index_inc;
366   END LOOP;
367 
368 
369 IF l_debug_level  > 0 THEN
370   oe_debug_pub.add(  'EXITING OE_BULK_TAX_UTIL.GET_DEFAULT_TAX_CODE' ) ;
371 END IF;
372 
373  EXCEPTION
374   WHEN OTHERS THEN
375 
376   IF l_debug_level  > 0 THEN
377      oe_debug_pub.add(  'in others exception: ' || SQLERRM);
378   END IF;
379 
380   IF OE_BULK_MSG_PUB.check_msg_level(OE_BULK_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
381   THEN
382     OE_BULK_MSG_PUB.add_exc_msg
383     (G_PKG_NAME
384     ,'Get_Default_Tax_Code'
385     );
386   END IF;
387   RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
388 END Get_Default_Tax_Code;
389 
390 
391 PROCEDURE Calculate_Tax
392           (p_post_insert            IN    BOOLEAN
393           )
394 IS
395 
399 l_index                   NUMBER;
396 
397 
398 -- 11510
400 l_header_index            NUMBER;
401 l_index_inc               NUMBER;
402 l_tax_index               NUMBER;
403 l_header_id               NUMBER;
404 l_line_id                 NUMBER;
405 l_order_type_cache_key    NUMBER;
406 l_remaining_lines         NUMBER;
407 l_tax_code_cache_key      NUMBER;
408 l_ship_to_cache_key       NUMBER;
409 l_invoice_to_cache_key    NUMBER;
410 l_asgn_org_id             NUMBER;
411 l_salesrep_cache_key      NUMBER;
412 l_person_id               NUMBER;
413 l_tax_method              VARCHAR2(30);
414 l_vendor_installed        VARCHAR2(1);
415 l_AR_Sys_Param_Rec	  AR_SYSTEM_PARAMETERS_ALL%ROWTYPE;
416 l_bill_to_cust_id         NUMBER;
417 l_bill_to_location_id     NUMBER;
418 l_bill_to_cust_acct_site_id    NUMBER;
419 l_bill_to_cust_account_id      NUMBER;
420 l_bill_to_account_number       VARCHAR2(30);
421 l_bill_su_tax_hdr_flag  VARCHAR2(1);
422 l_bill_acct_tax_hdr_flag  VARCHAR2(1);
423 l_bill_to_su_tax_rnd_rule        VARCHAR2(30);
424 l_bill_to_acct_tax_rnd_rule      VARCHAR2(30);
425 l_bill_to_state           VARCHAR2(60);
426 l_bill_to_party_name      VARCHAR2(360);
427 l_ship_to_cust_id         NUMBER;
428 l_ship_to_location_id     NUMBER;
429 l_ship_to_state           VARCHAR2(60);
430 l_ship_to_cust_acct_site_id    NUMBER;
431 l_ship_to_cust_account_id      NUMBER;
432 l_ship_to_account_number  VARCHAR2(30);
433 l_ship_to_party_name      VARCHAR2(360);
434 l_ship_su_tax_hdr_flag  VARCHAR2(1);
435 l_ship_acct_tax_hdr_flag  VARCHAR2(1);
436 l_ship_to_su_tax_rnd_rule        VARCHAR2(30);
437 l_ship_to_acct_tax_rnd_rule      VARCHAR2(30);
438 x_tax_value                           NUMBER;
439 l_x_msg_count                  NUMBER;
440 l_x_msg_data                   VARCHAR2(2000);
441 l_return_status                  VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
442 l_tax_value               NUMBER := 0;
443 l_tax_code                VARCHAR2(50);
444 l_adj_index               NUMBER;
445 l_start_time             NUMBER;
446 l_end_time               NUMBER;
447 l_load_person_failed     Boolean := false;
448 
449  l_msg_count                    NUMBER;
450  l_msg_data                     VARCHAR2(1000);
451  I                        INTEGER;
452   J                       INTEGER;
453  l_call_tax                     VARCHAR2(1) := 'N';
454  l_minimum_accountable_unit     fnd_currencies.minimum_accountable_unit%type;
455  l_precision                    fnd_currencies.precision%type;
456  l_ship_from_location_id        NUMBER;
457  l_commitment_id                oe_order_lines.commitment_id%type;
458  l_currency_code                VARCHAR2(30);
459  l_inventory_org_id             NUMBER;
460  l_header_org_id                NUMBER;
461  l_conversion_rate              NUMBER;
462  l_cust_trx_type_id             ra_cust_trx_types_all.cust_Trx_type_id%type;
463  l_legal_entity_id              NUMBER(15);
464  l_ship_party_id                NUMBER(15);
465  l_ship_party_site_id           NUMBER(15);
466  l_ship_location_id             NUMBER(15);
467  l_bill_party_id                NUMBER(15);
468  l_bill_party_site_id           NUMBER(15);
469  l_bill_location_id             NUMBER(15);
470  l_ship_to_site_use_id          HZ_CUST_SITE_USES_ALL.SITE_USE_ID%type;
471  l_ship_to_address_id           NUMBER ;
472  l_ship_to_customer_id          NUMBER ;
473  l_ship_to_postal_code          VARCHAR2(60);
474  l_ship_to_customer_name        VARCHAR2(360);
475  l_ship_to_customer_number      VARCHAR2(30);
476  l_bill_to_address_id           NUMBER;
477  l_bill_to_site_use_id          NUMBER;
478  l_bill_to_customer_id          NUMBER;
479  l_bill_to_postal_code          VARCHAR2(60);
480  l_internal_org_location_id        NUMBER;
481  l_bill_to_customer_name        VARCHAR2(360);
482  l_transaction_rec zx_api_pub.transaction_rec_type;
483  l_entity_code_crsr             zx_detail_tax_lines_gt.entity_code%TYPE := 'OE_ORDER_HEADERS';
484  l_event_class_code_crsr        zx_detail_tax_lines_gt.event_class_code%TYPE := 'SALES_TRANSACTION_TAX_QUOTE';
485  l_trx_level_type_crsr          zx_detail_tax_lines_gt.trx_level_type%TYPE;
486  l_application_id               NUMBER := 660;
487  l_bill_from_location_id        NUMBER;
488  l_POO_LOCATION_ID              NUMBER;
489  l_doc_level_recalc_flag varchar2(30);
490 
491 CURSOR get_internal_loc(p_organization_id number) IS
492  select location_id
493  from   hr_organization_units
494  where  organization_id = p_organization_id;
495 
496 
497 cursor getlocinfo(p_site_org_id HZ_CUST_SITE_USES_ALL.SITE_USE_ID%type) is
498  SELECT /* MOAC_SQL_CHANGE */ s_ship.site_use_id,
499        s_ship.cust_acct_site_id,
500        acct_site_ship.cust_account_id,
501        loc_ship.postal_code,
502        party.party_name,
503        cust_acct.account_number,
504        party.party_id,
505        party_site_ship.party_site_id,
506        loc_ship.location_id
507  FROM
508        HZ_CUST_SITE_USES           S_SHIP ,
509        HZ_CUST_ACCT_SITES_ALL      ACCT_SITE_SHIP,
510        HZ_PARTY_SITES              PARTY_SITE_SHIP,
511        HZ_LOCATIONS                LOC_SHIP,
512        HZ_PARTIES                  PARTY,
513        HZ_CUST_ACCOUNTS_ALL        CUST_ACCT
514 WHERE  s_ship.site_use_id = p_site_org_id
515   AND  s_ship.cust_acct_site_id  = acct_site_ship.cust_acct_site_id
516   and  acct_site_ship.cust_account_id = cust_acct.cust_account_id
517   and  cust_acct.party_id = party.party_id
518   and  acct_site_ship.party_site_id = party_site_ship.party_site_id
519   and  party_site_ship.location_id = loc_ship.location_id;
520 
521 CURSOR detail_tax_lines_gt (p_header_id oe_order_lines.header_id%type)
522                           --  p_line_id oe_order_lines.line_id%type)
523   is
524   select * from
525   ZX_DETAIL_TAX_LINES_GT
529   and event_class_code = l_event_class_code_crsr --'SALES_TRANSACTION_TAX_QUOTE'
526   where
527   application_id = l_application_id
528   and entity_code = l_entity_code_crsr           --'OE_ORDER_HEADERS'
530   and trx_id =  p_header_id
531   --and trx_line_id = p_line_id
532   and trx_level_type = 'LINE';
533 
534 
535  detail_tax_lines_gt_rec detail_tax_lines_gt%rowtype;
536 --
537 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
538 --
539 BEGIN
540 
541 
542   IF l_debug_level  > 0 THEN
543     oe_debug_pub.add(  'ENTERING OE_BULK_TAX_UTIL.CALCULATE_TAX' ) ;
544     IF p_post_insert THEN
545       oe_debug_pub.add(  'Post_insert : TRUE');
546     ELSE
547       oe_debug_pub.add(  'Post_insert : FALSE');
548     END IF;
549   END IF;
550 
551 
552 
553   IF l_debug_level  > 0 THEN
554     oe_debug_pub.add(  'tax method: ' || l_tax_method || '    vendor installed: ' || l_vendor_installed);
555   END IF;
556 
557 
558   --l_AR_Sys_Param_Rec := OE_SYS_PARAMETERS_PVT.Get_AR_Sys_Params;
559 
560 
561   --Loop over the loaded lines to calculate the tax
562   l_index := 1;
563   l_tax_index := 1;
564   l_adj_index := 1;
565 
566   WHILE l_index <= OE_Bulk_Order_PVT.G_LINE_REC.LINE_ID.COUNT LOOP
567     l_tax_value := 0;
568     l_index_inc := 1;
569     l_header_index := OE_Bulk_Order_PVT.G_LINE_REC.header_index(l_index);
570     l_header_id := OE_Bulk_Order_PVT.G_LINE_REC.header_id(l_index);
571     l_line_id := OE_Bulk_Order_PVT.G_LINE_REC.line_id(l_index);
572     zx_global_structures_pkg.init_trx_line_dist_tbl(l_index);
573       IF l_debug_level  > 0 THEN
574         oe_debug_pub.add(  'line index: ' || l_index || '   line id: '|| l_line_id || '    header index: ' || l_header_index || '    header id: ' || l_header_id);
575       END IF;
576 
577 
578     IF nvl(OE_Bulk_Order_PVT.G_HEADER_REC.lock_control(l_header_index),0) = -99
579       THEN
580 
581         IF l_debug_level  > 0 THEN
582           oe_debug_pub.add(  'lock control set.  skipping header with header id: '|| l_header_id);
583         END IF;
584 
585        l_legal_entity_id := get_le_id(p_order_type_id =>
586 OE_Bulk_Order_PVT.G_HEADER_REC.order_type_id(l_header_index)
587                                  , p_sold_to_customer_id =>
588 OE_Bulk_Order_PVT.G_HEADER_REC.sold_to_org_id(l_header_index)
589                                  , p_bill_to_customer_id => l_bill_to_customer_id
590                                  , p_org_id         => OE_Bulk_Order_PVT.G_HEADER_REC.org_id(l_header_index)
591                                   );
592 
593 
594         --Skip the remaining lines in this header as it is marked for error
595         l_remaining_lines := OE_Bulk_Order_PVT.G_HEADER_REC.end_line_index(l_header_index) - l_index;
596         l_index_inc := l_remaining_lines + 1;
597       ELSE
598       IF l_debug_level  > 0 THEN
599         oe_debug_pub.add('inventory_item_id: ' || OE_Bulk_Order_PVT.G_LINE_REC.inventory_item_id(l_index));
600         oe_debug_pub.add('unit_selling_price: ' || OE_Bulk_Order_PVT.G_LINE_REC.unit_selling_price(l_index));
601         oe_debug_pub.add('tax_exempt_flag: ' || OE_Bulk_Order_PVT.G_LINE_REC.tax_exempt_flag(l_index));
602         oe_debug_pub.add('tax_calculation_flag: ' || OE_Bulk_Order_PVT.G_LINE_REC.tax_calculation_flag(l_index));
603       END IF;
604 
605        begin
606         select location_id
607         into l_bill_from_location_id
608         from HR_ALL_ORGANIZATION_UNITS
609         where organization_id = OE_Bulk_Order_PVT.G_HEADER_REC.org_id(l_header_index);
610       Exception
611         when others then
612         l_bill_from_location_id := NULL;
613      End;
614 
615     open get_internal_loc(OE_Bulk_Order_PVT.G_HEADER_REC.org_id(l_header_index));
616      fetch get_internal_loc into l_internal_org_location_id;
617      close get_internal_loc;
618 
619      IF l_debug_level > 0 then
620          oe_debug_pub.add('om_tax_line  13' , 4);
621 	  oe_debug_pub.add('OE_Bulk_Order_PVT.G_LINE_REC.inventory_item_id(l_index):'||OE_Bulk_Order_PVT.G_LINE_REC.inventory_item_id(l_index));
622 	   oe_debug_pub.add('OE_Bulk_Order_PVT.G_LINE_REC.unit_selling_price(l_index):'||OE_Bulk_Order_PVT.G_LINE_REC.unit_selling_price(l_index));
623 	    oe_debug_pub.add('OE_Bulk_Order_PVT.G_LINE_REC.item_type_code(l_index):'||OE_Bulk_Order_PVT.G_LINE_REC.item_type_code(l_index));
624       END IF;
625 
626 
627       IF ((OE_Bulk_Order_PVT.G_LINE_REC.inventory_item_id(l_index) IS NOT NULL
628           AND OE_Bulk_Order_PVT.G_LINE_REC.unit_selling_price(l_index) IS NOT NULL
629           AND OE_Bulk_Order_PVT.G_LINE_REC.item_type_code(l_index) <> OE_GLOBALS.G_ITEM_INCLUDED)
630 	  )
631           --AND
632          --(OE_Bulk_Order_PVT.G_LINE_REC.tax_exempt_flag(l_index) = 'R' OR
633           --OE_Bulk_Order_PVT.G_LINE_REC.tax_calculation_flag(l_index) = 'Y'))
634 	  --bug7685103
635       THEN
636 
637          l_order_type_cache_key := OE_BULK_CACHE.Load_Order_Type(OE_Bulk_Order_PVT.G_HEADER_REC.order_type_id(l_header_index));
638 
639 	 IF l_debug_level  > 0 THEN
640            oe_debug_pub.add(  'tax calculation event: ' || OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_order_type_cache_key).tax_calculation_event);
641            oe_debug_pub.add(  'booked_flag: ' || nvl(OE_Bulk_Order_PVT.G_HEADER_REC.booked_flag(l_header_index), 'N'));
642          END IF;
643 
644 	 IF ((nvl(OE_Bulk_Order_PVT.G_HEADER_REC.booked_flag(l_header_index), 'N') = 'N' AND
645              OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_order_type_cache_key).tax_calculation_event = 'BOOKING')
646              OR
647             (OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_order_type_cache_key).tax_calculation_event NOT IN ('ENTERING', 'BOOKING')))
648          THEN
649            IF l_debug_level  > 0 THEN
653            --Skip the remaining lines in this header
650              oe_debug_pub.add(  'tax calculation event not set to ENTERING or BOOKING...OR....event is set to BOOKING but order is not booked.  skipping header with header id: '|| l_header_id);
651            END IF;
652 
654            l_remaining_lines := OE_Bulk_Order_PVT.G_HEADER_REC.end_line_index(l_header_index) - l_index;
655            l_index_inc := l_remaining_lines + 1;
656          ELSE
657 
658 	     oe_debug_pub.add(  'Set message Context ');
659            -- Set the message context for errors.
660            OE_BULK_MSG_PUB.set_msg_context
661                  ( p_entity_code                => 'LINE'
662           	 ,p_entity_id                   => l_line_id
663         	 ,p_header_id                   => l_header_id
664         	 ,p_line_id                     => l_line_id
665        		 ,p_orig_sys_document_ref       => OE_Bulk_Order_PVT.G_LINE_REC.orig_sys_document_ref(l_index)
666        		 ,p_orig_sys_document_line_ref  => OE_Bulk_Order_PVT.G_LINE_REC.orig_sys_line_ref(l_index)
667         	 ,p_source_document_id          => NULL
668        		 ,p_source_document_line_id     => NULL
669        		 ,p_order_source_id             => OE_Bulk_Order_PVT.G_LINE_REC.order_source_id(l_index)
670          	 ,p_source_document_type_id     => NULL
671                  );
672 
673 
674              IF l_debug_level  > 0 THEN
675                oe_debug_pub.add(  'loading tax attributes cache');
676              END IF;
677 
678 
679 
680     l_currency_code := OE_Bulk_Order_PVT.G_HEADER_REC.transactional_curr_code(l_header_index);
681     l_header_org_id := OE_Bulk_Order_PVT.G_HEADER_REC.org_id(l_header_index);
682     l_conversion_rate := OE_Bulk_Order_PVT.G_HEADER_REC.conversion_rate(l_header_index);
683     l_inventory_org_id := oe_sys_parameters.value('MASTER_ORGANIZATION_ID',OE_Bulk_Order_PVT.G_HEADER_REC.org_id(l_header_index));
684 
685 
686      select    c.minimum_accountable_unit,
687                c.precision
688      into      l_minimum_accountable_unit,
689                l_precision
690      from      fnd_currencies c
691      where     c.currency_code = l_currency_code;
692 
693      l_AR_Sys_Param_Rec          := OE_Sys_Parameters_Pvt.Get_AR_Sys_Params;
694 
695      --code changes made for bug 1883552  begin
696      l_commitment_id := nvl(OE_Bulk_Order_PVT.G_LINE_REC.commitment_id(l_index),0);
697      if l_commitment_id <> 0 then
698 
699 
700           IF l_debug_level > 0 THEN
701             oe_debug_pub.add('Commitment id is:'||l_commitment_id,4);
702           END IF;
703 
704           begin
705 
706            select /* MOAC_SQL_CHANGE */ nvl(cust_type.subsequent_trx_type_id, cust_type.cust_trx_type_id)
707            into l_cust_trx_type_id
708            from ra_cust_trx_types_all cust_type,
709                 ra_customer_trx cust_trx
710            where
711                 cust_type.cust_trx_type_id = cust_trx.cust_trx_type_id
712            and  cust_type.org_id = cust_trx.org_id
713            and  cust_trx.customer_trx_id = l_commitment_id;
714 
715           exception
716              when others then
717 
718              IF l_debug_level > 0 THEN
719                oe_debug_pub.add('In commitment exception ',4);
720              END IF;
721              null;
722           end;
723 
724         IF l_debug_level > 0 THEN
725           oe_debug_pub.add('cust trx type from commitment:'||l_cust_Trx_type_id,4);
726         END IF;
727      else
728 
729        IF l_debug_level > 0 THEN
730          oe_debug_pub.add('In else part of commitment id',4);
731        END IF;
732        /*l_cust_trx_type_id :=
733 OE_INVOICE_PUB.Get_Customer_Transaction_Type(OE_Bulk_Order_PVT.G_LINE_REC(l_index)); */
734 
735      end if;
736      --code changes made for bug 1883552  end
737 
738     IF l_debug_level > 0 THEN
739      oe_debug_pub.add('Customer trx type id is:'||l_cust_trx_type_id,4);
740     END IF;
741 
742 -- bug7685103 to avoid NO_DATA_FOUND exception
743  IF OE_Bulk_Order_PVT.G_LINE_REC.tax_code(l_index) IS NOT NULL THEN
744    l_tax_code_cache_key := OE_Bulk_Cache.load_tax_attributes(OE_Bulk_Order_PVT.G_LINE_REC.tax_code(l_index), OE_Bulk_Order_PVT.G_LINE_REC.tax_date(l_index));
745 
746              IF l_debug_level  > 0 THEN
747                oe_debug_pub.add('tax inclusive flag from cache:' || OE_BULK_CACHE.G_TAX_ATTRIBUTES_TBL(l_tax_code_cache_key).amount_includes_tax_flag);
748              END IF;
749 
750 END IF;
751 
752 
753 
754              BEGIN
755 
756                 l_salesrep_cache_key := OE_BULK_CACHE.Load_Salesrep(OE_Bulk_Order_PVT.G_LINE_REC.salesrep_id(l_index));
757                 l_person_id := OE_BULK_CACHE.G_SALESREP_TBL(l_salesrep_cache_key).person_id;
758 
759                 IF l_debug_level  > 0 THEN
760                          oe_debug_pub.add( 'Before Calling load_person: ' || l_person_id);
761                          oe_debug_pub.add( ' l_index :'|| l_index);
762                          oe_debug_pub.add( ' Tax Date :'|| OE_Bulk_Order_PVT.G_LINE_REC.tax_date(l_index));
763                 END IF;
764 
765                 l_asgn_org_id := OE_BULK_CACHE.Load_Person(l_person_id, OE_Bulk_Order_PVT.G_LINE_REC.tax_date(l_index));
766 
767              EXCEPTION
768                   When others then
769                       l_load_person_failed := true;
770                       IF l_debug_level  > 0 THEN
771                          oe_debug_pub.add(  'Load Person Failed. ' || SQLERRM);
772                       END IF;
773              END;
774 
775           IF l_load_person_failed THEN
776                     l_asgn_org_id := null;
777                     l_poo_location_id := NULL;
778                  ELSE
782 
779                     l_asgn_org_id := OE_BULK_CACHE.G_PERSON_TBL(l_person_id).ORGANIZATION_ID; -- the cache key is l_person_id only
780                     l_poo_location_id := OE_BULK_CACHE.G_PERSON_TBL(l_person_id).LOCATION_ID;
781                  END IF;
783 -- Legal Entity
784               oe_debug_pub.add(  ' Ship from org id :'|| OE_Bulk_Order_PVT.G_LINE_REC.ship_from_org_id(l_index));
785 
786            IF OE_Bulk_Order_PVT.G_LINE_REC.ship_from_org_id(l_index) IS NOT NULL THEN
787                BEGIN
788                  SELECT location_id
789                  INTO l_ship_from_location_id
790                  FROM hr_all_organization_units hu
791                  WHERE hu.organization_id = OE_Bulk_Order_PVT.G_LINE_REC.ship_from_org_id(l_index);
792               EXCEPTION
793                WHEN OTHERS THEN
794                NULL;
795              END;
796            END IF;
797 
798 
799  -- zx_global_structures_pkg.init_trx_line_dist_tbl(i);
800 
801              -- populate ship_to info if ship_to_org_id is not null
802              IF OE_Bulk_Order_PVT.G_LINE_REC.ship_to_org_id(l_index) IS NOT NULL
803              THEN
804                IF l_debug_level  > 0 THEN
805                  oe_debug_pub.add(  'retrieving ship_to info');
806                END IF;
807                l_ship_to_cache_key := OE_Bulk_Cache.load_loc_info(OE_Bulk_Order_PVT.G_LINE_REC.ship_to_org_id(l_index));
808                l_ship_to_cust_id := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).CUST_ACCOUNT_ID;
809                l_ship_to_postal_code := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).POSTAL_CODE;
810                l_ship_location_id := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).LOC_ID;
811 	       l_ship_to_state := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).STATE;
812 	       l_ship_to_cust_acct_site_id := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).CUST_ACCT_SITE_ID;
813                l_ship_to_cust_account_id := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).CUST_ACCOUNT_ID;
814                l_ship_to_account_number := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).ACCOUNT_NUMBER;
815                l_ship_party_id := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).PARTY_ID;
816                l_ship_to_party_name := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).PARTY_NAME;
817                l_ship_party_site_id := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).PARTY_SITE_ID;
818                l_ship_su_tax_hdr_flag := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).TAX_HEADER_LEVEL_FLAG;
819                l_ship_acct_tax_hdr_flag := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).ACCT_TAX_HEADER_LEVEL_FLAG;
820                l_ship_to_su_tax_rnd_rule := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).TAX_ROUNDING_RULE;
821                l_ship_to_acct_tax_rnd_rule := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).ACCT_TAX_ROUNDING_RULE;
822              END IF; -- end of if ship_to_org_id IS NOT NULL
823              oe_debug_pub.add(  'Ship to cache key :'|| l_ship_to_cache_key);
824              oe_debug_pub.add(  ' l_ship_party_id :'|| l_ship_party_id);
825              oe_debug_pub.add(  '  l_ship_location_id :'|| l_ship_location_id);
826              oe_debug_pub.add(  ' l_ship_to_cust_acct_site_id :'|| l_ship_to_cust_acct_site_id);
827              zx_global_structures_pkg.trx_line_dist_tbl.SHIP_TO_PARTY_ID(l_index)   := l_ship_party_id; --1001;
828              zx_global_structures_pkg.trx_line_dist_tbl.SHIP_TO_PARTY_SITE_ID(l_index)      := l_ship_party_site_id;--1024;
829              zx_global_structures_pkg.trx_line_dist_tbl.SHIP_TO_LOCATION_ID(l_index)        := l_ship_location_id;--1067;
830              zx_global_structures_pkg.trx_line_dist_tbl.SHIP_THIRD_PTY_ACCT_SITE_ID(l_index) := l_ship_to_cust_acct_site_id;--1024;
831              zx_global_structures_pkg.trx_line_dist_tbl.SHIP_TO_CUST_ACCT_SITE_USE_ID(l_index) := OE_Bulk_Order_PVT.G_LINE_REC.ship_to_org_id(l_index);--1007;
832              zx_global_structures_pkg.trx_line_dist_tbl.SHIP_THIRD_PTY_ACCT_ID(l_index) := l_ship_to_cust_account_id;--1001;
833 
834 
835              -- populate invoice_to info if invoice_to_org_id is not null
836              IF OE_Bulk_Order_PVT.G_LINE_REC.invoice_to_org_id(l_index) IS NOT NULL
837              THEN
838                IF l_debug_level  > 0 THEN
839                  oe_debug_pub.add(  'retrieving bill_to info');
840                END IF;
841                l_invoice_to_cache_key := OE_Bulk_Cache.load_loc_info(OE_Bulk_Order_PVT.G_LINE_REC.invoice_to_org_id(l_index));
842                l_bill_to_cust_id := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).CUST_ACCOUNT_ID;
843                l_bill_to_postal_code := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).POSTAL_CODE;
844                l_bill_location_id := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).LOC_ID;
845                l_bill_to_state := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).STATE;
846                l_bill_to_cust_acct_site_id := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).CUST_ACCT_SITE_ID;
847                l_bill_to_cust_account_id := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).CUST_ACCOUNT_ID;
848                l_bill_to_account_number := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).ACCOUNT_NUMBER;
849                l_bill_party_id          := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).PARTY_ID;
850                l_bill_to_party_name := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).PARTY_NAME;
851                l_bill_party_site_id  := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).PARTY_SITE_ID;
852                l_bill_su_tax_hdr_flag := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).TAX_HEADER_LEVEL_FLAG;
853                l_bill_acct_tax_hdr_flag := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).ACCT_TAX_HEADER_LEVEL_FLAG;
854                l_bill_to_su_tax_rnd_rule := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).TAX_ROUNDING_RULE;
855                l_bill_to_acct_tax_rnd_rule := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).ACCT_TAX_ROUNDING_RULE;
856              END IF;  --end of if invoice_to_org_id IS NOT NULL
857 
858 
862                                  , p_org_id         => OE_Bulk_Order_PVT.G_HEADER_REC.org_id(l_header_index)
859         l_legal_entity_id := get_le_id(p_order_type_id => OE_Bulk_Order_PVT.G_HEADER_REC.order_type_id(l_header_index)
860                                      , p_sold_to_customer_id => OE_Bulk_Order_PVT.G_HEADER_REC.sold_to_org_id(l_header_index)
861                                  , p_bill_to_customer_id => l_bill_to_cust_id
863                                   );
864 
865 
866      oe_debug_pub.add(  ' Assign Bill To info ');
867                  oe_debug_pub.add(  'Bill to cache key :'|| l_invoice_to_cache_key);
868              oe_debug_pub.add(  ' l_bill_party_id :'|| l_bill_party_id);
869              oe_debug_pub.add(  '  l_bill_location_id :'|| l_bill_location_id);
870              oe_debug_pub.add(  ' l_ship_to_cust_acct_site_id :'|| l_bill_to_cust_acct_site_id);
871 
872                 zx_global_structures_pkg.trx_line_dist_tbl.BILL_TO_PARTY_ID(l_index) := l_bill_party_id;
873                 zx_global_structures_pkg.trx_line_dist_tbl.BILL_TO_PARTY_SITE_ID(l_index)      := l_bill_party_site_id; --1024;
874                 zx_global_structures_pkg.trx_line_dist_tbl.BILL_TO_LOCATION_ID(l_index)        := l_bill_location_id;--1067;
875                 zx_global_structures_pkg.trx_line_dist_tbl.BILL_THIRD_PTY_ACCT_SITE_ID(l_index) := l_bill_to_cust_acct_site_id;--1024;
876                 zx_global_structures_pkg.trx_line_dist_tbl.BILL_TO_CUST_ACCT_SITE_USE_ID(l_index) := OE_Bulk_Order_PVT.G_LINE_REC.invoice_to_org_id(l_index);--1006;
877                 zx_global_structures_pkg.trx_line_dist_tbl.BILL_THIRD_PTY_ACCT_ID(l_index) := l_bill_to_cust_account_id;
878 
879 
880        oe_debug_pub.add(  ' Assign other values ',1);
881        l_call_tax := 'Y'; --bug7685103 --Call ZX api only if there is atleast one eligible line to be taxed
882 
883        zx_global_structures_pkg.trx_line_dist_tbl.APPLICATION_ID(l_index)	:= 660;
884        zx_global_structures_pkg.trx_line_dist_tbl.ENTITY_CODE(l_index)	:= 'OE_ORDER_HEADERS';
885        zx_global_structures_pkg.trx_line_dist_tbl.EVENT_CLASS_CODE(l_index)	:= 'SALES_TRANSACTION_TAX_QUOTE';
886        zx_global_structures_pkg.trx_line_dist_tbl.TRX_ID(l_index)		:= OE_Bulk_Order_PVT.G_Line_Rec.header_id(l_index);
887        zx_global_structures_pkg.trx_line_dist_tbl.TRX_LEVEL_TYPE(l_index)	:= 'LINE';
888 
889        zx_global_structures_pkg.trx_line_dist_tbl.INTERNAL_ORGANIZATION_ID(l_index)          := OE_Bulk_Order_PVT.G_Header_Rec.org_id(l_header_index);
890        zx_global_structures_pkg.trx_line_dist_tbl.EVENT_TYPE_CODE(l_index)                   := 'CREATE';
891 
892        zx_global_structures_pkg.trx_line_dist_tbl.TRX_DATE(l_index)               := OE_Bulk_Order_PVT.G_Line_Rec.TAX_DATE(l_index);
893 
894        zx_global_structures_pkg.trx_line_dist_tbl.TRX_DOC_REVISION(l_index)                  := NULL; --   VARCHAR2_150_tbl_type  ,
895        zx_global_structures_pkg.trx_line_dist_tbl.LEDGER_ID(l_index)                         := l_AR_Sys_Param_Rec.set_of_books_id;
896        zx_global_structures_pkg.trx_line_dist_tbl.TRX_CURRENCY_CODE(l_index)                 := OE_Bulk_Order_PVT.G_Header_Rec.transactional_curr_code(l_header_index);
897        oe_debug_pub.add(  '1:');
898 
899        zx_global_structures_pkg.trx_line_dist_tbl.CURRENCY_CONVERSION_DATE(l_index)          := OE_Bulk_Order_PVT.G_Header_Rec.conversion_rate_Date(l_header_index);
900        zx_global_structures_pkg.trx_line_dist_tbl.CURRENCY_CONVERSION_RATE(l_index)          := OE_Bulk_Order_PVT.G_Header_Rec.conversion_rate(l_header_index);
901        zx_global_structures_pkg.trx_line_dist_tbl.CURRENCY_CONVERSION_TYPE(l_index)          := OE_Bulk_Order_PVT.G_Header_Rec.CONVERSION_TYPE_CODE(l_header_index);
902        zx_global_structures_pkg.trx_line_dist_tbl.MINIMUM_ACCOUNTABLE_UNIT(l_index)          := G_MINIMUM_ACCOUNTABLE_UNIT;
903        zx_global_structures_pkg.trx_line_dist_tbl.PRECISION(l_index)                         := l_precision;
904    -- revisit the logic to derive legal_entity_id later when legal_entity_id approach is clarified.
905        zx_global_structures_pkg.trx_line_dist_tbl.LEGAL_ENTITY_ID(l_index)                   := l_legal_entity_id; --   NUMBER_tbl_type        ,
906        zx_global_structures_pkg.trx_line_dist_tbl.ESTABLISHMENT_ID(l_index)                  := NULL; --   NUMBER_tbl_type        ,
907        zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_TRX_NUMBER(l_index)           := NULL; --   VARCHAR2_150_tbl_type  ,
908        zx_global_structures_pkg.trx_line_dist_tbl.TRX_NUMBER(l_index)                        := OE_Bulk_Order_PVT.G_Header_Rec.order_number(l_header_index);
909        oe_debug_pub.add(  '2:');
910        zx_global_structures_pkg.trx_line_dist_tbl.TRX_DESCRIPTION(l_index)                   := NULL; --   VARCHAR2_240_tbl_type  ,
911        zx_global_structures_pkg.trx_line_dist_tbl.TRX_COMMUNICATED_DATE(l_index)             := NULL; --   DATE_tbl_type          ,
912        zx_global_structures_pkg.trx_line_dist_tbl.BATCH_SOURCE_ID(l_index)                   := NULL; --   NUMBER_tbl_type        ,
913        zx_global_structures_pkg.trx_line_dist_tbl.BATCH_SOURCE_NAME(l_index)                 := NULL; --   VARCHAR2_150_tbl_type  ,
914        zx_global_structures_pkg.trx_line_dist_tbl.DOC_SEQ_ID(l_index)                        := NULL; --   NUMBER_tbl_type        ,
915        zx_global_structures_pkg.trx_line_dist_tbl.DOC_SEQ_NAME(l_index)                      := NULL; --   VARCHAR2_150_tbl_type  ,
916        zx_global_structures_pkg.trx_line_dist_tbl.DOC_SEQ_VALUE(l_index)                     := NULL; --   VARCHAR2_240_tbl_type  ,
917        zx_global_structures_pkg.trx_line_dist_tbl.TRX_DUE_DATE(l_index)                      := NULL; --   DATE_tbl_type          ,
918        zx_global_structures_pkg.trx_line_dist_tbl.TRX_TYPE_DESCRIPTION(l_index)              := NULL; --   VARCHAR2_240_tbl_type  ,
919        zx_global_structures_pkg.trx_line_dist_tbl.FIRST_PTY_ORG_ID(l_index)                  := NULL; --   NUMBER_tbl_type        ,
920        zx_global_structures_pkg.trx_line_dist_tbl.RECEIVABLES_TRX_TYPE_ID(l_index)           := l_cust_trx_type_id;
921        zx_global_structures_pkg.trx_line_dist_tbl.TAX_EVENT_CLASS_CODE(l_index)              := NULL; --   VARCHAR2_30_tbl_type   ,
922        zx_global_structures_pkg.trx_line_dist_tbl.TAX_EVENT_TYPE_CODE(l_index)               := NULL; --   VARCHAR2_30_tbl_type   ,
926        zx_global_structures_pkg.trx_line_dist_tbl.SUPPLIER_TAX_INVOICE_DATE(l_index)         := NULL; --   DATE_tbl_type          ,
923        zx_global_structures_pkg.trx_line_dist_tbl.DOC_EVENT_STATUS(l_index)                  := NULL; --   VARCHAR2_30_tbl_type   ,
924        zx_global_structures_pkg.trx_line_dist_tbl.DOCUMENT_SUB_TYPE(l_index)                 := NULL; --   VARCHAR2_240_tbl_type  ,
925        zx_global_structures_pkg.trx_line_dist_tbl.SUPPLIER_TAX_INVOICE_NUMBER(l_index)       := NULL; --   VARCHAR2_150_tbl_type  ,
927        zx_global_structures_pkg.trx_line_dist_tbl.SUPPLIER_EXCHANGE_RATE(l_index)            := NULL; --   NUMBER_tbl_type        ,
928        zx_global_structures_pkg.trx_line_dist_tbl.TAX_INVOICE_DATE(l_index)                  := NULL; --   DATE_tbl_type          ,
929        zx_global_structures_pkg.trx_line_dist_tbl.TAX_INVOICE_NUMBER(l_index)                := NULL; --   VARCHAR2_150_tbl_type  ,
930        zx_global_structures_pkg.trx_line_dist_tbl.QUOTE_FLAG(l_index)                        := 'Y'; --   VARCHAR2_1_tbl_type   ,
931        zx_global_structures_pkg.trx_line_dist_tbl.DEFAULT_TAXATION_COUNTRY(l_index)          := NULL; --   VARCHAR2_2_tbl_type   ,
932        zx_global_structures_pkg.trx_line_dist_tbl.CTRL_HDR_TX_APPL_FLAG(l_index)             := NULL; --   VARCHAR2_1_tbl_type    ,
933        zx_global_structures_pkg.trx_line_dist_tbl.CTRL_TOTAL_HDR_TX_AMT(l_index)             := NULL; --   NUMBER_tbl_type        ,
934        zx_global_structures_pkg.trx_line_dist_tbl.PORT_OF_ENTRY_CODE(l_index)                := NULL; --   VARCHAR2_30_tbl_type,
935        zx_global_structures_pkg.trx_line_dist_tbl.TAX_REPORTING_FLAG(l_index)                := 'N'; --   VARCHAR2_1_tbl_type,
936        zx_global_structures_pkg.trx_line_dist_tbl.TAX_AMT_INCLUDED_FLAG(l_index)             := NULL; --   VARCHAR2_1_tbl_type ,
937        zx_global_structures_pkg.trx_line_dist_tbl.COMPOUNDING_TAX_FLAG(l_index)              := NULL; --   VARCHAR2_1_tbl_type,
938        zx_global_structures_pkg.trx_line_dist_tbl.PROVNL_TAX_DETERMINATION_DATE(l_index)     := NULL; --   DATE_tbl_type,
939        zx_global_structures_pkg.trx_line_dist_tbl.INSERT_UPDATE_FLAG(l_index)                := NULL; --   VARCHAR2_1_tbl_type,
940        zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_TO_TRX_NUMBER(l_index)             := NULL; --   VARCHAR2_150_tbl_type,
941        zx_global_structures_pkg.trx_line_dist_tbl.START_EXPENSE_DATE(l_index)                := NULL; --   DATE_tbl_type,
942        zx_global_structures_pkg.trx_line_dist_tbl.TRX_BATCH_ID(l_index)                      := NULL; --   NUMBER_tbl_type,
943        zx_global_structures_pkg.trx_line_dist_tbl.RECORD_TYPE_CODE(l_index)                  := NULL; --   VARCHAR2_30_tbl_type,
944        zx_global_structures_pkg.trx_line_dist_tbl.TAX_PROCESSING_COMPLETED_FLAG(l_index)     := NULL; --   VARCHAR2_1_tbl_type,
945        zx_global_structures_pkg.trx_line_dist_tbl.APPLICATION_DOC_STATUS(l_index)            := NULL; --   VARCHAR2_30_tbl_type,
946        zx_global_structures_pkg.trx_line_dist_tbl.OVERRIDING_RECOVERY_RATE(l_index)          := NULL; --   NUMBER_tbl_type,
947        zx_global_structures_pkg.trx_line_dist_tbl.TAX_CALCULATION_DONE_FLAG(l_index)         := NULL; --   VARCHAR2_1_tbl_type,
948        zx_global_structures_pkg.trx_line_dist_tbl.USER_UPD_DET_FACTORS_FLAG(l_index)         := NULL; --   VARCHAR2_1_tbl_type,
949        zx_global_structures_pkg.trx_line_dist_tbl.ICX_SESSION_ID(l_index)                    := NULL; --   NUMBER_tbl_type
950        oe_debug_pub.add(  '3:');
951        -- line level columns
952        --zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_CURRENCY_CODE(l_index)            := NULL; --   VARCHAR2_15_tbl_type   ,
953        --zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_CURRENCY_CONV_DATE(l_index)       := NULL; --   DATE_tbl_type          ,
954        --zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_CURRENCY_CONV_RATE(l_index)       := NULL; --   NUMBER_tbl_type        ,
955        --zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_CURRENCY_CONV_TYPE(l_index)       := NULL; --   VARCHAR2_30_tbl_type   ,
956        --zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_MAU(l_index)                      := NULL; --   NUMBER_tbl_type        ,
957        --zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_PRECISION(l_index)                := NULL; --   NUMBER_tbl_type        ,
958        zx_global_structures_pkg.trx_line_dist_tbl.LINE_INTENDED_USE(l_index)                 := NULL; --   VARCHAR2_240_tbl_type   ,
959        zx_global_structures_pkg.trx_line_dist_tbl.INPUT_TAX_CLASSIFICATION_CODE(l_index)     := NULL; --   VARCHAR2_30_tbl_type   ,
960        zx_global_structures_pkg.trx_line_dist_tbl.EXEMPTION_CONTROL_FLAG(l_index)            := OE_Bulk_Order_PVT.G_Line_Rec.TAX_EXEMPT_FLAG(l_index);
961        oe_debug_pub.add(  '4:');
962        zx_global_structures_pkg.trx_line_dist_tbl.EXEMPT_REASON_CODE(l_index)                := OE_Bulk_Order_PVT.G_Line_Rec.TAX_EXEMPT_REASON_CODE(l_index);
963         oe_debug_pub.add(  '44:');
964        zx_global_structures_pkg.trx_line_dist_tbl.INTERFACE_ENTITY_CODE(l_index)             := NULL; --   VARCHAR2_30_tbl_type,
965        zx_global_structures_pkg.trx_line_dist_tbl.INTERFACE_LINE_ID(l_index)                 := NULL; --   NUMBER_tbl_type,
966        zx_global_structures_pkg.trx_line_dist_tbl.HISTORICAL_TAX_CODE_ID(l_index)            := NULL; --   NUMBER_tbl_type,
967 
968        zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_ID(l_index)	:= OE_Bulk_Order_PVT.G_Line_Rec.Line_Id(l_index);
969        oe_debug_pub.add(  '444:');
970        zx_global_structures_pkg.trx_line_dist_tbl.LINE_CLASS(l_index) := 'INVOICE';
971        zx_global_structures_pkg.trx_line_dist_tbl.LINE_LEVEL_ACTION(l_index)	:= 'CREATE';
972         oe_debug_pub.add(  '441:');
973 --       zx_global_structures_pkg.trx_line_dist_tbl.TRX_SHIPPING_DATE(l_index)	:= Nvl(OE_Bulk_Order_PVT.G_Line_Rec.actual_shipment_date(l_index), OE_Bulk_Order_PVT.G_Line_Rec.schedule_ship_date(l_index)); -- l_trx_shipping_date;
974       oe_debug_pub.add(  '412');
975        zx_global_structures_pkg.trx_line_dist_tbl.TRX_RECEIPT_DATE(l_index)	:= NULL ;
976        zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_TYPE(l_index)	:= 'LINE';
977        zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_DATE(l_index)	:= OE_Bulk_Order_PVT.G_Line_Rec.tax_date(l_index);
978        oe_debug_pub.add(  '5:');
979     IF OE_Bulk_Order_PVT.G_Line_Rec.global_attribute_category(l_index) IN
983        zx_global_structures_pkg.trx_line_dist_tbl.TRX_BUSINESS_CATEGORY(l_index)	:= OE_Bulk_Order_PVT.G_Line_Rec.global_attribute6(l_index); --l_trx_business_category;
980        ('JL.AR.OEXOEORD.LINES',
981         'JL.BR.OEXOEORD.LINES',
982         'JL.CO.OEXOEORD.LINES') THEN
984        zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_FISC_CLASSIFICATION(l_index):= OE_Bulk_Order_PVT.G_Line_Rec.global_attribute5(l_index);
985     ELSE
986       zx_global_structures_pkg.trx_line_dist_tbl.TRX_BUSINESS_CATEGORY(l_index) := NULL;
987       zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_FISC_CLASSIFICATION(l_index):= NULL;
988     END IF;
989        oe_debug_pub.add(  '6:');
990        zx_global_structures_pkg.trx_line_dist_tbl.LINE_INTENDED_USE(l_index)	:= NULL;
991        zx_global_structures_pkg.trx_line_dist_tbl.USER_DEFINED_FISC_CLASS(l_index)	:= NULL;
992        zx_global_structures_pkg.trx_line_dist_tbl.LINE_AMT_INCLUDES_TAX_FLAG(l_index)	:= 'S';
993        zx_global_structures_pkg.trx_line_dist_tbl.LINE_AMT(l_index)	:= OE_Bulk_Order_PVT.G_Line_Rec. ordered_quantity (l_index) * OE_Bulk_Order_PVT.G_Line_Rec.unit_selling_price(l_index);
994        zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_QUANTITY(l_index)	:= OE_Bulk_Order_PVT.G_Line_Rec. ordered_quantity (l_index);
995        zx_global_structures_pkg.trx_line_dist_tbl.UNIT_PRICE(l_index)	:= OE_Bulk_Order_PVT.G_Line_Rec.unit_selling_price(l_index);
996        zx_global_structures_pkg.trx_line_dist_tbl.EXEMPT_CERTIFICATE_NUMBER(l_index)	:= OE_Bulk_Order_PVT.G_Line_Rec.tax_exempt_number(l_index);
997        zx_global_structures_pkg.trx_line_dist_tbl.EXEMPT_REASON(l_index)	:= OE_Bulk_Order_PVT.G_Line_Rec.TAX_EXEMPT_REASON_CODE(l_index);
998        oe_debug_pub.add(  '7:');
999        zx_global_structures_pkg.trx_line_dist_tbl.CASH_DISCOUNT(l_index)	:= NULL;
1000        zx_global_structures_pkg.trx_line_dist_tbl.VOLUME_DISCOUNT(l_index)	:= NULL;
1001        zx_global_structures_pkg.trx_line_dist_tbl.TRADING_DISCOUNT(l_index)	:= NULL;
1002        zx_global_structures_pkg.trx_line_dist_tbl.TRANSFER_CHARGE(l_index)	:= NULL ;
1003        zx_global_structures_pkg.trx_line_dist_tbl.TRANSPORTATION_CHARGE(l_index)	:= NULL;
1004        zx_global_structures_pkg.trx_line_dist_tbl.INSURANCE_CHARGE(l_index)	:= NULL;
1005        zx_global_structures_pkg.trx_line_dist_tbl.OTHER_CHARGE(l_index)	:= NULL;
1006        zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_ID(l_index)	:= OE_Bulk_Order_PVT.G_Line_Rec.inventory_item_id(l_index);
1007        zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_ORG_ID(l_index)	:= NVL(OE_Bulk_Order_PVT.G_Line_Rec.ship_from_org_id(l_index),l_inventory_org_id);
1008        oe_debug_pub.add(  '8:');
1009        zx_global_structures_pkg.trx_line_dist_tbl.UOM_CODE(l_index)		:=NVL( OE_Bulk_Order_PVT.G_Line_Rec.order_quantity_uom (l_index), OE_Bulk_Order_PVT.G_Line_Rec.pricing_quantity_uom(l_index));
1010       zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_TYPE(l_index)	:= NULL;
1011 zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_CODE(l_index)	:= NULL;
1012        zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_CATEGORY(l_index)	:= NULL;
1013        zx_global_structures_pkg.trx_line_dist_tbl.TRX_SIC_CODE(l_index)	:= NULL ;
1014        zx_global_structures_pkg.trx_line_dist_tbl.FOB_POINT(l_index)		:= OE_Bulk_Order_PVT.G_Line_Rec.fob_point_code(l_index);
1015        zx_global_structures_pkg.trx_line_dist_tbl.SHIP_FROM_PARTY_ID(l_index):= OE_Bulk_Order_PVT.G_Line_Rec.ship_from_org_id(l_index);
1016        zx_global_structures_pkg.trx_line_dist_tbl.POA_PARTY_ID(l_index)	:= l_header_org_id;
1017        oe_debug_pub.add(  '9:');
1018        zx_global_structures_pkg.trx_line_dist_tbl.POO_PARTY_ID(l_index)	:= l_asgn_org_id; -- Load it from person_id cache ->asgn_org_id;
1019        zx_global_structures_pkg.trx_line_dist_tbl.BILL_FROM_PARTY_ID(l_index):= NULL;
1020        zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_ID(l_index)	:= NULL;
1021        zx_global_structures_pkg.trx_line_dist_tbl.SHIP_FROM_PARTY_SITE_ID(l_index)	:= NULL;
1022        zx_global_structures_pkg.trx_line_dist_tbl.POA_PARTY_SITE_ID(l_index)	:= NULL ;
1023        zx_global_structures_pkg.trx_line_dist_tbl.POO_PARTY_SITE_ID(l_index)	:= NULL ;
1024        zx_global_structures_pkg.trx_line_dist_tbl.BILL_FROM_PARTY_SITE_ID(l_index)	:= NULL;
1025        zx_global_structures_pkg.trx_line_dist_tbl.SHIP_FROM_LOCATION_ID(l_index)	:= l_ship_from_location_id;
1026        zx_global_structures_pkg.trx_line_dist_tbl.POA_LOCATION_ID(l_index)		:= l_internal_org_location_id;
1027        zx_global_structures_pkg.trx_line_dist_tbl.POO_LOCATION_ID(l_index)		:= l_poo_location_id ;
1028        zx_global_structures_pkg.trx_line_dist_tbl.BILL_FROM_LOCATION_ID(l_index)	:= l_bill_from_location_id; --bug7228640
1029        zx_global_structures_pkg.trx_line_dist_tbl.ACCOUNT_CCID(l_index)		:= NULL;
1030        zx_global_structures_pkg.trx_line_dist_tbl.ACCOUNT_STRING(l_index)		:= NULL;
1031        zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_COUNTRY(l_index)	:= NULL;
1032        zx_global_structures_pkg.trx_line_dist_tbl.ASSET_FLAG(l_index)		:= NULL;
1033        zx_global_structures_pkg.trx_line_dist_tbl.ASSET_NUMBER(l_index)	:= NULL;
1034        zx_global_structures_pkg.trx_line_dist_tbl.ASSET_ACCUM_DEPRECIATION(l_index)	:= NULL;
1035        zx_global_structures_pkg.trx_line_dist_tbl.ASSET_TYPE(l_index)	:= NULL;
1036        zx_global_structures_pkg.trx_line_dist_tbl.ASSET_COST(l_index)	:= NULL;
1037        zx_global_structures_pkg.trx_line_dist_tbl.DIST_LEVEL_ACTION(l_index)           := NULL; --   VARCHAR2_30_tbl_type   ,
1038        zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_TAX_DIST_ID(l_index)    := NULL; --   NUMBER_tbl_type        ,
1039        zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_TAX_DIST_ID(l_index)    := NULL; --   NUMBER_tbl_type        ,
1040        zx_global_structures_pkg.trx_line_dist_tbl.TASK_ID(l_index)                     := NULL; --   NUMBER_tbl_type        ,
1041        zx_global_structures_pkg.trx_line_dist_tbl.AWARD_ID(l_index)                    := NULL; --   NUMBER_tbl_type        ,
1042        zx_global_structures_pkg.trx_line_dist_tbl.PROJECT_ID(l_index)                  := NULL; --   NUMBER_tbl_type        ,
1043        zx_global_structures_pkg.trx_line_dist_tbl.EXPENDITURE_TYPE(l_index)            := NULL; --   VARCHAR2_30_tbl_type   ,
1044        zx_global_structures_pkg.trx_line_dist_tbl.EXPENDITURE_ORGANIZATION_ID(l_index) := NULL; --   NUMBER_tbl_type        ,
1048        zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_CURR_CONV_RATE(l_index)      := NULL; --   NUMBER_tbl_type        ,
1045        zx_global_structures_pkg.trx_line_dist_tbl.EXPENDITURE_ITEM_DATE(l_index)       := NULL; --   DATE_tbl_type          ,
1046        zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_DIST_AMT(l_index)           := NULL; --   NUMBER_tbl_type        ,
1047        zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_DIST_QUANTITY(l_index)      := NULL; --   NUMBER_tbl_type        ,
1049        zx_global_structures_pkg.trx_line_dist_tbl.ITEM_DIST_NUMBER(l_index)            := NULL; --   NUMBER_tbl_type        ,
1050        zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_DIST_ID(l_index)             := NULL; --   NUMBER_tbl_type        ,
1051        zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_DIST_TAX_AMT(l_index)       := NULL; --   NUMBER_tbl_type        ,
1052        oe_debug_pub.add(  '10:');
1053        zx_global_structures_pkg.trx_line_dist_tbl.ASSESSABLE_VALUE(l_index)		:= NULL ;
1054        zx_global_structures_pkg.trx_line_dist_tbl.OUTPUT_TAX_CLASSIFICATION_CODE(l_index)	:= OE_Bulk_Order_PVT.G_Line_Rec.tax_code(l_index);
1055        zx_global_structures_pkg.trx_line_dist_tbl.TRX_ID_LEVEL2(l_index)	:= NULL;
1056        zx_global_structures_pkg.trx_line_dist_tbl.TRX_ID_LEVEL3(l_index)	:= NULL;
1057        zx_global_structures_pkg.trx_line_dist_tbl.TRX_ID_LEVEL4(l_index)	:= NULL;
1058        zx_global_structures_pkg.trx_line_dist_tbl.TRX_ID_LEVEL5(l_index)	:= NULL;
1059        zx_global_structures_pkg.trx_line_dist_tbl.TRX_ID_LEVEL6(l_index)	:= NULL;
1060        zx_global_structures_pkg.trx_line_dist_tbl.HDR_TRX_USER_KEY1(l_index)	:= NULL;
1061        zx_global_structures_pkg.trx_line_dist_tbl.HDR_TRX_USER_KEY2(l_index)	:= NULL;
1062        zx_global_structures_pkg.trx_line_dist_tbl.HDR_TRX_USER_KEY3(l_index)	:= NULL;
1063        zx_global_structures_pkg.trx_line_dist_tbl.HDR_TRX_USER_KEY4(l_index)	:= NULL;
1064        zx_global_structures_pkg.trx_line_dist_tbl.HDR_TRX_USER_KEY5(l_index)	:= NULL;
1065        zx_global_structures_pkg.trx_line_dist_tbl.HDR_TRX_USER_KEY6(l_index)	:= NULL;
1066        zx_global_structures_pkg.trx_line_dist_tbl.LINE_TRX_USER_KEY1(l_index):= NULL;
1067        zx_global_structures_pkg.trx_line_dist_tbl.LINE_TRX_USER_KEY2(l_index):= NULL;
1068        zx_global_structures_pkg.trx_line_dist_tbl.LINE_TRX_USER_KEY3(l_index):= NULL;
1069        zx_global_structures_pkg.trx_line_dist_tbl.LINE_TRX_USER_KEY4(l_index):= NULL;
1070        zx_global_structures_pkg.trx_line_dist_tbl.LINE_TRX_USER_KEY5(l_index):= NULL;
1071        zx_global_structures_pkg.trx_line_dist_tbl.LINE_TRX_USER_KEY6(l_index):= NULL;
1072        zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_NUMBER(l_index)   := OE_Bulk_Order_PVT.G_Line_Rec.line_number(l_index);
1073        zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_DIST_ID(l_index)   := NULL;
1074        zx_global_structures_pkg.trx_line_dist_tbl.DIST_TRX_USER_KEY1(l_index) := NULL;
1075        zx_global_structures_pkg.trx_line_dist_tbl.DIST_TRX_USER_KEY2(l_index) := NULL;
1076        zx_global_structures_pkg.trx_line_dist_tbl.DIST_TRX_USER_KEY3(l_index) := NULL;
1077        zx_global_structures_pkg.trx_line_dist_tbl.DIST_TRX_USER_KEY4(l_index) := NULL;
1078        zx_global_structures_pkg.trx_line_dist_tbl.DIST_TRX_USER_KEY5(l_index) := NULL;
1079        zx_global_structures_pkg.trx_line_dist_tbl.DIST_TRX_USER_KEY6(l_index) := NULL;
1080        zx_global_structures_pkg.trx_line_dist_tbl.HISTORICAL_FLAG(l_index)	:='N';
1081        zx_global_structures_pkg.trx_line_dist_tbl.CTRL_HDR_TX_APPL_FLAG(l_index)	:='N';
1082        zx_global_structures_pkg.trx_line_dist_tbl.CTRL_TOTAL_LINE_TX_AMT(l_index)	:=NULL;
1083        oe_debug_pub.add(  '11:');
1084       zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_DESCRIPTION(l_index)	:= OE_Bulk_Order_PVT.G_Line_Rec. user_item_description (l_index);
1085        zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_DESCRIPTION(l_index)	:= OE_Bulk_Order_PVT.G_Line_Rec. user_item_description (l_index);
1086        zx_global_structures_pkg.trx_line_dist_tbl.TRX_WAYBILL_NUMBER(l_index)	:= NULL;
1087        zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_GL_DATE(l_index)		:= NULL;
1088        zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_NAME(l_index)	:= NULL;
1089        zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_DOCUMENT_NUMBER(l_index)	:= NULL;
1090        zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_REFERENCE(l_index)	:= NULL;
1091        zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_TAXPAYER_ID(l_index):= NULL;
1092        zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_TAX_REG_NUMBER(l_index)	:= NULL;
1093        zx_global_structures_pkg.trx_line_dist_tbl.PAYING_PARTY_ID(l_index)		:= NULL;
1094        zx_global_structures_pkg.trx_line_dist_tbl.OWN_HQ_PARTY_ID(l_index)		:= NULL;
1095        zx_global_structures_pkg.trx_line_dist_tbl.TRADING_HQ_PARTY_ID(l_index)	:= NULL;
1096        zx_global_structures_pkg.trx_line_dist_tbl.POI_PARTY_ID(l_index)		:= NULL;
1097        zx_global_structures_pkg.trx_line_dist_tbl.POD_PARTY_ID(l_index)		:= NULL;
1098        zx_global_structures_pkg.trx_line_dist_tbl.TITLE_TRANSFER_PARTY_ID(l_index)	:= NULL;
1099        zx_global_structures_pkg.trx_line_dist_tbl.PAYING_PARTY_SITE_ID(l_index)	:= NULL;
1100        zx_global_structures_pkg.trx_line_dist_tbl.OWN_HQ_PARTY_SITE_ID(l_index)	:= NULL;
1101        zx_global_structures_pkg.trx_line_dist_tbl.TRADING_HQ_PARTY_SITE_ID(l_index)	:= NULL;
1102        zx_global_structures_pkg.trx_line_dist_tbl.POI_PARTY_SITE_ID(l_index)		:= NULL;
1103        zx_global_structures_pkg.trx_line_dist_tbl.POD_PARTY_SITE_ID(l_index)		:= NULL;
1104        zx_global_structures_pkg.trx_line_dist_tbl.TITLE_TRANSFER_PARTY_SITE_ID(l_index)	:= NULL;
1105        zx_global_structures_pkg.trx_line_dist_tbl.PAYING_LOCATION_ID(l_index)	:= NULL;
1106        zx_global_structures_pkg.trx_line_dist_tbl.OWN_HQ_LOCATION_ID(l_index)	:= NULL;
1107        zx_global_structures_pkg.trx_line_dist_tbl.TRADING_HQ_LOCATION_ID(l_index)	:= NULL;
1108        zx_global_structures_pkg.trx_line_dist_tbl.POC_LOCATION_ID(l_index)		:= NULL;
1109        zx_global_structures_pkg.trx_line_dist_tbl.POI_LOCATION_ID(l_index)		:= NULL;
1110        zx_global_structures_pkg.trx_line_dist_tbl.POD_LOCATION_ID(l_index)		:= NULL;
1111        zx_global_structures_pkg.trx_line_dist_tbl.TITLE_TRANSFER_LOCATION_ID(l_index):= NULL;
1115        zx_global_structures_pkg.trx_line_dist_tbl.ROUNDING_BILL_TO_PARTY_ID(l_index)   := NULL;
1112        -- Rounding parties not required for OM. No override of rounding level
1113        zx_global_structures_pkg.trx_line_dist_tbl.ROUNDING_SHIP_TO_PARTY_ID(l_index)   := NULL;
1114        zx_global_structures_pkg.trx_line_dist_tbl.ROUNDING_SHIP_FROM_PARTY_ID(l_index) := NULL;
1116        zx_global_structures_pkg.trx_line_dist_tbl.ROUNDING_BILL_FROM_PARTY_ID(l_index) := NULL;
1117        zx_global_structures_pkg.trx_line_dist_tbl.RNDG_SHIP_TO_PARTY_SITE_ID(l_index)  := NULL;
1118        zx_global_structures_pkg.trx_line_dist_tbl.RNDG_SHIP_FROM_PARTY_SITE_ID(l_index):= NULL;
1119        zx_global_structures_pkg.trx_line_dist_tbl.RNDG_BILL_TO_PARTY_SITE_ID(l_index)  := NULL;
1120        zx_global_structures_pkg.trx_line_dist_tbl.RNDG_BILL_FROM_PARTY_SITE_ID(l_index):= NULL;
1121 
1122        -- Ref_doc, applied_from, applied_to, related_doc are not applicable for OM
1123        zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_APPLICATION_ID(l_index)	:= NULL;
1124        zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_ENTITY_CODE(l_index)	:= NULL;
1125        zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_EVENT_CLASS_CODE(l_index)	:= NULL;
1126        zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_TRX_ID(l_index)		:= NULL;
1127        zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_HDR_TRX_USER_KEY1(l_index)	:= NULL;
1128        zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_HDR_TRX_USER_KEY2(l_index)	:= NULL;
1129        zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_HDR_TRX_USER_KEY3(l_index)	:= NULL;
1130        zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_HDR_TRX_USER_KEY4(l_index)	:= NULL;
1131        zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_HDR_TRX_USER_KEY5(l_index)	:= NULL;
1132        zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_HDR_TRX_USER_KEY6(l_index)	:= NULL;
1133        zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LINE_ID(l_index)		:= NULL;
1134        zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LIN_TRX_USER_KEY1(l_index)	:= NULL;
1135        zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LIN_TRX_USER_KEY2(l_index)	:= NULL;
1136        zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LIN_TRX_USER_KEY3(l_index)	:= NULL;
1137        zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LIN_TRX_USER_KEY4(l_index)	:= NULL;
1138        zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LIN_TRX_USER_KEY5(l_index)	:= NULL;
1139        zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LIN_TRX_USER_KEY6(l_index)	:= NULL;
1140        zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LINE_QUANTITY(l_index)	:= NULL;
1141        zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_APPLICATION_ID(l_index):= NULL;
1142        zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_ENTITY_CODE(l_index)	:= NULL;
1143        zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_EVENT_CLASS_CODE(l_index) := NULL;
1144        zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_TRX_ID(l_index)	:= NULL;
1145        zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_HDR_TRX_USER_KEY1(l_index):= NULL;
1146        zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_HDR_TRX_USER_KEY2(l_index):= NULL;
1147        zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_HDR_TRX_USER_KEY3(l_index):= NULL;
1148        zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_HDR_TRX_USER_KEY4(l_index):= NULL;
1149        zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_HDR_TRX_USER_KEY5(l_index):= NULL;
1150        zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_HDR_TRX_USER_KEY6(l_index):= NULL;
1151        zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_LINE_ID(l_index)	:= NULL;
1152        zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_LIN_TRX_USER_KEY1(l_index):= NULL;
1153        zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_LIN_TRX_USER_KEY2(l_index):= NULL;
1154        zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_LIN_TRX_USER_KEY3(l_index):= NULL;
1155        zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_LIN_TRX_USER_KEY4(l_index):= NULL;
1156        zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_LIN_TRX_USER_KEY5(l_index):= NULL;
1157        zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_LIN_TRX_USER_KEY6(l_index):= NULL;
1158        zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_DIST_ID(l_index)      := NULL;
1159        zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_DST_TRX_USER_KEY1(l_index) := NULL;
1160        zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_DST_TRX_USER_KEY2(l_index) := NULL;
1161        zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_DST_TRX_USER_KEY3(l_index) := NULL;
1162        zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_DST_TRX_USER_KEY4(l_index) := NULL;
1163        zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_DST_TRX_USER_KEY5(l_index) := NULL;
1164        zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_DST_TRX_USER_KEY6(l_index) := NULL;
1165        zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_APPLICATION_ID(l_index)	:= NULL;
1166        zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_ENTITY_CODE(l_index)	:= NULL;
1167        zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_EVENT_CLASS_CODE(l_index)	:= NULL;
1168        zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_TRX_ID(l_index)	:= NULL ;
1169        zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_HDR_TRX_USER_KEY1(l_index)	:= NULL;
1170        zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_HDR_TRX_USER_KEY2(l_index)	:= NULL;
1171        zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_HDR_TRX_USER_KEY3(l_index)	:= NULL;
1172        zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_HDR_TRX_USER_KEY4(l_index)	:= NULL;
1173        zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_HDR_TRX_USER_KEY5(l_index)	:= NULL;
1174        zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_HDR_TRX_USER_KEY6(l_index)	:= NULL;
1175        zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_LINE_ID(l_index)	:= NULL;
1176        zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_LIN_TRX_USER_KEY1(l_index)	:= NULL;
1177        zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_LIN_TRX_USER_KEY2(l_index)	:= NULL;
1178        zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_LIN_TRX_USER_KEY3(l_index)	:= NULL;
1179        zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_LIN_TRX_USER_KEY4(l_index)	:= NULL;
1183        zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_DST_TRX_USER_KEY1(l_index)  := NULL;
1180        zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_LIN_TRX_USER_KEY5(l_index)	:= NULL;
1181        zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_LIN_TRX_USER_KEY6(l_index)	:= NULL;
1182        zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_DIST_ID(l_index)       := NULL;
1184        zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_DST_TRX_USER_KEY2(l_index)  := NULL;
1185        zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_DST_TRX_USER_KEY3(l_index)  := NULL;
1186        zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_DST_TRX_USER_KEY4(l_index)  := NULL;
1187        zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_DST_TRX_USER_KEY5(l_index)  := NULL;
1188        zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_DST_TRX_USER_KEY6(l_index)     := NULL;
1189        zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_NUMBER(l_index)	:= NULL;
1190        zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_DATE(l_index)		:= NULL;
1191        zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_TO_APPLICATION_ID(l_index)	:= NULL;
1192        zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_TO_ENTITY_CODE(l_index)	:= NULL;
1193        zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_TO_EVENT_CLASS_CODE(l_index):= NULL;
1194        zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_TO_TRX_ID(l_index)		:= NULL;
1195        zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_HDR_TRX_USER_KEY1(l_index)	:= NULL;
1196        zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_HDR_TRX_USER_KEY2(l_index)	:= NULL;
1197        zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_HDR_TRX_USER_KEY3(l_index)	:= NULL;
1198        zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_HDR_TRX_USER_KEY4(l_index)	:= NULL;
1199        zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_HDR_TRX_USER_KEY5(l_index)	:= NULL;
1200        zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_HDR_TRX_USER_KEY6(l_index)	:= NULL;
1201        zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_TO_TRX_LINE_ID(l_index)	:= NULL;
1202        zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_LIN_TRX_USER_KEY1(l_index)	:= NULL;
1203        zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_LIN_TRX_USER_KEY2(l_index)	:= NULL;
1204        zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_LIN_TRX_USER_KEY3(l_index)	:= NULL;
1205        zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_LIN_TRX_USER_KEY4(l_index)	:= NULL;
1206        zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_LIN_TRX_USER_KEY5(l_index)	:= NULL;
1207        zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_LIN_TRX_USER_KEY6(l_index)	:= NULL;
1208        zx_global_structures_pkg.trx_line_dist_tbl.RELATED_DOC_APPLICATION_ID(l_index)  := NULL;
1209        zx_global_structures_pkg.trx_line_dist_tbl.RELATED_DOC_ENTITY_CODE(l_index)     := NULL;
1210        zx_global_structures_pkg.trx_line_dist_tbl.RELATED_DOC_EVENT_CLASS_CODE(l_index):= NULL;
1211        zx_global_structures_pkg.trx_line_dist_tbl.RELATED_DOC_TRX_ID(l_index)          := NULL;
1212        zx_global_structures_pkg.trx_line_dist_tbl.REL_DOC_HDR_TRX_USER_KEY1(l_index)   := NULL;
1213        zx_global_structures_pkg.trx_line_dist_tbl.REL_DOC_HDR_TRX_USER_KEY2(l_index)   := NULL;
1214        zx_global_structures_pkg.trx_line_dist_tbl.REL_DOC_HDR_TRX_USER_KEY3(l_index)   := NULL;
1215        zx_global_structures_pkg.trx_line_dist_tbl.REL_DOC_HDR_TRX_USER_KEY4(l_index)   := NULL;
1216        zx_global_structures_pkg.trx_line_dist_tbl.REL_DOC_HDR_TRX_USER_KEY5(l_index)   := NULL;
1217        zx_global_structures_pkg.trx_line_dist_tbl.REL_DOC_HDR_TRX_USER_KEY6(l_index)   := NULL;
1218        zx_global_structures_pkg.trx_line_dist_tbl.RELATED_DOC_NUMBER(l_index)          := NULL;
1219        zx_global_structures_pkg.trx_line_dist_tbl.RELATED_DOC_DATE(l_index)            := NULL;
1220        zx_global_structures_pkg.trx_line_dist_tbl.REVERSED_APPLN_ID(l_index)           := NULL;
1221        zx_global_structures_pkg.trx_line_dist_tbl.REVERSED_ENTITY_CODE(l_index)        := NULL;
1222        zx_global_structures_pkg.trx_line_dist_tbl.REVERSED_EVNT_CLS_CODE(l_index)      := NULL;
1223        zx_global_structures_pkg.trx_line_dist_tbl.REVERSED_TRX_ID(l_index)             := NULL;
1224        zx_global_structures_pkg.trx_line_dist_tbl.REVERSED_TRX_LEVEL_TYPE(l_index)     := NULL;
1225        zx_global_structures_pkg.trx_line_dist_tbl.REVERSED_TRX_LINE_ID(l_index)        := NULL;
1226        zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC1(l_index)	:= NULL;
1227        zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC2(l_index)	:= NULL;
1228        zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC3(l_index)	:= NULL;
1229        zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC4(l_index)	:= NULL;
1230        zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC5(l_index)	:= NULL;
1231        zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC6(l_index)	:= NULL;
1232        zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC7(l_index)	:= NULL;
1233        zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC8(l_index)	:= NULL;
1234        zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC9(l_index)	:= NULL;
1235        zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC10(l_index)	:= NULL;
1236        zx_global_structures_pkg.trx_line_dist_tbl.CHAR1(l_index)	:= NULL;
1237        zx_global_structures_pkg.trx_line_dist_tbl.CHAR2(l_index)	:= NULL;
1238        zx_global_structures_pkg.trx_line_dist_tbl.CHAR3(l_index)	:= NULL;
1239        zx_global_structures_pkg.trx_line_dist_tbl.CHAR4(l_index)	:= NULL;
1240        zx_global_structures_pkg.trx_line_dist_tbl.CHAR5(l_index)	:= NULL;
1241        zx_global_structures_pkg.trx_line_dist_tbl.CHAR6(l_index)	:= NULL;
1242        zx_global_structures_pkg.trx_line_dist_tbl.CHAR7(l_index)	:= NULL;
1243        zx_global_structures_pkg.trx_line_dist_tbl.CHAR8(l_index)	:= NULL;
1244        zx_global_structures_pkg.trx_line_dist_tbl.CHAR9(l_index)	:= NULL;
1245        zx_global_structures_pkg.trx_line_dist_tbl.CHAR10(l_index)	:= NULL;
1246        zx_global_structures_pkg.trx_line_dist_tbl.DATE1(l_index)	:= NULL;
1247        zx_global_structures_pkg.trx_line_dist_tbl.DATE2(l_index)	:= NULL;
1248        zx_global_structures_pkg.trx_line_dist_tbl.DATE3(l_index)	:= NULL;
1249        zx_global_structures_pkg.trx_line_dist_tbl.DATE4(l_index)	:= NULL;
1250        zx_global_structures_pkg.trx_line_dist_tbl.DATE5(l_index)	:= NULL;
1254        zx_global_structures_pkg.trx_line_dist_tbl.DATE9(l_index)	:= NULL;
1251        zx_global_structures_pkg.trx_line_dist_tbl.DATE6(l_index)	:= NULL;
1252        zx_global_structures_pkg.trx_line_dist_tbl.DATE7(l_index)	:= NULL;
1253        zx_global_structures_pkg.trx_line_dist_tbl.DATE8(l_index)	:= NULL;
1255        zx_global_structures_pkg.trx_line_dist_tbl.DATE10(l_index)	:= NULL;
1256        zx_global_structures_pkg.trx_line_dist_tbl.internal_org_location_id(l_index) := l_internal_org_location_id;
1257        oe_debug_pub.add(  '12:');
1258      /*
1259        zx_global_structures_pkg.trx_line_dist_tbl.SHIP_TO_PARTY_TAX_PROF_ID(l_index)	:= NULL;
1260        zx_global_structures_pkg.trx_line_dist_tbl.SHIP_FROM_PARTY_TAX_PROF_ID(l_index):= NULL;
1261        zx_global_structures_pkg.trx_line_dist_tbl.POA_PARTY_TAX_PROF_ID(l_index)	:= NULL;
1262        zx_global_structures_pkg.trx_line_dist_tbl.POO_PARTY_TAX_PROF_ID(l_index)	:= NULL;
1263        zx_global_structures_pkg.trx_line_dist_tbl.PAYING_PARTY_TAX_PROF_ID(l_index)	:= NULL;
1264        zx_global_structures_pkg.trx_line_dist_tbl.OWN_HQ_PARTY_TAX_PROF_ID(l_index)	:= NULL;
1265        zx_global_structures_pkg.trx_line_dist_tbl.TRADING_HQ_PARTY_TAX_PROF_ID(l_index)	:= NULL;
1266        zx_global_structures_pkg.trx_line_dist_tbl.POI_PARTY_TAX_PROF_ID(l_index)	:= NULL;
1267        zx_global_structures_pkg.trx_line_dist_tbl.POD_PARTY_TAX_PROF_ID(l_index)	:= NULL;
1268        zx_global_structures_pkg.trx_line_dist_tbl.BILL_TO_PARTY_TAX_PROF_ID(l_index)	:= NULL;
1269        zx_global_structures_pkg.trx_line_dist_tbl.BILL_FROM_PARTY_TAX_PROF_ID(l_index)	:= NULL;
1270        zx_global_structures_pkg.trx_line_dist_tbl.TITLE_TRANS_PARTY_TAX_PROF_ID(l_index)	:= NULL;
1271        zx_global_structures_pkg.trx_line_dist_tbl.SHIP_TO_SITE_TAX_PROF_ID(l_index)	:= NULL;
1272        zx_global_structures_pkg.trx_line_dist_tbl.SHIP_FROM_SITE_TAX_PROF_ID(l_index)	:= NULL;
1273        zx_global_structures_pkg.trx_line_dist_tbl.POA_SITE_TAX_PROF_ID(l_index)	:= NULL;
1274        zx_global_structures_pkg.trx_line_dist_tbl.POO_SITE_TAX_PROF_ID(l_index)	:= NULL;
1275        zx_global_structures_pkg.trx_line_dist_tbl.PAYING_SITE_TAX_PROF_ID(l_index)	:= NULL;
1276        zx_global_structures_pkg.trx_line_dist_tbl.OWN_HQ_SITE_TAX_PROF_ID(l_index)	:= NULL;
1277        zx_global_structures_pkg.trx_line_dist_tbl.TRADING_HQ_SITE_TAX_PROF_ID(l_index):= NULL;
1278        zx_global_structures_pkg.trx_line_dist_tbl.POI_SITE_TAX_PROF_ID(l_index)	:= NULL;
1279        zx_global_structures_pkg.trx_line_dist_tbl.POD_SITE_TAX_PROF_ID(l_index)	:= NULL;
1280        zx_global_structures_pkg.trx_line_dist_tbl.BILL_TO_SITE_TAX_PROF_ID(l_index)	:= NULL;
1281        zx_global_structures_pkg.trx_line_dist_tbl.BILL_FROM_SITE_TAX_PROF_ID(l_index):= NULL;
1282        zx_global_structures_pkg.trx_line_dist_tbl.TITLE_TRANS_SITE_TAX_PROF_ID(l_index)	:= NULL;
1283        zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_TAX_PROF_ID(l_index):= NULL;
1284        zx_global_structures_pkg.trx_line_dist_tbl.RDNG_SHIP_TO_PTY_TX_PROF_ID(l_index)    := NULL;
1285        zx_global_structures_pkg.trx_line_dist_tbl.RDNG_SHIP_FROM_PTY_TX_PROF_ID(l_index)  := NULL;
1286        zx_global_structures_pkg.trx_line_dist_tbl.RDNG_BILL_TO_PTY_TX_PROF_ID(l_index)    := NULL;
1287        zx_global_structures_pkg.trx_line_dist_tbl.RDNG_BILL_FROM_PTY_TX_PROF_ID(l_index)  := NULL;
1288        zx_global_structures_pkg.trx_line_dist_tbl.RDNG_SHIP_TO_PTY_TX_P_ST_ID(l_index)    := NULL;
1289        zx_global_structures_pkg.trx_line_dist_tbl.RDNG_SHIP_FROM_PTY_TX_P_ST_ID(l_index)  := NULL;
1290        zx_global_structures_pkg.trx_line_dist_tbl.RDNG_BILL_TO_PTY_TX_P_ST_ID(l_index)    := NULL;
1291        zx_global_structures_pkg.trx_line_dist_tbl.RDNG_BILL_FROM_PTY_TX_P_ST_ID(l_index)  := NULL;
1292        zx_global_structures_pkg.trx_line_dist_tbl.HQ_ESTB_PARTY_TAX_PROF_ID(l_index)      := NULL;
1293 
1294      */
1295        oe_debug_pub.add(  '13:');
1296        zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_APPLICATION_ID(l_index)	:= NULL;
1297        zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_ENTITY_CODE(l_index)	:= NULL;
1298        zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_EVENT_CLASS_CODE(l_index)	:= NULL;
1299        zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_TRX_ID(l_index)		:= NULL;
1300        zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_LINE_ID(l_index)		:= NULL;
1301        zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_TRX_LEVEL_TYPE(l_index)	:= NULL;
1302        zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_TRX_LEVEL_TYPE(l_index)	:= NULL;
1303        zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_TO_TRX_LEVEL_TYPE(l_index)	:= NULL;
1304        zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_TRX_LEVEL_TYPE(l_index):= NULL;
1305        zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_TRX_LEVEL_TYPE(l_index):= NULL;
1306        zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE1(l_index)	:= 'N';
1307        zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE2(l_index)	:= NULL;
1308        zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE3(l_index)	:= NULL;
1309        zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE4(l_index)	:= NULL;
1310        zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE5(l_index)	:= NULL;
1311        zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE6(l_index)	:= NULL;
1312        zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE7(l_index)	:= NULL;
1313        zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE8(l_index)	:= NULL;
1314        zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE9(l_index)	:= NULL;
1315        zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE10(l_index)	:= NULL;
1316        zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_TAX_LINE_ID(l_index)	:= NULL;
1317        zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_TRX_NUMBER(l_index)	:= NULL;
1318 	oe_debug_pub.add(  '14');
1319       IF l_debug_level > 0 THEN
1320          debug_msg(l_index, l_return_status);
1321  		null;
1322       END IF;
1323 
1324 
1325          END IF;  --end of IF tax_calculation_event NOT ENTERING or BOOKING
1326 
1327       END IF;  -- end of IF inventory item_id...
1328     END IF; -- end of IF header lock_control = -99
1329 
1333 
1330     l_index := l_index + l_index_inc;
1331   END LOOP; -- end of lines loop
1332 
1334          oe_debug_pub.add(  ' Assigned the Tax values ');
1335    /*
1336   IF ( NOT ( OE_Bulk_Order_PVT.G_Line_Rec.header_id(l_index) is null OR
1337              OE_Bulk_Order_PVT.G_Line_Rec.inventory_item_id(l_index) is null OR
1338              OE_Bulk_Order_PVT.G_Line_Rec.unit_selling_price(l_index) is null)
1339            )
1340   THEN
1341 
1342 
1343     IF l_debug_level > 0 THEN
1344  	oe_debug_pub.add('tax_line 11' , 1);
1345      SELECT hsecs INTO l_start_time from v$timer;
1346     END IF;
1347 
1348     l_call_tax := 'Y';
1349    */
1350 
1351       l_transaction_rec.application_id := 660;
1352       l_transaction_rec.entity_code := 'OE_ORDER_HEADERS';
1353       l_transaction_rec.event_class_code := 'SALES_TRANSACTION_TAX_QUOTE';
1354       l_transaction_rec.event_type_code := 'CREATE';
1355       l_transaction_rec.trx_id := OE_Bulk_Order_PVT.G_Header_Rec.header_id(l_header_index);
1356       l_transaction_rec.internal_organization_id := OE_Bulk_Order_PVT.G_Header_Rec.org_id(l_header_index);
1357 
1358 
1359       SELECT hsecs INTO l_start_time from v$timer;
1360 
1361        IF l_call_tax = 'Y' THEN --Call ZX api only if there is atleast one eligible line to be taxed
1362        oe_debug_pub.add(  ' Call zx_api_pub.calculate_tax ',1);
1363 
1364        zx_api_pub.calculate_tax(
1365                         p_api_version => 1.0,
1366                         p_init_msg_list => FND_API.G_TRUE,
1367                         p_commit           => NULL,
1368                         p_validation_level => NULL,
1369                         x_return_status => l_return_status,
1370                         x_msg_count => l_msg_count,
1371                         x_msg_data => l_msg_data,
1372                         p_transaction_rec => l_transaction_rec,
1373                         p_quote_flag  => 'Y',
1374                         p_data_transfer_mode => 'PLS',
1375                         x_doc_level_recalc_flag => l_doc_level_recalc_flag);
1376 	END IF;
1377 
1378 	SELECT hsecs INTO l_end_time from v$timer;
1379 
1380    FND_FILE.PUT_LINE(FND_FILE.LOG,'Time spent in zx_api_pub.calculate_tax is (sec) '||((l_end_time-l_start_time)/100));
1381 
1382           IF l_debug_level > 0 THEN
1383              oe_debug_pub.add('Message returned by tax API ZX_API_PUB.calculate_tax: '||l_msg_count,2);
1384           END IF;
1385 
1386 
1387         IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1388              IF l_debug_level  > 0 THEN
1389                oe_debug_pub.add(  'unexpected error');
1390              END IF;
1391               RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1392         ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
1393               IF l_x_msg_data is not null then
1394                  FND_MESSAGE.SET_NAME('ONT','ONT_AVAIL_GENERIC');
1395                  FND_MESSAGE.SET_TOKEN('TEXT',l_x_msg_data);
1396                  OE_MSG_PUB.Add;
1397               END IF;
1398          Handle_Error( l_header_index);
1399 
1400               IF l_debug_level  > 0 THEN
1401                 oe_debug_pub.add(  'return status was ERROR.  skipping header with header id: '|| OE_Bulk_Order_PVT.G_Header_Rec.header_id(l_header_index));
1402                 oe_debug_pub.add(  ' Error :'|| l_x_msg_data, 1);
1403               END IF;
1404 
1405               --Skip the remaining lines in this header as it is marked for error
1406 --              l_remaining_lines := OE_Bulk_Order_PVT.G_HEADER_REC.end_line_index(l_header_index) - l_index;
1407 --               l_index_inc := l_remaining_lines + 1;
1408            ELSE
1409 
1410              IF l_debug_level  > 0 THEN
1411                oe_debug_pub.add(  'before building adjustment records');
1412              END IF;
1413 
1414 /*    i:=0;
1415     open detail_tax_lines_gt(l_line_rec.header_id, l_line_rec.line_id);
1416     fetch detail_tax_lines_gt into detail_tax_lines_gt_rec;
1417     loop
1418        exit when detail_tax_lines_gt%NOTFOUND;*/
1419     i := 1;
1420     for detail_tax_lines_gt_rec in detail_tax_lines_gt(OE_Bulk_Order_PVT.G_Header_Rec.header_id(l_header_index)) loop
1421        oe_debug_pub.add(  ' Header il_header_index Lalit' || detail_tax_lines_gt_rec.trx_level_type, 1);
1422        oe_debug_pub.add(  ' Header id :' || OE_Bulk_Order_PVT.G_Header_Rec.header_id(l_header_index), 1);
1423        oe_debug_pub.add(  '  Tax Code  :'|| detail_tax_lines_gt_rec.Tax_Code,1);
1424         oe_debug_pub.add(  '  Tax_rate_id  :'|| detail_tax_lines_gt_rec.tax_rate_id ,1);
1425 
1426                   --Build the Adjustments records to INSERT Tax Info
1427                       Extend_Adj_Rec(1, G_LINE_ADJ_REC);
1428                       oe_debug_pub.add(  ' Aftr Extend ');
1429 		      G_LINE_ADJ_REC.header_id(i) :=  detail_tax_lines_gt_rec.trx_id;  --OE_Bulk_Order_PVT.G_Line_Rec.header_id(i);
1430                       G_LINE_ADJ_REC.line_id(i) :=  detail_tax_lines_gt_rec.trx_line_id; --OE_Bulk_Order_PVT.G_Line_Rec.line_id(i);
1431 
1432                       --  l_tax_code := OE_Bulk_Order_PVT.G_LINE_REC.Tax_Code(i);
1433 
1434                       G_LINE_ADJ_REC.tax_code(i) := detail_tax_lines_gt_rec.Tax_Code;
1435                       G_LINE_ADJ_REC.operand(i) := detail_tax_lines_gt_rec.tax_rate;
1436                       G_LINE_ADJ_REC.adjusted_amount(i) := detail_tax_lines_gt_rec.tax_amt;
1437 		      G_LINE_ADJ_REC.automatic_flag(i) := 'N';
1438                       G_LINE_ADJ_REC.list_line_type_code(i) := 'TAX';
1439                       G_LINE_ADJ_REC.arithmetic_operator(i) := 'AMT';
1440 		      G_LINE_ADJ_REC.tax_rate_id(i) := detail_tax_lines_gt_rec.tax_rate_id ; --bug7685103
1441 
1442                      -- OE_Bulk_Order_PVT.G_LINE_REC.tax_value(i) := detail_tax_lines_gt_rec.tax_amt;
1443 
1444                      IF l_debug_level  > 0 THEN
1445                         oe_debug_pub.add(  'total tax value: i: ' ||
1446 detail_tax_lines_gt_rec.tax_amt, 1);
1447                      END IF;
1448 
1452              -- oe_debug_pub.add(  'post insert mode, so reset global tax info');
1449           --IF p_post_insert THEN
1450 
1451             --IF l_debug_level  > 0 THEN
1453             --END IF;
1454 
1455             G_Tax_Line_Id(i) := detail_tax_lines_gt_rec.trx_line_id;
1456             G_Tax_Line_Value(i) := detail_tax_lines_gt_rec.tax_amt;
1457          -- END IF;
1458 
1459 
1460                   --   l_adj_index := l_adj_index + 1;
1461             i := i + 1;
1462 
1463           END LOOP;
1464          END IF;
1465      --   END IF;
1466 
1467 --Tax value not updated on order line in case of post_insert = FALSE
1468 FOR i IN 1..OE_Bulk_Order_PVT.G_LINE_REC.line_id.COUNT  LOOP --bug7685103
1469     FOR j in 1..G_Tax_Line_Id.COUNT LOOP
1470 	IF OE_Bulk_Order_PVT.G_LINE_REC.line_id(i) = G_Tax_Line_Id(j) THEN
1471 	   OE_Bulk_Order_PVT.G_LINE_REC.tax_value(i) := NVL(OE_Bulk_Order_PVT.G_LINE_REC.tax_value(i),0)+ G_Tax_Line_Value(j);
1472 	END IF;
1473     END LOOP;
1474 END  LOOP;
1475  --bug7685103
1476 
1477 IF G_LINE_ADJ_REC.line_id.COUNT > 0
1478   THEN
1479     IF l_debug_level  > 0 THEN
1480       oe_debug_pub.add(  'adjustment records found: '|| G_LINE_ADJ_REC.line_id.COUNT ) ;
1481     END IF;
1482     Insert_Tax_Records(p_post_insert => p_post_insert);
1483   END IF;
1484 G_LINE_ADJ_REC.PRICE_ADJUSTMENT_ID.delete;
1485 G_LINE_ADJ_REC.CREATED_BY.delete;
1486 G_LINE_ADJ_REC.CREATION_DATE.delete;
1487 G_LINE_ADJ_REC.LAST_UPDATE_DATE.delete;
1488 G_LINE_ADJ_REC.LAST_UPDATED_BY.delete;
1489 G_LINE_ADJ_REC.HEADER_ID.delete;
1490 G_LINE_ADJ_REC.LINE_ID.delete;
1491 G_LINE_ADJ_REC.TAX_CODE.delete;
1492 G_LINE_ADJ_REC.OPERAND.delete;
1493 G_LINE_ADJ_REC.ADJUSTED_AMOUNT.delete;
1494 G_LINE_ADJ_REC.AUTOMATIC_FLAG.delete;
1495 G_LINE_ADJ_REC.LIST_LINE_TYPE_CODE.delete;
1496 G_LINE_ADJ_REC.ARITHMETIC_OPERATOR.delete;
1497 G_LINE_ADJ_REC.TAX_RATE_ID.delete;
1498   G_TAX_LINE_ID  :=   G_MISS_TAX_NUMBER_TBL;
1499   G_TAX_LINE_VALUE := G_MISS_TAX_NUMBER_TBL;
1500 
1501 IF l_debug_level  > 0 THEN
1502   oe_debug_pub.add(  'EXITING OE_BULK_TAX_UTIL.CALCULATE_TAX' ) ;
1503 END IF;
1504 
1505 EXCEPTION
1506   WHEN OTHERS THEN
1507 
1508   IF l_debug_level  > 0 THEN
1509     oe_debug_pub.add(  'in others exception ' || SQLERRM);
1510   END IF;
1511 
1512   IF OE_BULK_MSG_PUB.check_msg_level(OE_BULK_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1513   THEN
1514     OE_BULK_MSG_PUB.add_exc_msg
1515     (G_PKG_NAME
1516     ,'Calcuate_Tax'
1517     );
1518   END IF;
1519   RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1520 END Calculate_Tax;
1521 
1522 
1523 
1524 
1525 PROCEDURE Extend_Adj_Rec
1526         (p_count               IN NUMBER
1527         ,p_adj_rec            IN OUT NOCOPY LINE_ADJ_REC_TYPE
1528         )
1529 IS
1530 --
1531 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1532 --
1533 BEGIN
1534 
1535 
1536 IF l_debug_level  > 0 THEN
1537   oe_debug_pub.add(  'ENTERING OE_BULK_TAX_UTIL.EXTEND_ADJ_REC' ) ;
1538  --  oe_debug_pub.add(  ' p_adj_rec.PRICE_ADJUSTMENT_ID :'|| p_adj_rec.PRICE_ADJUSTMENT_ID.count);
1539 END IF;
1540 
1541 p_adj_rec.PRICE_ADJUSTMENT_ID.extend(p_count);
1542 p_adj_rec.CREATED_BY.extend(p_count);
1543 p_adj_rec.CREATION_DATE.extend(p_count);
1544 p_adj_rec.LAST_UPDATE_DATE.extend(p_count);
1545 p_adj_rec.LAST_UPDATED_BY.extend(p_count);
1546 p_adj_rec.HEADER_ID.extend(p_count);
1547 p_adj_rec.LINE_ID.extend(p_count);
1548 p_adj_rec.TAX_CODE.extend(p_count);
1549 p_adj_rec.OPERAND.extend(p_count);
1550 p_adj_rec.ADJUSTED_AMOUNT.extend(p_count);
1551 p_adj_rec.AUTOMATIC_FLAG.extend(p_count);
1552 p_adj_rec.LIST_LINE_TYPE_CODE.extend(p_count);
1553 p_adj_rec.ARITHMETIC_OPERATOR.extend(p_count);
1554 p_adj_rec.TAX_RATE_ID.extend(p_count);
1555 
1556 
1557 IF l_debug_level  > 0 THEN
1558   oe_debug_pub.add(  'EXITING OE_BULK_TAX_UTIL.EXTEND_ADJ_REC' ) ;
1559 END IF;
1560 
1561 EXCEPTION
1562   WHEN OTHERS THEN
1563 
1564     IF l_debug_level  > 0 THEN
1565       oe_debug_pub.add(  'in others exception ' || SQLERRM);
1566     END IF;
1567 
1568     OE_BULK_MSG_PUB.Add_Exc_Msg
1569       (   G_PKG_NAME
1570       ,   'Extend_Adj_Rec'
1571        );
1572     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1573 END Extend_Adj_Rec;
1574 
1575 PROCEDURE Insert_Tax_Records
1576           (p_post_insert            IN    BOOLEAN
1577           )
1578 IS
1579 l_start_time             NUMBER;
1580 l_end_time               NUMBER;
1581 
1582 --
1583 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1584 --
1585 BEGIN
1586 
1587 
1588 IF l_debug_level  > 0 THEN
1589   oe_debug_pub.add(  'ENTERING OE_BULK_TAX_UTIL.INSERT_TAX_RECORDS' ) ;
1590 END IF;
1591 
1592  SELECT hsecs INTO l_start_time from v$timer;
1593 
1594 
1595 
1596 begin
1597 FORALL i IN 1..G_LINE_ADJ_REC.LINE_ID.COUNT --bug7685103
1598     DELETE FROM OE_PRICE_ADJUSTMENTS
1599     where  list_line_type_code = 'TAX'
1600             and LINE_ID   = G_LINE_ADJ_REC.LINE_ID(i);
1601 Exception
1602 	when others then
1603 	IF l_debug_level  > 0 THEN
1604 	  oe_debug_pub.add(  'Exception in delete existing tax records' ) ;
1605 	END IF;
1606 End ;
1607 
1608 
1609 FORALL i IN 1..G_LINE_ADJ_REC.LINE_ID.COUNT
1610                    INSERT INTO OE_PRICE_ADJUSTMENTS
1611                     (       PRICE_ADJUSTMENT_ID
1612                     ,       CREATED_BY
1613                     ,       CREATION_DATE
1614                     ,       LAST_UPDATE_DATE
1615                     ,       LAST_UPDATED_BY
1616                     ,       HEADER_ID
1617                     ,       LINE_ID
1621                     ,       automatic_flag
1618                     ,       TAX_CODE
1619                     ,       OPERAND
1620                     ,       adjusted_amount
1622                     ,       list_line_type_code
1623                     ,       arithmetic_operator
1624 		    ,       tax_rate_id --bug7685103
1625 		    )
1626                     VALUES
1627                     (       oe_price_adjustments_s.nextval
1628                     ,        FND_GLOBAL.USER_ID
1629                     ,        SYSDATE
1630                     ,        SYSDATE
1631                     ,        FND_GLOBAL.USER_ID
1632                     ,        G_LINE_ADJ_REC.header_id(i)
1633                     ,        G_LINE_ADJ_REC.line_id(i)
1634                     ,        G_LINE_ADJ_REC.tax_code(i)
1635                     ,        G_LINE_ADJ_REC.operand(i)
1636                     ,        G_LINE_ADJ_REC.adjusted_amount(i)
1637                     ,        'N'
1638                     ,        'TAX'
1639                     ,        'AMT'
1640 		    ,	     G_LINE_ADJ_REC.tax_rate_id(i) --bug7685103
1641 		    );
1642 
1643 
1644  SELECT hsecs INTO l_end_time from v$timer;
1645 
1646    FND_FILE.PUT_LINE(FND_FILE.LOG,'Time spent inserting adjustment records is (sec) '||((l_end_time-l_start_time)/100));
1647 
1648       --Need to Update TAX_VALUE on oe_order_lines_all if in post insert mode.
1649       IF p_post_insert AND G_Tax_Line_Id.COUNT > 0
1650       THEN
1651 
1652         IF l_debug_level  > 0 THEN
1653           oe_debug_pub.add(  'post insert mode, so update tax on lines in base table' ) ;
1654         END IF;
1655 
1656 
1657 	FORALL i IN 1..G_Tax_Line_Id.COUNT --bug7685103
1658           UPDATE OE_ORDER_LINES
1659           SET TAX_VALUE = 0
1660           WHERE LINE_ID = G_Tax_Line_Id(i);
1661 
1662         FORALL i IN 1..G_Tax_Line_Id.COUNT --bug7685103
1663           UPDATE OE_ORDER_LINES
1664           SET TAX_VALUE = TAX_VALUE + G_Tax_Line_Value(i)
1665           WHERE LINE_ID = G_Tax_Line_Id(i);
1666 
1667 
1668       END IF;
1669 
1670 
1671 IF l_debug_level  > 0 THEN
1672   oe_debug_pub.add(  'EXITING OE_BULK_TAX_UTIL.INSERT_TAX_RECORDS' ) ;
1673 END IF;
1674 
1675 
1676 EXCEPTION
1677   WHEN OTHERS THEN
1678 
1679   IF l_debug_level  > 0 THEN
1680     oe_debug_pub.add(  'in others exception ' || SQLERRM ) ;
1681   END IF;
1682 
1683   IF OE_BULK_MSG_PUB.check_msg_level(OE_BULK_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1684   THEN
1685     OE_BULK_MSG_PUB.add_exc_msg
1686     (G_PKG_NAME
1687     ,'Insert_Tax_Records'
1688     );
1689   END IF;
1690   RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1691 END Insert_Tax_Records;
1692 
1693 
1694 PROCEDURE Handle_Error
1695         (p_header_index               IN NUMBER
1696  --       ,p_line_index                 IN NUMBER
1697         )
1698 IS
1699 --
1700 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1701 --
1702 BEGIN
1703 
1704 
1705 IF l_debug_level  > 0 THEN
1706   oe_debug_pub.add(  'ENTERING OE_BULK_TAX_UTIL.HANDLE_ERROR' ) ;
1707 END IF;
1708 
1709 --OE_Bulk_Order_PVT.G_LINE_REC.lock_control(p_line_index) := -99;
1710 OE_Bulk_Order_PVT.G_HEADER_REC.lock_control(p_header_index) := -99;
1711 OE_BULK_ORDER_PVT.mark_header_error(p_header_index, OE_Bulk_Order_PVT.G_HEADER_REC);
1712 
1713 
1714 IF l_debug_level  > 0 THEN
1715   oe_debug_pub.add(  'EXITING OE_BULK_TAX_UTIL.HANDLE_ERROR' ) ;
1716 END IF;
1717 
1718 EXCEPTION
1719   WHEN OTHERS THEN
1720   IF l_debug_level  > 0 THEN
1721     oe_debug_pub.add(  'in others exception ' || SQLERRM ) ;
1722   END IF;
1723 
1724   IF OE_BULK_MSG_PUB.check_msg_level(OE_BULK_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1725   THEN
1726     OE_BULK_MSG_PUB.add_exc_msg
1727     (G_PKG_NAME
1728     ,'Handle_Error'
1729     );
1730   END IF;
1731   RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1732 END Handle_Error;
1733 
1734 PROCEDURE Handle_Tax_Code_Error(p_index IN NUMBER,
1735                                 p_header_index IN NUMBER,
1736 				x_index_inc OUT NOCOPY NUMBER)
1737 
1738 IS
1739 l_index_inc NUMBER := NULL;
1740 l_remaining_lines NUMBER;
1741 l_order_type_cache_key    NUMBER;
1742 --
1743 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1744 --
1745 BEGIN
1746 
1747 IF l_debug_level  > 0 THEN
1748   oe_debug_pub.add(  'ENTERING OE_BULK_TAX_UTIL.HANDLE_TAX_CODE_ERROR' ) ;
1749 END IF;
1750 
1751       OE_Bulk_Order_PVT.G_LINE_REC.tax_code(p_index) := null;
1752 
1753       IF nvl(OE_Bulk_Order_PVT.G_HEADER_REC.booked_flag(p_header_index), 'N') = 'Y'
1754               THEN
1755 
1756 
1757                 IF l_debug_level  > 0 THEN
1758                   oe_debug_pub.add(  'order was booked');
1759                 END IF;
1760 
1761          l_order_type_cache_key := OE_BULK_CACHE.Load_Order_Type(OE_Bulk_Order_PVT.G_HEADER_REC.order_type_id(p_header_index));
1762         IF OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_order_type_cache_key).tax_calculation_event IN ('ENTERING', 'BOOKING') THEN
1763 
1764           OE_BULK_MSG_PUB.Set_Msg_Context
1765 		( p_entity_code                 => 'HEADER'
1766          	 ,p_entity_id                   => OE_Bulk_Order_PVT.G_HEADER_REC.header_id(p_header_index)
1767         	 ,p_header_id                   => OE_Bulk_Order_PVT.G_HEADER_REC.header_id(p_header_index)
1768         	 ,p_orig_sys_document_ref       => OE_Bulk_Order_PVT.G_HEADER_REC.orig_sys_document_ref(p_header_index)
1769         	 ,p_order_source_id             => OE_Bulk_Order_PVT.G_HEADER_REC.order_source_id(p_header_index)
1770                 );
1771 
1772          FND_MESSAGE.SET_NAME('ONT','OE_VAL_TAX_CODE_REQD');
1773          OE_BULK_MSG_PUB.Add;
1774          Handle_Error( p_header_index);
1778          END IF;
1775 
1776          IF l_debug_level  > 0 THEN
1777            oe_debug_pub.add(  'tax code not found.  skipping header with header id: '|| OE_Bulk_Order_PVT.G_HEADER_REC.header_id(p_header_index));
1779 
1780          --Skip the remaining lines in this header
1781          l_remaining_lines := OE_Bulk_Order_PVT.G_HEADER_REC.end_line_index(p_header_index) - p_index;
1782          l_index_inc := l_remaining_lines + 1;
1783         END IF;  -- end of tax event in ENTERING or BOOKING
1784 
1785       END IF;  --end of IF booked_flag = 'Y'
1786 
1787       x_index_inc := l_index_inc;
1788 
1789 IF l_debug_level  > 0 THEN
1790   oe_debug_pub.add(  'EXITING OE_BULK_TAX_UTIL.HANDLE_TAX_CODE_ERROR' ) ;
1791 END IF;
1792 
1793 
1794 EXCEPTION
1795   WHEN OTHERS THEN
1796   IF l_debug_level  > 0 THEN
1797     oe_debug_pub.add(  'in others exception ' || SQLERRM ) ;
1798   END IF;
1799 
1800   IF OE_BULK_MSG_PUB.check_msg_level(OE_BULK_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1801   THEN
1802     OE_BULK_MSG_PUB.add_exc_msg
1803     (G_PKG_NAME
1804     ,'Handle_Tax_Code_Error'
1805     );
1806   END IF;
1807   RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1808 END Handle_Tax_Code_Error;
1809 
1810 Procedure Debug_msg(p_index         IN  NUMBER,
1811 		    x_return_status OUT NOCOPY Varchar2) IS
1812 
1813 i	NUMBER;
1814 Begin
1815         i:=p_index;
1816 	IF i IS NOT NULL
1817 	   AND zx_global_structures_pkg.trx_line_dist_tbl.APPLICATION_ID.exists(I)
1818 THEN
1819         oe_debug_pub.add('Entering OM_TAX_UTIL.Debug_msg procedure ');
1820         oe_debug_pub.add(' i = '||i);
1821 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APPLICATION_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APPLICATION_ID(i));
1822 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ENTITY_CODE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ENTITY_CODE(i));
1823 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.EVENT_CLASS_CODE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.EVENT_CLASS_CODE(i));
1824 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TRX_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TRX_ID(i));
1825 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TRX_LEVEL_TYPE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TRX_LEVEL_TYPE(i));
1826 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_ID(i));
1827 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.LINE_CLASS(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.LINE_CLASS(i));
1828 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.LINE_LEVEL_ACTION(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.LINE_LEVEL_ACTION(i));
1829 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TRX_SHIPPING_DATE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TRX_SHIPPING_DATE(i));
1830 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TRX_RECEIPT_DATE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TRX_RECEIPT_DATE(i));
1831 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_TYPE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_TYPE(i));
1832 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_DATE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_DATE(i));
1833 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TRX_BUSINESS_CATEGORY(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TRX_BUSINESS_CATEGORY(i));
1834 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.LINE_INTENDED_USE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.LINE_INTENDED_USE(i));
1835 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.USER_DEFINED_FISC_CLASS(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.USER_DEFINED_FISC_CLASS(i));
1836 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.LINE_AMT_INCLUDES_TAX_FLAG(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.LINE_AMT_INCLUDES_TAX_FLAG(i));
1837 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.LINE_AMT(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.LINE_AMT(i));
1838 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_QUANTITY(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_QUANTITY(i));
1839 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.UNIT_PRICE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.UNIT_PRICE(i));
1840 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.EXEMPT_CERTIFICATE_NUMBER(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.EXEMPT_CERTIFICATE_NUMBER(i));
1841 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.EXEMPT_REASON(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.EXEMPT_REASON(i));
1842 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.CASH_DISCOUNT(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.CASH_DISCOUNT(i));
1843 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.VOLUME_DISCOUNT(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.VOLUME_DISCOUNT(i));
1844 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TRADING_DISCOUNT(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TRADING_DISCOUNT(i));
1845 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TRANSFER_CHARGE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TRANSFER_CHARGE(i));
1846 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TRANSPORTATION_CHARGE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TRANSPORTATION_CHARGE(i));
1847 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.INSURANCE_CHARGE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.INSURANCE_CHARGE(i));
1848 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.OTHER_CHARGE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.OTHER_CHARGE(i));
1849 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_ID(i));
1850 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_FISC_CLASSIFICATION(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_FISC_CLASSIFICATION(i));
1851 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_ORG_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_ORG_ID(i));
1855 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_CATEGORY(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_CATEGORY(i));
1852 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.UOM_CODE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.UOM_CODE(i));
1853 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_TYPE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_TYPE(i));
1854 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_CODE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_CODE(i));
1856 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TRX_SIC_CODE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TRX_SIC_CODE(i));
1857 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.FOB_POINT(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.FOB_POINT(i));
1858 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.SHIP_TO_PARTY_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.SHIP_TO_PARTY_ID(i));
1859 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.SHIP_FROM_PARTY_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.SHIP_FROM_PARTY_ID(i));
1860 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.POA_PARTY_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.POA_PARTY_ID(i));
1861 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.POO_PARTY_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.POO_PARTY_ID(i));
1862 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.BILL_TO_PARTY_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.BILL_TO_PARTY_ID(i));
1863 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.BILL_FROM_PARTY_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.BILL_FROM_PARTY_ID(i));
1864 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_ID(i));
1865 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.SHIP_TO_PARTY_SITE_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.SHIP_TO_PARTY_SITE_ID(i));
1866 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.SHIP_FROM_PARTY_SITE_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.SHIP_FROM_PARTY_SITE_ID(i));
1867 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.POA_PARTY_SITE_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.POA_PARTY_SITE_ID(i));
1868 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.POO_PARTY_SITE_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.POO_PARTY_SITE_ID(i));
1869 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.BILL_TO_PARTY_SITE_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.BILL_TO_PARTY_SITE_ID(i));
1870 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.BILL_FROM_PARTY_SITE_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.BILL_FROM_PARTY_SITE_ID(i));
1871 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.SHIP_TO_LOCATION_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.SHIP_TO_LOCATION_ID(i));
1872 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.SHIP_FROM_LOCATION_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.SHIP_FROM_LOCATION_ID(i));
1873 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.POA_LOCATION_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.POA_LOCATION_ID(i));
1874 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.POO_LOCATION_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.POO_LOCATION_ID(i));
1875 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.BILL_TO_LOCATION_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.BILL_TO_LOCATION_ID(i));
1876 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.BILL_FROM_LOCATION_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.BILL_FROM_LOCATION_ID(i));
1877 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ACCOUNT_CCID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ACCOUNT_CCID(i));
1878 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ACCOUNT_STRING(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ACCOUNT_STRING(i));
1879 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_COUNTRY(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_COUNTRY(i));
1880 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_APPLICATION_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_APPLICATION_ID(i));
1881 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_ENTITY_CODE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_ENTITY_CODE(i));
1882 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_EVENT_CLASS_CODE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_EVENT_CLASS_CODE(i));
1883 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_TRX_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_TRX_ID(i));
1884 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_HDR_TRX_USER_KEY1(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_HDR_TRX_USER_KEY1(i));
1885 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_HDR_TRX_USER_KEY2(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_HDR_TRX_USER_KEY2(i));
1886 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_HDR_TRX_USER_KEY3(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_HDR_TRX_USER_KEY3(i));
1887 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_HDR_TRX_USER_KEY4(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_HDR_TRX_USER_KEY4(i));
1888 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_HDR_TRX_USER_KEY5(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_HDR_TRX_USER_KEY5(i));
1889 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_HDR_TRX_USER_KEY6(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_HDR_TRX_USER_KEY6(i));
1890 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LINE_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LINE_ID(i));
1891 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LIN_TRX_USER_KEY1(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LIN_TRX_USER_KEY1(i));
1892 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LIN_TRX_USER_KEY2(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LIN_TRX_USER_KEY2(i));
1893 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LIN_TRX_USER_KEY3(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LIN_TRX_USER_KEY3(i));
1897 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LINE_QUANTITY(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LINE_QUANTITY(i));
1894 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LIN_TRX_USER_KEY4(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LIN_TRX_USER_KEY4(i));
1895 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LIN_TRX_USER_KEY5(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LIN_TRX_USER_KEY5(i));
1896 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LIN_TRX_USER_KEY6(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LIN_TRX_USER_KEY6(i));
1898 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_APPLICATION_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_APPLICATION_ID(i));
1899 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_ENTITY_CODE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_ENTITY_CODE(i));
1900 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_EVENT_CLASS_CODE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_EVENT_CLASS_CODE(i));
1901 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_TRX_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_TRX_ID(i));
1902 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_HDR_TRX_USER_KEY1(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_HDR_TRX_USER_KEY1(i));
1903 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_HDR_TRX_USER_KEY2(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_HDR_TRX_USER_KEY2(i));
1904 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_HDR_TRX_USER_KEY3(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_HDR_TRX_USER_KEY3(i));
1905 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_HDR_TRX_USER_KEY4(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_HDR_TRX_USER_KEY4(i));
1906 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_HDR_TRX_USER_KEY5(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_HDR_TRX_USER_KEY5(i));
1907 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_HDR_TRX_USER_KEY6(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_HDR_TRX_USER_KEY6(i));
1908 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_LINE_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_LINE_ID(i));
1909 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_LIN_TRX_USER_KEY1(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_LIN_TRX_USER_KEY1(i));
1910 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_LIN_TRX_USER_KEY2(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_LIN_TRX_USER_KEY2(i));
1911 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_LIN_TRX_USER_KEY3(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_LIN_TRX_USER_KEY3(i));
1912 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_LIN_TRX_USER_KEY4(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_LIN_TRX_USER_KEY4(i));
1913 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_LIN_TRX_USER_KEY5(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_LIN_TRX_USER_KEY5(i));
1914 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_LIN_TRX_USER_KEY6(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_LIN_TRX_USER_KEY6(i));
1915 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_APPLICATION_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_APPLICATION_ID(i));
1916 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_ENTITY_CODE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_ENTITY_CODE(i));
1917 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_EVENT_CLASS_CODE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_EVENT_CLASS_CODE(i));
1918 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_TRX_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_TRX_ID(i));
1919 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_HDR_TRX_USER_KEY1(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_HDR_TRX_USER_KEY1(i));
1920 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_HDR_TRX_USER_KEY2(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_HDR_TRX_USER_KEY2(i));
1921 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_HDR_TRX_USER_KEY3(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_HDR_TRX_USER_KEY3(i));
1922 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_HDR_TRX_USER_KEY4(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_HDR_TRX_USER_KEY4(i));
1923 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_HDR_TRX_USER_KEY5(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_HDR_TRX_USER_KEY5(i));
1924 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_HDR_TRX_USER_KEY6(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_HDR_TRX_USER_KEY6(i));
1925 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_LINE_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_LINE_ID(i));
1926 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_LIN_TRX_USER_KEY1(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_LIN_TRX_USER_KEY1(i));
1927 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_LIN_TRX_USER_KEY2(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_LIN_TRX_USER_KEY2(i));
1928 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_LIN_TRX_USER_KEY3(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_LIN_TRX_USER_KEY3(i));
1929 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_LIN_TRX_USER_KEY4(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_LIN_TRX_USER_KEY4(i));
1930 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_LIN_TRX_USER_KEY5(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_LIN_TRX_USER_KEY5(i));
1931 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_LIN_TRX_USER_KEY6(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_LIN_TRX_USER_KEY6(i));
1932 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_NUMBER(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_NUMBER(i));
1936 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_TO_EVENT_CLASS_CODE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_TO_EVENT_CLASS_CODE(i));
1933 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_DATE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_DATE(i));
1934 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_TO_APPLICATION_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_TO_APPLICATION_ID(i));
1935 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_TO_ENTITY_CODE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_TO_ENTITY_CODE(i));
1937 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_TO_TRX_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_TO_TRX_ID(i));
1938 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_HDR_TRX_USER_KEY1(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_HDR_TRX_USER_KEY1(i));
1939 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_HDR_TRX_USER_KEY2(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_HDR_TRX_USER_KEY2(i));
1940 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_HDR_TRX_USER_KEY3(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_HDR_TRX_USER_KEY3(i));
1941 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_HDR_TRX_USER_KEY4(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_HDR_TRX_USER_KEY4(i));
1942 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_HDR_TRX_USER_KEY5(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_HDR_TRX_USER_KEY5(i));
1943 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_HDR_TRX_USER_KEY6(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_HDR_TRX_USER_KEY6(i));
1944 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_TO_TRX_LINE_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_TO_TRX_LINE_ID(i));
1945 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_LIN_TRX_USER_KEY1(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_LIN_TRX_USER_KEY1(i));
1946 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_LIN_TRX_USER_KEY2(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_LIN_TRX_USER_KEY2(i));
1947 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_LIN_TRX_USER_KEY3(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_LIN_TRX_USER_KEY3(i));
1948 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_LIN_TRX_USER_KEY4(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_LIN_TRX_USER_KEY4(i));
1949 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_LIN_TRX_USER_KEY5(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_LIN_TRX_USER_KEY5(i));
1950 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_LIN_TRX_USER_KEY6(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_LIN_TRX_USER_KEY6(i));
1951 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ASSESSABLE_VALUE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ASSESSABLE_VALUE(i));
1952 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.OUTPUT_TAX_CLASSIFICATION_CODE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.OUTPUT_TAX_CLASSIFICATION_CODE(i));
1953 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TRX_ID_LEVEL2(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TRX_ID_LEVEL2(i));
1954 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TRX_ID_LEVEL3(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TRX_ID_LEVEL3(i));
1955 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TRX_ID_LEVEL4(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TRX_ID_LEVEL4(i));
1956 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TRX_ID_LEVEL5(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TRX_ID_LEVEL5(i));
1957 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TRX_ID_LEVEL6(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TRX_ID_LEVEL6(i));
1958 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.HDR_TRX_USER_KEY1(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.HDR_TRX_USER_KEY1(i));
1959 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.HDR_TRX_USER_KEY2(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.HDR_TRX_USER_KEY2(i));
1960 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.HDR_TRX_USER_KEY3(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.HDR_TRX_USER_KEY3(i));
1961 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.HDR_TRX_USER_KEY4(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.HDR_TRX_USER_KEY4(i));
1962 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.HDR_TRX_USER_KEY5(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.HDR_TRX_USER_KEY5(i));
1963 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.HDR_TRX_USER_KEY6(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.HDR_TRX_USER_KEY6(i));
1964 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.LINE_TRX_USER_KEY1(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.LINE_TRX_USER_KEY1(i));
1965 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.LINE_TRX_USER_KEY2(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.LINE_TRX_USER_KEY2(i));
1966 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.LINE_TRX_USER_KEY3(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.LINE_TRX_USER_KEY3(i));
1967 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.LINE_TRX_USER_KEY4(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.LINE_TRX_USER_KEY4(i));
1968 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.LINE_TRX_USER_KEY5(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.LINE_TRX_USER_KEY5(i));
1969 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.LINE_TRX_USER_KEY6(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.LINE_TRX_USER_KEY6(i));
1970 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_NUMBER(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_NUMBER(i));
1971 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.HISTORICAL_FLAG(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.HISTORICAL_FLAG(i));
1972 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.CTRL_HDR_TX_APPL_FLAG(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.CTRL_HDR_TX_APPL_FLAG(i));
1973 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.CTRL_TOTAL_LINE_TX_AMT(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.CTRL_TOTAL_LINE_TX_AMT(i));
1977 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_GL_DATE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_GL_DATE(i));
1974 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_DESCRIPTION(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_DESCRIPTION(i));
1975 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_DESCRIPTION(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_DESCRIPTION(i));
1976 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TRX_WAYBILL_NUMBER(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TRX_WAYBILL_NUMBER(i));
1978 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_NAME(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_NAME(i));
1979 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_DOCUMENT_NUMBER(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_DOCUMENT_NUMBER(i));
1980 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_REFERENCE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_REFERENCE(i));
1981 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_TAXPAYER_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_TAXPAYER_ID(i));
1982 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_TAX_REG_NUMBER(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_TAX_REG_NUMBER(i));
1983 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.PAYING_PARTY_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.PAYING_PARTY_ID(i));
1984 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.OWN_HQ_PARTY_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.OWN_HQ_PARTY_ID(i));
1985 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TRADING_HQ_PARTY_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TRADING_HQ_PARTY_ID(i));
1986 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.POI_PARTY_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.POI_PARTY_ID(i));
1987 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.POD_PARTY_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.POD_PARTY_ID(i));
1988 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TITLE_TRANSFER_PARTY_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TITLE_TRANSFER_PARTY_ID(i));
1989 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.PAYING_PARTY_SITE_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.PAYING_PARTY_SITE_ID(i));
1990 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.OWN_HQ_PARTY_SITE_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.OWN_HQ_PARTY_SITE_ID(i));
1991 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TRADING_HQ_PARTY_SITE_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TRADING_HQ_PARTY_SITE_ID(i));
1992 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.POI_PARTY_SITE_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.POI_PARTY_SITE_ID(i));
1993 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.POD_PARTY_SITE_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.POD_PARTY_SITE_ID(i));
1994 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TITLE_TRANSFER_PARTY_SITE_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TITLE_TRANSFER_PARTY_SITE_ID(i));
1995 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.PAYING_LOCATION_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.PAYING_LOCATION_ID(i));
1996 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.OWN_HQ_LOCATION_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.OWN_HQ_LOCATION_ID(i));
1997 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TRADING_HQ_LOCATION_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TRADING_HQ_LOCATION_ID(i));
1998 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.POC_LOCATION_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.POC_LOCATION_ID(i));
1999 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.POI_LOCATION_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.POI_LOCATION_ID(i));
2000 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.POD_LOCATION_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.POD_LOCATION_ID(i));
2001 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TITLE_TRANSFER_LOCATION_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TITLE_TRANSFER_LOCATION_ID(i));
2002 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ASSET_FLAG(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ASSET_FLAG(i));
2003 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ASSET_NUMBER(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ASSET_NUMBER(i));
2004 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ASSET_ACCUM_DEPRECIATION(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ASSET_ACCUM_DEPRECIATION(i));
2005 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ASSET_TYPE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ASSET_TYPE(i));
2006 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ASSET_COST(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ASSET_COST(i));
2007 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC1(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC1(i));
2008 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC2(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC2(i));
2009 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC3(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC3(i));
2010 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC4(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC4(i));
2011 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC5(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC5(i));
2012 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC6(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC6(i));
2013 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC7(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC7(i));
2014 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC8(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC8(i));
2015 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC9(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC9(i));
2016 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC10(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC10(i));
2020 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.CHAR4(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.CHAR4(i));
2017 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.CHAR1(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.CHAR1(i));
2018 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.CHAR2(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.CHAR2(i));
2019 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.CHAR3(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.CHAR3(i));
2021 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.CHAR5(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.CHAR5(i));
2022 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.CHAR6(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.CHAR6(i));
2023 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.CHAR7(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.CHAR7(i));
2024 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.CHAR8(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.CHAR8(i));
2025 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.CHAR9(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.CHAR9(i));
2026 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.CHAR10(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.CHAR10(i));
2027 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DATE1(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DATE1(i));
2028 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DATE2(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DATE2(i));
2029 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DATE3(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DATE3(i));
2030 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DATE4(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DATE4(i));
2031 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DATE5(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DATE5(i));
2032 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DATE6(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DATE6(i));
2033 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DATE7(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DATE7(i));
2034 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DATE8(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DATE8(i));
2035 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DATE9(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DATE9(i));
2036 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DATE10(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DATE10(i));
2037 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.SHIP_TO_PARTY_TAX_PROF_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.SHIP_TO_PARTY_TAX_PROF_ID(i));
2038 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.SHIP_FROM_PARTY_TAX_PROF_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.SHIP_FROM_PARTY_TAX_PROF_ID(i));
2039 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.POA_PARTY_TAX_PROF_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.POA_PARTY_TAX_PROF_ID(i));
2040 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.POO_PARTY_TAX_PROF_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.POO_PARTY_TAX_PROF_ID(i));
2041 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.PAYING_PARTY_TAX_PROF_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.PAYING_PARTY_TAX_PROF_ID(i));
2042 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.OWN_HQ_PARTY_TAX_PROF_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.OWN_HQ_PARTY_TAX_PROF_ID(i));
2043 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TRADING_HQ_PARTY_TAX_PROF_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TRADING_HQ_PARTY_TAX_PROF_ID(i));
2044 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.POI_PARTY_TAX_PROF_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.POI_PARTY_TAX_PROF_ID(i));
2045 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.POD_PARTY_TAX_PROF_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.POD_PARTY_TAX_PROF_ID(i));
2046 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.BILL_TO_PARTY_TAX_PROF_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.BILL_TO_PARTY_TAX_PROF_ID(i));
2047 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.BILL_FROM_PARTY_TAX_PROF_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.BILL_FROM_PARTY_TAX_PROF_ID(i));
2048 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TITLE_TRANS_PARTY_TAX_PROF_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TITLE_TRANS_PARTY_TAX_PROF_ID(i));
2049 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.SHIP_TO_SITE_TAX_PROF_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.SHIP_TO_SITE_TAX_PROF_ID(i));
2050 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.SHIP_FROM_SITE_TAX_PROF_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.SHIP_FROM_SITE_TAX_PROF_ID(i));
2051 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.POA_SITE_TAX_PROF_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.POA_SITE_TAX_PROF_ID(i));
2052 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.POO_SITE_TAX_PROF_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.POO_SITE_TAX_PROF_ID(i));
2053 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.PAYING_SITE_TAX_PROF_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.PAYING_SITE_TAX_PROF_ID(i));
2054 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.OWN_HQ_SITE_TAX_PROF_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.OWN_HQ_SITE_TAX_PROF_ID(i));
2055 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TRADING_HQ_SITE_TAX_PROF_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TRADING_HQ_SITE_TAX_PROF_ID(i));
2056 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.POI_SITE_TAX_PROF_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.POI_SITE_TAX_PROF_ID(i));
2057 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.POD_SITE_TAX_PROF_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.POD_SITE_TAX_PROF_ID(i));
2058 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.BILL_TO_SITE_TAX_PROF_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.BILL_TO_SITE_TAX_PROF_ID(i));
2059 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.BILL_FROM_SITE_TAX_PROF_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.BILL_FROM_SITE_TAX_PROF_ID(i));
2060 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.TITLE_TRANS_SITE_TAX_PROF_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.TITLE_TRANS_SITE_TAX_PROF_ID(i));
2061 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_TAX_PROF_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_TAX_PROF_ID(i));
2062 
2063 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_APPLICATION_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_APPLICATION_ID(i));
2064 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_ENTITY_CODE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_ENTITY_CODE(i));
2065 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_EVENT_CLASS_CODE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_EVENT_CLASS_CODE(i));
2066 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_TRX_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_TRX_ID(i));
2067 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_LINE_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_LINE_ID(i));
2068 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_TRX_LEVEL_TYPE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_TRX_LEVEL_TYPE(i));
2069 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_TRX_LEVEL_TYPE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_TRX_LEVEL_TYPE(i));
2070 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_TO_TRX_LEVEL_TYPE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_TO_TRX_LEVEL_TYPE(i));
2071 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_TRX_LEVEL_TYPE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_TRX_LEVEL_TYPE(i));
2072 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_TRX_LEVEL_TYPE(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_TRX_LEVEL_TYPE(i));
2073 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE1(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE1(i));
2074 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE2(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE2(i));
2075 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE3(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE3(i));
2076 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE4(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE4(i));
2077 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE5(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE5(i));
2078 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE6(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE6(i));
2079 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE7(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE7(i));
2080 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE8(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE8(i));
2081 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE9(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE9(i));
2082 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE10(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE10(i));
2083 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_TAX_LINE_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_TAX_LINE_ID(i));
2084 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_TRX_NUMBER(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_TRX_NUMBER(i));
2085 
2086 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.SHIP_THIRD_PTY_ACCT_SITE_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.SHIP_THIRD_PTY_ACCT_SITE_ID(i));
2087 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.BILL_THIRD_PTY_ACCT_SITE_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.BILL_THIRD_PTY_ACCT_SITE_ID(i));
2088 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.SHIP_TO_CUST_ACCT_SITE_USE_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.SHIP_TO_CUST_ACCT_SITE_USE_ID(i));
2089 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.BILL_TO_CUST_ACCT_SITE_USE_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.BILL_TO_CUST_ACCT_SITE_USE_ID(i));
2090 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.SHIP_THIRD_PTY_ACCT_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.SHIP_THIRD_PTY_ACCT_ID(i));
2091 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.BILL_THIRD_PTY_ACCT_ID(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.BILL_THIRD_PTY_ACCT_ID(i));
2092         oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.LEGAL_ENTITY_ID(i)= '||
2093                                    zx_global_structures_pkg.trx_line_dist_tbl.LEGAL_ENTITY_ID(i),3);
2094         oe_debug_pub.add('Exiting OM_TAX_UTIL.Debug_msg procedure ');
2095 ELSE
2096 	oe_debug_pub.add(' Index:'||i||' not avail for debug');
2097 END IF;
2098 End Debug_msg ;
2099 
2100 END OE_BULK_TAX_UTIL;