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.8 2011/03/23 05:49:11 jmedaven 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 /* Procedure calculate_tax modified for TAX ER*/
391 
392 PROCEDURE Calculate_Tax(
393     p_post_insert IN BOOLEAN )
394 IS
395   l_charge_tbl om_tax_util.charge_tbl;
396   l_org_id               NUMBER(15):=MO_GLOBAL.Get_Current_Org_Id;
397   l_level                VARCHAR2(3);
398   l_index                NUMBER;
399   l_debug_level          CONSTANT NUMBER := oe_debug_pub.g_debug_level;
400   l_charge_id            NUMBER;
401   l_header_index         NUMBER;
402   l_index_inc            NUMBER;
403   l_tax_index            NUMBER;
404   l_header_id            NUMBER;
405   l_line_id              NUMBER;
406   l_order_type_cache_key NUMBER;
407   l_remaining_lines      NUMBER;
408   l_tax_code_cache_key   NUMBER;
409   l_ship_to_cache_key    NUMBER;
410   l_invoice_to_cache_key NUMBER;
411   l_asgn_org_id          NUMBER;
412   l_salesrep_cache_key   NUMBER;
413   l_person_id            NUMBER;
414   l_tax_method           VARCHAR2(30);
415   l_vendor_installed     VARCHAR2(1);
416   l_AR_Sys_Param_Rec AR_SYSTEM_PARAMETERS_ALL%ROWTYPE;
417   l_bill_to_cust_id           NUMBER;
418   l_bill_to_location_id       NUMBER;
419   l_bill_to_cust_acct_site_id NUMBER;
420   l_bill_to_cust_account_id   NUMBER;
421   l_bill_to_account_number    VARCHAR2(30);
422   l_bill_su_tax_hdr_flag      VARCHAR2(1);
423   l_bill_acct_tax_hdr_flag    VARCHAR2(1);
424   l_bill_to_su_tax_rnd_rule   VARCHAR2(30);
425   l_bill_to_acct_tax_rnd_rule VARCHAR2(30);
426   l_bill_to_state             VARCHAR2(60);
427   l_bill_to_party_name        VARCHAR2(360);
428   l_ship_to_cust_id           NUMBER;
429   l_ship_to_location_id       NUMBER;
430   l_ship_to_state             VARCHAR2(60);
431   l_ship_to_cust_acct_site_id NUMBER;
432   l_ship_to_cust_account_id   NUMBER;
433   l_ship_to_account_number    VARCHAR2(30);
434   l_ship_to_party_name        VARCHAR2(360);
435   l_ship_su_tax_hdr_flag      VARCHAR2(1);
436   l_ship_acct_tax_hdr_flag    VARCHAR2(1);
437   l_ship_to_su_tax_rnd_rule   VARCHAR2(30);
438   l_ship_to_acct_tax_rnd_rule VARCHAR2(30);
439   x_tax_value                 NUMBER;
440   l_x_msg_count               NUMBER;
441   l_x_msg_data                VARCHAR2(2000);
442   l_return_status             VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
443   l_tax_value                 NUMBER      := 0;
444   l_tax_code                  VARCHAR2(50);
445   l_adj_index                 NUMBER;
446   l_start_time                NUMBER;
447   l_end_time                  NUMBER;
448   l_load_person_failed        BOOLEAN := false;
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   CURSOR get_internal_loc(p_organization_id NUMBER)
491   IS
492     SELECT location_id
493     FROM hr_organization_units
494     WHERE organization_id = p_organization_id;
495 TYPE Entity_info
496 IS
497   RECORD
498   (
499     trx_id      NUMBER,
500     trx_line_id NUMBER,
501     line_id     NUMBER,
502     trx_level_type zx_detail_tax_lines_gt.trx_level_type%TYPE,
503     header_index NUMBER,
504     line_index   NUMBER,
505     charge_amt   NUMBER );
506 TYPE Entity_info_rec_tbl
507 IS
508   TABLE OF Entity_info INDEX BY binary_integer;
509   Entity_info_tbl Entity_info_rec_tbl;
510   CURSOR getlocinfo(p_site_org_id HZ_CUST_SITE_USES_ALL.SITE_USE_ID%type)
511   IS
512     SELECT
513       /* MOAC_SQL_CHANGE */
514       s_ship.site_use_id,
515       s_ship.cust_acct_site_id,
516       acct_site_ship.cust_account_id,
517       loc_ship.postal_code,
518       party.party_name,
519       cust_acct.account_number,
520       party.party_id,
521       party_site_ship.party_site_id,
522       loc_ship.location_id
523     FROM HZ_CUST_SITE_USES S_SHIP ,
524       HZ_CUST_ACCT_SITES_ALL ACCT_SITE_SHIP,
525       HZ_PARTY_SITES PARTY_SITE_SHIP,
526       HZ_LOCATIONS LOC_SHIP,
527       HZ_PARTIES PARTY,
528       HZ_CUST_ACCOUNTS_ALL CUST_ACCT
529     WHERE s_ship.site_use_id           = p_site_org_id
530     AND s_ship.cust_acct_site_id       = acct_site_ship.cust_acct_site_id
531     AND acct_site_ship.cust_account_id = cust_acct.cust_account_id
532     AND cust_acct.party_id             = party.party_id
533     AND acct_site_ship.party_site_id   = party_site_ship.party_site_id
534     AND party_site_ship.location_id    = loc_ship.location_id;
535   CURSOR detail_tax_lines_gt (p_header_id oe_order_lines.header_id%type)
536     --  p_line_id oe_order_lines.line_id%type)
537   IS
538     SELECT *
539     FROM ZX_DETAIL_TAX_LINES_GT
540     WHERE application_id = l_application_id
541     AND entity_code      = l_entity_code_crsr      --'OE_ORDER_HEADERS'
542     AND event_class_code = l_event_class_code_crsr --'SALES_TRANSACTION_TAX_QUOTE'
543     AND trx_id           = p_header_id ;
544       --and trx_line_id = p_line_id
545     --AND trx_level_type = 'LINE';
546   detail_tax_lines_gt_rec detail_tax_lines_gt%rowtype;
547   --
548 BEGIN
549   IF l_debug_level > 0 THEN
550     oe_debug_pub.add( 'ENTERING OE_BULK_TAX_UTIL.CALCULATE_TAX' ) ;
551     IF p_post_insert THEN
552       oe_debug_pub.add( 'Post_insert : TRUE');
553     ELSE
554       oe_debug_pub.add( 'Post_insert : FALSE');
555     END IF;
556   END IF;
557   IF l_debug_level > 0 THEN
558     oe_debug_pub.add( 'tax method: ' || l_tax_method || '    vendor installed: ' || l_vendor_installed);
559   END IF;
560   l_index     := 1;
561   l_tax_index := 1;
562   l_adj_index := 1;
563   FOR i       IN 1.. OE_Bulk_Order_PVT.G_LINE_REC.LINE_ID.COUNT
564   LOOP
565     G_LINE_ID(i) :=OE_Bulk_Order_PVT.G_LINE_REC.LINE_ID(i);
566     oe_debug_pub.add( 'Entering Values for line in entity info table for line');
567     Entity_info_tbl(l_index).trx_id                                               := OE_Bulk_Order_PVT.G_LINE_REC.header_id(i);
568     Entity_info_tbl(l_index).trx_line_id                                          := OE_Bulk_Order_PVT.G_LINE_REC.LINE_ID(i);
569     Entity_info_tbl(l_index).line_id                                              := OE_Bulk_Order_PVT.G_LINE_REC.LINE_ID(i);
570     Entity_info_tbl(l_index).header_index                                         := OE_Bulk_Order_PVT.G_LINE_REC.header_index(i);
571     Entity_info_tbl(l_index).line_index                                           := i;
572     oe_debug_pub.add( 'line_index for line'||OE_Bulk_Order_PVT.G_LINE_REC.LINE_ID(i) ||' :'|| i);
573     Entity_info_tbl(l_index).trx_level_type                                       := 'LINE';
574     Entity_info_tbl(l_index).charge_amt                                           := NULL;
575     l_index                                                                       := l_index+1;
576     IF ( NVL (oe_sys_parameters.value('OE_INVOICE_FREIGHT_AS_LINE',l_org_id), 'N') = 'Y' ) THEN
577 
578       l_charge_tbl := om_tax_util.get_charge_details(p_header_id =>OE_Bulk_Order_PVT.G_LINE_REC.header_id(i) , p_line_id =>OE_Bulk_Order_PVT.G_LINE_REC.line_id(i));
579       IF l_charge_tbl.Count > 0 THEN
580        oe_debug_pub.add( 'Entering Values for line charges in entity info table');
581       END IF;
582 
583 
584       FOR j        IN 1.. l_charge_tbl.count
585       LOOP
586         Entity_info_tbl(l_index).trx_id         := OE_Bulk_Order_PVT.G_LINE_REC.header_id(i);
587         Entity_info_tbl(l_index).trx_line_id    := l_charge_tbl(j).charge_id ;
588         Entity_info_tbl(l_index).line_id        := OE_Bulk_Order_PVT.G_LINE_REC.LINE_ID(i);
589         Entity_info_tbl(l_index).header_index   := OE_Bulk_Order_PVT.G_LINE_REC.header_index(i);
590         Entity_info_tbl(l_index).line_index     := i;
591         oe_debug_pub.add( 'line_index for line charge '||OE_Bulk_Order_PVT.G_LINE_REC.LINE_ID(i)|| ' :'|| i);
592         Entity_info_tbl(l_index).trx_level_type := 'FREIGHT CHARGE';
593         Entity_info_tbl(l_index).charge_amt     := l_charge_tbl(j).charge_amount;
594         l_index                                 := l_index+1;
595       END LOOP;
596     END IF;
597   END LOOP;
598   IF ( NVL (oe_sys_parameters.value('OE_INVOICE_FREIGHT_AS_LINE',l_org_id), 'N') = 'Y' ) THEN
599     FOR i IN 1.. OE_Bulk_Order_PVT.G_HEADER_REC.HEADER_ID.COUNT
600     LOOP
601       l_charge_tbl := om_tax_util.get_charge_details(p_header_id =>OE_Bulk_Order_PVT.G_HEADER_REC.HEADER_ID(i) , p_line_id =>NULL);
602       IF l_charge_tbl.Count > 0 THEN
603        oe_debug_pub.add( 'Entering Values for header charges in entity info table');
604       END IF;
605 
606       FOR j        IN 1..l_charge_tbl.count
607       LOOP
608         Entity_info_tbl(l_index).trx_id         := OE_Bulk_Order_PVT.G_HEADER_REC.header_id(i);
609         Entity_info_tbl(l_index).trx_line_id    := l_charge_tbl(j).charge_id ;
610         Entity_info_tbl(l_index).line_id        := NULL;
611         Entity_info_tbl(l_index).header_index   := i;
612         oe_debug_pub.add( 'header_index for header'||OE_Bulk_Order_PVT.G_HEADER_REC.header_id(i)|| ' :'|| i);
613         Entity_info_tbl(l_index).line_index     := NULL;
614         Entity_info_tbl(l_index).trx_level_type := 'FREIGHT CHARGE';
615         Entity_info_tbl(l_index).charge_amt     := l_charge_tbl(j).charge_amount;
616         l_index                                 := l_index+1;
617       END LOOP;
618     END LOOP;
619   END IF;
620   FOR i IN 1..Entity_info_tbl.count
621   LOOP
622     l_tax_value                         := 0;
623     l_index_inc                         := 1;
624     IF Entity_info_tbl(i).trx_level_type = 'LINE' THEN
625       oe_debug_pub.add( 'Processing Line: ' ||Entity_info_tbl(i).trx_line_id);
626       l_header_index                       := Entity_info_tbl(i).header_index;
627       l_header_id                          := Entity_info_tbl(i).trx_id;
628       l_line_id                            := Entity_info_tbl(i).trx_line_id;
629       l_level                              := 'L';
630       l_salesrep_cache_key                 := OE_BULK_CACHE.Load_Salesrep(OE_Bulk_Order_PVT.G_LINE_REC.salesrep_id(Entity_info_tbl(i).line_index));
631     elsif Entity_info_tbl(i).trx_level_type = 'FREIGHT CHARGE' AND Entity_info_tbl(i).line_id IS NOT NULL THEN
632       oe_debug_pub.add( 'Processing Line charge for line : ' ||Entity_info_tbl(i).line_id);
633       oe_debug_pub.add( 'Processing charge: ' ||Entity_info_tbl(i).trx_line_id);
634       l_header_index                       := Entity_info_tbl(i).header_index;
635       l_header_id                          := Entity_info_tbl(i).trx_id;
636       l_line_id                            := Entity_info_tbl(i).line_id;
637       l_charge_id                          := Entity_info_tbl(i).trx_line_id;
638       l_level                              := 'LC';
639       l_salesrep_cache_key                 := OE_BULK_CACHE.Load_Salesrep(OE_Bulk_Order_PVT.G_LINE_REC.salesrep_id(Entity_info_tbl(i).line_index));
640     elsif Entity_info_tbl(i).trx_level_type = 'FREIGHT CHARGE' AND Entity_info_tbl(i).line_id IS NULL THEN
641       oe_debug_pub.add( 'Processing Header charge for Header : ' ||Entity_info_tbl(i).trx_id);
642       oe_debug_pub.add( 'Processing charge: ' ||Entity_info_tbl(i).trx_line_id);
643       l_header_index       := Entity_info_tbl(i).header_index;
644       l_header_id          := Entity_info_tbl(i).trx_id;
645       l_line_id            := NULL;
646       l_charge_id          := Entity_info_tbl(i).trx_line_id;
647       l_level              := 'HC';
648       l_salesrep_cache_key := OE_BULK_CACHE.Load_Salesrep(OE_Bulk_Order_PVT.G_HEADER_REC.salesrep_id(Entity_info_tbl(i).header_index));
649     END IF;
650     zx_global_structures_pkg.init_trx_line_dist_tbl(i);
651     IF NVL(OE_Bulk_Order_PVT.G_HEADER_REC.lock_control(l_header_index),0) = -99 THEN
652       IF l_debug_level                                                    > 0 THEN
653         oe_debug_pub.add( 'lock control set.  skipping header with header id: '|| l_header_id);
654       END IF;
655       l_legal_entity_id := get_le_id(p_order_type_id => OE_Bulk_Order_PVT.G_HEADER_REC.order_type_id(l_header_index) ,
656                                      p_sold_to_customer_id => OE_Bulk_Order_PVT.G_HEADER_REC.sold_to_org_id(l_header_index) ,
657                                      p_bill_to_customer_id => l_bill_to_customer_id ,
658                                      p_org_id => OE_Bulk_Order_PVT.G_HEADER_REC.org_id(l_header_index) );
659       l_remaining_lines := OE_Bulk_Order_PVT.G_HEADER_REC.end_line_index(l_header_index) - l_index;
660       l_index_inc       := l_remaining_lines                                             + 1;
661     ELSE
662       l_AR_Sys_Param_Rec := OE_Sys_Parameters_Pvt.Get_AR_Sys_Params;
663       BEGIN
664         SELECT location_id
665         INTO l_bill_from_location_id
666         FROM HR_ALL_ORGANIZATION_UNITS
667         WHERE organization_id = OE_Bulk_Order_PVT.G_HEADER_REC.org_id(l_header_index);
668       EXCEPTION
669       WHEN OTHERS THEN
670         l_bill_from_location_id := NULL;
671       END;
672       IF l_level = 'L' THEN
673 
674       oe_debug_pub.add( 'Loading Line details in ZX global package');
675         BEGIN
676           l_person_id     := OE_BULK_CACHE.G_SALESREP_TBL(l_salesrep_cache_key).person_id;
677           IF l_debug_level > 0 THEN
678             oe_debug_pub.add( 'Before Calling load_person: ' || l_person_id);
679           END IF;
680           l_asgn_org_id := OE_BULK_CACHE.Load_Person(l_person_id, OE_Bulk_Order_PVT.G_LINE_REC.tax_date(Entity_info_tbl(i).line_index));
681         EXCEPTION
682         WHEN OTHERS THEN
683           l_load_person_failed := true;
684           IF l_debug_level      > 0 THEN
685             oe_debug_pub.add( 'Load Person Failed. ' || SQLERRM);
686           END IF;
687         END;
688         IF l_load_person_failed THEN
689           l_asgn_org_id     := NULL;
690           l_poo_location_id := NULL;
691         ELSE
692           l_asgn_org_id     := OE_BULK_CACHE.G_PERSON_TBL(l_person_id).ORGANIZATION_ID; -- the cache key is l_person_id only
693           l_poo_location_id := OE_BULK_CACHE.G_PERSON_TBL(l_person_id).LOCATION_ID;
694         END IF;
695         IF OE_Bulk_Order_PVT.G_LINE_REC.invoice_to_org_id(Entity_info_tbl(i).line_index) IS NOT NULL THEN
696           IF l_debug_level                                                                > 0 THEN
697             oe_debug_pub.add( 'retrieving bill_to info');
698             oe_debug_pub.add( 'Line index:'||Entity_info_tbl(i).line_index);
699             oe_debug_pub.add( 'Line index invoice to org:'||OE_Bulk_Order_PVT.G_LINE_REC.invoice_to_org_id(Entity_info_tbl(i).line_index));
700           END IF;
701           l_invoice_to_cache_key      := OE_Bulk_Cache.load_loc_info(OE_Bulk_Order_PVT.G_LINE_REC.invoice_to_org_id(Entity_info_tbl(i).line_index));
702           oe_debug_pub.add( 'After invoice line chache :'||l_invoice_to_cache_key);
703           l_bill_to_cust_id           := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).CUST_ACCOUNT_ID;
704           l_bill_to_postal_code       := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).POSTAL_CODE;
705           l_bill_location_id          := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).LOC_ID;
706           l_bill_to_state             := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).STATE;
707           l_bill_to_cust_acct_site_id := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).CUST_ACCT_SITE_ID;
708           l_bill_to_cust_account_id   := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).CUST_ACCOUNT_ID;
709           l_bill_to_account_number    := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).ACCOUNT_NUMBER;
710           l_bill_party_id             := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).PARTY_ID;
711           l_bill_to_party_name        := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).PARTY_NAME;
712           l_bill_party_site_id        := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).PARTY_SITE_ID;
713           l_bill_su_tax_hdr_flag      := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).TAX_HEADER_LEVEL_FLAG;
714           l_bill_acct_tax_hdr_flag    := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).ACCT_TAX_HEADER_LEVEL_FLAG;
715           l_bill_to_su_tax_rnd_rule   := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).TAX_ROUNDING_RULE;
716           l_bill_to_acct_tax_rnd_rule := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).ACCT_TAX_ROUNDING_RULE;
717           oe_debug_pub.add( 'before end if');
718         END IF; --end of if invoice_to_org_id IS NOT NULL
719         l_commitment_id    := NVL(OE_Bulk_Order_PVT.G_LINE_REC.commitment_id(Entity_info_tbl(i).line_index),0);
720         IF l_commitment_id <> 0 THEN
721           IF l_debug_level  > 0 THEN
722             oe_debug_pub.add('Commitment id is:'||l_commitment_id,4);
723           END IF;
724           BEGIN
725             SELECT
726               /* MOAC_SQL_CHANGE */
727               NVL(cust_type.subsequent_trx_type_id, cust_type.cust_trx_type_id)
728             INTO l_cust_trx_type_id
729             FROM ra_cust_trx_types_all cust_type,
730               ra_customer_trx cust_trx
731             WHERE cust_type.cust_trx_type_id = cust_trx.cust_trx_type_id
732             AND cust_type.org_id             = cust_trx.org_id
733             AND cust_trx.customer_trx_id     = l_commitment_id;
734           EXCEPTION
735           WHEN OTHERS THEN
736             IF l_debug_level > 0 THEN
737               oe_debug_pub.add('In commitment exception ',4);
738             END IF;
739             NULL;
740           END;
741           IF l_debug_level > 0 THEN
742             oe_debug_pub.add('cust trx type from commitment:'||l_cust_Trx_type_id,4);
743           END IF;
744         ELSE
745           IF l_debug_level > 0 THEN
746             oe_debug_pub.add('In else part of commitment id',4);
747           END IF;
748           /*l_cust_trx_type_id :=
749           OE_INVOICE_PUB.Get_Customer_Transaction_Type(OE_Bulk_Order_PVT.G_LINE_REC(l_index)); */
750         END IF;
751         --code changes made for bug 1883552  end
752         IF l_debug_level > 0 THEN
753           oe_debug_pub.add('Customer trx type id is:'||l_cust_trx_type_id,4);
754         END IF;
755         l_header_org_id    := OE_Bulk_Order_PVT.G_HEADER_REC.org_id(Entity_info_tbl(i).header_index);
756         l_currency_code    := OE_Bulk_Order_PVT.G_HEADER_REC.transactional_curr_code(Entity_info_tbl(i).header_index);
757         l_conversion_rate  := OE_Bulk_Order_PVT.G_HEADER_REC.conversion_rate(Entity_info_tbl(i).header_index);
758         l_inventory_org_id := oe_sys_parameters.value('MASTER_ORGANIZATION_ID',OE_Bulk_Order_PVT.G_HEADER_REC.org_id(Entity_info_tbl(i).header_index));
759         SELECT c.minimum_accountable_unit,
760           c.precision
761         INTO l_minimum_accountable_unit,
762           l_precision
763         FROM fnd_currencies c
764         WHERE c.currency_code = l_currency_code;
765         OPEN get_internal_loc(OE_Bulk_Order_PVT.G_HEADER_REC.org_id(Entity_info_tbl(i).header_index));
766         FETCH get_internal_loc INTO l_internal_org_location_id;
767         CLOSE get_internal_loc;
768         l_legal_entity_id  := get_le_id(p_order_type_id => OE_Bulk_Order_PVT.G_HEADER_REC.order_type_id(Entity_info_tbl(i).header_index) ,
769                               p_sold_to_customer_id => OE_Bulk_Order_PVT.G_HEADER_REC.sold_to_org_id(Entity_info_tbl(i).header_index) ,
770                               p_bill_to_customer_id => l_bill_to_cust_id ,
771                               p_org_id => OE_Bulk_Order_PVT.G_HEADER_REC.org_id(Entity_info_tbl(i).header_index) );
772         IF OE_Bulk_Order_PVT.G_LINE_REC.ship_from_org_id(Entity_info_tbl(i).line_index) IS NOT NULL THEN
773           BEGIN
774             SELECT location_id
775             INTO l_ship_from_location_id
776             FROM hr_all_organization_units hu
777             WHERE hu.organization_id = OE_Bulk_Order_PVT.G_LINE_REC.ship_from_org_id(Entity_info_tbl(i).line_index);
778           EXCEPTION
779           WHEN OTHERS THEN
780             NULL;
781           END;
782         END IF;
783         IF OE_Bulk_Order_PVT.G_LINE_REC.ship_to_org_id(Entity_info_tbl(i).line_index) IS NOT NULL THEN
784           IF l_debug_level                                                             > 0 THEN
785             oe_debug_pub.add( 'retrieving ship_to info');
786               END IF;
787           l_ship_to_cache_key         := OE_Bulk_Cache.load_loc_info(OE_Bulk_Order_PVT.G_LINE_REC.ship_to_org_id(Entity_info_tbl(i).line_index));
788           l_ship_to_cust_id           := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).CUST_ACCOUNT_ID;
789           l_ship_to_postal_code       := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).POSTAL_CODE;
790           l_ship_location_id          := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).LOC_ID;
791           l_ship_to_state             := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).STATE;
792           l_ship_to_cust_acct_site_id := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).CUST_ACCT_SITE_ID;
793           l_ship_to_cust_account_id   := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).CUST_ACCOUNT_ID;
794           l_ship_to_account_number    := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).ACCOUNT_NUMBER;
795           l_ship_party_id             := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).PARTY_ID;
796           l_ship_to_party_name        := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).PARTY_NAME;
797           l_ship_party_site_id        := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).PARTY_SITE_ID;
798           l_ship_su_tax_hdr_flag      := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).TAX_HEADER_LEVEL_FLAG;
799           l_ship_acct_tax_hdr_flag    := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).ACCT_TAX_HEADER_LEVEL_FLAG;
800           l_ship_to_su_tax_rnd_rule   := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).TAX_ROUNDING_RULE;
801           l_ship_to_acct_tax_rnd_rule := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).ACCT_TAX_ROUNDING_RULE;
802         END IF; -- end of if ship_to_org_id IS NOT NULL
803         zx_global_structures_pkg.trx_line_dist_tbl.TRX_LEVEL_TYPE(i)                 := 'LINE';
804         zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_ORG_ID(i)                 := NVL(OE_Bulk_Order_PVT.G_Line_Rec.ship_from_org_id(Entity_info_tbl(i).line_index),l_inventory_org_id);
805         zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_QUANTITY(i)              := OE_Bulk_Order_PVT.G_Line_Rec.ordered_quantity (Entity_info_tbl(i).line_index);
806         zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_DESCRIPTION(i)           := OE_Bulk_Order_PVT.G_Line_Rec.user_item_description (Entity_info_tbl(i).line_index);
807         zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_DESCRIPTION(i)            := OE_Bulk_Order_PVT.G_Line_Rec.user_item_description (Entity_info_tbl(i).line_index);
808         zx_global_structures_pkg.trx_line_dist_tbl.FOB_POINT(i)                      := OE_Bulk_Order_PVT.G_Line_Rec.fob_point_code(Entity_info_tbl(i).line_index);
809         zx_global_structures_pkg.trx_line_dist_tbl.TRX_ID(i)                         := OE_Bulk_Order_PVT.G_Line_Rec.header_id(Entity_info_tbl(i).line_index);
810         zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_ID(i)                     := OE_Bulk_Order_PVT.G_Line_Rec.inventory_item_id(Entity_info_tbl(i).line_index);
811         zx_global_structures_pkg.trx_line_dist_tbl.BILL_TO_CUST_ACCT_SITE_USE_ID(i)  := OE_Bulk_Order_PVT.G_LINE_REC.invoice_to_org_id(Entity_info_tbl(i).line_index);
812         zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_ID(i)                    := OE_Bulk_Order_PVT.G_Line_Rec.Line_Id(Entity_info_tbl(i).line_index);
813         zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_NUMBER(i)                := OE_Bulk_Order_PVT.G_Line_Rec.line_number(Entity_info_tbl(i).line_index);
814         zx_global_structures_pkg.trx_line_dist_tbl.SHIP_FROM_PARTY_ID(i)             := OE_Bulk_Order_PVT.G_Line_Rec.ship_from_org_id(Entity_info_tbl(i).line_index);
815         zx_global_structures_pkg.trx_line_dist_tbl.SHIP_TO_CUST_ACCT_SITE_USE_ID(i)  := OE_Bulk_Order_PVT.G_LINE_REC.ship_to_org_id(Entity_info_tbl(i).line_index);
816         zx_global_structures_pkg.trx_line_dist_tbl.OUTPUT_TAX_CLASSIFICATION_CODE(i) := OE_Bulk_Order_PVT.G_Line_Rec.tax_code(Entity_info_tbl(i).line_index);
817         zx_global_structures_pkg.trx_line_dist_tbl.TRX_DATE(i)                       := OE_Bulk_Order_PVT.G_Line_Rec.TAX_DATE(Entity_info_tbl(i).line_index);
818         zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_DATE(i)                  := OE_Bulk_Order_PVT.G_Line_Rec.tax_date(Entity_info_tbl(i).line_index);
819         zx_global_structures_pkg.trx_line_dist_tbl.EXEMPTION_CONTROL_FLAG(i)         := OE_Bulk_Order_PVT.G_Line_Rec.TAX_EXEMPT_FLAG(Entity_info_tbl(i).line_index);
820         zx_global_structures_pkg.trx_line_dist_tbl.EXEMPT_CERTIFICATE_NUMBER(i)      := OE_Bulk_Order_PVT.G_Line_Rec.tax_exempt_number(Entity_info_tbl(i).line_index);
821         zx_global_structures_pkg.trx_line_dist_tbl.EXEMPT_REASON_CODE(i)             := OE_Bulk_Order_PVT.G_Line_Rec.TAX_EXEMPT_REASON_CODE(Entity_info_tbl(i).line_index);
822         zx_global_structures_pkg.trx_line_dist_tbl.EXEMPT_REASON(i)                  := OE_Bulk_Order_PVT.G_Line_Rec.TAX_EXEMPT_REASON_CODE(Entity_info_tbl(i).line_index);
823         zx_global_structures_pkg.trx_line_dist_tbl.UNIT_PRICE(i)                     := OE_Bulk_Order_PVT.G_Line_Rec.unit_selling_price(Entity_info_tbl(i).line_index);
824         zx_global_structures_pkg.trx_line_dist_tbl.UOM_CODE(i)  := NVL( OE_Bulk_Order_PVT.G_Line_Rec.order_quantity_uom (Entity_info_tbl(i).line_index),
825                                                                                         OE_Bulk_Order_PVT.G_Line_Rec.pricing_quantity_uom(Entity_info_tbl(i).line_index));
826         zx_global_structures_pkg.trx_line_dist_tbl.LINE_AMT(i) := OE_Bulk_Order_PVT.G_Line_Rec.ordered_quantity (Entity_info_tbl(i).line_index) *
827                                                                   OE_Bulk_Order_PVT.G_Line_Rec.unit_selling_price(Entity_info_tbl(i).line_index);
828 
829         IF OE_Bulk_Order_PVT.G_Line_Rec.global_attribute_category(Entity_info_tbl(i).line_index)
830        IN ('JL.AR.OEXOEORD.LINES', 'JL.BR.OEXOEORD.LINES', 'JL.CO.OEXOEORD.LINES') THEN
831           zx_global_structures_pkg.trx_line_dist_tbl.TRX_BUSINESS_CATEGORY(i)        := OE_Bulk_Order_PVT.G_Line_Rec.global_attribute6(Entity_info_tbl(i).line_index);
832           zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_FISC_CLASSIFICATION(i)  := OE_Bulk_Order_PVT.G_Line_Rec.global_attribute5(Entity_info_tbl(i).line_index);
833         ELSE
834           zx_global_structures_pkg.trx_line_dist_tbl.TRX_BUSINESS_CATEGORY(i)      := NULL;
835           zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_FISC_CLASSIFICATION(i):= NULL;
836         END IF;
837          zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_LINE_ID(i)                 := OE_Bulk_Order_PVT.G_Line_Rec.Line_Id(Entity_info_tbl(i).line_index);
838       elsif l_level = 'LC' THEN
839        oe_debug_pub.add( 'Loading Line charge details in ZX global package');
840 
841         BEGIN
842           l_person_id     := OE_BULK_CACHE.G_SALESREP_TBL(l_salesrep_cache_key).person_id;
843           IF l_debug_level > 0 THEN
844             oe_debug_pub.add( 'Before Calling load_person: ' || l_person_id);
845           END IF;
846           l_asgn_org_id := OE_BULK_CACHE.Load_Person(l_person_id, OE_Bulk_Order_PVT.G_LINE_REC.tax_date(Entity_info_tbl(i).line_index));
847         EXCEPTION
848         WHEN OTHERS THEN
849           l_load_person_failed := true;
850           IF l_debug_level      > 0 THEN
851             oe_debug_pub.add( 'Load Person Failed. ' || SQLERRM);
852           END IF;
853         END;
854         IF l_load_person_failed THEN
855           l_asgn_org_id     := NULL;
856           l_poo_location_id := NULL;
857         ELSE
858           l_asgn_org_id     := OE_BULK_CACHE.G_PERSON_TBL(l_person_id).ORGANIZATION_ID; -- the cache key is l_person_id only
859           l_poo_location_id := OE_BULK_CACHE.G_PERSON_TBL(l_person_id).LOCATION_ID;
860         END IF;
861         IF OE_Bulk_Order_PVT.G_LINE_REC.invoice_to_org_id(Entity_info_tbl(i).line_index) IS NOT NULL THEN
862           IF l_debug_level                                                                > 0 THEN
863             oe_debug_pub.add( 'retrieving bill_to info');
864             oe_debug_pub.add( '2Line index:'||Entity_info_tbl(i).line_index);
865             oe_debug_pub.add( '2Line index invoice to org:'||OE_Bulk_Order_PVT.G_LINE_REC.invoice_to_org_id(Entity_info_tbl(i).line_index));
866           END IF;
867           l_invoice_to_cache_key      := OE_Bulk_Cache.load_loc_info(OE_Bulk_Order_PVT.G_LINE_REC.invoice_to_org_id(Entity_info_tbl(i).line_index));
868            oe_debug_pub.add( '2After invoice line chache :'||l_invoice_to_cache_key);
869           l_bill_to_cust_id           := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).CUST_ACCOUNT_ID;
870           l_bill_to_postal_code       := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).POSTAL_CODE;
871           l_bill_location_id          := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).LOC_ID;
872           l_bill_to_state             := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).STATE;
873           l_bill_to_cust_acct_site_id := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).CUST_ACCT_SITE_ID;
874           l_bill_to_cust_account_id   := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).CUST_ACCOUNT_ID;
875           l_bill_to_account_number    := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).ACCOUNT_NUMBER;
876           l_bill_party_id             := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).PARTY_ID;
877           l_bill_to_party_name        := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).PARTY_NAME;
878           l_bill_party_site_id        := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).PARTY_SITE_ID;
879           l_bill_su_tax_hdr_flag      := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).TAX_HEADER_LEVEL_FLAG;
880           l_bill_acct_tax_hdr_flag    := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).ACCT_TAX_HEADER_LEVEL_FLAG;
881           l_bill_to_su_tax_rnd_rule   := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).TAX_ROUNDING_RULE;
882           l_bill_to_acct_tax_rnd_rule := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).ACCT_TAX_ROUNDING_RULE;
883            oe_debug_pub.add( '2 before end if');
884         END IF; --end of if invoice_to_org_id IS NOT NULL
885         l_commitment_id    := NVL(OE_Bulk_Order_PVT.G_LINE_REC.commitment_id(Entity_info_tbl(i).line_index),0);
886         IF l_commitment_id <> 0 THEN
887           IF l_debug_level  > 0 THEN
888             oe_debug_pub.add('Commitment id is:'||l_commitment_id,4);
889           END IF;
890           BEGIN
891             SELECT
892               /* MOAC_SQL_CHANGE */
893               NVL(cust_type.subsequent_trx_type_id, cust_type.cust_trx_type_id)
894             INTO l_cust_trx_type_id
895             FROM ra_cust_trx_types_all cust_type,
896               ra_customer_trx cust_trx
897             WHERE cust_type.cust_trx_type_id = cust_trx.cust_trx_type_id
898             AND cust_type.org_id             = cust_trx.org_id
899             AND cust_trx.customer_trx_id     = l_commitment_id;
900           EXCEPTION
901           WHEN OTHERS THEN
902             IF l_debug_level > 0 THEN
903               oe_debug_pub.add('In commitment exception ',4);
904             END IF;
905             NULL;
906           END;
907           IF l_debug_level > 0 THEN
908             oe_debug_pub.add('cust trx type from commitment:'||l_cust_Trx_type_id,4);
909           END IF;
910         ELSE
911           IF l_debug_level > 0 THEN
912             oe_debug_pub.add('In else part of commitment id',4);
913           END IF;
914           /*l_cust_trx_type_id :=
915           OE_INVOICE_PUB.Get_Customer_Transaction_Type(OE_Bulk_Order_PVT.G_LINE_REC(l_index)); */
916         END IF;
917         --code changes made for bug 1883552  end
918         IF l_debug_level > 0 THEN
919           oe_debug_pub.add('Customer trx type id is:'||l_cust_trx_type_id,4);
920         END IF;
921         l_header_org_id    := OE_Bulk_Order_PVT.G_HEADER_REC.org_id(Entity_info_tbl(i).header_index);
922         l_currency_code    := OE_Bulk_Order_PVT.G_HEADER_REC.transactional_curr_code(Entity_info_tbl(i).header_index);
923         l_conversion_rate  := OE_Bulk_Order_PVT.G_HEADER_REC.conversion_rate(Entity_info_tbl(i).header_index);
924         l_inventory_org_id := oe_sys_parameters.value('MASTER_ORGANIZATION_ID',OE_Bulk_Order_PVT.G_HEADER_REC.org_id(Entity_info_tbl(i).header_index));
925         SELECT c.minimum_accountable_unit,
926           c.precision
927         INTO l_minimum_accountable_unit,
928           l_precision
929         FROM fnd_currencies c
930         WHERE c.currency_code = l_currency_code;
931         OPEN get_internal_loc(OE_Bulk_Order_PVT.G_HEADER_REC.org_id(Entity_info_tbl(i).header_index));
932         FETCH get_internal_loc INTO l_internal_org_location_id;
933         CLOSE get_internal_loc;
934         l_legal_entity_id     := get_le_id(p_order_type_id => OE_Bulk_Order_PVT.G_HEADER_REC.order_type_id(Entity_info_tbl(i).header_index) ,
935  p_sold_to_customer_id => OE_Bulk_Order_PVT.G_HEADER_REC.sold_to_org_id(Entity_info_tbl(i).header_index) ,
936  p_bill_to_customer_id => l_bill_to_cust_id ,
937  p_org_id => OE_Bulk_Order_PVT.G_HEADER_REC.org_id(Entity_info_tbl(i).header_index) );
938         IF OE_Bulk_Order_PVT.G_LINE_REC.ship_from_org_id(Entity_info_tbl(i).line_index) IS NOT NULL THEN
939           BEGIN
940             SELECT location_id
941             INTO l_ship_from_location_id
942             FROM hr_all_organization_units hu
943             WHERE hu.organization_id = OE_Bulk_Order_PVT.G_LINE_REC.ship_from_org_id(Entity_info_tbl(i).line_index);
944           EXCEPTION
945           WHEN OTHERS THEN
946             NULL;
947           END;
948         END IF;
949         IF OE_Bulk_Order_PVT.G_LINE_REC.ship_to_org_id(Entity_info_tbl(i).line_index) IS NOT NULL THEN
950           IF l_debug_level                                                             > 0 THEN
951             oe_debug_pub.add( 'retrieving ship_to info');
952              END IF;
953           l_ship_to_cache_key         := OE_Bulk_Cache.load_loc_info(OE_Bulk_Order_PVT.G_LINE_REC.ship_to_org_id(Entity_info_tbl(i).line_index));
954 
955           l_ship_to_cust_id           := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).CUST_ACCOUNT_ID;
956           l_ship_to_postal_code       := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).POSTAL_CODE;
957           l_ship_location_id          := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).LOC_ID;
958           l_ship_to_state             := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).STATE;
959           l_ship_to_cust_acct_site_id := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).CUST_ACCT_SITE_ID;
960           l_ship_to_cust_account_id   := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).CUST_ACCOUNT_ID;
961           l_ship_to_account_number    := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).ACCOUNT_NUMBER;
962           l_ship_party_id             := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).PARTY_ID;
963           l_ship_to_party_name        := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).PARTY_NAME;
964           l_ship_party_site_id        := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).PARTY_SITE_ID;
965           l_ship_su_tax_hdr_flag      := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).TAX_HEADER_LEVEL_FLAG;
966           l_ship_acct_tax_hdr_flag    := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).ACCT_TAX_HEADER_LEVEL_FLAG;
967           l_ship_to_su_tax_rnd_rule   := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).TAX_ROUNDING_RULE;
968           l_ship_to_acct_tax_rnd_rule := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).ACCT_TAX_ROUNDING_RULE;
969 
970 
971 
972 
973 
974         END IF; -- end of if ship_to_org_id IS NOT NULL
975         zx_global_structures_pkg.trx_line_dist_tbl.TRX_LEVEL_TYPE(i)                 := 'FREIGHT CHARGE';
976         zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_ORG_ID(i)                 := NVL(OE_Bulk_Order_PVT.G_Line_Rec.ship_from_org_id(Entity_info_tbl(i).line_index),l_inventory_org_id);
977         zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_QUANTITY(i)              := OE_Bulk_Order_PVT.G_Line_Rec.ordered_quantity (Entity_info_tbl(i).line_index);
978         zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_DESCRIPTION(i)           := OE_Bulk_Order_PVT.G_Line_Rec.user_item_description (Entity_info_tbl(i).line_index);
979         zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_DESCRIPTION(i)            := OE_Bulk_Order_PVT.G_Line_Rec.user_item_description (Entity_info_tbl(i).line_index);
980         zx_global_structures_pkg.trx_line_dist_tbl.FOB_POINT(i)                      := OE_Bulk_Order_PVT.G_Line_Rec.fob_point_code(Entity_info_tbl(i).line_index);
981         zx_global_structures_pkg.trx_line_dist_tbl.TRX_ID(i)                         := OE_Bulk_Order_PVT.G_Line_Rec.header_id(Entity_info_tbl(i).line_index);
982         zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_ID(i)                     := OE_Bulk_Order_PVT.G_Line_Rec.inventory_item_id(Entity_info_tbl(i).line_index);
983         zx_global_structures_pkg.trx_line_dist_tbl.BILL_TO_CUST_ACCT_SITE_USE_ID(i)  := OE_Bulk_Order_PVT.G_LINE_REC.invoice_to_org_id(Entity_info_tbl(i).line_index);
984         zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_ID(i)                    := Entity_info_tbl(i).trx_line_id ;
985         zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_NUMBER(i)                := OE_Bulk_Order_PVT.G_Line_Rec.Line_Id(Entity_info_tbl(i).line_index);
986         zx_global_structures_pkg.trx_line_dist_tbl.SHIP_FROM_PARTY_ID(i)             := OE_Bulk_Order_PVT.G_Line_Rec.ship_from_org_id(Entity_info_tbl(i).line_index);
987         zx_global_structures_pkg.trx_line_dist_tbl.SHIP_TO_CUST_ACCT_SITE_USE_ID(i)  := OE_Bulk_Order_PVT.G_LINE_REC.ship_to_org_id(Entity_info_tbl(i).line_index);
988         zx_global_structures_pkg.trx_line_dist_tbl.OUTPUT_TAX_CLASSIFICATION_CODE(i) := OE_Bulk_Order_PVT.G_Line_Rec.tax_code(Entity_info_tbl(i).line_index);
989         zx_global_structures_pkg.trx_line_dist_tbl.TRX_DATE(i)                       := OE_Bulk_Order_PVT.G_Line_Rec.TAX_DATE(Entity_info_tbl(i).line_index);
990         zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_DATE(i)                  := OE_Bulk_Order_PVT.G_Line_Rec.tax_date(Entity_info_tbl(i).line_index);
991         zx_global_structures_pkg.trx_line_dist_tbl.EXEMPTION_CONTROL_FLAG(i)         := OE_Bulk_Order_PVT.G_Line_Rec.TAX_EXEMPT_FLAG(Entity_info_tbl(i).line_index);
992         zx_global_structures_pkg.trx_line_dist_tbl.EXEMPT_CERTIFICATE_NUMBER(i)      := OE_Bulk_Order_PVT.G_Line_Rec.tax_exempt_number(Entity_info_tbl(i).line_index);
993         zx_global_structures_pkg.trx_line_dist_tbl.EXEMPT_REASON_CODE(i)             := OE_Bulk_Order_PVT.G_Line_Rec.TAX_EXEMPT_REASON_CODE(Entity_info_tbl(i).line_index);
994         zx_global_structures_pkg.trx_line_dist_tbl.EXEMPT_REASON(i)                  := OE_Bulk_Order_PVT.G_Line_Rec.TAX_EXEMPT_REASON_CODE(Entity_info_tbl(i).line_index);
995         zx_global_structures_pkg.trx_line_dist_tbl.UNIT_PRICE(i)                     := OE_Bulk_Order_PVT.G_Line_Rec.unit_selling_price(Entity_info_tbl(i).line_index);
996         zx_global_structures_pkg.trx_line_dist_tbl.UOM_CODE(i)
997                   := NVL( OE_Bulk_Order_PVT.G_Line_Rec.order_quantity_uom (Entity_info_tbl(i).line_index),
998                           OE_Bulk_Order_PVT.G_Line_Rec.pricing_quantity_uom(Entity_info_tbl(i).line_index));
999         zx_global_structures_pkg.trx_line_dist_tbl.LINE_AMT(i)                       := Entity_info_tbl(i).charge_amt ;
1000         IF OE_Bulk_Order_PVT.G_Line_Rec.global_attribute_category(Entity_info_tbl(i).line_index)
1001 
1002                           IN ('JL.AR.OEXOEORD.LINES', 'JL.BR.OEXOEORD.LINES', 'JL.CO.OEXOEORD.LINES') THEN
1003           zx_global_structures_pkg.trx_line_dist_tbl.TRX_BUSINESS_CATEGORY(i)        := OE_Bulk_Order_PVT.G_Line_Rec.global_attribute6(Entity_info_tbl(i).line_index);
1004           zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_FISC_CLASSIFICATION(i)  := OE_Bulk_Order_PVT.G_Line_Rec.global_attribute5(Entity_info_tbl(i).line_index);
1005         ELSE
1006           zx_global_structures_pkg.trx_line_dist_tbl.TRX_BUSINESS_CATEGORY(i)      := NULL;
1007           zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_FISC_CLASSIFICATION(i):= NULL;
1008         END IF;
1009          zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_LINE_ID(i)                 := OE_Bulk_Order_PVT.G_Line_Rec.Line_Id(Entity_info_tbl(i).line_index);
1010       elsif l_level = 'HC' THEN
1011 
1012           oe_debug_pub.add( 'Loading Header LEVEL charge details');
1013 
1014         BEGIN
1015           l_person_id     := OE_BULK_CACHE.G_SALESREP_TBL(l_salesrep_cache_key).person_id;
1016           IF l_debug_level > 0 THEN
1017             oe_debug_pub.add( 'Before Calling load_person: ' || l_person_id);
1018             oe_debug_pub.add( ' l_index :'|| l_index);
1019             oe_debug_pub.add( ' Tax Date :'|| OE_Bulk_Order_PVT.G_LINE_REC.tax_date(i));
1020           END IF;
1021           l_asgn_org_id := OE_BULK_CACHE.Load_Person(l_person_id, sysdate);
1022         EXCEPTION
1023         WHEN OTHERS THEN
1024           l_load_person_failed := true;
1025           IF l_debug_level      > 0 THEN
1026             oe_debug_pub.add( 'Load Person Failed. ' || SQLERRM);
1027           END IF;
1028         END;
1029         IF l_load_person_failed THEN
1030           l_asgn_org_id     := NULL;
1031           l_poo_location_id := NULL;
1032         ELSE
1033           l_asgn_org_id     := OE_BULK_CACHE.G_PERSON_TBL(l_person_id).ORGANIZATION_ID; -- the cache key is l_person_id only
1034           l_poo_location_id := OE_BULK_CACHE.G_PERSON_TBL(l_person_id).LOCATION_ID;
1035         END IF;
1036         IF OE_Bulk_Order_PVT.G_HEADER_REC.invoice_to_org_id(Entity_info_tbl(i).header_index) IS NOT NULL THEN
1037           IF l_debug_level                                                                    > 0 THEN
1038             oe_debug_pub.add( 'retrieving bill_to info');
1039             oe_debug_pub.add( '3header index:'||Entity_info_tbl(i).header_index);
1040             oe_debug_pub.add( '3header index invoice to org:'||OE_Bulk_Order_PVT.G_header_REC.invoice_to_org_id(Entity_info_tbl(i).header_index));
1041           END IF;
1042           l_invoice_to_cache_key      := OE_Bulk_Cache.load_loc_info(OE_Bulk_Order_PVT.G_header_REC.invoice_to_org_id(Entity_info_tbl(i).header_index));
1043             oe_debug_pub.add( 'l_invoice_to_cache_key:' ||l_invoice_to_cache_key );
1044           l_bill_to_cust_id           := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).CUST_ACCOUNT_ID;
1045           l_bill_to_postal_code       := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).POSTAL_CODE;
1046           l_bill_location_id          := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).LOC_ID;
1047           l_bill_to_state             := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).STATE;
1048           l_bill_to_cust_acct_site_id := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).CUST_ACCT_SITE_ID;
1049           l_bill_to_cust_account_id   := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).CUST_ACCOUNT_ID;
1050           l_bill_to_account_number    := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).ACCOUNT_NUMBER;
1051           l_bill_party_id             := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).PARTY_ID;
1052           l_bill_to_party_name        := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).PARTY_NAME;
1053           l_bill_party_site_id        := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).PARTY_SITE_ID;
1054           l_bill_su_tax_hdr_flag      := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).TAX_HEADER_LEVEL_FLAG;
1055           l_bill_acct_tax_hdr_flag    := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).ACCT_TAX_HEADER_LEVEL_FLAG;
1056           l_bill_to_su_tax_rnd_rule   := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).TAX_ROUNDING_RULE;
1057           l_bill_to_acct_tax_rnd_rule := OE_BULK_CACHE.G_LOC_INFO_TBL(l_invoice_to_cache_key).ACCT_TAX_ROUNDING_RULE;
1058          oe_debug_pub.ADD('Before End if');
1059         END IF; --end of if invoice_to_org_id IS NOT NULL
1060         BEGIN
1061           SELECT NVL (ot.cust_trx_type_id, 0)
1062           INTO l_cust_trx_type_id
1063           FROM oe_order_types_v ot,
1064             oe_order_headers_all oh
1065           WHERE ot.order_type_id = oh.order_type_id
1066           AND oh.header_id       = OE_Bulk_Order_PVT.G_header_REC.header_id(Entity_info_tbl(i).header_index);
1067         EXCEPTION
1068         WHEN OTHERS THEN
1069           IF l_debug_level > 0 THEN
1070             oe_debug_pub.add('In header exception ',4);
1071           END IF;
1072           NULL;
1073         END;
1074         l_header_org_id    := OE_Bulk_Order_PVT.G_HEADER_REC.org_id(Entity_info_tbl(i).header_index);
1075         l_currency_code    := OE_Bulk_Order_PVT.G_HEADER_REC.transactional_curr_code(Entity_info_tbl(i).header_index);
1076         l_conversion_rate  := OE_Bulk_Order_PVT.G_HEADER_REC.conversion_rate(Entity_info_tbl(i).header_index);
1077         l_inventory_org_id := oe_sys_parameters.value('MASTER_ORGANIZATION_ID',OE_Bulk_Order_PVT.G_HEADER_REC.org_id(Entity_info_tbl(i).header_index));
1078         SELECT c.minimum_accountable_unit,
1079           c.precision
1080         INTO l_minimum_accountable_unit,
1081           l_precision
1082         FROM fnd_currencies c
1083         WHERE c.currency_code = l_currency_code;
1084         OPEN get_internal_loc(OE_Bulk_Order_PVT.G_HEADER_REC.org_id(Entity_info_tbl(i).header_index));
1085         FETCH get_internal_loc INTO l_internal_org_location_id;
1086         CLOSE get_internal_loc;
1087         l_legal_entity_id := get_le_id(p_order_type_id => OE_Bulk_Order_PVT.G_HEADER_REC.order_type_id(Entity_info_tbl(i).header_index) ,
1088 p_sold_to_customer_id => OE_Bulk_Order_PVT.G_HEADER_REC.sold_to_org_id(Entity_info_tbl(i).header_index) ,
1089  p_bill_to_customer_id => l_bill_to_cust_id ,
1090 p_org_id => OE_Bulk_Order_PVT.G_HEADER_REC.org_id(Entity_info_tbl(i).header_index) );
1091         IF OE_Bulk_Order_PVT.G_Header_REC.ship_from_org_id(Entity_info_tbl(i).header_index) IS NOT NULL THEN
1092           BEGIN
1093             SELECT location_id
1094             INTO l_ship_from_location_id
1095             FROM hr_all_organization_units hu
1096             WHERE hu.organization_id = OE_Bulk_Order_PVT.G_Header_REC.ship_from_org_id(Entity_info_tbl(i).header_index);
1097           EXCEPTION
1098           WHEN OTHERS THEN
1099             NULL;
1100           END;
1101         END IF;
1102         IF OE_Bulk_Order_PVT.G_HEADER_REC.ship_to_org_id(Entity_info_tbl(i).header_index) IS NOT NULL THEN
1103           IF l_debug_level                                                                 > 0 THEN
1104             oe_debug_pub.add( 'retrieving ship_to info for Header record');
1105              oe_debug_pub.add( 'retrieving ship_to info');
1106             oe_debug_pub.add( ' Ship to Header:'||Entity_info_tbl(i).header_index);
1107             oe_debug_pub.add( ' ship to Line index invoice to org:'||OE_Bulk_Order_PVT.G_HEADER_REC.ship_to_org_id(Entity_info_tbl(i).header_index));
1108 
1109           END IF;
1110           l_ship_to_cache_key         := OE_Bulk_Cache.load_loc_info(OE_Bulk_Order_PVT.G_HEADER_REC.ship_to_org_id(Entity_info_tbl(i).header_index));
1111           oe_debug_pub.add(' l_ship_to_cache_key:'||l_ship_to_cache_key);
1112           l_ship_to_cust_id           := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).CUST_ACCOUNT_ID;
1113           l_ship_to_postal_code       := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).POSTAL_CODE;
1114           l_ship_location_id          := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).LOC_ID;
1115           l_ship_to_state             := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).STATE;
1116           l_ship_to_cust_acct_site_id := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).CUST_ACCT_SITE_ID;
1117           l_ship_to_cust_account_id   := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).CUST_ACCOUNT_ID;
1118           l_ship_to_account_number    := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).ACCOUNT_NUMBER;
1119           l_ship_party_id             := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).PARTY_ID;
1120           l_ship_to_party_name        := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).PARTY_NAME;
1121           l_ship_party_site_id        := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).PARTY_SITE_ID;
1122           l_ship_su_tax_hdr_flag      := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).TAX_HEADER_LEVEL_FLAG;
1123           l_ship_acct_tax_hdr_flag    := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).ACCT_TAX_HEADER_LEVEL_FLAG;
1124           l_ship_to_su_tax_rnd_rule   := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).TAX_ROUNDING_RULE;
1125           l_ship_to_acct_tax_rnd_rule := OE_BULK_CACHE.G_LOC_INFO_TBL(l_ship_to_cache_key).ACCT_TAX_ROUNDING_RULE;
1126         END IF; -- end of if ship_to_org_id IS NOT NULL
1127         zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_ORG_ID(i)                 := NULL;
1128         zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_QUANTITY(i)              := NULL;
1129         zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_DESCRIPTION(i)           := NULL;
1130         zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_DESCRIPTION(i)            := NULL;
1131         zx_global_structures_pkg.trx_line_dist_tbl.FOB_POINT(i)                      := NULL;
1132         zx_global_structures_pkg.trx_line_dist_tbl.TRX_ID(i)                         := Entity_info_tbl(i).TRX_ID ;
1133         zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_ID(i)                     := NULL ;
1134         zx_global_structures_pkg.trx_line_dist_tbl.BILL_TO_CUST_ACCT_SITE_USE_ID(i)  := OE_Bulk_Order_PVT.G_Header_REC.invoice_to_org_id(Entity_info_tbl(i).header_index);
1135         zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_ID(i)                    := Entity_info_tbl(i).trx_line_id ;
1136         zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_NUMBER(i)                := NULL;
1137         zx_global_structures_pkg.trx_line_dist_tbl.SHIP_FROM_PARTY_ID(i)             := OE_Bulk_Order_PVT.G_HEADER_Rec.ship_from_org_id(Entity_info_tbl(i).header_index);
1138         zx_global_structures_pkg.trx_line_dist_tbl.SHIP_TO_CUST_ACCT_SITE_USE_ID(i)  := OE_Bulk_Order_PVT.G_Header_REC.ship_to_org_id(Entity_info_tbl(i).header_index);
1139         zx_global_structures_pkg.trx_line_dist_tbl.OUTPUT_TAX_CLASSIFICATION_CODE(i) := NULL;
1140         zx_global_structures_pkg.trx_line_dist_tbl.TRX_DATE(i)                       := sysdate;
1141         zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_DATE(i)                  := sysdate;
1142         zx_global_structures_pkg.trx_line_dist_tbl.EXEMPTION_CONTROL_FLAG(i)         := OE_Bulk_Order_PVT.G_Header_Rec.TAX_EXEMPT_FLAG(Entity_info_tbl(i).header_index);
1143         zx_global_structures_pkg.trx_line_dist_tbl.EXEMPT_CERTIFICATE_NUMBER(i)      := OE_Bulk_Order_PVT.G_header_Rec.tax_exempt_number(Entity_info_tbl(i).header_index);
1144         zx_global_structures_pkg.trx_line_dist_tbl.EXEMPT_REASON_CODE(i)             := OE_Bulk_Order_PVT.G_Header_Rec.TAX_EXEMPT_REASON_CODE(Entity_info_tbl(i).Header_index);
1145         zx_global_structures_pkg.trx_line_dist_tbl.EXEMPT_REASON(i)                  := OE_Bulk_Order_PVT.G_Header_Rec.TAX_EXEMPT_REASON_CODE(Entity_info_tbl(i).header_index);
1146         zx_global_structures_pkg.trx_line_dist_tbl.UNIT_PRICE(i)                     := NULL ;
1147         zx_global_structures_pkg.trx_line_dist_tbl.UOM_CODE(i)                       := NULL ;
1148         zx_global_structures_pkg.trx_line_dist_tbl.LINE_AMT(i)                       := Entity_info_tbl(i).charge_amt ;
1149         zx_global_structures_pkg.trx_line_dist_tbl.TRX_BUSINESS_CATEGORY(i)          := NULL;
1150         zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_FISC_CLASSIFICATION(i)    := NULL;
1151         zx_global_structures_pkg.trx_line_dist_tbl.TRX_LEVEL_TYPE(i)                 := 'FREIGHT CHARGE';
1152          zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_LINE_ID(i)                 := NULL;
1153       END IF;
1154       zx_global_structures_pkg.trx_line_dist_tbl.LEDGER_ID(i)                      := l_AR_Sys_Param_Rec.set_of_books_id;
1155       zx_global_structures_pkg.trx_line_dist_tbl.POO_PARTY_ID(i)                   :=l_asgn_org_id;
1156       zx_global_structures_pkg.trx_line_dist_tbl.BILL_FROM_LOCATION_ID(i)          :=l_bill_from_location_id;
1157       zx_global_structures_pkg.trx_line_dist_tbl.BILL_TO_LOCATION_ID(i)            :=l_bill_location_id;
1158       zx_global_structures_pkg.trx_line_dist_tbl.BILL_TO_PARTY_ID(i)               := l_bill_party_id;
1159       zx_global_structures_pkg.trx_line_dist_tbl.BILL_TO_PARTY_SITE_ID(i)          := l_bill_party_site_id;
1160       zx_global_structures_pkg.trx_line_dist_tbl.BILL_THIRD_PTY_ACCT_ID(i)         := l_bill_to_cust_account_id;
1161       zx_global_structures_pkg.trx_line_dist_tbl.BILL_THIRD_PTY_ACCT_SITE_ID(i)    := l_bill_to_cust_acct_site_id;
1162       zx_global_structures_pkg.trx_line_dist_tbl.RECEIVABLES_TRX_TYPE_ID(i)        := l_cust_trx_type_id;
1163       zx_global_structures_pkg.trx_line_dist_tbl.POA_PARTY_ID(i)                   := l_header_org_id;
1164       zx_global_structures_pkg.trx_line_dist_tbl.POA_LOCATION_ID(i)                := l_internal_org_location_id;
1165       zx_global_structures_pkg.trx_line_dist_tbl.internal_org_location_id(i)       := l_internal_org_location_id;
1166       zx_global_structures_pkg.trx_line_dist_tbl.LEGAL_ENTITY_ID(i)                := l_legal_entity_id;
1167       zx_global_structures_pkg.trx_line_dist_tbl.POO_LOCATION_ID(i)                := l_poo_location_id ;
1168       zx_global_structures_pkg.trx_line_dist_tbl.PRECISION(i)                      := l_precision;
1169       zx_global_structures_pkg.trx_line_dist_tbl.SHIP_FROM_LOCATION_ID(i)          := l_ship_from_location_id;
1170       zx_global_structures_pkg.trx_line_dist_tbl.SHIP_TO_LOCATION_ID(i)            := l_ship_location_id;
1171       zx_global_structures_pkg.trx_line_dist_tbl.SHIP_TO_PARTY_ID(i)               := l_ship_party_id;
1172       zx_global_structures_pkg.trx_line_dist_tbl.SHIP_TO_PARTY_SITE_ID(i)          := l_ship_party_site_id;
1173       zx_global_structures_pkg.trx_line_dist_tbl.SHIP_THIRD_PTY_ACCT_ID(i)         := l_ship_to_cust_account_id;
1174       zx_global_structures_pkg.trx_line_dist_tbl.SHIP_THIRD_PTY_ACCT_SITE_ID(i)    := l_ship_to_cust_acct_site_id;
1175       zx_global_structures_pkg.trx_line_dist_tbl.CURRENCY_CONVERSION_RATE(i)       := OE_Bulk_Order_PVT.G_Header_Rec.conversion_rate(Entity_info_tbl(i).header_index);
1176       zx_global_structures_pkg.trx_line_dist_tbl.CURRENCY_CONVERSION_DATE(i)       := OE_Bulk_Order_PVT.G_Header_Rec.conversion_rate_Date(Entity_info_tbl(i).header_index);
1177       zx_global_structures_pkg.trx_line_dist_tbl.CURRENCY_CONVERSION_TYPE(i)       := OE_Bulk_Order_PVT.G_Header_Rec.CONVERSION_TYPE_CODE(Entity_info_tbl(i).header_index);
1178       zx_global_structures_pkg.trx_line_dist_tbl.TRX_NUMBER(i)                     := OE_Bulk_Order_PVT.G_Header_Rec.order_number(Entity_info_tbl(i).header_index);
1179       zx_global_structures_pkg.trx_line_dist_tbl.INTERNAL_ORGANIZATION_ID(i)       := OE_Bulk_Order_PVT.G_Header_Rec.org_id(Entity_info_tbl(i).header_index);
1180       zx_global_structures_pkg.trx_line_dist_tbl.TRX_CURRENCY_CODE(i)              := OE_Bulk_Order_PVT.G_Header_Rec.transactional_curr_code(Entity_info_tbl(i).header_index);
1181       zx_global_structures_pkg.trx_line_dist_tbl.TRX_RECEIPT_DATE(i)               := NULL ;
1182       zx_global_structures_pkg.trx_line_dist_tbl.TRANSFER_CHARGE(i)                := NULL ;
1183       zx_global_structures_pkg.trx_line_dist_tbl.TRX_SIC_CODE(i)                   := NULL ;
1184       zx_global_structures_pkg.trx_line_dist_tbl.POA_PARTY_SITE_ID(i)              := NULL ;
1185       zx_global_structures_pkg.trx_line_dist_tbl.POO_PARTY_SITE_ID(i)              := NULL ;
1186       zx_global_structures_pkg.trx_line_dist_tbl.ASSESSABLE_VALUE(i)               := NULL ;
1187       zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_TRX_ID(i)            := NULL ;
1188       zx_global_structures_pkg.trx_line_dist_tbl.LINE_INTENDED_USE(i)              := NULL;
1189       zx_global_structures_pkg.trx_line_dist_tbl.USER_DEFINED_FISC_CLASS(i)        := NULL;
1190       zx_global_structures_pkg.trx_line_dist_tbl.CASH_DISCOUNT(i)                  := NULL;
1191       zx_global_structures_pkg.trx_line_dist_tbl.VOLUME_DISCOUNT(i)                := NULL;
1192       zx_global_structures_pkg.trx_line_dist_tbl.TRADING_DISCOUNT(i)               := NULL;
1193       zx_global_structures_pkg.trx_line_dist_tbl.TRANSPORTATION_CHARGE(i)          := NULL;
1194       zx_global_structures_pkg.trx_line_dist_tbl.INSURANCE_CHARGE(i)               := NULL;
1195       zx_global_structures_pkg.trx_line_dist_tbl.OTHER_CHARGE(i)                   := NULL;
1196       zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_TYPE(i)                   := NULL;
1197       zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_CODE(i)                   := NULL;
1198       zx_global_structures_pkg.trx_line_dist_tbl.PRODUCT_CATEGORY(i)               := NULL;
1199       zx_global_structures_pkg.trx_line_dist_tbl.BILL_FROM_PARTY_ID(i)             := NULL;
1200       zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_ID(i)              := NULL;
1201       zx_global_structures_pkg.trx_line_dist_tbl.SHIP_FROM_PARTY_SITE_ID(i)        := NULL;
1202       zx_global_structures_pkg.trx_line_dist_tbl.BILL_FROM_PARTY_SITE_ID(i)        := NULL;
1203       zx_global_structures_pkg.trx_line_dist_tbl.ACCOUNT_CCID(i)                   := NULL;
1204       zx_global_structures_pkg.trx_line_dist_tbl.ACCOUNT_STRING(i)                 := NULL;
1205       zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_COUNTRY(i)         := NULL;
1206       zx_global_structures_pkg.trx_line_dist_tbl.ASSET_FLAG(i)                     := NULL;
1207       zx_global_structures_pkg.trx_line_dist_tbl.ASSET_NUMBER(i)                   := NULL;
1208       zx_global_structures_pkg.trx_line_dist_tbl.ASSET_ACCUM_DEPRECIATION(i)       := NULL;
1209       zx_global_structures_pkg.trx_line_dist_tbl.ASSET_TYPE(i)                     := NULL;
1210       zx_global_structures_pkg.trx_line_dist_tbl.ASSET_COST(i)                     := NULL;
1211       zx_global_structures_pkg.trx_line_dist_tbl.TRX_ID_LEVEL2(i)                  := NULL;
1212       zx_global_structures_pkg.trx_line_dist_tbl.TRX_ID_LEVEL3(i)                  := NULL;
1213       zx_global_structures_pkg.trx_line_dist_tbl.TRX_ID_LEVEL4(i)                  := NULL;
1214       zx_global_structures_pkg.trx_line_dist_tbl.TRX_ID_LEVEL5(i)                  := NULL;
1215       zx_global_structures_pkg.trx_line_dist_tbl.TRX_ID_LEVEL6(i)                  := NULL;
1216       zx_global_structures_pkg.trx_line_dist_tbl.HDR_TRX_USER_KEY1(i)              := NULL;
1217       zx_global_structures_pkg.trx_line_dist_tbl.HDR_TRX_USER_KEY2(i)              := NULL;
1218       zx_global_structures_pkg.trx_line_dist_tbl.HDR_TRX_USER_KEY3(i)              := NULL;
1219       zx_global_structures_pkg.trx_line_dist_tbl.HDR_TRX_USER_KEY4(i)              := NULL;
1220       zx_global_structures_pkg.trx_line_dist_tbl.HDR_TRX_USER_KEY5(i)              := NULL;
1221       zx_global_structures_pkg.trx_line_dist_tbl.HDR_TRX_USER_KEY6(i)              := NULL;
1222       zx_global_structures_pkg.trx_line_dist_tbl.LINE_TRX_USER_KEY1(i)             := NULL;
1223       zx_global_structures_pkg.trx_line_dist_tbl.LINE_TRX_USER_KEY2(i)             := NULL;
1224       zx_global_structures_pkg.trx_line_dist_tbl.LINE_TRX_USER_KEY3(i)             := NULL;
1225       zx_global_structures_pkg.trx_line_dist_tbl.LINE_TRX_USER_KEY4(i)             := NULL;
1226       zx_global_structures_pkg.trx_line_dist_tbl.LINE_TRX_USER_KEY5(i)             := NULL;
1227       zx_global_structures_pkg.trx_line_dist_tbl.LINE_TRX_USER_KEY6(i)             := NULL;
1228       zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_DIST_ID(i)               := NULL;
1229       zx_global_structures_pkg.trx_line_dist_tbl.DIST_TRX_USER_KEY1(i)             := NULL;
1230       zx_global_structures_pkg.trx_line_dist_tbl.DIST_TRX_USER_KEY2(i)             := NULL;
1231       zx_global_structures_pkg.trx_line_dist_tbl.DIST_TRX_USER_KEY3(i)             := NULL;
1232       zx_global_structures_pkg.trx_line_dist_tbl.DIST_TRX_USER_KEY4(i)             := NULL;
1233       zx_global_structures_pkg.trx_line_dist_tbl.DIST_TRX_USER_KEY5(i)             := NULL;
1234       zx_global_structures_pkg.trx_line_dist_tbl.DIST_TRX_USER_KEY6(i)             := NULL;
1235       zx_global_structures_pkg.trx_line_dist_tbl.TRX_WAYBILL_NUMBER(i)             := NULL;
1236       zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_GL_DATE(i)               := NULL;
1237       zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_NAME(i)            := NULL;
1238       zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_DOCUMENT_NUMBER(i) := NULL;
1239       zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_REFERENCE(i)       := NULL;
1240       zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_TAXPAYER_ID(i)     := NULL;
1241       zx_global_structures_pkg.trx_line_dist_tbl.MERCHANT_PARTY_TAX_REG_NUMBER(i)  := NULL;
1242       zx_global_structures_pkg.trx_line_dist_tbl.PAYING_PARTY_ID(i)                := NULL;
1243       zx_global_structures_pkg.trx_line_dist_tbl.OWN_HQ_PARTY_ID(i)                := NULL;
1244       zx_global_structures_pkg.trx_line_dist_tbl.TRADING_HQ_PARTY_ID(i)            := NULL;
1245       zx_global_structures_pkg.trx_line_dist_tbl.POI_PARTY_ID(i)                   := NULL;
1246       zx_global_structures_pkg.trx_line_dist_tbl.POD_PARTY_ID(i)                   := NULL;
1247       zx_global_structures_pkg.trx_line_dist_tbl.TITLE_TRANSFER_PARTY_ID(i)        := NULL;
1248       zx_global_structures_pkg.trx_line_dist_tbl.PAYING_PARTY_SITE_ID(i)           := NULL;
1249       zx_global_structures_pkg.trx_line_dist_tbl.OWN_HQ_PARTY_SITE_ID(i)           := NULL;
1250       zx_global_structures_pkg.trx_line_dist_tbl.TRADING_HQ_PARTY_SITE_ID(i)       := NULL;
1251       zx_global_structures_pkg.trx_line_dist_tbl.POI_PARTY_SITE_ID(i)              := NULL;
1252       zx_global_structures_pkg.trx_line_dist_tbl.POD_PARTY_SITE_ID(i)              := NULL;
1253       zx_global_structures_pkg.trx_line_dist_tbl.TITLE_TRANSFER_PARTY_SITE_ID(i)   := NULL;
1254       zx_global_structures_pkg.trx_line_dist_tbl.PAYING_LOCATION_ID(i)             := NULL;
1255       zx_global_structures_pkg.trx_line_dist_tbl.OWN_HQ_LOCATION_ID(i)             := NULL;
1256       zx_global_structures_pkg.trx_line_dist_tbl.TRADING_HQ_LOCATION_ID(i)         := NULL;
1257       zx_global_structures_pkg.trx_line_dist_tbl.POC_LOCATION_ID(i)                := NULL;
1258       zx_global_structures_pkg.trx_line_dist_tbl.POI_LOCATION_ID(i)                := NULL;
1259       zx_global_structures_pkg.trx_line_dist_tbl.POD_LOCATION_ID(i)                := NULL;
1260       zx_global_structures_pkg.trx_line_dist_tbl.TITLE_TRANSFER_LOCATION_ID(i)     := NULL;
1261       zx_global_structures_pkg.trx_line_dist_tbl.ROUNDING_SHIP_TO_PARTY_ID(i)      := NULL;
1262       zx_global_structures_pkg.trx_line_dist_tbl.ROUNDING_SHIP_FROM_PARTY_ID(i)    := NULL;
1263       zx_global_structures_pkg.trx_line_dist_tbl.ROUNDING_BILL_TO_PARTY_ID(i)      := NULL;
1264       zx_global_structures_pkg.trx_line_dist_tbl.ROUNDING_BILL_FROM_PARTY_ID(i)    := NULL;
1265       zx_global_structures_pkg.trx_line_dist_tbl.RNDG_SHIP_TO_PARTY_SITE_ID(i)     := NULL;
1266       zx_global_structures_pkg.trx_line_dist_tbl.RNDG_SHIP_FROM_PARTY_SITE_ID(i)   := NULL;
1267       zx_global_structures_pkg.trx_line_dist_tbl.RNDG_BILL_TO_PARTY_SITE_ID(i)     := NULL;
1268       zx_global_structures_pkg.trx_line_dist_tbl.RNDG_BILL_FROM_PARTY_SITE_ID(i)   := NULL;
1269       zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_APPLICATION_ID(i)         := NULL;
1270       zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_ENTITY_CODE(i)            := NULL;
1271       zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_EVENT_CLASS_CODE(i)       := NULL;
1272       zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_TRX_ID(i)                 := NULL;
1273       zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_HDR_TRX_USER_KEY1(i)      := NULL;
1274       zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_HDR_TRX_USER_KEY2(i)      := NULL;
1275       zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_HDR_TRX_USER_KEY3(i)      := NULL;
1276       zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_HDR_TRX_USER_KEY4(i)      := NULL;
1277       zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_HDR_TRX_USER_KEY5(i)      := NULL;
1278       zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_HDR_TRX_USER_KEY6(i)      := NULL;
1279       zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LINE_ID(i)                := NULL;
1280       zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LIN_TRX_USER_KEY1(i)      := NULL;
1281       zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LIN_TRX_USER_KEY2(i)      := NULL;
1282       zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LIN_TRX_USER_KEY3(i)      := NULL;
1283       zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LIN_TRX_USER_KEY4(i)      := NULL;
1284       zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LIN_TRX_USER_KEY5(i)      := NULL;
1285       zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LIN_TRX_USER_KEY6(i)      := NULL;
1286       zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_LINE_QUANTITY(i)          := NULL;
1287       zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_APPLICATION_ID(i)    := NULL;
1288       zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_ENTITY_CODE(i)       := NULL;
1289       zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_EVENT_CLASS_CODE(i)  := NULL;
1290       zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_TRX_ID(i)            := NULL;
1291       zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_HDR_TRX_USER_KEY1(i)     := NULL;
1292       zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_HDR_TRX_USER_KEY2(i)     := NULL;
1293       zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_HDR_TRX_USER_KEY3(i)     := NULL;
1294       zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_HDR_TRX_USER_KEY4(i)     := NULL;
1295       zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_HDR_TRX_USER_KEY5(i)     := NULL;
1296       zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_HDR_TRX_USER_KEY6(i)     := NULL;
1297       zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_LINE_ID(i)           := NULL;
1298       zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_LIN_TRX_USER_KEY1(i)     := NULL;
1299       zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_LIN_TRX_USER_KEY2(i)     := NULL;
1300       zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_LIN_TRX_USER_KEY3(i)     := NULL;
1301       zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_LIN_TRX_USER_KEY4(i)     := NULL;
1302       zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_LIN_TRX_USER_KEY5(i)     := NULL;
1303       zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_LIN_TRX_USER_KEY6(i)     := NULL;
1304       zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_DIST_ID(i)           := NULL;
1305       zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_DST_TRX_USER_KEY1(i)     := NULL;
1306       zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_DST_TRX_USER_KEY2(i)     := NULL;
1307       zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_DST_TRX_USER_KEY3(i)     := NULL;
1308       zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_DST_TRX_USER_KEY4(i)     := NULL;
1309       zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_DST_TRX_USER_KEY5(i)     := NULL;
1310       zx_global_structures_pkg.trx_line_dist_tbl.APP_FROM_DST_TRX_USER_KEY6(i)     := NULL;
1311       zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_APPLICATION_ID(i)    := NULL;
1312       zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_ENTITY_CODE(i)       := NULL;
1313       zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_EVENT_CLASS_CODE(i)  := NULL;
1314       zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_HDR_TRX_USER_KEY1(i)      := NULL;
1315       zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_HDR_TRX_USER_KEY2(i)      := NULL;
1316       zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_HDR_TRX_USER_KEY3(i)      := NULL;
1317       zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_HDR_TRX_USER_KEY4(i)      := NULL;
1318       zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_HDR_TRX_USER_KEY5(i)      := NULL;
1319       zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_HDR_TRX_USER_KEY6(i)      := NULL;
1320       zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_LINE_ID(i)           := NULL;
1321       zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_LIN_TRX_USER_KEY1(i)      := NULL;
1322       zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_LIN_TRX_USER_KEY2(i)      := NULL;
1323       zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_LIN_TRX_USER_KEY3(i)      := NULL;
1324       zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_LIN_TRX_USER_KEY4(i)      := NULL;
1325       zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_LIN_TRX_USER_KEY5(i)      := NULL;
1326       zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_LIN_TRX_USER_KEY6(i)      := NULL;
1327       zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_DIST_ID(i)           := NULL;
1328       zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_DST_TRX_USER_KEY1(i)      := NULL;
1329       zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_DST_TRX_USER_KEY2(i)      := NULL;
1330       zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_DST_TRX_USER_KEY3(i)      := NULL;
1331       zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_DST_TRX_USER_KEY4(i)      := NULL;
1332       zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_DST_TRX_USER_KEY5(i)      := NULL;
1333       zx_global_structures_pkg.trx_line_dist_tbl.ADJ_DOC_DST_TRX_USER_KEY6(i)      := NULL;
1334       zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_NUMBER(i)            := NULL;
1335       zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_DATE(i)              := NULL;
1336       zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_TO_APPLICATION_ID(i)      := NULL;
1337       zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_TO_ENTITY_CODE(i)         := NULL;
1338       zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_TO_EVENT_CLASS_CODE(i)    := NULL;
1339       zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_TO_TRX_ID(i)              := NULL;
1340       zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_HDR_TRX_USER_KEY1(i)       := NULL;
1341       zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_HDR_TRX_USER_KEY2(i)       := NULL;
1342       zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_HDR_TRX_USER_KEY3(i)       := NULL;
1343       zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_HDR_TRX_USER_KEY4(i)       := NULL;
1344       zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_HDR_TRX_USER_KEY5(i)       := NULL;
1345       zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_HDR_TRX_USER_KEY6(i)       := NULL;
1346       zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_TO_TRX_LINE_ID(i)         := NULL;
1347       zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_LIN_TRX_USER_KEY1(i)       := NULL;
1348       zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_LIN_TRX_USER_KEY2(i)       := NULL;
1349       zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_LIN_TRX_USER_KEY3(i)       := NULL;
1350       zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_LIN_TRX_USER_KEY4(i)       := NULL;
1351       zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_LIN_TRX_USER_KEY5(i)       := NULL;
1352       zx_global_structures_pkg.trx_line_dist_tbl.APP_TO_LIN_TRX_USER_KEY6(i)       := NULL;
1353       zx_global_structures_pkg.trx_line_dist_tbl.RELATED_DOC_APPLICATION_ID(i)     := NULL;
1354       zx_global_structures_pkg.trx_line_dist_tbl.RELATED_DOC_ENTITY_CODE(i)        := NULL;
1355       zx_global_structures_pkg.trx_line_dist_tbl.RELATED_DOC_EVENT_CLASS_CODE(i)   := NULL;
1356       zx_global_structures_pkg.trx_line_dist_tbl.RELATED_DOC_TRX_ID(i)             := NULL;
1357       zx_global_structures_pkg.trx_line_dist_tbl.REL_DOC_HDR_TRX_USER_KEY1(i)      := NULL;
1358       zx_global_structures_pkg.trx_line_dist_tbl.REL_DOC_HDR_TRX_USER_KEY2(i)      := NULL;
1359       zx_global_structures_pkg.trx_line_dist_tbl.REL_DOC_HDR_TRX_USER_KEY3(i)      := NULL;
1360       zx_global_structures_pkg.trx_line_dist_tbl.REL_DOC_HDR_TRX_USER_KEY4(i)      := NULL;
1361       zx_global_structures_pkg.trx_line_dist_tbl.REL_DOC_HDR_TRX_USER_KEY5(i)      := NULL;
1362       zx_global_structures_pkg.trx_line_dist_tbl.REL_DOC_HDR_TRX_USER_KEY6(i)      := NULL;
1363       zx_global_structures_pkg.trx_line_dist_tbl.RELATED_DOC_NUMBER(i)             := NULL;
1364       zx_global_structures_pkg.trx_line_dist_tbl.RELATED_DOC_DATE(i)               := NULL;
1365       zx_global_structures_pkg.trx_line_dist_tbl.REVERSED_APPLN_ID(i)              := NULL;
1366       zx_global_structures_pkg.trx_line_dist_tbl.REVERSED_ENTITY_CODE(i)           := NULL;
1367       zx_global_structures_pkg.trx_line_dist_tbl.REVERSED_EVNT_CLS_CODE(i)         := NULL;
1368       zx_global_structures_pkg.trx_line_dist_tbl.REVERSED_TRX_ID(i)                := NULL;
1369       zx_global_structures_pkg.trx_line_dist_tbl.REVERSED_TRX_LEVEL_TYPE(i)        := NULL;
1370       zx_global_structures_pkg.trx_line_dist_tbl.REVERSED_TRX_LINE_ID(i)           := NULL;
1371       zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC1(i)                       := NULL;
1372       zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC2(i)                       := NULL;
1373       zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC3(i)                       := NULL;
1374       zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC4(i)                       := NULL;
1375       zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC5(i)                       := NULL;
1376       zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC6(i)                       := NULL;
1377       zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC7(i)                       := NULL;
1378       zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC8(i)                       := NULL;
1379       zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC9(i)                       := NULL;
1380       zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC10(i)                      := NULL;
1381       zx_global_structures_pkg.trx_line_dist_tbl.CHAR1(i)                          := NULL;
1382       zx_global_structures_pkg.trx_line_dist_tbl.CHAR2(i)                          := NULL;
1383       zx_global_structures_pkg.trx_line_dist_tbl.CHAR3(i)                          := NULL;
1384       zx_global_structures_pkg.trx_line_dist_tbl.CHAR4(i)                          := NULL;
1385       zx_global_structures_pkg.trx_line_dist_tbl.CHAR5(i)                          := NULL;
1386       zx_global_structures_pkg.trx_line_dist_tbl.CHAR6(i)                          := NULL;
1387       zx_global_structures_pkg.trx_line_dist_tbl.CHAR7(i)                          := NULL;
1388       zx_global_structures_pkg.trx_line_dist_tbl.CHAR8(i)                          := NULL;
1389       zx_global_structures_pkg.trx_line_dist_tbl.CHAR9(i)                          := NULL;
1390       zx_global_structures_pkg.trx_line_dist_tbl.CHAR10(i)                         := NULL;
1391       zx_global_structures_pkg.trx_line_dist_tbl.DATE1(i)                          := NULL;
1392       zx_global_structures_pkg.trx_line_dist_tbl.DATE2(i)                          := NULL;
1393       zx_global_structures_pkg.trx_line_dist_tbl.DATE3(i)                          := NULL;
1394       zx_global_structures_pkg.trx_line_dist_tbl.DATE4(i)                          := NULL;
1395       zx_global_structures_pkg.trx_line_dist_tbl.DATE5(i)                          := NULL;
1396       zx_global_structures_pkg.trx_line_dist_tbl.DATE6(i)                          := NULL;
1397       zx_global_structures_pkg.trx_line_dist_tbl.DATE7(i)                          := NULL;
1398       zx_global_structures_pkg.trx_line_dist_tbl.DATE8(i)                          := NULL;
1399       zx_global_structures_pkg.trx_line_dist_tbl.DATE9(i)                          := NULL;
1400       zx_global_structures_pkg.trx_line_dist_tbl.DATE10(i)                         := NULL;
1401       zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_APPLICATION_ID(i)          := NULL;
1402       zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_ENTITY_CODE(i)             := NULL;
1403       zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_EVENT_CLASS_CODE(i)        := NULL;
1404       zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_TRX_ID(i)                  := NULL;
1405       zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_TRX_LEVEL_TYPE(i)          := NULL;
1406       zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_TRX_LEVEL_TYPE(i)         := NULL;
1407       zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_TO_TRX_LEVEL_TYPE(i)      := NULL;
1408       zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_TRX_LEVEL_TYPE(i)    := NULL;
1409       zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_TRX_LEVEL_TYPE(i)    := NULL;
1410       zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE2(i)          := NULL;
1411       zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE3(i)          := NULL;
1412       zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE4(i)          := NULL;
1413       zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE5(i)          := NULL;
1414       zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE6(i)          := NULL;
1415       zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE7(i)          := NULL;
1416       zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE8(i)          := NULL;
1417       zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE9(i)          := NULL;
1418       zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE10(i)         := NULL;
1419       zx_global_structures_pkg.trx_line_dist_tbl.SOURCE_TAX_LINE_ID(i)             := NULL;
1420       zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_TRX_NUMBER(i)        := NULL;
1421       zx_global_structures_pkg.trx_line_dist_tbl.TRX_DOC_REVISION(i)               := NULL;
1422       zx_global_structures_pkg.trx_line_dist_tbl.TRX_DESCRIPTION(i)                := NULL;
1423       zx_global_structures_pkg.trx_line_dist_tbl.TRX_COMMUNICATED_DATE(i)          := NULL;
1424       zx_global_structures_pkg.trx_line_dist_tbl.BATCH_SOURCE_ID(i)                := NULL;
1425       zx_global_structures_pkg.trx_line_dist_tbl.BATCH_SOURCE_NAME(i)              := NULL;
1426       zx_global_structures_pkg.trx_line_dist_tbl.DOC_SEQ_ID(i)                     := NULL;
1427       zx_global_structures_pkg.trx_line_dist_tbl.DOC_SEQ_NAME(i)                   := NULL;
1428       zx_global_structures_pkg.trx_line_dist_tbl.DOC_SEQ_VALUE(i)                  := NULL;
1429       zx_global_structures_pkg.trx_line_dist_tbl.TRX_DUE_DATE(i)                   := NULL;
1430       zx_global_structures_pkg.trx_line_dist_tbl.TRX_TYPE_DESCRIPTION(i)           := NULL;
1431       zx_global_structures_pkg.trx_line_dist_tbl.FIRST_PTY_ORG_ID(i)               := NULL;
1432       zx_global_structures_pkg.trx_line_dist_tbl.TAX_EVENT_CLASS_CODE(i)           := NULL;
1433       zx_global_structures_pkg.trx_line_dist_tbl.TAX_EVENT_TYPE_CODE(i)            := NULL;
1434       zx_global_structures_pkg.trx_line_dist_tbl.DOC_EVENT_STATUS(i)               := NULL;
1435       zx_global_structures_pkg.trx_line_dist_tbl.DOCUMENT_SUB_TYPE(i)              := NULL;
1436       zx_global_structures_pkg.trx_line_dist_tbl.SUPPLIER_TAX_INVOICE_NUMBER(i)    := NULL;
1437       zx_global_structures_pkg.trx_line_dist_tbl.SUPPLIER_TAX_INVOICE_DATE(i)      := NULL;
1438       zx_global_structures_pkg.trx_line_dist_tbl.SUPPLIER_EXCHANGE_RATE(i)         := NULL;
1439       zx_global_structures_pkg.trx_line_dist_tbl.TAX_INVOICE_DATE(i)               := NULL;
1440       zx_global_structures_pkg.trx_line_dist_tbl.TAX_INVOICE_NUMBER(i)             := NULL;
1441       zx_global_structures_pkg.trx_line_dist_tbl.DEFAULT_TAXATION_COUNTRY(i)       := NULL;
1442       zx_global_structures_pkg.trx_line_dist_tbl.CTRL_HDR_TX_APPL_FLAG(i)          := NULL;
1443       zx_global_structures_pkg.trx_line_dist_tbl.CTRL_TOTAL_HDR_TX_AMT(i)          := NULL;
1444       zx_global_structures_pkg.trx_line_dist_tbl.PORT_OF_ENTRY_CODE(i)             := NULL;
1445       zx_global_structures_pkg.trx_line_dist_tbl.TAX_AMT_INCLUDED_FLAG(i)          := NULL;
1446       zx_global_structures_pkg.trx_line_dist_tbl.COMPOUNDING_TAX_FLAG(i)           := NULL;
1447       zx_global_structures_pkg.trx_line_dist_tbl.PROVNL_TAX_DETERMINATION_DATE(i)  := NULL;
1448       zx_global_structures_pkg.trx_line_dist_tbl.INSERT_UPDATE_FLAG(i)             := NULL;
1449       zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_TO_TRX_NUMBER(i)          := NULL;
1450       zx_global_structures_pkg.trx_line_dist_tbl.START_EXPENSE_DATE(i)             := NULL;
1451       zx_global_structures_pkg.trx_line_dist_tbl.TRX_BATCH_ID(i)                   := NULL;
1452       zx_global_structures_pkg.trx_line_dist_tbl.RECORD_TYPE_CODE(i)               := NULL;
1453       zx_global_structures_pkg.trx_line_dist_tbl.TAX_PROCESSING_COMPLETED_FLAG(i)  := NULL;
1454       zx_global_structures_pkg.trx_line_dist_tbl.APPLICATION_DOC_STATUS(i)         := NULL;
1455       zx_global_structures_pkg.trx_line_dist_tbl.OVERRIDING_RECOVERY_RATE(i)       := NULL;
1456       zx_global_structures_pkg.trx_line_dist_tbl.TAX_CALCULATION_DONE_FLAG(i)      := NULL;
1457       zx_global_structures_pkg.trx_line_dist_tbl.USER_UPD_DET_FACTORS_FLAG(i)      := NULL;
1458       zx_global_structures_pkg.trx_line_dist_tbl.ICX_SESSION_ID(i)                 := NULL;
1459       zx_global_structures_pkg.trx_line_dist_tbl.LINE_INTENDED_USE(i)              := NULL;
1460       zx_global_structures_pkg.trx_line_dist_tbl.INPUT_TAX_CLASSIFICATION_CODE(i)  := NULL;
1461       zx_global_structures_pkg.trx_line_dist_tbl.INTERFACE_ENTITY_CODE(i)          := NULL;
1462       zx_global_structures_pkg.trx_line_dist_tbl.INTERFACE_LINE_ID(i)              := NULL;
1463       zx_global_structures_pkg.trx_line_dist_tbl.HISTORICAL_TAX_CODE_ID(i)         := NULL;
1464       zx_global_structures_pkg.trx_line_dist_tbl.DIST_LEVEL_ACTION(i)              := NULL;
1465       zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_TAX_DIST_ID(i)       := NULL;
1466       zx_global_structures_pkg.trx_line_dist_tbl.ADJUSTED_DOC_TAX_DIST_ID(i)       := NULL;
1467       zx_global_structures_pkg.trx_line_dist_tbl.TASK_ID(i)                        := NULL;
1468       zx_global_structures_pkg.trx_line_dist_tbl.AWARD_ID(i)                       := NULL;
1469       zx_global_structures_pkg.trx_line_dist_tbl.PROJECT_ID(i)                     := NULL;
1470       zx_global_structures_pkg.trx_line_dist_tbl.EXPENDITURE_TYPE(i)               := NULL;
1471       zx_global_structures_pkg.trx_line_dist_tbl.EXPENDITURE_ORGANIZATION_ID(i)    := NULL;
1472       zx_global_structures_pkg.trx_line_dist_tbl.EXPENDITURE_ITEM_DATE(i)          := NULL;
1473       zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_DIST_AMT(i)              := NULL;
1474       zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_DIST_QUANTITY(i)         := NULL;
1475       zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_CURR_CONV_RATE(i)         := NULL;
1476       zx_global_structures_pkg.trx_line_dist_tbl.ITEM_DIST_NUMBER(i)               := NULL;
1477       zx_global_structures_pkg.trx_line_dist_tbl.REF_DOC_DIST_ID(i)                := NULL;
1478       zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_DIST_TAX_AMT(i)          := NULL;
1479       zx_global_structures_pkg.trx_line_dist_tbl.ESTABLISHMENT_ID(i)               := NULL;
1480       zx_global_structures_pkg.trx_line_dist_tbl.APPLIED_FROM_TRX_NUMBER(i)        := NULL;
1481       zx_global_structures_pkg.trx_line_dist_tbl.CTRL_TOTAL_LINE_TX_AMT(i)         := NULL;
1482       zx_global_structures_pkg.trx_line_dist_tbl.APPLICATION_ID(i)                 := 660;
1483       zx_global_structures_pkg.trx_line_dist_tbl.EVENT_TYPE_CODE(i)                := 'CREATE';
1484       zx_global_structures_pkg.trx_line_dist_tbl.LINE_LEVEL_ACTION(i)              := 'CREATE';
1485       zx_global_structures_pkg.trx_line_dist_tbl.MINIMUM_ACCOUNTABLE_UNIT(i)       := G_MINIMUM_ACCOUNTABLE_UNIT;
1486       zx_global_structures_pkg.trx_line_dist_tbl.LINE_CLASS(i)                     := 'INVOICE';
1487       zx_global_structures_pkg.trx_line_dist_tbl.TRX_LINE_TYPE(i)                  := 'LINE';
1488       zx_global_structures_pkg.trx_line_dist_tbl.DEFAULTING_ATTRIBUTE1(i)          := 'N';
1489       zx_global_structures_pkg.trx_line_dist_tbl.TAX_REPORTING_FLAG(i)             := 'N';
1490       zx_global_structures_pkg.trx_line_dist_tbl.ENTITY_CODE(i)                    := 'OE_ORDER_HEADERS';
1491       zx_global_structures_pkg.trx_line_dist_tbl.LINE_AMT_INCLUDES_TAX_FLAG(i)     := 'S';
1492       zx_global_structures_pkg.trx_line_dist_tbl.EVENT_CLASS_CODE(i)               := 'SALES_TRANSACTION_TAX_QUOTE';
1493       l_call_tax                                                                   := 'Y';
1494       zx_global_structures_pkg.trx_line_dist_tbl.QUOTE_FLAG(i)                     := 'Y';
1495       zx_global_structures_pkg.trx_line_dist_tbl.HISTORICAL_FLAG(i)                := 'N';
1496       zx_global_structures_pkg.trx_line_dist_tbl.CTRL_HDR_TX_APPL_FLAG(i)          := 'N';
1497     END IF;-- lock control set.Skipping header with header id
1498 
1499     IF l_debug_level > 0 THEN
1500          debug_msg(i, l_return_status);
1501  		null;
1502       END IF;
1503 
1504   END LOOP;
1505   oe_debug_pub.add( ' Assigned the Tax values ');
1506   l_transaction_rec.application_id           := 660;
1507   l_transaction_rec.entity_code              := 'OE_ORDER_HEADERS';
1508   l_transaction_rec.event_class_code         := 'SALES_TRANSACTION_TAX_QUOTE';
1509   l_transaction_rec.event_type_code          := 'CREATE';
1510   l_transaction_rec.trx_id                   := OE_Bulk_Order_PVT.G_Header_Rec.header_id(l_header_index);
1511   l_transaction_rec.internal_organization_id := OE_Bulk_Order_PVT.G_Header_Rec.org_id(l_header_index);
1512   SELECT hsecs INTO l_start_time FROM v$timer;
1513   IF l_call_tax = 'Y' THEN --Call ZX api only if there is atleast one eligible line to be taxed
1514     oe_debug_pub.add( ' Call zx_api_pub.calculate_tax ',1);
1515     zx_api_pub.calculate_tax( p_api_version => 1.0,
1516  p_init_msg_list => FND_API.G_TRUE,
1517  p_commit => NULL,
1518  p_validation_level => NULL,
1519  x_return_status => l_return_status,
1520  x_msg_count => l_msg_count,
1521  x_msg_data => l_msg_data,
1522  p_transaction_rec => l_transaction_rec,
1523  p_quote_flag => 'Y',
1524 p_data_transfer_mode => 'PLS',
1525  x_doc_level_recalc_flag => l_doc_level_recalc_flag);
1526   END IF;
1527   SELECT hsecs INTO l_end_time FROM v$timer;
1528   FND_FILE.PUT_LINE(FND_FILE.LOG,'Time spent in zx_api_pub.calculate_tax is (sec) '||((l_end_time-l_start_time)/100));
1529   IF l_debug_level > 0 THEN
1530     oe_debug_pub.add('Message returned by tax API ZX_API_PUB.calculate_tax: '||l_msg_count,2);
1531   END IF;
1532   IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1533     IF l_debug_level > 0 THEN
1534       oe_debug_pub.add( 'unexpected error');
1535     END IF;
1536     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1537   ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
1538     IF l_x_msg_data    IS NOT NULL THEN
1539       FND_MESSAGE.SET_NAME('ONT','ONT_AVAIL_GENERIC');
1540       FND_MESSAGE.SET_TOKEN('TEXT',l_x_msg_data);
1541       OE_MSG_PUB.Add;
1542     END IF;
1543     Handle_Error( l_header_index);
1544     IF l_debug_level > 0 THEN
1545       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));
1546       oe_debug_pub.add( ' Error :'|| l_x_msg_data, 1);
1547     END IF;
1548     --Skip the remaining lines in this header as it is marked for error
1549     --              l_remaining_lines := OE_Bulk_Order_PVT.G_HEADER_REC.end_line_index(l_header_index) - l_index;
1550     --               l_index_inc := l_remaining_lines + 1;
1551   ELSE
1552     IF l_debug_level > 0 THEN
1553       oe_debug_pub.add( 'before building adjustment records');
1554     END IF;
1555     /*    i:=0;
1556     open detail_tax_lines_gt(l_line_rec.header_id, l_line_rec.line_id);
1557     fetch detail_tax_lines_gt into detail_tax_lines_gt_rec;
1558     loop
1559     exit when detail_tax_lines_gt%NOTFOUND;*/
1560    i:=1;
1561 
1562     oe_debug_pub.add( ' Number of records in Header' || OE_Bulk_Order_PVT.G_HEADER_REC.HEADER_ID.Count , 1);
1563 
1564     FOR j IN 1..OE_Bulk_Order_PVT.G_HEADER_REC.HEADER_ID.COUNT
1565     LOOP
1566 
1567       FOR detail_tax_lines_gt_rec IN detail_tax_lines_gt(OE_Bulk_Order_PVT.G_Header_Rec.header_id(j))
1568       LOOP
1569         oe_debug_pub.add( ' Header il_header_index Lalit' || detail_tax_lines_gt_rec.trx_level_type, 1);
1570         oe_debug_pub.add( ' Header id :' || OE_Bulk_Order_PVT.G_Header_Rec.header_id(j), 1);
1571         oe_debug_pub.add( '  Tax Code  :'|| detail_tax_lines_gt_rec.Tax_Code,1);
1572         oe_debug_pub.add( '  Tax_rate_id  :'|| detail_tax_lines_gt_rec.tax_rate_id ,1);
1573         oe_debug_pub.add( '  Trx_line_id  :'|| detail_tax_lines_gt_rec.trx_line_id ,1);
1574         --Build the Adjustments records to INSERT Tax Info
1575         Extend_Adj_Rec(1, G_LINE_ADJ_REC);
1576         oe_debug_pub.add( ' Aftr Extend '||i);
1577         G_LINE_ADJ_REC.header_id(i) := detail_tax_lines_gt_rec.trx_id;      --OE_Bulk_Order_PVT.G_Line_Rec.header_id(i);
1578 
1579          --OE_Bulk_Order_PVT.G_Line_Rec.line_id(i);
1580         --  l_tax_code := OE_Bulk_Order_PVT.G_LINE_REC.Tax_Code(i);
1581        IF  detail_tax_lines_gt_rec.trx_level_type = 'FREIGHT CHARGE' THEN
1582           oe_debug_pub.add( ' Inside Freight charge ');
1583            G_LINE_ADJ_REC.line_id(i)   := detail_tax_lines_gt_rec.TRX_LINE_NUMBER;
1584           G_LINE_ADJ_REC.PARENT_ADJUSTMENT_ID(i) :=  detail_tax_lines_gt_rec.trx_line_id;
1585        ELSE
1586           G_LINE_ADJ_REC.line_id(i)   := detail_tax_lines_gt_rec.TRX_LINE_ID;
1587           G_LINE_ADJ_REC.PARENT_ADJUSTMENT_ID(i) := NULL;
1588        END IF;
1589 
1590         G_LINE_ADJ_REC.tax_code(i)            := detail_tax_lines_gt_rec.Tax_Code;
1591         G_LINE_ADJ_REC.operand(i)             := detail_tax_lines_gt_rec.tax_rate;
1592         G_LINE_ADJ_REC.adjusted_amount(i)     := detail_tax_lines_gt_rec.tax_amt;
1593         G_LINE_ADJ_REC.automatic_flag(i)      := 'N';
1594         G_LINE_ADJ_REC.list_line_type_code(i) := 'TAX';
1595         G_LINE_ADJ_REC.arithmetic_operator(i) := 'AMT';
1596         G_LINE_ADJ_REC.tax_rate_id(i)         := detail_tax_lines_gt_rec.tax_rate_id ; --bug7685103
1597         -- OE_Bulk_Order_PVT.G_LINE_REC.tax_value(i) := detail_tax_lines_gt_rec.tax_amt;
1598         IF l_debug_level > 0 THEN
1599           oe_debug_pub.add( 'total tax value: i: ' || detail_tax_lines_gt_rec.tax_amt, 1);
1600         END IF;
1601         --IF p_post_insert THEN
1602         --IF l_debug_level  > 0 THEN
1603         -- oe_debug_pub.add(  'post insert mode, so reset global tax info');
1604         --END IF;
1605         G_Tax_Line_Id(i)    := detail_tax_lines_gt_rec.trx_line_id;
1606         G_Tax_Line_Value(i) := detail_tax_lines_gt_rec.tax_amt;
1607         -- END IF;
1608         --   l_adj_index := l_adj_index + 1;
1609         i := i + 1;
1610       END LOOP;
1611     END LOOP;
1612   END IF;
1613   FOR i IN 1..OE_Bulk_Order_PVT.G_LINE_REC.line_id.COUNT
1614   LOOP --bug7685103
1615     FOR j IN 1..G_Tax_Line_Id.COUNT
1616     LOOP
1617       IF OE_Bulk_Order_PVT.G_LINE_REC.line_id(i)   = G_Tax_Line_Id(j) THEN
1618         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);
1619       END IF;
1620     END LOOP;
1621   END LOOP;
1622   --bug7685103
1623   IF G_LINE_ADJ_REC.line_id.COUNT > 0 THEN
1624     IF l_debug_level              > 0 THEN
1625       oe_debug_pub.add( 'adjustment records found: '|| G_LINE_ADJ_REC.line_id.COUNT ) ;
1626     END IF;
1627     Insert_Tax_Records(p_post_insert => p_post_insert);
1628   END IF;
1629   G_LINE_ADJ_REC.PRICE_ADJUSTMENT_ID.delete;
1630   G_LINE_ADJ_REC.CREATED_BY.delete;
1631   G_LINE_ADJ_REC.CREATION_DATE.delete;
1632   G_LINE_ADJ_REC.LAST_UPDATE_DATE.delete;
1633   G_LINE_ADJ_REC.LAST_UPDATED_BY.delete;
1634   G_LINE_ADJ_REC.HEADER_ID.delete;
1635   G_LINE_ADJ_REC.LINE_ID.delete;
1636   G_LINE_ADJ_REC.TAX_CODE.delete;
1637   G_LINE_ADJ_REC.OPERAND.delete;
1638   G_LINE_ADJ_REC.ADJUSTED_AMOUNT.delete;
1639   G_LINE_ADJ_REC.AUTOMATIC_FLAG.delete;
1640   G_LINE_ADJ_REC.LIST_LINE_TYPE_CODE.delete;
1641   G_LINE_ADJ_REC.ARITHMETIC_OPERATOR.delete;
1642   G_LINE_ADJ_REC.TAX_RATE_ID.delete;
1643   G_TAX_LINE_ID    := G_MISS_TAX_NUMBER_TBL;
1644   G_TAX_LINE_VALUE := G_MISS_TAX_NUMBER_TBL;
1645   IF l_debug_level  > 0 THEN
1646     oe_debug_pub.add( 'EXITING OE_BULK_TAX_UTIL.CALCULATE_TAX' ) ;
1647   END IF;
1648 EXCEPTION
1649 WHEN OTHERS THEN
1650   IF l_debug_level > 0 THEN
1651     oe_debug_pub.add( 'in others exception ' || SQLERRM);
1652   END IF;
1653   IF OE_BULK_MSG_PUB.check_msg_level(OE_BULK_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
1654     OE_BULK_MSG_PUB.add_exc_msg (G_PKG_NAME ,'Calcuate_Tax' );
1655   END IF;
1656   RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1657 END Calculate_Tax;
1658 
1659 
1660 
1661 
1662 
1663 PROCEDURE Extend_Adj_Rec
1664         (p_count               IN NUMBER
1665         ,p_adj_rec            IN OUT NOCOPY LINE_ADJ_REC_TYPE
1666         )
1667 IS
1668 --
1669 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1670 --
1671 BEGIN
1672 
1673 
1674 IF l_debug_level  > 0 THEN
1675   oe_debug_pub.add(  'ENTERING OE_BULK_TAX_UTIL.EXTEND_ADJ_REC' ) ;
1676  --  oe_debug_pub.add(  ' p_adj_rec.PRICE_ADJUSTMENT_ID :'|| p_adj_rec.PRICE_ADJUSTMENT_ID.count);
1677 END IF;
1678 
1679 p_adj_rec.PRICE_ADJUSTMENT_ID.extend(p_count);
1680 p_adj_rec.CREATED_BY.extend(p_count);
1681 p_adj_rec.CREATION_DATE.extend(p_count);
1682 p_adj_rec.LAST_UPDATE_DATE.extend(p_count);
1683 p_adj_rec.LAST_UPDATED_BY.extend(p_count);
1684 p_adj_rec.HEADER_ID.extend(p_count);
1685 p_adj_rec.LINE_ID.extend(p_count);
1686 p_adj_rec.TAX_CODE.extend(p_count);
1687 p_adj_rec.OPERAND.extend(p_count);
1688 p_adj_rec.ADJUSTED_AMOUNT.extend(p_count);
1689 p_adj_rec.AUTOMATIC_FLAG.extend(p_count);
1690 p_adj_rec.LIST_LINE_TYPE_CODE.extend(p_count);
1691 p_adj_rec.ARITHMETIC_OPERATOR.extend(p_count);
1692 p_adj_rec.TAX_RATE_ID.extend(p_count);
1693 p_adj_rec.parent_adjustment_id.extend(p_count); --TAXER
1694 
1695 IF l_debug_level  > 0 THEN
1696   oe_debug_pub.add(  'EXITING OE_BULK_TAX_UTIL.EXTEND_ADJ_REC' ) ;
1697 END IF;
1698 
1699 EXCEPTION
1700   WHEN OTHERS THEN
1701 
1702     IF l_debug_level  > 0 THEN
1703       oe_debug_pub.add(  'in others exception ' || SQLERRM);
1704     END IF;
1705 
1706     OE_BULK_MSG_PUB.Add_Exc_Msg
1707       (   G_PKG_NAME
1708       ,   'Extend_Adj_Rec'
1709        );
1710     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1711 END Extend_Adj_Rec;
1712 
1713 PROCEDURE Insert_Tax_Records
1714           (p_post_insert            IN    BOOLEAN
1715           )
1716 IS
1717 l_start_time             NUMBER;
1718 l_end_time               NUMBER;
1719 
1720 --
1721 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1722 --
1723 
1724 ---TAXER
1725 
1726 CURSOR freight_charges(ORDER_Line_id NUMBER)
1727 IS
1728 SELECT *
1729 FROM oe_price_adjustments
1730 WHERE LIST_LINE_TYPE_CODE = 'FREIGHT_CHARGE'
1731 AND line_id = ORDER_Line_id;
1732 
1733 
1734 total_freight_tax  NUMBER;
1735 charge_tax   NUMBER;
1736 
1737 
1738 
1739 --TAXER
1740 
1741 
1742 
1743 
1744 BEGIN
1745 
1746 
1747 IF l_debug_level  > 0 THEN
1748   oe_debug_pub.add(  'ENTERING OE_BULK_TAX_UTIL.INSERT_TAX_RECORDS' ) ;
1749 END IF;
1750 
1751  SELECT hsecs INTO l_start_time from v$timer;
1752 
1753 
1754 
1755 begin
1756 FORALL i IN 1..G_LINE_ADJ_REC.LINE_ID.COUNT --bug7685103
1757     DELETE FROM OE_PRICE_ADJUSTMENTS
1758     where  list_line_type_code = 'TAX'
1759             and header_ID   = G_LINE_ADJ_REC.header_ID(i);
1760 Exception
1761 	when others then
1762 	IF l_debug_level  > 0 THEN
1763 	  oe_debug_pub.add(  'Exception in delete existing tax records' ) ;
1764 	END IF;
1765 End ;
1766 
1767 
1768 FORALL i IN 1..G_LINE_ADJ_REC.LINE_ID.COUNT
1769                    INSERT INTO OE_PRICE_ADJUSTMENTS
1770                     (       PRICE_ADJUSTMENT_ID
1771                     ,       CREATED_BY
1772                     ,       CREATION_DATE
1773                     ,       LAST_UPDATE_DATE
1774                     ,       LAST_UPDATED_BY
1775                     ,       HEADER_ID
1776                     ,       LINE_ID
1777                     ,       TAX_CODE
1778                     ,       OPERAND
1779                     ,       adjusted_amount
1780                     ,       automatic_flag
1781                     ,       list_line_type_code
1782                     ,       arithmetic_operator
1783 		                ,       tax_rate_id --bug7685103
1784                     ,       parent_adjustment_id
1785 		    )
1786                     VALUES
1787                     (       oe_price_adjustments_s.nextval
1788                     ,        FND_GLOBAL.USER_ID
1789                     ,        SYSDATE
1790                     ,        SYSDATE
1791                     ,        FND_GLOBAL.USER_ID
1792                     ,        G_LINE_ADJ_REC.header_id(i)
1793                     ,        G_LINE_ADJ_REC.line_id(i)
1794                     ,        G_LINE_ADJ_REC.tax_code(i)
1795                     ,        G_LINE_ADJ_REC.operand(i)
1796                     ,        G_LINE_ADJ_REC.adjusted_amount(i)
1797                     ,        'N'
1798                     ,        'TAX'
1799                     ,        'AMT'
1800 		    ,	     G_LINE_ADJ_REC.tax_rate_id(i) --bug7685103
1801          ,G_LINE_ADJ_REC.parent_adjustment_id(i)
1802 
1803 		    );
1804 
1805 
1806  SELECT hsecs INTO l_end_time from v$timer;
1807 
1808    FND_FILE.PUT_LINE(FND_FILE.LOG,'Time spent inserting adjustment records is (sec) '||((l_end_time-l_start_time)/100));
1809 
1810       --Need to Update TAX_VALUE on oe_order_lines_all if in post insert mode.
1811       IF p_post_insert AND G_Tax_Line_Id.COUNT > 0
1812       THEN
1813 
1814         IF l_debug_level  > 0 THEN
1815           oe_debug_pub.add(  'post insert mode, so update tax on lines in base table' ) ;
1816         END IF;
1817 
1818 
1819 	      FORALL i IN 1..G_Tax_Line_Id.COUNT --bug7685103
1820           UPDATE OE_ORDER_LINES
1821           SET TAX_VALUE = 0
1822           WHERE LINE_ID = G_Tax_Line_Id(i);
1823 
1824         FORALL i IN 1..G_Tax_Line_Id.COUNT --bug7685103
1825           UPDATE OE_ORDER_LINES
1826           SET TAX_VALUE = TAX_VALUE + G_Tax_Line_Value(i)
1827           WHERE LINE_ID = G_Tax_Line_Id(i);
1828 
1829 
1830           --TAXER
1831 
1832 
1833            oe_debug_pub.add(  'Updating OE_ORDER_LINES tax value' ) ;
1834 
1835            FOR i IN 1..G_LINE_ID.COUNT LOOP
1836                 total_freight_tax:=0;
1837 
1838                 oe_debug_pub.add(  'Updating oe_price_Adjustments for line'||OE_Bulk_Order_PVT.G_LINE_REC.LINE_ID(i) ) ;
1839 
1840 
1841               FOR j IN freight_charges(G_LINE_ID(i))   LOOP
1842 
1843                oe_debug_pub.add(  'Updating oe_price_Adjustments'||j.PRICE_ADJUSTMENT_ID ) ;
1844 
1845                   begin
1846 
1847                    SELECT Sum(Nvl(adjusted_amount,0))
1848                    INTO charge_tax
1849                    FROM oe_price_adjustments
1850                    WHERE parent_adjustment_id = j.PRICE_ADJUSTMENT_ID
1851                    AND list_line_type_code = 'TAX';
1852 
1853                  oe_debug_pub.add(  'Updating tax amount'||charge_tax ) ;
1854 
1855 
1856                    EXCEPTION
1857                    WHEN OTHERS THEN
1858                       charge_tax:=0;
1859                    END;
1860 
1861 
1862 
1863                  total_freight_tax:= total_freight_tax + charge_tax;
1864 
1865               END LOOP;
1866 
1867               UPDATE OE_ORDER_LINES
1868                SET  TAX_VALUE = TAX_VALUE + total_freight_tax ,
1869                 TAX_LINE_VALUE = total_freight_tax
1870               WHERE LINE_ID = G_LINE_ID(i);
1871 
1872 
1873            END LOOP;
1874 
1875 
1876            --TAXER
1877 
1878 
1879       END IF;
1880 
1881 
1882 IF l_debug_level  > 0 THEN
1883   oe_debug_pub.add(  'EXITING OE_BULK_TAX_UTIL.INSERT_TAX_RECORDS' ) ;
1884 END IF;
1885 
1886 
1887 EXCEPTION
1888   WHEN OTHERS THEN
1889 
1890   IF l_debug_level  > 0 THEN
1891     oe_debug_pub.add(  'in others exception ' || SQLERRM ) ;
1892   END IF;
1893 
1894   IF OE_BULK_MSG_PUB.check_msg_level(OE_BULK_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1895   THEN
1896     OE_BULK_MSG_PUB.add_exc_msg
1897     (G_PKG_NAME
1898     ,'Insert_Tax_Records'
1899     );
1900   END IF;
1901   RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1902 END Insert_Tax_Records;
1903 
1904 
1905 PROCEDURE Handle_Error
1906         (p_header_index               IN NUMBER
1907  --       ,p_line_index                 IN NUMBER
1908         )
1909 IS
1910 --
1911 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1912 --
1913 BEGIN
1914 
1915 
1916 IF l_debug_level  > 0 THEN
1917   oe_debug_pub.add(  'ENTERING OE_BULK_TAX_UTIL.HANDLE_ERROR' ) ;
1918 END IF;
1919 
1920 --OE_Bulk_Order_PVT.G_LINE_REC.lock_control(p_line_index) := -99;
1921 OE_Bulk_Order_PVT.G_HEADER_REC.lock_control(p_header_index) := -99;
1922 OE_BULK_ORDER_PVT.mark_header_error(p_header_index, OE_Bulk_Order_PVT.G_HEADER_REC);
1923 
1924 
1925 IF l_debug_level  > 0 THEN
1926   oe_debug_pub.add(  'EXITING OE_BULK_TAX_UTIL.HANDLE_ERROR' ) ;
1927 END IF;
1928 
1929 EXCEPTION
1930   WHEN OTHERS THEN
1931   IF l_debug_level  > 0 THEN
1932     oe_debug_pub.add(  'in others exception ' || SQLERRM ) ;
1933   END IF;
1934 
1935   IF OE_BULK_MSG_PUB.check_msg_level(OE_BULK_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1936   THEN
1937     OE_BULK_MSG_PUB.add_exc_msg
1938     (G_PKG_NAME
1939     ,'Handle_Error'
1940     );
1941   END IF;
1942   RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1943 END Handle_Error;
1944 
1945 PROCEDURE Handle_Tax_Code_Error(p_index IN NUMBER,
1946                                 p_header_index IN NUMBER,
1947 				x_index_inc OUT NOCOPY NUMBER)
1948 
1949 IS
1950 l_index_inc NUMBER := NULL;
1951 l_remaining_lines NUMBER;
1952 l_order_type_cache_key    NUMBER;
1953 --
1954 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1955 --
1956 BEGIN
1957 
1958 IF l_debug_level  > 0 THEN
1959   oe_debug_pub.add(  'ENTERING OE_BULK_TAX_UTIL.HANDLE_TAX_CODE_ERROR' ) ;
1960 END IF;
1961 
1962       OE_Bulk_Order_PVT.G_LINE_REC.tax_code(p_index) := null;
1963 
1964       IF nvl(OE_Bulk_Order_PVT.G_HEADER_REC.booked_flag(p_header_index), 'N') = 'Y'
1965               THEN
1966 
1967 
1968                 IF l_debug_level  > 0 THEN
1969                   oe_debug_pub.add(  'order was booked');
1970                 END IF;
1971 
1972          l_order_type_cache_key := OE_BULK_CACHE.Load_Order_Type(OE_Bulk_Order_PVT.G_HEADER_REC.order_type_id(p_header_index));
1973         IF OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_order_type_cache_key).tax_calculation_event IN ('ENTERING', 'BOOKING') THEN
1974 
1975           OE_BULK_MSG_PUB.Set_Msg_Context
1976 		( p_entity_code                 => 'HEADER'
1977          	 ,p_entity_id                   => OE_Bulk_Order_PVT.G_HEADER_REC.header_id(p_header_index)
1978         	 ,p_header_id                   => OE_Bulk_Order_PVT.G_HEADER_REC.header_id(p_header_index)
1979         	 ,p_orig_sys_document_ref       => OE_Bulk_Order_PVT.G_HEADER_REC.orig_sys_document_ref(p_header_index)
1980         	 ,p_order_source_id             => OE_Bulk_Order_PVT.G_HEADER_REC.order_source_id(p_header_index)
1981                 );
1982 
1983          FND_MESSAGE.SET_NAME('ONT','OE_VAL_TAX_CODE_REQD');
1984          OE_BULK_MSG_PUB.Add;
1985          Handle_Error( p_header_index);
1986 
1987          IF l_debug_level  > 0 THEN
1988            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));
1989          END IF;
1990 
1991          --Skip the remaining lines in this header
1992          l_remaining_lines := OE_Bulk_Order_PVT.G_HEADER_REC.end_line_index(p_header_index) - p_index;
1993          l_index_inc := l_remaining_lines + 1;
1994         END IF;  -- end of tax event in ENTERING or BOOKING
1995 
1996       END IF;  --end of IF booked_flag = 'Y'
1997 
1998       x_index_inc := l_index_inc;
1999 
2000 IF l_debug_level  > 0 THEN
2001   oe_debug_pub.add(  'EXITING OE_BULK_TAX_UTIL.HANDLE_TAX_CODE_ERROR' ) ;
2002 END IF;
2003 
2004 
2005 EXCEPTION
2006   WHEN OTHERS THEN
2007   IF l_debug_level  > 0 THEN
2008     oe_debug_pub.add(  'in others exception ' || SQLERRM ) ;
2009   END IF;
2010 
2011   IF OE_BULK_MSG_PUB.check_msg_level(OE_BULK_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
2012   THEN
2013     OE_BULK_MSG_PUB.add_exc_msg
2014     (G_PKG_NAME
2015     ,'Handle_Tax_Code_Error'
2016     );
2017   END IF;
2018   RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2019 END Handle_Tax_Code_Error;
2020 
2021 Procedure Debug_msg(p_index         IN  NUMBER,
2022 		    x_return_status OUT NOCOPY Varchar2) IS
2023 
2024 i	NUMBER;
2025 Begin
2026         i:=p_index;
2027 	IF i IS NOT NULL
2028 	   AND zx_global_structures_pkg.trx_line_dist_tbl.APPLICATION_ID.exists(I)
2029 THEN
2030         oe_debug_pub.add('Entering OM_TAX_UTIL.Debug_msg procedure ');
2031         oe_debug_pub.add(' i = '||i);
2032 	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));
2033 	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));
2034 	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));
2035 	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));
2036 	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));
2037 	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));
2038 	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));
2039 	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));
2040 	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));
2041 	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));
2042 	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));
2043 	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));
2044 	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));
2045 	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));
2046 	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));
2047 	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));
2048 	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));
2049 	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));
2050 	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));
2051 	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));
2052 	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));
2053 	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));
2054 	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));
2055 	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));
2056 	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));
2057 	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));
2058 	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));
2059 	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));
2060 	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));
2061 	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));
2062 	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));
2063 	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));
2064 	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));
2065 	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));
2066 	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));
2067 	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));
2068 	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));
2069 	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));
2070 	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));
2071 	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));
2072 	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));
2073 	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));
2074 	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));
2075 	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));
2076 	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));
2077 	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));
2078 	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));
2079 	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));
2080 	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));
2081 	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));
2082 	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));
2083 	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));
2084 	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));
2085 	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));
2086 	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));
2087 	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));
2088 	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));
2089 	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));
2090 	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));
2091 	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));
2092 	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));
2093 	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));
2094 	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));
2095 	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));
2096 	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));
2097 	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));
2098 	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));
2099 	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));
2100 	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));
2101 	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));
2102 	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));
2103 	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));
2104 	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));
2105 	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));
2106 	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));
2107 	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));
2108 	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));
2109 	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));
2110 	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));
2111 	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));
2112 	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));
2113 	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));
2114 	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));
2115 	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));
2116 	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));
2117 	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));
2118 	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));
2119 	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));
2120 	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));
2121 	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));
2122 	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));
2123 	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));
2124 	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));
2125 	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));
2126 	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));
2127 	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));
2128 	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));
2129 	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));
2130 	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));
2131 	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));
2132 	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));
2133 	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));
2134 	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));
2135 	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));
2136 	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));
2137 	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));
2138 	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));
2139 	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));
2140 	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));
2141 	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));
2142 	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));
2143 	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));
2144 	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));
2145 	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));
2146 	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));
2147 	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));
2148 	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));
2149 	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));
2150 	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));
2151 	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));
2152 	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));
2153 	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));
2154 	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));
2155 	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));
2156 	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));
2157 	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));
2158 	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));
2159 	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));
2160 	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));
2161 	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));
2162 	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));
2163 	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));
2164 	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));
2165 	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));
2166 	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));
2167 	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));
2168 	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));
2169 	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));
2170 	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));
2171 	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));
2172 	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));
2173 	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));
2174 	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));
2175 	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));
2176 	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));
2177 	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));
2178 	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));
2179 	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));
2180 	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));
2181 	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));
2182 	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));
2183 	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));
2184 	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));
2185 	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));
2186 	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));
2187 	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));
2188 	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));
2189 	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));
2190 	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));
2191 	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));
2192 	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));
2193 	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));
2194 	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));
2195 	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));
2196 	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));
2197 	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));
2198 	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));
2199 	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));
2200 	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));
2201 	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));
2202 	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));
2203 	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));
2204 	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));
2205 	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));
2206 	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));
2207 	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));
2208 	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));
2209 	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));
2210 	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));
2211 	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));
2212 	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));
2213 	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));
2214 	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));
2215 	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));
2216 	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));
2217 	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));
2218 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC1(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC1(i));
2219 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC2(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC2(i));
2220 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC3(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC3(i));
2221 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC4(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC4(i));
2222 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC5(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC5(i));
2223 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC6(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC6(i));
2224 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC7(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC7(i));
2225 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC8(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC8(i));
2226 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC9(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC9(i));
2227 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC10(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.NUMERIC10(i));
2228 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.CHAR1(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.CHAR1(i));
2229 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.CHAR2(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.CHAR2(i));
2230 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.CHAR3(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.CHAR3(i));
2231 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.CHAR4(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.CHAR4(i));
2232 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.CHAR5(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.CHAR5(i));
2233 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.CHAR6(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.CHAR6(i));
2234 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.CHAR7(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.CHAR7(i));
2235 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.CHAR8(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.CHAR8(i));
2236 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.CHAR9(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.CHAR9(i));
2237 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.CHAR10(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.CHAR10(i));
2238 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DATE1(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DATE1(i));
2239 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DATE2(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DATE2(i));
2240 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DATE3(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DATE3(i));
2241 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DATE4(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DATE4(i));
2242 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DATE5(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DATE5(i));
2243 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DATE6(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DATE6(i));
2244 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DATE7(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DATE7(i));
2245 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DATE8(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DATE8(i));
2246 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DATE9(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DATE9(i));
2247 	oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.DATE10(i)= '||zx_global_structures_pkg.trx_line_dist_tbl.DATE10(i));
2248 	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));
2249 	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));
2250 	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));
2251 	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));
2252 	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));
2253 	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));
2254 	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));
2255 	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));
2256 	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));
2257 	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));
2258 	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));
2259 	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));
2260 	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));
2261 	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));
2262 	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));
2263 	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));
2264 	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));
2265 	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));
2266 	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));
2267 	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));
2268 	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));
2269 	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));
2270 	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));
2271 	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));
2272 	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));
2273   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));
2274 	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));
2275 	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));
2276 	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));
2277 	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));
2278 	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));
2279 	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));
2280 	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));
2281 	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));
2282 	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));
2283 	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));
2284 	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));
2285 	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));
2286 	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));
2287 	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));
2288 	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));
2289 	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));
2290 	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));
2291 	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));
2292 	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));
2293 	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));
2294 	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));
2295   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));
2296 	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));
2297 	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));
2298 	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));
2299 	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));
2300 	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));
2301         oe_debug_pub.add(' zx_global_structures_pkg.trx_line_dist_tbl.LEGAL_ENTITY_ID(i)= '||
2302                                    zx_global_structures_pkg.trx_line_dist_tbl.LEGAL_ENTITY_ID(i),3);
2303         oe_debug_pub.add('Exiting OM_TAX_UTIL.Debug_msg procedure ');
2304 ELSE
2305 	oe_debug_pub.add(' Index:'||i||' not avail for debug');
2306 END IF;
2307 End Debug_msg ;
2308 
2309 END OE_BULK_TAX_UTIL;