DBA Data[Home] [Help]

PACKAGE BODY: APPS.ZX_TEST_API

Source


1 PACKAGE BODY ZX_TEST_API AS
2 /* $Header: zxitestapispvtb.pls 120.41 2006/04/05 17:12:26 appradha ship $ */
3 
4 l_ship_from_location_id NUMBER;
5 
6 /* ============================================================================*
7  | PROCEDURE write_message:  Write output depending of the value given in      |
8  |                           l_destination                                     |
9  * ===========================================================================*/
10   PROCEDURE write_message(p_message IN VARCHAR2) IS
11   BEGIN
12     IF g_log_destination = 'LOGFILE' THEN
13       arp_util_tax.debug(p_message);
14     ELSIF g_log_destination = 'LOGVARIABLE' THEN
15      --DBMS_OUTPUT.PUT_LINE(p_message); --Uncomment unly when testing in SQL plus.
16      g_log_variable := g_log_variable ||'
17 '|| p_message; --Return delivery entered, due Standard avoiding CHR() function.
18     END IF;
19   END write_message;
20 
21 
22 
23 /*=============================================================================*
24  | PROCEDURE get_log: Retrieves the log stored in global_variable              |
25  *=============================================================================*/
26   PROCEDURE get_log
27     (
28      x_log                  OUT NOCOPY LONG
29     ) IS
30   BEGIN
31     x_log := g_log_variable;
32   END;
33 
34 
35 
36 /* ============================================================================*
37  | PROCEDURE Initialize_file : Open the file for reading.                      |
38  * ===========================================================================*/
39   PROCEDURE initialize_file
40     (
41      p_file_dir             IN  VARCHAR2,
42      p_file_name            IN  VARCHAR2,
43 	 x_return_status        OUT NOCOPY VARCHAR2
44 	) IS
45   l_line_max_size  BINARY_INTEGER;
46 
47   BEGIN
48     l_line_max_size := 32767;
49     -------------------------------
50     -- Open the file to process.
51     -------------------------------
52     g_file := UTL_FILE.FOPEN(p_file_dir,
53                              p_file_name,
54                              'r',
55                              l_line_max_size);
56     x_return_status := 'SUCCESS';
57 
58   EXCEPTION
59     WHEN OTHERS THEN
60       x_return_status := 'FAILURE';
61       write_message('-------------------------------------------------------------------');
62       write_message('ERROR: Not able to find the file '||p_file_name||' at '||p_file_dir);
63       write_message('-------------------------------------------------------------------');
64 
65 
66   END initialize_file;
67 
68 
69 
70 /* ======================================================================*
71  | PROCEDURE close_file : Close the current file for reading.            |
72  * ======================================================================*/
73 
74   PROCEDURE close_file
75     (
76 	 x_return_status        OUT NOCOPY VARCHAR2
77 	) IS
78   BEGIN
79     -------------------------------
80     -- Close the file.
81     -------------------------------
82     UTL_FILE.FCLOSE_ALL;
83     x_return_status := 'SUCCESS';
84 
85   EXCEPTION
86     WHEN OTHERS THEN
87       x_return_status := 'FAILURE';
88 
89   END close_file;
90 
91 
92 /* ==================================================================================*
93  | PROCEDURE retrieve_another_segment : Retrieves next segment(1000 chars) from line |
94  * ==================================================================================*/
95 
96   PROCEDURE retrieve_another_segment
97     (
98       x_return_status         OUT NOCOPY VARCHAR2
99 	) IS
100   BEGIN
101     x_return_status := 'IN PROGRESS';
102     ---------------------------------------------------------------------------
103     -- Process the line. Line max size is 32767 characters long.
104     -- Separate the line in segments of 1000 chars and process it.
105     -- It does a maximum of 32 cycles.(Due limit of 32*1000 chars=32K chars)
106     ---------------------------------------------------------------------------
107     IF g_retrieve_another_segment = 'Y' THEN
108       IF    g_line_segment_counter  = 0  THEN
109         g_line_segment_string      := substr(g_line_buffer,1,1000);
110         ------------------------------------------------------------------------
111         -- Separates any contiguos separators ",,," with spaces " , , , "
112         ------------------------------------------------------------------------
113         g_line_segment_string      := replace(g_line_segment_string,g_separator||g_separator
114                                                                    ,' '||g_separator||' '||g_separator||' ');
115         g_line_segment_counter     := g_line_segment_counter + 1;
116         g_retrieve_another_segment := 'N';
117         IF g_line_segment_string IS NULL THEN
118           x_return_status := 'COMPLETED';
119         ELSE
120           x_return_status := 'IN PROGRESS';
121         END IF;
122 
123       ELSIF g_line_segment_counter <= 32 THEN
124         -----------------------------------------------------------------------
125         -- Separates the Line in segments of 1000 chars , append
126         -- the last part of the previous line that was not processed.
127         -----------------------------------------------------------------------
128         g_line_segment_string      := substr(g_line_buffer,(1000*(g_line_segment_counter)+1),1000);
129         g_line_segment_string      := g_last_portion_prev_string||g_line_segment_string;
130         g_line_segment_counter     := g_line_segment_counter + 1;
131         g_retrieve_another_segment := 'N';
132         IF g_line_segment_string IS NULL THEN
133           x_return_status := 'COMPLETED';
134         ELSE
135           x_return_status := 'IN PROGRESS';
136         END IF;
137       END IF;
138     END IF;
139 
140   END retrieve_another_segment;
141 
142 
143 /* ===========================================================================*
144  | PROCEDURE read_line : Reads a line from the file and puts it on buffer     |
145  * ===========================================================================*/
146 
147   PROCEDURE read_line
148      (
149       x_line_suite               OUT NOCOPY VARCHAR2,
150       x_line_case                OUT NOCOPY VARCHAR2,
151       x_line_api                 OUT NOCOPY VARCHAR2,
152       x_line_task                OUT NOCOPY VARCHAR2,
153       x_line_structure           OUT NOCOPY VARCHAR2,
154       x_line_counter             OUT NOCOPY NUMBER  ,
155       x_line_is_end_of_case      OUT NOCOPY VARCHAR2,
156       x_current_datafile_section OUT NOCOPY VARCHAR2,
157 	  x_return_status            OUT NOCOPY VARCHAR2
158      ) IS
159 
160   l_curr                    NUMBER;
161   l_next                    NUMBER;
162   l_next_line_buffer        LONG;
163   l_next_line_return_status VARCHAR2(2000);
164   l_next_line_suite         VARCHAR2(30);
165   l_next_line_case          VARCHAR2(30);
166   l_next_line_string        VARCHAR2(2000);
167   l_curr_line_string        VARCHAR2(2000);
168   l_dummy_exception         EXCEPTION;
169   l_structure               VARCHAR2(2000);
170 
171   BEGIN
172     --------------------------------
173     -- Initialize variables for line
174     --------------------------------
175     g_line_segment_counter     := 0;
176     g_element_in_segment_count := 0;
177     g_last_portion_prev_string := '';
178     g_retrieve_another_segment := 'Y';
179 
180     -------------------------------------------------------------
181     -- If is the first line to be read in the file then retrieve
182     -- it from file, if not, then retrieve it from the buffer
183     -- retrieved in the previous cycle.
184     -- This is done to be able to determine, based on current
185     -- and next lines, if the line is end of case or file.
186     -------------------------------------------------------------
187     IF g_initial_file_reading_flag = 'Y' THEN
188       -------------------------------------------------
189       -- Get a Line from the file and put it in buffer
190       -------------------------------------------------
191       UTL_FILE.GET_LINE ( g_file,
192                           g_line_buffer);
193       x_return_status := 'SUCCESS';
194       g_initial_file_reading_flag := 'N';
195     ELSE
196       -------------------------------------------------
197       -- Get the Line from the previous iteration.
198       -------------------------------------------------
199       g_line_buffer   := g_next_line_buffer;
200       x_return_status := g_next_line_return_status;
201     END IF;
202 
203     ----------------------------------------------------------------------------
204     -- Identify what kind of data is being read from datafile
205     -- If row is a header row, skip it, set the data section, discard current
206     -- line and read next line.
207     ----------------------------------------------------------------------------
208     x_current_datafile_section := g_current_datafile_section;
209     l_curr_line_string := substr(g_line_buffer,1,1000);
210     IF substr(l_curr_line_string,1,28)     = '<DATA HEADER ROW:INPUT DATA>' THEN
211       x_current_datafile_section := 'INPUT_DATA';
212       g_current_datafile_section := 'INPUT_DATA';
213       ---------------------------
214       -- Get a Line from the file.
215       ---------------------------
216       UTL_FILE.GET_LINE ( g_file,
217                           g_line_buffer);
218       x_return_status := 'SUCCESS';
219       l_curr_line_string := substr(g_line_buffer,1,1000);
220     ELSIF substr(l_curr_line_string,1,38)  = '<DATA HEADER ROW:EXPECTED OUTPUT DATA>' THEN
221       -----------------------------------------------------------------------------
222       -- If the seccion is Output_data means ends of input data. Reading completed.
223       -- as if file is over.
224       -----------------------------------------------------------------------------
225       x_current_datafile_section := 'OUTPUT_DATA';
226       g_current_datafile_section := 'OUTPUT_DATA';
227       l_curr_line_string := substr(g_line_buffer,1,1000);
228       RAISE l_dummy_exception;
229     END IF;
230 
231     ---------------------------------------------------------------------------
232     -- Assign the counter of the lines read from file. Header rows do not count
233     ---------------------------------------------------------------------------
234     g_file_curr_line_counter := g_file_curr_line_counter + 1;
235 
236     ----------------------------------------------------------------
237     --Identify all the basic information of the current row
238     ----------------------------------------------------------------
239     x_line_suite     :=           GET_NTH_ELEMENT(1,l_curr_line_string,g_separator);
240     x_line_case      :=           GET_NTH_ELEMENT(2,l_curr_line_string,g_separator);
241     x_line_api       :=           GET_NTH_ELEMENT(4,l_curr_line_string,g_separator);
242     x_line_task      :=           GET_NTH_ELEMENT(8,l_curr_line_string,g_separator);
243     x_line_structure :=           GET_NTH_ELEMENT(9,l_curr_line_string,g_separator);
244     x_line_counter   := g_file_curr_line_counter;
245 
246     --------------------------------------------------------------
247     -- Retreives the next line and put it on buffer for next cycle.
248     --------------------------------------------------------------
249     BEGIN
250       -----------------------------------
251       -- Get the next line from the file.
252       -----------------------------------
253       UTL_FILE.GET_LINE ( g_file,
254                           g_next_line_buffer);
255       g_next_line_return_status := 'SUCCESS';
256       l_next_line_string := substr(g_next_line_buffer,1,1000);
257 
258       --------------------------------------------------------------------------
259       -- If the Row is an Output Row, it will not consider this row, skip it and
260       -- retrieve the next row.
261       --------------------------------------------------------------------------
262       IF SUBSTR(GET_NTH_ELEMENT(9,l_next_line_string,g_separator),1,16) = 'STRUCTURE_OUTPUT' THEN
263         LOOP
264           l_structure :=  SUBSTR(GET_NTH_ELEMENT(9,l_next_line_string,g_separator),1,16);
265           IF l_structure = 'STRUCTURE_OUTPUT' THEN
266             write_message('Skiping Line '||GET_NTH_ELEMENT(9,l_next_line_string,g_separator)||' not used for calculations.');
267             ---------------------------
268             -- Get a Line from the file.
269             ---------------------------
270             UTL_FILE.GET_LINE ( g_file,
271                                 g_next_line_buffer);
272             x_return_status := 'SUCCESS';
273             l_next_line_string := substr(g_next_line_buffer,1,1000);
274           ELSE
275             EXIT;
276           END IF;
277         END LOOP;
278       END IF;
279       --------------------------------------
280       -- Retrieve the next Suite and Case
281       --------------------------------------
282       l_next_line_suite := GET_NTH_ELEMENT(1,l_next_line_string,g_separator);
283       l_next_line_case  := GET_NTH_ELEMENT(2,l_next_line_string,g_separator);
284 
285     EXCEPTION
286       WHEN l_dummy_exception THEN
287         x_return_status := 'FAILURE';
288       WHEN OTHERS THEN
289         g_next_line_return_status := 'FAILURE';
290     END;
291 
292     ---------------------------------------------------------------
293     -- Determines if current line is end of Case or end of File
294     ---------------------------------------------------------------
295     IF (x_line_suite <> l_next_line_suite) or
296        (x_line_case  <> l_next_line_case ) or
297        (g_next_line_return_status = 'FAILURE') or
298        (substr(l_next_line_string,1,38)  = '<DATA HEADER ROW:EXPECTED OUTPUT DATA>') THEN
299         x_line_is_end_of_case := 'Y';
300     ELSE
301         x_line_is_end_of_case := 'N';
302     END IF;
303     -------------------------------------------------------------------------------------
304     -- If next line is expected output set the info to end of data
305     -------------------------------------------------------------------------------------
306     IF (substr(l_next_line_string,1,38)  = '<DATA HEADER ROW:EXPECTED OUTPUT DATA>') THEN
307       g_next_line_return_status := 'FAILURE';
308     END IF;
309 
310   EXCEPTION
311     WHEN OTHERS THEN
312       x_return_status := 'FAILURE';
313 
314   END read_line;
315 
316 
317 /* ===========================================================================*
318  | PROCEDURE get_next_element_in_row : From the line in buffer retrieves next |
319  |                                     element                                |
320  * ===========================================================================*/
321 
322   PROCEDURE get_next_element_in_row
323     (
324       x_element               OUT NOCOPY VARCHAR2 ,
325       x_return_status         OUT NOCOPY VARCHAR2
326 	) IS
327   l_value           VARCHAR2(4000);
328   l_text            VARCHAR2(4000);
329   l_start_string    NUMBER;
330   l_end_string      NUMBER;
331   l_separator       VARCHAR2(1);
332   l_first_separator_position NUMBER;
333   l_return_status   VARCHAR2(2000);
334 
335   BEGIN
336     l_separator  := g_separator;
337     l_first_separator_position := 0;
338 
339     -----------------------------------------------
340     -- Retrieves a segment of 1000 chars if needed.
341     -----------------------------------------------
342     l_value := null;
343     x_return_status := 'IN PROGRESS';
344     retrieve_another_segment(l_return_status);
345     IF l_return_status <> 'COMPLETED' THEN
346       l_end_string   := instr(g_line_segment_string,l_separator,1);
347       IF l_end_string > 0 THEN
348          l_value               := substr(g_line_segment_string,1,l_end_string-1);
349          g_line_segment_string := substr(g_line_segment_string,l_end_string+1,1001);
350       ELSE
351          g_retrieve_another_segment := 'Y';
352          retrieve_another_segment(l_return_status);
353          IF l_return_status <> 'COMPLETED' THEN
354            If substr(g_line_segment_string,1,1) = l_separator THEN
355              g_line_segment_string := substr(g_line_segment_string,1,1000);
356            END IF;
357            l_end_string   := instr(g_line_segment_string,l_separator,1);
358            l_value        := substr(g_line_segment_string,1,l_end_string-1);
359            g_line_segment_string := substr(g_line_segment_string,l_end_string+1,1000);
360            x_return_status := 'IN PROGRESS';
361          ELSE
362            l_value := null;
363            x_return_status := 'COMPLETED';
364          END IF;
365       END IF;
366       g_last_portion_prev_string := g_line_segment_string;
367       x_element := l_value;
368       IF l_value is NULL and g_line_segment_string is not null THEN
369         x_element := g_line_segment_string;
370         x_return_status := 'COMPLETED';
371       END IF;
372     ELSE
373       x_element := null;
374       x_return_status := 'COMPLETED';
375     END IF;
376   END get_next_element_in_row;
377 
378 
379 /* ============================================================================*
380  | PROCEDURE surrogate_key: Populate the surrogate keys                        |
381  * ===========================================================================*/
382   PROCEDURE surrogate_key (
383                            p_surrogate_key IN VARCHAR2,
384                            x_real_value    OUT NOCOPY NUMBER,
385                            p_type          IN VARCHAR2 )
386   IS
387 
388   BEGIN
389     IF p_surrogate_key IS NOT NULL THEN
390       ----------------------------------------------------------------
391       -- Generates the real key based on the type of the surrogate key
392       ----------------------------------------------------------------
393       IF p_type = 'HEADER' THEN
394         --SELECT zx_trx_header_id_s.nextval
395         SELECT zx_transaction_s.nextval
396         INTO   x_real_value
397         FROM   DUAL;
398         --------------------------------------------------------
399         -- This value has been harcoded to test with Nilesh data
400         --------------------------------------------------------
401       ELSIF p_type = 'LINE' THEN
402         --SELECT zx_trx_line_id_s.nextval
403         SELECT zx_transaction_lines_s.nextval
404         INTO   x_real_value
405         FROM   DUAL;
406         --------------------------------------------------------
407         -- This value has been harcoded to test with Nilesh data
408         --------------------------------------------------------
409       ELSIF p_type = 'DIST' THEN
410         --SELECT zx_trx_line_dist_id_s.nextval
411         SELECT zx_sim_trx_dists_s.nextval
412         INTO   x_real_value
413         FROM   DUAL;
414       END IF;
415       write_message('~      Surrogate Key '||to_char(p_surrogate_key));
416       write_message('~      has been substituted for the generated key :'
417                                  ||to_char(x_real_value));
418       write_message('~      of type: '||p_type);
419     END IF;
420   END surrogate_key;
421 
422 
423 /* ============================================================================*
424  | PROCEDURE check_surrogate_key   : Checks the existence of surrogate key     |
425  * ===========================================================================*/
426   PROCEDURE check_surrogate_key (p_key   IN VARCHAR2,
427                                  x_value OUT NOCOPY NUMBER,
428                                  p_type  IN VARCHAR2)
429   IS
430 
431    surrogate_key_not_found_exp   EXCEPTION;
432 
433   BEGIN
434     IF p_key is not null THEN
435       ------------------------------------------------------------------------
436       -- Retrieves the already generated real key based on the type of the
437       -- surrogate key
438       ------------------------------------------------------------------------
439       IF p_type = 'HEADER' THEN
440          IF (g_surr_trx_id_tbl.exists(p_key)) THEN
441             x_value := g_surr_trx_id_tbl(p_key);
442          ELSE
443             RAISE surrogate_key_not_found_exp;
444          END IF;
445       ELSIF p_type = 'LINE' THEN
446         IF (g_surr_trx_line_id_tbl.exists(p_key)) THEN
447           x_value := g_surr_trx_line_id_tbl(p_key);
448         ELSE
449           RAISE surrogate_key_not_found_exp;
450         END IF;
451       ELSIF p_type = 'DIST' THEN
452         IF (g_surr_trx_dist_id_tbl.exists(p_key)) THEN
453           x_value := g_surr_trx_dist_id_tbl(p_key);
454         ELSE
455           RAISE surrogate_key_not_found_exp;
456         END IF;
457       END IF;
458       write_message('~           Surrogate Key '||to_char(p_key));
459       write_message('~           has been substituted for the already generated key :'||to_char(x_value));
460       write_message('~           of type: '||p_type);
461 
462     END IF;
463 
464     EXCEPTION
465       WHEN surrogate_key_not_found_exp THEN
466          write_message('~           Expected already Surrogate Key was not found');
467          write_message('~           Surrogate Key '||to_char(p_key));
468          write_message('~           of type: '||p_type||' not found');
469          write_message('~           It will be generated...');
470          surrogate_key (p_surrogate_key => p_key,
471                         x_real_value    => x_value,
472                         p_type          => p_type);
473          Return;
474 
475   END check_surrogate_key;
476 
477 
478 /* =====================================================================================*
479  | PROCEDURE break_user_key_into_segments: Breaks into segments a string for User Keys  |
480  * =====================================================================================*/
481   PROCEDURE break_user_key_into_segments (
482                                           p_string             IN VARCHAR2,
483                                           p_separator          IN VARCHAR2,
484                                           x_number_of_segments OUT NOCOPY NUMBER,
485                                           x_user_key_tbl       OUT NOCOPY user_keys_segments_tbl_type) IS
486   l_counter            INTEGER;
487   l_string             VARCHAR2(2000);
488   l_separator_position NUMBER;
489   l_last_segment_flag  VARCHAR2(1);
490   BEGIN
491     l_string := p_string;
492     FOR l_counter in 1..1000 LOOP
493       l_separator_position := INSTR(l_string,p_separator,1,1);
494       IF nvl(l_separator_position,0) = 0 THEN
495         l_last_segment_flag := 'Y';
496         l_separator_position := 2000;
497       END IF;
498       x_user_key_tbl(l_counter) := substr(l_string,1,l_separator_position-1);
499       x_number_of_segments := l_counter;
500       l_string := substr(l_string,l_separator_position+1,2000);
501       IF l_last_segment_flag = 'Y' THEN
502         EXIT;
503       END IF;
504     END LOOP;
505   END break_user_key_into_segments;
506 
507 
508 /* ============================================================================*
509  | PROCEDURE get_user_key_id: Retrieve the ID for the User Keys                |
510  |                                                                             |
511  | NOTES:                                                                      |
512  |        This procedure retrieves the ID for any given user key.              |
513  |        The user key values come in a single string separated by a colon.    |
514  |        That string has to be separated in the different elements of the user|
515  |        key.                                                                 |
516  |        Example for Batch Source (Actually Batch Source will be different,but|
517  |                                  lets show it just as example):             |
518  |                                                                             |
519  |          USER KEY string for BATCH_SOURCE_ID  -->  'MyBatchName:MyOrg_id'   |
520  |                                                                             |
521  |          1) Break the string in 'MyBatchName' and 'MyOrg_id'                |
522  |          2) Retrieve the BATCH_SOURCE_ID from RA_BATCH_SOURCES where        |
523  |             name = 'MyBatchName' and org_id = 'MyOrg_id'                    |
524  |          3) If User Key not found raise and error.                          |
525  |                                                                             |
526  |        The procedure will retrieve the User Keys for the following:         |
527  |                                                                             |
528  |                                                                             |
529  |           BATCH_SOURCE_ID                                                   |
530  |           INTERNAL_ORGANIZATION_ID                                          |
531  |           APPLICATION_ID                                                    |
532  |           REF_DOC_APPLICATION_ID                                            |
533  |           RELATED_DOC_APPLICATION_ID                                        |
534  |           APPLIED_DOC_APPLICATION_ID                                        |
535  |           APPLIED_TO_APPLICATION_ID                                         |
536  |           APPLIED_FROM_APPLICATION_ID                                       |
537  |           ADJUSTED_DOC_APPLICATION_ID                                       |
538  |           LEDGER_ID                                                         |
539  |           LEGAL_ENTITY_ID                                                   |
540  |           ROUNDING_SHIP_TO_PARTY_ID                                         |
541  |           ROUNDING_SHIP_FROM_PARTY_ID                                       |
542  |           ROUNDING_BILL_TO_PARTY_ID                                         |
543  |           ROUNDING_BILL_FROM_PARTY_ID                                       |
544  |           SHIP_FROM_PARTY                                                   |
545  |           SHIP_TO_PARTY                                                     |
546  |           POA_PARTY_ID                                                      |
547  |           POO_PARTY_ID                                                      |
548  |           BILL_TO_PARTY_ID                                                  |
549  |           BILL_FROM_PARTY_ID                                                |
550  |           MERCHANT_PARTY_ID                                                 |
551  |           PAYING_PARTY_ID                                                   |
552  |           OWN_HQ_PARTY_ID                                                   |
553  |           SHIP_TO_LOCATION_ID                                               |
554  |           SHIP_FROM_LOCATION_ID                                             |
555  |           POA_LOCATION_ID                                                   |
556  |           POO_LOCATION_ID                                                   |
557  |           BILL_TO_LOCATION_ID                                               |
558  |           BILL_FROM_LOCATION_ID                                             |
559  |           PAYING_LOCATION_ID                                                |
560  |           OWN_HQ_LOCATION_ID                                                |
561  |           POI_LOCATION_ID                                                   |
562  |           ACCOUNT_STRING                                                    |
563  |           DOC_SEQ_ID                                                        |
564  |           RNDG_SHIP_TO_PARTY_SITE_ID                                        |
565  |           RNDG_SHIP_FROM_PARTY_SITE_ID                                      |
566  |           RNDG_BILL_TO_PARTY_SITE_ID                                        |
567  |           RNDG_BILL_FROM_PARTY_SITE_ID                                      |
568  |           SHIP_TO_PARTY_SITE_ID                                             |
569  |           SHIP_FROM_PARTY_SITE_ID                                           |
570  |           POA_PARTY_SITE_ID                                                 |
571  |           POO_PARTY_SITE_ID                                                 |
572  |           BILL_TO_PARTY_SITE_ID                                             |
573  |           BILL_FROM_PARTY_SITE_ID                                           |
574  |           PAYING_PARTY_SITE_ID                                              |
575  |           OWN_HQ_PARTY_SITE_ID                                              |
576  |           TRADING_HQ_PARTY_SITE_ID                                          |
577  |                                                                             |
578  * ===========================================================================*/
579   PROCEDURE get_user_key_id (
580                               p_user_key_string IN VARCHAR2,
581                               p_user_key_type   IN VARCHAR2,
582                               x_user_key_id     OUT NOCOPY NUMBER
583                               )
584   IS
585   l_user_key_segments_tbl user_keys_segments_tbl_type;
586   l_separator             VARCHAR2(1);
587   l_number_of_segments    NUMBER;
588   l_varchar2_id           VARCHAR2(1000);
589   l_varchar2_id1          VARCHAR2(1000);
590   l_num_id                NUMBER;
591   l_chrt_acct_id          hr_all_organization_units.business_group_id%type;
592   l_table_name            zx_party_types.party_source_table%type;
593   l_party_type            zx_party_types.party_type_code%type;
594   l_party_number          hz_parties.party_number%type;
595   l_name                  xle_entity_profiles.name%type;
596   l_flow                  VARCHAR2(2000);
597 
598   BEGIN
599       l_separator := ':';
600 
601     --------------------------------------------------------
602     -- Determine the Flow of the Scenario. (P2P or OTC)
603     -- From zx_evnt_cls_mappings (g_party_rec)
604     --------------------------------------------------------
605     l_flow := g_party_rec.prod_family_grp_code;
606 
607 
608     IF p_user_key_string IS NOT NULL THEN
609       ------------------------------------------------------
610       -- Gets user key for BATCH_SOURCE_NAME
611       -- the LOV used is BATCH_SOURCE_NAME_LOV
612       -- and the segments in user key string are:
613       --     Segment 1 is NAME
614       --     Segment 2 is ORG_ID
615       -- Returns BATCH SOURCE ID
616       ------------------------------------------------------
617       IF p_user_key_type = 'BATCH_SOURCE_NAME' THEN
618         break_user_key_into_segments(p_user_key_string,
619                                      l_separator,
620                                      l_number_of_segments,
621                                      l_user_key_segments_tbl);
622         l_varchar2_id   :=           l_user_key_segments_tbl(1);
623         l_num_id := to_number(l_user_key_segments_tbl(2));
624 
625         -----------------------------------------
626         -- Retrieves the Batch Source Id
627         -----------------------------------------
628         BEGIN
629           select batch_source_id
630           into   x_user_key_id
631           from   ra_batch_sources_all
632           where  org_id = l_num_id
633           and    name   = l_varchar2_id;
634         EXCEPTION
635           WHEN NO_DATA_FOUND THEN
636           FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
637           FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','BATCH_SOURCE_ID: '||sqlerrm);
638           write_message(substr(fnd_message.get,1,200));
639           FND_MSG_PUB.Add;
640             x_user_key_id := -9999;
641           WHEN OTHERS THEN
642           FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
643           FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','BATCH_SOURCE_ID: '||sqlerrm);
644           write_message(substr(fnd_message.get,1,200));
645           FND_MSG_PUB.Add;
646             x_user_key_id := -9999;
647         END;
648       END IF;
649 
650       ------------------------------------------------------
651       -- Gets user key for INTERNAL_ORGANIZATION_ID
652       -- the LOV used is   ORGANIZATION_LOV
653       -- and the segments in user key string are:
654       --     Segment 1 is NAME
655       --     Segment 2 is BUSINESS_GROUP_ID (ORG_ID)
656       ------------------------------------------------------
657       IF p_user_key_type = 'INTERNAL_ORGANIZATION_ID' THEN
658         break_user_key_into_segments(p_user_key_string,
659                                      l_separator,
660                                      l_number_of_segments,
661                                      l_user_key_segments_tbl);
662         l_varchar2_id := l_user_key_segments_tbl(1);
663         l_num_id := to_number(l_user_key_segments_tbl(2));
664 
665         -----------------------------------------
666         -- Retrieves the Internal Organization Id
667         -----------------------------------------
668         BEGIN
669           select organization_id
670           into   x_user_key_id
671           from   hr_all_organization_units
672           where  business_group_id = l_num_id
673           and    name   = l_varchar2_id;
674         EXCEPTION
675           WHEN NO_DATA_FOUND THEN
676           FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
677           FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','INTERNAL_ORG_ID: '||sqlerrm);
678           write_message(substr(fnd_message.get,1,200));
679           FND_MSG_PUB.Add;
680             x_user_key_id := -9999;
681           WHEN OTHERS THEN
682           FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
683           FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','INTERNAL_ORG_ID: '||sqlerrm);
684           write_message(substr(fnd_message.get,1,200));
685           FND_MSG_PUB.Add;
686             x_user_key_id := -9999;
687         END;
688       END IF;
689 
690       ------------------------------------------------------
691       -- Gets user key for APPLICATION_ID
692       --                   REF_DOC_APPLICATION_ID
693       --                   RELATED_DOC_APPLICATION_ID
694       --                   APPLIED_DOC_APPLICATION_ID
695       --                   APPLIED_TO_APPLICATION_ID
696       --                   APPLIED_FROM_APPLICATION_ID
697       --                   ADJUSTED_DOC_APPLICATION_ID
698       -- the LOV used is   APPLICATION_ID_LOV
699       -- and the segments in user key string are:
700       --     Segment 1 is APPLICATION_NAME
701       ------------------------------------------------------
702       IF p_user_key_type in( 'APPLICATION_ID',
703                              'REF_DOC_APPLICATION_ID',
704                              'RELATED_DOC_APPLICATION_ID',
705                              'APPLIED_DOC_APPLICATION_ID',
706                              'APPLIED_TO_APPLICATION_ID',
707                              'APPLIED_FROM_APPLICATION_ID',
708                              'ADJUSTED_DOC_APPLICATION_ID')
709       THEN
710         break_user_key_into_segments(p_user_key_string,
711                                      l_separator,
712                                      l_number_of_segments,
713                                      l_user_key_segments_tbl);
714         l_varchar2_id := l_user_key_segments_tbl(1);
715 
716         -----------------------------------------
717         -- Retrieves the Application ID
718         -----------------------------------------
719         BEGIN
720           select application_id
721           into   x_user_key_id
722           from   fnd_application
723           where  application_short_name = l_varchar2_id;
724 
725         EXCEPTION
726           WHEN NO_DATA_FOUND THEN
727           FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
728           FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','Error for '||p_user_key_type||' '||sqlerrm);
729           write_message(substr(fnd_message.get,1,200));
730           FND_MSG_PUB.Add;
731             x_user_key_id := -9999;
732           WHEN OTHERS THEN
733           FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
734           FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','Error for '||p_user_key_type||' '||sqlerrm);
735           write_message(substr(fnd_message.get,1,200));
736           FND_MSG_PUB.Add;
737             x_user_key_id := -9999;
738         END;
739       END IF;
740 
741       -------------------------------------------------------
742       -- Gets user key for LEDGER_ID (Former SET_OF_BOOKS_ID)
743       -- the LOV used is   LEDGER_ID_LOV
744       -- and the segments in user key string are:
745       --     Segment 1 is NAME
746       -------------------------------------------------------
747       IF p_user_key_type = 'LEDGER_ID' THEN
748         ------------------------------------------
749         -- Break the User Key String into Segments
750         -- Segment 1 is NAME
751         ------------------------------------------
752         break_user_key_into_segments(p_user_key_string,
753                                      l_separator,
754                                      l_number_of_segments,
755                                      l_user_key_segments_tbl);
756         l_varchar2_id := l_user_key_segments_tbl(1);
757 
758 
759         ----------------------------------------------------
760         -- Retrieves the LEDGER_ID (Former SET_OF_BOOKS_ID)
761         ----------------------------------------------------
762         BEGIN
763           select set_of_books_id
764           into   x_user_key_id
765           from   gl_sets_of_books
766           where  name = l_varchar2_id;
767 
768         EXCEPTION
769           WHEN NO_DATA_FOUND THEN
770           FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
771           FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','LEDGER_ID: '||sqlerrm);
772           write_message(substr(fnd_message.get,1,200));
773           FND_MSG_PUB.Add;
774             x_user_key_id := -9999;
775           WHEN OTHERS THEN
776           FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
777           FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','LEDGER_ID: '||sqlerrm);
778           write_message(substr(fnd_message.get,1,200));
779           FND_MSG_PUB.Add;
780             x_user_key_id := -9999;
781         END;
782       END IF;
783 
784       ------------------------------------------------------
785       -- Gets user key for LEGAL_ENTITY_ID
786       -- the LOV used is   LEGAL_ENTITY_LOV
787       -- and the segments in user key string are:
788       --     Segment 1 is PARTY_NAME   (Comes from XLE_ENTITY_PROFILES.NAME)
789       --     Segment 2 is PARTY_NUMBER (Comes from HZ_PARTIES.PARTY_NUMBER)
790       ------------------------------------------------------
791 
792       IF p_user_key_type = 'LEGAL_ENTITY_ID' THEN
793         break_user_key_into_segments(p_user_key_string,
794                                      l_separator,
795                                      l_number_of_segments,
796                                      l_user_key_segments_tbl);
797 
798         l_name         := l_user_key_segments_tbl(1);
799         --------------------------------------------------------
800         --Name can be entered with Uppercase errors, so will
801         --convert name to uppercaase only.
802         --------------------------------------------------------
803         l_name         := upper(l_name);
804         If nvl(l_number_of_segments,1) > 1 then
805           l_party_number := l_user_key_segments_tbl(2);
806         Else
807           -------------------------------------------------------
808           -- It is required to receive the Party Name and Number
809           -- if not raise an error.
810           -------------------------------------------------------
811            RAISE_APPLICATION_ERROR (-20000,'
812  Error: To derive LEGAL_ENTITY_ID the Party Name and Party Number are required.
813         The user Key that has been passed is:'||p_user_key_string||'
814         Please review that value for LEGAL_ENTITY_ID is in the format PARTY_NAME:PARTY_NUMBER
815         Review your datafile *.dat and your MASTER_SETUP.xls files');
816 
817         End If;
818 
819         -----------------------------------------
820         -- Retrieves the Legal Entity ID
821         -----------------------------------------
822         BEGIN
823           ----------------------------------------------
824           -- From BTT User will select from an LOV that
825           -- Shows Legal Entity Name and Party Number.
826           -- The Party Name is duplicated as there
827           -- is a row with the same name for Main Legal Establishment
828           -- and one row same name for the Legal entity itself. The
829           -- Party Number is unique and this will distinguish the rows.
830           -- However xle_entity_profiles does not contain party_number. This
831           -- is why is required to go and join with hz_parties.
832           -- Discussed with Desh on 11-Nov-2005
833           ----------------------------------------------
834 
835           select xle_ep.legal_entity_id
836           into   x_user_key_id
837           from   xle_entity_profiles xle_ep,
838                  hz_parties          hz_pty
839           where  xle_ep.party_id     = hz_pty.party_id
840           and    upper(xle_ep.name)  = l_name
841           and    hz_pty.party_number = l_party_number;
842 
843         EXCEPTION
844           WHEN NO_DATA_FOUND THEN
845             FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
846             FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','LEGAL ENTITY ID: '||sqlerrm);
847             write_message(substr(fnd_message.get,1,200));
848             FND_MSG_PUB.Add;
849             RAISE_APPLICATION_ERROR (-20000,'Error while calculating LEGAL_ENTITY_ID with user key'||p_user_key_string|| sqlerrm);
850 
851           WHEN OTHERS THEN
852             FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
853             FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','LEGAL ENTITY ID: '||sqlerrm);
854             write_message(substr(fnd_message.get,1,200));
855             FND_MSG_PUB.Add;
856             RAISE_APPLICATION_ERROR (-20000, 'Error while calculating LEGAL_ENTITY_ID with user key'||p_user_key_string||sqlerrm);
857         END;
858       END IF;
859 
860       -----------------------------------------------------------
861       -- Gets user key for ROUNDING_SHIP_TO_PARTY_ID
862       --                   ROUNDING_SHIP_FROM_PARTY_ID
863       --                   ROUNDING_BILL_TO_PARTY_ID
864       --                   ROUNDING_BILL_FROM_PARTY_ID
865       --                   SHIP_FROM_PARTY_ID
866       --                   SHIP_TO_PARTY_ID
867       --                   POA_PARTY_ID
868       --                   POO_PARTY_ID
869       --                   BILL_TO_PARTY_ID
870       --                   BILL_FROM_PARTY_ID
871       --                   MERCHANT_PARTY_ID
872       --                   PAYING_PARTY_ID
873       --
874       --
875       -- the LOV used is   HZPARTIES_POVENDORS
876       -- This User Key is a special case.
877       -- Depending of the mapping of ZX_EVENT_CLS_MAPPINGS and
878       -- value in table ZX_PARTY_TYPES, for
879       -- every user_key, will be chosen a from either
880       -- HZ_PARTIES or PO_VENDORS, so we have the following:
881       -- If PO_VENDORS the segments in user key are:
882       --     Segment 1 is VENDOR_NAME
883       --     Segment 2 is VENDOR_SITE_CODE
884       --     Segment 3 is ORG_ID
885       -- If HZ_PARTIES the segments in user key are:
886       --     Segment 1 is PARTY_SITE_NUMBER
887       --     Segment 2 is PARTY_SITE_NAME
888       -----------------------------------------------------------
889       IF p_user_key_type in ('ROUNDING_SHIP_TO_PARTY_ID',
890                              'ROUNDING_SHIP_FROM_PARTY_ID',
891                              'ROUNDING_BILL_TO_PARTY_ID',
892                              'ROUNDING_BILL_FROM_PARTY_ID',
893                              'SHIP_FROM_PARTY_ID',
894                              'SHIP_TO_PARTY_ID',
895                              'POA_PARTY_ID',
896                              'POO_PARTY_ID',
897                              'BILL_TO_PARTY_ID',
898                              'BILL_FROM_PARTY_ID',
899                              'MERCHANT_PARTY_ID'
900                              )
901       THEN
902         break_user_key_into_segments(p_user_key_string,
903                                      l_separator,
904                                      l_number_of_segments,
905                                      l_user_key_segments_tbl);
906 
907         BEGIN
908           ---------------------------------------------
909           -- RETRIEVE THE PARTY TYPE FOR THE USER KEY
910           ---------------------------------------------
911           IF    p_user_key_type  = 'ROUNDING_SHIP_TO_PARTY_ID'
912             THEN l_party_type := g_party_rec.SHIP_TO_PARTY_TYPE;
913 
914           ELSIF p_user_key_type  = 'ROUNDING_SHIP_FROM_PARTY_ID'
915             THEN l_party_type := g_party_rec.SHIP_FROM_PARTY_TYPE;
916 
917           ELSIF p_user_key_type =  'ROUNDING_BILL_TO_PARTY_ID'
918             THEN l_party_type := g_party_rec.BILL_TO_PARTY_TYPE;
919 
920           ELSIF p_user_key_type  = 'ROUNDING_BILL_FROM_PARTY_ID'
921             THEN l_party_type := g_party_rec.BILL_FROM_PARTY_TYPE;
922 
923           ELSIF p_user_key_type           = 'SHIP_FROM_PARTY_ID'
924             THEN l_party_type := g_party_rec.SHIP_FROM_PARTY_TYPE;
925 
926           ELSIF p_user_key_type           = 'SHIP_TO_PARTY_ID'
927             THEN l_party_type := g_party_rec.SHIP_TO_PARTY_TYPE;
928 
929           ELSIF p_user_key_type           = 'POA_PARTY_ID'
930             THEN l_party_type := g_party_rec.POA_PARTY_TYPE;
931 
932           ELSIF p_user_key_type           = 'POO_PARTY_ID'
933             THEN l_party_type := g_party_rec.POO_PARTY_TYPE;
934 
935           ELSIF p_user_key_type           = 'BILL_TO_PARTY_ID'
936             THEN l_party_type := g_party_rec.BILL_TO_PARTY_TYPE;
937 
938           ELSIF p_user_key_type           = 'BILL_FROM_PARTY_ID'
939             THEN l_party_type := g_party_rec.BILL_FROM_PARTY_TYPE;
940 
941           ELSIF p_user_key_type           = 'OWN_HQ_PARTY_ID'
942             THEN l_party_type := g_party_rec.OWN_HQ_PARTY_TYPE;
943           END IF;
944 
945           write_message('~      To Retrieve the ID for the user key of:'||p_user_key_type);
946           write_message('~      we will use the l_party_type:'||l_party_type);
947 
948           BEGIN
949             SELECT upper(party_source_table)
950             INTO   l_table_name
951             FROM   zx_party_types
952             WHERE  party_type_code = l_party_type;
953           EXCEPTION
954             WHEN OTHERS THEN l_table_name := null;
955           END;
956 
957           write_message('~      we have obtained the table:'||l_table_name||' to be used as source');
958 
959           IF  l_table_name = 'PO_VENDORS' THEN
960             ------------------------------------------------------------
961             -- Retrieves the user_key_id using PO_VENDORS
962             ------------------------------------------------------------
963             l_varchar2_id      := l_user_key_segments_tbl(1);
964 
965             select vendor_id
966             into   x_user_key_id
967             from   ap_suppliers
968             where  vendor_name = l_varchar2_id;
969 
970           ELSIF l_table_name = 'HZ_PARTIES' THEN
971             ------------------------------------------------------------
972             -- Retrieves the user_key_id using HZ_PARTIES.
973             -- We have two cases. User Key with one Value and Two Values
974             -- If we have User Key with One Value:
975             --   Segment1 => Party Number (From HZ_PARTIES.PARTY_NUMBER)
976             -- If we have User Key with Two Values:
977             --  Segment1 => Name         (From XLE_ENTITY_PROFILES.NAME)
978             --  Segment2 => Party Number (From HZ_PARTIES.PARTY_NUMBER)
979             ------------------------------------------------------------
980             If nvl(l_number_of_segments,1) = 1 then
981                l_varchar2_id := l_user_key_segments_tbl(1);
982             Else
983                l_varchar2_id := l_user_key_segments_tbl(2);
984 			End if;
985 
986             BEGIN
987               Select party_id
988               into   x_user_key_id
989               from   hz_parties
990               where  party_number = l_varchar2_id;
991 
992             EXCEPTION
993             WHEN NO_DATA_FOUND THEN
994               select party_id
995               into   x_user_key_id
996               from   hz_parties
997               where  party_name = l_varchar2_id;
998             END;
999           ELSE
1000             RAISE NO_DATA_FOUND;
1001           END IF;
1002         EXCEPTION
1003           WHEN NO_DATA_FOUND THEN
1004 
1005             RAISE_APPLICATION_ERROR (-20000,'
1006 NO_DATA_FOUND Error: To derive '||p_user_key_type||' the Party Number from HZ_PARTIES is required.
1007         The user Key that has been passed is:'||p_user_key_string||'
1008         Please review that value passed is the format PARTY_NUMBER or PARTY_NAME:PARTY_NUMBER
1009         and this value exists in table HZ_PARTIES.
1010         Review your datafile *.dat and your MASTER_SETUP.xls files. The sqlerrm found is
1011 		'||sqlerrm);
1012 
1013 
1014           WHEN OTHERS THEN
1015             RAISE_APPLICATION_ERROR (-20000,'
1016 OTHERS Error: To derive '||p_user_key_type||' the Party Number from HZ_PARTIES is required.
1017         The user Key that has been passed is:'||p_user_key_string||'
1018         Please review that value passed is the format PARTY_NUMBER or PARTY_NAME:PARTY_NUMBER
1019         and this value exists in table HZ_PARTIES.
1020         Review your datafile *.dat and your MASTER_SETUP.xls files. The sqlerrm found is
1021 		'||sqlerrm);
1022         END;
1023       END IF;
1024 
1025 
1026       ------------------------------------------------------
1027       -- Gets user key for SHIP_TO_LOCATION_ID
1028       -- the LOV used is   HR_LOCATIONS for P2P
1029       -- the LOV used is   HZ_LOCATIONS for O2C
1030       -- and the segments in user key string are:
1031       --     Segment 1 is LOCATION_CODE
1032       --     Segment 2 is BUSINESS_GROUP_ID
1033       -- Note: We will use only segment1 we expect user to enter unique value.
1034       ------------------------------------------------------
1035 
1036       IF p_user_key_type = 'SHIP_TO_LOCATION_ID' THEN
1037         -----------------------------------------
1038         -- Retrieves the SHIP_TO_LOCATION_ID
1039         -----------------------------------------
1040         write_message('~      The flow to Calculate Ship to Location is:'||l_flow);
1041         IF l_flow = 'P2P' THEN
1042           write_message('~      Table to get Ship to Location is HR_LOCATIONS');
1043           break_user_key_into_segments(p_user_key_string,
1044                                        l_separator,
1045                                        l_number_of_segments,
1046                                        l_user_key_segments_tbl);
1047           l_varchar2_id := l_user_key_segments_tbl(1);
1048           If nvl(l_number_of_segments,1) > 1 then
1049             l_num_id := to_number(l_user_key_segments_tbl(2));
1050           End If;
1051           -------------------------------------------------------
1052           -- P2P Retrieve SHIP_TO_LOCATION_ID from HR_LOCATIONS
1053           -------------------------------------------------------
1054           BEGIN
1055             IF l_num_id is not null THEN
1056               select ship_to_location_id
1057               into   x_user_key_id
1058               from   hr_locations
1059               where  location_code = l_varchar2_id
1060               and    business_group_id = l_num_id;
1061             ELSE
1062               select ship_to_location_id
1063               into   x_user_key_id
1064               from   hr_locations
1065               where  location_code = l_varchar2_id
1066               and    business_group_id is null;
1067             END IF;
1068           EXCEPTION
1069             WHEN NO_DATA_FOUND THEN
1070               ----------------------------------------------------------------------
1071               -- If no location is found, error out.
1072               ----------------------------------------------------------------------
1073               write_message('No location was found. Please review your data');
1074               FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
1075               FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','SHIP TO LOCATION ID: '||sqlerrm);
1076               write_message(substr(fnd_message.get,1,200));
1077               FND_MSG_PUB.Add;
1078 
1079             WHEN TOO_MANY_ROWS THEN
1080               ----------------------------------------------------------------------
1081               -- If multiple locations are found, error out.
1082               ----------------------------------------------------------------------
1083               write_message('Multiple locations were found. Please review your data');
1084               FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
1085               FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','SHIP TO LOCATION ID: '||sqlerrm);
1086               write_message(substr(fnd_message.get,1,200));
1087               FND_MSG_PUB.Add;
1088 
1089             WHEN OTHERS THEN
1090               ----------------------------------------------------------------------
1091               --If other issue, error out.
1092               ----------------------------------------------------------------------
1093               write_message('Not able to retrieve the Location. Please review your data');
1094               FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
1095               FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','SHIP TO LOCATION ID: '||sqlerrm);
1096               write_message(substr(fnd_message.get,1,200));
1097               FND_MSG_PUB.Add;
1098           END;
1099 
1100         ELSIF l_flow = 'O2C' THEN
1101           write_message('~      Table to get Ship to Location is HZ_LOCATIONS');
1102           break_user_key_into_segments(p_user_key_string,
1103                                        l_separator,
1104                                        l_number_of_segments,
1105                                        l_user_key_segments_tbl);
1106           l_varchar2_id := l_user_key_segments_tbl(1);
1107           If nvl(l_number_of_segments,1) > 1 then
1108             l_varchar2_id1 := l_user_key_segments_tbl(2);
1109           End If;
1110           -------------------------------------------------------
1111           -- O2C Retrieve SHIP_TO_LOCATION_ID from HZ_LOCATIONS
1112           -------------------------------------------------------
1113           BEGIN
1114             select location_id
1115             into   x_user_key_id
1116             from   hz_locations
1117             where  ltrim(rtrim(upper(address1))) = ltrim(rtrim(upper(l_varchar2_id)))
1118             and    upper(city)                   = upper(l_varchar2_id1);
1119           EXCEPTION
1120             WHEN NO_DATA_FOUND THEN
1121               --------------------------------------------------------------------
1122               -- If Location not found, search location by the short description
1123               --------------------------------------------------------------------
1124               BEGIN
1125                 select location_id
1126                 into   x_user_key_id
1127                 from   hz_locations
1128                 where  short_description  = l_varchar2_id;
1129               EXCEPTION
1130                 WHEN NO_DATA_FOUND THEN
1131                   --------------------------------------------------------------------
1132                   -- If location not found, error out
1133                   --------------------------------------------------------------------
1134                   write_message(' No Data Found. Location cannot be found. Please review your data');
1135                   FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
1136                   FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','SHIP TO LOCATION ID: '||sqlerrm);
1137                   write_message(substr(fnd_message.get,1,200));
1138                   FND_MSG_PUB.Add;
1139 
1140                 WHEN OTHERS THEN
1141                   --------------------------------------------------------------------
1142                   -- If location not found, error out
1143                   --------------------------------------------------------------------
1144                   write_message(' Others error. Location cannot be found. Please review your data');
1145                   FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
1146                   FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','SHIP TO LOCATION ID: '||sqlerrm);
1147                   write_message(substr(fnd_message.get,1,200));
1148                   FND_MSG_PUB.Add;
1149 
1150               END;
1151 
1152             WHEN TOO_MANY_ROWS THEN
1153               ----------------------------------------------------------------------
1154               -- If multiple locations are found, the error out.
1155               ----------------------------------------------------------------------
1156               write_message('Multiple locations were found. Please review your data');
1157               FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
1158               FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','SHIP TO LOCATION ID: '||sqlerrm);
1159               write_message(substr(fnd_message.get,1,200));
1160               FND_MSG_PUB.Add;
1161 
1162             WHEN OTHERS THEN
1163               ----------------------------------------------------------------------
1164               -- In multiple locations are found, the error out.
1165               ----------------------------------------------------------------------
1166               write_message('Multiple locations were found. Please review your data');
1167               FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
1168               FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','SHIP TO LOCATION ID: '||sqlerrm);
1169               write_message(substr(fnd_message.get,1,200));
1170               FND_MSG_PUB.Add;
1171 
1172           END;
1173         END IF;
1174       END IF;
1175 
1176       ------------------------------------------------------
1177       -- Gets user key for SHIP_FROM_LOCATION_ID
1178       --                   POA_LOCATION_ID
1179       --                   POO_LOCATION_ID
1180       --                   BILL_TO_LOCATION_ID
1181       --                   BILL_FROM__LOCATION_ID
1182       --                   PAYING_LOCATION_ID
1183       --                   POI_LOCATION_ID
1184       -- the LOV used is   HR_LOCATIONS_LOV
1185       -- and the segments in user key string are:
1186       --     Segment 1 is LOCATION_CODE
1187       --     Segment 2 is BUSINESS_GROUP_ID
1188       ------------------------------------------------------
1189       IF p_user_key_type in ('SHIP_FROM_LOCATION_ID',
1190                              'POA_LOCATION_ID',
1191                              'POO_LOCATION_ID',
1192                              'BILL_TO_LOCATION_ID',
1193                              'BILL_FROM_LOCATION_ID'
1194                              ) THEN
1195         break_user_key_into_segments(p_user_key_string,
1196                                      l_separator,
1197                                      l_number_of_segments,
1198                                      l_user_key_segments_tbl);
1199 
1200         l_varchar2_id := l_user_key_segments_tbl(1);
1201         If nvl(l_number_of_segments,1) > 1 then
1202           l_num_id := to_number(l_user_key_segments_tbl(2));
1203         End If;
1204         -----------------------------------------
1205         -- Retrieves the id for the user key.
1206         -----------------------------------------
1207         BEGIN
1208           IF l_num_id is not null THEN
1209             select location_id
1210             into   x_user_key_id
1211             from   hr_locations
1212             where  location_code = l_varchar2_id
1213             and    business_group_id = l_num_id;
1214           ELSE
1215             select location_id
1216             into   x_user_key_id
1217             from   hr_locations
1218             where  location_code = l_varchar2_id
1219             and    business_group_id is null;
1220           END IF;
1221 
1222         EXCEPTION
1223           WHEN NO_DATA_FOUND THEN
1224 
1225               RAISE_APPLICATION_ERROR (-20000,'
1226 NO_DATA_FOUND Error: To derive '||p_user_key_type||' the Location Code or Location Code and Business Group from HR_LOCATIONS is required.
1227         The user Key that has been passed is:'||p_user_key_string||'
1228         Please review that value passed is the format LOCATION_CODE or LOCATION_CODE:BUSINESS_GROUP_ID and
1229         this value exists in table HR_LOCATIONS.
1230         Review your datafile *.dat, your Spreadsheet and MASTER_SETUP.xls files. The sqlerrm found is
1231 		'||sqlerrm);
1232 
1233 
1234 
1235           WHEN OTHERS THEN
1236               RAISE_APPLICATION_ERROR (-20000,'
1237 OTHERS Error: To derive '||p_user_key_type||' the Location Code or Location Code and Business Group from HR_LOCATIONS is required.
1238         The user Key that has been passed is:'||p_user_key_string||'
1239         Please review that value passed is the format LOCATION_CODE or LOCATION_CODE:BUSINESS_GROUP_ID and
1240         this value exists in table HR_LOCATIONS.
1241         Review your datafile *.dat, your Spreadsheet and MASTER_SETUP.xls files. The sqlerrm found is
1242 		'||sqlerrm);
1243 
1244 
1245         END;
1246       END IF;
1247 
1248       -------------------------------------------------------
1249       -- Gets user key for ACCOUNT_STRING
1250       -- the LOV used is   NONE.
1251       -- and the segments in user key string are:
1252       --     Standard Segments used in the Account String.
1253       -- Notes:
1254       --   This is a special case, there is no LOV associated
1255       --   but user will populate the account string in the
1256       --   field manually. Example '001.3456.14412.32412.001'
1257       --   We use the standard APIs to obtain the CCID
1258       --   The column for CCID will be populated, and the
1259       --   column with the ACCOUNT_STRING will remain with
1260       --   its value.
1261       -------------------------------------------------------
1262       IF p_user_key_type = 'ACCOUNT_STRING' THEN
1263         -----------------------------------------
1264         -- Retrieves the ACCOUNT_CCID
1265         -----------------------------------------
1266         BEGIN
1267 
1268           select chart_of_accounts_id
1269           into   l_chrt_acct_id
1270           from   gl_sets_of_books
1271           where  set_of_books_id = g_suite_rec_tbl.ledger_id(1);
1272 
1273           x_user_key_id := FND_FLEX_EXT.GET_CCID('SQLGL','GL#',l_chrt_acct_id,sysdate,p_user_key_string);
1274 
1275         EXCEPTION
1276           WHEN NO_DATA_FOUND THEN
1277           FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
1278           FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','ACCOUNT_CCID: '||sqlerrm);
1279           write_message(substr(fnd_message.get,1,200));
1280           FND_MSG_PUB.Add;
1281             x_user_key_id := -9999;
1282           WHEN OTHERS THEN
1283           FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
1284           FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','ACCOUNT_CCID: '||sqlerrm);
1285           write_message(substr(fnd_message.get,1,200));
1286           FND_MSG_PUB.Add;
1287             x_user_key_id := -9999;
1288         END;
1289       END IF;
1290 
1291 
1292       ------------------------------------------------------
1293       -- Gets user key for DOC_SEQ_ID
1294       -- the LOV used is   DOC_SEQ_ID_LOV
1295       -- and the segments in user key string are:
1296       --     Segment 1 is NAME
1297       ------------------------------------------------------
1298       IF p_user_key_type = 'DOC_SEQ_ID' THEN
1299       ----------------------------------------------------
1300         break_user_key_into_segments(p_user_key_string,
1301                                      l_separator,
1302                                      l_number_of_segments,
1303                                      l_user_key_segments_tbl);
1304         l_varchar2_id := l_user_key_segments_tbl(1);
1305 
1306         ---------------------------------------------
1307         -- Retrieves the DOC_SEQ_ID
1308         ---------------------------------------------
1309         BEGIN
1310           select doc_sequence_id
1311           into   x_user_key_id
1312           from   FND_DOCUMENT_SEQUENCES
1313           where  name  = l_varchar2_id;
1314 
1315         EXCEPTION
1316           WHEN NO_DATA_FOUND THEN
1317           FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
1318           FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','DOC SEQ ID: '||sqlerrm);
1319           write_message(substr(fnd_message.get,1,200));
1320           FND_MSG_PUB.Add;
1321             x_user_key_id := -9999;
1322           WHEN OTHERS THEN
1323           FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
1324           FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','DOC SEQ ID: '||sqlerrm);
1325           write_message(substr(fnd_message.get,1,200));
1326           FND_MSG_PUB.Add;
1327             x_user_key_id := -9999;
1328         END;
1329       END IF;
1330 
1331       -----------------------------------------------------------
1332       -- Gets user key for RNDG_SHIP_TO_PARTY_SITE_ID
1333       --                   RNDG_SHIP_FROM_PARTY_SITE_ID
1334       --                   RNDG_BILL_TO_PARTY_SITE_ID
1335       --                   RNDG_BILL_FROM_PARTY_SITE_ID
1336       --                   SHIP_TO_PARTY_SITE_ID
1337       --                   SHIP_FROM_PARTY_SITE_ID
1338       --                   POA_PARTY_SITE_ID
1339       --                   POO_PARTY_SITE_ID
1340       --                   BILL_TO_PARTY_SITE_ID
1341       --                   BILL_FROM_PARTY_SITE_ID
1342       --                   PAYING_PARTY_SITE_ID
1343       --                   OWN_HQ_PARTY_SITE_ID
1344       --                   TRADING_HQ_PARTY_SITE_ID
1345       --
1346       --
1347       -- the LOV used is   HZPARTYSITES_POVENDORSITES
1348       -- This User Key is a special case.
1349       -- Depending of the mapping of ZX_EVENT_CLS_MAPPINGS and
1350       -- value in table ZX_PARTY_TYPES, for
1351       -- every user_key, will be chosen a from either
1352       -- HZ_PARTY_SITES or PO_VENDOR_SITES, so we have the following:
1353       -- If PO_VENDOR_SITES the segments in user key are:
1354       --     Segment 1 is VENDOR_NAME
1355       --     Segment 2 is VENDOR_SITE_CODE
1356       --     Segment 3 is ORG_ID
1357       -- If HZ_PARTY_SITES the segments in user key are:
1358       --     Segment 1 is PARTY_SITE_NUMBER
1359       --     Segment 2 is PARTY_SITE_NAME
1360       -----------------------------------------------------------
1361       IF p_user_key_type in ('RNDG_SHIP_TO_PARTY_SITE_ID',
1362                              'RNDG_SHIP_FROM_PARTY_SITE_ID',
1363                              'RNDG_BILL_TO_PARTY_SITE_ID',
1364                              'RNDG_BILL_FROM_PARTY_SITE_ID',
1365                              'SHIP_TO_PARTY_SITE_ID',
1366                              'SHIP_FROM_PARTY_SITE_ID',
1367                              'POA_PARTY_SITE_ID',
1368                              'POO_PARTY_SITE_ID',
1369                              'BILL_TO_PARTY_SITE_ID',
1370                              'BILL_FROM_PARTY_SITE_ID',
1371                              'TRADING_HQ_PARTY_SITE_ID'
1372                              )
1373       THEN
1374         break_user_key_into_segments(p_user_key_string,
1375                                      l_separator,
1376                                      l_number_of_segments,
1377                                      l_user_key_segments_tbl);
1378         --Bug 4306914. The Composite Key was simpified to single key.
1379        /* IF l_number_of_segments = 3 THEN
1380           l_varchar2_id    :=           l_user_key_segments_tbl(1);
1381           l_varchar2_id1   :=           l_user_key_segments_tbl(2);
1382           l_num_id         := to_number(l_user_key_segments_tbl(3));
1383         ELSE
1384           l_varchar2_id    :=           l_user_key_segments_tbl(1);
1385         END IF;*/
1386 
1387           l_varchar2_id    :=           l_user_key_segments_tbl(1);
1388 
1389         ---------------------------------------------
1390         -- Retrieves the RNDG_SHIP_TO_PARTY_SITE_ID
1391         ---------------------------------------------
1392         BEGIN
1393           ---------------------------------------------
1394           -- RETRIEVE THE PARTY TYPE FOR THE USER KEY
1395           ---------------------------------------------
1396           IF    p_user_key_type           = 'RNDG_SHIP_TO_PARTY_SITE_ID'
1397             THEN l_party_type := g_party_rec.ship_to_pty_site_type;
1398           ELSIF p_user_key_type           = 'RNDG_SHIP_FROM_PARTY_SITE_ID'
1399             THEN l_party_type := g_party_rec.ship_from_pty_site_type;
1400           ELSIF p_user_key_type           = 'RNDG_BILL_TO_PARTY_SITE_ID'
1401             THEN l_party_type := g_party_rec.bill_to_pty_site_type;
1402           ELSIF p_user_key_type           = 'RNDG_BILL_FROM_PARTY_SITE_ID'
1403             THEN l_party_type := g_party_rec.bill_from_pty_site_type;
1404           ELSIF p_user_key_type           = 'SHIP_TO_PARTY_SITE_ID'
1405             THEN l_party_type := g_party_rec.ship_to_pty_site_type;
1406           ELSIF p_user_key_type           = 'SHIP_FROM_PARTY_SITE_ID'
1407             THEN l_party_type := g_party_rec.ship_from_pty_site_type;
1408           ELSIF p_user_key_type           = 'POA_PARTY_SITE_ID'
1409             THEN l_party_type := g_party_rec.poa_pty_site_type;
1410           ELSIF p_user_key_type           = 'POO_PARTY_SITE_ID'
1411             THEN l_party_type := g_party_rec.poo_pty_site_type;
1412           ELSIF p_user_key_type           = 'BILL_TO_PARTY_SITE_ID'
1413             THEN l_party_type := g_party_rec.bill_to_pty_site_type;
1414           ELSIF p_user_key_type           = 'BILL_FROM_PARTY_SITE_ID'
1415             THEN l_party_type := g_party_rec.bill_from_pty_site_type;
1416           ELSIF p_user_key_type           = 'TRADING_HQ_PARTY_SITE_ID'
1417             THEN l_party_type := g_party_rec.trad_hq_party_type;
1418           END IF;
1419 
1420           BEGIN
1421             select upper(party_source_table)
1422             into   l_table_name
1423             from   zx_party_types
1424             where  party_type_code = l_party_type;
1425           EXCEPTION
1426             WHEN OTHERS THEN l_table_name := null;
1427           END;
1428 
1429           BEGIN
1430             IF l_table_name = 'HZ_PARTY_SITES' THEN  -- Verify if it is PARTIES or PARTY_SITES
1431               ---------------------------------------------------
1432               -- Retrieves the user_key_id using HZ_PARTY_SITES
1433               ---------------------------------------------------
1434               write_message('~      Retrieves the user_key_id using HZ_PARTY_SITES');
1435               begin
1436 
1437               select party_site_id
1438               into   x_user_key_id
1439               from   hz_party_sites
1440               where  party_site_number  = l_varchar2_id ;
1441               exception
1442                 WHEN no_data_found then
1443                    select party_site_id
1444                    into   x_user_key_id
1445                    from   po_vendor_sites
1446                    where  vendor_site_code = l_varchar2_id;
1447 
1448                    select location_id
1449                    into   l_ship_from_location_id
1450                    from   hz_party_sites
1451                    where  party_site_id=x_user_key_id;
1452               end;
1453             ELSE
1454               ---------------------------------------------------
1455               -- Retrieves the user_key_id using PO_VENDOR_SITES
1456               ---------------------------------------------------
1457               write_message('~      Retrieves the user_key_id using PO_VENDOR_SITES');
1458               select vendor_site_id
1459               into   x_user_key_id
1460               from   po_vendor_sites_all
1461               where    vendor_site_code = l_varchar2_id;
1462               --Bug 4306914. The Composite Key was simpified to single key.
1463               /*where  vendor_id        = to_number(l_varchar2_id)
1464               and    vendor_site_code = l_varchar2_id1
1465               and    org_id           = l_num_id;*/
1466             END IF;
1467           EXCEPTION
1468             WHEN NO_DATA_FOUND THEN
1469               FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
1470               FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','Error for'||p_user_key_type||' '||sqlerrm);
1471           write_message(substr(sqlerrm,1,200));
1472               FND_MSG_PUB.Add;
1473                 x_user_key_id := -9999;
1474 
1475             WHEN TOO_MANY_ROWS THEN
1476               FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
1477               FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','Error for'||
1478                p_user_key_type|| ' the vendor_site_code'|| l_varchar2_id1 ||
1479                'is not unique in table PO_VENDOR_SITES_ALL. '||sqlerrm);
1480           write_message(substr(sqlerrm,1,200));
1481               FND_MSG_PUB.Add;
1482                 x_user_key_id := -9999;
1483             WHEN OTHERS THEN
1484               FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
1485               FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','Error for'||p_user_key_type||' '||sqlerrm);
1486           write_message(substr(sqlerrm,1,200));
1487               FND_MSG_PUB.Add;
1488                 x_user_key_id := -9999;
1489               FND_MSG_PUB.Add;
1490                 x_user_key_id := -9999;
1491           END;
1492         END;
1493       END IF;
1494       write_Message('~      The ID retrieved from USER KEY value above is: '||to_char(x_user_key_id));
1495     ELSE
1496       x_user_key_id := NULL;
1497     END IF;
1498   END get_user_key_id;
1499 
1500 
1501 /* ============================================================================*
1502  | PROCEDURE insert_into_rev_dist_lines_gt : Logic to Insert into Global       |
1503  |                                           Temporary Table                   |
1504  |                                           ZX_REVERSE_DIST_GT                |
1505  * ===========================================================================*/
1506 
1507  PROCEDURE insert_into_rev_dist_lines_gt(p_transaction_id IN NUMBER) IS
1508 
1509  l_int_org_id  NUMBER;
1510 
1511  BEGIN
1512 
1513      INSERT INTO ZX_REVERSE_DIST_GT
1514                 ( internal_organization_id,
1515                   reversing_appln_id,
1516                   reversing_entity_code,
1517                   reversing_evnt_cls_code,
1518                   reversing_trx_level_type,
1519                   reversing_trx_id,
1520                   reversing_trx_line_id,
1521                   reversing_trx_line_dist_id,
1522                   reversing_tax_line_id,
1523                   reversed_appln_id,
1524                   reversed_entity_code,
1525                   reversed_evnt_cls_code,
1526                   reversed_trx_level_type,
1527                   reversed_trx_id,
1528                   reversed_trx_line_id,
1529                   reversed_trx_line_dist_id,
1530                   FIRST_PTY_ORG_ID         ,
1531                   reversed_tax_line_id )
1532            SELECT g_transaction_rec.internal_organization_id,
1533                   application_id,
1534                   entity_code,
1535                   event_class_code,
1536                   'DISTRIBUTION',
1537                   trx_id,
1538                   trx_line_id,
1539                   trx_line_dist_id,
1540                   tax_line_id,
1541                   application_id,
1542                   entity_code,
1543                   event_class_code,
1544                   'DISTRIBUTION',
1545                   trx_id,
1546                   trx_line_id,
1547                   trx_line_dist_id,
1548                   g_transaction_rec.first_pty_org_id,
1549                   tax_line_id
1550             FROM  zx_rec_nrec_dist
1551            WHERE  trx_id = p_transaction_id;
1552 
1553   END insert_into_rev_dist_lines_gt;
1554 
1555 
1556 /* ======================================================================*
1557  | PROCEDURE put_data_in_party_rec : Put party_rec data in the a record  |
1558  * ======================================================================*/
1559 
1560   PROCEDURE put_data_in_party_rec(p_header_row IN NUMBER) IS
1561   BEGIN
1562     IF g_suite_rec_tbl.application_id(p_header_row)   IS NOT NULL AND
1563        g_suite_rec_tbl.entity_code(p_header_row)      IS NOT NULL AND
1564        g_suite_rec_tbl.event_class_code(p_header_row) IS NOT NULL THEN
1565     SELECT
1566       SHIP_TO_PARTY_TYPE ,
1567       SHIP_FROM_PARTY_TYPE,
1568       POA_PARTY_TYPE,
1569       POO_PARTY_TYPE,
1570       PAYING_PARTY_TYPE,
1571       OWN_HQ_PARTY_TYPE,
1572       TRAD_HQ_PARTY_TYPE,
1573       POI_PARTY_TYPE,
1574       POD_PARTY_TYPE,
1575       BILL_TO_PARTY_TYPE,
1576       BILL_FROM_PARTY_TYPE,
1577       TTL_TRNS_PARTY_TYPE,
1578       MERCHANT_PARTY_TYPE,
1579       SHIP_TO_PTY_SITE_TYPE,
1580       SHIP_FROM_PTY_SITE_TYPE,
1581       POA_PTY_SITE_TYPE,
1582       POO_PTY_SITE_TYPE,
1583       PAYING_PTY_SITE_TYPE,
1584       OWN_HQ_PTY_SITE_TYPE,
1585       TRAD_HQ_PTY_SITE_TYPE,
1586       POI_PTY_SITE_TYPE,
1587       POD_PTY_SITE_TYPE,
1588       BILL_TO_PTY_SITE_TYPE,
1589       BILL_FROM_PTY_SITE_TYPE,
1590       TTL_TRNS_PTY_SITE_TYPE,
1591       PROD_FAMILY_GRP_CODE
1592     INTO
1593       g_party_rec.SHIP_TO_PARTY_TYPE,
1594       g_party_rec.SHIP_FROM_PARTY_TYPE,
1595       g_party_rec.POA_PARTY_TYPE,
1596       g_party_rec.POO_PARTY_TYPE,
1597       g_party_rec.PAYING_PARTY_TYPE,
1598       g_party_rec.OWN_HQ_PARTY_TYPE,
1599       g_party_rec.TRAD_HQ_PARTY_TYPE,
1600       g_party_rec.POI_PARTY_TYPE,
1601       g_party_rec.POD_PARTY_TYPE,
1602       g_party_rec.BILL_TO_PARTY_TYPE,
1603       g_party_rec.BILL_FROM_PARTY_TYPE,
1604       g_party_rec.TTL_TRNS_PARTY_TYPE,
1605       g_party_rec.MERCHANT_PARTY_TYPE,
1606       g_party_rec.SHIP_TO_PTY_SITE_TYPE,
1607       g_party_rec.SHIP_FROM_PTY_SITE_TYPE,
1608       g_party_rec.POA_PTY_SITE_TYPE,
1609       g_party_rec.POO_PTY_SITE_TYPE,
1610       g_party_rec.PAYING_PTY_SITE_TYPE,
1611       g_party_rec.OWN_HQ_PTY_SITE_TYPE,
1612       g_party_rec.TRAD_HQ_PTY_SITE_TYPE,
1613       g_party_rec.POI_PTY_SITE_TYPE,
1614       g_party_rec.POD_PTY_SITE_TYPE,
1615       g_party_rec.BILL_TO_PTY_SITE_TYPE,
1616       g_party_rec.BILL_FROM_PTY_SITE_TYPE,
1617       g_party_rec.TTL_TRNS_PTY_SITE_TYPE,
1618       g_party_rec.PROD_FAMILY_GRP_CODE
1619     FROM
1620       zx_evnt_cls_mappings
1621     WHERE
1622       application_id       = g_suite_rec_tbl.application_id(p_header_row)
1623       and entity_code      = g_suite_rec_tbl.entity_code(p_header_row)
1624       and event_class_code = g_suite_rec_tbl.event_class_code(p_header_row) ;
1625     END IF;
1626     EXCEPTION
1627       WHEN TOO_MANY_ROWS THEN
1628         FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
1629         FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','TOO MANY ROWS PARTY_REC: '||sqlerrm);
1630         write_message(substr(fnd_message.get,1,200));
1631         FND_MSG_PUB.Add;
1632       WHEN NO_DATA_FOUND THEN
1633         FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
1634         FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','NO DATA FOUND PARTY_REC: '||sqlerrm);
1635         write_message(substr(fnd_message.get,1,200));
1636         FND_MSG_PUB.Add;
1637       WHEN OTHERS THEN
1638         FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
1639         FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','OTHERS PARTY_REC: '||sqlerrm);
1640         write_message(substr(fnd_message.get,1,200));
1641         FND_MSG_PUB.Add;
1642   END put_data_in_party_rec;
1643 
1644 
1645 /* ================================================================================*
1646  | PROCEDURE insert_data_trx_headers_gt : Inserts a row in zx_trx_headers_gt|
1647  * ================================================================================*/
1648 
1649   PROCEDURE insert_data_trx_headers_gt(p_row_id IN NUMBER)
1650   IS
1651   BEGIN
1652   write_message('Inserting into zx_trx_headers_gt rec_tbl_row:'||to_char(p_row_id));
1653     ----------------------------------------------
1654     -- INSERT INTO TABLE zx_trx_headers_gt
1655     ----------------------------------------------
1656 
1657     INSERT INTO zx_trx_headers_gt(
1658       INTERNAL_ORGANIZATION_ID            ,
1659       INTERNAL_ORG_LOCATION_ID            ,
1660       APPLICATION_ID                      ,
1661       ENTITY_CODE                         ,
1662       EVENT_CLASS_CODE                    ,
1663       EVENT_TYPE_CODE                     ,
1664       TRX_ID                              ,
1665       TRX_DATE                            ,
1666       TRX_DOC_REVISION                    ,
1667       LEDGER_ID                           ,
1668       TRX_CURRENCY_CODE                   ,
1669       CURRENCY_CONVERSION_DATE            ,
1670       CURRENCY_CONVERSION_RATE            ,
1671       CURRENCY_CONVERSION_TYPE            ,
1672       MINIMUM_ACCOUNTABLE_UNIT            ,
1673       PRECISION                           ,
1674       LEGAL_ENTITY_ID                     ,
1675       ROUNDING_SHIP_TO_PARTY_ID           ,
1676       ROUNDING_SHIP_FROM_PARTY_ID         ,
1677       ROUNDING_BILL_TO_PARTY_ID           ,
1678       ROUNDING_BILL_FROM_PARTY_ID         ,
1679       RNDG_SHIP_TO_PARTY_SITE_ID          ,
1680       RNDG_SHIP_FROM_PARTY_SITE_ID        ,
1681       RNDG_BILL_TO_PARTY_SITE_ID          ,
1682       RNDG_BILL_FROM_PARTY_SITE_ID        ,
1683       ESTABLISHMENT_ID                    ,
1684       RECEIVABLES_TRX_TYPE_ID             ,
1685       RELATED_DOC_APPLICATION_ID          ,
1686       RELATED_DOC_ENTITY_CODE             ,
1687       RELATED_DOC_EVENT_CLASS_CODE        ,
1688       RELATED_DOC_TRX_ID                  ,
1689       RELATED_DOC_NUMBER                  ,
1690       RELATED_DOC_DATE                    ,
1691       DEFAULT_TAXATION_COUNTRY            ,
1692       QUOTE_FLAG                          ,
1693       CTRL_TOTAL_HDR_TX_AMT               ,
1694       TRX_NUMBER                          ,
1695       TRX_DESCRIPTION                     ,
1696       TRX_COMMUNICATED_DATE               ,
1697       BATCH_SOURCE_ID                     ,
1698       BATCH_SOURCE_NAME                   ,
1699       DOC_SEQ_ID                          ,
1700       DOC_SEQ_NAME                        ,
1701       DOC_SEQ_VALUE                       ,
1702       TRX_DUE_DATE                        ,
1703       TRX_TYPE_DESCRIPTION                ,
1704       DOCUMENT_SUB_TYPE                   ,
1705       SUPPLIER_TAX_INVOICE_NUMBER         ,
1706       SUPPLIER_TAX_INVOICE_DATE           ,
1707       SUPPLIER_EXCHANGE_RATE              ,
1708       TAX_INVOICE_DATE                    ,
1709       TAX_INVOICE_NUMBER                  ,
1710       FIRST_PTY_ORG_ID                    ,
1711       TAX_EVENT_CLASS_CODE                ,
1712       TAX_EVENT_TYPE_CODE                 ,
1713       DOC_EVENT_STATUS                    ,
1714       RDNG_SHIP_TO_PTY_TX_PROF_ID         ,
1715       RDNG_SHIP_FROM_PTY_TX_PROF_ID       ,
1716       RDNG_BILL_TO_PTY_TX_PROF_ID         ,
1717       RDNG_BILL_FROM_PTY_TX_PROF_ID       ,
1718       RDNG_SHIP_TO_PTY_TX_P_ST_ID         ,
1719       RDNG_SHIP_FROM_PTY_TX_P_ST_ID       ,
1720       RDNG_BILL_TO_PTY_TX_P_ST_ID         ,
1721       RDNG_BILL_FROM_PTY_TX_P_ST_ID       ,
1722       VALIDATION_CHECK_FLAG               ,
1723       PORT_OF_ENTRY_CODE                  )
1724       VALUES
1725       (
1726       g_suite_rec_tbl.INTERNAL_ORGANIZATION_ID(p_row_id)            ,
1727       g_suite_rec_tbl.INTERNAL_ORG_LOCATION_ID(p_row_id)            ,
1728       g_suite_rec_tbl.APPLICATION_ID(p_row_id)                      ,
1729       g_suite_rec_tbl.ENTITY_CODE(p_row_id)                         ,
1730       g_suite_rec_tbl.EVENT_CLASS_CODE(p_row_id)                    ,
1731       g_suite_rec_tbl.EVENT_TYPE_CODE(p_row_id)                     ,
1732       g_suite_rec_tbl.TRX_ID(p_row_id)                              ,
1733       g_suite_rec_tbl.TRX_DATE(p_row_id)                            ,
1734       g_suite_rec_tbl.TRX_DOC_REVISION(p_row_id)                    ,
1735       g_suite_rec_tbl.LEDGER_ID(p_row_id)                           ,
1736       g_suite_rec_tbl.TRX_CURRENCY_CODE(p_row_id)                   ,
1737       g_suite_rec_tbl.CURRENCY_CONVERSION_DATE(p_row_id)            ,
1738       g_suite_rec_tbl.CURRENCY_CONVERSION_RATE(p_row_id)            ,
1739       g_suite_rec_tbl.CURRENCY_CONVERSION_TYPE(p_row_id)            ,
1740       g_suite_rec_tbl.MINIMUM_ACCOUNTABLE_UNIT(p_row_id)            ,
1741       g_suite_rec_tbl.PRECISION(p_row_id)                           ,
1742       g_suite_rec_tbl.LEGAL_ENTITY_ID(p_row_id)                     ,
1743       g_suite_rec_tbl.ROUNDING_SHIP_TO_PARTY_ID(p_row_id)           ,
1744       g_suite_rec_tbl.ROUNDING_SHIP_FROM_PARTY_ID(p_row_id)         ,
1745       g_suite_rec_tbl.ROUNDING_BILL_TO_PARTY_ID(p_row_id)           ,
1746       g_suite_rec_tbl.ROUNDING_BILL_FROM_PARTY_ID(p_row_id)         ,
1747       g_suite_rec_tbl.RNDG_SHIP_TO_PARTY_SITE_ID(p_row_id)          ,
1748       g_suite_rec_tbl.RNDG_SHIP_FROM_PARTY_SITE_ID(p_row_id)        ,
1749       g_suite_rec_tbl.RNDG_BILL_TO_PARTY_SITE_ID(p_row_id)          ,
1750       g_suite_rec_tbl.RNDG_BILL_FROM_PARTY_SITE_ID(p_row_id)        ,
1751       g_suite_rec_tbl.ESTABLISHMENT_ID(p_row_id)                    ,
1752       g_suite_rec_tbl.RECEIVABLES_TRX_TYPE_ID(p_row_id)             ,
1753       g_suite_rec_tbl.RELATED_DOC_APPLICATION_ID(p_row_id)          ,
1754       g_suite_rec_tbl.RELATED_DOC_ENTITY_CODE(p_row_id)             ,
1755       g_suite_rec_tbl.RELATED_DOC_EVENT_CLASS_CODE(p_row_id)        ,
1756       g_suite_rec_tbl.RELATED_DOC_TRX_ID(p_row_id)                  ,
1757       g_suite_rec_tbl.RELATED_DOC_NUMBER(p_row_id)                  ,
1758       g_suite_rec_tbl.RELATED_DOC_DATE(p_row_id)                    ,
1759       g_suite_rec_tbl.DEFAULT_TAXATION_COUNTRY(p_row_id)            ,
1760       g_suite_rec_tbl.QUOTE_FLAG(p_row_id)                          ,
1761       g_suite_rec_tbl.CTRL_TOTAL_HDR_TX_AMT(p_row_id)               ,
1762       g_suite_rec_tbl.TRX_NUMBER(p_row_id)                          ,
1763       g_suite_rec_tbl.TRX_DESCRIPTION(p_row_id)                     ,
1764       g_suite_rec_tbl.TRX_COMMUNICATED_DATE(p_row_id)               ,
1765       g_suite_rec_tbl.BATCH_SOURCE_ID(p_row_id)                     ,
1766       g_suite_rec_tbl.BATCH_SOURCE_NAME(p_row_id)                   ,
1767       g_suite_rec_tbl.DOC_SEQ_ID(p_row_id)                          ,
1768       g_suite_rec_tbl.DOC_SEQ_NAME(p_row_id)                        ,
1769       g_suite_rec_tbl.DOC_SEQ_VALUE(p_row_id)                       ,
1770       g_suite_rec_tbl.TRX_DUE_DATE(p_row_id)                        ,
1771       g_suite_rec_tbl.TRX_TYPE_DESCRIPTION(p_row_id)                ,
1772       g_suite_rec_tbl.DOCUMENT_SUB_TYPE(p_row_id)                   ,
1773       g_suite_rec_tbl.SUPPLIER_TAX_INVOICE_NUMBER(p_row_id)         ,
1774       g_suite_rec_tbl.SUPPLIER_TAX_INVOICE_DATE(p_row_id)           ,
1775       g_suite_rec_tbl.SUPPLIER_EXCHANGE_RATE(p_row_id)              ,
1776       g_suite_rec_tbl.TAX_INVOICE_DATE(p_row_id)                    ,
1777       g_suite_rec_tbl.TAX_INVOICE_NUMBER(p_row_id)                  ,
1778       g_suite_rec_tbl.FIRST_PTY_ORG_ID(p_row_id)                    ,
1779       g_suite_rec_tbl.TAX_EVENT_CLASS_CODE(p_row_id)                ,
1780       g_suite_rec_tbl.TAX_EVENT_TYPE_CODE(p_row_id)                 ,
1781       g_suite_rec_tbl.DOC_EVENT_STATUS(p_row_id)                    ,
1782       g_suite_rec_tbl.RDNG_SHIP_TO_PTY_TX_PROF_ID(p_row_id)         ,
1783       g_suite_rec_tbl.RDNG_SHIP_FROM_PTY_TX_PROF_ID(p_row_id)       ,
1784       g_suite_rec_tbl.RDNG_BILL_TO_PTY_TX_PROF_ID(p_row_id)         ,
1785       g_suite_rec_tbl.RDNG_BILL_FROM_PTY_TX_PROF_ID(p_row_id)       ,
1786       g_suite_rec_tbl.RDNG_SHIP_TO_PTY_TX_P_ST_ID(p_row_id)         ,
1787       g_suite_rec_tbl.RDNG_SHIP_FROM_PTY_TX_P_ST_ID(p_row_id)       ,
1788       g_suite_rec_tbl.RDNG_BILL_TO_PTY_TX_P_ST_ID(p_row_id)         ,
1789       g_suite_rec_tbl.RDNG_BILL_FROM_PTY_TX_P_ST_ID(p_row_id)       ,
1790       g_suite_rec_tbl.VALIDATION_CHECK_FLAG(p_row_id)               ,
1791       g_suite_rec_tbl.PORT_OF_ENTRY_CODE(p_row_id)                  );
1792   END insert_data_trx_headers_gt;
1793 
1794 
1795 /* ============================================================================*
1796  | PROCEDURE insert_data_trx_lines_gt : Inserts data for lines in              |
1797  |                                      ZX_TRANSACTION_LINES_GT. Some values   |
1798  |                                      are obtained from the Header row       |
1799  * ============================================================================*/
1800 
1801   PROCEDURE insert_data_trx_lines_gt(p_header_row        NUMBER,
1802                                      p_starting_line_row NUMBER,
1803                                      p_ending_line_row   NUMBER)
1804   IS
1805      l_counter                  NUMBER;
1806      i                          NUMBER;
1807   BEGIN
1808     ---------------------------------------------
1809     -- INSERT INTO TABLE ZX_TRANSACTION_LINES_GT
1810     ---------------------------------------------
1811     for i in p_starting_line_row..p_ending_line_row loop
1812     write_message('Inserting into ZX_TRANSACTION_LINES_GT rec_tbl_row:'||to_char(i));
1813 
1814     --forall i in p_starting_line_row..p_ending_line_row
1815         INSERT INTO ZX_TRANSACTION_LINES_GT(
1816               APPLICATION_ID                           ,
1817               ENTITY_CODE                              ,
1818               EVENT_CLASS_CODE                         ,
1819               TRX_ID                                   ,
1820               TRX_LEVEL_TYPE                           ,
1821               TRX_LINE_ID                              ,
1822               LINE_LEVEL_ACTION                        ,
1823               LINE_CLASS                               ,
1824               TRX_SHIPPING_DATE                        ,
1825               TRX_RECEIPT_DATE                         ,
1826               TRX_LINE_TYPE                            ,
1827               TRX_LINE_DATE                            ,
1828               TRX_BUSINESS_CATEGORY                    ,
1829               LINE_INTENDED_USE                        ,
1830               USER_DEFINED_FISC_CLASS                  ,
1831               LINE_AMT                                 ,
1832               TRX_LINE_QUANTITY                        ,
1833               UNIT_PRICE                               ,
1834               EXEMPT_CERTIFICATE_NUMBER                ,
1835               EXEMPT_REASON                            ,
1836               CASH_DISCOUNT                            ,
1837               VOLUME_DISCOUNT                          ,
1838               TRADING_DISCOUNT                         ,
1839               TRANSFER_CHARGE                          ,
1840               TRANSPORTATION_CHARGE                    ,
1841               INSURANCE_CHARGE                         ,
1842               OTHER_CHARGE                             ,
1843               PRODUCT_ID                               ,
1844               PRODUCT_FISC_CLASSIFICATION              ,
1845               PRODUCT_ORG_ID                           ,
1846               UOM_CODE                                 ,
1847               PRODUCT_TYPE                             ,
1848               PRODUCT_CODE                             ,
1849               PRODUCT_CATEGORY                         ,
1850               TRX_SIC_CODE                             ,
1851               FOB_POINT                                ,
1852               SHIP_TO_PARTY_ID                         ,
1853               SHIP_FROM_PARTY_ID                       ,
1854               POA_PARTY_ID                             ,
1855               POO_PARTY_ID                             ,
1856               BILL_TO_PARTY_ID                         ,
1857               BILL_FROM_PARTY_ID                       ,
1858               MERCHANT_PARTY_ID                        ,
1859               SHIP_TO_PARTY_SITE_ID                    ,
1860               SHIP_FROM_PARTY_SITE_ID                  ,
1861               POA_PARTY_SITE_ID                        ,
1862               POO_PARTY_SITE_ID                        ,
1863               BILL_TO_PARTY_SITE_ID                    ,
1864               BILL_FROM_PARTY_SITE_ID                  ,
1865               SHIP_TO_LOCATION_ID                      ,
1866               SHIP_FROM_LOCATION_ID                    ,
1867               POA_LOCATION_ID                          ,
1868               POO_LOCATION_ID                          ,
1869               BILL_TO_LOCATION_ID                      ,
1870               BILL_FROM_LOCATION_ID                    ,
1871               ACCOUNT_CCID                             ,
1872               ACCOUNT_STRING                           ,
1873               MERCHANT_PARTY_COUNTRY                   ,
1874               REF_DOC_APPLICATION_ID                   ,
1875               REF_DOC_ENTITY_CODE                      ,
1876               REF_DOC_EVENT_CLASS_CODE                 ,
1877               REF_DOC_TRX_ID                           ,
1878               REF_DOC_LINE_ID                          ,
1879               REF_DOC_LINE_QUANTITY                    ,
1880               APPLIED_FROM_APPLICATION_ID              ,
1881               APPLIED_FROM_ENTITY_CODE                 ,
1882               APPLIED_FROM_EVENT_CLASS_CODE            ,
1883               APPLIED_FROM_TRX_ID                      ,
1884               APPLIED_FROM_LINE_ID                     ,
1885               ADJUSTED_DOC_APPLICATION_ID              ,
1886               ADJUSTED_DOC_ENTITY_CODE                 ,
1887               ADJUSTED_DOC_EVENT_CLASS_CODE            ,
1888               ADJUSTED_DOC_TRX_ID                      ,
1889               ADJUSTED_DOC_LINE_ID                     ,
1890               ADJUSTED_DOC_NUMBER                      ,
1891               ADJUSTED_DOC_DATE                        ,
1892               APPLIED_TO_APPLICATION_ID                ,
1893               APPLIED_TO_ENTITY_CODE                   ,
1894               APPLIED_TO_EVENT_CLASS_CODE              ,
1895               APPLIED_TO_TRX_ID                        ,
1896               APPLIED_TO_TRX_LINE_ID                   ,
1897               TRX_ID_LEVEL2                            ,
1898               TRX_ID_LEVEL3                            ,
1899               TRX_ID_LEVEL4                            ,
1900               TRX_ID_LEVEL5                            ,
1901               TRX_ID_LEVEL6                            ,
1902               TRX_LINE_NUMBER                          ,
1903               TRX_LINE_DESCRIPTION                     ,
1904               PRODUCT_DESCRIPTION                      ,
1905               TRX_WAYBILL_NUMBER                       ,
1906               TRX_LINE_GL_DATE                         ,
1907               MERCHANT_PARTY_NAME                      ,
1908               MERCHANT_PARTY_DOCUMENT_NUMBER           ,
1909               MERCHANT_PARTY_REFERENCE                 ,
1910               MERCHANT_PARTY_TAXPAYER_ID               ,
1911               MERCHANT_PARTY_TAX_REG_NUMBER            ,
1912               PAYING_PARTY_ID                          ,
1913               OWN_HQ_PARTY_ID                          ,
1914               TRADING_HQ_PARTY_ID                      ,
1915               POI_PARTY_ID                             ,
1916               POD_PARTY_ID                             ,
1917               TITLE_TRANSFER_PARTY_ID                  ,
1918               PAYING_PARTY_SITE_ID                     ,
1919               OWN_HQ_PARTY_SITE_ID                     ,
1920               TRADING_HQ_PARTY_SITE_ID                 ,
1921               POI_PARTY_SITE_ID                        ,
1922               POD_PARTY_SITE_ID                      ,
1923               TITLE_TRANSFER_PARTY_SITE_ID           ,
1924               PAYING_LOCATION_ID                     ,
1925               OWN_HQ_LOCATION_ID                     ,
1926               TRADING_HQ_LOCATION_ID                 ,
1927               POC_LOCATION_ID                        ,
1928               POI_LOCATION_ID                        ,
1929               POD_LOCATION_ID                        ,
1930               TITLE_TRANSFER_LOCATION_ID             ,
1931               ASSESSABLE_VALUE                      ,
1932               ASSET_FLAG                            ,
1933               ASSET_NUMBER                          ,
1934               ASSET_ACCUM_DEPRECIATION              ,
1935               ASSET_TYPE                            ,
1936               ASSET_COST                            ,
1937               SHIP_TO_PARTY_TAX_PROF_ID             ,
1938               SHIP_FROM_PARTY_TAX_PROF_ID           ,
1939               POA_PARTY_TAX_PROF_ID                 ,
1940               POO_PARTY_TAX_PROF_ID                 ,
1941               PAYING_PARTY_TAX_PROF_ID              ,
1942               OWN_HQ_PARTY_TAX_PROF_ID              ,
1943               TRADING_HQ_PARTY_TAX_PROF_ID          ,
1944               POI_PARTY_TAX_PROF_ID                 ,
1945               POD_PARTY_TAX_PROF_ID                 ,
1946               BILL_TO_PARTY_TAX_PROF_ID             ,
1947               BILL_FROM_PARTY_TAX_PROF_ID           ,
1948               TITLE_TRANS_PARTY_TAX_PROF_ID         ,
1949               SHIP_TO_SITE_TAX_PROF_ID              ,
1950               SHIP_FROM_SITE_TAX_PROF_ID            ,
1951               POA_SITE_TAX_PROF_ID                  ,
1952               POO_SITE_TAX_PROF_ID                  ,
1953               PAYING_SITE_TAX_PROF_ID               ,
1954               OWN_HQ_SITE_TAX_PROF_ID               ,
1955               TRADING_HQ_SITE_TAX_PROF_ID           ,
1956               POI_SITE_TAX_PROF_ID                  ,
1957               POD_SITE_TAX_PROF_ID                  ,
1958               BILL_TO_SITE_TAX_PROF_ID              ,
1959               BILL_FROM_SITE_TAX_PROF_ID            ,
1960               TITLE_TRANS_SITE_TAX_PROF_ID          ,
1961               MERCHANT_PARTY_TAX_PROF_ID            ,
1962               HQ_ESTB_PARTY_TAX_PROF_ID             ,
1963               LINE_AMT_INCLUDES_TAX_FLAG            ,
1964               HISTORICAL_FLAG                       ,
1965               CTRL_HDR_TX_APPL_FLAG                 ,
1966               CTRL_TOTAL_LINE_TX_AMT
1967               )
1968               VALUES
1969               (
1970                g_suite_rec_tbl.APPLICATION_ID(p_header_row)      ,
1971                g_suite_rec_tbl.ENTITY_CODE(p_header_row)         ,
1972                g_suite_rec_tbl.EVENT_CLASS_CODE(p_header_row)    ,
1973                g_suite_rec_tbl.TRX_ID(p_header_row)              ,
1974                g_suite_rec_tbl.TRX_LEVEL_TYPE(p_header_row)      ,
1975                g_suite_rec_tbl.TRX_LINE_ID(i)                    ,
1976                g_suite_rec_tbl.LINE_LEVEL_ACTION(i)              ,
1977                g_suite_rec_tbl.LINE_CLASS(i)                     ,
1978                g_suite_rec_tbl.TRX_SHIPPING_DATE(i)              ,
1979                g_suite_rec_tbl.TRX_RECEIPT_DATE(i)               ,
1980                g_suite_rec_tbl.TRX_LINE_TYPE(i)                  ,
1981                g_suite_rec_tbl.TRX_LINE_DATE(i)                  ,
1982                g_suite_rec_tbl.TRX_BUSINESS_CATEGORY(i)          ,
1983                g_suite_rec_tbl.LINE_INTENDED_USE(i)              ,
1984                g_suite_rec_tbl.USER_DEFINED_FISC_CLASS(i)        ,
1985                g_suite_rec_tbl.LINE_AMT(i)                       ,
1986                g_suite_rec_tbl.TRX_LINE_QUANTITY(i)              ,
1987                g_suite_rec_tbl.UNIT_PRICE(i)                     ,
1988                g_suite_rec_tbl.EXEMPT_CERTIFICATE_NUMBER(i)      ,
1989                g_suite_rec_tbl.EXEMPT_REASON(i)                  ,
1990                g_suite_rec_tbl.CASH_DISCOUNT(i)                  ,
1991                g_suite_rec_tbl.VOLUME_DISCOUNT(i)                ,
1992                g_suite_rec_tbl.TRADING_DISCOUNT(i)               ,
1993                g_suite_rec_tbl.TRANSFER_CHARGE(i)                ,
1994                g_suite_rec_tbl.TRANSPORTATION_CHARGE(i)          ,
1995                g_suite_rec_tbl.INSURANCE_CHARGE(i)               ,
1996                g_suite_rec_tbl.OTHER_CHARGE(i)                   ,
1997                g_suite_rec_tbl.PRODUCT_ID(i)                     ,
1998                g_suite_rec_tbl.PRODUCT_FISC_CLASSIFICATION(i)    ,
1999                g_suite_rec_tbl.PRODUCT_ORG_ID(i)                 ,
2000                g_suite_rec_tbl.UOM_CODE(i)                       ,
2001                g_suite_rec_tbl.PRODUCT_TYPE(i)                   ,
2002                g_suite_rec_tbl.PRODUCT_CODE(i)                   ,
2003                g_suite_rec_tbl.PRODUCT_CATEGORY(i)               ,
2004                g_suite_rec_tbl.TRX_SIC_CODE(i)                   ,
2005                g_suite_rec_tbl.FOB_POINT(i)                      ,
2006                g_suite_rec_tbl.SHIP_TO_PARTY_ID(i)               ,
2007                g_suite_rec_tbl.SHIP_FROM_PARTY_ID(i)             ,
2008                g_suite_rec_tbl.POA_PARTY_ID(i)                   ,
2009                g_suite_rec_tbl.POO_PARTY_ID(i)                   ,
2010                g_suite_rec_tbl.BILL_TO_PARTY_ID(i)               ,
2011                g_suite_rec_tbl.BILL_FROM_PARTY_ID(i)             ,
2012                g_suite_rec_tbl.MERCHANT_PARTY_ID(i)              ,
2013                g_suite_rec_tbl.SHIP_TO_PARTY_SITE_ID(i)          ,
2014                g_suite_rec_tbl.SHIP_FROM_PARTY_SITE_ID(i)        ,
2015                g_suite_rec_tbl.POA_PARTY_SITE_ID(i)                     ,
2016                g_suite_rec_tbl.POO_PARTY_SITE_ID(i)                     ,
2017                g_suite_rec_tbl.BILL_TO_PARTY_SITE_ID(i)                 ,
2018                g_suite_rec_tbl.BILL_FROM_PARTY_SITE_ID(i)               ,
2019                g_suite_rec_tbl.SHIP_TO_LOCATION_ID(i)                   ,
2020                --g_suite_rec_tbl.SHIP_FROM_LOCATION_ID(i)                 ,
2021                l_ship_from_location_id,
2022                g_suite_rec_tbl.POA_LOCATION_ID(i)                       ,
2023                g_suite_rec_tbl.POO_LOCATION_ID(i)                       ,
2024                g_suite_rec_tbl.BILL_TO_LOCATION_ID(i)                   ,
2025                g_suite_rec_tbl.BILL_FROM_LOCATION_ID(i)                 ,
2026                g_suite_rec_tbl.ACCOUNT_CCID(i)                          ,
2027                g_suite_rec_tbl.ACCOUNT_STRING(i)                        ,
2028                g_suite_rec_tbl.MERCHANT_PARTY_COUNTRY(i)                ,
2029                g_suite_rec_tbl.REF_DOC_APPLICATION_ID(i)                ,
2030                g_suite_rec_tbl.REF_DOC_ENTITY_CODE(i)                   ,
2031                g_suite_rec_tbl.REF_DOC_EVENT_CLASS_CODE(i)              ,
2032                g_suite_rec_tbl.REF_DOC_TRX_ID(i)                        ,
2033                g_suite_rec_tbl.REF_DOC_LINE_ID(i)                       ,
2034                g_suite_rec_tbl.REF_DOC_LINE_QUANTITY(i)                 ,
2035                g_suite_rec_tbl.APPLIED_FROM_APPLICATION_ID(i)           ,
2036                g_suite_rec_tbl.APPLIED_FROM_ENTITY_CODE(i)              ,
2037                g_suite_rec_tbl.APPLIED_FROM_EVENT_CLASS_CODE(i)         ,
2038                g_suite_rec_tbl.APPLIED_FROM_TRX_ID(i)                   ,
2039                g_suite_rec_tbl.APPLIED_FROM_LINE_ID(i)                  ,
2040                g_suite_rec_tbl.ADJUSTED_DOC_APPLICATION_ID(i)           ,
2041                g_suite_rec_tbl.ADJUSTED_DOC_ENTITY_CODE(i)              ,
2042                g_suite_rec_tbl.ADJUSTED_DOC_EVENT_CLASS_CODE(i)         ,
2043                g_suite_rec_tbl.ADJUSTED_DOC_TRX_ID(i)                   ,
2044                g_suite_rec_tbl.ADJUSTED_DOC_LINE_ID(i)                  ,
2045                g_suite_rec_tbl.ADJUSTED_DOC_NUMBER(i)                   ,
2046                g_suite_rec_tbl.ADJUSTED_DOC_DATE(i)                     ,
2047                g_suite_rec_tbl.APPLIED_TO_APPLICATION_ID(i)             ,
2048                g_suite_rec_tbl.APPLIED_TO_ENTITY_CODE(i)                ,
2049                g_suite_rec_tbl.APPLIED_TO_EVENT_CLASS_CODE(i)           ,
2050                g_suite_rec_tbl.APPLIED_TO_TRX_ID(i)                     ,
2051                g_suite_rec_tbl.APPLIED_TO_TRX_LINE_ID(i)                ,
2052                g_suite_rec_tbl.TRX_ID_LEVEL2(i)                         ,
2053                g_suite_rec_tbl.TRX_ID_LEVEL3(i)                         ,
2054                g_suite_rec_tbl.TRX_ID_LEVEL4(i)                         ,
2055                g_suite_rec_tbl.TRX_ID_LEVEL5(i)                         ,
2056                g_suite_rec_tbl.TRX_ID_LEVEL6(i)                         ,
2057                g_suite_rec_tbl.TRX_LINE_NUMBER(i)                       ,
2058                g_suite_rec_tbl.TRX_LINE_DESCRIPTION(i)                  ,
2059                g_suite_rec_tbl.PRODUCT_DESCRIPTION(i)                   ,
2060                g_suite_rec_tbl.TRX_WAYBILL_NUMBER(i)                    ,
2061                g_suite_rec_tbl.TRX_LINE_GL_DATE(i)                      ,
2062                g_suite_rec_tbl.MERCHANT_PARTY_NAME(i)                   ,
2063                g_suite_rec_tbl.MERCHANT_PARTY_DOCUMENT_NUMBER(i)        ,
2064                g_suite_rec_tbl.MERCHANT_PARTY_REFERENCE(i)              ,
2065                g_suite_rec_tbl.MERCHANT_PARTY_TAXPAYER_ID(i)            ,
2066                g_suite_rec_tbl.MERCHANT_PARTY_TAX_REG_NUMBER(i)         ,
2067                g_suite_rec_tbl.PAYING_PARTY_ID(i)                       ,
2068                g_suite_rec_tbl.OWN_HQ_PARTY_ID(i)                       ,
2069                g_suite_rec_tbl.TRADING_HQ_PARTY_ID(i)                   ,
2070                g_suite_rec_tbl.POI_PARTY_ID(i)                          ,
2071                g_suite_rec_tbl.POD_PARTY_ID(i)                          ,
2072                g_suite_rec_tbl.TITLE_TRANSFER_PARTY_ID(i)               ,
2073                g_suite_rec_tbl.PAYING_PARTY_SITE_ID(i)                  ,
2074                g_suite_rec_tbl.OWN_HQ_PARTY_SITE_ID(i)                  ,
2075                g_suite_rec_tbl.TRADING_HQ_PARTY_SITE_ID(i)              ,
2076                g_suite_rec_tbl.POI_PARTY_SITE_ID(i)                     ,
2077                g_suite_rec_tbl.POD_PARTY_SITE_ID(i)                     ,
2078                g_suite_rec_tbl.TITLE_TRANSFER_PARTY_SITE_ID(i)          ,
2079                g_suite_rec_tbl.PAYING_LOCATION_ID(i)                    ,
2080                g_suite_rec_tbl.OWN_HQ_LOCATION_ID(i)                    ,
2081                g_suite_rec_tbl.TRADING_HQ_LOCATION_ID(i)                ,
2082                g_suite_rec_tbl.POC_LOCATION_ID(i)                       ,
2083                g_suite_rec_tbl.POI_LOCATION_ID(i)                       ,
2084                g_suite_rec_tbl.POD_LOCATION_ID(i)                       ,
2085                g_suite_rec_tbl.TITLE_TRANSFER_LOCATION_ID(i)            ,
2086                g_suite_rec_tbl.ASSESSABLE_VALUE(i)                      ,
2087                g_suite_rec_tbl.ASSET_FLAG(i)                            ,
2088                g_suite_rec_tbl.ASSET_NUMBER(i)                          ,
2089                g_suite_rec_tbl.ASSET_ACCUM_DEPRECIATION(i)              ,
2090                g_suite_rec_tbl.ASSET_TYPE(i)                            ,
2091                g_suite_rec_tbl.ASSET_COST(i)                            ,
2092                g_suite_rec_tbl.SHIP_TO_PARTY_TAX_PROF_ID(i)             ,
2093                g_suite_rec_tbl.SHIP_FROM_PARTY_TAX_PROF_ID(i)           ,
2094                g_suite_rec_tbl.POA_PARTY_TAX_PROF_ID(i)                 ,
2095                g_suite_rec_tbl.POO_PARTY_TAX_PROF_ID(i)                 ,
2096                g_suite_rec_tbl.PAYING_PARTY_TAX_PROF_ID(i)              ,
2097                g_suite_rec_tbl.OWN_HQ_PARTY_TAX_PROF_ID(i)              ,
2098                g_suite_rec_tbl.TRADING_HQ_PARTY_TAX_PROF_ID(i)          ,
2099                g_suite_rec_tbl.POI_PARTY_TAX_PROF_ID(i)                 ,
2100                g_suite_rec_tbl.POD_PARTY_TAX_PROF_ID(i)                 ,
2101                g_suite_rec_tbl.BILL_TO_PARTY_TAX_PROF_ID(i)             ,
2102                g_suite_rec_tbl.BILL_FROM_PARTY_TAX_PROF_ID(i)           ,
2103                g_suite_rec_tbl.TITLE_TRANS_PARTY_TAX_PROF_ID(i)         ,
2104                g_suite_rec_tbl.SHIP_TO_SITE_TAX_PROF_ID(i)              ,
2105                g_suite_rec_tbl.SHIP_FROM_SITE_TAX_PROF_ID(i)            ,
2106                g_suite_rec_tbl.POA_SITE_TAX_PROF_ID(i)                  ,
2107                g_suite_rec_tbl.POO_SITE_TAX_PROF_ID(i)                  ,
2108                g_suite_rec_tbl.PAYING_SITE_TAX_PROF_ID(i)               ,
2109                g_suite_rec_tbl.OWN_HQ_SITE_TAX_PROF_ID(i)               ,
2110                g_suite_rec_tbl.TRADING_HQ_SITE_TAX_PROF_ID(i)           ,
2111                g_suite_rec_tbl.POI_SITE_TAX_PROF_ID(i)                  ,
2112                g_suite_rec_tbl.POD_SITE_TAX_PROF_ID(i)                  ,
2113                g_suite_rec_tbl.BILL_TO_SITE_TAX_PROF_ID(i)              ,
2114                g_suite_rec_tbl.BILL_FROM_SITE_TAX_PROF_ID(i)            ,
2115                g_suite_rec_tbl.TITLE_TRANS_SITE_TAX_PROF_ID(i)          ,
2116                g_suite_rec_tbl.MERCHANT_PARTY_TAX_PROF_ID(i)            ,
2117                g_suite_rec_tbl.HQ_ESTB_PARTY_TAX_PROF_ID(i)             ,
2118                g_suite_rec_tbl.LINE_AMT_INCLUDES_TAX_FLAG(i)            ,
2119                g_suite_rec_tbl.HISTORICAL_FLAG(i)                       ,
2120                g_suite_rec_tbl.CTRL_HDR_TX_APPL_FLAG(i)                 ,
2121                g_suite_rec_tbl.CTRL_TOTAL_LINE_TX_AMT(i)
2122                );
2123 
2124           END LOOP;
2125   END insert_data_trx_lines_gt;
2126 
2127 
2128 
2129 /* ============================================================================*
2130  | PROCEDURE insert_data_mrc_gt :Inserts a row in ZX_MRC_GT                    |
2131  * ===========================================================================*/
2132   PROCEDURE insert_data_mrc_gt
2133     (
2134       p_header_row        IN NUMBER
2135     ) IS
2136   BEGIN
2137       INSERT INTO ZX_MRC_GT
2138       (
2139         MINIMUM_ACCOUNTABLE_UNIT                       ,
2140         PRECISION                                      ,
2141         APPLICATION_ID                                 ,
2142         ENTITY_CODE                                    ,
2143         EVENT_CLASS_CODE                               ,
2144         EVENT_TYPE_CODE                                ,
2145         TRX_ID                                         ,
2146         REPORTING_CURRENCY_CODE                        ,
2147         CURRENCY_CONVERSION_DATE                       ,
2148         CURRENCY_CONVERSION_TYPE                       ,
2149         CURRENCY_CONVERSION_RATE                       ,
2150         LEDGER_ID
2151       )
2152       VALUES
2153       (
2154         g_suite_rec_tbl.MINIMUM_ACCOUNTABLE_UNIT(p_header_row)    ,
2155         g_suite_rec_tbl.PRECISION(p_header_row)                   ,
2156         g_suite_rec_tbl.APPLICATION_ID (p_header_row)             ,
2157         g_suite_rec_tbl.ENTITY_CODE(p_header_row)                 ,
2158         g_suite_rec_tbl.EVENT_CLASS_CODE(p_header_row)            ,
2159         g_suite_rec_tbl.EVENT_TYPE_CODE(p_header_row)             ,
2160         g_suite_rec_tbl.TRX_ID(p_header_row)                      ,
2161         g_suite_rec_tbl.TRX_CURRENCY_CODE(p_header_row)           ,
2162         ------------------------------------------------------------
2163         --At this moment we will use TRX_CURRENCY_CODE, later when
2164         --g_suite_rec_tbl.REPORTING_CURRENCY_CODE(i) is added to BTT
2165         --we will replace it by REPORTING_CURRENCY_CODE.
2166         ------------------------------------------------------------
2167         g_suite_rec_tbl.CURRENCY_CONVERSION_DATE(p_header_row)    ,
2168         g_suite_rec_tbl.CURRENCY_CONVERSION_TYPE(p_header_row)    ,
2169         g_suite_rec_tbl.CURRENCY_CONVERSION_RATE(p_header_row)    ,
2170         g_suite_rec_tbl.LEDGER_ID(p_header_row)
2171       );
2172   END;
2173 
2174 
2175 
2176 /* ============================================================================*
2177  | PROCEDURE insert_transaction_rec : Populate the row in transaction_rec      |
2178  * ============================================================================*/
2179 
2180   PROCEDURE insert_transaction_rec (
2181                p_transaction_rec IN OUT NOCOPY zx_api_pub.transaction_rec_type
2182               )
2183   IS
2184   BEGIN
2185 
2186     p_transaction_rec.INTERNAL_ORGANIZATION_ID := g_suite_rec_tbl.INTERNAL_ORGANIZATION_ID(1);
2187     p_transaction_rec.APPLICATION_ID           := g_suite_rec_tbl.APPLICATION_ID(1);
2188     p_transaction_rec.ENTITY_CODE              := g_suite_rec_tbl.ENTITY_CODE(1);
2189     p_transaction_rec.EVENT_CLASS_CODE         := g_suite_rec_tbl.EVENT_CLASS_CODE(1);
2190     p_transaction_rec.EVENT_TYPE_CODE          := g_suite_rec_tbl.EVENT_TYPE_CODE(1);
2191     p_transaction_rec.TRX_ID                   := g_suite_rec_tbl.TRX_ID(1);
2192 
2193   END insert_transaction_rec;
2194 
2195 
2196 /* ============================================================================*
2197  | PROCEDURE insert_row_transaction_rec : Populate the row in transaction_rec      |
2198  * ============================================================================*/
2199 
2200   PROCEDURE insert_row_transaction_rec (
2201               p_transaction_rec IN OUT NOCOPY zx_api_pub.transaction_rec_type,
2202               p_initial_row     IN NUMBER
2203               )
2204   IS
2205   BEGIN
2206 
2207     p_transaction_rec.INTERNAL_ORGANIZATION_ID := g_suite_rec_tbl.INTERNAL_ORGANIZATION_ID(p_initial_row);
2208     p_transaction_rec.APPLICATION_ID           := g_suite_rec_tbl.APPLICATION_ID(p_initial_row);
2209     p_transaction_rec.ENTITY_CODE              := g_suite_rec_tbl.ENTITY_CODE(p_initial_row);
2210     p_transaction_rec.EVENT_CLASS_CODE         := g_suite_rec_tbl.EVENT_CLASS_CODE(p_initial_row);
2211     p_transaction_rec.EVENT_TYPE_CODE          := g_suite_rec_tbl.EVENT_TYPE_CODE(p_initial_row);
2212     p_transaction_rec.TRX_ID                   := g_suite_rec_tbl.TRX_ID(p_initial_row);
2213 
2214   END insert_row_transaction_rec;
2215 
2216 
2217 /* ====================================================================================*
2218  | PROCEDURE insert_import_sum_tax_lines_gt:Insert a row in ZX_IMPORT_TAX_LINES_GT |
2219  * ====================================================================================*/
2220   PROCEDURE insert_import_sum_tax_lines_gt (
2221       p_starting_row_tax_lines IN NUMBER,
2222       p_ending_row_tax_lines   IN NUMBER)
2223   IS
2224   i NUMBER;
2225   BEGIN
2226 
2227      FORALL i in p_starting_row_tax_lines..p_ending_row_tax_lines
2228      INSERT INTO ZX_IMPORT_TAX_LINES_GT
2229     (
2230      SUMMARY_TAX_LINE_NUMBER    ,
2231      INTERNAL_ORGANIZATION_ID   ,
2232      APPLICATION_ID             ,
2233      ENTITY_CODE                ,
2234      EVENT_CLASS_CODE           ,
2235      TRX_ID                     ,
2236      TAX_REGIME_CODE            ,
2237      TAX                        ,
2238      TAX_STATUS_CODE            ,
2239      TAX_RATE_CODE              ,
2240      TAX_RATE                   ,
2241      TAX_AMT                    ,
2242      TAX_JURISDICTION_CODE      ,
2243      TAX_AMT_INCLUDED_FLAG      ,
2244      TAX_RATE_ID                ,
2245      TAX_PROVIDER_ID            ,
2246      TAX_EXCEPTION_ID           ,
2247      TAX_EXEMPTION_ID           ,
2248      EXEMPT_REASON_CODE         ,
2249      EXEMPT_CERTIFICATE_NUMBER  ,
2250      TAX_LINE_ALLOCATION_FLAG
2251      )
2252      VALUES
2253      (
2254      g_suite_rec_tbl.SUMMARY_TAX_LINE_NUMBER(i)  ,
2255      g_suite_rec_tbl.INTERNAL_ORGANIZATION_ID(i) ,
2256      g_suite_rec_tbl.APPLICATION_ID(i)           ,
2257      g_suite_rec_tbl.ENTITY_CODE(i)              ,
2258      g_suite_rec_tbl.EVENT_CLASS_CODE(i)         ,
2259      g_suite_rec_tbl.TRX_ID(i)                   ,
2260      g_suite_rec_tbl.TAX_REGIME_CODE(i)          ,
2261      g_suite_rec_tbl.TAX(i)                      ,
2262      g_suite_rec_tbl.TAX_STATUS_CODE(i)          ,
2263      g_suite_rec_tbl.TAX_RATE_CODE(i)            ,
2264      g_suite_rec_tbl.TAX_RATE(i)                 ,
2265      g_suite_rec_tbl.TAX_AMT(i)                  ,
2266      g_suite_rec_tbl.TAX_JURISDICTION_CODE(i)    ,
2267      g_suite_rec_tbl.TAX_AMT_INCLUDED_FLAG(i)    ,
2268      g_suite_rec_tbl.TAX_RATE_ID(i)              ,
2269      g_suite_rec_tbl.TAX_PROVIDER_ID(i)          ,
2270      g_suite_rec_tbl.TAX_EXCEPTION_ID(i)         ,
2271      g_suite_rec_tbl.TAX_EXEMPTION_ID(i)         ,
2272      g_suite_rec_tbl.EXEMPT_REASON_CODE(i)       ,
2273      g_suite_rec_tbl.EXEMPT_CERTIFICATE_NUMBER(i),
2274      g_suite_rec_tbl.TAX_LINE_ALLOCATION_FLAG(i)
2275      );
2276 
2277   END insert_import_sum_tax_lines_gt;
2278 
2279 
2280 /* ====================================================================*
2281  | PROCEDURE insert_trx_tax_link_gt:Insert a row in ZX_TRX_TAX_LINK_GT |
2282  * ====================================================================*/
2283   PROCEDURE insert_trx_tax_link_gt
2284       (
2285       p_sta_row_imp_tax_link   IN NUMBER,
2286       p_end_row_imp_tax_link   IN NUMBER
2287       )
2288   IS
2289   i NUMBER;
2290   BEGIN
2291     forall i in p_sta_row_imp_tax_link..p_end_row_imp_tax_link
2292     INSERT INTO ZX_TRX_TAX_LINK_GT
2293     (
2294      APPLICATION_ID                  ,
2295      ENTITY_CODE                     ,
2296      EVENT_CLASS_CODE                ,
2297      TRX_ID                          ,
2298      TRX_LEVEL_TYPE                  ,
2299      TRX_LINE_ID                     ,
2300      SUMMARY_TAX_LINE_NUMBER         ,
2301      LINE_AMT
2302     )
2303     VALUES
2304     (
2305      g_suite_rec_tbl.APPLICATION_ID(i)           ,
2306      g_suite_rec_tbl.ENTITY_CODE(i)              ,
2307      g_suite_rec_tbl.EVENT_CLASS_CODE(i)         ,
2308      g_suite_rec_tbl.TRX_ID(i)                   ,
2309      g_suite_rec_tbl.TRX_LEVEL_TYPE(i)           ,
2310      g_suite_rec_tbl.TRX_LINE_ID(i)              ,
2311      g_suite_rec_tbl.SUMMARY_TAX_LINE_NUMBER(i)  ,
2312      g_suite_rec_tbl.LINE_AMT(i)
2313     );
2314 
2315   END insert_trx_tax_link_gt;
2316 
2317 
2318 /* =============================================================================*
2319  | PROCEDURE insert_reverse_trx_lines_gt:Insert a row in ZX_REVERSE_TRX_LINES_GT|
2320  * =============================================================================*/
2321   PROCEDURE insert_reverse_trx_lines_gt
2322   IS
2323   i NUMBER;
2324   BEGIN
2325 
2326   forall i in g_suite_rec_tbl.application_id.first..g_suite_rec_tbl.application_id.last
2327   INSERT INTO ZX_REVERSE_TRX_LINES_GT
2328   (
2329     INTERNAL_ORGANIZATION_ID    ,
2330     REVERSING_APPLN_ID          ,
2331     REVERSING_ENTITY_CODE       ,
2332     REVERSING_EVNT_CLS_CODE     ,
2333     REVERSING_TRX_ID            ,
2334     REVERSING_TRX_LEVEL_TYPE    ,
2335     REVERSING_TRX_LINE_ID       ,
2336     REVERSED_APPLN_ID           ,
2337     REVERSED_ENTITY_CODE        ,
2338     REVERSED_EVNT_CLS_CODE      ,
2339     REVERSED_TRX_ID             ,
2340     REVERSED_TRX_LEVEL_TYPE     ,
2341     REVERSED_TRX_LINE_ID        ,
2342     TRX_LINE_DESCRIPTION        ,
2343     PRODUCT_DESCRIPTION         ,
2344     TRX_WAYBILL_NUMBER          ,
2345     TRX_LINE_GL_DATE            ,
2346     MERCHANT_PARTY_DOCUMENT_NUMBER
2347    )
2348    VALUES
2349    (
2350     g_suite_rec_tbl.INTERNAL_ORGANIZATION_ID(i) ,
2351     g_suite_rec_tbl.REVERSING_APPLN_ID(i)       ,
2352     g_suite_rec_tbl.REVERSING_ENTITY_CODE(i)    ,
2353     g_suite_rec_tbl.REVERSING_EVNT_CLS_CODE(i)  ,
2354     g_suite_rec_tbl.REVERSING_TRX_ID(i)         ,
2355     g_suite_rec_tbl.REVERSING_TRX_LEVEL_TYPE(i) ,
2356     g_suite_rec_tbl.REVERSING_TRX_LINE_ID(i)    ,
2357     g_suite_rec_tbl.REVERSED_APPLN_ID(i)        ,
2358     g_suite_rec_tbl.REVERSED_ENTITY_CODE(i)     ,
2359     g_suite_rec_tbl.REVERSED_EVNT_CLS_CODE(i)   ,
2360     g_suite_rec_tbl.REVERSED_TRX_ID(i)          ,
2361     g_suite_rec_tbl.REVERSED_TRX_LEVEL_TYPE(i)  ,
2362     g_suite_rec_tbl.REVERSED_TRX_LINE_ID(i)     ,
2363     g_suite_rec_tbl.TRX_LINE_DESCRIPTION(i)      ,
2364     g_suite_rec_tbl.PRODUCT_DESCRIPTION(i)       ,
2365     g_suite_rec_tbl.TRX_WAYBILL_NUMBER(i)        ,
2366     g_suite_rec_tbl.TRX_LINE_GL_DATE(i)          ,
2367     g_suite_rec_tbl.MERCHANT_PARTY_DOCUMENT_NUMBER(i)
2368     );
2369 
2370   END insert_reverse_trx_lines_gt;
2371 
2372 
2373 /* ===============================================================================*
2374  | PROCEDURE insert_reverse_dist_lines_gt:Insert a row in ZX_REVERSE_TRX_LINES_GT |
2375  * ===============================================================================*/
2376   PROCEDURE insert_reverse_dist_lines_gt
2377   IS
2378   i NUMBER;
2379   BEGIN
2380 
2381   forall i in g_suite_rec_tbl.application_id.first..g_suite_rec_tbl.application_id.last
2382   INSERT INTO ZX_REVERSE_DIST_GT
2383   (
2384      INTERNAL_ORGANIZATION_ID,
2385      REVERSING_APPLN_ID,
2386      REVERSING_ENTITY_CODE,
2387      REVERSING_EVNT_CLS_CODE,
2388      REVERSING_TRX_ID,
2389      REVERSING_TRX_LEVEL_TYPE,
2390      REVERSING_TRX_LINE_ID,
2391      REVERSING_TRX_LINE_DIST_ID,
2392      REVERSING_TAX_LINE_ID,
2393      REVERSED_APPLN_ID,
2394      REVERSED_ENTITY_CODE,
2395      REVERSED_EVNT_CLS_CODE,
2396      REVERSED_TRX_ID,
2397      REVERSED_TRX_LEVEL_TYPE,
2398      REVERSED_TRX_LINE_ID,
2399      REVERSED_TRX_LINE_DIST_ID,
2400      FIRST_PTY_ORG_ID         ,
2401      REVERSED_TAX_LINE_ID
2402    )
2403    VALUES
2404    (
2405      g_suite_rec_tbl.INTERNAL_ORGANIZATION_ID(i),
2406      g_suite_rec_tbl.REVERSING_APPLN_ID(i),
2407      g_suite_rec_tbl.REVERSING_ENTITY_CODE(i),
2408      g_suite_rec_tbl.REVERSING_EVNT_CLS_CODE(i),
2409      g_suite_rec_tbl.REVERSING_TRX_ID(i),
2410      g_suite_rec_tbl.REVERSING_TRX_LEVEL_TYPE(i),
2411      g_suite_rec_tbl.REVERSING_TRX_LINE_ID(i),
2412      g_suite_rec_tbl.REVERSING_TRX_LINE_DIST_ID(i),
2413      g_suite_rec_tbl.REVERSING_TAX_LINE_ID(i),
2414      g_suite_rec_tbl.REVERSED_APPLN_ID(i),
2415      g_suite_rec_tbl.REVERSED_ENTITY_CODE(i),
2416      g_suite_rec_tbl.REVERSED_EVNT_CLS_CODE(i),
2417      g_suite_rec_tbl.REVERSED_TRX_ID(i),
2418      g_suite_rec_tbl.REVERSED_TRX_LEVEL_TYPE(i)           ,
2419      g_suite_rec_tbl.REVERSED_TRX_LINE_ID(i)              ,
2420      g_suite_rec_tbl.REVERSED_TRX_LINE_DIST_ID(i)         ,
2421      g_suite_rec_tbl.FIRST_PTY_ORG_ID(i)                   ,
2422      g_suite_rec_tbl.REVERSED_TAX_LINE_ID(i)
2423     );
2424 
2425   END insert_reverse_dist_lines_gt;
2426 
2427 
2428 /* ================================================================================*
2429  | PROCEDURE insert_itm_distributions_gt:Insert a row in ZX_ITM_DISTRIBUTIONS_GT   |
2430  * ================================================================================*/
2431   PROCEDURE insert_itm_distributions_gt
2432       (
2433       p_header_row        IN NUMBER,
2434       p_sta_row_item_dist IN NUMBER,
2435       p_end_row_item_dist IN NUMBER
2436       )
2437 
2438   IS
2439   i NUMBER;
2440   BEGIN
2441 
2442     forall i in p_sta_row_item_dist..p_end_row_item_dist
2443     INSERT INTO ZX_ITM_DISTRIBUTIONS_GT
2444     (
2445      APPLICATION_ID                           ,
2446      ENTITY_CODE                              ,
2447      EVENT_CLASS_CODE                         ,
2448      TRX_ID                                   ,
2449      TRX_LINE_ID                              ,
2450      TRX_LEVEL_TYPE                           ,
2451      TRX_LINE_DIST_ID                         ,
2452      DIST_LEVEL_ACTION                        ,
2453      TRX_LINE_DIST_DATE                       ,
2454      ITEM_DIST_NUMBER                         ,
2455      DIST_INTENDED_USE                        ,
2456      TAX_INCLUSION_FLAG                       ,
2457      TAX_CODE                                 ,
2458      APPLIED_FROM_TAX_DIST_ID                 ,
2459      ADJUSTED_DOC_TAX_DIST_ID                 ,
2460      TASK_ID                                  ,
2461      AWARD_ID                                 ,
2462      PROJECT_ID                               ,
2463      EXPENDITURE_TYPE                         ,
2464      EXPENDITURE_ORGANIZATION_ID              ,
2465      EXPENDITURE_ITEM_DATE                    ,
2466      TRX_LINE_DIST_AMT                        ,
2467      TRX_LINE_DIST_QTY                        ,
2468      TRX_LINE_QUANTITY                        ,
2469      ACCOUNT_CCID                             ,
2470      ACCOUNT_STRING                           ,
2471      REF_DOC_APPLICATION_ID                   ,
2472      REF_DOC_ENTITY_CODE                      ,
2473      REF_DOC_EVENT_CLASS_CODE                 ,
2474      REF_DOC_TRX_ID                           ,
2475      REF_DOC_LINE_ID                          ,
2476      REF_DOC_DIST_ID                          ,
2477      REF_DOC_CURR_CONV_RATE                   ,
2478      TRX_LINE_DIST_TAX_AMT                    ,
2479      HISTORICAL_FLAG                          ,
2480      APPLIED_FROM_APPLICATION_ID              ,
2481      APPLIED_FROM_EVENT_CLASS_CODE            ,
2482      APPLIED_FROM_ENTITY_CODE                 ,
2483      APPLIED_FROM_TRX_ID                      ,
2484      APPLIED_FROM_LINE_ID                     ,
2485      APPLIED_FROM_DIST_ID                     ,
2486      ADJUSTED_DOC_APPLICATION_ID              ,
2487      ADJUSTED_DOC_EVENT_CLASS_CODE            ,
2488      ADJUSTED_DOC_ENTITY_CODE                 ,
2489      ADJUSTED_DOC_TRX_ID                      ,
2490      ADJUSTED_DOC_LINE_ID                     ,
2491      ADJUSTED_DOC_DIST_ID                     ,
2492      APPLIED_TO_DOC_CURR_CONV_RATE            ,
2493      TAX_VARIANCE_CALC_FLAG
2494     )
2495     VALUES
2496     (
2497       g_suite_rec_tbl.APPLICATION_ID(p_header_row)        ,
2498       g_suite_rec_tbl.ENTITY_CODE(p_header_row)           ,
2499       g_suite_rec_tbl.EVENT_CLASS_CODE(p_header_row)      ,
2500       g_suite_rec_tbl.TRX_ID(p_header_row)                ,
2501       g_suite_rec_tbl.TRX_LINE_ID(i)                      ,
2502       g_suite_rec_tbl.TRX_LEVEL_TYPE(i)                   ,
2503       g_suite_rec_tbl.TRX_LINE_DIST_ID(i)                 ,
2504       g_suite_rec_tbl.DIST_LEVEL_ACTION(i)                ,
2505       g_suite_rec_tbl.TRX_LINE_DIST_DATE(i)               ,
2506       g_suite_rec_tbl.ITEM_DIST_NUMBER(i)                 ,
2507       g_suite_rec_tbl.DIST_INTENDED_USE(i)                ,
2508       g_suite_rec_tbl.TAX_INCLUSION_FLAG(i)               ,
2509       g_suite_rec_tbl.TAX_CODE(i)                         ,
2510       g_suite_rec_tbl.APPLIED_FROM_TAX_DIST_ID(i)         ,
2511       g_suite_rec_tbl.ADJUSTED_DOC_TAX_DIST_ID(i)         ,
2512       g_suite_rec_tbl.TASK_ID(i)                          ,
2513       g_suite_rec_tbl.AWARD_ID(i)                         ,
2514       g_suite_rec_tbl.PROJECT_ID(i)                       ,
2515       g_suite_rec_tbl.EXPENDITURE_TYPE(i)                 ,
2516       g_suite_rec_tbl.EXPENDITURE_ORGANIZATION_ID(i)      ,
2517       g_suite_rec_tbl.EXPENDITURE_ITEM_DATE(i)            ,
2518       g_suite_rec_tbl.TRX_LINE_DIST_AMT(i)                ,
2519       g_suite_rec_tbl.TRX_LINE_DIST_QUANTITY(i)           ,
2520       g_suite_rec_tbl.TRX_LINE_QUANTITY(i)                ,
2521       g_suite_rec_tbl.ACCOUNT_CCID(i)                     ,
2522       g_suite_rec_tbl.ACCOUNT_STRING(i)                   ,
2523       g_suite_rec_tbl.REF_DOC_APPLICATION_ID(i)           ,
2524       g_suite_rec_tbl.REF_DOC_ENTITY_CODE(i)              ,
2525       g_suite_rec_tbl.REF_DOC_EVENT_CLASS_CODE(i)         ,
2526       g_suite_rec_tbl.REF_DOC_TRX_ID(i)                   ,
2527       g_suite_rec_tbl.REF_DOC_LINE_ID(i)                  ,
2528       g_suite_rec_tbl.REF_DOC_DIST_ID(i)                  ,
2529       g_suite_rec_tbl.REF_DOC_CURR_CONV_RATE(i)           ,
2530       g_suite_rec_tbl.TRX_LINE_DIST_TAX_AMT(i)            ,
2531       g_suite_rec_tbl.HISTORICAL_FLAG(i)                  ,
2532       g_suite_rec_tbl.APPLIED_FROM_APPLICATION_ID(i)      ,
2533       g_suite_rec_tbl.APPLIED_FROM_EVENT_CLASS_CODE(i)    ,
2534       g_suite_rec_tbl.APPLIED_FROM_ENTITY_CODE(i)         ,
2535       g_suite_rec_tbl.APPLIED_FROM_TRX_ID(i)              ,
2536       g_suite_rec_tbl.APPLIED_FROM_LINE_ID(i)             ,
2537       g_suite_rec_tbl.APPLIED_FROM_DIST_ID(i)             ,
2538       g_suite_rec_tbl.ADJUSTED_DOC_APPLICATION_ID(i)      ,
2539       g_suite_rec_tbl.ADJUSTED_DOC_EVENT_CLASS_CODE(i)    ,
2540       g_suite_rec_tbl.adjusted_doc_entity_code(i)         ,
2541       g_suite_rec_tbl.ADJUSTED_DOC_TRX_ID(i)              ,
2542       g_suite_rec_tbl.ADJUSTED_DOC_LINE_ID(i)             ,
2543       g_suite_rec_tbl.ADJUSTED_DOC_DIST_ID(i)             ,
2544       g_suite_rec_tbl.APPLIED_TO_DOC_CURR_CONV_RATE(i)    ,
2545       g_suite_rec_tbl.TAX_VARIANCE_CALC_FLAG(i)           );
2546 
2547   END insert_itm_distributions_gt;
2548 
2549 
2550 /* ========================================================================*
2551  | PROCEDURE Insert rows into ZX_TAX_DIST_ID_GT from zx_rec_nrec_dist      |
2552  * ========================================================================*/
2553   PROCEDURE insert_rows_tax_dist_id_gt( p_trx_id IN NUMBER)
2554   IS
2555   BEGIN
2556        INSERT INTO ZX_TAX_DIST_ID_GT
2557        (
2558          TAX_DIST_ID
2559        )
2560        SELECT
2561          REC_NREC_TAX_DIST_ID
2562        FROM ZX_REC_NREC_DIST
2563        WHERE TRX_ID = p_trx_id;
2564 
2565   END insert_rows_tax_dist_id_gt;
2566 
2567 
2568 /* =========================================================================*
2569  | PROCEDURE insert_sync_trx_rec: Insert the row in the sync trx record     |
2570  * =========================================================================*/
2571   PROCEDURE insert_sync_trx_rec
2572     (
2573      p_header_row IN NUMBER,
2574      x_sync_trx_rec OUT NOCOPY zx_api_pub.sync_trx_rec_type
2575     )
2576   IS
2577   BEGIN
2578    x_sync_trx_rec.APPLICATION_ID                 := g_suite_rec_tbl.APPLICATION_ID(p_header_row);
2579    x_sync_trx_rec.ENTITY_CODE                    := g_suite_rec_tbl.ENTITY_CODE(p_header_row);
2580    x_sync_trx_rec.EVENT_CLASS_CODE               := g_suite_rec_tbl.EVENT_CLASS_CODE(p_header_row);
2581    x_sync_trx_rec.EVENT_TYPE_CODE                := g_suite_rec_tbl.EVENT_TYPE_CODE(p_header_row);
2582    x_sync_trx_rec.TRX_ID                         := g_suite_rec_tbl.TRX_ID(p_header_row);
2583    x_sync_trx_rec.TRX_NUMBER                     := g_suite_rec_tbl.TRX_NUMBER(p_header_row);
2584    x_sync_trx_rec.TRX_DESCRIPTION                := g_suite_rec_tbl.TRX_DESCRIPTION(p_header_row);
2585    x_sync_trx_rec.TRX_COMMUNICATED_DATE          := g_suite_rec_tbl.TRX_COMMUNICATED_DATE(p_header_row);
2586    x_sync_trx_rec.BATCH_SOURCE_ID                := g_suite_rec_tbl.BATCH_SOURCE_ID(p_header_row);
2587    x_sync_trx_rec.BATCH_SOURCE_NAME              := g_suite_rec_tbl.BATCH_SOURCE_NAME(p_header_row);
2588    x_sync_trx_rec.DOC_SEQ_ID                     := g_suite_rec_tbl.DOC_SEQ_ID(p_header_row);
2589    x_sync_trx_rec.DOC_SEQ_NAME                   := g_suite_rec_tbl.DOC_SEQ_NAME(p_header_row);
2590    x_sync_trx_rec.DOC_SEQ_VALUE                  := g_suite_rec_tbl.DOC_SEQ_VALUE(p_header_row);
2591    x_sync_trx_rec.TRX_DUE_DATE                   := g_suite_rec_tbl.TRX_DUE_DATE(p_header_row);
2592    x_sync_trx_rec.TRX_TYPE_DESCRIPTION           := g_suite_rec_tbl.TRX_TYPE_DESCRIPTION(p_header_row);
2593    x_sync_trx_rec.SUPPLIER_TAX_INVOICE_NUMBER    := g_suite_rec_tbl.SUPPLIER_TAX_INVOICE_NUMBER(p_header_row);
2594    x_sync_trx_rec.SUPPLIER_TAX_INVOICE_DATE      := g_suite_rec_tbl.SUPPLIER_TAX_INVOICE_DATE(p_header_row);
2595    x_sync_trx_rec.SUPPLIER_EXCHANGE_RATE         := g_suite_rec_tbl.SUPPLIER_EXCHANGE_RATE(p_header_row);
2596    x_sync_trx_rec.TAX_INVOICE_DATE               := g_suite_rec_tbl.TAX_INVOICE_DATE(p_header_row);
2597   END insert_sync_trx_rec;
2598 
2599 
2600 /* ==========================================================================*
2601  | PROCEDURE insert_sync_trx_lines_tbl:Insert a row in ZX_SYNC_TRX_LINES_tbl |
2602  * ==========================================================================*/
2603 
2604   PROCEDURE insert_sync_trx_lines_tbl(
2605               p_header_row                  IN NUMBER,
2606               p_starting_row_sync_trx_lines IN NUMBER,
2607               p_ending_row_sync_trx_lines   IN NUMBER,
2608               x_sync_trx_lines_tbl          OUT NOCOPY zx_api_pub.sync_trx_lines_tbl_type%type)
2609   IS
2610     i NUMBER;
2611     l_counter NUMBER;
2612   BEGIN
2613     l_counter := 1;
2614     FOR i in p_starting_row_sync_trx_lines..p_ending_row_sync_trx_lines
2615     LOOP
2616       x_sync_trx_lines_tbl.application_id(l_counter)                 := g_suite_rec_tbl.application_id(p_header_row);
2617       x_sync_trx_lines_tbl.entity_code(l_counter)                    := g_suite_rec_tbl.entity_code(p_header_row);
2618       x_sync_trx_lines_tbl.event_class_code(l_counter)               := g_suite_rec_tbl.event_class_code(p_header_row);
2619       x_sync_trx_lines_tbl.trx_id(l_counter)                         := g_suite_rec_tbl.trx_id(p_header_row);
2620       x_sync_trx_lines_tbl.trx_level_type(l_counter)                 := g_suite_rec_tbl.trx_level_type(i);
2621       x_sync_trx_lines_tbl.trx_line_id(l_counter)                    := g_suite_rec_tbl.trx_line_id(i);
2622       x_sync_trx_lines_tbl.trx_waybill_number(l_counter)             := g_suite_rec_tbl.trx_waybill_number(i);
2623       x_sync_trx_lines_tbl.trx_line_description(l_counter)           := g_suite_rec_tbl.trx_line_description(i);
2624       x_sync_trx_lines_tbl.product_description(l_counter)            := g_suite_rec_tbl.product_description(i);
2625       x_sync_trx_lines_tbl.trx_line_gl_date(l_counter)               := g_suite_rec_tbl.trx_line_gl_date(i);
2626       x_sync_trx_lines_tbl.merchant_party_name(l_counter)            := g_suite_rec_tbl.merchant_party_name(i);
2627       x_sync_trx_lines_tbl.merchant_party_document_number(l_counter) := g_suite_rec_tbl.merchant_party_document_number(i);
2628       x_sync_trx_lines_tbl.merchant_party_reference(l_counter)       := g_suite_rec_tbl.merchant_party_reference(i);
2629       x_sync_trx_lines_tbl.merchant_party_taxpayer_id(l_counter)     := g_suite_rec_tbl.merchant_party_taxpayer_id(i);
2630       x_sync_trx_lines_tbl.merchant_party_tax_reg_number(l_counter)  := g_suite_rec_tbl.merchant_party_tax_reg_number(i);
2631       x_sync_trx_lines_tbl.asset_number(l_counter)                   := g_suite_rec_tbl.asset_number(i);
2632 
2633       l_counter := l_counter + 1;
2634     END LOOP;
2635   END insert_sync_trx_lines_tbl;
2636 
2637 
2638 
2639 /* ============================================================================*
2640  | PROCEDURE insert_transaction_line_rec: Populate the transaction_line_rec    |
2641  * ============================================================================*/
2642   PROCEDURE insert_transaction_line_rec (
2643          p_transaction_line_rec IN OUT NOCOPY zx_api_pub.transaction_line_rec_type,
2644          p_row_trx_line         IN NUMBER
2645          )
2646   IS
2647   BEGIN
2648 
2649     p_transaction_line_rec.INTERNAL_ORGANIZATION_ID := g_suite_rec_tbl.internal_organization_id(p_row_trx_line);
2650     p_transaction_line_rec.APPLICATION_ID           := g_suite_rec_tbl.application_id(p_row_trx_line);
2651     p_transaction_line_rec.ENTITY_CODE              := g_suite_rec_tbl.entity_code(p_row_trx_line);
2652     p_transaction_line_rec.EVENT_CLASS_CODE         := g_suite_rec_tbl.event_class_code(p_row_trx_line);
2653     p_transaction_line_rec.EVENT_TYPE_CODE          := g_suite_rec_tbl.event_type_code(p_row_trx_line);
2654     p_transaction_line_rec.TRX_ID                   := g_suite_rec_tbl.trx_id(p_row_trx_line);
2655     p_transaction_line_rec.TRX_LINE_ID              := g_suite_rec_tbl.trx_line_id(p_row_trx_line);
2656     p_transaction_line_rec.TRX_LEVEL_TYPE           := g_suite_rec_tbl.trx_level_type(p_row_trx_line);
2657 
2658     write_message('A row has been inserted in g_transaction_line_rec.');
2659     write_message('~ INTERNAL_ORGANIZATION_ID '||to_char(g_transaction_line_rec.INTERNAL_ORGANIZATION_ID));
2660     write_message('~ APPLICATION_ID '          ||to_char(g_transaction_line_rec.APPLICATION_ID));
2661     write_message('~ ENTITY_CODE '             ||        g_transaction_line_rec.ENTITY_CODE);
2662     write_message('~ EVENT_CLASS_CODE '        ||        g_transaction_line_rec.EVENT_CLASS_CODE);
2663     write_message('~ EVENT_TYPE_CODE '         ||        g_transaction_line_rec.EVENT_TYPE_CODE);
2664     write_message('~ TRX_ID '                  ||to_char(g_transaction_line_rec.TRX_ID));
2665     write_message('~ TRX_LINE_ID '             ||to_char(g_transaction_line_rec.TRX_LINE_ID));
2666     write_message('~ TRX_LEVEL_TYPE '          ||        g_transaction_line_rec.TRX_LEVEL_TYPE);
2667 
2668 
2669   END insert_transaction_line_rec;
2670 
2671 
2672 
2673 /* ======================================================================*
2674  | PROCEDURE delete_table :     Reset the record of tables               |
2675  * ======================================================================*/
2676 
2677   PROCEDURE delete_table IS
2678 
2679   BEGIN
2680    g_suite_rec_tbl.ROW_ID.delete;
2681    g_suite_rec_tbl.ROW_SUITE.delete;
2682    g_suite_rec_tbl.ROW_CASE.delete;
2683    g_suite_rec_tbl.ROW_API.delete;
2684    g_suite_rec_tbl.ROW_SERVICE.delete;
2685    g_suite_rec_tbl.ROW_STRUCTURE.delete;
2686    g_suite_rec_tbl.INTERNAL_ORGANIZATION_ID.delete;
2687    g_suite_rec_tbl.INTERNAL_ORG_LOCATION_ID.delete;
2688    g_suite_rec_tbl.APPLICATION_ID.delete;
2689    g_suite_rec_tbl.ENTITY_CODE.delete;
2690    g_suite_rec_tbl.EVENT_CLASS_CODE.delete;
2691    g_suite_rec_tbl.TAX_EVENT_CLASS_CODE.delete;
2692    g_suite_rec_tbl.DOC_EVENT_STATUS.delete;
2693    g_suite_rec_tbl.TAX_HOLD_RELEASED_CODE.delete;
2694    g_suite_rec_tbl.EVENT_TYPE_CODE.delete;
2695    g_suite_rec_tbl.TRX_ID.delete;
2696    g_suite_rec_tbl.OVERRIDE_LEVEL.delete;
2697    g_suite_rec_tbl.TRX_LEVEL_TYPE.delete;
2698    g_suite_rec_tbl.TRX_LINE_ID.delete;
2699    g_suite_rec_tbl.TRX_WAYBILL_NUMBER.delete;
2700    g_suite_rec_tbl.TRX_LINE_DESCRIPTION.delete;
2701    g_suite_rec_tbl.PRODUCT_DESCRIPTION.delete;
2702    g_suite_rec_tbl.TAX_LINE_ID.delete;
2703    g_suite_rec_tbl.SUMMARY_TAX_LINE_ID.delete;
2704    g_suite_rec_tbl.INVOICE_PRICE_VARIANCE.delete;
2705    g_suite_rec_tbl.LINE_LEVEL_ACTION.delete;
2706    g_suite_rec_tbl.TAX_CLASSIFICATION_CODE.delete;
2707    g_suite_rec_tbl.TRX_DATE.delete;
2708    g_suite_rec_tbl.TRX_DOC_REVISION.delete;
2709    g_suite_rec_tbl.LEDGER_ID.delete;
2710    g_suite_rec_tbl.TAX_RATE_ID.delete;
2711    g_suite_rec_tbl.TRX_CURRENCY_CODE.delete;
2712    g_suite_rec_tbl.CURRENCY_CONVERSION_DATE.delete;
2713    g_suite_rec_tbl.CURRENCY_CONVERSION_RATE.delete;
2714    g_suite_rec_tbl.CURRENCY_CONVERSION_TYPE.delete;
2715    g_suite_rec_tbl.MINIMUM_ACCOUNTABLE_UNIT.delete;
2716    g_suite_rec_tbl.PRECISION.delete;
2717    g_suite_rec_tbl.TRX_SHIPPING_DATE.delete;
2718    g_suite_rec_tbl.TRX_RECEIPT_DATE.delete;
2719    g_suite_rec_tbl.LEGAL_ENTITY_ID.delete;
2720    g_suite_rec_tbl.REVERSING_APPLN_ID.delete;
2721    g_suite_rec_tbl.ROUNDING_SHIP_TO_PARTY_ID.delete;
2722    g_suite_rec_tbl.ROUNDING_SHIP_FROM_PARTY_ID.delete;
2723    g_suite_rec_tbl.ROUNDING_BILL_TO_PARTY_ID.delete;
2724    g_suite_rec_tbl.ROUNDING_BILL_FROM_PARTY_ID.delete;
2725    g_suite_rec_tbl.RNDG_SHIP_TO_PARTY_SITE_ID.delete;
2726    g_suite_rec_tbl.RNDG_SHIP_FROM_PARTY_SITE_ID.delete;
2727    g_suite_rec_tbl.RNDG_BILL_TO_PARTY_SITE_ID.delete;
2728    g_suite_rec_tbl.RNDG_BILL_FROM_PARTY_SITE_ID.delete;
2729    g_suite_rec_tbl.ESTABLISHMENT_ID.delete;
2730    g_suite_rec_tbl.TAX_EXEMPTION_ID.delete;
2731    g_suite_rec_tbl.REC_NREC_TAX_DIST_ID.delete;
2732    g_suite_rec_tbl.TAX_APPORTIONMENT_LINE_NUMBER.delete;
2733    g_suite_rec_tbl.EXEMPTION_RATE.delete;
2734    g_suite_rec_tbl.TOTAL_NREC_TAX_AMT.delete;
2735    g_suite_rec_tbl.TOTAL_REC_TAX_AMT.delete;
2736    g_suite_rec_tbl.REC_TAX_AMT.delete;
2737    g_suite_rec_tbl.NREC_TAX_AMT.delete;
2738    g_suite_rec_tbl.MERCHANT_PARTY_DOCUMENT_NUMBER.delete;
2739    g_suite_rec_tbl.TRX_LINE_TYPE.delete;
2740    g_suite_rec_tbl.TAX_REGISTRATION_NUMBER.delete;
2741    g_suite_rec_tbl.CTRL_TOTAL_HDR_TX_AMT.delete;
2742    g_suite_rec_tbl.EXEMPT_REASON_CODE.delete;
2743    g_suite_rec_tbl.TAX_HOLD_CODE.delete;
2744    g_suite_rec_tbl.TAX_AMT_FUNCL_CURR.delete;
2745    g_suite_rec_tbl.TOTAL_REC_TAX_AMT_FUNCL_CURR.delete;
2746    g_suite_rec_tbl.TOTAL_NREC_TAX_AMT_FUNCL_CURR.delete;
2747    g_suite_rec_tbl.TAXABLE_AMT_FUNCL_CURR.delete;
2748    g_suite_rec_tbl.REC_TAX_AMT_FUNCL_CURR.delete;
2749    g_suite_rec_tbl.NREC_TAX_AMT_FUNCL_CURR.delete;
2750    g_suite_rec_tbl.TRX_LINE_DATE.delete;
2751    g_suite_rec_tbl.TRX_BUSINESS_CATEGORY.delete;
2752    g_suite_rec_tbl.LINE_INTENDED_USE.delete;
2753    g_suite_rec_tbl.USER_DEFINED_FISC_CLASS.delete;
2754    g_suite_rec_tbl.TAX_CODE.delete;
2755    g_suite_rec_tbl.TAX_INCLUSION_FLAG.delete;
2756    g_suite_rec_tbl.TAX_AMT_INCLUDED_FLAG.delete;
2757    g_suite_rec_tbl.SELF_ASSESSED_FLAG.delete;
2758    g_suite_rec_tbl.QUOTE_FLAG.delete;
2759    g_suite_rec_tbl.HISTORICAL_FLAG.delete;
2760    g_suite_rec_tbl.MANUALLY_ENTERED_FLAG.delete;
2761    g_suite_rec_tbl.LINE_AMT.delete;
2762    g_suite_rec_tbl.TRX_LINE_QUANTITY.delete;
2763    g_suite_rec_tbl.UNIT_PRICE.delete;
2764    g_suite_rec_tbl.EXEMPT_CERTIFICATE_NUMBER.delete;
2765    g_suite_rec_tbl.EXEMPT_REASON.delete;
2766    g_suite_rec_tbl.CASH_DISCOUNT.delete;
2767    g_suite_rec_tbl.VOLUME_DISCOUNT.delete;
2768    g_suite_rec_tbl.TRADING_DISCOUNT.delete;
2769    g_suite_rec_tbl.TRANSFER_CHARGE.delete;
2770    g_suite_rec_tbl.TRANSPORTATION_CHARGE.delete;
2771    g_suite_rec_tbl.INSURANCE_CHARGE.delete;
2772    g_suite_rec_tbl.OTHER_CHARGE.delete;
2773    g_suite_rec_tbl.PRODUCT_ID.delete;
2774    g_suite_rec_tbl.PRODUCT_FISC_CLASSIFICATION.delete;
2775    g_suite_rec_tbl.PRODUCT_ORG_ID.delete;
2776    g_suite_rec_tbl.UOM_CODE.delete;
2777    g_suite_rec_tbl.PRODUCT_TYPE.delete;
2778    g_suite_rec_tbl.PRODUCT_CODE.delete;
2779    g_suite_rec_tbl.PRODUCT_CATEGORY.delete;
2780    g_suite_rec_tbl.TRX_SIC_CODE.delete;
2781    g_suite_rec_tbl.FOB_POINT.delete;
2782    g_suite_rec_tbl.SHIP_TO_PARTY_ID.delete;
2783    g_suite_rec_tbl.SHIP_FROM_PARTY_ID.delete;
2784    g_suite_rec_tbl.POA_PARTY_ID.delete;
2785    g_suite_rec_tbl.POO_PARTY_ID.delete;
2786    g_suite_rec_tbl.BILL_TO_PARTY_ID.delete;
2787    g_suite_rec_tbl.BILL_FROM_PARTY_ID.delete;
2788    g_suite_rec_tbl.MERCHANT_PARTY_ID.delete;
2789    g_suite_rec_tbl.SHIP_TO_PARTY_SITE_ID.delete;
2790    g_suite_rec_tbl.SHIP_FROM_PARTY_SITE_ID.delete;
2791    g_suite_rec_tbl.POA_PARTY_SITE_ID.delete;
2792    g_suite_rec_tbl.POO_PARTY_SITE_ID.delete;
2793    g_suite_rec_tbl.BILL_TO_PARTY_SITE_ID.delete;
2794    g_suite_rec_tbl.BILL_FROM_PARTY_SITE_ID.delete;
2795    g_suite_rec_tbl.SHIP_TO_LOCATION_ID.delete;
2796    g_suite_rec_tbl.SHIP_FROM_LOCATION_ID.delete;
2797    g_suite_rec_tbl.POA_LOCATION_ID.delete;
2798    g_suite_rec_tbl.POO_LOCATION_ID.delete;
2799    g_suite_rec_tbl.BILL_TO_LOCATION_ID.delete;
2800    g_suite_rec_tbl.BILL_FROM_LOCATION_ID.delete;
2801    g_suite_rec_tbl.ACCOUNT_CCID.delete;
2802    g_suite_rec_tbl.ACCOUNT_STRING.delete;
2803    g_suite_rec_tbl.MERCHANT_PARTY_COUNTRY.delete;
2804    g_suite_rec_tbl.RECEIVABLES_TRX_TYPE_ID.delete;
2805    g_suite_rec_tbl.REF_DOC_APPLICATION_ID.delete;
2806    g_suite_rec_tbl.REF_DOC_ENTITY_CODE.delete;
2807    g_suite_rec_tbl.REF_DOC_EVENT_CLASS_CODE.delete;
2808    g_suite_rec_tbl.REF_DOC_TRX_ID.delete;
2809    g_suite_rec_tbl.REF_DOC_LINE_ID.delete;
2810    g_suite_rec_tbl.REF_DOC_LINE_QUANTITY.delete;
2811    g_suite_rec_tbl.RELATED_DOC_APPLICATION_ID.delete;
2812    g_suite_rec_tbl.RELATED_DOC_ENTITY_CODE.delete;
2813    g_suite_rec_tbl.RELATED_DOC_EVENT_CLASS_CODE.delete;
2814    g_suite_rec_tbl.RELATED_DOC_TRX_ID.delete;
2815    g_suite_rec_tbl.RELATED_DOC_NUMBER.delete;
2816    g_suite_rec_tbl.RELATED_DOC_DATE.delete;
2817    g_suite_rec_tbl.APPLIED_FROM_APPLICATION_ID.delete;
2818    g_suite_rec_tbl.APPLIED_FROM_ENTITY_CODE.delete;
2819    g_suite_rec_tbl.APPLIED_FROM_EVENT_CLASS_CODE.delete;
2820    g_suite_rec_tbl.APPLIED_FROM_TRX_ID.delete;
2821    g_suite_rec_tbl.APPLIED_FROM_LINE_ID.delete;
2822    g_suite_rec_tbl.ADJUSTED_DOC_APPLICATION_ID.delete;
2823    g_suite_rec_tbl.ADJUSTED_DOC_ENTITY_CODE.delete;
2824    g_suite_rec_tbl.ADJUSTED_DOC_EVENT_CLASS_CODE.delete;
2825    g_suite_rec_tbl.ADJUSTED_DOC_TRX_ID.delete;
2826    g_suite_rec_tbl.ADJUSTED_DOC_LINE_ID.delete;
2827    g_suite_rec_tbl.ADJUSTED_DOC_NUMBER.delete;
2828    g_suite_rec_tbl.ASSESSABLE_VALUE.delete;
2829    g_suite_rec_tbl.ADJUSTED_DOC_DATE.delete;
2830    g_suite_rec_tbl.APPLIED_TO_APPLICATION_ID.delete;
2831    g_suite_rec_tbl.APPLIED_TO_ENTITY_CODE.delete;
2832    g_suite_rec_tbl.APPLIED_TO_EVENT_CLASS_CODE.delete;
2833    g_suite_rec_tbl.APPLIED_TO_TRX_ID.delete;
2834    g_suite_rec_tbl.APPLIED_TO_TRX_LINE_ID.delete;
2835    g_suite_rec_tbl.TRX_LINE_NUMBER.delete;
2836    g_suite_rec_tbl.TRX_NUMBER.delete;
2837    g_suite_rec_tbl.TRX_DESCRIPTION.delete;
2838    g_suite_rec_tbl.TRX_COMMUNICATED_DATE.delete;
2839    g_suite_rec_tbl.TRX_LINE_GL_DATE.delete;
2840    g_suite_rec_tbl.BATCH_SOURCE_ID.delete;
2841    g_suite_rec_tbl.BATCH_SOURCE_NAME.delete;
2842    g_suite_rec_tbl.DOC_SEQ_ID.delete;
2843    g_suite_rec_tbl.DOC_SEQ_NAME.delete;
2844    g_suite_rec_tbl.DOC_SEQ_VALUE.delete;
2845    g_suite_rec_tbl.TRX_DUE_DATE.delete;
2846    g_suite_rec_tbl.TRX_TYPE_DESCRIPTION.delete;
2847    g_suite_rec_tbl.MERCHANT_PARTY_NAME.delete;
2848    g_suite_rec_tbl.MERCHANT_PARTY_REFERENCE.delete;
2849    g_suite_rec_tbl.MERCHANT_PARTY_TAXPAYER_ID.delete;
2850    g_suite_rec_tbl.MERCHANT_PARTY_TAX_REG_NUMBER.delete;
2851    g_suite_rec_tbl.DOCUMENT_SUB_TYPE.delete;
2852    g_suite_rec_tbl.SUPPLIER_TAX_INVOICE_NUMBER.delete;
2853    g_suite_rec_tbl.SUPPLIER_TAX_INVOICE_DATE.delete;
2854    g_suite_rec_tbl.SUPPLIER_EXCHANGE_RATE.delete;
2855    g_suite_rec_tbl.EXCHANGE_RATE_VARIANCE.delete;
2856    g_suite_rec_tbl.BASE_INVOICE_PRICE_VARIANCE.delete;
2857    g_suite_rec_tbl.TAX_INVOICE_DATE.delete;
2858    g_suite_rec_tbl.TAX_INVOICE_NUMBER.delete;
2859    g_suite_rec_tbl.SUMMARY_TAX_LINE_NUMBER.delete;
2860    g_suite_rec_tbl.TAX_REGIME_CODE.delete;
2861    g_suite_rec_tbl.TAX_JURISDICTION_ID.delete;
2862    g_suite_rec_tbl.TAX.delete;
2863    g_suite_rec_tbl.TAX_STATUS_CODE.delete;
2864    g_suite_rec_tbl.RECOVERY_TYPE_CODE.delete;
2865    g_suite_rec_tbl.RECOVERY_RATE_CODE.delete;
2866    g_suite_rec_tbl.TAX_RATE_CODE.delete;
2867    g_suite_rec_tbl.RECOVERABLE_FLAG.delete;
2868    g_suite_rec_tbl.FREEZE_FLAG.delete;
2869    g_suite_rec_tbl.POSTING_FLAG.delete;
2870    g_suite_rec_tbl.TAX_RATE.delete;
2871    g_suite_rec_tbl.TAX_AMT.delete;
2872    g_suite_rec_tbl.REC_NREC_TAX_AMT.delete;
2873    g_suite_rec_tbl.TAXABLE_AMT.delete;
2874    g_suite_rec_tbl.REC_NREC_TAX_AMT_FUNCL_CURR.delete;
2875    g_suite_rec_tbl.REC_NREC_CCID.delete;
2876    g_suite_rec_tbl.REVERSING_ENTITY_CODE.delete;
2877    g_suite_rec_tbl.REVERSING_EVNT_CLS_CODE.delete;
2878    g_suite_rec_tbl.REVERSING_TRX_ID.delete;
2879    g_suite_rec_tbl.REVERSING_TRX_LINE_DIST_ID.delete;
2880    g_suite_rec_tbl.REVERSING_TRX_LEVEL_TYPE.delete;
2881    g_suite_rec_tbl.REVERSING_TRX_LINE_ID.delete;
2882    g_suite_rec_tbl.REVERSED_APPLN_ID.delete;
2883    g_suite_rec_tbl.REVERSED_ENTITY_CODE.delete;
2884    g_suite_rec_tbl.REVERSED_EVNT_CLS_CODE.delete;
2885    g_suite_rec_tbl.REVERSED_TRX_ID.delete;
2886    g_suite_rec_tbl.REVERSED_TRX_LEVEL_TYPE.delete;
2887    g_suite_rec_tbl.REVERSED_TRX_LINE_ID.delete;
2888    g_suite_rec_tbl.REVERSE_FLAG.delete;
2889    g_suite_rec_tbl.CANCEL_FLAG.delete;
2890    g_suite_rec_tbl.TRX_LINE_DIST_ID.delete;
2891    g_suite_rec_tbl.REVERSED_TAX_DIST_ID.delete;
2892    g_suite_rec_tbl.DIST_LEVEL_ACTION.delete;
2893    g_suite_rec_tbl.TRX_LINE_DIST_DATE.delete;
2894    g_suite_rec_tbl.ITEM_DIST_NUMBER.delete;
2895    g_suite_rec_tbl.DIST_INTENDED_USE.delete;
2896    g_suite_rec_tbl.TASK_ID.delete;
2897    g_suite_rec_tbl.AWARD_ID.delete;
2898    g_suite_rec_tbl.PROJECT_ID.delete;
2899    g_suite_rec_tbl.EXPENDITURE_TYPE.delete;
2900    g_suite_rec_tbl.EXPENDITURE_ORGANIZATION_ID.delete;
2901    g_suite_rec_tbl.EXPENDITURE_ITEM_DATE.delete;
2902    g_suite_rec_tbl.TRX_LINE_DIST_AMT.delete;
2903    g_suite_rec_tbl.TRX_LINE_DIST_QUANTITY.delete;
2904    g_suite_rec_tbl.REF_DOC_DIST_ID.delete;
2905    g_suite_rec_tbl.REF_DOC_CURR_CONV_RATE.delete;
2906    g_suite_rec_tbl.TAX_DIST_ID.delete;
2907    g_suite_rec_tbl.LINE_AMT_INCLUDES_TAX_FLAG.delete;
2908    g_suite_rec_tbl.DEFAULT_TAXATION_COUNTRY.delete;
2909    g_suite_rec_tbl.VALIDATION_CHECK_FLAG.delete;
2910    g_suite_rec_tbl.FIRST_PTY_ORG_ID.delete;
2911    g_suite_rec_tbl.RDNG_SHIP_TO_PTY_TX_PROF_ID.delete;
2912    g_suite_rec_tbl.RDNG_SHIP_FROM_PTY_TX_PROF_ID.delete;
2913    g_suite_rec_tbl.RDNG_BILL_TO_PTY_TX_PROF_ID.delete;
2914    g_suite_rec_tbl.RDNG_BILL_FROM_PTY_TX_PROF_ID.delete;
2915    g_suite_rec_tbl.RDNG_SHIP_TO_PTY_TX_P_ST_ID.delete;
2916    g_suite_rec_tbl.RDNG_SHIP_FROM_PTY_TX_P_ST_ID.delete;
2917    g_suite_rec_tbl.RDNG_BILL_TO_PTY_TX_P_ST_ID.delete;
2918    g_suite_rec_tbl.RDNG_BILL_FROM_PTY_TX_P_ST_ID.delete;
2919    g_suite_rec_tbl.ASSESSABLE_VALUE.delete;
2920    g_suite_rec_tbl.ASSET_ACCUM_DEPRECIATION.delete;
2921    g_suite_rec_tbl.ASSET_COST.delete;
2922    g_suite_rec_tbl.ASSET_FLAG.delete;
2923    g_suite_rec_tbl.ASSET_NUMBER.delete;
2924    g_suite_rec_tbl.ASSET_TYPE.delete;
2925    g_suite_rec_tbl.BILL_FROM_PARTY_TAX_PROF_ID.delete;
2926    g_suite_rec_tbl.BILL_FROM_SITE_TAX_PROF_ID.delete;
2927    g_suite_rec_tbl.BILL_TO_PARTY_TAX_PROF_ID.delete;
2928    g_suite_rec_tbl.BILL_TO_SITE_TAX_PROF_ID.delete;
2929    g_suite_rec_tbl.CTRL_HDR_TX_APPL_FLAG.delete;
2930    g_suite_rec_tbl.CTRL_TOTAL_LINE_TX_AMT.delete;
2931    g_suite_rec_tbl.ENTITY_CODE.delete;
2932    g_suite_rec_tbl.EVENT_CLASS_CODE.delete;
2933    g_suite_rec_tbl.HQ_ESTB_PARTY_TAX_PROF_ID.delete;
2934    g_suite_rec_tbl.LINE_CLASS.delete;
2935    g_suite_rec_tbl.MERCHANT_PARTY_TAX_PROF_ID.delete;
2936    g_suite_rec_tbl.OWN_HQ_LOCATION_ID.delete;
2937    g_suite_rec_tbl.OWN_HQ_PARTY_ID.delete;
2938    g_suite_rec_tbl.OWN_HQ_PARTY_SITE_ID.delete;
2939    g_suite_rec_tbl.OWN_HQ_PARTY_TAX_PROF_ID.delete;
2940    g_suite_rec_tbl.OWN_HQ_SITE_TAX_PROF_ID.delete;
2941    g_suite_rec_tbl.PAYING_LOCATION_ID.delete;
2942    g_suite_rec_tbl.PAYING_PARTY_ID.delete;
2943    g_suite_rec_tbl.PAYING_PARTY_SITE_ID.delete;
2944    g_suite_rec_tbl.PAYING_PARTY_TAX_PROF_ID.delete;
2945    g_suite_rec_tbl.PAYING_SITE_TAX_PROF_ID.delete;
2946    g_suite_rec_tbl.POA_PARTY_TAX_PROF_ID.delete;
2947    g_suite_rec_tbl.POA_SITE_TAX_PROF_ID.delete;
2948    g_suite_rec_tbl.POC_LOCATION_ID.delete;
2949    g_suite_rec_tbl.POD_LOCATION_ID.delete;
2950    g_suite_rec_tbl.POD_PARTY_ID.delete;
2951    g_suite_rec_tbl.POD_PARTY_SITE_ID.delete;
2952    g_suite_rec_tbl.POD_PARTY_TAX_PROF_ID.delete;
2953    g_suite_rec_tbl.POD_SITE_TAX_PROF_ID.delete;
2954    g_suite_rec_tbl.POI_LOCATION_ID.delete;
2955    g_suite_rec_tbl.POI_PARTY_ID.delete;
2956    g_suite_rec_tbl.POI_PARTY_SITE_ID.delete;
2957    g_suite_rec_tbl.POI_PARTY_TAX_PROF_ID.delete;
2958    g_suite_rec_tbl.POI_SITE_TAX_PROF_ID.delete;
2959    g_suite_rec_tbl.POO_PARTY_TAX_PROF_ID.delete;
2960    g_suite_rec_tbl.POO_SITE_TAX_PROF_ID.delete;
2961    g_suite_rec_tbl.SHIP_FROM_PARTY_TAX_PROF_ID.delete;
2962    g_suite_rec_tbl.SHIP_FROM_SITE_TAX_PROF_ID.delete;
2963    g_suite_rec_tbl.SHIP_TO_PARTY_TAX_PROF_ID.delete;
2964    g_suite_rec_tbl.SHIP_TO_SITE_TAX_PROF_ID.delete;
2965    g_suite_rec_tbl.TITLE_TRANS_PARTY_TAX_PROF_ID.delete;
2966    g_suite_rec_tbl.TITLE_TRANS_SITE_TAX_PROF_ID.delete;
2967    g_suite_rec_tbl.TITLE_TRANSFER_LOCATION_ID.delete;
2968    g_suite_rec_tbl.TITLE_TRANSFER_PARTY_ID.delete;
2969    g_suite_rec_tbl.TITLE_TRANSFER_PARTY_SITE_ID.delete;
2970    g_suite_rec_tbl.TRADING_HQ_LOCATION_ID.delete;
2971    g_suite_rec_tbl.TRADING_HQ_PARTY_ID.delete;
2972    g_suite_rec_tbl.TRADING_HQ_PARTY_SITE_ID.delete;
2973    g_suite_rec_tbl.TRADING_HQ_PARTY_TAX_PROF_ID.delete;
2974    g_suite_rec_tbl.TRADING_HQ_SITE_TAX_PROF_ID.delete;
2975    g_suite_rec_tbl.TRX_ID_LEVEL2.delete;
2976    g_suite_rec_tbl.TRX_ID_LEVEL3.delete;
2977    g_suite_rec_tbl.TRX_ID_LEVEL4.delete;
2978    g_suite_rec_tbl.TRX_ID_LEVEL5.delete;
2979    g_suite_rec_tbl.TRX_ID_LEVEL6.delete;
2980    g_suite_rec_tbl.PORT_OF_ENTRY_CODE.delete;
2981    g_suite_rec_tbl.SHIP_THIRD_PTY_ACCT_ID.delete;
2982    g_suite_rec_tbl.BILL_THIRD_PTY_ACCT_ID.delete;
2983    g_suite_rec_tbl.SHIP_THIRD_PTY_ACCT_SITE_ID.delete;
2984    g_suite_rec_tbl.BILL_THIRD_PTY_ACCT_SITE_ID.delete;
2985    g_suite_rec_tbl.BILL_TO_CUST_ACCT_SITE_USE_ID.delete;
2986    g_suite_rec_tbl.SHIP_TO_CUST_ACCT_SITE_USE_ID.delete;
2987 
2988    END delete_table;
2989 
2990 
2991 
2992 /* ======================================================================*
2993  | PROCEDURE initialize_row :     Initialize a row of record of tables   |
2994  * ======================================================================*/
2995 
2996   PROCEDURE Initialize_row(p_record_counter IN NUMBER) IS
2997 
2998   BEGIN
2999    g_suite_rec_tbl.ROW_ID(p_record_counter)                        := NULL;
3000    g_suite_rec_tbl.ROW_SUITE(p_record_counter)                     := NULL;
3001    g_suite_rec_tbl.ROW_CASE(p_record_counter)                      := NULL;
3002    g_suite_rec_tbl.ROW_API(p_record_counter)                       := NULL;
3003    g_suite_rec_tbl.ROW_SERVICE(p_record_counter)                   := NULL;
3004    g_suite_rec_tbl.ROW_STRUCTURE(p_record_counter)                 := NULL;
3005    g_suite_rec_tbl.INTERNAL_ORGANIZATION_ID(p_record_counter)      := NULL;
3006    g_suite_rec_tbl.INTERNAL_ORG_LOCATION_ID(p_record_counter)      := NULL;
3007    g_suite_rec_tbl.APPLICATION_ID(p_record_counter)                := NULL;
3008    g_suite_rec_tbl.ENTITY_CODE(p_record_counter)                   := NULL;
3009    g_suite_rec_tbl.EVENT_CLASS_CODE(p_record_counter)              := NULL;
3010    g_suite_rec_tbl.TAX_EVENT_CLASS_CODE(p_record_counter)          := NULL;
3011    g_suite_rec_tbl.DOC_EVENT_STATUS(p_record_counter)              := NULL;
3012    g_suite_rec_tbl.TAX_HOLD_RELEASED_CODE(p_record_counter)        := NULL;
3013    g_suite_rec_tbl.EVENT_TYPE_CODE(p_record_counter)               := NULL;
3014    g_suite_rec_tbl.TRX_ID(p_record_counter)                        := NULL;
3015    g_suite_rec_tbl.OVERRIDE_LEVEL(p_record_counter)                := NULL;
3016    g_suite_rec_tbl.TRX_LEVEL_TYPE(p_record_counter)                := NULL;
3017    g_suite_rec_tbl.TRX_LINE_ID(p_record_counter)                   := NULL;
3018    g_suite_rec_tbl.TRX_WAYBILL_NUMBER(p_record_counter)            := NULL;
3019    g_suite_rec_tbl.TRX_LINE_DESCRIPTION(p_record_counter)          := NULL;
3020    g_suite_rec_tbl.PRODUCT_DESCRIPTION(p_record_counter)           := NULL;
3021    g_suite_rec_tbl.TAX_LINE_ID(p_record_counter)                   := NULL;
3022    g_suite_rec_tbl.SUMMARY_TAX_LINE_ID(p_record_counter)           := NULL;
3023    g_suite_rec_tbl.INVOICE_PRICE_VARIANCE(p_record_counter)        := NULL;
3024    g_suite_rec_tbl.LINE_LEVEL_ACTION(p_record_counter)             := NULL;
3025    g_suite_rec_tbl.TAX_CLASSIFICATION_CODE(p_record_counter)       := NULL;
3026    g_suite_rec_tbl.TRX_DATE(p_record_counter)                      := NULL;
3027    g_suite_rec_tbl.TRX_DOC_REVISION(p_record_counter)              := NULL;
3028    g_suite_rec_tbl.LEDGER_ID(p_record_counter)                     := NULL;
3029    g_suite_rec_tbl.TAX_RATE_ID(p_record_counter)                   := NULL;
3030    g_suite_rec_tbl.TRX_CURRENCY_CODE(p_record_counter)             := NULL;
3031    g_suite_rec_tbl.CURRENCY_CONVERSION_DATE(p_record_counter)      := NULL;
3032    g_suite_rec_tbl.CURRENCY_CONVERSION_RATE(p_record_counter)      := NULL;
3033    g_suite_rec_tbl.CURRENCY_CONVERSION_TYPE(p_record_counter)      := NULL;
3034    g_suite_rec_tbl.MINIMUM_ACCOUNTABLE_UNIT(p_record_counter)      := NULL;
3035    g_suite_rec_tbl.PRECISION(p_record_counter)                     := NULL;
3036    g_suite_rec_tbl.TRX_SHIPPING_DATE(p_record_counter)             := NULL;
3037    g_suite_rec_tbl.TRX_RECEIPT_DATE(p_record_counter)              := NULL;
3038    g_suite_rec_tbl.LEGAL_ENTITY_ID(p_record_counter)               := NULL;
3039    g_suite_rec_tbl.REVERSING_APPLN_ID(p_record_counter)            := NULL;
3040    g_suite_rec_tbl.ROUNDING_SHIP_TO_PARTY_ID(p_record_counter)     := NULL;
3041    g_suite_rec_tbl.ROUNDING_SHIP_FROM_PARTY_ID(p_record_counter)   := NULL;
3042    g_suite_rec_tbl.ROUNDING_BILL_TO_PARTY_ID(p_record_counter)     := NULL;
3043    g_suite_rec_tbl.ROUNDING_BILL_FROM_PARTY_ID(p_record_counter)   := NULL;
3044    g_suite_rec_tbl.RNDG_SHIP_TO_PARTY_SITE_ID(p_record_counter)    := NULL;
3045    g_suite_rec_tbl.RNDG_SHIP_FROM_PARTY_SITE_ID(p_record_counter)  := NULL;
3046    g_suite_rec_tbl.RNDG_BILL_TO_PARTY_SITE_ID(p_record_counter)    := NULL;
3047    g_suite_rec_tbl.RNDG_BILL_FROM_PARTY_SITE_ID(p_record_counter)  := NULL;
3048    g_suite_rec_tbl.ESTABLISHMENT_ID(p_record_counter)              := NULL;
3049    g_suite_rec_tbl.TAX_EXEMPTION_ID(p_record_counter)              := NULL;
3050    g_suite_rec_tbl.REC_NREC_TAX_DIST_ID(p_record_counter)          := NULL;
3051    g_suite_rec_tbl.TAX_APPORTIONMENT_LINE_NUMBER(p_record_counter) := NULL;
3052    g_suite_rec_tbl.EXEMPTION_RATE(p_record_counter)                := NULL;
3053    g_suite_rec_tbl.TOTAL_NREC_TAX_AMT(p_record_counter)            := NULL;
3054    g_suite_rec_tbl.TOTAL_REC_TAX_AMT(p_record_counter)             := NULL;
3055    g_suite_rec_tbl.REC_TAX_AMT(p_record_counter)                   := NULL;
3056    g_suite_rec_tbl.NREC_TAX_AMT(p_record_counter)                  := NULL;
3057    g_suite_rec_tbl.MERCHANT_PARTY_DOCUMENT_NUMBER(p_record_counter):= NULL;
3058    g_suite_rec_tbl.TRX_LINE_TYPE(p_record_counter)                 := NULL;
3059    g_suite_rec_tbl.TAX_REGISTRATION_NUMBER(p_record_counter)       := NULL;
3060    g_suite_rec_tbl.CTRL_TOTAL_HDR_TX_AMT(p_record_counter)         := NULL;
3061    g_suite_rec_tbl.EXEMPT_REASON_CODE(p_record_counter)            := NULL;
3062    g_suite_rec_tbl.TAX_HOLD_CODE(p_record_counter)                 := NULL;
3063    g_suite_rec_tbl.TAX_AMT_FUNCL_CURR(p_record_counter)            := NULL;
3064    g_suite_rec_tbl.TOTAL_REC_TAX_AMT_FUNCL_CURR(p_record_counter)  := NULL;
3065    g_suite_rec_tbl.TOTAL_NREC_TAX_AMT_FUNCL_CURR(p_record_counter) := NULL;
3066    g_suite_rec_tbl.TAXABLE_AMT_FUNCL_CURR(p_record_counter)        := NULL;
3067    g_suite_rec_tbl.REC_TAX_AMT_FUNCL_CURR(p_record_counter)        := NULL;
3068    g_suite_rec_tbl.NREC_TAX_AMT_FUNCL_CURR(p_record_counter)       := NULL;
3069    g_suite_rec_tbl.TRX_LINE_DATE(p_record_counter)                 := NULL;
3070    g_suite_rec_tbl.TRX_BUSINESS_CATEGORY(p_record_counter)         := NULL;
3071    g_suite_rec_tbl.LINE_INTENDED_USE(p_record_counter)             := NULL;
3072    g_suite_rec_tbl.USER_DEFINED_FISC_CLASS(p_record_counter)       := NULL;
3073    g_suite_rec_tbl.TAX_CODE(p_record_counter)                      := NULL;
3074    g_suite_rec_tbl.TAX_INCLUSION_FLAG(p_record_counter)            := NULL;
3075    g_suite_rec_tbl.TAX_AMT_INCLUDED_FLAG(p_record_counter)         := NULL;
3076    g_suite_rec_tbl.SELF_ASSESSED_FLAG(p_record_counter)            := NULL;
3077    g_suite_rec_tbl.QUOTE_FLAG(p_record_counter)                    := NULL;
3078    g_suite_rec_tbl.HISTORICAL_FLAG(p_record_counter)               := NULL;
3079    g_suite_rec_tbl.MANUALLY_ENTERED_FLAG(p_record_counter)         := NULL;
3080    g_suite_rec_tbl.LINE_AMT(p_record_counter)                      := NULL;
3081    g_suite_rec_tbl.TRX_LINE_QUANTITY(p_record_counter)             := NULL;
3082    g_suite_rec_tbl.UNIT_PRICE(p_record_counter)                    := NULL;
3083    g_suite_rec_tbl.EXEMPT_CERTIFICATE_NUMBER(p_record_counter)     := NULL;
3084    g_suite_rec_tbl.EXEMPT_REASON(p_record_counter)                 := NULL;
3085    g_suite_rec_tbl.CASH_DISCOUNT(p_record_counter)                 := NULL;
3086    g_suite_rec_tbl.VOLUME_DISCOUNT(p_record_counter)               := NULL;
3087    g_suite_rec_tbl.TRADING_DISCOUNT(p_record_counter)              := NULL;
3088    g_suite_rec_tbl.TRANSFER_CHARGE(p_record_counter)               := NULL;
3089    g_suite_rec_tbl.TRANSPORTATION_CHARGE(p_record_counter)         := NULL;
3090    g_suite_rec_tbl.INSURANCE_CHARGE(p_record_counter)              := NULL;
3091    g_suite_rec_tbl.OTHER_CHARGE(p_record_counter)                  := NULL;
3092    g_suite_rec_tbl.PRODUCT_ID(p_record_counter)                    := NULL;
3093    g_suite_rec_tbl.PRODUCT_FISC_CLASSIFICATION(p_record_counter)   := NULL;
3094    g_suite_rec_tbl.PRODUCT_ORG_ID(p_record_counter)                := NULL;
3095    g_suite_rec_tbl.UOM_CODE(p_record_counter)                      := NULL;
3096    g_suite_rec_tbl.PRODUCT_TYPE(p_record_counter)                  := NULL;
3097    g_suite_rec_tbl.PRODUCT_CODE(p_record_counter)                  := NULL;
3098    g_suite_rec_tbl.PRODUCT_CATEGORY(p_record_counter)              := NULL;
3099    g_suite_rec_tbl.TRX_SIC_CODE(p_record_counter)                  := NULL;
3100    g_suite_rec_tbl.FOB_POINT(p_record_counter)                     := NULL;
3101    g_suite_rec_tbl.SHIP_TO_PARTY_ID(p_record_counter)              := NULL;
3102    g_suite_rec_tbl.SHIP_FROM_PARTY_ID(p_record_counter)            := NULL;
3103    g_suite_rec_tbl.POA_PARTY_ID(p_record_counter)                  := NULL;
3104    g_suite_rec_tbl.POO_PARTY_ID(p_record_counter)                  := NULL;
3105    g_suite_rec_tbl.BILL_TO_PARTY_ID(p_record_counter)              := NULL;
3106    g_suite_rec_tbl.BILL_FROM_PARTY_ID(p_record_counter)            := NULL;
3107    g_suite_rec_tbl.MERCHANT_PARTY_ID(p_record_counter)             := NULL;
3108    g_suite_rec_tbl.SHIP_TO_PARTY_SITE_ID(p_record_counter)         := NULL;
3109    g_suite_rec_tbl.SHIP_FROM_PARTY_SITE_ID(p_record_counter)       := NULL;
3110    g_suite_rec_tbl.POA_PARTY_SITE_ID(p_record_counter)             := NULL;
3111    g_suite_rec_tbl.POO_PARTY_SITE_ID(p_record_counter)             := NULL;
3112    g_suite_rec_tbl.BILL_TO_PARTY_SITE_ID(p_record_counter)         := NULL;
3113    g_suite_rec_tbl.BILL_FROM_PARTY_SITE_ID(p_record_counter)       := NULL;
3114    g_suite_rec_tbl.SHIP_TO_LOCATION_ID(p_record_counter)           := NULL;
3115    g_suite_rec_tbl.SHIP_FROM_LOCATION_ID(p_record_counter)         := NULL;
3116    g_suite_rec_tbl.POA_LOCATION_ID(p_record_counter)               := NULL;
3117    g_suite_rec_tbl.POO_LOCATION_ID(p_record_counter)               := NULL;
3118    g_suite_rec_tbl.BILL_TO_LOCATION_ID(p_record_counter)           := NULL;
3119    g_suite_rec_tbl.BILL_FROM_LOCATION_ID(p_record_counter)         := NULL;
3120    g_suite_rec_tbl.ACCOUNT_CCID(p_record_counter)                  := NULL;
3121    g_suite_rec_tbl.ACCOUNT_STRING(p_record_counter)                := NULL;
3122    g_suite_rec_tbl.MERCHANT_PARTY_COUNTRY(p_record_counter)        := NULL;
3123    g_suite_rec_tbl.RECEIVABLES_TRX_TYPE_ID(p_record_counter)       := NULL;
3124    g_suite_rec_tbl.REF_DOC_APPLICATION_ID(p_record_counter)        := NULL;
3125    g_suite_rec_tbl.REF_DOC_ENTITY_CODE(p_record_counter)           := NULL;
3126    g_suite_rec_tbl.REF_DOC_EVENT_CLASS_CODE(p_record_counter)      := NULL;
3127    g_suite_rec_tbl.REF_DOC_TRX_ID(p_record_counter)                := NULL;
3128    g_suite_rec_tbl.REF_DOC_LINE_ID(p_record_counter)               := NULL;
3129    g_suite_rec_tbl.REF_DOC_LINE_QUANTITY(p_record_counter)         := NULL;
3130    g_suite_rec_tbl.RELATED_DOC_APPLICATION_ID(p_record_counter)    := NULL;
3131    g_suite_rec_tbl.RELATED_DOC_ENTITY_CODE(p_record_counter)       := NULL;
3132    g_suite_rec_tbl.RELATED_DOC_EVENT_CLASS_CODE(p_record_counter)  := NULL;
3133    g_suite_rec_tbl.RELATED_DOC_TRX_ID(p_record_counter)            := NULL;
3134    g_suite_rec_tbl.RELATED_DOC_NUMBER(p_record_counter)            := NULL;
3135    g_suite_rec_tbl.RELATED_DOC_DATE(p_record_counter)              := NULL;
3136    g_suite_rec_tbl.APPLIED_FROM_APPLICATION_ID(p_record_counter)   := NULL;
3137    g_suite_rec_tbl.APPLIED_FROM_ENTITY_CODE(p_record_counter)      := NULL;
3138    g_suite_rec_tbl.APPLIED_FROM_EVENT_CLASS_CODE(p_record_counter) := NULL;
3139    g_suite_rec_tbl.APPLIED_FROM_TRX_ID(p_record_counter)           := NULL;
3140    g_suite_rec_tbl.APPLIED_FROM_LINE_ID(p_record_counter)          := NULL;
3141    g_suite_rec_tbl.ADJUSTED_DOC_APPLICATION_ID(p_record_counter)   := NULL;
3142    g_suite_rec_tbl.ADJUSTED_DOC_ENTITY_CODE(p_record_counter)      := NULL;
3143    g_suite_rec_tbl.ADJUSTED_DOC_EVENT_CLASS_CODE(p_record_counter) := NULL;
3144    g_suite_rec_tbl.ADJUSTED_DOC_TRX_ID(p_record_counter)           := NULL;
3145    g_suite_rec_tbl.ADJUSTED_DOC_LINE_ID(p_record_counter)          := NULL;
3146    g_suite_rec_tbl.ADJUSTED_DOC_NUMBER(p_record_counter)           := NULL;
3147    g_suite_rec_tbl.ASSESSABLE_VALUE(p_record_counter)              := NULL;
3148    g_suite_rec_tbl.ADJUSTED_DOC_DATE(p_record_counter)             := NULL;
3149    g_suite_rec_tbl.APPLIED_TO_APPLICATION_ID(p_record_counter)     := NULL;
3150    g_suite_rec_tbl.APPLIED_TO_ENTITY_CODE(p_record_counter)        := NULL;
3151    g_suite_rec_tbl.APPLIED_TO_EVENT_CLASS_CODE(p_record_counter)   := NULL;
3152    g_suite_rec_tbl.APPLIED_TO_TRX_ID(p_record_counter)             := NULL;
3153    g_suite_rec_tbl.APPLIED_TO_TRX_LINE_ID(p_record_counter)        := NULL;
3154    g_suite_rec_tbl.TRX_LINE_NUMBER(p_record_counter)               := NULL;
3155    g_suite_rec_tbl.TRX_NUMBER(p_record_counter)                    := NULL;
3156    g_suite_rec_tbl.TRX_DESCRIPTION(p_record_counter)               := NULL;
3157    g_suite_rec_tbl.TRX_COMMUNICATED_DATE(p_record_counter)         := NULL;
3158    g_suite_rec_tbl.TRX_LINE_GL_DATE(p_record_counter)              := NULL;
3159    g_suite_rec_tbl.BATCH_SOURCE_ID(p_record_counter)               := NULL;
3160    g_suite_rec_tbl.BATCH_SOURCE_NAME(p_record_counter)             := NULL;
3161    g_suite_rec_tbl.DOC_SEQ_ID(p_record_counter)                    := NULL;
3162    g_suite_rec_tbl.DOC_SEQ_NAME(p_record_counter)                  := NULL;
3163    g_suite_rec_tbl.DOC_SEQ_VALUE(p_record_counter)                 := NULL;
3164    g_suite_rec_tbl.TRX_DUE_DATE(p_record_counter)                  := NULL;
3165    g_suite_rec_tbl.TRX_TYPE_DESCRIPTION(p_record_counter)          := NULL;
3166    g_suite_rec_tbl.MERCHANT_PARTY_NAME(p_record_counter)           := NULL;
3167    g_suite_rec_tbl.MERCHANT_PARTY_REFERENCE(p_record_counter)      := NULL;
3168    g_suite_rec_tbl.MERCHANT_PARTY_TAXPAYER_ID(p_record_counter)    := NULL;
3169    g_suite_rec_tbl.MERCHANT_PARTY_TAX_REG_NUMBER(p_record_counter) := NULL;
3170    g_suite_rec_tbl.DOCUMENT_SUB_TYPE(p_record_counter)             := NULL;
3171    g_suite_rec_tbl.SUPPLIER_TAX_INVOICE_NUMBER(p_record_counter)   := NULL;
3172    g_suite_rec_tbl.SUPPLIER_TAX_INVOICE_DATE(p_record_counter)     := NULL;
3173    g_suite_rec_tbl.SUPPLIER_EXCHANGE_RATE(p_record_counter)        := NULL;
3174    g_suite_rec_tbl.EXCHANGE_RATE_VARIANCE(p_record_counter)        := NULL;
3175    g_suite_rec_tbl.BASE_INVOICE_PRICE_VARIANCE(p_record_counter)   := NULL;
3176    g_suite_rec_tbl.TAX_INVOICE_DATE(p_record_counter)              := NULL;
3177    g_suite_rec_tbl.TAX_INVOICE_NUMBER(p_record_counter)            := NULL;
3178    g_suite_rec_tbl.SUMMARY_TAX_LINE_NUMBER(p_record_counter)       := NULL;
3179    g_suite_rec_tbl.TAX_REGIME_CODE(p_record_counter)               := NULL;
3180    g_suite_rec_tbl.TAX_JURISDICTION_ID(p_record_counter)           := NULL;
3181    g_suite_rec_tbl.TAX(p_record_counter)                           := NULL;
3182    g_suite_rec_tbl.TAX_STATUS_CODE(p_record_counter)               := NULL;
3183    g_suite_rec_tbl.RECOVERY_TYPE_CODE(p_record_counter)            := NULL;
3184    g_suite_rec_tbl.RECOVERY_RATE_CODE(p_record_counter)            := NULL;
3185    g_suite_rec_tbl.TAX_RATE_CODE(p_record_counter)                 := NULL;
3186    g_suite_rec_tbl.RECOVERABLE_FLAG(p_record_counter)              := NULL;
3187    g_suite_rec_tbl.FREEZE_FLAG(p_record_counter)                   := NULL;
3188    g_suite_rec_tbl.POSTING_FLAG(p_record_counter)                  := NULL;
3189    g_suite_rec_tbl.TAX_RATE(p_record_counter)                      := NULL;
3190    g_suite_rec_tbl.TAX_AMT(p_record_counter)                       := NULL;
3191    g_suite_rec_tbl.REC_NREC_TAX_AMT(p_record_counter)              := NULL;
3192    g_suite_rec_tbl.TAXABLE_AMT(p_record_counter)                   := NULL;
3193    g_suite_rec_tbl.REC_NREC_TAX_AMT_FUNCL_CURR(p_record_counter)   := NULL;
3194    g_suite_rec_tbl.REC_NREC_CCID(p_record_counter)                 := NULL;
3195    g_suite_rec_tbl.REVERSING_ENTITY_CODE(p_record_counter)         := NULL;
3196    g_suite_rec_tbl.REVERSING_EVNT_CLS_CODE(p_record_counter)       := NULL;
3197    g_suite_rec_tbl.REVERSING_TRX_ID(p_record_counter)              := NULL;
3198    g_suite_rec_tbl.REVERSING_TRX_LINE_DIST_ID(p_record_counter)    := NULL;
3199    g_suite_rec_tbl.REVERSING_TRX_LEVEL_TYPE(p_record_counter)      := NULL;
3200    g_suite_rec_tbl.REVERSING_TRX_LINE_ID(p_record_counter)         := NULL;
3201    g_suite_rec_tbl.REVERSED_APPLN_ID(p_record_counter)             := NULL;
3202    g_suite_rec_tbl.REVERSED_ENTITY_CODE(p_record_counter)          := NULL;
3203    g_suite_rec_tbl.REVERSED_EVNT_CLS_CODE(p_record_counter)        := NULL;
3204    g_suite_rec_tbl.REVERSED_TRX_ID(p_record_counter)               := NULL;
3205    g_suite_rec_tbl.REVERSED_TRX_LEVEL_TYPE(p_record_counter)       := NULL;
3206    g_suite_rec_tbl.REVERSED_TRX_LINE_ID(p_record_counter)          := NULL;
3207    g_suite_rec_tbl.REVERSE_FLAG(p_record_counter)                  := NULL;
3208    g_suite_rec_tbl.CANCEL_FLAG(p_record_counter)                   := NULL;
3209    g_suite_rec_tbl.TRX_LINE_DIST_ID(p_record_counter)              := NULL;
3210    g_suite_rec_tbl.REVERSED_TAX_DIST_ID(p_record_counter)          := NULL;
3211    g_suite_rec_tbl.DIST_LEVEL_ACTION(p_record_counter)             := NULL;
3212    g_suite_rec_tbl.TRX_LINE_DIST_DATE(p_record_counter)            := NULL;
3213    g_suite_rec_tbl.ITEM_DIST_NUMBER(p_record_counter)              := NULL;
3214    g_suite_rec_tbl.DIST_INTENDED_USE(p_record_counter)             := NULL;
3215    g_suite_rec_tbl.TASK_ID(p_record_counter)                       := NULL;
3216    g_suite_rec_tbl.AWARD_ID(p_record_counter)                      := NULL;
3217    g_suite_rec_tbl.PROJECT_ID(p_record_counter)                    := NULL;
3218    g_suite_rec_tbl.EXPENDITURE_TYPE(p_record_counter)              := NULL;
3219    g_suite_rec_tbl.EXPENDITURE_ORGANIZATION_ID(p_record_counter)   := NULL;
3220    g_suite_rec_tbl.EXPENDITURE_ITEM_DATE(p_record_counter)         := NULL;
3221    g_suite_rec_tbl.TRX_LINE_DIST_AMT(p_record_counter)             := NULL;
3222    g_suite_rec_tbl.TRX_LINE_DIST_QUANTITY(p_record_counter)        := NULL;
3223    g_suite_rec_tbl.REF_DOC_DIST_ID(p_record_counter)               := NULL;
3224    g_suite_rec_tbl.REF_DOC_CURR_CONV_RATE(p_record_counter)        := NULL;
3225    g_suite_rec_tbl.TAX_DIST_ID(p_record_counter)                   := NULL;
3226    g_suite_rec_tbl.LINE_AMT_INCLUDES_TAX_FLAG(p_record_counter)    := NULL;
3227    g_suite_rec_tbl.DEFAULT_TAXATION_COUNTRY(p_record_counter)      := NULL;
3228    g_suite_rec_tbl.VALIDATION_CHECK_FLAG(p_record_counter)         := NULL;
3229    g_suite_rec_tbl.FIRST_PTY_ORG_ID(p_record_counter)              := NULL;
3230    g_suite_rec_tbl.RDNG_SHIP_TO_PTY_TX_PROF_ID(p_record_counter)   := NULL;
3231    g_suite_rec_tbl.RDNG_SHIP_FROM_PTY_TX_PROF_ID(p_record_counter) := NULL;
3232    g_suite_rec_tbl.RDNG_BILL_TO_PTY_TX_PROF_ID(p_record_counter)   := NULL;
3233    g_suite_rec_tbl.RDNG_BILL_FROM_PTY_TX_PROF_ID(p_record_counter) := NULL;
3234    g_suite_rec_tbl.RDNG_SHIP_TO_PTY_TX_P_ST_ID(p_record_counter)   := NULL;
3235    g_suite_rec_tbl.RDNG_SHIP_FROM_PTY_TX_P_ST_ID(p_record_counter) := NULL;
3236    g_suite_rec_tbl.RDNG_BILL_TO_PTY_TX_P_ST_ID(p_record_counter)   := NULL;
3237    g_suite_rec_tbl.RDNG_BILL_FROM_PTY_TX_P_ST_ID(p_record_counter) := NULL;
3238    g_suite_rec_tbl.ASSESSABLE_VALUE(p_record_counter)              := NULL;
3239    g_suite_rec_tbl.ASSET_ACCUM_DEPRECIATION(p_record_counter)      := NULL;
3240    g_suite_rec_tbl.ASSET_COST(p_record_counter)                    := NULL;
3241    g_suite_rec_tbl.ASSET_FLAG(p_record_counter)                    := NULL;
3242    g_suite_rec_tbl.ASSET_NUMBER(p_record_counter)                  := NULL;
3243    g_suite_rec_tbl.ASSET_TYPE(p_record_counter)                    := NULL;
3244    g_suite_rec_tbl.BILL_FROM_PARTY_TAX_PROF_ID(p_record_counter)   := NULL;
3245    g_suite_rec_tbl.BILL_FROM_SITE_TAX_PROF_ID(p_record_counter)    := NULL;
3246    g_suite_rec_tbl.BILL_TO_PARTY_TAX_PROF_ID(p_record_counter)     := NULL;
3247    g_suite_rec_tbl.BILL_TO_SITE_TAX_PROF_ID(p_record_counter)      := NULL;
3248    g_suite_rec_tbl.CTRL_HDR_TX_APPL_FLAG(p_record_counter)         := NULL;
3249    g_suite_rec_tbl.CTRL_TOTAL_LINE_TX_AMT(p_record_counter)        := NULL;
3250    g_suite_rec_tbl.ENTITY_CODE(p_record_counter)                   := NULL;
3251    g_suite_rec_tbl.EVENT_CLASS_CODE(p_record_counter)              := NULL;
3252    g_suite_rec_tbl.HQ_ESTB_PARTY_TAX_PROF_ID(p_record_counter)     := NULL;
3253    g_suite_rec_tbl.LINE_CLASS(p_record_counter)                    := NULL;
3254    g_suite_rec_tbl.MERCHANT_PARTY_TAX_PROF_ID(p_record_counter)    := NULL;
3255    g_suite_rec_tbl.OWN_HQ_LOCATION_ID(p_record_counter)            := NULL;
3256    g_suite_rec_tbl.OWN_HQ_PARTY_ID(p_record_counter)               := NULL;
3257    g_suite_rec_tbl.OWN_HQ_PARTY_SITE_ID(p_record_counter)          := NULL;
3258    g_suite_rec_tbl.OWN_HQ_PARTY_TAX_PROF_ID(p_record_counter)      := NULL;
3259    g_suite_rec_tbl.OWN_HQ_SITE_TAX_PROF_ID(p_record_counter)       := NULL;
3260    g_suite_rec_tbl.PAYING_LOCATION_ID(p_record_counter)            := NULL;
3261    g_suite_rec_tbl.PAYING_PARTY_ID(p_record_counter)               := NULL;
3262    g_suite_rec_tbl.PAYING_PARTY_SITE_ID(p_record_counter)          := NULL;
3263    g_suite_rec_tbl.PAYING_PARTY_TAX_PROF_ID(p_record_counter)      := NULL;
3264    g_suite_rec_tbl.PAYING_SITE_TAX_PROF_ID(p_record_counter)       := NULL;
3265    g_suite_rec_tbl.POA_PARTY_TAX_PROF_ID(p_record_counter)         := NULL;
3266    g_suite_rec_tbl.POA_SITE_TAX_PROF_ID(p_record_counter)          := NULL;
3267    g_suite_rec_tbl.POC_LOCATION_ID(p_record_counter)               := NULL;
3268    g_suite_rec_tbl.POD_LOCATION_ID(p_record_counter)               := NULL;
3269    g_suite_rec_tbl.POD_PARTY_ID(p_record_counter)                  := NULL;
3270    g_suite_rec_tbl.POD_PARTY_SITE_ID(p_record_counter)             := NULL;
3271    g_suite_rec_tbl.POD_PARTY_TAX_PROF_ID(p_record_counter)         := NULL;
3272    g_suite_rec_tbl.POD_SITE_TAX_PROF_ID(p_record_counter)          := NULL;
3273    g_suite_rec_tbl.POI_LOCATION_ID(p_record_counter)               := NULL;
3274    g_suite_rec_tbl.POI_PARTY_ID(p_record_counter)                  := NULL;
3275    g_suite_rec_tbl.POI_PARTY_SITE_ID(p_record_counter)             := NULL;
3276    g_suite_rec_tbl.POI_PARTY_TAX_PROF_ID(p_record_counter)         := NULL;
3277    g_suite_rec_tbl.POI_SITE_TAX_PROF_ID(p_record_counter)          := NULL;
3278    g_suite_rec_tbl.POO_PARTY_TAX_PROF_ID(p_record_counter)         := NULL;
3279    g_suite_rec_tbl.POO_SITE_TAX_PROF_ID(p_record_counter)          := NULL;
3280    g_suite_rec_tbl.SHIP_FROM_PARTY_TAX_PROF_ID(p_record_counter)   := NULL;
3281    g_suite_rec_tbl.SHIP_FROM_SITE_TAX_PROF_ID(p_record_counter)    := NULL;
3282    g_suite_rec_tbl.SHIP_TO_PARTY_TAX_PROF_ID(p_record_counter)     := NULL;
3283    g_suite_rec_tbl.SHIP_TO_SITE_TAX_PROF_ID(p_record_counter)      := NULL;
3284    g_suite_rec_tbl.TITLE_TRANS_PARTY_TAX_PROF_ID(p_record_counter) := NULL;
3285    g_suite_rec_tbl.TITLE_TRANS_SITE_TAX_PROF_ID(p_record_counter)  := NULL;
3286    g_suite_rec_tbl.TITLE_TRANSFER_LOCATION_ID(p_record_counter)    := NULL;
3287    g_suite_rec_tbl.TITLE_TRANSFER_PARTY_ID(p_record_counter)       := NULL;
3288    g_suite_rec_tbl.TITLE_TRANSFER_PARTY_SITE_ID(p_record_counter)  := NULL;
3289    g_suite_rec_tbl.TRADING_HQ_LOCATION_ID(p_record_counter)        := NULL;
3290    g_suite_rec_tbl.TRADING_HQ_PARTY_ID(p_record_counter)           := NULL;
3291    g_suite_rec_tbl.TRADING_HQ_PARTY_SITE_ID(p_record_counter)      := NULL;
3292    g_suite_rec_tbl.TRADING_HQ_PARTY_TAX_PROF_ID(p_record_counter)  := NULL;
3293    g_suite_rec_tbl.TRADING_HQ_SITE_TAX_PROF_ID(p_record_counter)   := NULL;
3294    g_suite_rec_tbl.TRX_ID_LEVEL2(p_record_counter)                 := NULL;
3295    g_suite_rec_tbl.TRX_ID_LEVEL3(p_record_counter)                 := NULL;
3296    g_suite_rec_tbl.TRX_ID_LEVEL4(p_record_counter)                 := NULL;
3297    g_suite_rec_tbl.TRX_ID_LEVEL5(p_record_counter)                 := NULL;
3298    g_suite_rec_tbl.TRX_ID_LEVEL6(p_record_counter)                 := NULL;
3299    g_suite_rec_tbl.PORT_OF_ENTRY_CODE(p_record_counter)            := NULL;
3300    g_suite_rec_tbl.SHIP_THIRD_PTY_ACCT_ID(p_record_counter)        := NULL;
3301    g_suite_rec_tbl.BILL_THIRD_PTY_ACCT_ID(p_record_counter)        := NULL;
3302    g_suite_rec_tbl.SHIP_THIRD_PTY_ACCT_SITE_ID(p_record_counter)   := NULL;
3303    g_suite_rec_tbl.BILL_THIRD_PTY_ACCT_SITE_ID(p_record_counter)   := NULL;
3304    g_suite_rec_tbl.BILL_TO_CUST_ACCT_SITE_USE_ID(p_record_counter) := NULL;
3305    g_suite_rec_tbl.SHIP_TO_CUST_ACCT_SITE_USE_ID(p_record_counter) := NULL;
3306 
3307 
3308    --Missing initializations discovered while testig recovery case.
3309 
3310    g_suite_rec_tbl.APPLIED_FROM_TAX_DIST_ID(p_record_counter)      := NULL;
3311    g_suite_rec_tbl.ADJUSTED_DOC_TAX_DIST_ID(p_record_counter)      := NULL;
3312    g_suite_rec_tbl.TRX_LINE_DIST_TAX_AMT(p_record_counter)         := NULL;
3313    g_suite_rec_tbl.APPLIED_FROM_DIST_ID(p_record_counter)          := NULL;
3314    g_suite_rec_tbl.ADJUSTED_DOC_DIST_ID(p_record_counter)          := NULL;
3315    g_suite_rec_tbl.APPLIED_TO_DOC_CURR_CONV_RATE(p_record_counter) := NULL;
3316    g_suite_rec_tbl.TAX_VARIANCE_CALC_FLAG(p_record_counter)        := NULL;
3317 
3318    --Missing initializations discovered while testig Import Case.
3319 
3320    g_suite_rec_tbl.TAX_JURISDICTION_CODE(p_record_counter)        := NULL;
3321    g_suite_rec_tbl.TAX_PROVIDER_ID(p_record_counter)              := NULL;
3322    g_suite_rec_tbl.TAX_EXCEPTION_ID(p_record_counter)             := NULL;
3323    g_suite_rec_tbl.TAX_LINE_ALLOCATION_FLAG(p_record_counter)     := NULL;
3324 
3325 
3326    END Initialize_row;
3327 
3328 
3329 
3330 /* ======================================================================*
3331  | PROCEDURE put_line_in_suite_rec_tbl : Read a line from flat file and  |
3332  |           puts it in the structure record of tables for the suite     |
3333  |           Will put the row in the indicated p_record_counter          |
3334  * ======================================================================*/
3335 
3336   PROCEDURE put_line_in_suite_rec_tbl(x_suite_number  OUT NOCOPY VARCHAR2,
3337                                       x_case_number   OUT NOCOPY VARCHAR2,
3338                                       x_api_name      OUT NOCOPY VARCHAR2,
3339                                       x_api_service   OUT NOCOPY VARCHAR2,
3340                                       x_api_structure OUT NOCOPY VARCHAR2,
3341                                       p_header_row     IN NUMBER,
3342                                       p_record_counter IN NUMBER ) IS
3343   l_counter                  NUMBER;
3344   l_element_value            VARCHAR2(2000);
3345   l_parameter_name           VARCHAR2(2000);
3346   l_return_status_p          VARCHAR2(2000);
3347   l_numeric_surrogate_value  NUMBER;
3348   l_numeric_real_value       NUMBER;
3349   BEGIN
3350     l_counter        := 0;
3351     l_parameter_name := null;
3352 
3353     -------------------------------------------------
3354     -- Get values from the line of file.
3355     -------------------------------------------------
3356     initialize_row(p_record_counter);
3357 
3358     LOOP
3359       l_counter := l_counter + 1;
3360       ------------------------------
3361       -- Get a Element from the Line
3362       ------------------------------
3363 
3364       get_next_element_in_row(l_element_value,l_return_status_p);
3365 
3366       IF l_return_status_p = 'COMPLETED' THEN
3367         EXIT;
3368       END IF;
3369 
3370       l_element_value := ltrim(rtrim(l_element_value));
3371 
3372       -------------------------------------------------------------------------------
3373       -- Retrieves the Suite, Case, API and Service if element in line is 1,2,3 or 4
3374       -------------------------------------------------------------------------------
3375       IF    l_counter = 1 THEN
3376         write_message('-------------------------------------------------------');
3377         write_message('--          Suite Number : '||l_element_value);
3378         x_suite_number:= l_element_value;
3379         g_suite_rec_tbl.ROW_SUITE(p_record_counter)    :=x_suite_number;
3380 
3381       ELSIF l_counter = 2 THEN
3382         write_message('--           Case Number : '||l_element_value);
3383         x_case_number := l_element_value;
3384         g_suite_rec_tbl.ROW_CASE(p_record_counter)    :=x_case_number;
3385 
3386       ELSIF l_counter = 3 THEN
3387         --Parameter 3 are the comments of the suite
3388         null;
3389 
3390       ELSIF l_counter = 4 THEN
3391         write_message('--                   API : '||l_element_value);
3392         x_api_name := l_element_value;
3393         g_suite_rec_tbl.ROW_API(p_record_counter)    :=x_api_name;
3394 
3395       ELSIF l_counter = 5 THEN
3396         write_message('--        APPLICATION_ID : '||l_element_value);
3397            get_user_key_id(l_element_value,'APPLICATION_ID',
3398            g_suite_rec_tbl.APPLICATION_ID(p_record_counter));
3399            put_data_in_party_rec(nvl(p_header_row,p_record_counter));
3400 
3401       ELSIF l_counter = 6 THEN
3402         write_message('--         DOCUMENT_NAME : '||l_element_value);
3403 
3404       ELSIF l_counter = 7 THEN
3405         write_message('-- DOCUMENT_LEVEL_ACTION : '||l_element_value);
3406         ------------------------------------------------------------------
3407         -- TAX EVENT TYPE CODE is the same as DOCUMENT LEVEL ACTION as Sri
3408         -- explained. So If Event Type Code is null then I will take
3409         -- the value of Document Level Action. Verify this later. 5-NOV-03
3410         ------------------------------------------------------------------
3411         g_suite_rec_tbl.TAX_EVENT_TYPE_CODE(p_record_counter) := l_element_value;
3412 
3413       ELSIF l_counter = 8 THEN
3414         write_message('--               Service : '||l_element_value);
3415         x_api_service:= l_element_value;
3416         g_suite_rec_tbl.ROW_SERVICE(p_record_counter)    :=x_api_service;
3417 
3418       ELSIF l_counter = 9 THEN
3419         write_message('--             Structure : '||l_element_value);
3420         write_message('-------------------------------------------------------');
3421         x_api_structure:= l_element_value;
3422         g_suite_rec_tbl.ROW_STRUCTURE(p_record_counter)    :=l_element_value;
3423 
3424       ELSE
3425         --------------------------------------
3426         -- Retrieves the elements in the line.
3427         --------------------------------------
3428         IF mod(l_counter,2) <> 1 THEN
3429           --------------------------------------
3430           -- Retrieves the Name of the Parameter
3431           --------------------------------------
3432           l_parameter_name := l_element_value;
3433           IF l_parameter_name IS NULL THEN
3434            l_return_status_p := 'LINE COMPLETED';
3435            EXIT;
3436           END IF;
3437         ELSE
3438           ---------------------------------------
3439           -- Retrieves the Value of the Parameter
3440           ---------------------------------------
3441           IF l_element_value is NOT NULL THEN
3442             write_message(/*trunc(l_counter/2)-2||*/
3443                           'Prm: '||rpad(l_parameter_name,32,' ')||
3444                           'Val: '||substr(l_element_value,1,50));
3445             IF    l_parameter_name= 'INTERNAL_ORGANIZATION_ID'     THEN
3446               get_user_key_id(l_element_value,'INTERNAL_ORGANIZATION_ID',
3447               g_suite_rec_tbl.INTERNAL_ORGANIZATION_ID(p_record_counter));
3448 
3449             ELSIF l_parameter_name= 'ENTITY_CODE'                  THEN
3450               g_suite_rec_tbl.ENTITY_CODE(p_record_counter):=l_element_value;
3451               put_data_in_party_rec(nvl(p_header_row,p_record_counter));
3452 
3453             ELSIF l_parameter_name= 'EVENT_CLASS_CODE'             THEN
3454               g_suite_rec_tbl.EVENT_CLASS_CODE(p_record_counter):=l_element_value;
3455               put_data_in_party_rec(nvl(p_header_row,p_record_counter));
3456 
3457             ELSIF l_parameter_name= 'EVENT_TYPE_CODE'              THEN
3458                 g_suite_rec_tbl.EVENT_TYPE_CODE(p_record_counter)            :=l_element_value;
3459                 g_suite_rec_tbl.TAX_EVENT_TYPE_CODE(p_record_counter):=
3460                 get_tax_event_type(g_suite_rec_tbl.APPLICATION_ID(p_record_counter),
3461                                  g_suite_rec_tbl.ENTITY_CODE(p_record_counter),
3462                                  g_suite_rec_tbl.EVENT_CLASS_CODE(p_record_counter),
3463                                  g_suite_rec_tbl.EVENT_TYPE_CODE(p_record_counter));
3464 
3465             ELSIF l_parameter_name= 'TRX_ID'                       THEN
3466               ----------------------------------------------------------------------------
3467               --Create the surrogate Key if has to be created or has not been created yet.
3468               ----------------------------------------------------------------------------
3469               IF g_suite_rec_tbl.tax_event_type_code.exists(p_record_counter) then
3470                 IF (g_suite_rec_tbl.tax_event_type_code(p_record_counter) = 'CREATE'
3471                    AND NOT(g_surr_trx_id_tbl.exists(l_element_value))) THEN
3472                    --write_message('Calling the Surrogate_Key Pkg.'||to_char(p_record_counter));
3473                   surrogate_key ( l_element_value,g_suite_rec_tbl.trx_id(p_record_counter),'HEADER');
3474                    --write_message('Calling the g_surr_trx_id_tbl.'||to_char(p_record_counter));
3475                    --write_message('Value in g_suite_rec_tbl_trx_id is:'||g_suite_rec_tbl.trx_id(p_record_counter));
3476                   g_surr_trx_id_tbl(l_element_value) := g_suite_rec_tbl.trx_id(p_record_counter);
3477                 ELSE
3478                   check_surrogate_key(l_element_value,g_suite_rec_tbl.trx_id(p_record_counter),'HEADER');
3479                 END IF;
3480               ELSE
3481                 write_message('~           Tax_event_type_code does not exists');
3482                 write_message('~           for the current record because it''s');
3483                 write_message('~           on the header line.');
3484                 check_surrogate_key(l_element_value,g_suite_rec_tbl.trx_id(p_record_counter),'HEADER');
3485               END IF;
3486 
3487             ELSIF l_parameter_name= 'TRX_LEVEL_TYPE'               THEN
3488               g_suite_rec_tbl.TRX_LEVEL_TYPE(p_record_counter)     :=l_element_value;
3489 
3490             ELSIF l_parameter_name= 'TRX_LINE_ID'                  THEN
3491               ----------------------------------------------------------------------------
3492               --Create the surrogate Key if has to be created or has not been created yet.
3493               ----------------------------------------------------------------------------
3494               IF g_suite_rec_tbl.tax_event_type_code.exists(p_record_counter) then
3495                 IF (g_suite_rec_tbl.tax_event_type_code(p_record_counter) = 'CREATE'
3496                     AND NOT(g_surr_trx_line_id_tbl.exists(l_element_value))) THEN
3497                   surrogate_key(l_element_value,g_suite_rec_tbl.trx_line_id(p_record_counter),'LINE');
3498                   g_surr_trx_line_id_tbl(l_element_value) := g_suite_rec_tbl.trx_line_id(p_record_counter);
3499                 ELSE
3500                   check_surrogate_key(l_element_value,g_suite_rec_tbl.trx_line_id(p_record_counter),'LINE');
3501                 END IF;
3502               ELSE
3503                 check_surrogate_key(l_element_value,g_suite_rec_tbl.trx_line_id(p_record_counter),'LINE');
3504               END IF;
3505 
3506             ELSIF l_parameter_name= 'LINE_LEVEL_ACTION'            THEN
3507               g_suite_rec_tbl.LINE_LEVEL_ACTION(p_record_counter)  :=l_element_value;
3508 
3509             ELSIF l_parameter_name= 'TRX_DATE'                     THEN
3510               g_suite_rec_tbl.TRX_DATE(p_record_counter):=
3511                 to_date(nvl(l_element_value,'2000/01/01'),'YYYY/MM/DD');
3512 
3513             ELSIF l_parameter_name= 'TRX_DOC_REVISION'             THEN
3514               g_suite_rec_tbl.TRX_DOC_REVISION(p_record_counter):=l_element_value;
3515 
3516             ELSIF l_parameter_name= 'LEDGER_ID'                    THEN
3517               get_user_key_id(l_element_value,
3518                               'LEDGER_ID',
3519                               g_suite_rec_tbl.LEDGER_ID(p_record_counter));
3520 
3521             ELSIF l_parameter_name= 'TRX_CURRENCY_CODE'            THEN
3522               g_suite_rec_tbl.TRX_CURRENCY_CODE(p_record_counter):=l_element_value;
3523 
3524             ELSIF l_parameter_name= 'CURRENCY_CONVERSION_DATE'     THEN
3525               g_suite_rec_tbl.CURRENCY_CONVERSION_DATE(p_record_counter):=
3526                 to_date(nvl(l_element_value,'2000/01/01'),'YYYY/MM/DD');
3527 
3528             ELSIF l_parameter_name= 'CURRENCY_CONVERSION_RATE'     THEN
3529               g_suite_rec_tbl.CURRENCY_CONVERSION_RATE(p_record_counter):=
3530                 to_number(l_element_value);
3531 
3532             ELSIF l_parameter_name= 'CURRENCY_CONVERSION_TYPE'     THEN
3533               g_suite_rec_tbl.CURRENCY_CONVERSION_TYPE(p_record_counter):=
3534                 l_element_value;
3535 
3536             ELSIF l_parameter_name= 'MINIMUM_ACCOUNTABLE_UNIT'     THEN
3537               g_suite_rec_tbl.MINIMUM_ACCOUNTABLE_UNIT(p_record_counter):=
3538                 to_number(l_element_value);
3539 
3540             ELSIF l_parameter_name= 'PRECISION'                    THEN
3541               g_suite_rec_tbl.PRECISION(p_record_counter):=
3542                 to_number(l_element_value);
3543 
3544             ELSIF l_parameter_name= 'TRX_SHIPPING_DATE'            THEN
3545               g_suite_rec_tbl.TRX_SHIPPING_DATE(p_record_counter):=
3546                 to_date(nvl(l_element_value,'2000/01/01'),'YYYY/MM/DD');
3547 
3548             ELSIF l_parameter_name= 'TRX_RECEIPT_DATE'             THEN
3549               g_suite_rec_tbl.TRX_RECEIPT_DATE(p_record_counter):=
3550                 to_date(nvl(l_element_value,'2000/01/01'),'YYYY/MM/DD');
3551 
3552             ELSIF l_parameter_name= 'LEGAL_ENTITY_ID'              THEN
3553               get_user_key_id(l_element_value,
3554                               'LEGAL_ENTITY_ID',
3555                               g_suite_rec_tbl.LEGAL_ENTITY_ID(p_record_counter));
3556 
3557             ELSIF l_parameter_name= 'ROUNDING_SHIP_TO_PARTY_ID'    THEN
3558               get_user_key_id(l_element_value,
3559                               'ROUNDING_SHIP_TO_PARTY_ID',
3560                               g_suite_rec_tbl.ROUNDING_SHIP_TO_PARTY_ID(p_record_counter));
3561 
3562             ELSIF l_parameter_name= 'ROUNDING_SHIP_FROM_PARTY_ID'  THEN
3563               get_user_key_id(l_element_value,
3564                               'ROUNDING_SHIP_FROM_PARTY_ID',
3565                               g_suite_rec_tbl.ROUNDING_SHIP_FROM_PARTY_ID(p_record_counter));
3566 
3567             ELSIF l_parameter_name= 'ROUNDING_BILL_TO_PARTY_ID'    THEN
3568               get_user_key_id(l_element_value,
3569                               'ROUNDING_BILL_TO_PARTY_ID',
3570                               g_suite_rec_tbl.ROUNDING_BILL_TO_PARTY_ID(p_record_counter));
3571 
3572             ELSIF l_parameter_name= 'ROUNDING_BILL_FROM_PARTY_ID'  THEN
3573               get_user_key_id(l_element_value,
3574                               'ROUNDING_BILL_FROM_PARTY_ID',
3575                               g_suite_rec_tbl.ROUNDING_BILL_FROM_PARTY_ID(p_record_counter));
3576 
3577             ELSIF l_parameter_name= 'RNDG_SHIP_TO_PARTY_SITE_ID'   THEN
3578               get_user_key_id(l_element_value,
3579                               'RNDG_SHIP_TO_PARTY_SITE_ID',
3580                               g_suite_rec_tbl.RNDG_SHIP_TO_PARTY_SITE_ID(p_record_counter));
3581 
3582             ELSIF l_parameter_name= 'RNDG_SHIP_FROM_PARTY_SITE_ID' THEN
3583               get_user_key_id(l_element_value,
3584                               'RNDG_SHIP_FROM_PARTY_SITE_ID',
3585                               g_suite_rec_tbl.RNDG_SHIP_FROM_PARTY_SITE_ID(p_record_counter));
3586 
3587             ELSIF l_parameter_name= 'RNDG_BILL_TO_PARTY_SITE_ID'   THEN
3588               get_user_key_id(l_element_value,
3589                               'RNDG_BILL_TO_PARTY_SITE_ID',
3590                               g_suite_rec_tbl.RNDG_BILL_TO_PARTY_SITE_ID(p_record_counter));
3591 
3592             ELSIF l_parameter_name= 'RNDG_BILL_FROM_PARTY_SITE_ID' THEN
3593               get_user_key_id(l_element_value,
3594                               'RNDG_BILL_FROM_PARTY_SITE_ID',
3595                               g_suite_rec_tbl.RNDG_BILL_FROM_PARTY_SITE_ID(p_record_counter));
3596 
3597             ELSIF l_parameter_name= 'ESTABLISHMENT_ID'             THEN
3598               get_user_key_id(l_element_value,
3599                               'ESTABLISHMENT_ID',
3600                               g_suite_rec_tbl.ESTABLISHMENT_ID(p_record_counter));
3601 
3602             ELSIF l_parameter_name= 'TRX_LINE_TYPE'                THEN
3603               g_suite_rec_tbl.TRX_LINE_TYPE(p_record_counter):=l_element_value;
3604 
3605             ELSIF l_parameter_name= 'TRX_LINE_DATE'                THEN
3606               g_suite_rec_tbl.TRX_LINE_DATE(p_record_counter):=
3607                 to_date(nvl(l_element_value,'2000/01/01'),'YYYY/MM/DD');
3608 
3609             ELSIF l_parameter_name= 'TRX_BUSINESS_CATEGORY'        THEN
3610               g_suite_rec_tbl.TRX_BUSINESS_CATEGORY(p_record_counter):=
3611                 l_element_value;
3612 
3613             ELSIF l_parameter_name= 'ASSESSABLE_VALUE'        THEN
3614               g_suite_rec_tbl.ASSESSABLE_VALUE(p_record_counter):=
3615                 l_element_value;
3616 
3617             ELSIF l_parameter_name= 'BASE_INVOICE_PRICE_VARIANCE' THEN
3618               g_suite_rec_tbl.BASE_INVOICE_PRICE_VARIANCE(p_record_counter):=
3619                 l_element_value;
3620 
3621             ELSIF l_parameter_name= 'CANCEL_FLAG' THEN
3622               g_suite_rec_tbl.CANCEL_FLAG(p_record_counter) :=l_element_value;
3623 
3624             ELSIF l_parameter_name= 'CTRL_TOTAL_HDR_TX_AMT' THEN
3625               g_suite_rec_tbl.CTRL_TOTAL_HDR_TX_AMT(p_record_counter):=
3626                 l_element_value;
3627 
3628             ELSIF l_parameter_name= 'REC_NREC_TAX_AMT' THEN
3629               g_suite_rec_tbl.REC_NREC_TAX_AMT(p_record_counter):=
3630                 l_element_value;
3631 
3632             ELSIF l_parameter_name= 'REC_TAX_AMT_FUNCL_CURR' THEN
3633               g_suite_rec_tbl.REC_TAX_AMT_FUNCL_CURR(p_record_counter):=
3634                 l_element_value;
3635 
3636             ELSIF l_parameter_name= 'TOTAL_REC_TAX_AMT_FUNCL_CURR' THEN
3637               g_suite_rec_tbl.TOTAL_REC_TAX_AMT_FUNCL_CURR(p_record_counter):=
3638                 l_element_value;
3639 
3640             ELSIF l_parameter_name= 'TOTAL_NREC_TAX_AMT_FUNCL_CURR' THEN
3641               g_suite_rec_tbl.TOTAL_NREC_TAX_AMT_FUNCL_CURR(p_record_counter):=
3642                 l_element_value;
3643 
3644             ELSIF l_parameter_name= 'TAXABLE_AMT_FUNCL_CURR' THEN
3645               g_suite_rec_tbl.TAXABLE_AMT_FUNCL_CURR(p_record_counter):=
3646                 l_element_value;
3647 
3648             ELSIF l_parameter_name= 'TAXABLE_AMT' THEN
3649               g_suite_rec_tbl.TAXABLE_AMT(p_record_counter):=
3650                 l_element_value;
3651 
3652             ELSIF l_parameter_name= 'TAX_REGISTRATION_NUMBER' THEN
3653               g_suite_rec_tbl.TAX_REGISTRATION_NUMBER(p_record_counter):=
3654                 l_element_value;
3655 
3656             ELSIF l_parameter_name= 'TAX_LINE_ID' THEN
3657               g_suite_rec_tbl.TAX_LINE_ID(p_record_counter):=
3658                 l_element_value;
3659 
3660             ELSIF l_parameter_name= 'TAX_JURISDICTION_ID' THEN
3661               g_suite_rec_tbl.TAX_JURISDICTION_ID(p_record_counter):=
3662                 l_element_value;
3663 
3664             ELSIF l_parameter_name= 'TAX_HOLD_CODE' THEN
3665               g_suite_rec_tbl.TAX_HOLD_CODE(p_record_counter):=
3666                 l_element_value;
3667 
3668             ELSIF l_parameter_name= 'TAX_EXEMPTION_ID' THEN
3669               g_suite_rec_tbl.TAX_EXEMPTION_ID(p_record_counter):=
3670                 l_element_value;
3671 
3672             ELSIF l_parameter_name= 'TAX_CLASSIFICATION_CODE' THEN
3673               g_suite_rec_tbl.TAX_CLASSIFICATION_CODE(p_record_counter):=
3674                 l_element_value;
3675 
3676             ELSIF l_parameter_name= 'RECOVERABLE_FLAG' THEN
3677               g_suite_rec_tbl.RECOVERABLE_FLAG(p_record_counter):=
3678                 l_element_value;
3679 
3680             ELSIF l_parameter_name= 'TAX_APPORTIONMENT_LINE_NUMBER' THEN
3681               g_suite_rec_tbl.TAX_APPORTIONMENT_LINE_NUMBER(p_record_counter):=
3682                 l_element_value;
3683 
3684             ELSIF l_parameter_name= 'TAX_AMT_INCLUDED_FLAG' THEN
3685               g_suite_rec_tbl.TAX_AMT_INCLUDED_FLAG(p_record_counter):=
3686                 l_element_value;
3687 
3688             ELSIF l_parameter_name= 'TAX_AMT_FUNCL_CURR' THEN
3689               g_suite_rec_tbl.TAX_AMT_FUNCL_CURR(p_record_counter):=
3690                 l_element_value;
3691 
3692             ELSIF l_parameter_name= 'SUMMARY_TAX_LINE_ID' THEN
3693               g_suite_rec_tbl.SUMMARY_TAX_LINE_ID(p_record_counter):=
3694                 l_element_value;
3695 
3696             ELSIF l_parameter_name= 'REVERSING_TAX_LINE_ID' THEN
3697               g_suite_rec_tbl.REVERSING_TAX_LINE_ID(p_record_counter):=
3698                 l_element_value;
3699 
3700             ELSIF l_parameter_name= 'REVERSING_TRX_LINE_DIST_ID' THEN
3701               g_suite_rec_tbl.REVERSING_TRX_LINE_DIST_ID(p_record_counter):=
3702                 l_element_value;
3703 
3704             ELSIF l_parameter_name= 'REVERSED_TAX_DIST_ID' THEN
3705               g_suite_rec_tbl.REVERSED_TAX_DIST_ID(p_record_counter):=
3706                 l_element_value;
3707 
3708             ELSIF l_parameter_name= 'REVERSED_TRX_LINE_DIST_ID' THEN
3709               g_suite_rec_tbl.REVERSED_TRX_LINE_DIST_ID(p_record_counter):=
3710                 l_element_value;
3711 
3712             ELSIF l_parameter_name= 'REVERSE_FLAG' THEN
3713               g_suite_rec_tbl.REVERSE_FLAG(p_record_counter):=
3714                 l_element_value;
3715 
3716             ELSIF l_parameter_name= 'RECOVERY_TYPE_CODE' THEN
3717               g_suite_rec_tbl.RECOVERY_TYPE_CODE(p_record_counter):=
3718                 l_element_value;
3719 
3720             ELSIF l_parameter_name= 'RECOVERY_RATE_CODE' THEN
3721               g_suite_rec_tbl.RECOVERY_RATE_CODE(p_record_counter):=
3722                 l_element_value;
3723 
3724             ELSIF l_parameter_name= 'REC_TAX_AMT' THEN
3725               g_suite_rec_tbl.REC_TAX_AMT(p_record_counter):=
3726                 l_element_value;
3727 
3728             ELSIF l_parameter_name= 'REC_NREC_TAX_DIST_ID' THEN
3729               g_suite_rec_tbl.REC_NREC_TAX_DIST_ID(p_record_counter):=l_element_value;
3730 
3731             ELSIF l_parameter_name= 'REC_TAX_AMT_FUNCL_CURR' THEN
3732                       g_suite_rec_tbl.REC_TAX_AMT_FUNCL_CURR(p_record_counter) :=l_element_value;
3733 
3734             ELSIF l_parameter_name= 'REC_TAX_AMT' THEN
3735                       g_suite_rec_tbl.REC_TAX_AMT(p_record_counter) :=l_element_value;
3736 
3737             ELSIF l_parameter_name= 'REC_NREC_TAX_DIST_ID' THEN
3738                       g_suite_rec_tbl.REC_NREC_TAX_DIST_ID(p_record_counter) :=l_element_value;
3739 
3740             ELSIF l_parameter_name= 'REC_NREC_TAX_AMT_FUNCL_CURR' THEN
3741                       g_suite_rec_tbl.REC_NREC_TAX_AMT_FUNCL_CURR(p_record_counter) :=l_element_value;
3742 
3743             ELSIF l_parameter_name= 'REC_NREC_CCID' THEN
3744                       g_suite_rec_tbl.REC_NREC_CCID(p_record_counter) :=l_element_value;
3745 
3746             ELSIF l_parameter_name= 'EXCHANGE_RATE_VARIANCE' THEN
3747                       g_suite_rec_tbl.EXCHANGE_RATE_VARIANCE(p_record_counter) :=l_element_value;
3748 
3749             ELSIF l_parameter_name= 'POSTING_FLAG' THEN
3750                       g_suite_rec_tbl.POSTING_FLAG(p_record_counter) :=l_element_value;
3751 
3752             ELSIF l_parameter_name= 'EXEMPT_REASON_CODE' THEN
3753                       g_suite_rec_tbl.EXEMPT_REASON_CODE(p_record_counter) :=l_element_value;
3754 
3755             ELSIF l_parameter_name= 'EXEMPTION_RATE' THEN
3756                       g_suite_rec_tbl.EXEMPTION_RATE(p_record_counter) :=l_element_value;
3757 
3758             ELSIF l_parameter_name= 'NREC_TAX_AMT_FUNCL_CURR' THEN
3759                       g_suite_rec_tbl.NREC_TAX_AMT_FUNCL_CURR(p_record_counter) :=l_element_value;
3760 
3761             ELSIF l_parameter_name= 'NREC_TAX_AMT' THEN
3762                       g_suite_rec_tbl.NREC_TAX_AMT(p_record_counter) :=l_element_value;
3763 
3764             ELSIF l_parameter_name= 'INVOICE_PRICE_VARIANCE' THEN
3765                       g_suite_rec_tbl.INVOICE_PRICE_VARIANCE(p_record_counter) :=l_element_value;
3766 
3767             ELSIF l_parameter_name= 'INTERNAL_ORG_LOCATION_ID' THEN
3768                       g_suite_rec_tbl.INTERNAL_ORG_LOCATION_ID(p_record_counter) :=l_element_value;
3769 
3770             ELSIF l_parameter_name= 'FREEZE_FLAG' THEN
3771                       g_suite_rec_tbl.FREEZE_FLAG(p_record_counter) :=l_element_value;
3772 
3773             ELSIF l_parameter_name= 'OVERRIDE_LEVEL'               THEN
3774                       g_suite_rec_tbl.OVERRIDE_LEVEL(p_record_counter)       :=l_element_value;
3775 
3776             ELSIF l_parameter_name= 'LINE_INTENDED_USE'            THEN
3777                       g_suite_rec_tbl.LINE_INTENDED_USE(p_record_counter)    :=l_element_value;
3778 
3779             ELSIF l_parameter_name= 'USER_DEFINED_FISC_CLASS'      THEN
3780                       g_suite_rec_tbl.USER_DEFINED_FISC_CLASS(p_record_counter)  :=l_element_value;
3781 
3782             ELSIF l_parameter_name= 'TAX_CODE'                     THEN
3783                       g_suite_rec_tbl.TAX_CODE(p_record_counter)                   :=l_element_value;
3784 
3785             ELSIF l_parameter_name= 'TAX_INCLUSION_FLAG'            THEN
3786                       g_suite_rec_tbl.TAX_INCLUSION_FLAG(p_record_counter)      :=l_element_value;
3787 
3788             ELSIF l_parameter_name= 'LINE_AMT'                     THEN
3789                       g_suite_rec_tbl.LINE_AMT(p_record_counter)               :=to_number(l_element_value);
3790 
3791             ELSIF l_parameter_name= 'TRX_LINE_QUANTITY'            THEN
3792                       g_suite_rec_tbl.TRX_LINE_QUANTITY(p_record_counter)     :=to_number(l_element_value);
3793 
3794             ELSIF l_parameter_name= 'UNIT_PRICE'                   THEN
3795                       g_suite_rec_tbl.UNIT_PRICE(p_record_counter)           :=to_number(l_element_value);
3796 
3797             ELSIF l_parameter_name= 'EXEMPT_CERTIFICATE_NUMBER'    THEN
3798                       g_suite_rec_tbl.EXEMPT_CERTIFICATE_NUMBER(p_record_counter)  :=l_element_value;
3799 
3800             ELSIF l_parameter_name= 'EXEMPT_REASON'                THEN
3801                       g_suite_rec_tbl.EXEMPT_REASON(p_record_counter)        :=l_element_value;
3802 
3803             ELSIF l_parameter_name= 'CASH_DISCOUNT'                THEN
3804                       g_suite_rec_tbl.CASH_DISCOUNT(p_record_counter)       :=to_number(l_element_value);
3805 
3806             ELSIF l_parameter_name= 'VOLUME_DISCOUNT'              THEN
3807                       g_suite_rec_tbl.VOLUME_DISCOUNT(p_record_counter)     :=to_number(l_element_value);
3808 
3809             ELSIF l_parameter_name= 'TRADING_DISCOUNT'             THEN
3810                       g_suite_rec_tbl.TRADING_DISCOUNT(p_record_counter)    :=to_number(l_element_value);
3811 
3812             ELSIF l_parameter_name= 'TRANSFER_CHARGE'              THEN
3813                       g_suite_rec_tbl.TRANSFER_CHARGE(p_record_counter)     :=to_number(l_element_value);
3814 
3815             ELSIF l_parameter_name= 'TRANSPORTATION_CHARGE'        THEN
3816                       g_suite_rec_tbl.TRANSPORTATION_CHARGE(p_record_counter)  :=to_number(l_element_value);
3817 
3818             ELSIF l_parameter_name= 'INSURANCE_CHARGE'             THEN
3819                       g_suite_rec_tbl.INSURANCE_CHARGE(p_record_counter)     :=to_number(l_element_value);
3820 
3821             ELSIF l_parameter_name= 'OTHER_CHARGE'                 THEN
3822                       g_suite_rec_tbl.OTHER_CHARGE(p_record_counter)        :=to_number(l_element_value);
3823 
3824             ELSIF l_parameter_name= 'PRODUCT_ID'                   THEN
3825                  get_user_key_id(l_element_value,'PRODUCT_ID',g_suite_rec_tbl.PRODUCT_ID(p_record_counter));
3826 
3827             ELSIF l_parameter_name= 'FIRST_PARTY_ORG_ID'  THEN
3828                       g_suite_rec_tbl.FIRST_PARTY_ORG_ID(p_record_counter):=l_element_value;
3829 
3830             ELSIF l_parameter_name= 'TAX_EVENT_CLASS_CODE'  THEN
3831                       g_suite_rec_tbl.TAX_EVENT_CLASS_CODE(p_record_counter):=l_element_value;
3832             ELSIF l_parameter_name= 'DOC_EVENT_STATUS'  THEN
3833                       g_suite_rec_tbl.DOC_EVENT_STATUS(p_record_counter):=l_element_value;
3834             ELSIF l_parameter_name= 'APPLIED_FROM_DIST_ID'  THEN
3835                       g_suite_rec_tbl.APPLIED_FROM_DIST_ID(p_record_counter):=l_element_value;
3836             ELSIF l_parameter_name= 'FIRST_PARTY_ORG_ID'  THEN
3837                       g_suite_rec_tbl.FIRST_PARTY_ORG_ID(p_record_counter):=l_element_value;
3838             ELSIF l_parameter_name= 'RDNG_SHIP_TO_PTY_TX_PROF_ID'  THEN
3839                       g_suite_rec_tbl.RDNG_SHIP_TO_PTY_TX_PROF_ID(p_record_counter):=l_element_value;
3840 
3841             ELSIF l_parameter_name= 'RDNG_SHIP_FROM_PTY_TX_PROF_ID'  THEN
3842                       g_suite_rec_tbl.RDNG_SHIP_FROM_PTY_TX_PROF_ID(p_record_counter):=l_element_value;
3843             ELSIF l_parameter_name= 'RDNG_BILL_TO_PTY_TX_PROF_ID'  THEN
3844                       g_suite_rec_tbl.RDNG_BILL_TO_PTY_TX_PROF_ID(p_record_counter):=l_element_value;
3845             ELSIF l_parameter_name= 'RDNG_BILL_FROM_PTY_TX_PROF_ID'  THEN
3846                       g_suite_rec_tbl.RDNG_BILL_FROM_PTY_TX_PROF_ID(p_record_counter):=l_element_value;
3847             ELSIF l_parameter_name= 'RDNG_SHIP_TO_PTY_TX_P_ST_ID'  THEN
3848                       g_suite_rec_tbl.RDNG_SHIP_TO_PTY_TX_P_ST_ID(p_record_counter):=l_element_value;
3849             ELSIF l_parameter_name= 'RDNG_SHIP_FROM_PTY_TX_P_ST_ID'  THEN
3850                       g_suite_rec_tbl.RDNG_SHIP_FROM_PTY_TX_P_ST_ID(p_record_counter):=l_element_value;
3851             ELSIF l_parameter_name= 'RDNG_BILL_TO_PTY_TX_P_ST_ID'  THEN
3852                       g_suite_rec_tbl.RDNG_BILL_TO_PTY_TX_P_ST_ID(p_record_counter):=l_element_value;
3853             ELSIF l_parameter_name= 'RDNG_BILL_FROM_PTY_TX_P_ST_ID'  THEN
3854                       g_suite_rec_tbl.RDNG_BILL_FROM_PTY_TX_P_ST_ID(p_record_counter):=l_element_value;
3855             ELSIF l_parameter_name= 'VALIDATION_CHECK_FLAG'  THEN
3856                       g_suite_rec_tbl.VALIDATION_CHECK_FLAG(p_record_counter):=l_element_value;
3857             ELSIF l_parameter_name= 'LINE_CLASS'  THEN
3858                       g_suite_rec_tbl.LINE_CLASS(p_record_counter):=l_element_value;
3859             ELSIF l_parameter_name= 'TRX_ID_LEVEL2'  THEN
3860                       g_suite_rec_tbl.TRX_ID_LEVEL2(p_record_counter):=l_element_value;
3861             ELSIF l_parameter_name= 'TRX_ID_LEVEL3'  THEN
3862                       g_suite_rec_tbl.TRX_ID_LEVEL3(p_record_counter):=l_element_value;
3863             ELSIF l_parameter_name= 'TRX_ID_LEVEL4'  THEN
3864                       g_suite_rec_tbl.TRX_ID_LEVEL4(p_record_counter):=l_element_value;
3865             ELSIF l_parameter_name= 'TRX_ID_LEVEL5'  THEN
3866                       g_suite_rec_tbl.TRX_ID_LEVEL5(p_record_counter):=l_element_value;
3867             ELSIF l_parameter_name= 'TRX_ID_LEVEL6'  THEN
3868                       g_suite_rec_tbl.TRX_ID_LEVEL6(p_record_counter):=l_element_value;
3869             ELSIF l_parameter_name= 'PAYING_PARTY_ID'  THEN
3870                       g_suite_rec_tbl.PAYING_PARTY_ID(p_record_counter):=l_element_value;
3871             ELSIF l_parameter_name= 'TRADING_HQ_PARTY_ID'  THEN
3872                       g_suite_rec_tbl.TRADING_HQ_PARTY_ID(p_record_counter):=l_element_value;
3873             ELSIF l_parameter_name= 'PAYING_PARTY_ID'  THEN
3874                       g_suite_rec_tbl.PAYING_PARTY_ID(p_record_counter):=l_element_value;
3875             ELSIF l_parameter_name= 'TRADING_HQ_PARTY_ID'  THEN
3876                       g_suite_rec_tbl.TRADING_HQ_PARTY_ID(p_record_counter):=l_element_value;
3877             ELSIF l_parameter_name= 'POI_PARTY_ID'  THEN
3878                       g_suite_rec_tbl.POI_PARTY_ID(p_record_counter):=l_element_value;
3879             ELSIF l_parameter_name= 'POD_PARTY_ID'  THEN
3880                       g_suite_rec_tbl.POD_PARTY_ID(p_record_counter):=l_element_value;
3881             ELSIF l_parameter_name= 'TITLE_TRANSFER_PARTY_ID'  THEN
3882                       g_suite_rec_tbl.TITLE_TRANSFER_PARTY_ID(p_record_counter):=l_element_value;
3883             ELSIF l_parameter_name= 'PAYING_PARTY_SITE_ID'  THEN
3884                       g_suite_rec_tbl.PAYING_PARTY_SITE_ID(p_record_counter):=l_element_value;
3885             ELSIF l_parameter_name= 'OWN_HQ_PARTY_SITE_ID'  THEN
3886                       g_suite_rec_tbl.OWN_HQ_PARTY_SITE_ID(p_record_counter):=l_element_value;
3887             ELSIF l_parameter_name= 'TRADING_HQ_PARTY_SITE_ID'  THEN
3888                       g_suite_rec_tbl.TRADING_HQ_PARTY_SITE_ID(p_record_counter):=l_element_value;
3889             ELSIF l_parameter_name= 'POI_PARTY_SITE_ID'  THEN
3890                       g_suite_rec_tbl.POI_PARTY_SITE_ID(p_record_counter):=l_element_value;
3891             ELSIF l_parameter_name= 'POD_PARTY_SITE_ID'  THEN
3892                       g_suite_rec_tbl.POD_PARTY_SITE_ID(p_record_counter):=l_element_value;
3893             ELSIF l_parameter_name= 'TITLE_TRANSFER_PARTY_ID'  THEN
3894                       g_suite_rec_tbl.TITLE_TRANSFER_PARTY_ID(p_record_counter):=l_element_value;
3895             ELSIF l_parameter_name= 'PAYING_PARTY_SITE_ID'  THEN
3896                       g_suite_rec_tbl.PAYING_PARTY_SITE_ID(p_record_counter):=l_element_value;
3897             ELSIF l_parameter_name= 'OWN_HQ_PARTY_SITE_ID'  THEN
3898                       g_suite_rec_tbl.OWN_HQ_PARTY_SITE_ID(p_record_counter):=l_element_value;
3899             ELSIF l_parameter_name= 'TRADING_HQ_PARTY_SITE_ID'  THEN
3900                       g_suite_rec_tbl.TRADING_HQ_PARTY_SITE_ID(p_record_counter):=l_element_value;
3901             ELSIF l_parameter_name= 'POI_PARTY_SITE_ID'  THEN
3902                       g_suite_rec_tbl.POI_PARTY_SITE_ID(p_record_counter):=l_element_value;
3903             ELSIF l_parameter_name= 'POD_PARTY_SITE_ID'  THEN
3904                       g_suite_rec_tbl.POD_PARTY_SITE_ID(p_record_counter):=l_element_value;
3905             ELSIF l_parameter_name= 'POD_PARTY_SITE_ID'  THEN
3906                       g_suite_rec_tbl.POD_PARTY_SITE_ID(p_record_counter):=l_element_value;
3907             ELSIF l_parameter_name= 'POD_PARTY_SITE_ID'  THEN
3908                       g_suite_rec_tbl.POD_PARTY_SITE_ID(p_record_counter):=l_element_value;
3909             ELSIF l_parameter_name= 'POD_PARTY_SITE_ID'  THEN
3910                       g_suite_rec_tbl.POD_PARTY_SITE_ID(p_record_counter):=l_element_value;
3911             ELSIF l_parameter_name= 'TITLE_TRANSFER_PARTY_SITE_ID'  THEN
3912                       g_suite_rec_tbl.TITLE_TRANSFER_PARTY_SITE_ID(p_record_counter):=l_element_value;
3913             ELSIF l_parameter_name= 'PAYING_LOCATION_ID'  THEN
3914                       g_suite_rec_tbl.PAYING_LOCATION_ID(p_record_counter):=l_element_value;
3915             ELSIF l_parameter_name= 'OWN_HQ_LOCATION_ID'  THEN
3916                       g_suite_rec_tbl.OWN_HQ_LOCATION_ID(p_record_counter):=l_element_value;
3917             ELSIF l_parameter_name= 'TRADING_HQ_LOCATION_ID'  THEN
3918                       g_suite_rec_tbl.TRADING_HQ_LOCATION_ID(p_record_counter):=l_element_value;
3919             ELSIF l_parameter_name= 'TRADING_HQ_LOCATION_ID'  THEN
3920                       g_suite_rec_tbl.TRADING_HQ_LOCATION_ID(p_record_counter):=l_element_value;
3921             ELSIF l_parameter_name= 'POC_LOCATION_ID'  THEN
3922                       g_suite_rec_tbl.POC_LOCATION_ID(p_record_counter):=l_element_value;
3923             ELSIF l_parameter_name= 'POI_LOCATION_ID'  THEN
3924                       g_suite_rec_tbl.POI_LOCATION_ID(p_record_counter):=l_element_value;
3925             ELSIF l_parameter_name= 'POD_LOCATION_ID'  THEN
3926                       g_suite_rec_tbl.POD_LOCATION_ID(p_record_counter):=l_element_value;
3927             ELSIF l_parameter_name= 'TITLE_TRANSFER_LOCATION_ID'  THEN
3928                       g_suite_rec_tbl.TITLE_TRANSFER_LOCATION_ID(p_record_counter):=l_element_value;
3929             ELSIF l_parameter_name= 'ASSET_FLAG'  THEN
3930                       g_suite_rec_tbl.ASSET_FLAG(p_record_counter):=l_element_value;
3931             ELSIF l_parameter_name= 'ASSET_NUMBER'  THEN
3932                       g_suite_rec_tbl.ASSET_NUMBER(p_record_counter):=l_element_value;
3933             ELSIF l_parameter_name= 'ASSET_ACCUM_DEPRECIATION'  THEN
3934                       g_suite_rec_tbl.ASSET_ACCUM_DEPRECIATION(p_record_counter):=l_element_value;
3935             ELSIF l_parameter_name= 'ASSET_TYPE'  THEN
3936                       g_suite_rec_tbl.ASSET_TYPE(p_record_counter):=l_element_value;
3937             ELSIF l_parameter_name= 'ASSET_COST'  THEN
3938                       g_suite_rec_tbl.ASSET_COST(p_record_counter):=l_element_value;
3939             ELSIF l_parameter_name= 'SHIP_TO_PARTY_TAX_PROF_ID'  THEN
3940                       g_suite_rec_tbl.SHIP_TO_PARTY_TAX_PROF_ID(p_record_counter):=l_element_value;
3941             ELSIF l_parameter_name= 'SHIP_FROM_PARTY_TAX_PROF_ID'  THEN
3942                       g_suite_rec_tbl.SHIP_FROM_PARTY_TAX_PROF_ID(p_record_counter):=l_element_value;
3943             ELSIF l_parameter_name= 'POA_PARTY_TAX_PROF_ID'  THEN
3944                       g_suite_rec_tbl.POA_PARTY_TAX_PROF_ID(p_record_counter):=l_element_value;
3945             ELSIF l_parameter_name= 'POO_PARTY_TAX_PROF_ID'  THEN
3946                       g_suite_rec_tbl.POO_PARTY_TAX_PROF_ID(p_record_counter):=l_element_value;
3947             ELSIF l_parameter_name= 'PAYING_PARTY_TAX_PROF_ID'  THEN
3948                       g_suite_rec_tbl.PAYING_PARTY_TAX_PROF_ID(p_record_counter):=l_element_value;
3949             ELSIF l_parameter_name= 'OWN_HQ_PARTY_TAX_PROF_ID'  THEN
3950                       g_suite_rec_tbl.OWN_HQ_PARTY_TAX_PROF_ID(p_record_counter):=l_element_value;
3951             ELSIF l_parameter_name= 'TRADING_HQ_PARTY_TAX_PROF_ID'  THEN
3952                       g_suite_rec_tbl.TRADING_HQ_PARTY_TAX_PROF_ID(p_record_counter):=l_element_value;
3953             ELSIF l_parameter_name= 'POI_PARTY_TAX_PROF_ID'  THEN
3954                       g_suite_rec_tbl.POI_PARTY_TAX_PROF_ID(p_record_counter):=l_element_value;
3955             ELSIF l_parameter_name= 'POD_PARTY_TAX_PROF_ID'  THEN
3956                       g_suite_rec_tbl.POD_PARTY_TAX_PROF_ID(p_record_counter):=l_element_value;
3957             ELSIF l_parameter_name= 'BILL_TO_PARTY_TAX_PROF_ID'  THEN
3958                       g_suite_rec_tbl.BILL_TO_PARTY_TAX_PROF_ID(p_record_counter):=l_element_value;
3959             ELSIF l_parameter_name= 'BILL_FROM_PARTY_TAX_PROF_ID'  THEN
3960                       g_suite_rec_tbl.BILL_FROM_PARTY_TAX_PROF_ID(p_record_counter):=l_element_value;
3961             ELSIF l_parameter_name= 'SHIP_TO_SITE_PARTY_TAX_PROF_ID'  THEN
3962                       g_suite_rec_tbl.SHIP_TO_SITE_PARTY_TAX_PROF_ID(p_record_counter):=l_element_value;
3963             ELSIF l_parameter_name= 'POA_SITE_TAX_PROF_ID'  THEN
3964                       g_suite_rec_tbl.POA_SITE_TAX_PROF_ID(p_record_counter):=l_element_value;
3965             ELSIF l_parameter_name= 'POO_SITE_TAX_PROF_ID'  THEN
3966                       g_suite_rec_tbl.POO_SITE_TAX_PROF_ID(p_record_counter):=l_element_value;
3967             ELSIF l_parameter_name= 'PAYING_SITE_TAX_PROF_ID'  THEN
3968                       g_suite_rec_tbl.PAYING_SITE_TAX_PROF_ID(p_record_counter):=l_element_value;
3969             ELSIF l_parameter_name= 'OWN_HQ_SITE_TAX_PROF_ID'  THEN
3970                       g_suite_rec_tbl.OWN_HQ_SITE_TAX_PROF_ID(p_record_counter):=l_element_value;
3971             ELSIF l_parameter_name= 'TRADING_HQ_SITE_TAX_PROF_ID'  THEN
3972                       g_suite_rec_tbl.TRADING_HQ_SITE_TAX_PROF_ID(p_record_counter):=l_element_value;
3973             ELSIF l_parameter_name= 'POI_SITE_TAX_PROF_ID'  THEN
3974                       g_suite_rec_tbl.POI_SITE_TAX_PROF_ID(p_record_counter):=l_element_value;
3975             ELSIF l_parameter_name= 'POD_SITE_TAX_PROF_ID'  THEN
3976                       g_suite_rec_tbl.POD_SITE_TAX_PROF_ID(p_record_counter):=l_element_value;
3977             ELSIF l_parameter_name= 'BILL_TO_SITE_TAX_PROF_ID'  THEN
3978                       g_suite_rec_tbl.BILL_TO_SITE_TAX_PROF_ID(p_record_counter):=l_element_value;
3979             ELSIF l_parameter_name= 'BILL_FROM_SITE_TAX_PROF_ID'  THEN
3980                       g_suite_rec_tbl.BILL_FROM_SITE_TAX_PROF_ID(p_record_counter):=l_element_value;
3981             ELSIF l_parameter_name= 'TITLE_TRANS_SITE_TAX_PROF_ID'  THEN
3982                       g_suite_rec_tbl.TITLE_TRANS_SITE_TAX_PROF_ID(p_record_counter):=l_element_value;
3983             ELSIF l_parameter_name= 'MERCHANT_PARTY_TAX_PROF_ID'  THEN
3984                       g_suite_rec_tbl.MERCHANT_PARTY_TAX_PROF_ID(p_record_counter):=l_element_value;
3985             ELSIF l_parameter_name= 'HQ_ESTB_PARTY_TAX_PROF_ID'  THEN
3986                       g_suite_rec_tbl.HQ_ESTB_PARTY_TAX_PROF_ID(p_record_counter):=l_element_value;
3987             ELSIF l_parameter_name= 'CTRL_HDR_TX_APPL_FLAG'  THEN
3988                       g_suite_rec_tbl.CTRL_HDR_TX_APPL_FLAG(p_record_counter):=l_element_value;
3989             ELSIF l_parameter_name= 'CTRL_TOTAL_LINE_TX_AMT'  THEN
3990                       g_suite_rec_tbl.CTRL_TOTAL_LINE_TX_AMT(p_record_counter):=l_element_value;
3991             ELSIF l_parameter_name= 'TAX_JURISDICTION_CODE'  THEN
3992                       g_suite_rec_tbl.TAX_JURISDICTION_CODE(p_record_counter):=l_element_value;
3993             ELSIF l_parameter_name= 'TAX_PROVIDER_ID'  THEN
3994                       g_suite_rec_tbl.TAX_PROVIDER_ID(p_record_counter):=l_element_value;
3995             ELSIF l_parameter_name= 'TAX_EXCEPTION_ID'  THEN
3996                       g_suite_rec_tbl.TAX_EXCEPTION_ID(p_record_counter):=l_element_value;
3997             ELSIF l_parameter_name= 'TAX_LINE_ALLOCATION_FLAG'  THEN
3998                       g_suite_rec_tbl.TAX_LINE_ALLOCATION_FLAG(p_record_counter):=l_element_value;
3999             ELSIF l_parameter_name= 'REVERSED_TAX_LINE_ID'  THEN
4000                       g_suite_rec_tbl.REVERSED_TAX_LINE_ID(p_record_counter):=l_element_value;
4001             ELSIF l_parameter_name= 'APPLIED_FROM_TAX_DIST_ID'  THEN
4002                       g_suite_rec_tbl.APPLIED_FROM_TAX_DIST_ID(p_record_counter):=l_element_value;
4003             ELSIF l_parameter_name= 'ADJUSTED_DOC_TAX_DIST_ID'  THEN
4004                       g_suite_rec_tbl.ADJUSTED_DOC_TAX_DIST_ID(p_record_counter):=l_element_value;
4005             ELSIF l_parameter_name= 'TRX_LINE_DIST_TAX_AMT'  THEN
4006                       g_suite_rec_tbl.TRX_LINE_DIST_TAX_AMT(p_record_counter):=l_element_value;
4007             ELSIF l_parameter_name= 'ADJUSTED_DOC_DIST_ID'  THEN
4008                       g_suite_rec_tbl.ADJUSTED_DOC_DIST_ID(p_record_counter):=l_element_value;
4009             ELSIF l_parameter_name= 'APPLIED_TO_DOC_CURR_CONV_RATE'  THEN
4010                       g_suite_rec_tbl.APPLIED_TO_DOC_CURR_CONV_RATE(p_record_counter):=l_element_value;
4011             ELSIF l_parameter_name= 'TAX_VARIANCE_CALC_FLAG'  THEN
4012                       g_suite_rec_tbl.TAX_VARIANCE_CALC_FLAG(p_record_counter):=l_element_value;
4013 
4014 
4015             ELSIF l_parameter_name= 'PRODUCT_FISC_CLASSIFICATION'  THEN
4016                       g_suite_rec_tbl.PRODUCT_FISC_CLASSIFICATION(p_record_counter):=l_element_value;
4017 
4018             ELSIF l_parameter_name= 'PRODUCT_ORG_ID'               THEN
4019                get_user_key_id(l_element_value,'PRODUCT_ORG_ID',g_suite_rec_tbl.PRODUCT_ORG_ID(p_record_counter));
4020 
4021             ELSIF l_parameter_name= 'UOM_CODE'                     THEN
4022                       g_suite_rec_tbl.UOM_CODE(p_record_counter)        :=l_element_value;
4023 
4024             ELSIF l_parameter_name= 'PRODUCT_TYPE'                 THEN
4025                       g_suite_rec_tbl.PRODUCT_TYPE(p_record_counter)    :=l_element_value;
4026 
4027             ELSIF l_parameter_name= 'PRODUCT_CODE'                 THEN
4028                       g_suite_rec_tbl.PRODUCT_CODE(p_record_counter)    :=l_element_value;
4029 
4030             ELSIF l_parameter_name= 'PRODUCT_CATEGORY'             THEN
4031                       g_suite_rec_tbl.PRODUCT_CATEGORY(p_record_counter)  :=l_element_value;
4032 
4033             ELSIF l_parameter_name= 'TRX_SIC_CODE'                 THEN
4034                       g_suite_rec_tbl.TRX_SIC_CODE(p_record_counter)    :=l_element_value;
4035 
4036             ELSIF l_parameter_name= 'FOB_POINT'                    THEN
4037                       g_suite_rec_tbl.FOB_POINT(p_record_counter)                  :=l_element_value;
4038 
4039             ELSIF l_parameter_name= 'SHIP_TO_PARTY_ID'             THEN
4040                  get_user_key_id(l_element_value,'SHIP_TO_PARTY_ID',g_suite_rec_tbl.SHIP_TO_PARTY_ID(p_record_counter));
4041 
4042             ELSIF l_parameter_name= 'SHIP_FROM_PARTY_ID'           THEN
4043                  get_user_key_id(l_element_value,'SHIP_FROM_PARTY_ID',g_suite_rec_tbl.SHIP_FROM_PARTY_ID(p_record_counter));
4044 
4045             ELSIF l_parameter_name= 'POA_PARTY_ID'                 THEN
4046                  get_user_key_id(l_element_value,'POA_PARTY_ID',g_suite_rec_tbl.POA_PARTY_ID(p_record_counter));
4047 
4048             ELSIF l_parameter_name= 'POO_PARTY_ID'                 THEN
4049                  get_user_key_id(l_element_value,'POO_PARTY_ID',g_suite_rec_tbl.POO_PARTY_ID(p_record_counter));
4050 
4051             ELSIF l_parameter_name= 'BILL_TO_PARTY_ID'             THEN
4052                  get_user_key_id(l_element_value,'BILL_TO_PARTY_ID',g_suite_rec_tbl.BILL_TO_PARTY_ID(p_record_counter));
4053 
4054             ELSIF l_parameter_name= 'BILL_FROM_PARTY_ID'           THEN
4055                  get_user_key_id(l_element_value,'BILL_FROM_PARTY_ID',g_suite_rec_tbl.BILL_FROM_PARTY_ID(p_record_counter));
4056 
4057             ELSIF l_parameter_name= 'MERCHANT_PARTY_ID'            THEN
4058                  get_user_key_id(l_element_value,'MERCHANT_PARTY_ID',g_suite_rec_tbl.MERCHANT_PARTY_ID(p_record_counter));
4059 
4060             ELSIF l_parameter_name= 'SHIP_TO_PARTY_SITE_ID'        THEN
4061                  get_user_key_id(l_element_value,'SHIP_TO_PARTY_SITE_ID',g_suite_rec_tbl.SHIP_TO_PARTY_SITE_ID(p_record_counter));
4062 
4063             ELSIF l_parameter_name= 'SHIP_FROM_PARTY_SITE_ID'      THEN
4064                  get_user_key_id(l_element_value,'SHIP_FROM_PARTY_SITE_ID',g_suite_rec_tbl.SHIP_FROM_PARTY_SITE_ID(p_record_counter));
4065 
4066             ELSIF l_parameter_name= 'POA_PARTY_SITE_ID'            THEN
4067                  get_user_key_id(l_element_value,'POA_PARTY_ID',g_suite_rec_tbl.POA_PARTY_ID(p_record_counter));
4068 
4069             ELSIF l_parameter_name= 'POO_PARTY_SITE_ID'            THEN
4070                  get_user_key_id(l_element_value,'POO_PARTY_ID',g_suite_rec_tbl.POO_PARTY_ID(p_record_counter));
4071 
4072             ELSIF l_parameter_name= 'BILL_TO_PARTY_SITE_ID'        THEN
4073                  get_user_key_id(l_element_value,'BILL_TO_PARTY_SITE_ID',g_suite_rec_tbl.BILL_TO_PARTY_SITE_ID(p_record_counter));
4074 
4075             ELSIF l_parameter_name= 'BILL_FROM_PARTY_SITE_ID'      THEN
4076                  get_user_key_id(l_element_value,'BILL_FROM_PARTY_SITE_ID',g_suite_rec_tbl.BILL_FROM_PARTY_SITE_ID(p_record_counter));
4077 
4078             ELSIF l_parameter_name= 'SHIP_TO_LOCATION_ID'          THEN
4079                  get_user_key_id(l_element_value,'SHIP_TO_LOCATION_ID',g_suite_rec_tbl.SHIP_TO_LOCATION_ID(p_record_counter));
4080 
4081             ELSIF l_parameter_name= 'SHIP_FROM_LOCATION_ID'        THEN
4082                  get_user_key_id(l_element_value,'SHIP_FROM_LOCATION_ID',g_suite_rec_tbl.SHIP_FROM_LOCATION_ID(p_record_counter));
4083 
4084             ELSIF l_parameter_name= 'POA_LOCATION_ID'              THEN
4085                  get_user_key_id(l_element_value,'POA_LOCATION_ID',g_suite_rec_tbl.POA_LOCATION_ID(p_record_counter));
4086 
4087             ELSIF l_parameter_name= 'POO_LOCATION_ID'              THEN
4088                  get_user_key_id(l_element_value,'POO_LOCATION_ID',g_suite_rec_tbl.POO_LOCATION_ID(p_record_counter));
4089 
4090             ELSIF l_parameter_name= 'BILL_TO_LOCATION_ID'          THEN
4091                  get_user_key_id(l_element_value,'BILL_TO_LOCATION_ID',g_suite_rec_tbl.BILL_TO_LOCATION_ID(p_record_counter));
4092 
4093             ELSIF l_parameter_name= 'BILL_FROM_LOCATION_ID'        THEN
4094                  get_user_key_id(l_element_value,'BILL_FROM_LOCATION_ID',g_suite_rec_tbl.BILL_FROM_LOCATION_ID(p_record_counter));
4095 
4096             ELSIF l_parameter_name= 'ACCOUNT_CCID'                 THEN
4097                     null;
4098 
4099             ELSIF l_parameter_name = 'ACCOUNT_STRING'               THEN
4100 
4101                     ----------------------------------------------------------------------
4102                     -- Account String has to populate the Account CCID and Account String
4103                     -- based and the Account String given.
4104                     ----------------------------------------------------------------------
4105 
4106                     g_suite_rec_tbl.ACCOUNT_STRING(p_record_counter)    :=l_element_value;
4107                     get_user_key_id(l_element_value,'ACCOUNT_STRING',g_suite_rec_tbl.ACCOUNT_CCID(p_record_counter));
4108 
4109             ELSIF l_parameter_name= 'MERCHANT_PARTY_COUNTRY'       THEN
4110                     g_suite_rec_tbl.MERCHANT_PARTY_COUNTRY(p_record_counter)     :=l_element_value;
4111 
4112             ELSIF l_parameter_name= 'RECEIVABLES_TRX_TYPE_ID'      THEN
4113                  --get_user_key_id(l_element_value,'RECEIVABLES_TRX_TYPE_ID',g_suite_rec_tbl.RECEIVABLES_TRX_TYPE_ID(p_record_counter));
4114                  --JUST FOR TESTING PORPUSES WILL USE FIXED VALUE
4115                  write_message('Calculating Receivables Trx type id');
4116                  IF l_element_value is not null then
4117                    write_message('Assigning Calculating Receivables Trx type id');
4118 
4119                    g_suite_rec_tbl.RECEIVABLES_TRX_TYPE_ID(p_record_counter) :=101;
4120                    write_message(to_char(g_suite_rec_tbl.RECEIVABLES_TRX_TYPE_ID(p_record_counter)));
4121                  END IF;
4122 
4123             ELSIF l_parameter_name= 'REF_DOC_APPLICATION_ID'       THEN
4124                  get_user_key_id(l_element_value,'REF_DOC_APPLICATION_ID',g_suite_rec_tbl.REF_DOC_APPLICATION_ID(p_record_counter));
4125 
4126             ELSIF l_parameter_name= 'REF_DOC_ENTITY_CODE'          THEN
4127                       g_suite_rec_tbl.REF_DOC_ENTITY_CODE(p_record_counter)        :=l_element_value;
4128 
4129             ELSIF l_parameter_name= 'REF_DOC_EVENT_CLASS_CODE'     THEN
4130                       g_suite_rec_tbl.REF_DOC_EVENT_CLASS_CODE(p_record_counter)   :=l_element_value;
4131 
4132             ELSIF l_parameter_name= 'REF_DOC_TRX_ID'               THEN
4133               check_surrogate_key(l_element_value,g_suite_rec_tbl.ref_doc_trx_id(p_record_counter),'HEADER');
4134 
4135             ELSIF l_parameter_name= 'REF_DOC_LINE_ID'              THEN
4136               check_surrogate_key(l_element_value,g_suite_rec_tbl.ref_doc_line_id(p_record_counter),'LINE');
4137 
4138             ELSIF l_parameter_name= 'REF_DOC_LINE_QUANTITY'        THEN
4139                     g_suite_rec_tbl.REF_DOC_LINE_QUANTITY(p_record_counter)  :=to_number(l_element_value);
4140 
4141             ELSIF l_parameter_name= 'RELATED_DOC_APPLICATION_ID'   THEN
4142                get_user_key_id(l_element_value,'RELATED_DOC_APPLICATION_ID',g_suite_rec_tbl.RELATED_DOC_APPLICATION_ID(p_record_counter));
4143 
4144             ELSIF l_parameter_name= 'RELATED_DOC_ENTITY_CODE'      THEN
4145                     g_suite_rec_tbl.RELATED_DOC_ENTITY_CODE(p_record_counter)    :=l_element_value;
4146 
4147             ELSIF l_parameter_name= 'RELATED_DOC_EVENT_CLASS_CODE' THEN
4148                     g_suite_rec_tbl.RELATED_DOC_EVENT_CLASS_CODE(p_record_counter):= l_element_value;
4149 
4150             ELSIF l_parameter_name= 'RELATED_DOC_TRX_ID'           THEN
4151             check_surrogate_key(l_element_value,g_suite_rec_tbl.related_doc_trx_id(p_record_counter),'HEADER');
4152 
4153             ELSIF l_parameter_name= 'RELATED_DOC_NUMBER'           THEN
4154                     g_suite_rec_tbl.RELATED_DOC_NUMBER(p_record_counter)         :=l_element_value;
4155 
4156             ELSIF l_parameter_name= 'RELATED_DOC_DATE'             THEN
4157                     g_suite_rec_tbl.RELATED_DOC_DATE(p_record_counter)           :=to_date(nvl(l_element_value,'2000/01/01'),'YYYY/MM/DD');
4158 
4159             ELSIF l_parameter_name= 'APPLIED_FROM_APPLICATION_ID'  THEN
4160                get_user_key_id(l_element_value,'APPLIED_FROM_APPLICATION_ID',g_suite_rec_tbl.APPLIED_FROM_APPLICATION_ID(p_record_counter));
4161 
4162             ELSIF l_parameter_name= 'APPLIED_FROM_ENTITY_CODE'     THEN
4163                     g_suite_rec_tbl.APPLIED_FROM_ENTITY_CODE(p_record_counter)   :=l_element_value;
4164 
4165             ELSIF l_parameter_name= 'APPLIED_FROM_EVENT_CLASS_CODE' THEN
4166                     g_suite_rec_tbl.APPLIED_FROM_EVENT_CLASS_CODE(p_record_counter):= l_element_value;
4167 
4168             ELSIF l_parameter_name= 'APPLIED_FROM_TRX_ID'          THEN
4169             check_surrogate_key(l_element_value,g_suite_rec_tbl.applied_from_trx_id(p_record_counter),'HEADER');
4170 
4171             ELSIF l_parameter_name= 'APPLIED_FROM_LINE_ID'         THEN
4172             check_surrogate_key(l_element_value,g_suite_rec_tbl.applied_from_line_id(p_record_counter),'LINE');
4173 
4174             ELSIF l_parameter_name= 'ADJUSTED_DOC_APPLICATION_ID'  THEN
4175                get_user_key_id(l_element_value,'ADJUSTED_DOC_APPLICATION_ID',g_suite_rec_tbl.ADJUSTED_DOC_APPLICATION_ID(p_record_counter));
4176 
4177             ELSIF l_parameter_name= 'ADJUSTED_DOC_ENTITY_CODE'     THEN
4178                     g_suite_rec_tbl.adjusted_doc_entity_code(p_record_counter)   :=l_element_value;
4179 
4180             ELSIF l_parameter_name= 'ADJUSTED_DOC_EVENT_CLASS_CODE' THEN
4181                     g_suite_rec_tbl.ADJUSTED_DOC_EVENT_CLASS_CODE(p_record_counter):= l_element_value;
4182 
4183             ELSIF l_parameter_name= 'ADJUSTED_DOC_TRX_ID'          THEN
4184             check_surrogate_key(l_element_value,g_suite_rec_tbl.adjusted_doc_trx_id(p_record_counter),'HEADER');
4185 
4186             ELSIF l_parameter_name= 'ADJUSTED_DOC_LINE_ID'         THEN
4187             check_surrogate_key(l_element_value,g_suite_rec_tbl.adjusted_doc_line_id(p_record_counter),'LINE');
4188 
4189             ELSIF l_parameter_name= 'ADJUSTED_DOC_NUMBER'          THEN
4190                     g_suite_rec_tbl.ADJUSTED_DOC_NUMBER(p_record_counter)        :=l_element_value;
4191 
4192             ELSIF l_parameter_name= 'ADJUSTED_DOC_DATE'            THEN
4193                     g_suite_rec_tbl.ADJUSTED_DOC_DATE(p_record_counter)          :=to_date(nvl(l_element_value,'2000/01/01'),'YYYY/MM/DD');
4194 
4195             ELSIF l_parameter_name= 'APPLIED_TO_APPLICATION_ID'    THEN
4196                get_user_key_id(l_element_value,'APPLIED_TO_APPLICATION_ID',g_suite_rec_tbl.APPLIED_TO_APPLICATION_ID(p_record_counter));
4197 
4198             ELSIF l_parameter_name= 'APPLIED_TO_ENTITY_CODE'       THEN
4199                     g_suite_rec_tbl.APPLIED_TO_ENTITY_CODE(p_record_counter)     :=l_element_value;
4200 
4201             ELSIF l_parameter_name= 'APPLIED_TO_EVENT_CLASS_CODE'  THEN
4202                     g_suite_rec_tbl.APPLIED_TO_EVENT_CLASS_CODE(p_record_counter):=l_element_value;
4203 
4204             ELSIF l_parameter_name= 'APPLIED_TO_TRX_ID'            THEN
4205             check_surrogate_key(l_element_value,g_suite_rec_tbl.applied_to_trx_id(p_record_counter),'HEADER');
4206 
4207             ELSIF l_parameter_name= 'APPLIED_TO_TRX_LINE_ID'       THEN
4208             check_surrogate_key(l_element_value,g_suite_rec_tbl.applied_to_trx_line_id(p_record_counter),'LINE');
4209 
4210             ELSIF l_parameter_name= 'TRX_LINE_NUMBER'              THEN
4211                     g_suite_rec_tbl.TRX_LINE_NUMBER(p_record_counter)            :=to_number(l_element_value);
4212 
4213             ELSIF l_parameter_name= 'TRX_NUMBER'                   THEN
4214                     g_suite_rec_tbl.TRX_NUMBER(p_record_counter)     :=l_element_value;
4215 
4216             ELSIF l_parameter_name= 'TRX_DESCRIPTION'              THEN
4217                     g_suite_rec_tbl.TRX_DESCRIPTION(p_record_counter)     :=l_element_value;
4218 
4219             ELSIF l_parameter_name= 'TRX_LINE_DESCRIPTION'         THEN
4220                     g_suite_rec_tbl.TRX_LINE_DESCRIPTION(p_record_counter)      :=l_element_value;
4221 
4222             ELSIF l_parameter_name= 'PRODUCT_DESCRIPTION'          THEN
4223                     g_suite_rec_tbl.PRODUCT_DESCRIPTION(p_record_counter)     :=l_element_value;
4224 
4225             ELSIF l_parameter_name= 'TRX_WAYBILL_NUMBER'           THEN
4226                     g_suite_rec_tbl.TRX_WAYBILL_NUMBER(p_record_counter)         :=l_element_value;
4227 
4228             ELSIF l_parameter_name= 'TRX_COMMUNICATED_DATE'        THEN
4229                     g_suite_rec_tbl.TRX_COMMUNICATED_DATE(p_record_counter)      :=to_date(nvl(l_element_value,'2000/01/01'),'YYYY/MM/DD');
4230 
4231             ELSIF l_parameter_name= 'TRX_LINE_GL_DATE'             THEN
4232                     g_suite_rec_tbl.TRX_LINE_GL_DATE(p_record_counter)           :=to_date(nvl(l_element_value,'2000/01/01'),'YYYY/MM/DD');
4233 
4234             ELSIF l_parameter_name= 'BATCH_SOURCE_ID'              THEN
4235                     null;
4236 
4237             ELSIF l_parameter_name= 'BATCH_SOURCE_NAME'            THEN
4238                     ----------------------------------------------------------------------
4239                     -- Batch Source Name has to populate the Batch Source Id and Name
4240                     -- based and the Batch Source Name given.
4241                     ----------------------------------------------------------------------
4242                     g_suite_rec_tbl.BATCH_SOURCE_NAME(p_record_counter)          :=l_element_value;
4243                     get_user_key_id(l_element_value,'BATCH_SOURCE_NAME',g_suite_rec_tbl.BATCH_SOURCE_ID(p_record_counter));
4244 
4245             ELSIF l_parameter_name= 'DOC_SEQ_ID'                   THEN
4246                get_user_key_id(l_element_value,'DOC_SEQ_ID',g_suite_rec_tbl.DOC_SEQ_ID(p_record_counter));
4247 
4248             ELSIF l_parameter_name= 'DOC_SEQ_NAME'                 THEN
4249                     g_suite_rec_tbl.DOC_SEQ_NAME(p_record_counter)               :=l_element_value;
4250 
4251             ELSIF l_parameter_name= 'DOC_SEQ_VALUE'                THEN
4252                     g_suite_rec_tbl.DOC_SEQ_VALUE(p_record_counter)              :=l_element_value;
4253 
4254             ELSIF l_parameter_name= 'TRX_DUE_DATE'                 THEN
4255                     g_suite_rec_tbl.TRX_DUE_DATE(p_record_counter)  :=to_date(nvl(l_element_value,'2000/01/01'),'YYYY/MM/DD');
4256 
4257             ELSIF l_parameter_name= 'TRX_TYPE_DESCRIPTION'         THEN
4258                     g_suite_rec_tbl.TRX_TYPE_DESCRIPTION(p_record_counter)       :=l_element_value;
4259 
4260             ELSIF l_parameter_name= 'MERCHANT_PARTY_NAME'          THEN
4261                     g_suite_rec_tbl.MERCHANT_PARTY_NAME(p_record_counter)        :=l_element_value;
4262 
4263             ELSIF l_parameter_name= 'MERCHANT_PARTY_DOCUMENT_NUMBER' THEN
4264                     g_suite_rec_tbl.MERCHANT_PARTY_DOCUMENT_NUMBER(p_record_counter):= l_element_value;
4265 
4266             ELSIF l_parameter_name= 'MERCHANT_PARTY_REFERENCE'     THEN
4267                     g_suite_rec_tbl.MERCHANT_PARTY_REFERENCE(p_record_counter)   :=l_element_value;
4268 
4269             ELSIF l_parameter_name= 'MERCHANT_PARTY_TAXPAYER_ID'   THEN
4270                     g_suite_rec_tbl.MERCHANT_PARTY_TAXPAYER_ID(p_record_counter) :=l_element_value;
4271 
4272             ELSIF l_parameter_name= 'MERCHANT_PARTY_TAX_REG_NUMBER' THEN
4273                     g_suite_rec_tbl.MERCHANT_PARTY_TAX_REG_NUMBER(p_record_counter):= l_element_value;
4274 
4275             ELSIF l_parameter_name= 'DOCUMENT_SUB_TYPE'            THEN
4276                     g_suite_rec_tbl.DOCUMENT_SUB_TYPE(p_record_counter)          :=l_element_value;
4277 
4278             ELSIF l_parameter_name= 'SUPPLIER_TAX_INVOICE_NUMBER'  THEN
4279                     g_suite_rec_tbl.SUPPLIER_TAX_INVOICE_NUMBER(p_record_counter):=l_element_value;
4280 
4281             ELSIF l_parameter_name= 'SUPPLIER_TAX_INVOICE_DATE'    THEN
4282                     g_suite_rec_tbl.SUPPLIER_TAX_INVOICE_DATE(p_record_counter)  :=to_date(nvl(l_element_value,'2000/01/01'),'YYYY/MM/DD');
4283 
4284             ELSIF l_parameter_name= 'SUPPLIER_EXCHANGE_RATE'       THEN
4285                     g_suite_rec_tbl.SUPPLIER_EXCHANGE_RATE(p_record_counter)     :=to_number(l_element_value);
4286 
4287             ELSIF l_parameter_name= 'TAX_INVOICE_DATE'             THEN
4288                     g_suite_rec_tbl.TAX_INVOICE_DATE(p_record_counter)   :=to_date(nvl(l_element_value,'2000/01/01'),'YYYY/MM/DD');
4289 
4290             ELSIF l_parameter_name= 'TAX_INVOICE_NUMBER'           THEN
4291                     g_suite_rec_tbl.TAX_INVOICE_NUMBER(p_record_counter)     :=l_element_value;
4292 
4293             ELSIF l_parameter_name= 'SUMMARY_TAX_LINE_NUMBER'      THEN
4294                     g_suite_rec_tbl.SUMMARY_TAX_LINE_NUMBER(p_record_counter) :=to_number(l_element_value);
4295 
4296             ELSIF l_parameter_name= 'TAX_REGIME_CODE'              THEN
4297                     g_suite_rec_tbl.TAX_REGIME_CODE(p_record_counter)            :=l_element_value;
4298 
4299             ELSIF l_parameter_name= 'TAX'                          THEN
4300                     g_suite_rec_tbl.TAX(p_record_counter)                        :=l_element_value;
4301 
4302             ELSIF l_parameter_name= 'TAX_STATUS_CODE'              THEN
4303                     g_suite_rec_tbl.TAX_STATUS_CODE(p_record_counter)            :=l_element_value;
4304 
4305             ELSIF l_parameter_name= 'TAX_RATE_CODE'                THEN
4306                     g_suite_rec_tbl.TAX_RATE_CODE(p_record_counter)              :=l_element_value;
4307 
4308             ELSIF l_parameter_name= 'TAX_RATE'                     THEN
4309                     g_suite_rec_tbl.TAX_RATE(p_record_counter)                   :=to_number(l_element_value);
4310 
4311             ELSIF l_parameter_name= 'TAX_AMT'                      THEN
4312                     g_suite_rec_tbl.TAX_AMT(p_record_counter)                    :=to_number(l_element_value);
4313 
4314             ELSIF l_parameter_name= 'TAX_LINE_NUMBER'              THEN
4315                     g_suite_rec_tbl.TAX_LINE_NUMBER(p_record_counter)            :=to_number(l_element_value);
4316 
4317             ELSIF l_parameter_name= 'REVERSING_APPLN_ID'            THEN
4318                     g_suite_rec_tbl.REVERSING_APPLN_ID(p_record_counter)          :=to_number(l_element_value);
4319 
4320             ELSIF l_parameter_name= 'REVERSING_ENTITY_CODE'        THEN
4321                     g_suite_rec_tbl.REVERSING_ENTITY_CODE(p_record_counter)      :=l_element_value;
4322 
4323             ELSIF l_parameter_name= 'REVERSING_EVNT_CLS_CODE'      THEN
4324                     g_suite_rec_tbl.REVERSING_EVNT_CLS_CODE(p_record_counter)    :=l_element_value;
4325 
4326             ELSIF l_parameter_name= 'REVERSING_TRX_ID'             THEN
4327               ----------------------------------------------------------------------------
4328               --Create the surrogate Key if has to be created or has not been created yet.
4329               ----------------------------------------------------------------------------
4330               IF (g_suite_rec_tbl.tax_event_type_code(p_record_counter) = 'CREATE' and NOT(g_surr_trx_id_tbl.exists(l_element_value))) THEN
4331                 surrogate_key ( l_element_value,g_suite_rec_tbl.reversing_trx_id(p_record_counter),'HEADER');
4332                 g_surr_trx_id_tbl(l_element_value) := g_suite_rec_tbl.reversing_trx_id(p_record_counter);
4333               ELSE
4334                 check_surrogate_key(l_element_value,g_suite_rec_tbl.reversing_trx_id(p_record_counter),'HEADER');
4335               END IF;
4336 
4337             ELSIF l_parameter_name= 'REVERSING_TRX_LEVEL_TYPE'     THEN
4338                       g_suite_rec_tbl.REVERSING_TRX_LEVEL_TYPE(p_record_counter)   :=to_number(l_element_value);
4339 
4340             ELSIF l_parameter_name= 'REVERSING_TRX_LINE_ID'        THEN
4341               ----------------------------------------------------------------------------
4342               --Create the surrogate Key if has to be created or has not been created yet.
4343               ----------------------------------------------------------------------------
4344               IF g_suite_rec_tbl.tax_event_type_code(p_record_counter) = 'CREATE' THEN
4345                 surrogate_key ( l_element_value,g_suite_rec_tbl.reversing_trx_line_id(p_record_counter),'LINE');
4346                 g_surr_trx_id_tbl(l_element_value) := g_suite_rec_tbl.reversing_trx_line_id(p_record_counter);
4347               ELSE
4348                 check_surrogate_key(l_element_value,g_suite_rec_tbl.reversing_trx_line_id(p_record_counter),'LINE');
4349               END IF;
4350 
4351             ELSIF l_parameter_name= 'REVERSED_APPLN_ID'            THEN
4352                     g_suite_rec_tbl.REVERSED_APPLN_ID(p_record_counter)          :=to_number(l_element_value);
4353 
4354             ELSIF l_parameter_name= 'REVERSED_ENTITY_CODE'         THEN
4355                     g_suite_rec_tbl.REVERSED_ENTITY_CODE(p_record_counter)       :=l_element_value;
4356 
4357             ELSIF l_parameter_name= 'REVERSED_EVNT_CLS_CODE'       THEN
4358                     g_suite_rec_tbl.REVERSED_EVNT_CLS_CODE(p_record_counter)     :=l_element_value;
4359 
4360             ELSIF l_parameter_name= 'REVERSED_TRX_ID'              THEN
4361               check_surrogate_key(l_element_value,g_suite_rec_tbl.reversed_trx_id(p_record_counter),'HEADER');
4362 
4363             ELSIF l_parameter_name= 'REVERSED_TRX_LEVEL_TYPE'      THEN
4364                     g_suite_rec_tbl.REVERSED_TRX_LEVEL_TYPE(p_record_counter)    :=to_number(l_element_value);
4365 
4366             ELSIF l_parameter_name= 'REVERSED_TRX_LINE_ID'         THEN
4367               check_surrogate_key(l_element_value,g_suite_rec_tbl.reversed_trx_line_id(p_record_counter),'LINE');
4368 
4369             ELSIF l_parameter_name= 'TRX_LINE_DIST_ID'             THEN
4370               ----------------------------------------------------------------------------
4371               --Create the surrogate Key if has to be created or has not been created yet.
4372               ----------------------------------------------------------------------------
4373               IF g_suite_rec_tbl.tax_event_type_code(p_record_counter) = 'CREATE' THEN
4374                 surrogate_key ( l_element_value,g_suite_rec_tbl.trx_line_dist_id(p_record_counter),'DIST');
4375                 g_surr_trx_id_tbl(l_element_value) := g_suite_rec_tbl.trx_line_dist_id(p_record_counter);
4376               ELSE
4377                 check_surrogate_key(l_element_value,g_suite_rec_tbl.trx_line_dist_id(p_record_counter),'DIST');
4378               END IF;
4379 
4380             ELSIF l_parameter_name= 'DIST_LEVEL_ACTION'            THEN
4381                       g_suite_rec_tbl.DIST_LEVEL_ACTION(p_record_counter)          :=l_element_value;
4382 
4383             ELSIF l_parameter_name= 'TRX_LINE_DIST_DATE'           THEN
4384                       g_suite_rec_tbl.TRX_LINE_DIST_DATE(p_record_counter)         :=to_date(nvl(l_element_value,'2000/01/01'),'YYYY/MM/DD');
4385 
4386             ELSIF l_parameter_name= 'ITEM_DIST_NUMBER'             THEN
4387                       g_suite_rec_tbl.ITEM_DIST_NUMBER(p_record_counter)           :=to_number(l_element_value);
4388 
4389             ELSIF l_parameter_name= 'DIST_INTENDED_USE'            THEN
4390                       g_suite_rec_tbl.DIST_INTENDED_USE(p_record_counter)          :=l_element_value;
4391 
4392             ELSIF l_parameter_name= 'TASK_ID'                      THEN
4393                       g_suite_rec_tbl.TASK_ID(p_record_counter)                    :=to_number(l_element_value);
4394 
4395             ELSIF l_parameter_name= 'AWARD_ID'                     THEN
4396                       g_suite_rec_tbl.AWARD_ID(p_record_counter)                   :=to_number(l_element_value);
4397 
4398             ELSIF l_parameter_name= 'PROJECT_ID'                   THEN
4399                       g_suite_rec_tbl.PROJECT_ID(p_record_counter)                 :=to_number(l_element_value);
4400 
4401             ELSIF l_parameter_name= 'EXPENDITURE_TYPE'             THEN
4402                       g_suite_rec_tbl.EXPENDITURE_TYPE(p_record_counter)           :=l_element_value;
4403 
4404             ELSIF l_parameter_name= 'EXPENDITURE_ORGANIZATION_ID'  THEN
4405                       g_suite_rec_tbl.EXPENDITURE_ORGANIZATION_ID(p_record_counter):=to_number(l_element_value);
4406 
4407             ELSIF l_parameter_name= 'EXPENDITURE_ITEM_DATE'        THEN
4408                       g_suite_rec_tbl.EXPENDITURE_ITEM_DATE(p_record_counter)      :=to_date(nvl(l_element_value,'2000/01/01'),'YYYY/MM/DD');
4409 
4410             ELSIF l_parameter_name= 'TRX_LINE_DIST_AMT'            THEN
4411                       g_suite_rec_tbl.TRX_LINE_DIST_AMT(p_record_counter)          :=to_number(l_element_value);
4412 
4413             ELSIF l_parameter_name= 'TRX_LINE_DIST_QUANTITY'       THEN
4414                       g_suite_rec_tbl.TRX_LINE_DIST_QUANTITY(p_record_counter)     :=to_number(l_element_value);
4415 
4416             ELSIF l_parameter_name= 'REF_DOC_DIST_ID'              THEN
4417                       g_suite_rec_tbl.REF_DOC_DIST_ID(p_record_counter)            :=to_number(l_element_value);
4418 
4419             ELSIF l_parameter_name= 'REF_DOC_CURR_CONV_RATE'       THEN
4420                       g_suite_rec_tbl.REF_DOC_CURR_CONV_RATE(p_record_counter)     :=to_number(l_element_value);
4421 
4422             ELSIF l_parameter_name= 'TAX_DIST_ID'                  THEN
4423                       g_suite_rec_tbl.TAX_DIST_ID(p_record_counter)                :=to_number(l_element_value);
4424 
4425             ELSIF l_parameter_name= 'LINE_AMT_INCLUDES_TAX_FLAG'    THEN
4426                       g_suite_rec_tbl.LINE_AMT_INCLUDES_TAX_FLAG(p_record_counter) :=l_element_value;
4427 
4428             ELSIF l_parameter_name= 'PORT_OF_ENTRY_CODE'    THEN
4429                       g_suite_rec_tbl.PORT_OF_ENTRY_CODE(p_record_counter)         :=l_element_value;
4430 
4431             ELSIF l_parameter_name= 'OWN_HQ_PARTY_ID'   THEN
4432                  get_user_key_id(l_element_value,'OWN_HQ_PARTY_ID',g_suite_rec_tbl.OWN_HQ_PARTY_ID(p_record_counter));
4433 
4434             ELSIF l_parameter_name= 'DEFAULT_TAXATION_COUNTRY' THEN
4435                       g_suite_rec_tbl.DEFAULT_TAXATION_COUNTRY(p_record_counter)   :=l_element_value;
4436 
4437             ELSIF l_parameter_name= 'SHIP_THIRD_PTY_ACCT_ID' THEN
4438                       g_suite_rec_tbl.SHIP_THIRD_PTY_ACCT_ID(p_record_counter)     :=l_element_value;
4439 
4440             ELSIF l_parameter_name= 'BILL_THIRD_PTY_ACCT_ID' THEN
4441                       g_suite_rec_tbl.BILL_THIRD_PTY_ACCT_ID(p_record_counter)     :=l_element_value;
4442 
4443             ELSIF l_parameter_name= 'SHIP_THIRD_PTY_ACCT_SITE_ID' THEN
4444                       g_suite_rec_tbl.SHIP_THIRD_PTY_ACCT_SITE_ID(p_record_counter) :=l_element_value;
4445 
4446             ELSIF l_parameter_name= 'BILL_THIRD_PTY_ACCT_SITE_ID' THEN
4447                       g_suite_rec_tbl.BILL_THIRD_PTY_ACCT_SITE_ID(p_record_counter) :=l_element_value;
4448 
4449 
4450             ELSIF l_parameter_name= 'BILL_TO_CUST_ACCT_SITE_USE_ID' THEN
4451                       g_suite_rec_tbl.BILL_TO_CUST_ACCT_SITE_USE_ID(p_record_counter) :=l_element_value;
4452 
4453             ELSIF l_parameter_name= 'SHIP_TO_CUST_ACCT_SITE_USE_ID' THEN
4454                       g_suite_rec_tbl.SHIP_TO_CUST_ACCT_SITE_USE_ID(p_record_counter) :=l_element_value;
4455 
4456 
4457             ---------------------------------------------------------------------------------
4458             -- Bug 4477978. Added Source Columns.
4459             ---------------------------------------------------------------------------------
4460             ELSIF l_parameter_name= 'SOURCE_APPLICATION_ID' THEN
4461                       get_user_key_id(l_element_value,'SOURCE_APPLICATION_ID',
4462                                        g_suite_rec_tbl.SOURCE_APPLICATION_ID(p_record_counter));
4463 
4464             ELSIF l_parameter_name= 'SOURCE_ENTITY_CODE' THEN
4465                       g_suite_rec_tbl.SOURCE_ENTITY_CODE(p_record_counter) := l_element_value;
4466 
4467             ELSIF l_parameter_name= 'SOURCE_EVENT_CLASS_CODE' THEN
4468                       g_suite_rec_tbl.SOURCE_EVENT_CLASS_CODE(p_record_counter) := l_element_value;
4469 
4470             ELSIF l_parameter_name= 'SOURCE_TRX_ID' THEN
4471                       check_surrogate_key(l_element_value,g_suite_rec_tbl.SOURCE_TRX_ID(p_record_counter),'HEADER');
4472 
4473             ELSIF l_parameter_name= 'SOURCE_LINE_ID' THEN
4474                       check_surrogate_key(l_element_value,g_suite_rec_tbl.SOURCE_LINE_ID(p_record_counter),'LINE');
4475 
4476             ELSIF l_parameter_name= 'SOURCE_TRX_LEVEL_TYPE' THEN
4477                       g_suite_rec_tbl.SOURCE_TRX_LEVEL_TYPE(p_record_counter) := l_element_value;
4478 
4479             ELSIF l_parameter_name= 'SOURCE_TAX_LINE_ID' THEN
4480                       check_surrogate_key(l_element_value,g_suite_rec_tbl.SOURCE_TAX_LINE_ID(p_record_counter),'LINE');
4481 
4482 
4483 
4484             ELSIF l_parameter_name= 'COMMON_TRANSACTION_DATA'   THEN
4485                  --------------------------------------------------------------------
4486                  --Predefined Values Column is used only for generation of text file.
4487                  --------------------------------------------------------------------
4488                  null;
4489             ELSIF l_parameter_name IN ('COMMENTS01','COMMENTS02','COMMENTS03','COMMENTS04','COMMENTS05',
4490                                        'COMMENTS06','COMMENTS07','COMMENTS08','COMMENTS09','COMMENTS10')   THEN
4491                  null;
4492 
4493             ELSE
4494               write_message('~      *** The Parameter above is NOT DEFINED in ZX_TEST_API:'||l_parameter_name||' ***');
4495             END IF;
4496           END IF;
4497         IF l_return_status_p = 'LINE COMPLETED' THEN
4498           EXIT;
4499         END IF;
4500       END IF;
4501      END IF;
4502     END LOOP;
4503 
4504   END put_line_in_suite_rec_tbl;
4505 
4506 
4507 
4508 /* ====================================================================================*
4509  | PROCEDURE call_api : Logic to Call the APIs                                         |
4510  * ====================================================================================*/
4511 
4512   PROCEDURE call_api (p_api_service    IN VARCHAR,
4513                       p_suite_number   IN VARCHAR,
4514                       p_case_number    IN VARCHAR,
4515                       p_transaction_id IN NUMBER) IS
4516 
4517   l_row_id                 VARCHAR2(4000);
4518   l_error_flag             VARCHAR2(1);
4519   l_mesg                   VARCHAR2(2000);
4520   l_return_status          VARCHAR2(2000);
4521   l_override_level         VARCHAR2(2000);
4522   l_hold_codes_tbl         zx_api_pub.hold_codes_tbl_type;
4523   l_validation_status      VARCHAR2(4000);
4524   l_start_row              NUMBER;
4525   l_end_row                NUMBER;
4526   l_flag                   VARCHAR2(1);
4527   l_tax_hold_code          VARCHAR2(100);
4528   l_initial_row            NUMBER;
4529   l_ending_row             NUMBER;
4530   l_first                  BOOLEAN;
4531   l_sync_trx_rec           zx_api_pub.sync_trx_rec_type;
4532   l_sync_trx_lines_tbl     zx_api_pub.sync_trx_lines_tbl_type%type;
4533   l_zx_errors_gt           VARCHAR2(4000);
4534 
4535 
4536   -------------------------------------
4537   --7 Standard Parameters for all APIs
4538   -------------------------------------
4539   l_api_version              NUMBER;
4540   l_init_msg_list            VARCHAR2(2000);
4541   l_commit                   VARCHAR2(2000);
4542   l_validation_level         NUMBER;
4543   l_msg_count                NUMBER;
4544   l_msg_data                 VARCHAR2(2000);
4545   l_dummy                    NUMBER;
4546   l_object_version_number    NUMBER;
4547 
4548   BEGIN
4549     l_row_id := NULL;
4550     l_api_version  :=g_api_version;
4551 
4552     -------------------------------------------------------------
4553     -- Call the APIs for the case has been just finished reading.
4554     -------------------------------------------------------------
4555     write_message('In the Procedure CALL_API for:'||p_api_service);
4556     -----------------------------------------------------------
4557     -- Proceeds to Call the APIs Calculate Tax
4558     -----------------------------------------------------------
4559     IF p_api_service = 'CALCULATE_TAX' THEN
4560       select count(*) into l_dummy from zx_trx_headers_gt;
4561       write_message('zx_transaction_headers_gt contains rows:'||to_char(l_dummy));
4562 
4563       zx_api_pub.calculate_tax (
4564                      l_api_version      ,
4565                      l_init_msg_list    ,
4566                      l_commit           ,
4567                      l_validation_level ,
4568                      l_return_status    ,
4569                      l_msg_count        ,
4570                      l_msg_data
4571                      );
4572       write_message('----------------------------------------------------');
4573       write_message('Service ZX_API_PUB.CALCULATE_TAX has been called! For ');
4574       write_message('Suite: '||p_suite_number||' and Case: '||p_case_number);
4575       write_message('x_return_status : '||l_return_status);
4576       write_message('x_msg_count     : '||to_char(l_msg_count)    );
4577 
4578     -----------------------------------------------------------
4579     -- Proceeds to Call the API Override Detail Manual Tax Line
4580     -----------------------------------------------------------
4581     ELSIF p_api_service = 'OVERRIDE_DETAIL_ENTER_MANUAL_TAX_LINE' THEN
4582       get_start_end_rows_structure
4583        (
4584          p_suite      => p_suite_number,
4585          p_case       => p_case_number,
4586          p_structure  => 'STRUCTURE_OVERRIDE_DETAIL_TAX_LINES',
4587          x_start_row  => l_start_row,
4588          x_end_row    => l_end_row
4589        );
4590 
4591       FOR i IN l_start_row..l_end_row LOOP
4592       zx_trl_detail_override_pkg.Insert_row (
4593         X_ROWID                        => l_row_id                                   ,
4594         P_TAX_LINE_ID                  => null                                       ,
4595         P_INTERNAL_ORGANIZATION_ID     => g_suite_rec_tbl.internal_organization_id(i),
4596         P_APPLICATION_ID               => g_suite_rec_tbl.application_id(i)          ,
4597         P_ENTITY_CODE                  => g_suite_rec_tbl.entity_code(i)             ,
4598         P_EVENT_CLASS_CODE             => g_suite_rec_tbl.event_class_code(i)        ,
4599         P_EVENT_TYPE_CODE              => g_suite_rec_tbl.event_type_code(i)         ,
4600         P_TRX_ID                       => g_suite_rec_tbl.trx_id(i)                  ,
4601         P_TRX_LINE_ID                  => g_suite_rec_tbl.tax_line_id(i)             ,
4602         P_TRX_LEVEL_TYPE               => g_suite_rec_tbl.trx_level_type(i)          ,
4603         P_TRX_LINE_NUMBER              => g_suite_rec_tbl.trx_line_number(i)         ,
4604         P_DOC_EVENT_STATUS             => null                                       ,
4605         P_TAX_EVENT_CLASS_CODE         => null                                       ,
4606         P_TAX_EVENT_TYPE_CODE          => null                                       ,
4607         P_TAX_LINE_NUMBER              => g_suite_rec_tbl.tax_line_number(i)         ,
4608         P_CONTENT_OWNER_ID             => null                                       ,
4609         P_TAX_REGIME_ID                => null                                       ,
4610         P_TAX_REGIME_CODE              => g_suite_rec_tbl.tax_regime_code(i)         ,
4611         P_TAX_ID                       => null                                       ,
4612         P_TAX                          => g_suite_rec_tbl.tax(i)                     ,
4613         P_TAX_STATUS_ID                => null                                       ,
4614         P_TAX_STATUS_CODE              => g_suite_rec_tbl.tax_status_code(i)         ,
4615         P_TAX_RATE_ID                  => g_suite_rec_tbl.tax_rate_id(i)             ,
4616         P_TAX_RATE_CODE                => g_suite_rec_tbl.tax_rate_code(i)           ,
4617         P_TAX_RATE                     => g_suite_rec_tbl.tax_rate(i)                ,
4618         P_TAX_RATE_TYPE                => null                                       ,
4619         P_TAX_APPORTIONMENT_LINE_NUM   => null                                       ,
4620         P_TRX_ID_LEVEL2                => null                                       ,
4621         P_TRX_ID_LEVEL3                => null                                       ,
4622         P_TRX_ID_LEVEL4                => null                                       ,
4623         P_TRX_ID_LEVEL5                => null                                       ,
4624         P_TRX_ID_LEVEL6                => null                                       ,
4625         P_TRX_USER_KEY_LEVEL1          => null                                       ,
4626         P_TRX_USER_KEY_LEVEL2          => null                                       ,
4627         P_TRX_USER_KEY_LEVEL3          => null                                       ,
4628         P_TRX_USER_KEY_LEVEL4          => null                                       ,
4629         P_TRX_USER_KEY_LEVEL5          => null                                       ,
4630         P_TRX_USER_KEY_LEVEL6          => null                                       ,
4631 /*      P_HDR_TRX_USER_KEY1            => null                                       ,
4632         P_HDR_TRX_USER_KEY2            => null                                       ,
4633         P_HDR_TRX_USER_KEY3            => null                                       ,
4634         P_HDR_TRX_USER_KEY4            => null                                       ,
4635         P_HDR_TRX_USER_KEY5            => null                                       ,
4636         P_HDR_TRX_USER_KEY6            => null                                       ,
4637         P_LINE_TRX_USER_KEY1           => null                                       ,
4638         P_LINE_TRX_USER_KEY2           => null                                       ,
4639         P_LINE_TRX_USER_KEY3           => null                                       ,
4640         P_LINE_TRX_USER_KEY4           => null                                       ,
4641         P_LINE_TRX_USER_KEY5           => null                                       ,
4642         P_LINE_TRX_USER_KEY6           => null                                       ,*/
4643         P_MRC_TAX_LINE_FLAG            => null                                       ,
4644         P_MRC_LINK_TO_TAX_LINE_ID      => null                                       ,
4645         P_LEDGER_ID                    => null                                       ,
4646         P_ESTABLISHMENT_ID             => null                                       ,
4647         P_LEGAL_ENTITY_ID              => null                                       ,
4648         -- P_LEGAL_ENTITY_TAX_REG_NUMBER  => null                                       ,
4649         P_HQ_ESTB_REG_NUMBER           => null                                       ,
4650         P_HQ_ESTB_PARTY_TAX_PROF_ID    => null                                       ,
4651         P_CURRENCY_CONVERSION_DATE     => null                                       ,
4652         P_CURRENCY_CONVERSION_TYPE     => null                                       ,
4653         P_CURRENCY_CONVERSION_RATE     => null                                       ,
4654         P_TAX_CURR_CONVERSION_DATE     => null                                       ,
4655         P_TAX_CURR_CONVERSION_TYPE     => null                                       ,
4656         P_TAX_CURR_CONVERSION_RATE     => null                                       ,
4657         P_TRX_CURRENCY_CODE            => null                                       ,
4658         P_REPORTING_CURRENCY_CODE      => null                                       ,
4659         P_MINIMUM_ACCOUNTABLE_UNIT     => null                                       ,
4660         P_PRECISION                    => null                                       ,
4661         P_TRX_NUMBER                   => g_suite_rec_tbl.trx_number(i)              ,
4662         P_TRX_DATE                     => null                                       ,
4663         P_UNIT_PRICE                   => null                                       ,
4664         P_LINE_AMT                     => null                                       ,
4665         P_TRX_LINE_QUANTITY            => null                                       ,
4666         P_TAX_BASE_MODIFIER_RATE       => null                                       ,
4667         P_REF_DOC_APPLICATION_ID       => null                                       ,
4668         P_REF_DOC_ENTITY_CODE          => null                                       ,
4669         P_REF_DOC_EVENT_CLASS_CODE     => null                                       ,
4670         P_REF_DOC_TRX_ID               => null                                       ,
4671         P_REF_DOC_TRX_LEVEL_TYPE       => null                                       ,
4672         P_REF_DOC_LINE_ID              => null                                       ,
4673         P_REF_DOC_LINE_QUANTITY        => null                                       ,
4674         P_OTHER_DOC_LINE_AMT           => null                                       ,
4675         P_OTHER_DOC_LINE_TAX_AMT       => null                                       ,
4676         P_OTHER_DOC_LINE_TAXABLE_AMT   => null                                       ,
4677         P_UNROUNDED_TAXABLE_AMT        => null                                       ,
4678         P_UNROUNDED_TAX_AMT            => null                                       ,
4679         P_RELATED_DOC_APPLICATION_ID   => null                                       ,
4680         P_RELATED_DOC_ENTITY_CODE      => null                                       ,
4681         P_RELATED_DOC_EVT_CLASS_CODE   => null                                       ,
4682         P_RELATED_DOC_TRX_ID           => null                                       ,
4683         P_RELATED_DOC_TRX_LEVEL_TYPE   => null                                       ,
4684         P_RELATED_DOC_NUMBER           => null                                       ,
4685         P_RELATED_DOC_DATE             => null                                       ,
4686         P_APPLIED_FROM_APPL_ID         => null                                       ,
4687         P_APPLIED_FROM_EVT_CLSS_CODE   => null                                       ,
4688         P_APPLIED_FROM_ENTITY_CODE     => null                                       ,
4689         P_APPLIED_FROM_TRX_ID          => null                                       ,
4690         P_APPLIED_FROM_TRX_LEVEL_TYPE  => null                                       ,
4691         P_APPLIED_FROM_LINE_ID         => null                                       ,
4692         P_APPLIED_FROM_TRX_NUMBER      => null                                       ,
4693         P_ADJUSTED_DOC_APPLN_ID        => null                                       ,
4694         P_ADJUSTED_DOC_ENTITY_CODE     => g_suite_rec_tbl.adjusted_doc_entity_code(i),
4695         P_ADJUSTED_DOC_EVT_CLSS_CODE   => null                                       ,
4696         P_ADJUSTED_DOC_TRX_ID          => null                                       ,
4697         P_ADJUSTED_DOC_TRX_LEVEL_TYPE  => null                                       ,
4698         P_ADJUSTED_DOC_LINE_ID         => null                                       ,
4699         P_ADJUSTED_DOC_NUMBER          => null                                       ,
4700         P_ADJUSTED_DOC_DATE            => null                                       ,
4701         P_APPLIED_TO_APPLICATION_ID    => null                                       ,
4702         P_APPLIED_TO_EVT_CLASS_CODE    => null                                       ,
4703         P_APPLIED_TO_ENTITY_CODE       => null                                       ,
4704         P_APPLIED_TO_TRX_ID            => null                                       ,
4705         P_APPLIED_TO_TRX_LEVEL_TYPE    => null                                       ,
4706         P_APPLIED_TO_LINE_ID           => null                                       ,
4707         P_SUMMARY_TAX_LINE_ID          => g_suite_rec_tbl.summary_tax_line_id(i)     ,
4708         P_OFFSET_LINK_TO_TAX_LINE_ID   => null                                       ,
4709         P_OFFSET_FLAG                  => null                                       ,
4710         P_PROCESS_FOR_RECOVERY_FLAG    => null                                       ,
4711         P_TAX_JURISDICTION_ID          => g_suite_rec_tbl.tax_jurisdiction_id(i)     ,
4712         P_TAX_JURISDICTION_CODE        => null                                       ,
4713         P_PLACE_OF_SUPPLY              => null                                       ,
4714         P_PLACE_OF_SUPPLY_TYPE_CODE    => null                                       ,
4715         P_PLACE_OF_SUPPLY_RESULT_ID    => null                                       ,
4716         P_TAX_DATE_RULE_ID             => null                                       ,
4717         P_TAX_DATE                     => null                                       ,
4718         P_TAX_DETERMINE_DATE           => null                                       ,
4719         P_TAX_POINT_DATE               => null                                       ,
4720         P_TRX_LINE_DATE                => null                                       ,
4721         P_TAX_TYPE_CODE                => null                                       ,
4722         P_TAX_CODE                     => null                                       ,
4723         P_TAX_REGISTRATION_ID          => null                                       ,
4724         P_TAX_REGISTRATION_NUMBER      => g_suite_rec_tbl.tax_registration_number(i) ,
4725         P_REGISTRATION_PARTY_TYPE      => null                                       ,
4726         P_ROUNDING_LEVEL_CODE          => null                                       ,
4727         P_ROUNDING_RULE_CODE           => null                                       ,
4728         P_RNDG_LVL_PARTY_TAX_PROF_ID   => null                                       ,
4729         P_ROUNDING_LVL_PARTY_TYPE      => null                                       ,
4730         P_COMPOUNDING_TAX_FLAG         => null                                       ,
4731         P_ORIG_TAX_STATUS_ID           => null                                       ,
4732         P_ORIG_TAX_STATUS_CODE         => null                                       ,
4733         P_ORIG_TAX_RATE_ID             => null                                       ,
4734         P_ORIG_TAX_RATE_CODE           => null                                       ,
4735         P_ORIG_TAX_RATE                => null                                       ,
4736         P_ORIG_TAX_JURISDICTION_ID     => null                                       ,
4737         P_ORIG_TAX_JURISDICTION_CODE   => null                                       ,
4738         P_ORIG_TAX_AMT_INCLUDED_FLAG   => null                                       ,
4739         P_ORIG_SELF_ASSESSED_FLAG      => null                                       ,
4740         P_TAX_CURRENCY_CODE            => null                                       ,
4741         P_TAX_AMT                      => g_suite_rec_tbl.tax_amt(i)                 ,
4742         P_TAX_AMT_TAX_CURR             => null                                       ,
4743         P_TAX_AMT_FUNCL_CURR           => null                                       ,
4744         P_TAXABLE_AMT                  => g_suite_rec_tbl.taxable_amt(i)             ,
4745         P_TAXABLE_AMT_TAX_CURR         => null                                       ,
4746         P_TAXABLE_AMT_FUNCL_CURR       => null                                       ,
4747         P_ORIG_TAXABLE_AMT             => null                                       ,
4748         P_ORIG_TAXABLE_AMT_TAX_CURR    => null                                       ,
4749         P_CAL_TAX_AMT                  => null                                       ,
4750         P_CAL_TAX_AMT_TAX_CURR         => null                                       ,
4751         P_CAL_TAX_AMT_FUNCL_CURR       => null                                       ,
4752         P_ORIG_TAX_AMT                 => null                                       ,
4753         P_ORIG_TAX_AMT_TAX_CURR        => null                                       ,
4754         P_REC_TAX_AMT                  => g_suite_rec_tbl.rec_tax_amt(i)             ,
4755         P_REC_TAX_AMT_TAX_CURR         => null                                       ,
4756         P_REC_TAX_AMT_FUNCL_CURR       => null                                       ,
4757         P_NREC_TAX_AMT                 => g_suite_rec_tbl.nrec_tax_amt(i)            ,
4758         P_NREC_TAX_AMT_TAX_CURR        => null                                       ,
4759         P_NREC_TAX_AMT_FUNCL_CURR      => null                                       ,
4760         P_TAX_EXEMPTION_ID             => g_suite_rec_tbl.tax_exemption_id(i)        ,
4761         P_TAX_RATE_BEFORE_EXEMPTION    => null, --NOT SURE IF IT IS g_suite_rec_tbl.exemption_rate(i),
4762         P_TAX_RATE_NAME_BEFORE_EXEMPT  => null                                       ,
4763         P_EXEMPT_RATE_MODIFIER         => null                                       ,
4764         P_EXEMPT_CERTIFICATE_NUMBER    => g_suite_rec_tbl.exempt_certificate_number(i),
4765         P_EXEMPT_REASON                => null                                       ,
4766         P_EXEMPT_REASON_CODE           => g_suite_rec_tbl.exempt_reason_code(i)      ,
4767         P_TAX_EXCEPTION_ID             => null                                       ,
4768         P_TAX_RATE_BEFORE_EXCEPTION    => null                                       ,
4769         P_TAX_RATE_NAME_BEFORE_EXCEPT  => null                                       ,
4770         P_EXCEPTION_RATE               => g_suite_rec_tbl.exemption_rate(i)          ,
4771         P_TAX_APPORTIONMENT_FLAG       => null                                       ,
4772         P_HISTORICAL_FLAG              => null                                       ,
4773         P_TAXABLE_BASIS_FORMULA        => null                                       ,
4774         P_TAX_CALCULATION_FORMULA      => null                                       ,
4775         P_CANCEL_FLAG                  => g_suite_rec_tbl.cancel_flag(i)             ,
4776         P_PURGE_FLAG                   => null                                       ,
4777         P_DELETE_FLAG                  => null                                       ,
4778         P_TAX_AMT_INCLUDED_FLAG        => g_suite_rec_tbl.tax_amt_included_flag(i)   ,
4779         P_SELF_ASSESSED_FLAG           => g_suite_rec_tbl.self_assessed_flag(i)      ,
4780         P_OVERRIDDEN_FLAG              => null                                       ,
4781         P_MANUALLY_ENTERED_FLAG        => g_suite_rec_tbl.manually_entered_flag(i)   ,
4782         P_REPORTING_ONLY_FLAG          => null                                       ,
4783         P_FREEZE_UNTIL_OVERRIDDN_FLG   => null                                       ,
4784         P_COPIED_FROM_OTHER_DOC_FLAG   => null                                       ,
4785         P_RECALC_REQUIRED_FLAG         => null                                       ,
4786         P_SETTLEMENT_FLAG              => null                                       ,
4787         P_ITEM_DIST_CHANGED_FLAG       => null                                       ,
4788         P_ASSOC_CHILDREN_FROZEN_FLG    => null                                       ,
4789         P_TAX_ONLY_LINE_FLAG           => null                                       ,
4790         P_COMPOUNDING_DEP_TAX_FLAG     => null                                       ,
4791         P_COMPOUNDING_TAX_MISS_FLAG    => null                                       ,
4792         P_SYNC_WITH_PRVDR_FLAG         => null                                       ,
4793         P_LAST_MANUAL_ENTRY            => null                                       ,
4794         P_TAX_PROVIDER_ID              => null                                       ,
4795         P_RECORD_TYPE_CODE             => null                                       ,
4796         P_REPORTING_PERIOD_ID          => null                                       ,
4797         P_LEGAL_JUSTIFICATION_TEXT1    => null                                       ,
4798         P_LEGAL_JUSTIFICATION_TEXT2    => null                                       ,
4799         P_LEGAL_JUSTIFICATION_TEXT3    => null                                       ,
4800         P_LEGAL_MESSAGE_APPL_2         => null                                       ,
4801         P_LEGAL_MESSAGE_STATUS         => null                                       ,
4802         P_LEGAL_MESSAGE_RATE           => null                                       ,
4803         P_LEGAL_MESSAGE_BASIS          => null                                       ,
4804         P_LEGAL_MESSAGE_CALC           => null                                       ,
4805         P_LEGAL_MESSAGE_THRESHOLD      => null                                       ,
4806         P_LEGAL_MESSAGE_POS            => null                                       ,
4807         P_LEGAL_MESSAGE_TRN            => null                                       ,
4808         P_LEGAL_MESSAGE_EXMPT          => null                                       ,
4809         P_LEGAL_MESSAGE_EXCPT          => null                                       ,
4810         P_TAX_REGIME_TEMPLATE_ID       => null                                       ,
4811         P_TAX_APPLICABILITY_RESULT_ID  => null                                       ,
4812         P_DIRECT_RATE_RESULT_ID        => null                                       ,
4813         P_STATUS_RESULT_ID             => null                                       ,
4814         P_RATE_RESULT_ID               => null                                       ,
4815         P_BASIS_RESULT_ID              => null                                       ,
4816         P_THRESH_RESULT_ID             => null                                       ,
4817         P_CALC_RESULT_ID               => null                                       ,
4818         P_TAX_REG_NUM_DET_RESULT_ID    => null                                       ,
4819         P_EVAL_EXMPT_RESULT_ID         => null                                       ,
4820         P_EVAL_EXCPT_RESULT_ID         => null                                       ,
4821         P_ENFORCED_FROM_NAT_ACCT_FLG   => null                                       ,
4822         P_TAX_HOLD_CODE                => null                                       ,
4823         P_TAX_HOLD_RELEASED_CODE       => null                                       ,
4824         P_PRD_TOTAL_TAX_AMT            => null                                       ,
4825         P_PRD_TOTAL_TAX_AMT_TAX_CURR   => null                                       ,
4826         P_PRD_TOTAL_TAX_AMT_FUNCL_CURR => null                                       ,
4827         P_TRX_LINE_INDEX               => null                                       ,
4828         P_OFFSET_TAX_RATE_CODE         => null                                       ,
4829         P_PRORATION_CODE               => null                                       ,
4830         P_OTHER_DOC_SOURCE             => null                                       ,
4831         P_INTERNAL_ORG_LOCATION_ID     => null                                       ,
4832         P_LINE_ASSESSABLE_VALUE        => null                                       ,
4833         P_CTRL_TOTAL_LINE_TX_AMT       => g_suite_rec_tbl.ctrl_total_line_tx_amt(i)  ,
4834         P_APPLIED_TO_TRX_NUMBER        => null                                       ,
4835         --P_EVENT_ID  => null (has been renamed),
4836         P_ATTRIBUTE_CATEGORY           => null                                       ,
4837         P_ATTRIBUTE1                   => null                                       ,
4838         P_ATTRIBUTE2                   => null                                       ,
4839         P_ATTRIBUTE3                   => null                                       ,
4840         P_ATTRIBUTE4                   => null                                       ,
4841         P_ATTRIBUTE5                   => null                                       ,
4842         P_ATTRIBUTE6                   => null                                       ,
4843         P_ATTRIBUTE7                   => null                                       ,
4844         P_ATTRIBUTE8                   => null                                       ,
4845         P_ATTRIBUTE9                   => null                                       ,
4846         P_ATTRIBUTE10                  => null                                       ,
4847         P_ATTRIBUTE11                  => null                                       ,
4848         P_ATTRIBUTE12                  => null                                       ,
4849         P_ATTRIBUTE13                  => null                                       ,
4850         P_ATTRIBUTE14                  => null                                       ,
4851         P_ATTRIBUTE15                  => null                                       ,
4852         P_GLOBAL_ATTRIBUTE_CATEGORY    => null                                       ,
4853         P_GLOBAL_ATTRIBUTE1            => null                                       ,
4854         P_GLOBAL_ATTRIBUTE2            => null                                       ,
4855         P_GLOBAL_ATTRIBUTE3            => null                                       ,
4856         P_GLOBAL_ATTRIBUTE4            => null                                       ,
4857         P_GLOBAL_ATTRIBUTE5            => null                                       ,
4858         P_GLOBAL_ATTRIBUTE6            => null                                       ,
4859         P_GLOBAL_ATTRIBUTE7            => null                                       ,
4860         P_GLOBAL_ATTRIBUTE8            => null                                       ,
4861         P_GLOBAL_ATTRIBUTE9            => null                                       ,
4862         P_GLOBAL_ATTRIBUTE10           => null                                       ,
4863         P_GLOBAL_ATTRIBUTE11           => null                                       ,
4864         P_GLOBAL_ATTRIBUTE12           => null                                       ,
4865         P_GLOBAL_ATTRIBUTE13           => null                                       ,
4866         P_GLOBAL_ATTRIBUTE14           => null                                       ,
4867         P_GLOBAL_ATTRIBUTE15           => null                                       ,
4868         P_NUMERIC1                     => null                                       ,
4869         P_NUMERIC2                     => null                                       ,
4870         P_NUMERIC3                     => null                                       ,
4871         P_NUMERIC4                     => null                                       ,
4872         P_NUMERIC5                     => null                                       ,
4873         P_NUMERIC6                     => null                                       ,
4874         P_NUMERIC7                     => null                                       ,
4875         P_NUMERIC8                     => null                                       ,
4876         P_NUMERIC9                     => null                                       ,
4877         P_NUMERIC10                    => null                                       ,
4878         P_CHAR1                        => null                                       ,
4879         P_CHAR2                        => null                                       ,
4880         P_CHAR3                        => null                                       ,
4881         P_CHAR4                        => null                                       ,
4882         P_CHAR5                        => null                                       ,
4883         P_CHAR6                        => null                                       ,
4884         P_CHAR7                        => null                                       ,
4885         P_CHAR8                        => null                                       ,
4886         P_CHAR9                        => null                                       ,
4887         P_CHAR10                       => null                                       ,
4888         P_DATE1                        => null                                       ,
4889         P_DATE2                        => null                                       ,
4890         P_DATE3                        => null                                       ,
4891         P_DATE4                        => null                                       ,
4892         P_DATE5                        => null                                       ,
4893         P_DATE6                        => null                                       ,
4894         P_DATE7                        => null                                       ,
4895         P_DATE8                        => null                                       ,
4896         P_DATE9                        => null                                       ,
4897         P_DATE10                       => null                                       ,
4898         P_INTERFACE_ENTITY_CODE        => null                                       ,
4899         P_INTERFACE_TAX_LINE_ID        => null                                       ,
4900         P_TAXING_JURIS_GEOGRAPHY_ID    => null                                       ,
4901         P_ADJUSTED_DOC_TAX_LINE_ID     => null                                       ,
4902         P_OBJECT_VERSION_NUMBER        => 1                                          ,
4903         P_CREATED_BY                   => 1      , ---------------------------------
4904         P_CREATION_DATE                => sysdate, -- What are the correct values
4905         P_LAST_UPDATED_BY              => 1      , -- to pass for the Who Columns?
4906         P_LAST_UPDATE_DATE             => sysdate, -- Review this later.
4907         P_LAST_UPDATE_LOGIN            => 1 );      ---------------------------------
4908 
4909       END LOOP;
4910 
4911 
4912     ELSIF p_api_service = 'OVERRIDE_DETAIL_UPDATE_TAX_LINE' THEN
4913       ----------------------------------------------
4914       -- Get inital and ending row for the structure
4915       ----------------------------------------------
4916       get_start_end_rows_structure
4917        (
4918          p_suite      => p_suite_number,
4919          p_case       => p_case_number,
4920          p_structure  => 'STRUCTURE_OVERRIDE_DETAIL_TAX_LINES',
4921          x_start_row  => l_start_row,
4922          x_end_row    => l_end_row
4923        );
4924 
4925       /* For Lock Row V7 changes I didn't find following columns zx_trl_detail_override_pkg.Lock_row
4926         P_EXEMPTION_RATE                => g_suite_rec_tbl.exemption_rate(i)          ,
4927         P_EXEMPT_CERTIFICATE_NUMBER     => g_suite_rec_tbl.exempt_certificate_number(i),
4928         P_EXEMPT_REASON_CODE            => g_suite_rec_tbl.exempt_reason_code(i)      , */
4929 
4930 
4931       FOR i in l_start_row..l_end_row LOOP
4932         select object_version_number
4933         into l_object_version_number
4934         from zx_lines
4935         where application_id =g_suite_rec_tbl.application_id(i)
4936           and entity_code = g_suite_rec_tbl.entity_code(i)
4937           and event_class_code = g_suite_rec_tbl.event_class_code(i)
4938           and trx_id = g_suite_rec_tbl.trx_id(i)
4939           and trx_line_id = g_suite_rec_tbl.trx_line_id(i)
4940           and trx_level_type = g_suite_rec_tbl.trx_level_type(i)
4941           and tax_line_id = g_suite_rec_tbl.tax_line_id(i) ;
4942 
4943       zx_trl_detail_override_pkg.Lock_row (
4944         X_ROWID                        => l_row_id                                   ,
4945         P_TAX_LINE_ID                  => g_suite_rec_tbl.tax_line_id(i)             ,
4946         P_INTERNAL_ORGANIZATION_ID     => g_suite_rec_tbl.internal_organization_id(i),
4947         P_APPLICATION_ID               => g_suite_rec_tbl.application_id(i)          ,
4948         P_ENTITY_CODE                  => g_suite_rec_tbl.entity_code(i)             ,
4949         P_EVENT_CLASS_CODE             => g_suite_rec_tbl.event_class_code(i)        ,
4950         P_EVENT_TYPE_CODE              => g_suite_rec_tbl.event_type_code(i)         ,
4951         P_TRX_ID                       => g_suite_rec_tbl.trx_id(i)                  ,
4952         P_TRX_LINE_ID                  => g_suite_rec_tbl.trx_line_id(i)             ,
4953         P_TRX_LEVEL_TYPE               => g_suite_rec_tbl.trx_level_type(i)          ,
4954         P_TRX_LINE_NUMBER              => g_suite_rec_tbl.trx_line_number(i)         ,
4955         P_DOC_EVENT_STATUS             => null                                       ,
4956         P_TAX_EVENT_CLASS_CODE         => null                                       ,
4957         P_TAX_EVENT_TYPE_CODE          => null                                       ,
4958         P_TAX_LINE_NUMBER              => null                                       ,
4959         P_CONTENT_OWNER_ID             => null                                       ,
4960         P_TAX_REGIME_ID                => null                                       ,
4961         P_TAX_REGIME_CODE              => null                                       ,
4962         P_TAX_ID                       => null                                       ,
4963         P_TAX                          => g_suite_rec_tbl.tax(i)                     ,
4964         P_TAX_STATUS_ID                => g_suite_rec_tbl.tax_rate_id(i)             ,
4965         P_TAX_STATUS_CODE              => g_suite_rec_tbl.tax_rate_code(i)           ,
4966         P_TAX_RATE_ID                  => null                                       ,
4967         P_TAX_RATE_CODE                => null                                       ,
4968         P_TAX_RATE                     => g_suite_rec_tbl.tax_rate(i)                ,
4969         P_TAX_RATE_TYPE                => null                                       ,
4970         P_TAX_APPORTIONMENT_LINE_NUM   => null                                       ,
4971         P_TRX_ID_LEVEL2                => null                                       ,
4972         P_TRX_ID_LEVEL3                => null                                       ,
4973         P_TRX_ID_LEVEL4                => null                                       ,
4974         P_TRX_ID_LEVEL5                => null                                       ,
4975         P_TRX_ID_LEVEL6                => null                                       ,
4976         P_TRX_USER_KEY_LEVEL1          => null                                       ,
4977         P_TRX_USER_KEY_LEVEL2          => null                                       ,
4978         P_TRX_USER_KEY_LEVEL3          => null                                       ,
4979         P_TRX_USER_KEY_LEVEL4          => null                                       ,
4980         P_TRX_USER_KEY_LEVEL5          => null                                       ,
4981         P_TRX_USER_KEY_LEVEL6          => null                                       ,
4982 /*        P_HDR_TRX_USER_KEY1            => null                                       ,
4983         P_HDR_TRX_USER_KEY2            => null                                       ,
4984         P_HDR_TRX_USER_KEY3            => null                                       ,
4985         P_HDR_TRX_USER_KEY4            => null                                       ,
4986         P_HDR_TRX_USER_KEY5            => null                                       ,
4987         P_HDR_TRX_USER_KEY6            => null                                       ,
4988         P_LINE_TRX_USER_KEY1           => null                                       ,
4989         P_LINE_TRX_USER_KEY2           => null                                       ,
4990         P_LINE_TRX_USER_KEY3           => null                                       ,
4991         P_LINE_TRX_USER_KEY4           => null                                       ,
4992         P_LINE_TRX_USER_KEY5           => null                                       ,
4993         P_LINE_TRX_USER_KEY6           => null                                       ,*/
4994         P_MRC_TAX_LINE_FLAG            => null                                       ,
4995         P_MRC_LINK_TO_TAX_LINE_ID      => null                                       ,
4996         P_LEDGER_ID                    => null                                       ,
4997         P_ESTABLISHMENT_ID             => null                                       ,
4998         P_LEGAL_ENTITY_ID              => null                                       ,
4999      --  P_LEGAL_ENTITY_TAX_REG_NUMBER  => null                                       ,
5000         P_HQ_ESTB_REG_NUMBER           => null                                       ,
5001         P_HQ_ESTB_PARTY_TAX_PROF_ID    => null                                       ,
5002         P_CURRENCY_CONVERSION_DATE     => null                                       ,
5003         P_CURRENCY_CONVERSION_TYPE     => null                                       ,
5004         P_CURRENCY_CONVERSION_RATE     => null                                       ,
5005         P_TAX_CURR_CONVERSION_DATE     => null                                       ,
5006         P_TAX_CURR_CONVERSION_TYPE     => null                                       ,
5007         P_TAX_CURR_CONVERSION_RATE     => null                                       ,
5008         P_TRX_CURRENCY_CODE            => null                                       ,
5009         P_REPORTING_CURRENCY_CODE      => null                                       ,
5010         P_MINIMUM_ACCOUNTABLE_UNIT     => null                                       ,
5011         P_PRECISION                    => null                                       ,
5012         P_TRX_NUMBER                   => g_suite_rec_tbl.trx_number(i)              ,
5013         P_TRX_DATE                     => null                                       ,
5014         P_UNIT_PRICE                   => null                                       ,
5015         P_LINE_AMT                     => null                                       ,
5016         P_TRX_LINE_QUANTITY            => null                                       ,
5017         P_TAX_BASE_MODIFIER_RATE       => null                                       ,
5018         P_REF_DOC_APPLICATION_ID       => null                                       ,
5019         P_REF_DOC_ENTITY_CODE          => null                                       ,
5020         P_REF_DOC_EVENT_CLASS_CODE     => null                                       ,
5021         P_REF_DOC_TRX_ID               => null                                       ,
5022         P_REF_DOC_TRX_LEVEL_TYPE       => null                                       ,
5023         P_REF_DOC_LINE_ID              => null                                       ,
5024         P_REF_DOC_LINE_QUANTITY        => null                                       ,
5025         P_OTHER_DOC_LINE_AMT           => null                                       ,
5026         P_OTHER_DOC_LINE_TAX_AMT       => null                                       ,
5027         P_OTHER_DOC_LINE_TAXABLE_AMT   => null                                       ,
5028         P_UNROUNDED_TAXABLE_AMT        => null                                       ,
5029         P_UNROUNDED_TAX_AMT            => null                                       ,
5030         P_RELATED_DOC_APPLICATION_ID   => null                                       ,
5031         P_RELATED_DOC_ENTITY_CODE      => null                                       ,
5032         P_RELATED_DOC_EVT_CLASS_CODE   => null                                       ,
5033         P_RELATED_DOC_TRX_ID           => null                                       ,
5034         P_RELATED_DOC_TRX_LEVEL_TYPE   => null                                       ,
5035         P_RELATED_DOC_NUMBER           => null                                       ,
5036         P_RELATED_DOC_DATE             => null                                       ,
5037         P_APPLIED_FROM_APPL_ID         => null                                       ,
5038         P_APPLIED_FROM_EVT_CLSS_CODE   => null                                       ,
5039         P_APPLIED_FROM_ENTITY_CODE     => null                                       ,
5040         P_APPLIED_FROM_TRX_ID          => null                                       ,
5041         P_APPLIED_FROM_TRX_LEVEL_TYPE  => null                                       ,
5042         P_APPLIED_FROM_LINE_ID         => null                                       ,
5043         P_APPLIED_FROM_TRX_NUMBER      => null                                       ,
5044         P_ADJUSTED_DOC_APPLN_ID        => null                                       ,
5045         P_ADJUSTED_DOC_ENTITY_CODE     => g_suite_rec_tbl.adjusted_doc_entity_code(i),
5046         P_ADJUSTED_DOC_EVT_CLSS_CODE   => null                                       ,
5047         P_ADJUSTED_DOC_TRX_ID          => null                                       ,
5048         P_ADJUSTED_DOC_TRX_LEVEL_TYPE  => null                                       ,
5049         P_ADJUSTED_DOC_LINE_ID         => null                                       ,
5050         P_ADJUSTED_DOC_NUMBER          => null                                       ,
5051         P_ADJUSTED_DOC_DATE            => null                                       ,
5052         P_APPLIED_TO_APPLICATION_ID    => null                                       ,
5053         P_APPLIED_TO_EVT_CLASS_CODE    => null                                       ,
5054         P_APPLIED_TO_ENTITY_CODE       => null                                       ,
5055         P_APPLIED_TO_TRX_ID            => null                                       ,
5056         P_APPLIED_TO_TRX_LEVEL_TYPE    => null                                       ,
5057         P_APPLIED_TO_LINE_ID           => null                                       ,
5058         P_SUMMARY_TAX_LINE_ID          => g_suite_rec_tbl.summary_tax_line_id(i)     ,
5059         P_OFFSET_LINK_TO_TAX_LINE_ID   => null                                       ,
5060         P_OFFSET_FLAG                  => null                                       ,
5061         P_PROCESS_FOR_RECOVERY_FLAG    => null                                       ,
5062         P_TAX_JURISDICTION_ID          => g_suite_rec_tbl.tax_jurisdiction_id(i)     ,
5063         P_TAX_JURISDICTION_CODE        => null                                       ,
5064         P_PLACE_OF_SUPPLY              => null                                       ,
5065         P_PLACE_OF_SUPPLY_TYPE_CODE    => null                                       ,
5066         P_PLACE_OF_SUPPLY_RESULT_ID    => null                                       ,
5067         P_TAX_DATE_RULE_ID             => null                                       ,
5068         P_TAX_DATE                     => null                                       ,
5069         P_TAX_DETERMINE_DATE           => null                                       ,
5070         P_TAX_POINT_DATE               => null                                       ,
5071         P_TRX_LINE_DATE                => null                                       ,
5072         P_TAX_TYPE_CODE                => null                                       ,
5073         P_TAX_CODE                     => null                                       ,
5074         P_TAX_REGISTRATION_ID          => null                                       ,
5075         P_TAX_REGISTRATION_NUMBER      => g_suite_rec_tbl.tax_registration_number(i) ,
5076         P_REGISTRATION_PARTY_TYPE      => null                                       ,
5077         P_ROUNDING_LEVEL_CODE          => null                                       ,
5078         P_ROUNDING_RULE_CODE           => null                                       ,
5079         P_RNDG_LVL_PARTY_TAX_PROF_ID   => null                                       ,
5080         P_ROUNDING_LVL_PARTY_TYPE      => null                                       ,
5081         P_COMPOUNDING_TAX_FLAG         => null                                       ,
5082         P_ORIG_TAX_STATUS_ID           => null                                       ,
5083         P_ORIG_TAX_STATUS_CODE         => null                                       ,
5084         P_ORIG_TAX_RATE_ID             => null                                       ,
5085         P_ORIG_TAX_RATE_CODE           => null                                       ,
5086         P_ORIG_TAX_RATE                => null                                       ,
5087         P_ORIG_TAX_JURISDICTION_ID     => null                                       ,
5088         P_ORIG_TAX_JURISDICTION_CODE   => null                                       ,
5089         P_ORIG_TAX_AMT_INCLUDED_FLAG   => null                                       ,
5090         P_ORIG_SELF_ASSESSED_FLAG      => null                                       ,
5091         P_TAX_CURRENCY_CODE            => null                                       ,
5092         P_TAX_AMT                      => g_suite_rec_tbl.tax_amt(i)                 ,
5093         P_TAX_AMT_TAX_CURR             => null                                       ,
5094         P_TAX_AMT_FUNCL_CURR           => null                                       ,
5095         P_TAXABLE_AMT                  => g_suite_rec_tbl.taxable_amt(i)             ,
5096         P_TAXABLE_AMT_TAX_CURR         => null                                       ,
5097         P_TAXABLE_AMT_FUNCL_CURR       => null                                       ,
5098         P_ORIG_TAXABLE_AMT             => null                                       ,
5099         P_ORIG_TAXABLE_AMT_TAX_CURR    => null                                       ,
5100         P_CAL_TAX_AMT                  => null                                       ,
5101         P_CAL_TAX_AMT_TAX_CURR         => null                                       ,
5102         P_CAL_TAX_AMT_FUNCL_CURR       => null                                       ,
5103         P_ORIG_TAX_AMT                 => null                                       ,
5104         P_ORIG_TAX_AMT_TAX_CURR        => null                                       ,
5105         P_REC_TAX_AMT                  => g_suite_rec_tbl.rec_tax_amt(i)             ,
5106         P_REC_TAX_AMT_TAX_CURR         => null                                       ,
5107         P_REC_TAX_AMT_FUNCL_CURR       => null                                       ,
5108         P_NREC_TAX_AMT                 => g_suite_rec_tbl.nrec_tax_amt(i)            ,
5109         P_NREC_TAX_AMT_TAX_CURR        => null                                       ,
5110         P_NREC_TAX_AMT_FUNCL_CURR      => null                                       ,
5111         P_TAX_EXEMPTION_ID             => g_suite_rec_tbl.tax_exemption_id(i)        ,
5112         P_TAX_RATE_BEFORE_EXEMPTION    => null                                       ,
5113         P_TAX_RATE_NAME_BEFORE_EXEMPT  => null                                       ,
5114         P_EXEMPT_RATE_MODIFIER         => null                                       ,
5115         P_EXEMPT_CERTIFICATE_NUMBER    => null                                       ,
5116         P_EXEMPT_REASON                => null                                       ,
5117         P_EXEMPT_REASON_CODE           => null                                       ,
5118         P_TAX_EXCEPTION_ID             => null                                       ,
5119         P_TAX_RATE_BEFORE_EXCEPTION    => null                                       ,
5120         P_TAX_RATE_NAME_BEFORE_EXCEPT  => null                                       ,
5121         P_EXCEPTION_RATE               => null                                       ,
5122         P_TAX_APPORTIONMENT_FLAG       => null                                       ,
5123         P_HISTORICAL_FLAG              => null                                       ,
5124         P_TAXABLE_BASIS_FORMULA        => null                                       ,
5125         P_TAX_CALCULATION_FORMULA      => null                                       ,
5126         P_CANCEL_FLAG                  => null                                       ,
5127         P_PURGE_FLAG                   => null                                       ,
5128         P_DELETE_FLAG                  => null                                       ,
5129         P_TAX_AMT_INCLUDED_FLAG        => g_suite_rec_tbl.tax_amt_included_flag(i)   ,
5130         P_SELF_ASSESSED_FLAG           => g_suite_rec_tbl.self_assessed_flag(i)      ,
5131         P_OVERRIDDEN_FLAG              => null                                       ,
5132         P_MANUALLY_ENTERED_FLAG        => null                                       ,
5133         P_REPORTING_ONLY_FLAG          => null                                       ,
5134         P_FREEZE_UNTIL_OVERRIDDN_FLG   => null                                       ,
5135         P_COPIED_FROM_OTHER_DOC_FLAG   => null                                       ,
5136         P_RECALC_REQUIRED_FLAG         => null                                       ,
5137         P_SETTLEMENT_FLAG              => null                                       ,
5138         P_ITEM_DIST_CHANGED_FLAG       => null                                       ,
5139         P_ASSOC_CHILDREN_FROZEN_FLG    => null                                       ,
5140         P_TAX_ONLY_LINE_FLAG           => null                                       ,
5141         P_COMPOUNDING_DEP_TAX_FLAG     => null                                       ,
5142         P_COMPOUNDING_TAX_MISS_FLAG    => null                                       ,
5143         P_SYNC_WITH_PRVDR_FLAG         => null                                       ,
5144         P_LAST_MANUAL_ENTRY            => null                                       ,
5145         P_TAX_PROVIDER_ID              => null                                       ,
5146         P_RECORD_TYPE_CODE             => null                                       ,
5147         P_REPORTING_PERIOD_ID          => null                                       ,
5148         P_LEGAL_JUSTIFICATION_TEXT1    => null                                       ,
5149         P_LEGAL_JUSTIFICATION_TEXT2    => null                                       ,
5150         P_LEGAL_JUSTIFICATION_TEXT3    => null                                       ,
5151         P_LEGAL_MESSAGE_APPL_2         => null                                       ,
5152         P_LEGAL_MESSAGE_STATUS         => null                                       ,
5153         P_LEGAL_MESSAGE_RATE           => null                                       ,
5154         P_LEGAL_MESSAGE_BASIS          => null                                       ,
5155         P_LEGAL_MESSAGE_CALC           => null                                       ,
5156         P_LEGAL_MESSAGE_THRESHOLD      => null                                       ,
5157         P_LEGAL_MESSAGE_POS            => null                                       ,
5158         P_LEGAL_MESSAGE_TRN            => null                                       ,
5159         P_LEGAL_MESSAGE_EXMPT          => null                                       ,
5160         P_LEGAL_MESSAGE_EXCPT          => null                                       ,
5161         P_TAX_REGIME_TEMPLATE_ID       => null                                       ,
5162         P_TAX_APPLICABILITY_RESULT_ID  => null                                       ,
5163         P_DIRECT_RATE_RESULT_ID        => null                                       ,
5164         P_STATUS_RESULT_ID             => null                                       ,
5165         P_RATE_RESULT_ID               => null                                       ,
5166         P_BASIS_RESULT_ID              => null                                       ,
5167         P_THRESH_RESULT_ID             => null                                       ,
5168         P_CALC_RESULT_ID               => null                                       ,
5169         P_TAX_REG_NUM_DET_RESULT_ID    => null                                       ,
5170         P_EVAL_EXMPT_RESULT_ID         => null                                       ,
5171         P_EVAL_EXCPT_RESULT_ID         => null                                       ,
5172         P_ENFORCED_FROM_NAT_ACCT_FLG   => null                                       ,
5173         P_TAX_HOLD_CODE                => null                                       ,
5174         P_TAX_HOLD_RELEASED_CODE       => null                                       ,
5175         P_PRD_TOTAL_TAX_AMT            => null                                       ,
5176         P_PRD_TOTAL_TAX_AMT_TAX_CURR   => null                                       ,
5177         P_PRD_TOTAL_TAX_AMT_FUNCL_CURR => null                                       ,
5178         P_TRX_LINE_INDEX               => null                                       ,
5179         P_OFFSET_TAX_RATE_CODE         => null                                       ,
5180         P_PRORATION_CODE               => null                                       ,
5181         P_OTHER_DOC_SOURCE             => null                                       ,
5182         P_INTERNAL_ORG_LOCATION_ID     => null                                       ,
5183         P_LINE_ASSESSABLE_VALUE        => null                                       ,
5184         P_CTRL_TOTAL_LINE_TX_AMT       => g_suite_rec_tbl.ctrl_total_line_tx_amt(i)  ,
5185         P_APPLIED_TO_TRX_NUMBER        => null                                       ,
5186         P_ATTRIBUTE_CATEGORY           => null                                       ,
5187         P_ATTRIBUTE1                   => null                                       ,
5188         P_ATTRIBUTE2                   => null                                       ,
5189         P_ATTRIBUTE3                   => null                                       ,
5190         P_ATTRIBUTE4                   => null                                       ,
5191         P_ATTRIBUTE5                   => null                                       ,
5192         P_ATTRIBUTE6                   => null                                       ,
5193         P_ATTRIBUTE7                   => null                                       ,
5194         P_ATTRIBUTE8                   => null                                       ,
5195         P_ATTRIBUTE9                   => null                                       ,
5196         P_ATTRIBUTE10                  => null                                       ,
5197         P_ATTRIBUTE11                  => null                                       ,
5198         P_ATTRIBUTE12                  => null                                       ,
5199         P_ATTRIBUTE13                  => null                                       ,
5200         P_ATTRIBUTE14                  => null                                       ,
5201         P_ATTRIBUTE15                  => null                                       ,
5202         P_GLOBAL_ATTRIBUTE_CATEGORY    => null                                       ,
5203         P_GLOBAL_ATTRIBUTE1            => null                                       ,
5204         P_GLOBAL_ATTRIBUTE2            => null                                       ,
5205         P_GLOBAL_ATTRIBUTE3            => null                                       ,
5206         P_GLOBAL_ATTRIBUTE4            => null                                       ,
5207         P_GLOBAL_ATTRIBUTE5            => null                                       ,
5208         P_GLOBAL_ATTRIBUTE6            => null                                       ,
5209         P_GLOBAL_ATTRIBUTE7            => null                                       ,
5210         P_GLOBAL_ATTRIBUTE8            => null                                       ,
5211         P_GLOBAL_ATTRIBUTE9            => null                                       ,
5212         P_GLOBAL_ATTRIBUTE10           => null                                       ,
5213         P_GLOBAL_ATTRIBUTE11           => null                                       ,
5214         P_GLOBAL_ATTRIBUTE12           => null                                       ,
5215         P_GLOBAL_ATTRIBUTE13           => null                                       ,
5216         P_GLOBAL_ATTRIBUTE14           => null                                       ,
5217         P_GLOBAL_ATTRIBUTE15           => null                                       ,
5218         P_NUMERIC1                     => null                                       ,
5219         P_NUMERIC2                     => null                                       ,
5220         P_NUMERIC3                     => null                                       ,
5221         P_NUMERIC4                     => null                                       ,
5222         P_NUMERIC5                     => null                                       ,
5223         P_NUMERIC6                     => null                                       ,
5224         P_NUMERIC7                     => null                                       ,
5225         P_NUMERIC8                     => null                                       ,
5226         P_NUMERIC9                     => null                                       ,
5227         P_NUMERIC10                    => null                                       ,
5228         P_CHAR1                        => null                                       ,
5229         P_CHAR2                        => null                                       ,
5230         P_CHAR3                        => null                                       ,
5231         P_CHAR4                        => null                                       ,
5232         P_CHAR5                        => null                                       ,
5233         P_CHAR6                        => null                                       ,
5234         P_CHAR7                        => null                                       ,
5235         P_CHAR8                        => null                                       ,
5236         P_CHAR9                        => null                                       ,
5237         P_CHAR10                       => null                                       ,
5238         P_DATE1                        => null                                       ,
5239         P_DATE2                        => null                                       ,
5240         P_DATE3                        => null                                       ,
5241         P_DATE4                        => null                                       ,
5242         P_DATE5                        => null                                       ,
5243         P_DATE6                        => null                                       ,
5244         P_DATE7                        => null                                       ,
5245         P_DATE8                        => null                                       ,
5246         P_DATE9                        => null                                       ,
5247         P_DATE10                       => null                                       ,
5248         P_INTERFACE_ENTITY_CODE        => null                                       ,
5249         P_INTERFACE_TAX_LINE_ID        => null                                       ,
5250         P_TAXING_JURIS_GEOGRAPHY_ID    => null                                       ,
5251         P_ADJUSTED_DOC_TAX_LINE_ID     => null                                       ,
5252         P_OBJECT_VERSION_NUMBER        => l_object_version_number                    ,
5253         P_CREATED_BY                   => 1      , ---------------------------------
5254         P_CREATION_DATE                => sysdate, -- What are the correct values
5255         P_LAST_UPDATED_BY              => 1      , -- to pass for the Who Columns?
5256         P_LAST_UPDATE_DATE             => sysdate, -- Review this later.
5257         P_LAST_UPDATE_LOGIN            => 1 );      ---------------------------------
5258 
5259       END LOOP;
5260 
5261       FOR i in l_start_row..l_end_row LOOP
5262         select object_version_number
5263         into l_object_version_number
5264         from zx_lines
5265         where application_id =g_suite_rec_tbl.application_id(i)
5266           and entity_code = g_suite_rec_tbl.entity_code(i)
5267           and event_class_code = g_suite_rec_tbl.event_class_code(i)
5268           and trx_id = g_suite_rec_tbl.trx_id(i)
5269           and trx_line_id = g_suite_rec_tbl.trx_line_id(i)
5270           and trx_level_type = g_suite_rec_tbl.trx_level_type(i)
5271           and tax_line_id = g_suite_rec_tbl.tax_line_id(i) ;
5272 
5273       zx_trl_detail_override_pkg.Update_row(
5274         --X_ROWID                        => l_row_id                                   ,
5275         P_TAX_LINE_ID                  => g_suite_rec_tbl.tax_line_id(i)             ,
5276         P_INTERNAL_ORGANIZATION_ID     => g_suite_rec_tbl.internal_organization_id(i),
5277         P_APPLICATION_ID               => g_suite_rec_tbl.application_id(i)          ,
5278         P_ENTITY_CODE                  => g_suite_rec_tbl.entity_code(i)             ,
5279         P_EVENT_CLASS_CODE             => g_suite_rec_tbl.event_class_code(i)        ,
5280         P_EVENT_TYPE_CODE              => g_suite_rec_tbl.event_type_code(i)         ,
5281         P_TRX_ID                       => g_suite_rec_tbl.trx_id(i)                  ,
5282         P_TRX_LINE_ID                  => g_suite_rec_tbl.trx_line_id(i)             ,
5283         P_TRX_LEVEL_TYPE               => g_suite_rec_tbl.trx_level_type(i)          ,
5284         P_TRX_LINE_NUMBER              => g_suite_rec_tbl.trx_line_number(i)         ,
5285         P_DOC_EVENT_STATUS             => null                                       ,
5286         P_TAX_EVENT_CLASS_CODE         => null                                       ,
5287         P_TAX_EVENT_TYPE_CODE          => null                                       ,
5288         P_TAX_LINE_NUMBER              => null                                       ,
5289         P_CONTENT_OWNER_ID             => null                                       ,
5290         P_TAX_REGIME_ID                => null                                       ,
5291         P_TAX_REGIME_CODE              => g_suite_rec_tbl.tax_regime_code(i)         ,
5292         P_TAX_ID                       => null                                       ,
5293         P_TAX                          => null                                       ,
5294         P_TAX_STATUS_ID                => null                                       ,
5295         P_TAX_STATUS_CODE              => g_suite_rec_tbl.tax_status_code(i)         ,
5296         P_TAX_RATE_ID                  => g_suite_rec_tbl.tax_rate_id(i)             ,
5297         P_TAX_RATE_CODE                => g_suite_rec_tbl.tax_rate_code(i)           ,
5298         P_TAX_RATE                     => g_suite_rec_tbl.tax_rate(i)                ,
5299         P_TAX_RATE_TYPE                => null                                       ,
5300         P_TAX_APPORTIONMENT_LINE_NUM   => null                                       ,
5301         P_TRX_ID_LEVEL2                => null                                       ,
5302         P_TRX_ID_LEVEL3                => null                                       ,
5303         P_TRX_ID_LEVEL4                => null                                       ,
5304         P_TRX_ID_LEVEL5                => null                                       ,
5305         P_TRX_ID_LEVEL6                => null                                       ,
5306         P_TRX_USER_KEY_LEVEL1          => null                                       ,
5307         P_TRX_USER_KEY_LEVEL2          => null                                       ,
5308         P_TRX_USER_KEY_LEVEL3          => null                                       ,
5309         P_TRX_USER_KEY_LEVEL4          => null                                       ,
5310         P_TRX_USER_KEY_LEVEL5          => null                                       ,
5311         P_TRX_USER_KEY_LEVEL6          => null                                       ,
5312         /*P_HDR_TRX_USER_KEY1            => null                                       ,
5313         P_HDR_TRX_USER_KEY2            => null                                       ,
5314         P_HDR_TRX_USER_KEY3            => null                                       ,
5315         P_HDR_TRX_USER_KEY4            => null                                       ,
5316         P_HDR_TRX_USER_KEY5            => null                                       ,
5317         P_HDR_TRX_USER_KEY6            => null                                       ,
5318         P_LINE_TRX_USER_KEY1           => null                                       ,
5319         P_LINE_TRX_USER_KEY2           => null                                       ,
5320         P_LINE_TRX_USER_KEY3           => null                                       ,
5321         P_LINE_TRX_USER_KEY4           => null                                       ,
5322         P_LINE_TRX_USER_KEY5           => null                                       ,
5323         P_LINE_TRX_USER_KEY6           => null                                       ,*/
5324         P_MRC_TAX_LINE_FLAG            => null                                       ,
5325         P_MRC_LINK_TO_TAX_LINE_ID      => null                                       ,
5326         P_LEDGER_ID                    => null                                       ,
5327         P_ESTABLISHMENT_ID             => null                                       ,
5328         P_LEGAL_ENTITY_ID              => null                                       ,
5329         -- P_LEGAL_ENTITY_TAX_REG_NUMBER  => null                                       ,
5330         P_HQ_ESTB_REG_NUMBER           => null                                       ,
5331         P_HQ_ESTB_PARTY_TAX_PROF_ID    => null                                       ,
5332         P_CURRENCY_CONVERSION_DATE     => null                                       ,
5333         P_CURRENCY_CONVERSION_TYPE     => null                                       ,
5334         P_CURRENCY_CONVERSION_RATE     => null                                       ,
5335         P_TAX_CURR_CONVERSION_DATE     => null                                       ,
5336         P_TAX_CURR_CONVERSION_TYPE     => null                                       ,
5337         P_TAX_CURR_CONVERSION_RATE     => null                                       ,
5338         P_TRX_CURRENCY_CODE            => null                                       ,
5339         P_REPORTING_CURRENCY_CODE      => null                                       ,
5340         P_MINIMUM_ACCOUNTABLE_UNIT     => null                                       ,
5341         P_PRECISION                    => null                                       ,
5342         P_TRX_NUMBER                   => null                                       ,
5343         P_TRX_DATE                     => null                                       ,
5344         P_UNIT_PRICE                   => null                                       ,
5345         P_LINE_AMT                     => null                                       ,
5346         P_TRX_LINE_QUANTITY            => null                                       ,
5347         P_TAX_BASE_MODIFIER_RATE       => null                                       ,
5348         P_REF_DOC_APPLICATION_ID       => null                                       ,
5349         P_REF_DOC_ENTITY_CODE          => null                                       ,
5350         P_REF_DOC_EVENT_CLASS_CODE     => null                                       ,
5351         P_REF_DOC_TRX_ID               => null                                       ,
5352         P_REF_DOC_TRX_LEVEL_TYPE       => null                                       ,
5353         P_REF_DOC_LINE_ID              => null                                       ,
5354         P_REF_DOC_LINE_QUANTITY        => null                                       ,
5355         P_OTHER_DOC_LINE_AMT           => null                                       ,
5356         P_OTHER_DOC_LINE_TAX_AMT       => null                                       ,
5357         P_OTHER_DOC_LINE_TAXABLE_AMT   => null                                       ,
5358         P_UNROUNDED_TAXABLE_AMT        => null                                       ,
5359         P_UNROUNDED_TAX_AMT            => null                                       ,
5360         P_RELATED_DOC_APPLICATION_ID   => null                                       ,
5361         P_RELATED_DOC_ENTITY_CODE      => null                                       ,
5362         P_RELATED_DOC_EVT_CLASS_CODE   => null                                       ,
5363         P_RELATED_DOC_TRX_ID           => null                                       ,
5364         P_RELATED_DOC_TRX_LEVEL_TYPE   => null                                       ,
5365         P_RELATED_DOC_NUMBER           => null                                       ,
5366         P_RELATED_DOC_DATE             => null                                       ,
5367         P_APPLIED_FROM_APPL_ID         => null                                       ,
5368         P_APPLIED_FROM_EVT_CLSS_CODE   => null                                       ,
5369         P_APPLIED_FROM_ENTITY_CODE     => null                                       ,
5370         P_APPLIED_FROM_TRX_ID          => null                                       ,
5371         P_APPLIED_FROM_TRX_LEVEL_TYPE  => null                                       ,
5372         P_APPLIED_FROM_LINE_ID         => null                                       ,
5373         P_APPLIED_FROM_TRX_NUMBER      => null                                       ,
5374         P_ADJUSTED_DOC_APPLN_ID        => null                                       ,
5375         P_ADJUSTED_DOC_ENTITY_CODE     => g_suite_rec_tbl.adjusted_doc_entity_code(i),
5376         P_ADJUSTED_DOC_EVT_CLSS_CODE   => null                                       ,
5377         P_ADJUSTED_DOC_TRX_ID          => null                                       ,
5378         P_ADJUSTED_DOC_TRX_LEVEL_TYPE  => null                                       ,
5379         P_ADJUSTED_DOC_LINE_ID         => null                                       ,
5380         P_ADJUSTED_DOC_NUMBER          => null                                       ,
5381         P_ADJUSTED_DOC_DATE            => null                                       ,
5382         P_APPLIED_TO_APPLICATION_ID    => null                                       ,
5383         P_APPLIED_TO_EVT_CLASS_CODE    => null                                       ,
5384         P_APPLIED_TO_ENTITY_CODE       => null                                       ,
5385         P_APPLIED_TO_TRX_ID            => null                                       ,
5386         P_APPLIED_TO_TRX_LEVEL_TYPE    => null                                       ,
5387         P_APPLIED_TO_LINE_ID           => null                                       ,
5388         P_SUMMARY_TAX_LINE_ID          => g_suite_rec_tbl.summary_tax_line_id(i)     ,
5389         P_OFFSET_LINK_TO_TAX_LINE_ID   => null                                       ,
5390         P_OFFSET_FLAG                  => null                                       ,
5391         P_PROCESS_FOR_RECOVERY_FLAG    => null                                       ,
5392         P_TAX_JURISDICTION_ID          => null                                       ,
5393         P_TAX_JURISDICTION_CODE        => null                                       ,
5394         P_PLACE_OF_SUPPLY              => null                                       ,
5395         P_PLACE_OF_SUPPLY_TYPE_CODE    => null                                       ,
5396         P_PLACE_OF_SUPPLY_RESULT_ID    => null                                       ,
5397         P_TAX_DATE_RULE_ID             => null                                       ,
5398         P_TAX_DATE                     => null                                       ,
5399         P_TAX_DETERMINE_DATE           => null                                       ,
5400         P_TAX_POINT_DATE               => null                                       ,
5401         P_TRX_LINE_DATE                => null                                       ,
5402         P_TAX_TYPE_CODE                => null                                       ,
5403         P_TAX_CODE                     => null                                       ,
5404         P_TAX_REGISTRATION_ID          => null                                       ,
5405         P_TAX_REGISTRATION_NUMBER      => null                                       ,
5406         P_REGISTRATION_PARTY_TYPE      => null                                       ,
5407         P_ROUNDING_LEVEL_CODE          => null                                       ,
5408         P_ROUNDING_RULE_CODE           => null                                       ,
5409         P_RNDG_LVL_PARTY_TAX_PROF_ID   => null                                       ,
5410         P_ROUNDING_LVL_PARTY_TYPE      => null                                       ,
5411         P_COMPOUNDING_TAX_FLAG         => null                                       ,
5412         P_ORIG_TAX_STATUS_ID           => null                                       ,
5413         P_ORIG_TAX_STATUS_CODE         => null                                       ,
5414         P_ORIG_TAX_RATE_ID             => null                                       ,
5415         P_ORIG_TAX_RATE_CODE           => null                                       ,
5416         P_ORIG_TAX_RATE                => null                                       ,
5417         P_ORIG_TAX_JURISDICTION_ID     => null                                       ,
5418         P_ORIG_TAX_JURISDICTION_CODE   => null                                       ,
5419         P_ORIG_TAX_AMT_INCLUDED_FLAG   => null                                       ,
5420         P_ORIG_SELF_ASSESSED_FLAG      => null                                       ,
5421         P_TAX_CURRENCY_CODE            => null                                       ,
5422         P_TAX_AMT                      => g_suite_rec_tbl.tax_amt(i)                 ,
5423         P_TAX_AMT_TAX_CURR             => null                                       ,
5424         P_TAX_AMT_FUNCL_CURR           => null                                       ,
5425         P_TAXABLE_AMT                  => null                                       ,
5426         P_TAXABLE_AMT_TAX_CURR         => null                                       ,
5427         P_TAXABLE_AMT_FUNCL_CURR       => null                                       ,
5428         P_ORIG_TAXABLE_AMT             => null                                       ,
5429         P_ORIG_TAXABLE_AMT_TAX_CURR    => null                                       ,
5430         P_CAL_TAX_AMT                  => null                                       ,
5431         P_CAL_TAX_AMT_TAX_CURR         => null                                       ,
5432         P_CAL_TAX_AMT_FUNCL_CURR       => null                                       ,
5433         P_ORIG_TAX_AMT                 => null                                       ,
5434         P_ORIG_TAX_AMT_TAX_CURR        => null                                       ,
5435         P_REC_TAX_AMT                  => null                                       ,
5436         P_REC_TAX_AMT_TAX_CURR         => null                                       ,
5437         P_REC_TAX_AMT_FUNCL_CURR       => null                                       ,
5438         P_NREC_TAX_AMT                 => null                                       ,
5439         P_NREC_TAX_AMT_TAX_CURR        => null                                       ,
5440         P_NREC_TAX_AMT_FUNCL_CURR      => null                                       ,
5441         P_TAX_EXEMPTION_ID             => null                                       ,
5442         P_TAX_RATE_BEFORE_EXEMPTION    => null                                       ,
5443         P_TAX_RATE_NAME_BEFORE_EXEMPT  => null                                       ,
5444         P_EXEMPT_RATE_MODIFIER         => null                                       ,
5445         P_EXEMPT_CERTIFICATE_NUMBER    => null                                       ,
5446         P_EXEMPT_REASON                => null                                       ,
5447         P_EXEMPT_REASON_CODE           => null                                       ,
5448         P_TAX_EXCEPTION_ID             => null                                       ,
5449         P_TAX_RATE_BEFORE_EXCEPTION    => null                                       ,
5450         P_TAX_RATE_NAME_BEFORE_EXCEPT  => null                                       ,
5451         P_EXCEPTION_RATE               => null                                       ,
5452         P_TAX_APPORTIONMENT_FLAG       => null                                       ,
5453         P_HISTORICAL_FLAG              => null                                       ,
5454         P_TAXABLE_BASIS_FORMULA        => null                                       ,
5455         P_TAX_CALCULATION_FORMULA      => null                                       ,
5456         P_CANCEL_FLAG                  => null                                       ,
5457         P_PURGE_FLAG                   => null                                       ,
5458         P_DELETE_FLAG                  => null                                       ,
5459         P_TAX_AMT_INCLUDED_FLAG        => g_suite_rec_tbl.tax_amt_included_flag(i)   ,
5460         P_SELF_ASSESSED_FLAG           => g_suite_rec_tbl.self_assessed_flag(i)      ,
5461         P_OVERRIDDEN_FLAG              => null                                       ,
5462         P_MANUALLY_ENTERED_FLAG        => null                                       ,
5463         P_REPORTING_ONLY_FLAG          => null                                       ,
5464         P_FREEZE_UNTIL_OVERRIDDN_FLG   => null                                       ,
5465         P_COPIED_FROM_OTHER_DOC_FLAG   => null                                       ,
5466         P_RECALC_REQUIRED_FLAG         => null                                       ,
5467         P_SETTLEMENT_FLAG              => null                                       ,
5468         P_ITEM_DIST_CHANGED_FLAG       => null                                       ,
5469         P_ASSOC_CHILDREN_FROZEN_FLG    => null                                       ,
5470         P_TAX_ONLY_LINE_FLAG           => null                                       ,
5471         P_COMPOUNDING_DEP_TAX_FLAG     => null                                       ,
5472         P_COMPOUNDING_TAX_MISS_FLAG    => null                                       ,
5473         P_SYNC_WITH_PRVDR_FLAG         => null                                       ,
5474         P_LAST_MANUAL_ENTRY            => null                                       ,
5475         P_TAX_PROVIDER_ID              => null                                       ,
5476         P_RECORD_TYPE_CODE             => null                                       ,
5477         P_REPORTING_PERIOD_ID          => null                                       ,
5478         P_LEGAL_JUSTIFICATION_TEXT1    => null                                       ,
5479         P_LEGAL_JUSTIFICATION_TEXT2    => null                                       ,
5480         P_LEGAL_JUSTIFICATION_TEXT3    => null                                       ,
5481         P_LEGAL_MESSAGE_APPL_2         => null                                       ,
5482         P_LEGAL_MESSAGE_STATUS         => null                                       ,
5483         P_LEGAL_MESSAGE_RATE           => null                                       ,
5484         P_LEGAL_MESSAGE_BASIS          => null                                       ,
5485         P_LEGAL_MESSAGE_CALC           => null                                       ,
5486         P_LEGAL_MESSAGE_THRESHOLD      => null                                       ,
5487         P_LEGAL_MESSAGE_POS            => null                                       ,
5488         P_LEGAL_MESSAGE_TRN            => null                                       ,
5489         P_LEGAL_MESSAGE_EXMPT          => null                                       ,
5490         P_LEGAL_MESSAGE_EXCPT          => null                                       ,
5491         P_TAX_REGIME_TEMPLATE_ID       => null                                       ,
5492         P_TAX_APPLICABILITY_RESULT_ID  => null                                       ,
5493         P_DIRECT_RATE_RESULT_ID        => null                                       ,
5494         P_STATUS_RESULT_ID             => null                                       ,
5495         P_RATE_RESULT_ID               => null                                       ,
5496         P_BASIS_RESULT_ID              => null                                       ,
5497         P_THRESH_RESULT_ID             => null                                       ,
5498         P_CALC_RESULT_ID               => null                                       ,
5499         P_TAX_REG_NUM_DET_RESULT_ID    => null                                       ,
5500         P_EVAL_EXMPT_RESULT_ID         => null                                       ,
5501         P_EVAL_EXCPT_RESULT_ID         => null                                       ,
5502         P_ENFORCED_FROM_NAT_ACCT_FLG   => null                                       ,
5503         P_TAX_HOLD_CODE                => null                                       ,
5504         P_TAX_HOLD_RELEASED_CODE       => null                                       ,
5505         P_PRD_TOTAL_TAX_AMT            => null                                       ,
5506         P_PRD_TOTAL_TAX_AMT_TAX_CURR   => null                                       ,
5507         P_PRD_TOTAL_TAX_AMT_FUNCL_CURR => null                                       ,
5508         P_TRX_LINE_INDEX               => null                                       ,
5509         P_OFFSET_TAX_RATE_CODE         => null                                       ,
5510         P_PRORATION_CODE               => null                                       ,
5511         P_OTHER_DOC_SOURCE             => null                                       ,
5512         P_INTERNAL_ORG_LOCATION_ID     => null                                       ,
5513         P_LINE_ASSESSABLE_VALUE        => null                                       ,
5514         P_CTRL_TOTAL_LINE_TX_AMT       => g_suite_rec_tbl.ctrl_total_line_tx_amt(i)  ,
5515         P_APPLIED_TO_TRX_NUMBER        => null                                       ,
5516         --P_CTRL_EF_OV_CAL_LINE_FLAG     => null                                       ,
5517         P_ATTRIBUTE_CATEGORY           => null                                       ,
5518         P_ATTRIBUTE1                   => null                                       ,
5519         P_ATTRIBUTE2                   => null                                       ,
5520         P_ATTRIBUTE3                   => null                                       ,
5521         P_ATTRIBUTE4                   => null                                       ,
5522         P_ATTRIBUTE5                   => null                                       ,
5523         P_ATTRIBUTE6                   => null                                       ,
5524         P_ATTRIBUTE7                   => null                                       ,
5525         P_ATTRIBUTE8                   => null                                       ,
5526         P_ATTRIBUTE9                   => null                                       ,
5527         P_ATTRIBUTE10                  => null                                       ,
5528         P_ATTRIBUTE11                  => null                                       ,
5529         P_ATTRIBUTE12                  => null                                       ,
5530         P_ATTRIBUTE13                  => null                                       ,
5531         P_ATTRIBUTE14                  => null                                       ,
5532         P_ATTRIBUTE15                  => null                                       ,
5533         P_GLOBAL_ATTRIBUTE_CATEGORY    => null                                       ,
5534         P_GLOBAL_ATTRIBUTE1            => null                                       ,
5535         P_GLOBAL_ATTRIBUTE2            => null                                       ,
5536         P_GLOBAL_ATTRIBUTE3            => null                                       ,
5537         P_GLOBAL_ATTRIBUTE4            => null                                       ,
5538         P_GLOBAL_ATTRIBUTE5            => null                                       ,
5539         P_GLOBAL_ATTRIBUTE6            => null                                       ,
5540         P_GLOBAL_ATTRIBUTE7            => null                                       ,
5541         P_GLOBAL_ATTRIBUTE8            => null                                       ,
5542         P_GLOBAL_ATTRIBUTE9            => null                                       ,
5543         P_GLOBAL_ATTRIBUTE10           => null                                       ,
5544         P_GLOBAL_ATTRIBUTE11           => null                                       ,
5545         P_GLOBAL_ATTRIBUTE12           => null                                       ,
5546         P_GLOBAL_ATTRIBUTE13           => null                                       ,
5547         P_GLOBAL_ATTRIBUTE14           => null                                       ,
5548         P_GLOBAL_ATTRIBUTE15           => null                                       ,
5549         P_NUMERIC1                     => null                                       ,
5550         P_NUMERIC2                     => null                                       ,
5551         P_NUMERIC3                     => null                                       ,
5552         P_NUMERIC4                     => null                                       ,
5553         P_NUMERIC5                     => null                                       ,
5554         P_NUMERIC6                     => null                                       ,
5555         P_NUMERIC7                     => null                                       ,
5556         P_NUMERIC8                     => null                                       ,
5557         P_NUMERIC9                     => null                                       ,
5558         P_NUMERIC10                    => null                                       ,
5559         P_CHAR1                        => null                                       ,
5560         P_CHAR2                        => null                                       ,
5561         P_CHAR3                        => null                                       ,
5562         P_CHAR4                        => null                                       ,
5563         P_CHAR5                        => null                                       ,
5564         P_CHAR6                        => null                                       ,
5565         P_CHAR7                        => null                                       ,
5566         P_CHAR8                        => null                                       ,
5567         P_CHAR9                        => null                                       ,
5568         P_CHAR10                       => null                                       ,
5569         P_DATE1                        => null                                       ,
5570         P_DATE2                        => null                                       ,
5571         P_DATE3                        => null                                       ,
5572         P_DATE4                        => null                                       ,
5573         P_DATE5                        => null                                       ,
5574         P_DATE6                        => null                                       ,
5575         P_DATE7                        => null                                       ,
5576         P_DATE8                        => null                                       ,
5577         P_DATE9                        => null                                       ,
5578         P_DATE10                       => null                                       ,
5579         P_INTERFACE_ENTITY_CODE        => null                                       ,
5580         P_INTERFACE_TAX_LINE_ID        => null                                       ,
5581         P_TAXING_JURIS_GEOGRAPHY_ID    => null                                       ,
5582         P_ADJUSTED_DOC_TAX_LINE_ID     => null                                       ,
5583         P_OBJECT_VERSION_NUMBER        => l_object_version_number+1                  ,
5584         --P_CREATED_BY                   => 1      , ---------------------------------
5585         --P_CREATION_DATE                => sysdate, -- What are the correct values
5586         P_LAST_UPDATED_BY              => 1      , -- to pass for the Who Columns?
5587         P_LAST_UPDATE_DATE             => sysdate, -- Review this later.
5588         P_LAST_UPDATE_LOGIN            => 1 );      ---------------------------------
5589 
5590       END LOOP;
5591 
5592       write_message('Service ZX_TRL_DETAIL_OVERRIDE_PKG.Lock_row/Update_row have been called!.');
5593       write_message('For Suite: '||p_suite_number||' and Case: '||p_case_number);
5594       write_message('x_return_status : '||l_return_status);
5595       write_message('x_msg_count     : '||l_msg_count    );
5596       write_message('x_msg_data      : '||l_msg_data     );
5597 
5598 
5599     ELSIF p_api_service = 'OVERRIDE_DETAIL_DELETE_TAX_LINE' THEN
5600       ----------------------------------------------
5601       -- Get inital and ending row for the structure
5602       ----------------------------------------------
5603       get_start_end_rows_structure
5604        (
5605          p_suite      => p_suite_number,
5606          p_case       => p_case_number,
5607          p_structure  => 'STRUCTURE_OVERRIDE_DETAIL_TAX_LINES',
5608          x_start_row  => l_start_row,
5609          x_end_row    => l_end_row
5610        );
5611 
5612 
5613       /* In V7 Changes for ZX_TRL_DETAIL_OVERRIDE_PKG.delete_row
5614       P_EXEMPTION_RATE              => g_suite_rec_tbl.exemption_rate(i)
5615       is no longer there*/
5616 
5617       FOR i in l_start_row..l_end_row LOOP
5618         select object_version_number
5619         into l_object_version_number
5620         from zx_lines
5621         where application_id =g_suite_rec_tbl.application_id(i)
5622           and entity_code = g_suite_rec_tbl.entity_code(i)
5623           and event_class_code = g_suite_rec_tbl.event_class_code(i)
5624           and trx_id = g_suite_rec_tbl.trx_id(i)
5625           and trx_line_id = g_suite_rec_tbl.trx_line_id(i)
5626           and trx_level_type = g_suite_rec_tbl.trx_level_type(i)
5627           and tax_line_id = g_suite_rec_tbl.tax_line_id(i) ;
5628 
5629       ZX_TRL_DETAIL_OVERRIDE_PKG.delete_row(
5630         X_ROWID                        => l_row_id                                   ,
5631         P_TAX_LINE_ID                  => g_suite_rec_tbl.tax_line_id(i)             ,
5632         P_INTERNAL_ORGANIZATION_ID     => g_suite_rec_tbl.internal_organization_id(i),
5633         P_APPLICATION_ID               => g_suite_rec_tbl.application_id(i)          ,
5634         P_ENTITY_CODE                  => g_suite_rec_tbl.entity_code(i)             ,
5635         P_EVENT_CLASS_CODE             => g_suite_rec_tbl.event_class_code(i)        ,
5636         P_EVENT_TYPE_CODE              => g_suite_rec_tbl.event_type_code(i)         ,
5637         P_TRX_ID                       => g_suite_rec_tbl.trx_id(i)                  ,
5638         P_TRX_LINE_ID                  => g_suite_rec_tbl.trx_line_id(i)             ,
5639         P_TRX_LEVEL_TYPE               => g_suite_rec_tbl.trx_level_type(i)          ,
5640         P_TRX_LINE_NUMBER              => g_suite_rec_tbl.trx_line_number(i)         ,
5641         P_DOC_EVENT_STATUS             => null                                       ,
5642         P_TAX_EVENT_CLASS_CODE         => null                                       ,
5643         P_TAX_EVENT_TYPE_CODE          => null                                       ,
5644         P_TAX_LINE_NUMBER              => null                                       ,
5645         P_CONTENT_OWNER_ID             => null                                       ,
5646         P_TAX_REGIME_ID                => null                                       ,
5647         P_TAX_REGIME_CODE              => g_suite_rec_tbl.tax_regime_code(i)         ,
5648         P_TAX_ID                       => null                                       ,
5649         P_TAX                          => g_suite_rec_tbl.tax(i)                     ,
5650         P_TAX_STATUS_ID                => null                                       ,
5651         P_TAX_STATUS_CODE              => g_suite_rec_tbl.tax_status_code(i)         ,
5652         P_TAX_RATE_ID                  => g_suite_rec_tbl.tax_rate_id(i)             ,
5653         P_TAX_RATE_CODE                => g_suite_rec_tbl.tax_rate_code(i)           ,
5654         P_TAX_RATE                     => g_suite_rec_tbl.tax_rate(i)                ,
5655         P_TAX_RATE_TYPE                => null                                       ,
5656         P_TAX_APPORTIONMENT_LINE_NUM   => null                                       ,
5657         P_TRX_ID_LEVEL2                => null                                       ,
5658         P_TRX_ID_LEVEL3                => null                                       ,
5659         P_TRX_ID_LEVEL4                => null                                       ,
5660         P_TRX_ID_LEVEL5                => null                                       ,
5661         P_TRX_ID_LEVEL6                => null                                       ,
5662         P_TRX_USER_KEY_LEVEL1          => null                                       ,
5663         P_TRX_USER_KEY_LEVEL2          => null                                       ,
5664         P_TRX_USER_KEY_LEVEL3          => null                                       ,
5665         P_TRX_USER_KEY_LEVEL4          => null                                       ,
5666         P_TRX_USER_KEY_LEVEL5          => null                                       ,
5667         P_TRX_USER_KEY_LEVEL6          => null                                       ,
5668       /*P_HDR_TRX_USER_KEY1            => null                                       ,
5669         P_HDR_TRX_USER_KEY2            => null                                       ,
5670         P_HDR_TRX_USER_KEY3            => null                                       ,
5671         P_HDR_TRX_USER_KEY4            => null                                       ,
5672         P_HDR_TRX_USER_KEY5            => null                                       ,
5673         P_HDR_TRX_USER_KEY6            => null                                       ,
5674         P_LINE_TRX_USER_KEY1           => null                                       ,
5675         P_LINE_TRX_USER_KEY2           => null                                       ,
5676         P_LINE_TRX_USER_KEY3           => null                                       ,
5677         P_LINE_TRX_USER_KEY4           => null                                       ,
5678         P_LINE_TRX_USER_KEY5           => null                                       ,
5679         P_LINE_TRX_USER_KEY6           => null                                       ,*/
5680         P_MRC_TAX_LINE_FLAG            => null                                       ,
5681         P_MRC_LINK_TO_TAX_LINE_ID      => null                                       ,
5682         P_LEDGER_ID                    => null                                       ,
5683         P_ESTABLISHMENT_ID             => null                                       ,
5684         P_LEGAL_ENTITY_ID              => null                                       ,
5685         -- P_LEGAL_ENTITY_TAX_REG_NUMBER  => null                                       ,
5686         P_HQ_ESTB_REG_NUMBER           => null                                       ,
5687         P_HQ_ESTB_PARTY_TAX_PROF_ID    => null                                       ,
5688         P_CURRENCY_CONVERSION_DATE     => null                                       ,
5689         P_CURRENCY_CONVERSION_TYPE     => null                                       ,
5690         P_CURRENCY_CONVERSION_RATE     => null                                       ,
5691         P_TAX_CURR_CONVERSION_DATE     => null                                       ,
5692         P_TAX_CURR_CONVERSION_TYPE     => null                                       ,
5693         P_TAX_CURR_CONVERSION_RATE     => null                                       ,
5694         P_TRX_CURRENCY_CODE            => null                                       ,
5695         P_REPORTING_CURRENCY_CODE      => null                                       ,
5696         P_MINIMUM_ACCOUNTABLE_UNIT     => null                                       ,
5697         P_PRECISION                    => null                                       ,
5698         P_TRX_NUMBER                   => g_suite_rec_tbl.trx_number(i)              ,
5699         P_TRX_DATE                     => null                                       ,
5700         P_UNIT_PRICE                   => null                                       ,
5701         P_LINE_AMT                     => null                                       ,
5702         P_TRX_LINE_QUANTITY            => null                                       ,
5703         P_TAX_BASE_MODIFIER_RATE       => null                                       ,
5704         P_REF_DOC_APPLICATION_ID       => null                                       ,
5705         P_REF_DOC_ENTITY_CODE          => null                                       ,
5706         P_REF_DOC_EVENT_CLASS_CODE     => null                                       ,
5707         P_REF_DOC_TRX_ID               => null                                       ,
5708         P_REF_DOC_TRX_LEVEL_TYPE       => null                                       ,
5709         P_REF_DOC_LINE_ID              => null                                       ,
5710         P_REF_DOC_LINE_QUANTITY        => null                                       ,
5711         P_OTHER_DOC_LINE_AMT           => null                                       ,
5712         P_OTHER_DOC_LINE_TAX_AMT       => null                                       ,
5713         P_OTHER_DOC_LINE_TAXABLE_AMT   => null                                       ,
5714         P_UNROUNDED_TAXABLE_AMT        => null                                       ,
5715         P_UNROUNDED_TAX_AMT            => null                                       ,
5716         P_RELATED_DOC_APPLICATION_ID   => null                                       ,
5717         P_RELATED_DOC_ENTITY_CODE      => null                                       ,
5718         P_RELATED_DOC_EVT_CLASS_CODE   => null                                       ,
5719         P_RELATED_DOC_TRX_ID           => null                                       ,
5720         P_RELATED_DOC_TRX_LEVEL_TYPE   => null                                       ,
5721         P_RELATED_DOC_NUMBER           => null                                       ,
5722         P_RELATED_DOC_DATE             => null                                       ,
5723         P_APPLIED_FROM_APPL_ID         => null                                       ,
5724         P_APPLIED_FROM_EVT_CLSS_CODE   => null                                       ,
5725         P_APPLIED_FROM_ENTITY_CODE     => null                                       ,
5726         P_APPLIED_FROM_TRX_ID          => null                                       ,
5727         P_APPLIED_FROM_TRX_LEVEL_TYPE  => null                                       ,
5728         P_APPLIED_FROM_LINE_ID         => null                                       ,
5729         P_APPLIED_FROM_TRX_NUMBER      => null                                       ,
5730         P_ADJUSTED_DOC_APPLN_ID        => null                                       ,
5731         P_ADJUSTED_DOC_ENTITY_CODE     => g_suite_rec_tbl.adjusted_doc_entity_code(i),
5732         P_ADJUSTED_DOC_EVT_CLSS_CODE   => null                                       ,
5733         P_ADJUSTED_DOC_TRX_ID          => null                                       ,
5734         P_ADJUSTED_DOC_TRX_LEVEL_TYPE  => null                                       ,
5735         P_ADJUSTED_DOC_LINE_ID         => null                                       ,
5736         P_ADJUSTED_DOC_NUMBER          => null                                       ,
5737         P_ADJUSTED_DOC_DATE            => null                                       ,
5738         P_APPLIED_TO_APPLICATION_ID    => null                                       ,
5739         P_APPLIED_TO_EVT_CLASS_CODE    => null                                       ,
5740         P_APPLIED_TO_ENTITY_CODE       => null                                       ,
5741         P_APPLIED_TO_TRX_ID            => null                                       ,
5742         P_APPLIED_TO_TRX_LEVEL_TYPE    => null                                       ,
5743         P_APPLIED_TO_LINE_ID           => null                                       ,
5744         P_SUMMARY_TAX_LINE_ID          => g_suite_rec_tbl.summary_tax_line_id(i)     ,
5745         P_OFFSET_LINK_TO_TAX_LINE_ID   => null                                       ,
5746         P_OFFSET_FLAG                  => null                                       ,
5747         P_PROCESS_FOR_RECOVERY_FLAG    => null                                       ,
5748         P_TAX_JURISDICTION_ID          => g_suite_rec_tbl.tax_jurisdiction_id(i)     ,
5749         P_TAX_JURISDICTION_CODE        => null                                       ,
5750         P_PLACE_OF_SUPPLY              => null                                       ,
5751         P_PLACE_OF_SUPPLY_TYPE_CODE    => null                                       ,
5752         P_PLACE_OF_SUPPLY_RESULT_ID    => null                                       ,
5753         P_TAX_DATE_RULE_ID             => null                                       ,
5754         P_TAX_DATE                     => null                                       ,
5755         P_TAX_DETERMINE_DATE           => null                                       ,
5756         P_TAX_POINT_DATE               => null                                       ,
5757         P_TRX_LINE_DATE                => null                                       ,
5758         P_TAX_TYPE_CODE                => null                                       ,
5759         P_TAX_CODE                     => null                                       ,
5760         P_TAX_REGISTRATION_ID          => null                                       ,
5761         P_TAX_REGISTRATION_NUMBER      => g_suite_rec_tbl.tax_registration_number(i) ,
5762         P_REGISTRATION_PARTY_TYPE      => null                                       ,
5763         P_ROUNDING_LEVEL_CODE          => null                                       ,
5764         P_ROUNDING_RULE_CODE           => null                                       ,
5765         P_RNDG_LVL_PARTY_TAX_PROF_ID   => null                                       ,
5766         P_ROUNDING_LVL_PARTY_TYPE      => null                                       ,
5767         P_COMPOUNDING_TAX_FLAG         => null                                       ,
5768         P_ORIG_TAX_STATUS_ID           => null                                       ,
5769         P_ORIG_TAX_STATUS_CODE         => null                                       ,
5770         P_ORIG_TAX_RATE_ID             => null                                       ,
5771         P_ORIG_TAX_RATE_CODE           => null                                       ,
5772         P_ORIG_TAX_RATE                => null                                       ,
5773         P_ORIG_TAX_JURISDICTION_ID     => null                                       ,
5774         P_ORIG_TAX_JURISDICTION_CODE   => null                                       ,
5775         P_ORIG_TAX_AMT_INCLUDED_FLAG   => null                                       ,
5776         P_ORIG_SELF_ASSESSED_FLAG      => null                                       ,
5777         P_TAX_CURRENCY_CODE            => null                                       ,
5778         P_TAX_AMT                      => g_suite_rec_tbl.tax_amt(i)                 ,
5779         P_TAX_AMT_TAX_CURR             => null                                       ,
5780         P_TAX_AMT_FUNCL_CURR           => null                                       ,
5781         P_TAXABLE_AMT                  => g_suite_rec_tbl.taxable_amt(i)             ,
5782         P_TAXABLE_AMT_TAX_CURR         => null                                       ,
5783         P_TAXABLE_AMT_FUNCL_CURR       => null                                       ,
5784         P_ORIG_TAXABLE_AMT             => null                                       ,
5785         P_ORIG_TAXABLE_AMT_TAX_CURR    => null                                       ,
5786         P_CAL_TAX_AMT                  => null                                       ,
5787         P_CAL_TAX_AMT_TAX_CURR         => null                                       ,
5788         P_CAL_TAX_AMT_FUNCL_CURR       => null                                       ,
5789         P_ORIG_TAX_AMT                 => null                                       ,
5790         P_ORIG_TAX_AMT_TAX_CURR        => null                                       ,
5791         P_REC_TAX_AMT                  => g_suite_rec_tbl.rec_tax_amt(i)             ,
5792         P_REC_TAX_AMT_TAX_CURR         => null                                       ,
5793         P_REC_TAX_AMT_FUNCL_CURR       => null                                       ,
5794         P_NREC_TAX_AMT                 => g_suite_rec_tbl.nrec_tax_amt(i)            ,
5795         P_NREC_TAX_AMT_TAX_CURR        => null                                       ,
5796         P_NREC_TAX_AMT_FUNCL_CURR      => null                                       ,
5797         P_TAX_EXEMPTION_ID             => null                                       ,
5798         P_TAX_RATE_BEFORE_EXEMPTION    => null                                       ,
5799         P_TAX_RATE_NAME_BEFORE_EXEMPT  => null                                       ,
5800         P_EXEMPT_RATE_MODIFIER         => null                                       ,
5801         P_EXEMPT_CERTIFICATE_NUMBER    => g_suite_rec_tbl.exempt_certificate_number(i),
5802         P_EXEMPT_REASON                => null                                       ,
5803         P_EXEMPT_REASON_CODE           => g_suite_rec_tbl.exempt_reason_code(i)      ,
5804         P_TAX_EXCEPTION_ID             => null                                       ,
5805         P_TAX_RATE_BEFORE_EXCEPTION    => null                                       ,
5806         P_TAX_RATE_NAME_BEFORE_EXCEPT  => null                                       ,
5807         P_EXCEPTION_RATE               => null                                       ,
5808         P_TAX_APPORTIONMENT_FLAG       => null                                       ,
5809         P_HISTORICAL_FLAG              => null                                       ,
5810         P_TAXABLE_BASIS_FORMULA        => null                                       ,
5811         P_TAX_CALCULATION_FORMULA      => null                                       ,
5812         P_CANCEL_FLAG                  => g_suite_rec_tbl.cancel_flag(i)             ,
5813         P_PURGE_FLAG                   => null                                       ,
5814         P_DELETE_FLAG                  => null                                       ,
5815         P_TAX_AMT_INCLUDED_FLAG        => g_suite_rec_tbl.tax_amt_included_flag(i)   ,
5816         P_SELF_ASSESSED_FLAG           => g_suite_rec_tbl.self_assessed_flag(i)      ,
5817         P_OVERRIDDEN_FLAG              => null                                       ,
5818         P_MANUALLY_ENTERED_FLAG        => g_suite_rec_tbl.manually_entered_flag(i)   ,
5819         P_REPORTING_ONLY_FLAG          => null                                       ,
5820         P_FREEZE_UNTIL_OVERRIDDN_FLG   => null                                       ,
5821         P_COPIED_FROM_OTHER_DOC_FLAG   => null                                       ,
5822         P_RECALC_REQUIRED_FLAG         => null                                       ,
5823         P_SETTLEMENT_FLAG              => null                                       ,
5824         P_ITEM_DIST_CHANGED_FLAG       => null                                       ,
5825         P_ASSOC_CHILDREN_FROZEN_FLG    => null                                       ,
5826         P_TAX_ONLY_LINE_FLAG           => null                                       ,
5827         P_COMPOUNDING_DEP_TAX_FLAG     => null                                       ,
5828         P_COMPOUNDING_TAX_MISS_FLAG    => null                                       ,
5829         P_SYNC_WITH_PRVDR_FLAG         => null                                       ,
5830         P_LAST_MANUAL_ENTRY            => null                                       ,
5831         P_TAX_PROVIDER_ID              => null                                       ,
5832         P_RECORD_TYPE_CODE             => null                                       ,
5833         P_REPORTING_PERIOD_ID          => null                                       ,
5834         P_LEGAL_JUSTIFICATION_TEXT1    => null                                       ,
5835         P_LEGAL_JUSTIFICATION_TEXT2    => null                                       ,
5836         P_LEGAL_JUSTIFICATION_TEXT3    => null                                       ,
5837         P_LEGAL_MESSAGE_APPL_2         => null                                       ,
5838         P_LEGAL_MESSAGE_STATUS         => null                                       ,
5839         P_LEGAL_MESSAGE_RATE           => null                                       ,
5840         P_LEGAL_MESSAGE_BASIS          => null                                       ,
5841         P_LEGAL_MESSAGE_CALC           => null                                       ,
5842         P_LEGAL_MESSAGE_THRESHOLD      => null                                       ,
5843         P_LEGAL_MESSAGE_POS            => null                                       ,
5844         P_LEGAL_MESSAGE_TRN            => null                                       ,
5845         P_LEGAL_MESSAGE_EXMPT          => null                                       ,
5846         P_LEGAL_MESSAGE_EXCPT          => null                                       ,
5847         P_TAX_REGIME_TEMPLATE_ID       => null                                       ,
5848         P_TAX_APPLICABILITY_RESULT_ID  => null                                       ,
5849         P_DIRECT_RATE_RESULT_ID        => null                                       ,
5850         P_STATUS_RESULT_ID             => null                                       ,
5851         P_RATE_RESULT_ID               => null                                       ,
5852         P_BASIS_RESULT_ID              => null                                       ,
5853         P_THRESH_RESULT_ID             => null                                       ,
5854         P_CALC_RESULT_ID               => null                                       ,
5855         P_TAX_REG_NUM_DET_RESULT_ID    => null                                       ,
5856         P_EVAL_EXMPT_RESULT_ID         => null                                       ,
5857         P_EVAL_EXCPT_RESULT_ID         => null                                       ,
5858         P_ENFORCED_FROM_NAT_ACCT_FLG   => null                                       ,
5859         P_TAX_HOLD_CODE                => null                                       ,
5860         P_TAX_HOLD_RELEASED_CODE       => null                                       ,
5861         P_PRD_TOTAL_TAX_AMT            => null                                       ,
5862         P_PRD_TOTAL_TAX_AMT_TAX_CURR   => null                                       ,
5863         P_PRD_TOTAL_TAX_AMT_FUNCL_CURR => null                                       ,
5864         P_TRX_LINE_INDEX               => null                                       ,
5865         P_OFFSET_TAX_RATE_CODE         => null                                       ,
5866         P_PRORATION_CODE               => null                                       ,
5867         P_OTHER_DOC_SOURCE             => null                                       ,
5868         P_INTERNAL_ORG_LOCATION_ID     => null                                       ,
5869         P_LINE_ASSESSABLE_VALUE        => null                                       ,
5870         P_CTRL_TOTAL_LINE_TX_AMT       => g_suite_rec_tbl.ctrl_total_line_tx_amt(i)  ,
5871         P_APPLIED_TO_TRX_NUMBER        => null                                       , --added bug 4053445
5872         P_ATTRIBUTE_CATEGORY           => null                                       ,
5873         P_ATTRIBUTE1                   => null                                       ,
5874         P_ATTRIBUTE2                   => null                                       ,
5875         P_ATTRIBUTE3                   => null                                       ,
5876         P_ATTRIBUTE4                   => null                                       ,
5877         P_ATTRIBUTE5                   => null                                       ,
5878         P_ATTRIBUTE6                   => null                                       ,
5879         P_ATTRIBUTE7                   => null                                       ,
5880         P_ATTRIBUTE8                   => null                                       ,
5881         P_ATTRIBUTE9                   => null                                       ,
5882         P_ATTRIBUTE10                  => null                                       ,
5883         P_ATTRIBUTE11                  => null                                       ,
5884         P_ATTRIBUTE12                  => null                                       ,
5885         P_ATTRIBUTE13                  => null                                       ,
5886         P_ATTRIBUTE14                  => null                                       ,
5887         P_ATTRIBUTE15                  => null                                       ,
5888         P_GLOBAL_ATTRIBUTE_CATEGORY    => null                                       ,
5889         P_GLOBAL_ATTRIBUTE1            => null                                       ,
5890         P_GLOBAL_ATTRIBUTE2            => null                                       ,
5891         P_GLOBAL_ATTRIBUTE3            => null                                       ,
5892         P_GLOBAL_ATTRIBUTE4            => null                                       ,
5893         P_GLOBAL_ATTRIBUTE5            => null                                       ,
5894         P_GLOBAL_ATTRIBUTE6            => null                                       ,
5895         P_GLOBAL_ATTRIBUTE7            => null                                       ,
5896         P_GLOBAL_ATTRIBUTE8            => null                                       ,
5897         P_GLOBAL_ATTRIBUTE9            => null                                       ,
5898         P_GLOBAL_ATTRIBUTE10           => null                                       ,
5899         P_GLOBAL_ATTRIBUTE11           => null                                       ,
5900         P_GLOBAL_ATTRIBUTE12           => null                                       ,
5901         P_GLOBAL_ATTRIBUTE13           => null                                       ,
5902         P_GLOBAL_ATTRIBUTE14           => null                                       ,
5903         P_GLOBAL_ATTRIBUTE15           => null                                       ,
5904         P_NUMERIC1                     => null                                       ,
5905         P_NUMERIC2                     => null                                       ,
5906         P_NUMERIC3                     => null                                       ,
5907         P_NUMERIC4                     => null                                       ,
5908         P_NUMERIC5                     => null                                       ,
5909         P_NUMERIC6                     => null                                       ,
5910         P_NUMERIC7                     => null                                       ,
5911         P_NUMERIC8                     => null                                       ,
5912         P_NUMERIC9                     => null                                       ,
5913         P_NUMERIC10                    => null                                       ,
5914         P_CHAR1                        => null                                       ,
5915         P_CHAR2                        => null                                       ,
5916         P_CHAR3                        => null                                       ,
5917         P_CHAR4                        => null                                       ,
5918         P_CHAR5                        => null                                       ,
5919         P_CHAR6                        => null                                       ,
5920         P_CHAR7                        => null                                       ,
5921         P_CHAR8                        => null                                       ,
5922         P_CHAR9                        => null                                       ,
5923         P_CHAR10                       => null                                       ,
5924         P_DATE1                        => null                                       ,
5925         P_DATE2                        => null                                       ,
5926         P_DATE3                        => null                                       ,
5927         P_DATE4                        => null                                       ,
5928         P_DATE5                        => null                                       ,
5929         P_DATE6                        => null                                       ,
5930         P_DATE7                        => null                                       ,
5931         P_DATE8                        => null                                       ,
5932         P_DATE9                        => null                                       ,
5933         P_DATE10                       => null                                       ,
5934         P_INTERFACE_ENTITY_CODE        => null                                       ,
5935         P_INTERFACE_TAX_LINE_ID        => null                                       ,
5936         P_TAXING_JURIS_GEOGRAPHY_ID    => null                                       ,
5937         P_ADJUSTED_DOC_TAX_LINE_ID     => null                                       ,
5938         P_OBJECT_VERSION_NUMBER        => l_object_version_number                    ,
5939         P_CREATED_BY                   => 1      , ---------------------------------
5940         P_CREATION_DATE                => sysdate, -- What are the correct values
5941         P_LAST_UPDATED_BY              => 1      , -- to pass for the Who Columns?
5942         P_LAST_UPDATE_DATE             => sysdate, -- Review this later.
5943         P_LAST_UPDATE_LOGIN            => 1 );      ---------------------------------
5944 
5945       END LOOP;
5946       write_message('Service ZX_TRL_DETAIL_OVERRIDE_PKG.Delete_Row has been called!.');
5947       write_message('For Suite: '||p_suite_number||' and Case: '||p_case_number);
5948       write_message('x_return_status : '||l_return_status);
5949       write_message('x_msg_count     : '||l_msg_count    );
5950       write_message('x_msg_data      : '||l_msg_data     );
5951 
5952 
5953     -------------------------------------------------------------
5954     -- Call the APIs for the case has been just finished reading.
5955     -------------------------------------------------------------
5956     ELSIF p_api_service = 'OVERRIDE_SUMMARY_ENTER_MANUAL_TAX_LINE' THEN
5957       ----------------------------------------------
5958       -- Get inital and ending row for the structure
5959       ----------------------------------------------
5960       get_start_end_rows_structure
5961        (
5962          p_suite      => p_suite_number,
5963          p_case       => p_case_number,
5964          p_structure  => 'STRUCTURE_OVERRIDE_SUMMARY_TAX_LINES',
5965          x_start_row  => l_start_row,
5966          x_end_row    => l_end_row
5967        );
5968 
5969       /* Not found in ZX_TRL_SUMMARY_OVERRIDE_PKG.insert_row following
5970       columns
5971          P_TRX_LEVEL_TYPE           => g_suite_rec_tbl.TRX_LEVEL_TYPE(i)       ,
5972          P_SUMMARY_TAX_LINE_NUMBER  => g_suite_rec_tbl.SUMMARY_TAX_LINE_NUMBER(i),
5973          P_TAX_JURISDICTION_ID      => g_suite_rec_tbl.TAX_JURISDICTION_ID(i)  , --THERE IS ONLY CODE */
5974 
5975       FOR i IN l_start_row..l_end_row LOOP
5976       ZX_TRL_SUMMARY_OVERRIDE_PKG.insert_row(
5977         X_ROWID                        => l_row_id                                ,
5978         P_SUMMARY_TAX_LINE_ID          => g_suite_rec_tbl.SUMMARY_TAX_LINE_ID(i)  ,
5979         P_INTERNAL_ORGANIZATION_ID     => g_suite_rec_tbl.INTERNAL_ORGANIZATION_ID(i),
5980         P_APPLICATION_ID               => g_suite_rec_tbl.APPLICATION_ID(i)       ,
5981         P_ENTITY_CODE                  => g_suite_rec_tbl.ENTITY_CODE(i)          ,
5982         P_EVENT_CLASS_CODE             => g_suite_rec_tbl.EVENT_CLASS_CODE(i)     ,
5983         P_TRX_ID                       => g_suite_rec_tbl.TRX_ID(i)               ,
5984         P_SUMMARY_TAX_LINE_NUMBER      => null                                    ,
5985         P_TRX_NUMBER                   => g_suite_rec_tbl.TRX_NUMBER(i)           ,
5986         P_APPLIED_FROM_APPLICATION_ID  => null                                    ,
5987         P_APPLIED_FROM_EVT_CLASS_CODE  => null                                    ,
5988         P_APPLIED_FROM_ENTITY_CODE     => null                                    ,
5989         P_APPLIED_FROM_TRX_ID          => null                                    ,
5990         P_APPLIED_FROM_TRX_LEVEL_TYPE  => null                                    ,
5991         P_APPLIED_FROM_LINE_ID         => null                                    ,
5992         P_ADJUSTED_DOC_APPLICATION_ID  => null                                    ,
5993         P_ADJUSTED_DOC_ENTITY_CODE     => g_suite_rec_tbl.adjusted_doc_entity_code(i),
5994         P_ADJUSTED_DOC_EVT_CLASS_CODE  => null                                    ,
5995         P_ADJUSTED_DOC_TRX_ID          => null                                    ,
5996         P_ADJUSTED_DOC_TRX_LEVEL_TYPE  => null                                    ,
5997         P_APPLIED_TO_APPLICATION_ID    => null                                    ,
5998         P_APPLIED_TO_EVENT_CLASS_CODE  => null                                    ,
5999         P_APPLIED_TO_ENTITY_CODE       => null                                    ,
6000         P_APPLIED_TO_TRX_ID            => null                                    ,
6001         P_APPLIED_TO_TRX_LEVEL_TYPE    => null                                    ,
6002         P_APPLIED_TO_LINE_ID           => null                                    ,
6003         P_TAX_EXEMPTION_ID             => null                                    ,
6004         P_TAX_RATE_BEFORE_EXEMPTION    => null                                    ,
6005         P_TAX_RATE_NAME_BEFORE_EXEMPT  => null                                    ,
6006         P_EXEMPT_RATE_MODIFIER         => null                                    ,
6007         P_EXEMPT_CERTIFICATE_NUMBER    => null                                    ,
6008         P_EXEMPT_REASON                => null                                    ,
6009         P_EXEMPT_REASON_CODE           => null                                    ,
6010         P_TAX_RATE_BEFORE_EXCEPTION    => null                                    ,
6011         P_TAX_RATE_NAME_BEFORE_EXCEPT  => null                                    ,
6012         P_TAX_EXCEPTION_ID             => null                                    ,
6013         P_EXCEPTION_RATE               => null                                    ,
6014         P_CONTENT_OWNER_ID             => null                                    ,
6015         P_TAX_REGIME_CODE              => g_suite_rec_tbl.TAX_REGIME_CODE(i)      ,
6016         P_TAX                          => g_suite_rec_tbl.TAX(i)                  ,
6017         P_TAX_STATUS_CODE              => g_suite_rec_tbl.TAX_STATUS_CODE(i)      ,
6018         P_TAX_RATE_ID                  => g_suite_rec_tbl.TAX_RATE_ID(i)          ,
6019         P_TAX_RATE_CODE                => g_suite_rec_tbl.TAX_RATE_CODE(i)        ,
6020         P_TAX_RATE                     => g_suite_rec_tbl.TAX_RATE(i)             ,
6021         P_TAX_AMT                      => g_suite_rec_tbl.TAX_AMT(i)              ,
6022         P_TAX_AMT_TAX_CURR             => null                                    ,
6023         P_TAX_AMT_FUNCL_CURR           => null                                    ,
6024         P_TAX_JURISDICTION_CODE        => null                                    ,
6025         P_TOTAL_REC_TAX_AMT            => g_suite_rec_tbl.TOTAL_REC_TAX_AMT(i)    ,
6026         P_TOTAL_REC_TAX_AMT_FUNC_CURR  => null                                    ,
6027         P_TOTAL_REC_TAX_AMT_TAX_CURR   => null                                    ,
6028         P_TOTAL_NREC_TAX_AMT           => g_suite_rec_tbl.TOTAL_NREC_TAX_AMT(i)   ,
6029         P_TOTAL_NREC_TAX_AMT_FUNC_CURR => null                                    ,
6030         P_TOTAL_NREC_TAX_AMT_TAX_CURR  => null                                    ,
6031         P_LEDGER_ID                    => g_suite_rec_tbl.LEDGER_ID(i)            ,
6032         P_LEGAL_ENTITY_ID              => null                                    ,
6033         P_ESTABLISHMENT_ID             => null                                    ,
6034         P_CURRENCY_CONVERSION_DATE     => null                                    ,
6035         P_CURRENCY_CONVERSION_TYPE     => null                                    ,
6036         P_CURRENCY_CONVERSION_RATE     => null                                    ,
6037         P_SUMMARIZATION_TEMPLATE_ID    => null                                    ,
6038         P_TAXABLE_BASIS_FORMULA        => null                                    ,
6039         P_TAX_CALCULATION_FORMULA      => null                                    ,
6040         P_HISTORICAL_FLAG              => null                                    ,
6041         P_CANCEL_FLAG                  => g_suite_rec_tbl.CANCEL_FLAG(i)          ,
6042         P_DELETE_FLAG                  => null                                    ,
6043         P_TAX_AMT_INCLUDED_FLAG        => g_suite_rec_tbl.TAX_AMT_INCLUDED_FLAG(i),
6044         P_COMPOUNDING_TAX_FLAG         => null                                    ,
6045         P_SELF_ASSESSED_FLAG           => g_suite_rec_tbl.SELF_ASSESSED_FLAG(i)   ,
6046         P_OVERRIDDEN_FLAG              => null                                    ,
6047         P_REPORTING_ONLY_FLAG          => null                                    ,
6048         P_ASSOC_CHILD_FROZEN_FLAG      => null                                    ,
6049         P_COPIED_FROM_OTHER_DOC_FLAG   => null                                    ,
6050         P_MANUALLY_ENTERED_FLAG        => g_suite_rec_tbl.MANUALLY_ENTERED_FLAG(i),
6051         P_MRC_TAX_LINE_FLAG            => null                                    ,
6052         P_LAST_MANUAL_ENTRY            => null                                    ,
6053         P_RECORD_TYPE_CODE             => null                                    ,
6054         P_TAX_PROVIDER_ID              => null                                    ,
6055         P_TAX_ONLY_LINE_FLAG           => null                                    ,
6056         P_ADJUST_TAX_AMT_FLAG          => null                                    ,
6057         P_ATTRIBUTE_CATEGORY           => null                                    ,
6058         P_ATTRIBUTE1                   => null                                    ,
6059         P_ATTRIBUTE2                   => null                                    ,
6060         P_ATTRIBUTE3                   => null                                    ,
6061         P_ATTRIBUTE4                   => null                                    ,
6062         P_ATTRIBUTE5                   => null                                    ,
6063         P_ATTRIBUTE6                   => null                                    ,
6064         P_ATTRIBUTE7                   => null                                    ,
6065         P_ATTRIBUTE8                   => null                                    ,
6066         P_ATTRIBUTE9                   => null                                    ,
6067         P_ATTRIBUTE10                  => null                                    ,
6068         P_ATTRIBUTE11                  => null                                    ,
6069         P_ATTRIBUTE12                  => null                                    ,
6070         P_ATTRIBUTE13                  => null                                    ,
6071         P_ATTRIBUTE14                  => null                                    ,
6072         P_ATTRIBUTE15                  => null                                    ,
6073         P_GLOBAL_ATTRIBUTE_CATEGORY    => null                                    ,
6074         P_GLOBAL_ATTRIBUTE1            => null                                    ,
6075         P_GLOBAL_ATTRIBUTE2            => null                                    ,
6076         P_GLOBAL_ATTRIBUTE3            => null                                    ,
6077         P_GLOBAL_ATTRIBUTE4            => null                                    ,
6078         P_GLOBAL_ATTRIBUTE5            => null                                    ,
6079         P_GLOBAL_ATTRIBUTE6            => null                                    ,
6080         P_GLOBAL_ATTRIBUTE7            => null                                    ,
6081         P_GLOBAL_ATTRIBUTE8            => null                                    ,
6082         P_GLOBAL_ATTRIBUTE9            => null                                    ,
6083         P_GLOBAL_ATTRIBUTE10           => null                                    ,
6084         P_GLOBAL_ATTRIBUTE11           => null                                    ,
6085         P_GLOBAL_ATTRIBUTE12           => null                                    ,
6086         P_GLOBAL_ATTRIBUTE13           => null                                    ,
6087         P_GLOBAL_ATTRIBUTE14           => null                                    ,
6088         P_GLOBAL_ATTRIBUTE15           => null                                    ,
6089         P_GLOBAL_ATTRIBUTE16           => null                                    ,
6090         P_GLOBAL_ATTRIBUTE17           => null                                    ,
6091         P_GLOBAL_ATTRIBUTE18           => null                                    ,
6092         P_GLOBAL_ATTRIBUTE19           => null                                    ,
6093         P_GLOBAL_ATTRIBUTE20           => null                                    ,
6094         P_OBJECT_VERSION_NUMBER        => 1                                       ,
6095         P_CREATED_BY                   => 1      , ---------------------------------
6096         P_CREATION_DATE                => sysdate, -- What are the correct values
6097         P_LAST_UPDATED_BY              => 1      , -- to pass for the Who Columns?
6098         P_LAST_UPDATE_DATE             => sysdate, -- Review this later.
6099         P_LAST_UPDATE_LOGIN            => 1 );      ---------------------------------
6100 
6101 
6102       END LOOP;
6103       write_message('Service ZX_TRL_DETAIL_OVERRIDE_PKG.Delete_Row has been called!.');
6104       write_message('For Suite: '||p_suite_number||' and Case: '||p_case_number);
6105       write_message('x_return_status : '||l_return_status);
6106       write_message('x_msg_count     : '||l_msg_count    );
6107       write_message('x_msg_data      : '||l_msg_data     );
6108 
6109 
6110       FOR i IN l_start_row..l_end_row LOOP
6111         write_message('Calling zx_trl_allocations_pkg.insert_row');
6112 
6113       zx_trl_allocations_pkg.insert_row(
6114         X_ROWID                        => l_row_id                                   ,
6115         P_SUMMARY_TAX_LINE_ID          => g_suite_rec_tbl.summary_tax_line_id(i)     ,
6116         P_INTERNAL_ORGANIZATION_ID     => g_suite_rec_tbl.internal_organization_id(i),
6117         P_APPLICATION_ID               => g_suite_rec_tbl.application_id(i)          ,
6118         P_ENTITY_CODE                  => g_suite_rec_tbl.entity_code(i)             ,
6119         P_EVENT_CLASS_CODE             => g_suite_rec_tbl.event_class_code(i)        ,
6120         P_EVENT_TYPE_CODE              => g_suite_rec_tbl.event_type_code(i)         ,
6121         P_TRX_LINE_NUMBER              => g_suite_rec_tbl.trx_line_number(i)         ,
6122         P_TRX_ID                       => g_suite_rec_tbl.trx_id(i)                  ,
6123         P_TRX_NUMBER                   => null                                       ,
6124         P_TRX_LINE_ID                  => g_suite_rec_tbl.trx_line_id(i)             ,
6125         P_TRX_LEVEL_TYPE               => g_suite_rec_tbl.trx_level_type(i)          ,
6126         P_LINE_AMT                     => null                                       ,
6127         P_TRX_LINE_DATE                => null                                       ,
6128         --P_TAX_REGIME_ID                => null                                     ,
6129         P_TAX_REGIME_CODE              => g_suite_rec_tbl.tax_regime_code(i)         ,
6130         --P_TAX_ID                       => null                                     ,
6131         P_TAX                          => g_suite_rec_tbl.tax(i)                     ,
6132         --P_TAX_JURISDICTION_ID          => g_suite_rec_tbl.tax_jurisdiction_id(i)   ,
6133         P_TAX_JURISDICTION_CODE        => null                                       ,
6134         --P_TAX_STATUS_ID                => null                                       ,
6135         P_TAX_STATUS_CODE              => g_suite_rec_tbl.tax_status_code(i)         ,
6136         P_TAX_RATE_ID                  => g_suite_rec_tbl.tax_rate_id(i)             ,
6137         P_TAX_RATE_CODE                => g_suite_rec_tbl.tax_rate_code(i)           ,
6138         P_TAX_RATE                     => g_suite_rec_tbl.tax_rate(i)                ,
6139         P_TAX_AMT                      => g_suite_rec_tbl.tax_amt(i)                 ,
6140         P_ENABLED_RECORD               => null                                       ,
6141         --P_HDR_TRX_USER_KEY1          => null                                       ,
6142         --P_HDR_TRX_USER_KEY2          => null                                       ,
6143         --P_HDR_TRX_USER_KEY3          => null                                       ,
6144         --P_HDR_TRX_USER_KEY4          => null                                       ,
6145         --P_HDR_TRX_USER_KEY5          => null                                       ,
6146         --P_HDR_TRX_USER_KEY6          => null                                       ,
6147         --P_LINE_TRX_USER_KEY1         => null                                       ,
6148         --P_LINE_TRX_USER_KEY2         => null                                       ,
6149         --P_LINE_TRX_USER_KEY3         => null                                       ,
6150         --P_LINE_TRX_USER_KEY4         => null                                       ,
6151         --P_LINE_TRX_USER_KEY5         => null                                       ,
6152         --P_LINE_TRX_USER_KEY6         => null                                       ,
6153         P_MANUALLY_ENTERED_FLAG        => null                                       ,
6154         P_CONTENT_OWNER_ID             => null                                       ,
6155         P_RECORD_TYPE_CODE             => null                                       ,
6156         P_LAST_MANUAL_ENTRY            => null                                       ,
6157         P_TRX_LINE_AMT                 => null                                       ,
6158         P_TAX_AMT_INCLUDED_FLAG        => null                                       ,
6159         P_SELF_ASSESSED_FLAG           => null                                       ,
6160         P_TAX_ONLY_LINE_FLAG           => null                                       ,
6161         P_CREATED_BY                   => 1       , ---------------------------------
6162         P_CREATION_DATE                => sysdate , -- What are the correct values
6163         P_LAST_UPDATED_BY              => 1       , -- to pass for the Who Columns?
6164         P_LAST_UPDATE_DATE             => sysdate , -- Review this later.
6165         P_LAST_UPDATE_LOGIN            => 1 );      ---------------------------------
6166 
6167       END LOOP;
6168       write_message('Service zx_trl_allocations_pkg.Insert_row has been called!.');
6169       write_message('For Suite: '||p_suite_number||' and Case: '||p_case_number);
6170       write_message('x_return_status : '||l_return_status);
6171       write_message('x_msg_count     : '||l_msg_count    );
6172       write_message('x_msg_data      : '||l_msg_data     );
6173 
6174      -----------------------------------------------------------------------
6175      -- Note: ZX_TRL_ALLOCATIONS_PKG.UPDATE_ROW and
6176      --       ZX_TRL_ALLOCATIONS_PKG.LOCK_ROWS and
6177      --       ZX_TRL_ALLOCATIONS_PKG.DELETE_ROW have been removed in TRL pkg
6178      --       10-DEC-2004
6179      -----------------------------------------------------------------------
6180 
6181 /*      FOR i in l_start_row..l_end_row LOOP
6182         zx_trl_allocations_pkg.lock_row
6183         (
6184           X_ROWID             => l_row_id,
6185           P_CREATED_BY        => 1       , ------------------------------
6186           P_CREATION_DATE     => sysdate , -- What are to correct values
6187           P_LAST_UPDATED_BY   => 1       , -- to pass to Who Columns?
6188           P_LAST_UPDATE_DATE  => sysdate , ------------------------------
6189           P_LAST_UPDATE_LOGIN => 1
6190         ); null;
6191       END LOOP;
6192       write_message('Service zx_trl_allocations_pkg.lock_row has been called!.');
6193       write_message('For Suite: '||p_suite_number||' and Case: '||p_case_number);
6194       write_message('x_return_status : '||l_return_status);
6195       write_message('x_msg_count     : '||l_msg_count    );
6196       write_message('x_msg_data      : '||l_msg_data     );
6197 
6198 
6199       FOR i IN l_start_row..l_end_row LOOP
6200         zx_trl_allocations_pkg.Update_row
6201           (
6202           X_ROWID                    => l_row_id                                    ,
6203           P_SUMMARY_TAX_LINE_ID      => g_suite_rec_tbl.summary_tax_line_id(i)      ,
6204           P_INTERNAL_ORGANIZATION_ID => g_suite_rec_tbl.internal_organization_id(i) ,
6205           P_APPLICATION_ID           => g_suite_rec_tbl.application_id(i)           ,
6206           P_ENTITY_CODE              => g_suite_rec_tbl.entity_code(i)              ,
6207           P_EVENT_CLASS_CODE         => g_suite_rec_tbl.event_class_code(i)         ,
6208           P_EVENT_TYPE_CODE          => g_suite_rec_tbl.event_type_code(i)          ,
6209           P_TRX_LINE_ID              => g_suite_rec_tbl.trx_line_id(i)              ,
6210           P_TRX_LINE_NUMBER          => g_suite_rec_tbl.trx_line_number(i)          ,
6211           P_TAX_EVENT_CLASS_CODE     => null                                        ,
6212           P_TAX_EVENT_TYPE_CODE      => null                                        ,
6213           P_TRX_ID                   => g_suite_rec_tbl.trx_id(i)                   ,
6214           P_TAX_LINE_ID              => g_suite_rec_tbl.tax_line_id(i)              ,
6215           P_TAX_LINE_NUMBER          => null                                        ,
6216           P_TAX_AMT                  => g_suite_rec_tbl.tax_amt(i)                  ,
6217           P_ENABLED_RECORD           => null                                        ,
6218           P_CREATED_BY               => null                                        ,
6219           P_CREATION_DATE            => null                                        ,
6220           P_LAST_UPDATED_BY          => null                                        ,
6221           P_LAST_UPDATE_DATE         => null                                        ,
6222           P_LAST_UPDATE_LOGIN        => null
6223           ); null;
6224 
6225 
6226      END LOOP;
6227      write_message('Service zx_trl_allocations_pkg.Update_row has been called!.');
6228      write_message('For Suite: '||p_suite_number||' and Case: '||p_case_number);
6229      write_message('x_return_status : '||l_return_status);
6230      write_message('x_msg_count     : '||l_msg_count    );
6231      write_message('x_msg_data      : '||l_msg_data     );
6232 
6233      FOR i in l_start_row..l_end_row LOOP
6234        zx_trl_allocations_pkg.Delete_row
6235         (
6236         X_ROWID                    => l_row_id                                   ,
6237         P_SUMMARY_TAX_LINE_ID      => g_suite_rec_tbl.summary_tax_line_id(i)     ,
6238         P_INTERNAL_ORGANIZATION_ID => g_suite_rec_tbl.internal_organization_id(i),
6239         P_APPLICATION_ID           => g_suite_rec_tbl.application_id(i)          ,
6240         P_ENTITY_CODE              => g_suite_rec_tbl.entity_code(i)             ,
6241         P_EVENT_CLASS_CODE         => g_suite_rec_tbl.event_class_code(i)        ,
6242         P_EVENT_TYPE_CODE          => g_suite_rec_tbl.event_type_code(i)         ,
6243         P_TRX_ID                   => g_suite_rec_tbl.trx_id(i)
6244         );
6245 
6246      END LOOP;
6247      write_message('Service zx_trl_allocations_pkg.Delete_row has been called!.');
6248      write_message('For Suite: '||p_suite_number||' and Case: '||p_case_number);
6249      write_message('x_return_status : '||l_return_status);
6250      write_message('x_msg_count     : '||l_msg_count    );
6251      write_message('x_msg_data      : '||l_msg_data     );
6252 */
6253 
6254     ELSIF p_api_service = 'OVERRIDE_SUMMARY_UPDATE_TAX_LINE' THEN
6255 
6256       FOR i in g_suite_rec_tbl.application_id.FIRST..g_suite_rec_tbl.application_id.LAST LOOP
6257 
6258       select object_version_number
6259       into l_object_version_number
6260       from zx_lines_summary
6261       where application_id =g_suite_rec_tbl.application_id(i)
6262         and entity_code = g_suite_rec_tbl.entity_code(i)
6263         and event_class_code = g_suite_rec_tbl.event_class_code(i)
6264         and trx_id = g_suite_rec_tbl.trx_id(i)
6265         and summary_tax_line_id = g_suite_rec_tbl.summary_tax_line_id(i) ;
6266 
6267       ZX_TRL_SUMMARY_OVERRIDE_PKG.Lock_row(
6268         X_ROWID                        => l_row_id                                   ,
6269         P_SUMMARY_TAX_LINE_ID          => g_suite_rec_tbl.SUMMARY_TAX_LINE_ID(i)     ,
6270         P_INTERNAL_ORGANIZATION_ID     => g_suite_rec_tbl.INTERNAL_ORGANIZATION_ID(i),
6271         P_APPLICATION_ID               => g_suite_rec_tbl.APPLICATION_ID(i)          ,
6272         P_ENTITY_CODE                  => g_suite_rec_tbl.ENTITY_CODE(i)             ,
6273         P_EVENT_CLASS_CODE             => g_suite_rec_tbl.EVENT_CLASS_CODE(i)        ,
6274         P_TRX_ID                       => g_suite_rec_tbl.TRX_ID(i)                  ,
6275         P_SUMMARY_TAX_LINE_NUMBER      => g_suite_rec_tbl.SUMMARY_TAX_LINE_NUMBER(i) ,
6276         P_TRX_NUMBER                   => g_suite_rec_tbl.TRX_NUMBER(i)              ,
6277         P_APPLIED_FROM_APPLICATION_ID  => null                                       ,
6278         P_APPLIED_FROM_EVT_CLASS_CODE  => null                                       ,
6279         P_APPLIED_FROM_ENTITY_CODE     => null                                       ,
6280         P_APPLIED_FROM_TRX_ID          => null                                       ,
6281         P_APPLIED_FROM_TRX_LEVEL_TYPE  => null                                       ,
6282         P_APPLIED_FROM_LINE_ID         => null                                       ,
6283         P_ADJUSTED_DOC_APPLICATION_ID  => null                                       ,
6284         P_ADJUSTED_DOC_ENTITY_CODE     => g_suite_rec_tbl.adjusted_doc_entity_code(i),
6285         P_ADJUSTED_DOC_EVT_CLASS_CODE  => null                                       ,
6286         P_ADJUSTED_DOC_TRX_ID          => null                                       ,
6287         P_ADJUSTED_DOC_TRX_LEVEL_TYPE  => null                                       ,
6288         P_APPLIED_TO_APPLICATION_ID    => null                                       ,
6289         P_APPLIED_TO_EVENT_CLASS_CODE  => null                                       ,
6290         P_APPLIED_TO_ENTITY_CODE       => null                                       ,
6291         P_APPLIED_TO_TRX_ID            => null                                       ,
6292         P_APPLIED_TO_TRX_LEVEL_TYPE    => null                                       ,
6293         P_APPLIED_TO_LINE_ID           => null                                       ,
6294         P_TAX_EXEMPTION_ID             => null                                       ,
6295         P_TAX_RATE_BEFORE_EXEMPTION    => null                                       ,
6296         P_TAX_RATE_NAME_BEFORE_EXEMPT  => null                                       ,
6297         P_EXEMPT_RATE_MODIFIER         => null                                       ,
6298         P_EXEMPT_CERTIFICATE_NUMBER    => null                                       ,
6299         P_EXEMPT_REASON                => null                                       ,
6300         P_EXEMPT_REASON_CODE           => null                                       ,
6301         P_TAX_RATE_BEFORE_EXCEPTION    => null                                       ,
6302         P_TAX_RATE_NAME_BEFORE_EXCEPT  => null                                       ,
6303         P_TAX_EXCEPTION_ID             => null                                       ,
6304         P_EXCEPTION_RATE               => null                                       ,
6305         P_CONTENT_OWNER_ID             => null                                       ,
6306         P_TAX_REGIME_CODE              => g_suite_rec_tbl.TAX_REGIME_CODE(i)         ,
6307         P_TAX                          => g_suite_rec_tbl.TAX(i)                     ,
6308         P_TAX_STATUS_CODE              => g_suite_rec_tbl.TAX_STATUS_CODE(i)         ,
6309         P_TAX_RATE_ID                  => g_suite_rec_tbl.TAX_RATE_ID(i)             ,
6310         P_TAX_RATE_CODE                => g_suite_rec_tbl.TAX_RATE_CODE(i)           ,
6311         P_TAX_RATE                     => g_suite_rec_tbl.TAX_RATE(i)                ,
6312         P_TAX_AMT                      => g_suite_rec_tbl.TAX_AMT(i)                 ,
6313         P_TAX_AMT_TAX_CURR             => null                                       ,
6314         P_TAX_AMT_FUNCL_CURR           => null                                       ,
6315         P_TAX_JURISDICTION_CODE        => null                                       ,
6316         P_TOTAL_REC_TAX_AMT            => g_suite_rec_tbl.TOTAL_REC_TAX_AMT(i)       ,
6317         P_TOTAL_REC_TAX_AMT_FUNC_CURR  => null                                       ,
6318         P_TOTAL_REC_TAX_AMT_TAX_CURR   => null                                       ,
6319         P_TOTAL_NREC_TAX_AMT           => g_suite_rec_tbl.TOTAL_NREC_TAX_AMT(i)      ,
6320         P_TOTAL_NREC_TAX_AMT_FUNC_CURR => null                                       ,
6321         P_TOTAL_NREC_TAX_AMT_TAX_CURR  => null                                       ,
6322         P_LEDGER_ID                    => g_suite_rec_tbl.LEDGER_ID(i)               ,
6323         P_LEGAL_ENTITY_ID              => null                                       ,
6324         P_ESTABLISHMENT_ID             => null                                       ,
6325         P_CURRENCY_CONVERSION_DATE     => null                                       ,
6326         P_CURRENCY_CONVERSION_TYPE     => null                                       ,
6327         P_CURRENCY_CONVERSION_RATE     => null                                       ,
6328         P_SUMMARIZATION_TEMPLATE_ID    => null                                       ,
6329         P_TAXABLE_BASIS_FORMULA        => null                                       ,
6330         P_TAX_CALCULATION_FORMULA      => null                                       ,
6331         P_HISTORICAL_FLAG              => null                                       ,
6332         P_CANCEL_FLAG                  => g_suite_rec_tbl.CANCEL_FLAG(i)             ,
6333         P_DELETE_FLAG                  => null                                       ,
6334         P_TAX_AMT_INCLUDED_FLAG        => g_suite_rec_tbl.TAX_AMT_INCLUDED_FLAG(i)   ,
6335         P_COMPOUNDING_TAX_FLAG         => null                                       ,
6336         P_SELF_ASSESSED_FLAG           => g_suite_rec_tbl.SELF_ASSESSED_FLAG(i)      ,
6337         P_OVERRIDDEN_FLAG              => null                                       ,
6338         P_REPORTING_ONLY_FLAG          => null                                       ,
6339         P_ASSOC_CHILD_FROZEN_FLAG      => null                                       ,
6340         P_COPIED_FROM_OTHER_DOC_FLAG   => null                                       ,
6341         P_MANUALLY_ENTERED_FLAG        => g_suite_rec_tbl.MANUALLY_ENTERED_FLAG(i)   ,
6342         P_MRC_TAX_LINE_FLAG            => null                                       ,
6343         P_LAST_MANUAL_ENTRY            => null                                       ,
6344         P_RECORD_TYPE_CODE             => null                                       ,
6345         P_TAX_PROVIDER_ID              => null                                       ,
6346         P_TAX_ONLY_LINE_FLAG           => null                                       ,
6347         P_ADJUST_TAX_AMT_FLAG          => null                                       ,
6348         P_ATTRIBUTE_CATEGORY           => null                                       ,
6349         P_ATTRIBUTE1                   => null                                       ,
6350         P_ATTRIBUTE2                   => null                                       ,
6351         P_ATTRIBUTE3                   => null                                       ,
6352         P_ATTRIBUTE4                   => null                                       ,
6353         P_ATTRIBUTE5                   => null                                       ,
6354         P_ATTRIBUTE6                   => null                                       ,
6355         P_ATTRIBUTE7                   => null                                       ,
6356         P_ATTRIBUTE8                   => null                                       ,
6357         P_ATTRIBUTE9                   => null                                       ,
6358         P_ATTRIBUTE10                  => null                                       ,
6359         P_ATTRIBUTE11                  => null                                       ,
6360         P_ATTRIBUTE12                  => null                                       ,
6361         P_ATTRIBUTE13                  => null                                       ,
6362         P_ATTRIBUTE14                  => null                                       ,
6363         P_ATTRIBUTE15                  => null                                       ,
6364         P_GLOBAL_ATTRIBUTE_CATEGORY    => null                                       ,
6365         P_GLOBAL_ATTRIBUTE1            => null                                       ,
6366         P_GLOBAL_ATTRIBUTE2            => null                                       ,
6367         P_GLOBAL_ATTRIBUTE3            => null                                       ,
6368         P_GLOBAL_ATTRIBUTE4            => null                                       ,
6369         P_GLOBAL_ATTRIBUTE5            => null                                       ,
6370         P_GLOBAL_ATTRIBUTE6            => null                                       ,
6371         P_GLOBAL_ATTRIBUTE7            => null                                       ,
6372         P_GLOBAL_ATTRIBUTE8            => null                                       ,
6373         P_GLOBAL_ATTRIBUTE9            => null                                       ,
6374         P_GLOBAL_ATTRIBUTE10           => null                                       ,
6375         P_GLOBAL_ATTRIBUTE11           => null                                       ,
6376         P_GLOBAL_ATTRIBUTE12           => null                                       ,
6377         P_GLOBAL_ATTRIBUTE13           => null                                       ,
6378         P_GLOBAL_ATTRIBUTE14           => null                                       ,
6379         P_GLOBAL_ATTRIBUTE15           => null                                       ,
6380         P_GLOBAL_ATTRIBUTE16           => null                                       ,
6381         P_GLOBAL_ATTRIBUTE17           => null                                       ,
6382         P_GLOBAL_ATTRIBUTE18           => null                                       ,
6383         P_GLOBAL_ATTRIBUTE19           => null                                       ,
6384         P_GLOBAL_ATTRIBUTE20           => null                                       ,
6385         P_OBJECT_VERSION_NUMBER        => l_object_version_number                    ,
6386         P_CREATED_BY                   => 1       , ---------------------------------
6387         P_CREATION_DATE                => sysdate , -- What are the correct values
6388         P_LAST_UPDATED_BY              => 1       , -- to pass for the Who Columns?
6389         P_LAST_UPDATE_DATE             => sysdate , -- Review this later.
6390         P_LAST_UPDATE_LOGIN            => 1 );      ---------------------------------
6391 
6392         null;
6393    END LOOP;
6394 
6395       FOR i in g_suite_rec_tbl.application_id.FIRST..g_suite_rec_tbl.application_id.LAST LOOP
6396 
6397       select object_version_number
6398       into l_object_version_number
6399       from zx_lines_summary
6400       where application_id =g_suite_rec_tbl.application_id(i)
6401         and entity_code = g_suite_rec_tbl.entity_code(i)
6402         and event_class_code = g_suite_rec_tbl.event_class_code(i)
6403         and trx_id = g_suite_rec_tbl.trx_id(i)
6404         and summary_tax_line_id = g_suite_rec_tbl.summary_tax_line_id(i) ;
6405 
6406      ZX_TRL_SUMMARY_OVERRIDE_PKG.Update_row(
6407         --X_ROWID                        => l_row_id                                   ,
6408         P_SUMMARY_TAX_LINE_ID          => g_suite_rec_tbl.SUMMARY_TAX_LINE_ID(i)     ,
6409         P_INTERNAL_ORGANIZATION_ID     => g_suite_rec_tbl.INTERNAL_ORGANIZATION_ID(i),
6410         P_APPLICATION_ID               => g_suite_rec_tbl.APPLICATION_ID(i)          ,
6411         P_ENTITY_CODE                  => g_suite_rec_tbl.ENTITY_CODE(i)             ,
6412         P_EVENT_CLASS_CODE             => g_suite_rec_tbl.EVENT_CLASS_CODE(i)        ,
6413         P_TRX_ID                       => g_suite_rec_tbl.TRX_ID(i)                  ,
6414         P_SUMMARY_TAX_LINE_NUMBER      => g_suite_rec_tbl.SUMMARY_TAX_LINE_NUMBER(i) ,
6415         P_TRX_NUMBER                   => g_suite_rec_tbl.TRX_NUMBER(i)              ,
6416         P_APPLIED_FROM_APPLICATION_ID  => null                                       ,
6417         P_APPLIED_FROM_EVT_CLASS_CODE  => null                                       ,
6418         P_APPLIED_FROM_ENTITY_CODE     => null                                       ,
6419         P_APPLIED_FROM_TRX_ID          => null                                       ,
6420         P_APPLIED_FROM_TRX_LEVEL_TYPE  => null                                       ,
6421         P_APPLIED_FROM_LINE_ID         => null                                       ,
6422         P_ADJUSTED_DOC_APPLICATION_ID  => null                                       ,
6423         P_ADJUSTED_DOC_ENTITY_CODE     => g_suite_rec_tbl.adjusted_doc_entity_code(i),
6424         P_ADJUSTED_DOC_EVT_CLASS_CODE  => null                                       ,
6425         P_ADJUSTED_DOC_TRX_ID          => null                                       ,
6426         P_ADJUSTED_DOC_TRX_LEVEL_TYPE  => null                                       ,
6427         P_APPLIED_TO_APPLICATION_ID    => null                                       ,
6428         P_APPLIED_TO_EVENT_CLASS_CODE  => null                                       ,
6429         P_APPLIED_TO_ENTITY_CODE       => null                                       ,
6430         P_APPLIED_TO_TRX_ID            => null                                       ,
6431         P_APPLIED_TO_TRX_LEVEL_TYPE    => null                                       ,
6432         P_APPLIED_TO_LINE_ID           => null                                       ,
6433         P_TAX_EXEMPTION_ID             => null                                       ,
6434         P_TAX_RATE_BEFORE_EXEMPTION    => null                                       ,
6435         P_TAX_RATE_NAME_BEFORE_EXEMPT  => null                                       ,
6436         P_EXEMPT_RATE_MODIFIER         => null                                       ,
6437         P_EXEMPT_CERTIFICATE_NUMBER    => null                                       ,
6438         P_EXEMPT_REASON                => null                                       ,
6439         P_EXEMPT_REASON_CODE           => null                                       ,
6440         P_TAX_RATE_BEFORE_EXCEPTION    => null                                       ,
6441         P_TAX_RATE_NAME_BEFORE_EXCEPT  => null                                       ,
6442         P_TAX_EXCEPTION_ID             => null                                       ,
6443         P_EXCEPTION_RATE               => null                                       ,
6444         P_CONTENT_OWNER_ID             => null                                       ,
6445         P_TAX_REGIME_CODE              => g_suite_rec_tbl.TAX_REGIME_CODE(i)         ,
6446         P_TAX                          => g_suite_rec_tbl.TAX(i)                     ,
6447         P_TAX_STATUS_ID                => null                     ,
6448         P_TAX_STATUS_CODE              => g_suite_rec_tbl.TAX_STATUS_CODE(i)         ,
6449         P_TAX_RATE_ID                  => g_suite_rec_tbl.TAX_RATE_ID(i)             ,
6450         P_TAX_RATE_CODE                => g_suite_rec_tbl.TAX_RATE_CODE(i)           ,
6451         P_TAX_RATE                     => g_suite_rec_tbl.TAX_RATE(i)                ,
6452         P_TAX_AMT                      => g_suite_rec_tbl.TAX_AMT(i)                 ,
6453         P_TAX_AMT_TAX_CURR             => null                                       ,
6454         P_TAX_AMT_FUNCL_CURR           => null                                       ,
6455         P_TAX_JURISDICTION_CODE        => null                                       ,
6456         P_TOTAL_REC_TAX_AMT            => g_suite_rec_tbl.TOTAL_REC_TAX_AMT(i)       ,
6457         P_TOTAL_REC_TAX_AMT_FUNC_CURR  => null                                       ,
6458         P_TOTAL_REC_TAX_AMT_TAX_CURR   => null                                       ,
6459         P_TOTAL_NREC_TAX_AMT           => g_suite_rec_tbl.TOTAL_NREC_TAX_AMT(i)      ,
6460         P_TOTAL_NREC_TAX_AMT_FUNC_CURR => null                                       ,
6461         P_TOTAL_NREC_TAX_AMT_TAX_CURR  => null                                       ,
6462         P_LEDGER_ID                    => g_suite_rec_tbl.LEDGER_ID(i)               ,
6463         P_LEGAL_ENTITY_ID              => null                                       ,
6464         P_ESTABLISHMENT_ID             => null                                       ,
6465         P_CURRENCY_CONVERSION_DATE     => null                                       ,
6466         P_CURRENCY_CONVERSION_TYPE     => null                                       ,
6467         P_CURRENCY_CONVERSION_RATE     => null                                       ,
6468         P_SUMMARIZATION_TEMPLATE_ID    => null                                       ,
6469         P_TAXABLE_BASIS_FORMULA        => null                                       ,
6470         P_TAX_CALCULATION_FORMULA      => null                                       ,
6471         P_HISTORICAL_FLAG              => null                                       ,
6472         P_CANCEL_FLAG                  => g_suite_rec_tbl.CANCEL_FLAG(i)             ,
6473         P_DELETE_FLAG                  => null                                       ,
6474         P_TAX_AMT_INCLUDED_FLAG        => g_suite_rec_tbl.TAX_AMT_INCLUDED_FLAG(i)   ,
6475         P_COMPOUNDING_TAX_FLAG         => null                                       ,
6476         P_SELF_ASSESSED_FLAG           => g_suite_rec_tbl.SELF_ASSESSED_FLAG(i)      ,
6477         P_OVERRIDDEN_FLAG              => null                                       ,
6478         P_REPORTING_ONLY_FLAG          => null                                       ,
6479         P_ASSOC_CHILD_FROZEN_FLAG      => null                                       ,
6480         P_COPIED_FROM_OTHER_DOC_FLAG   => null                                       ,
6481         P_MANUALLY_ENTERED_FLAG        => g_suite_rec_tbl.MANUALLY_ENTERED_FLAG(i)   ,
6482         P_MRC_TAX_LINE_FLAG            => null                                       ,
6483         P_LAST_MANUAL_ENTRY            => null                                       ,
6484         P_RECORD_TYPE_CODE             => null                                       ,
6485         P_TAX_PROVIDER_ID              => null                                       ,
6486         P_TAX_ONLY_LINE_FLAG           => null                                       ,
6487         P_ADJUST_TAX_AMT_FLAG          => null                                       ,
6488         --P_EVENT_ID                     => null                                       ,
6489         --P_CTRL_EF_OV_CAL_LINE_FLAG     => null                                       ,
6490         P_ATTRIBUTE_CATEGORY           => null                                       ,
6491         P_ATTRIBUTE1                   => null                                       ,
6492         P_ATTRIBUTE2                   => null                                       ,
6493         P_ATTRIBUTE3                   => null                                       ,
6494         P_ATTRIBUTE4                   => null                                       ,
6495         P_ATTRIBUTE5                   => null                                       ,
6496         P_ATTRIBUTE6                   => null                                       ,
6497         P_ATTRIBUTE7                   => null                                       ,
6498         P_ATTRIBUTE8                   => null                                       ,
6499         P_ATTRIBUTE9                   => null                                       ,
6500         P_ATTRIBUTE10                  => null                                       ,
6501         P_ATTRIBUTE11                  => null                                       ,
6502         P_ATTRIBUTE12                  => null                                       ,
6503         P_ATTRIBUTE13                  => null                                       ,
6504         P_ATTRIBUTE14                  => null                                       ,
6505         P_ATTRIBUTE15                  => null                                       ,
6506         P_GLOBAL_ATTRIBUTE_CATEGORY    => null                                       ,
6507         P_GLOBAL_ATTRIBUTE1            => null                                       ,
6508         P_GLOBAL_ATTRIBUTE2            => null                                       ,
6509         P_GLOBAL_ATTRIBUTE3            => null                                       ,
6510         P_GLOBAL_ATTRIBUTE4            => null                                       ,
6511         P_GLOBAL_ATTRIBUTE5            => null                                       ,
6512         P_GLOBAL_ATTRIBUTE6            => null                                       ,
6513         P_GLOBAL_ATTRIBUTE7            => null                                       ,
6514         P_GLOBAL_ATTRIBUTE8            => null                                       ,
6515         P_GLOBAL_ATTRIBUTE9            => null                                       ,
6516         P_GLOBAL_ATTRIBUTE10           => null                                       ,
6517         P_GLOBAL_ATTRIBUTE11           => null                                       ,
6518         P_GLOBAL_ATTRIBUTE12           => null                                       ,
6519         P_GLOBAL_ATTRIBUTE13           => null                                       ,
6520         P_GLOBAL_ATTRIBUTE14           => null                                       ,
6521         P_GLOBAL_ATTRIBUTE15           => null                                       ,
6522         P_GLOBAL_ATTRIBUTE16           => null                                       ,
6523         P_GLOBAL_ATTRIBUTE17           => null                                       ,
6524         P_GLOBAL_ATTRIBUTE18           => null                                       ,
6525         P_GLOBAL_ATTRIBUTE19           => null                                       ,
6526         P_GLOBAL_ATTRIBUTE20           => null                                       ,
6527         P_OBJECT_VERSION_NUMBER        => l_object_version_number+1                  ,
6528         --P_CREATED_BY                   => 1       , ---------------------------------
6529         --P_CREATION_DATE                => sysdate , -- What are the correct values
6530         P_LAST_UPDATED_BY              => 1       , -- to pass for the Who Columns?
6531         P_LAST_UPDATE_DATE             => sysdate , -- Review this later.
6532         P_LAST_UPDATE_LOGIN            => 1 );      ---------------------------------
6533  null;
6534 
6535     END LOOP;
6536 
6537      write_message('Service zx_trl_allocations_pkg.Delete_row has been called!.');
6538      write_message('For Suite: '||p_suite_number||' and Case: '||p_case_number);
6539      write_message('x_return_status : '||l_return_status);
6540      write_message('x_msg_count     : '||l_msg_count    );
6541      write_message('x_msg_data      : '||l_msg_data     );
6542 
6543     ELSIF p_api_service = 'OVERRIDE_SUMMARY_DELETE_TAX_LINE' THEN
6544 
6545       ----------------------------------------------
6546       -- Get inital and ending row for the structure
6547       ----------------------------------------------
6548       get_start_end_rows_structure
6549        (
6550          p_suite      => p_suite_number,
6551          p_case       => p_case_number,
6552          p_structure  => 'STRUCTURE_OVERRIDE_SUMMARY_TAX_LINES',
6553          x_start_row  => l_start_row,
6554          x_end_row    => l_end_row
6555        );
6556 
6557       -----------------------------------------------------------
6558       -- Proceeds to Call the API Synchronize Tax Repository
6559       -----------------------------------------------------------
6560       write_message('Calculating for OVERRIDE_SUMMARY_DELETE_TAX_LINE');
6561       FOR i in l_start_row..l_end_row LOOP
6562 
6563       select object_version_number
6564       into l_object_version_number
6565       from zx_lines_summary
6566       where application_id =g_suite_rec_tbl.application_id(i)
6567         and entity_code = g_suite_rec_tbl.entity_code(i)
6568         and event_class_code = g_suite_rec_tbl.event_class_code(i)
6569         and trx_id = g_suite_rec_tbl.trx_id(i)
6570         and summary_tax_line_id = g_suite_rec_tbl.summary_tax_line_id(i) ;
6571 
6572       ZX_TRL_SUMMARY_OVERRIDE_PKG.Delete_row(
6573           X_ROWID                        => l_row_id                                   ,
6574           P_SUMMARY_TAX_LINE_ID          => g_suite_rec_tbl.SUMMARY_TAX_LINE_ID(i)     ,
6575           P_INTERNAL_ORGANIZATION_ID     => g_suite_rec_tbl.INTERNAL_ORGANIZATION_ID(i),
6576           P_APPLICATION_ID               => g_suite_rec_tbl.APPLICATION_ID(i)          ,
6577           P_ENTITY_CODE                  => g_suite_rec_tbl.ENTITY_CODE(i)             ,
6578           P_EVENT_CLASS_CODE             => g_suite_rec_tbl.EVENT_CLASS_CODE(i)        ,
6579           P_TRX_ID                       => g_suite_rec_tbl.TRX_ID(i)                  ,
6580           P_SUMMARY_TAX_LINE_NUMBER      => g_suite_rec_tbl.SUMMARY_TAX_LINE_NUMBER(i) ,
6581           P_TRX_NUMBER                   => g_suite_rec_tbl.TRX_NUMBER(i)              ,
6582           P_APPLIED_FROM_APPLICATION_ID  => null                                       ,
6583           P_APPLIED_FROM_EVT_CLASS_CODE  => null                                       ,
6584           P_APPLIED_FROM_ENTITY_CODE     => null                                       ,
6585           P_APPLIED_FROM_TRX_ID          => null                                       ,
6586           P_APPLIED_FROM_TRX_LEVEL_TYPE  => null                                       ,
6587           P_APPLIED_FROM_LINE_ID         => null                                       ,
6588           P_ADJUSTED_DOC_APPLICATION_ID  => null                                       ,
6589           P_ADJUSTED_DOC_ENTITY_CODE     => g_suite_rec_tbl.adjusted_doc_entity_code(i),
6590           P_ADJUSTED_DOC_EVT_CLASS_CODE  => null                                       ,
6591           P_ADJUSTED_DOC_TRX_ID          => null                                       ,
6592           P_ADJUSTED_DOC_TRX_LEVEL_TYPE  => null                                       ,
6593           P_APPLIED_TO_APPLICATION_ID    => null                                       ,
6594           P_APPLIED_TO_EVENT_CLASS_CODE  => null                                       ,
6595           P_APPLIED_TO_ENTITY_CODE       => null                                       ,
6596           P_APPLIED_TO_TRX_ID            => null                                       ,
6597           P_APPLIED_TO_TRX_LEVEL_TYPE    => null                                       ,
6598           P_APPLIED_TO_LINE_ID           => null                                       ,
6599           P_TAX_EXEMPTION_ID             => null                                       ,
6600           P_TAX_RATE_BEFORE_EXEMPTION    => null                                       ,
6601           P_TAX_RATE_NAME_BEFORE_EXEMPT  => null                                       ,
6602           P_EXEMPT_RATE_MODIFIER         => null                                       ,
6603           P_EXEMPT_CERTIFICATE_NUMBER    => null                                       ,
6604           P_EXEMPT_REASON                => null                                       ,
6605           P_EXEMPT_REASON_CODE           => null                                       ,
6606           P_TAX_RATE_BEFORE_EXCEPTION    => null                                       ,
6607           P_TAX_RATE_NAME_BEFORE_EXCEPT  => null                                       ,
6608           P_TAX_EXCEPTION_ID             => null                                       ,
6609           P_EXCEPTION_RATE               => null                                       ,
6610           P_CONTENT_OWNER_ID             => null                                       ,
6611           P_TAX_REGIME_CODE              => g_suite_rec_tbl.TAX_REGIME_CODE(i)         ,
6612           P_TAX                          => g_suite_rec_tbl.TAX(i)                     ,
6613           P_TAX_STATUS_CODE              => g_suite_rec_tbl.TAX_STATUS_CODE(i)         ,
6614           P_TAX_RATE_ID                  => g_suite_rec_tbl.TAX_RATE_ID(i)             ,
6615           P_TAX_RATE_CODE                => g_suite_rec_tbl.TAX_RATE_CODE(i)           ,
6616           P_TAX_RATE                     => g_suite_rec_tbl.TAX_RATE(i)                ,
6617           P_TAX_AMT                      => g_suite_rec_tbl.TAX_AMT(i)                 ,
6618           P_TAX_AMT_TAX_CURR             => null                                       ,
6619           P_TAX_AMT_FUNCL_CURR           => null                                       ,
6620           P_TAX_JURISDICTION_CODE        => null                                       ,
6621           P_TOTAL_REC_TAX_AMT            => g_suite_rec_tbl.TOTAL_REC_TAX_AMT(i)       ,
6622           P_TOTAL_REC_TAX_AMT_FUNC_CURR  => null                                       ,
6623           P_TOTAL_REC_TAX_AMT_TAX_CURR   => null                                       ,
6624           P_TOTAL_NREC_TAX_AMT           => g_suite_rec_tbl.TOTAL_NREC_TAX_AMT(i)      ,
6625           P_TOTAL_NREC_TAX_AMT_FUNC_CURR => null                                       ,
6626           P_TOTAL_NREC_TAX_AMT_TAX_CURR  => null                                       ,
6627           P_LEDGER_ID                    => g_suite_rec_tbl.LEDGER_ID(i)               ,
6628           P_LEGAL_ENTITY_ID              => null                                       ,
6629           P_ESTABLISHMENT_ID             => null                                       ,
6630           P_CURRENCY_CONVERSION_DATE     => null                                       ,
6631           P_CURRENCY_CONVERSION_TYPE     => null                                       ,
6632           P_CURRENCY_CONVERSION_RATE     => null                                       ,
6633           P_SUMMARIZATION_TEMPLATE_ID    => null                                       ,
6634           P_TAXABLE_BASIS_FORMULA        => null                                       ,
6635           P_TAX_CALCULATION_FORMULA      => null                                       ,
6636           P_HISTORICAL_FLAG              => null                                       ,
6637           P_CANCEL_FLAG                  => g_suite_rec_tbl.CANCEL_FLAG(i)             ,
6638           P_DELETE_FLAG                  => null                                       ,
6639           P_TAX_AMT_INCLUDED_FLAG        => g_suite_rec_tbl.TAX_AMT_INCLUDED_FLAG(i)   ,
6640           P_COMPOUNDING_TAX_FLAG         => null                                       ,
6641           P_SELF_ASSESSED_FLAG           => g_suite_rec_tbl.SELF_ASSESSED_FLAG(i)      ,
6642           P_OVERRIDDEN_FLAG              => null                                       ,
6643           P_REPORTING_ONLY_FLAG          => null                                       ,
6644           P_ASSOC_CHILD_FROZEN_FLAG      => null                                       ,
6645           P_COPIED_FROM_OTHER_DOC_FLAG   => null                                       ,
6646           P_MANUALLY_ENTERED_FLAG        => g_suite_rec_tbl.MANUALLY_ENTERED_FLAG(i)   ,
6647           P_MRC_TAX_LINE_FLAG            => null                                       ,
6648           P_LAST_MANUAL_ENTRY            => null                                       ,
6649           P_RECORD_TYPE_CODE             => null                                       ,
6650           P_TAX_PROVIDER_ID              => null                                       ,
6651           P_TAX_ONLY_LINE_FLAG           => null                                       ,
6652           P_ADJUST_TAX_AMT_FLAG          => null                                       ,
6653           P_ATTRIBUTE_CATEGORY           => null                                       ,
6654           P_ATTRIBUTE1                   => null                                       ,
6655           P_ATTRIBUTE2                   => null                                       ,
6656           P_ATTRIBUTE3                   => null                                       ,
6657           P_ATTRIBUTE4                   => null                                       ,
6658           P_ATTRIBUTE5                   => null                                       ,
6659           P_ATTRIBUTE6                   => null                                       ,
6660           P_ATTRIBUTE7                   => null                                       ,
6661           P_ATTRIBUTE8                   => null                                       ,
6662           P_ATTRIBUTE9                   => null                                       ,
6663           P_ATTRIBUTE10                  => null                                       ,
6664           P_ATTRIBUTE11                  => null                                       ,
6665           P_ATTRIBUTE12                  => null                                       ,
6666           P_ATTRIBUTE13                  => null                                       ,
6667           P_ATTRIBUTE14                  => null                                       ,
6668           P_ATTRIBUTE15                  => null                                       ,
6669           P_GLOBAL_ATTRIBUTE_CATEGORY    => null                                       ,
6670           P_GLOBAL_ATTRIBUTE1            => null                                       ,
6671           P_GLOBAL_ATTRIBUTE2            => null                                       ,
6672           P_GLOBAL_ATTRIBUTE3            => null                                       ,
6673           P_GLOBAL_ATTRIBUTE4            => null                                       ,
6674           P_GLOBAL_ATTRIBUTE5            => null                                       ,
6675           P_GLOBAL_ATTRIBUTE6            => null                                       ,
6676           P_GLOBAL_ATTRIBUTE7            => null                                       ,
6677           P_GLOBAL_ATTRIBUTE8            => null                                       ,
6678           P_GLOBAL_ATTRIBUTE9            => null                                       ,
6679           P_GLOBAL_ATTRIBUTE10           => null                                       ,
6680           P_GLOBAL_ATTRIBUTE11           => null                                       ,
6681           P_GLOBAL_ATTRIBUTE12           => null                                       ,
6682           P_GLOBAL_ATTRIBUTE13           => null                                       ,
6683           P_GLOBAL_ATTRIBUTE14           => null                                       ,
6684           P_GLOBAL_ATTRIBUTE15           => null                                       ,
6685           P_GLOBAL_ATTRIBUTE16           => null                                       ,
6686           P_GLOBAL_ATTRIBUTE17           => null                                       ,
6687           P_GLOBAL_ATTRIBUTE18           => null                                       ,
6688           P_GLOBAL_ATTRIBUTE19           => null                                       ,
6689           P_GLOBAL_ATTRIBUTE20           => null                                       ,
6690           P_OBJECT_VERSION_NUMBER        => l_object_version_number                    ,
6691           P_CREATED_BY                => 1       , -------------------------------
6692           P_CREATION_DATE             => sysdate , -- What are the correct values
6693           P_LAST_UPDATED_BY           => 1       , -- to pass for who columns?
6694           P_LAST_UPDATE_LOGIN         => 1       , -- Review this later.
6695           P_LAST_UPDATE_DATE          => sysdate); -------------------------------
6696 
6697    END LOOP;
6698 
6699     ELSIF p_api_service = 'OVERRIDE_DISTRIBUTION_UPDATE_TAX_LINE' THEN
6700       -----------------------------------------------------------
6701       -- Proceeds to Call the Lock_row and Update_row API
6702       -----------------------------------------------------------
6703 
6704       FOR i in g_suite_rec_tbl.application_id.FIRST..g_suite_rec_tbl.application_id.LAST LOOP
6705 
6706       select object_version_number
6707       into l_object_version_number
6708       from ZX_REC_NREC_DIST
6709       where application_id =g_suite_rec_tbl.application_id(i)
6710         and entity_code = g_suite_rec_tbl.entity_code(i)
6711         and event_class_code = g_suite_rec_tbl.event_class_code(i)
6712         and trx_id = g_suite_rec_tbl.trx_id(i)
6713         and trx_line_id = g_suite_rec_tbl.trx_line_id(i)
6714         and trx_level_type = g_suite_rec_tbl.trx_level_type(i)
6715         and REC_NREC_TAX_DIST_ID = g_suite_rec_tbl.REC_NREC_TAX_DIST_ID(i) ;
6716 
6717       ZX_TRL_DISTRIBUTIONS_PKG.Lock_Row(
6718           X_ROWID                        => l_row_id                                   ,
6719           P_REC_NREC_TAX_DIST_ID         => g_suite_rec_tbl.rec_nrec_tax_dist_id(i)    ,
6720           P_APPLICATION_ID               => g_suite_rec_tbl.application_id(i)          ,
6721           P_ENTITY_CODE                  => g_suite_rec_tbl.entity_code(i)             ,
6722           P_EVENT_CLASS_CODE             => g_suite_rec_tbl.event_class_code(i)        ,
6723           P_EVENT_TYPE_CODE              => g_suite_rec_tbl.event_type_code(i)         ,
6724           P_TRX_ID                       => g_suite_rec_tbl.trx_id(i)                  ,
6725           P_TRX_NUMBER                   => null                                       ,
6726           P_TRX_LINE_ID                  => g_suite_rec_tbl.trx_line_id(i)             ,
6727           P_TRX_LINE_NUMBER              => g_suite_rec_tbl.trx_line_number(i)         ,
6728           P_TAX_LINE_ID                  => g_suite_rec_tbl.tax_line_id(i)             ,
6729           P_TAX_LINE_NUMBER              => null                                       ,
6730           P_TRX_LINE_DIST_ID             => g_suite_rec_tbl.trx_line_dist_id(i)        ,
6731           P_TRX_LEVEL_TYPE               => null                                       ,
6732           P_ITEM_DIST_NUMBER             => g_suite_rec_tbl.item_dist_number(i)        ,
6733           P_REC_NREC_TAX_DIST_NUMBER     => null                                       ,
6734           P_REC_NREC_RATE                => null                                       ,
6735           P_RECOVERABLE_FLAG             => g_suite_rec_tbl.recoverable_flag(i)        ,
6736           P_REC_NREC_TAX_AMT             => g_suite_rec_tbl.rec_nrec_tax_amt(i)        ,
6737           P_TAX_EVENT_CLASS_CODE         => null                                       ,
6738           P_TAX_EVENT_TYPE_CODE          => null                                       ,
6739           P_CONTENT_OWNER_ID             => null                                       ,
6740           P_TAX_REGIME_ID                => null                                       ,
6741           P_TAX_REGIME_CODE              => g_suite_rec_tbl.tax_regime_code(i)         ,
6742           P_TAX_ID                       => null                                       ,
6743           P_TAX                          => g_suite_rec_tbl.tax(i)                     ,
6744           P_TAX_STATUS_ID                => null                                       ,
6745           P_TAX_STATUS_CODE              => g_suite_rec_tbl.tax_status_code(i)         ,
6746           P_TAX_RATE_ID                  => g_suite_rec_tbl.tax_rate_id(i)             ,
6747           P_TAX_RATE_CODE                => g_suite_rec_tbl.tax_rate_code(i)           ,
6748           P_TAX_RATE                     => g_suite_rec_tbl.tax_rate(i)                ,
6749           P_INCLUSIVE_FLAG               => null                                       ,
6750           P_RECOVERY_TYPE_ID             => null                                       ,
6751           P_RECOVERY_TYPE_CODE           => g_suite_rec_tbl.recovery_type_code(i)      ,
6752           P_RECOVERY_RATE_ID             => null                                       ,
6753           P_RECOVERY_RATE_CODE           => g_suite_rec_tbl.recovery_rate_code(i)      ,
6754           P_REC_TYPE_RULE_FLAG           => null                                       ,
6755           P_NEW_REC_RATE_CODE_FLAG       => null                                       ,
6756           P_REVERSE_FLAG                 => g_suite_rec_tbl.reverse_flag(i)            ,
6757           P_HISTORICAL_FLAG              => g_suite_rec_tbl.historical_flag(i)         ,
6758           P_REVERSED_TAX_DIST_ID         => g_suite_rec_tbl.reversed_tax_dist_id(i)    ,
6759           P_REC_NREC_TAX_AMT_TAX_CURR    => null                                       ,
6760           P_REC_NREC_TAX_AMT_FUNCL_CURR  => g_suite_rec_tbl.rec_nrec_tax_amt_funcl_curr(i),
6761           P_INTENDED_USE                 => null                                       ,
6762           P_PROJECT_ID                   => g_suite_rec_tbl.project_id(i)              ,
6763           P_TASK_ID                      => g_suite_rec_tbl.task_id(i)                 ,
6764           P_AWARD_ID                     => g_suite_rec_tbl.award_id(i)                ,
6765           P_EXPENDITURE_TYPE             => g_suite_rec_tbl.expenditure_type(i)        ,
6766           P_EXPENDITURE_ORGANIZATION_ID  => g_suite_rec_tbl.expenditure_organization_id(i),
6767           P_EXPENDITURE_ITEM_DATE        => g_suite_rec_tbl.expenditure_item_date(i)   ,
6768           P_REC_RATE_DET_RULE_FLAG       => null                                       ,
6769           P_LEDGER_ID                    => g_suite_rec_tbl.ledger_id(i)               ,
6770           P_SUMMARY_TAX_LINE_ID          => g_suite_rec_tbl.summary_tax_line_id(i)     ,
6771           P_RECORD_TYPE_CODE             => null                                       ,
6772           P_CURRENCY_CONVERSION_DATE     => g_suite_rec_tbl.currency_conversion_date(i),
6773           P_CURRENCY_CONVERSION_TYPE     => g_suite_rec_tbl.currency_conversion_type(i),
6774           P_CURRENCY_CONVERSION_RATE     => g_suite_rec_tbl.currency_conversion_rate(i),
6775           P_TAX_CURRENCY_CONVERSION_DATE => null                                       ,
6776           P_TAX_CURRENCY_CONVERSION_TYPE => null                                       ,
6777           P_TAX_CURRENCY_CONVERSION_RATE => null                                       ,
6778           P_TRX_CURRENCY_CODE            => g_suite_rec_tbl.trx_currency_code(i)       ,
6779           P_TAX_CURRENCY_CODE            => null                                       ,
6780           P_TRX_LINE_DIST_QTY            => null                                       ,
6781           P_REF_DOC_TRX_LINE_DIST_QTY    => null                                       ,
6782           P_PRICE_DIFF                   => null                                       ,
6783           P_QTY_DIFF                     => null                                       ,
6784           P_PER_TRX_CURR_UNIT_NR_AMT     => null                                       ,
6785           P_REF_PER_TRX_CURR_UNIT_NR_AMT => null                                       ,
6786           P_REF_DOC_CURR_CONV_RATE       => null                                       ,
6787           P_UNIT_PRICE                   => null                                       ,
6788           P_REF_DOC_UNIT_PRICE           => null                                       ,
6789           P_PER_UNIT_NREC_TAX_AMT        => null                                       ,
6790           P_REF_DOC_PER_UNIT_NREC_TAX_AM => null                                       ,
6791           P_RATE_TAX_FACTOR              => null                                       ,
6792           P_TAX_APPORTIONMENT_FLAG       => null                                       ,
6793           P_TRX_LINE_DIST_AMT            => g_suite_rec_tbl.trx_line_dist_amt(i)       ,
6794           P_TRX_LINE_DIST_TAX_AMT        => null                                       ,
6795           P_ORIG_REC_NREC_RATE           => null                                       ,
6796           P_ORIG_REC_RATE_CODE           => null                                       ,
6797           P_ORIG_REC_NREC_TAX_AMT        => null                                       ,
6798           P_ORIG_REC_NREC_TAX_AMT_TAX_CU => null                                       ,
6799           P_ACCOUNT_CCID                 => null                                       ,
6800           P_ACCOUNT_STRING               => null                                       ,
6801           P_UNROUNDED_REC_NREC_TAX_AMT   => null                                       ,
6802           P_APPLICABILITY_RESULT_ID      => null                                       ,
6803           P_REC_RATE_RESULT_ID           => null                                       ,
6804           P_BACKWARD_COMPATIBILITY_FLAG  => null                                       ,
6805           P_OVERRIDDEN_FLAG              => null                                       ,
6806           P_SELF_ASSESSED_FLAG           => g_suite_rec_tbl.self_assessed_flag(i)      ,
6807           P_FREEZE_FLAG                  => g_suite_rec_tbl.freeze_flag(i)             ,
6808           P_POSTING_FLAG                 => g_suite_rec_tbl.posting_flag(i)            ,
6809           P_GL_DATE                      => null                                       ,
6810           P_REF_DOC_APPLICATION_ID       => null                                       ,
6811           P_REF_DOC_ENTITY_CODE          => null                                       ,
6812           P_REF_DOC_EVENT_CLASS_CODE     => null                                       ,
6813           P_REF_DOC_TRX_ID               => null                                       ,
6814           P_REF_DOC_TRX_LEVEL_TYPE       => null                                       ,
6815           P_REF_DOC_LINE_ID              => null                                       ,
6816           P_REF_DOC_DIST_ID              => null                                       ,
6817           P_MINIMUM_ACCOUNTABLE_UNIT     => null                                       ,
6818           P_PRECISION                    => null                                       ,
6819           P_ROUNDING_RULE_CODE           => null                                       ,
6820           P_TAXABLE_AMT                  => null                                       ,
6821           P_TAXABLE_AMT_TAX_CURR         => null                                       ,
6822           P_TAXABLE_AMT_FUNCL_CURR       => null                                       ,
6823           P_TAX_ONLY_LINE_FLAG           => null                                       ,
6824           P_UNROUNDED_TAXABLE_AMT        => null                                       ,
6825           P_LEGAL_ENTITY_ID              => null                                       ,
6826           P_PRD_TAX_AMT                  => null                                       ,
6827           P_PRD_TAX_AMT_TAX_CURR         => null                                       ,
6828           P_PRD_TAX_AMT_FUNCL_CURR       => null                                       ,
6829           P_PRD_TOTAL_TAX_AMT            => null                                       ,
6830           P_PRD_TOTAL_TAX_AMT_TAX_CURR   => null                                       ,
6831           P_PRD_TOTAL_TAX_AMT_FUNCL_CURR => null                                       ,
6832           P_APPLIED_FROM_TAX_DIST_ID     => null                                       ,
6833           P_APPL_TO_DOC_CURR_CONV_RATE   => null                                       ,
6834           P_ADJUSTED_DOC_TAX_DIST_ID     => null                                       ,
6835           P_FUNC_CURR_ROUNDING_ADJUST    => null                                       ,
6836           P_TAX_APPORTIONMENT_LINE_NUM   => null                                       ,
6837           P_LAST_MANUAL_ENTRY            => null                                       ,
6838           P_REF_DOC_TAX_DIST_ID          => null                                       ,
6839           P_MRC_TAX_DIST_FLAG            => null                                       ,
6840           P_MRC_LINK_TO_TAX_DIST_ID      => null                                       ,
6841 /*          P_HDR_TRX_USER_KEY1            => null                                       ,
6842           P_HDR_TRX_USER_KEY2            => null                                       ,
6843           P_HDR_TRX_USER_KEY3            => null                                       ,
6844           P_HDR_TRX_USER_KEY4            => null                                       ,
6845           P_HDR_TRX_USER_KEY5            => null                                       ,
6846           P_HDR_TRX_USER_KEY6            => null                                       ,
6847           P_LINE_TRX_USER_KEY1           => null                                       ,
6848           P_LINE_TRX_USER_KEY2           => null                                       ,
6849           P_LINE_TRX_USER_KEY3           => null                                       ,
6850           P_LINE_TRX_USER_KEY4           => null                                       ,
6851           P_LINE_TRX_USER_KEY5           => null                                       ,
6852           P_LINE_TRX_USER_KEY6           => null                                       ,
6853           P_DIST_TRX_USER_KEY1           => null                                       ,
6854           P_DIST_TRX_USER_KEY2           => null                                       ,
6855           P_DIST_TRX_USER_KEY3           => null                                       ,
6856           P_DIST_TRX_USER_KEY4           => null                                       ,
6857           P_DIST_TRX_USER_KEY5           => null                                       ,
6858           P_DIST_TRX_USER_KEY6           => null                                       ,*/
6859           P_ATTRIBUTE_CATEGORY           => null                                       ,
6860           P_ATTRIBUTE1                   => null                                       ,
6861           P_ATTRIBUTE2                   => null                                       ,
6862           P_ATTRIBUTE3                   => null                                       ,
6863           P_ATTRIBUTE4                   => null                                       ,
6864           P_ATTRIBUTE5                   => null                                       ,
6865           P_ATTRIBUTE6                   => null                                       ,
6866           P_ATTRIBUTE7                   => null                                       ,
6867           P_ATTRIBUTE8                   => null                                       ,
6868           P_ATTRIBUTE9                   => null                                       ,
6869           P_ATTRIBUTE10                  => null                                       ,
6870           P_ATTRIBUTE11                  => null                                       ,
6871           P_ATTRIBUTE12                  => null                                       ,
6872           P_ATTRIBUTE13                  => null                                       ,
6873           P_ATTRIBUTE14                  => null                                       ,
6874           P_ATTRIBUTE15                  => null                                       ,
6875           P_GLOBAL_ATTRIBUTE_CATEGORY    => null                                       ,
6876           P_GLOBAL_ATTRIBUTE1            => null                                       ,
6877           P_GLOBAL_ATTRIBUTE2            => null                                       ,
6878           P_GLOBAL_ATTRIBUTE3            => null                                       ,
6879           P_GLOBAL_ATTRIBUTE4            => null                                       ,
6880           P_GLOBAL_ATTRIBUTE5            => null                                       ,
6881           P_GLOBAL_ATTRIBUTE6            => null                                       ,
6882           P_GLOBAL_ATTRIBUTE7            => null                                       ,
6883           P_GLOBAL_ATTRIBUTE8            => null                                       ,
6884           P_GLOBAL_ATTRIBUTE9            => null                                       ,
6885           P_GLOBAL_ATTRIBUTE10           => null                                       ,
6886           P_GLOBAL_ATTRIBUTE11           => null                                       ,
6887           P_GLOBAL_ATTRIBUTE12           => null                                       ,
6888           P_GLOBAL_ATTRIBUTE13           => null                                       ,
6889           P_GLOBAL_ATTRIBUTE14           => null                                       ,
6890           P_GLOBAL_ATTRIBUTE15           => null                                       ,
6891           P_GLOBAL_ATTRIBUTE16           => null                                       ,
6892           P_GLOBAL_ATTRIBUTE17           => null                                       ,
6893           P_GLOBAL_ATTRIBUTE18           => null                                       ,
6894           P_GLOBAL_ATTRIBUTE19           => null                                       ,
6895           P_GLOBAL_ATTRIBUTE20           => null                                       ,
6896           P_ORIG_AP_CHRG_DIST_NUM        => null                                       ,
6897           P_ORIG_AP_CHRG_DIST_ID         => null                                       ,
6898           P_ORIG_AP_TAX_DIST_NUM         => null                                       ,
6899           P_ORIG_AP_TAX_DIST_ID          => null                                       ,
6900           P_OBJECT_VERSION_NUMBER        => l_object_version_number                    ,
6901           P_CREATED_BY                => 1       , -------------------------------
6902           P_CREATION_DATE             => sysdate , -- What are the correct values
6903           P_LAST_UPDATED_BY           => 1       , -- to pass for who columns?
6904           P_LAST_UPDATE_LOGIN         => 1       , -- Review this later.
6905           P_LAST_UPDATE_DATE          => sysdate); -------------------------------
6906 
6907     END LOOP;
6908 
6909     FOR i in g_suite_rec_tbl.application_id.FIRST..g_suite_rec_tbl.application_id.LAST LOOP
6910 
6911       select object_version_number
6912       into l_object_version_number
6913       from ZX_REC_NREC_DIST
6914       where application_id =g_suite_rec_tbl.application_id(i)
6915         and entity_code = g_suite_rec_tbl.entity_code(i)
6916         and event_class_code = g_suite_rec_tbl.event_class_code(i)
6917         and trx_id = g_suite_rec_tbl.trx_id(i)
6918         and trx_line_id = g_suite_rec_tbl.trx_line_id(i)
6919         and trx_level_type = g_suite_rec_tbl.trx_level_type(i)
6920         and REC_NREC_TAX_DIST_ID = g_suite_rec_tbl.REC_NREC_TAX_DIST_ID(i) ;
6921 
6922     ZX_TRL_DISTRIBUTIONS_PKG.Update_row(
6923 --          X_ROWID                        => l_row_id                                   ,
6924           P_REC_NREC_TAX_DIST_ID         => g_suite_rec_tbl.rec_nrec_tax_dist_id(i)    ,
6925           P_APPLICATION_ID               => g_suite_rec_tbl.application_id(i)          ,
6926           P_ENTITY_CODE                  => g_suite_rec_tbl.entity_code(i)             ,
6927           P_EVENT_CLASS_CODE             => g_suite_rec_tbl.event_class_code(i)        ,
6928           P_EVENT_TYPE_CODE              => g_suite_rec_tbl.event_type_code(i)         ,
6929           P_TRX_ID                       => g_suite_rec_tbl.trx_id(i)                  ,
6930           P_TRX_NUMBER                   => null                                       ,
6931           P_TRX_LINE_ID                  => g_suite_rec_tbl.trx_line_id(i)             ,
6932           P_TRX_LINE_NUMBER              => g_suite_rec_tbl.trx_line_number(i)         ,
6933           P_TAX_LINE_ID                  => g_suite_rec_tbl.tax_line_id(i)             ,
6934           P_TAX_LINE_NUMBER              => null                                       ,
6935           P_TRX_LINE_DIST_ID             => g_suite_rec_tbl.trx_line_dist_id(i)        ,
6936           P_TRX_LEVEL_TYPE               => null                                       ,
6937           P_ITEM_DIST_NUMBER             => g_suite_rec_tbl.item_dist_number(i)        ,
6938           P_REC_NREC_TAX_DIST_NUMBER     => null                                       ,
6939           P_REC_NREC_RATE                => null                                       ,
6940           P_RECOVERABLE_FLAG             => null                                       ,
6941           P_REC_NREC_TAX_AMT             => g_suite_rec_tbl.rec_nrec_tax_amt(i)        ,
6942           P_TAX_EVENT_CLASS_CODE         => null                                       ,
6943           P_TAX_EVENT_TYPE_CODE          => null                                       ,
6944           P_CONTENT_OWNER_ID             => null                                       ,
6945           P_TAX_REGIME_ID                => null                                       ,
6946           P_TAX_REGIME_CODE              => g_suite_rec_tbl.tax_regime_code(i)         ,
6947           P_TAX_ID                       => null                                       ,
6948           P_TAX                          => g_suite_rec_tbl.tax(i)                     ,
6949           P_TAX_STATUS_ID                => null                                       ,
6950           P_TAX_STATUS_CODE              => g_suite_rec_tbl.tax_status_code(i)         ,
6951           P_TAX_RATE_ID                  => g_suite_rec_tbl.tax_rate_id(i)             ,
6952           P_TAX_RATE_CODE                => g_suite_rec_tbl.tax_rate_code(i)           ,
6953           P_TAX_RATE                     => g_suite_rec_tbl.tax_rate(i)                ,
6954           P_INCLUSIVE_FLAG               => null                                       ,
6955           P_RECOVERY_TYPE_ID             => null                                       ,
6956           P_RECOVERY_TYPE_CODE           => g_suite_rec_tbl.recovery_type_code(i)      ,
6957           P_RECOVERY_RATE_ID             => null                                       ,
6958           P_RECOVERY_RATE_CODE           => g_suite_rec_tbl.recovery_rate_code(i)      ,
6959           P_REC_TYPE_RULE_FLAG           => null                                       ,
6960           P_NEW_REC_RATE_CODE_FLAG       => null                                       ,
6961           P_REVERSE_FLAG                 => g_suite_rec_tbl.reverse_flag(i)            ,
6962           P_HISTORICAL_FLAG              => g_suite_rec_tbl.historical_flag(i)         ,
6963           P_REVERSED_TAX_DIST_ID         => g_suite_rec_tbl.reversed_tax_dist_id(i)    ,
6964           P_REC_NREC_TAX_AMT_TAX_CURR    => null                                       ,
6965           P_REC_NREC_TAX_AMT_FUNCL_CURR  => g_suite_rec_tbl.rec_nrec_tax_amt_funcl_curr(i),
6966           P_INTENDED_USE                 => null                                       ,
6967           P_PROJECT_ID                   => g_suite_rec_tbl.project_id(i)              ,
6968           P_TASK_ID                      => g_suite_rec_tbl.task_id(i)                 ,
6969           P_AWARD_ID                     => g_suite_rec_tbl.award_id(i)                ,
6970           P_EXPENDITURE_TYPE             => g_suite_rec_tbl.expenditure_type(i)        ,
6971           P_EXPENDITURE_ORGANIZATION_ID  => g_suite_rec_tbl.expenditure_organization_id(i),
6972           P_EXPENDITURE_ITEM_DATE        => g_suite_rec_tbl.expenditure_item_date(i)   ,
6973           P_REC_RATE_DET_RULE_FLAG       => null                                       ,
6974           P_LEDGER_ID                    => g_suite_rec_tbl.ledger_id(i)               ,
6975           P_SUMMARY_TAX_LINE_ID          => g_suite_rec_tbl.summary_tax_line_id(i)     ,
6976           P_RECORD_TYPE_CODE             => null                                       ,
6977           P_CURRENCY_CONVERSION_DATE     => g_suite_rec_tbl.currency_conversion_date(i),
6978           P_CURRENCY_CONVERSION_TYPE     => g_suite_rec_tbl.currency_conversion_type(i),
6979           P_CURRENCY_CONVERSION_RATE     => g_suite_rec_tbl.currency_conversion_rate(i),
6980           P_TAX_CURRENCY_CONVERSION_DATE => null                                       ,
6981           P_TAX_CURRENCY_CONVERSION_TYPE => null                                       ,
6982           P_TAX_CURRENCY_CONVERSION_RATE => null                                       ,
6983           P_TRX_CURRENCY_CODE            => g_suite_rec_tbl.trx_currency_code(i)       ,
6984           P_TAX_CURRENCY_CODE            => null                                       ,
6985           P_TRX_LINE_DIST_QTY            => null                                       ,
6986           P_REF_DOC_TRX_LINE_DIST_QTY    => null                                       ,
6987           P_PRICE_DIFF                   => null                                       ,
6988           P_QTY_DIFF                     => null                                       ,
6989           P_PER_TRX_CURR_UNIT_NR_AMT     => null                                       ,
6990           P_REF_PER_TRX_CURR_UNIT_NR_AMT => null                                       ,
6991           P_REF_DOC_CURR_CONV_RATE       => null                                       ,
6992           P_UNIT_PRICE                   => null                                       ,
6993           P_REF_DOC_UNIT_PRICE           => null                                       ,
6994           P_PER_UNIT_NREC_TAX_AMT        => null                                       ,
6995           P_REF_DOC_PER_UNIT_NREC_TAX_AM => null                                       ,
6996           P_RATE_TAX_FACTOR              => null                                       ,
6997           P_TAX_APPORTIONMENT_FLAG       => null                                       ,
6998           P_TRX_LINE_DIST_AMT            => g_suite_rec_tbl.trx_line_dist_amt(i)       ,
6999           P_TRX_LINE_DIST_TAX_AMT        => null                                       ,
7000           P_ORIG_REC_NREC_RATE           => null                                       ,
7001           P_ORIG_REC_RATE_CODE           => null                                       ,
7002           P_ORIG_REC_NREC_TAX_AMT        => null                                       ,
7003           P_ORIG_REC_NREC_TAX_AMT_TAX_CU => null                                       ,
7004           P_ACCOUNT_CCID                 => null                                       ,
7005           P_ACCOUNT_STRING               => null                                       ,
7006           P_UNROUNDED_REC_NREC_TAX_AMT   => null                                       ,
7007           P_APPLICABILITY_RESULT_ID      => null                                       ,
7008           P_REC_RATE_RESULT_ID           => null                                       ,
7009           P_BACKWARD_COMPATIBILITY_FLAG  => null                                       ,
7010           P_OVERRIDDEN_FLAG              => null                                       ,
7011           P_SELF_ASSESSED_FLAG           => g_suite_rec_tbl.self_assessed_flag(i)      ,
7012           P_FREEZE_FLAG                  => g_suite_rec_tbl.freeze_flag(i)             ,
7013           P_POSTING_FLAG                 => g_suite_rec_tbl.posting_flag(i)            ,
7014           P_GL_DATE                      => null                                       ,
7015           P_REF_DOC_APPLICATION_ID       => null                                       ,
7016           P_REF_DOC_ENTITY_CODE          => null                                       ,
7017           P_REF_DOC_EVENT_CLASS_CODE     => null                                       ,
7018           P_REF_DOC_TRX_ID               => null                                       ,
7019           P_REF_DOC_TRX_LEVEL_TYPE       => null                                       ,
7020           P_REF_DOC_LINE_ID              => null                                       ,
7021           P_REF_DOC_DIST_ID              => null                                       ,
7022           P_MINIMUM_ACCOUNTABLE_UNIT     => null                                       ,
7023           P_PRECISION                    => null                                       ,
7024           P_ROUNDING_RULE_CODE           => null                                       ,
7025           P_TAXABLE_AMT                  => null                                       ,
7026           P_TAXABLE_AMT_TAX_CURR         => null                                       ,
7027           P_TAXABLE_AMT_FUNCL_CURR       => null                                       ,
7028           P_TAX_ONLY_LINE_FLAG           => null                                       ,
7029           P_UNROUNDED_TAXABLE_AMT        => null                                       ,
7030           P_LEGAL_ENTITY_ID              => null                                       ,
7031           P_PRD_TAX_AMT                  => null                                       ,
7032           P_PRD_TAX_AMT_TAX_CURR         => null                                       ,
7033           P_PRD_TAX_AMT_FUNCL_CURR       => null                                       ,
7034           P_PRD_TOTAL_TAX_AMT            => null                                       ,
7035           P_PRD_TOTAL_TAX_AMT_TAX_CURR   => null                                       ,
7036           P_PRD_TOTAL_TAX_AMT_FUNCL_CURR => null                                       ,
7037           P_APPLIED_FROM_TAX_DIST_ID     => null                                       ,
7038           P_APPL_TO_DOC_CURR_CONV_RATE   => null                                       ,
7039           P_ADJUSTED_DOC_TAX_DIST_ID     => null                                       ,
7040           P_FUNC_CURR_ROUNDING_ADJUST    => null                                       ,
7041           P_TAX_APPORTIONMENT_LINE_NUM   => null                                       ,
7042           P_LAST_MANUAL_ENTRY            => null                                       ,
7043           P_REF_DOC_TAX_DIST_ID          => null                                       ,
7044           P_MRC_TAX_DIST_FLAG            => null                                       ,
7045           P_MRC_LINK_TO_TAX_DIST_ID      => null                                       ,
7046 /*          P_HDR_TRX_USER_KEY1            => null                                       ,
7047           P_HDR_TRX_USER_KEY2            => null                                       ,
7048           P_HDR_TRX_USER_KEY3            => null                                       ,
7049           P_HDR_TRX_USER_KEY4            => null                                       ,
7050           P_HDR_TRX_USER_KEY5            => null                                       ,
7051           P_HDR_TRX_USER_KEY6            => null                                       ,
7052           P_LINE_TRX_USER_KEY1           => null                                       ,
7053           P_LINE_TRX_USER_KEY2           => null                                       ,
7054           P_LINE_TRX_USER_KEY3           => null                                       ,
7055           P_LINE_TRX_USER_KEY4           => null                                       ,
7056           P_LINE_TRX_USER_KEY5           => null                                       ,
7057           P_LINE_TRX_USER_KEY6           => null                                       ,
7058           P_DIST_TRX_USER_KEY1           => null                                       ,
7059           P_DIST_TRX_USER_KEY2           => null                                       ,
7060           P_DIST_TRX_USER_KEY3           => null                                       ,
7061           P_DIST_TRX_USER_KEY4           => null                                       ,
7062           P_DIST_TRX_USER_KEY5           => null                                       ,
7063           P_DIST_TRX_USER_KEY6           => null                                       ,
7064           P_REPORTING_CURRENCY_CODE      => null                                       ,
7065           P_INTERNAL_ORGANIZATION_ID     => null                                       ,*/
7066           P_ATTRIBUTE_CATEGORY           => null                                       ,
7067           P_ATTRIBUTE1                   => null                                       ,
7068           P_ATTRIBUTE2                   => null                                       ,
7069           P_ATTRIBUTE3                   => null                                       ,
7070           P_ATTRIBUTE4                   => null                                       ,
7071           P_ATTRIBUTE5                   => null                                       ,
7072           P_ATTRIBUTE6                   => null                                       ,
7073           P_ATTRIBUTE7                   => null                                       ,
7074           P_ATTRIBUTE8                   => null                                       ,
7075           P_ATTRIBUTE9                   => null                                       ,
7076           P_ATTRIBUTE10                  => null                                       ,
7077           P_ATTRIBUTE11                  => null                                       ,
7078           P_ATTRIBUTE12                  => null                                       ,
7079           P_ATTRIBUTE13                  => null                                       ,
7080           P_ATTRIBUTE14                  => null                                       ,
7081           P_ATTRIBUTE15                  => null                                       ,
7082           P_GLOBAL_ATTRIBUTE_CATEGORY    => null                                       ,
7083           P_GLOBAL_ATTRIBUTE1            => null                                       ,
7084           P_GLOBAL_ATTRIBUTE2            => null                                       ,
7085           P_GLOBAL_ATTRIBUTE3            => null                                       ,
7086           P_GLOBAL_ATTRIBUTE4            => null                                       ,
7087           P_GLOBAL_ATTRIBUTE5            => null                                       ,
7088           P_GLOBAL_ATTRIBUTE6            => null                                       ,
7089           P_GLOBAL_ATTRIBUTE7            => null                                       ,
7090           P_GLOBAL_ATTRIBUTE8            => null                                       ,
7091           P_GLOBAL_ATTRIBUTE9            => null                                       ,
7092           P_GLOBAL_ATTRIBUTE10           => null                                       ,
7093           P_GLOBAL_ATTRIBUTE11           => null                                       ,
7094           P_GLOBAL_ATTRIBUTE12           => null                                       ,
7095           P_GLOBAL_ATTRIBUTE13           => null                                       ,
7096           P_GLOBAL_ATTRIBUTE14           => null                                       ,
7097           P_GLOBAL_ATTRIBUTE15           => null                                       ,
7098           P_GLOBAL_ATTRIBUTE16           => null                                       ,
7099           P_GLOBAL_ATTRIBUTE17           => null                                       ,
7100           P_GLOBAL_ATTRIBUTE18           => null                                       ,
7101           P_GLOBAL_ATTRIBUTE19           => null                                       ,
7102           P_GLOBAL_ATTRIBUTE20           => null                                       ,
7103           P_ORIG_AP_CHRG_DIST_NUM        => null                                       ,
7104           P_ORIG_AP_CHRG_DIST_ID         => null                                       ,
7105           P_ORIG_AP_TAX_DIST_NUM         => null                                       ,
7106           P_ORIG_AP_TAX_DIST_ID          => null                                       ,
7107           P_OBJECT_VERSION_NUMBER        => l_object_version_number+1                  ,
7108 --          P_CREATED_BY                   => 1       , -------------------------------
7109 --          P_CREATION_DATE                => sysdate , -- What are the correct values
7110           P_LAST_UPDATED_BY              => 1       , -- to pass for who columns?
7111           P_LAST_UPDATE_LOGIN            => 1       , -- Review this later.
7112           P_LAST_UPDATE_DATE             => sysdate); -------------------------------
7113  null;
7114     END LOOP;
7115 
7116     ELSIF p_api_service = 'SYNCHRONIZE_TAX_REPOSITORY' THEN
7117 
7118       ------------------------------------------------------------------
7119       --The values for sync_trx_rec are stored in global variable
7120       --g_sync_trx_rec
7121       ------------------------------------------------------------------
7122       l_sync_trx_rec := g_sync_trx_rec;
7123 
7124       ------------------------------------------------------------------
7125       --The values for sync_trx_lines_tbl are stored in global variable
7126       --g_sync_trx_lines_tbl
7127       ------------------------------------------------------------------
7128       l_sync_trx_lines_tbl := g_sync_trx_lines_tbl;
7129 
7130       -----------------------------------------------------------
7131       -- Proceeds to Call the API Synchronize Tax Repository
7132       -----------------------------------------------------------
7133         zx_api_pub.synchronize_tax_repository (
7134                 P_API_VERSION         =>  l_api_version       ,
7135                 P_INIT_MSG_LIST       =>  l_init_msg_list     ,
7136                 P_COMMIT              =>  l_commit            ,
7137                 P_VALIDATION_LEVEL    =>  l_validation_level  ,
7138                 X_RETURN_STATUS       =>  l_return_status     ,
7139                 X_MSG_COUNT           =>  l_msg_count         ,
7140                 X_MSG_DATA            =>  l_msg_data          ,
7141                 P_SYNC_TRX_REC        =>  l_sync_trx_rec      ,
7142                 P_SYNC_TRX_LINES_TBL  =>  l_sync_trx_lines_tbl);
7143 
7144 
7145             write_message('Service ZX_API_PUB.SYNCHRONIZE_TAX_REPOSITORY has been called!.');
7146             write_message('For Suite: '||p_suite_number||' and Case: '||p_case_number);
7147             write_message('x_return_status : '||l_return_status);
7148             write_message('x_msg_count     : '||l_msg_count    );
7149             write_message('x_msg_data      : '||l_msg_data     );
7150 
7151     ELSIF p_api_service = 'OVERRIDE_TAX' THEN
7152             l_override_level := 'S';
7153 
7154             -----------------------------------------------------------
7155             -- Proceeds to Call the API Override Tax
7156             -----------------------------------------------------------
7157             zx_api_pub.override_tax(
7158                            P_API_VERSION      => l_api_version      ,
7159                            P_INIT_MSG_LIST    => l_init_msg_list    ,
7160                            P_COMMIT           => l_commit           ,
7161                            P_VALIDATION_LEVEL => l_validation_level ,
7162                            X_RETURN_STATUS    => l_return_status    ,
7163                            X_MSG_COUNT        => l_msg_count        ,
7164                            X_MSG_DATA         => l_msg_data         ,
7165                            P_TRANSACTION_REC  => g_transaction_rec  ,
7166                            P_OVERRIDE_LEVEL   => l_override_level   ,
7167                            P_EVENT_ID         => null -- v7 change. From where to obtain l_event_id?
7168                            );
7169 
7170             write_message('Service ZX_API_PUB.OVERRIDE_TAX has been called!. ');
7171             write_message('For Suite: '||p_suite_number||' and Case: '||p_case_number);
7172             write_message('x_return_status : '||l_return_status);
7173             write_message('x_msg_count     : '||l_msg_count    );
7174             write_message('x_msg_data      : '||l_msg_data     );
7175 
7176     ELSIF p_api_service = 'GLOBAL_DOCUMENT_UPDATE' THEN
7177            -----------------------------------------------------------
7178       -- Proceeds to Call the API Synchronize Tax Repository
7179       -----------------------------------------------------------
7180       zx_api_pub.global_document_update (
7181                      l_api_version      ,
7182                      l_init_msg_list    ,
7183                      l_commit           ,
7184                      l_validation_level ,
7185                      l_return_status    ,
7186                      l_msg_count        ,
7187                      l_msg_data         ,
7188                      g_transaction_rec );
7189       write_message('Service ZX_API_PUB.GLOBAL_DOCUMENT_UPDATE has been called!. ');
7190       write_message('For Suite: '||p_suite_number||' and Case: '||p_case_number);
7191       write_message('x_return_status : '||l_return_status);
7192       write_message('x_msg_count     : '||l_msg_count    );
7193       write_message('x_msg_data      : '||l_msg_data     );
7194 
7195     ELSIF p_api_service = 'MARK_TAX_LINES_DELETED' THEN
7196       -----------------------------------------------------------
7197       -- Proceeds to Call the API Synchronize Tax Repository
7198       -----------------------------------------------------------
7199       zx_api_pub.mark_tax_lines_deleted (
7200                      l_api_version      ,
7201                      l_init_msg_list    ,
7202                      l_commit           ,
7203                      l_validation_level ,
7204                      l_return_status    ,
7205                      l_msg_count        ,
7206                      l_msg_data         ,
7207                      g_transaction_line_rec);
7208 
7209       write_message('Service ZX_API_PUB.MARK_TAX_LINES_DELETED has been called!. ');
7210       write_message('For Suite: '||p_suite_number||' and Case: '||p_case_number);
7211       write_message('x_return_status : '||l_return_status);
7212       write_message('x_msg_count     : '||l_msg_count    );
7213       write_message('x_msg_data      : '||l_msg_data     );
7214 
7215     ELSIF p_api_service = 'IMPORT_DOCUMENT_WITH_TAX' THEN
7216       -----------------------------------------------------------
7217       -- Proceeds to Call the API Synchronize Tax Repository
7218       -----------------------------------------------------------
7219       zx_api_pub.import_document_with_tax (
7220                      l_api_version      ,
7221                      l_init_msg_list    ,
7222                      l_commit           ,
7223                      l_validation_level ,
7224                      l_return_status    ,
7225                      l_msg_count        ,
7226                      l_msg_data
7227                      );
7228 
7229       write_message('Service ZX_API_PUB.IMPORT_DOCUMENT_WITH_TAX has been called!. ');
7230       write_message('For Suite: '||p_suite_number||' and Case: '||p_case_number);
7231       write_message('x_return_status : '||l_return_status);
7232       write_message('x_msg_count     : '||l_msg_count    );
7233       write_message('x_msg_data      : '||l_msg_data     );
7234 
7235     ELSIF p_api_service = 'VALIDATE_DOCUMENT_WITH_TAX' THEN
7236       -----------------------------------------------------------
7237       -- Proceeds to Call the API Synchronize Tax Repository
7238       -----------------------------------------------------------
7239       zx_api_pub.validate_document_for_tax (
7240                      P_API_VERSION       => l_api_version      ,
7241                      P_INIT_MSG_LIST     => l_init_msg_list    ,
7242                      P_COMMIT            => l_commit           ,
7243                      P_VALIDATION_LEVEL  => l_validation_level ,
7244                      X_RETURN_STATUS     => l_return_status    ,
7245                      X_MSG_COUNT         => l_msg_count        ,
7246                      X_MSG_DATA          => l_msg_data         ,
7247                      P_TRANSACTION_REC   => g_transaction_rec  ,
7248                      X_VALIDATION_STATUS => l_validation_status,
7249                      X_HOLD_CODES_TBL    => l_hold_codes_tbl);
7250 
7251       write_message('Service ZX_API_PUB.VALIDATE_DOCUMENT_WITH_TAX has been called!. ');
7252       write_message('For Suite: '||p_suite_number||' and Case: '||p_case_number);
7253       write_message('x_return_status : '||l_return_status);
7254       write_message('x_msg_count     : '||l_msg_count    );
7255       write_message('x_msg_data      : '||l_msg_data     );
7256 
7257     ELSIF p_api_service = 'REVERSE_DOCUMENT_DISTRIBUTIONS' THEN
7258       -----------------------------------------------------------
7259       -- Proceeds to Call the API Reverse Document Distribution
7260       -----------------------------------------------------------
7261       zx_api_pub.reverse_document_distribution (
7262                      l_api_version      ,
7263                      l_init_msg_list    ,
7264                      l_commit           ,
7265                      l_validation_level ,
7266                      l_return_status    ,
7267                      l_msg_count        ,
7268                      l_msg_data         );
7269 
7270       write_message('Service ZX_API_PUB.REVERSE_DOCUMENT_DISTRIBUTION has been called!. ');
7271       write_message('For Suite: '||p_suite_number||' and Case: '||p_case_number);
7272       write_message('x_return_status : '||l_return_status);
7273       write_message('x_msg_count     : '||l_msg_count    );
7274       write_message('x_msg_data      : '||l_msg_data     );
7275 
7276     ELSIF p_api_service = 'REVERSE_DOCUMENT' THEN
7277       -----------------------------------------------------------
7278       -- Proceeds to Call the API Synchronize Tax Repository
7279       -----------------------------------------------------------
7280       zx_api_pub.reverse_document (
7281                      l_api_version      ,
7282                      l_init_msg_list    ,
7283                      l_commit           ,
7284                      l_validation_level ,
7285                      l_return_status    ,
7286                      l_msg_count        ,
7287                      l_msg_data         );
7288 
7289       write_message('Service ZX_API_PUB.REVERSE_DOCUMENT has been called!. ');
7290       write_message('For Suite: '||p_suite_number||' and Case: '||p_case_number);
7291       write_message('x_return_status : '||l_return_status);
7292       write_message('x_msg_count     : '||l_msg_count    );
7293       write_message('x_msg_data      : '||l_msg_data     );
7294 
7295     ELSIF p_api_service = 'REVERSE_DISTRIBUTIONS' THEN
7296       -----------------------------------------------------------
7297       -- Proceeds to Call the API REVERSE DISTRIBUTIONS
7298       -----------------------------------------------------------
7299       zx_api_pub.reverse_distributions (
7300                      l_api_version      ,
7301                      l_init_msg_list    ,
7302                      l_commit           ,
7303                      l_validation_level ,
7304                      l_return_status    ,
7305                      l_msg_count        ,
7306                      l_msg_data         );
7307 
7308       write_message('Service ZX_API_PUB.REVERSE_DISTRIBUTIONS has been called!. ');
7309       write_message('For Suite: '||p_suite_number||' and Case: '||p_case_number);
7310       write_message('x_return_status : '||l_return_status);
7311       write_message('x_msg_count     : '||l_msg_count    );
7312       write_message('x_msg_data      : '||l_msg_data     );
7313 
7314     ELSIF p_api_service = 'DETERMINE_RECOVERY' THEN
7315       -----------------------------------------------------------
7316       -- Proceeds to Call the API Synchronize Tax Repository
7317       -----------------------------------------------------------
7318       zx_api_pub.determine_recovery (
7319                l_api_version      ,
7320                l_init_msg_list    ,
7321                l_commit           ,
7322                l_validation_level ,
7323                l_return_status    ,
7324                l_msg_count        ,
7325                l_msg_data
7326                );
7327 
7328       write_message('Service ZX_API_PUB.DETERMINE_RECOVERY has been called!. ');
7329       write_message('For Suite: '||p_suite_number||' and Case: '||p_case_number);
7330       write_message('x_return_status : '||l_return_status);
7331       write_message('x_msg_count     : '||l_msg_count    );
7332       write_message('x_msg_data      : '||l_msg_data     );
7333 
7334     ELSIF p_api_service = 'OVERRIDE_RECOVERY' THEN
7335       -----------------------------------------------------------
7336       -- Proceeds to Call the API Synchronize Tax Repository
7337       -----------------------------------------------------------
7338       zx_api_pub.override_recovery (
7339                      l_api_version      ,
7340                      l_init_msg_list    ,
7341                      l_commit           ,
7342                      l_validation_level ,
7343                      l_return_status    ,
7344                      l_msg_count        ,
7345                      l_msg_data         ,
7346                      g_transaction_rec  );
7347 
7348       write_message('Service ZX_API_PUB.OVERRIDE_RECOVERY has been called!. ');
7349       write_message('For Suite: '||p_suite_number||' and Case: '||p_case_number);
7350       write_message('x_return_status : '||l_return_status);
7351       write_message('x_msg_count     : '||l_msg_count    );
7352       write_message('x_msg_data      : '||l_msg_data     );
7353 
7354     ELSIF p_api_service = 'FREEZE_DISTRIBUTION_LINES' THEN
7355       -----------------------------------------------------------
7356       -- Proceeds to Call the API Synchronize Tax Repository
7357       -----------------------------------------------------------
7358       zx_api_pub.freeze_tax_distributions (
7359                      l_api_version      ,
7360                      l_init_msg_list    ,
7361                      l_commit           ,
7362                      l_validation_level ,
7363                      l_return_status    ,
7364                      l_msg_count        ,
7365                      l_msg_data         ,
7366                      g_transaction_rec  );
7367 
7368       write_message('Service ZX_API_PUB.FREEZE_DISTRIBUTION_LINES has been called!. ');
7369       write_message('For Suite: '||p_suite_number||' and Case: '||p_case_number);
7370       write_message('x_return_status : '||l_return_status);
7371       write_message('x_msg_count     : '||l_msg_count    );
7372       write_message('x_msg_data      : '||l_msg_data     );
7373 
7374     -------------------------------------------------------------
7375     -- Call the APIs for the case has been just finished reading.
7376     -------------------------------------------------------------
7377     ELSIF p_api_service = 'CANCEL' THEN
7378       -----------------------------------------------------------
7379       -- Logic for the Cancel Document
7380       -----------------------------------------------------------
7381 
7382       -----------------------------------------------------------
7383       -- Logic to get the start and end number in the case
7384       -----------------------------------------------------------
7385 
7386       get_start_end_rows_structure
7387        (
7388         p_suite     =>  p_suite_number,
7389         p_case      =>  p_case_number,
7390         p_structure =>  'STRUCTURE_TRANSACTION_RECORD',
7391         x_start_row =>  l_initial_row,
7392         x_end_row   =>  l_ending_row
7393        );
7394 
7395       write_message('----------------------------------------------------------');
7396       write_message('Getting start and end rows of the structure '||to_char(l_initial_row)||' End '||to_char(l_ending_row));
7397 
7398       -----------------------------------------------------------
7399       -- Inserting tax dist id
7400       -----------------------------------------------------------
7401       insert_rows_tax_dist_id_gt(p_transaction_id);
7402 
7403       -----------------------------------------------------------
7404       -- Inserting into transaction record
7405       -----------------------------------------------------------
7406 
7407       insert_row_transaction_rec(g_transaction_rec,l_initial_row);
7408 
7409       write_message('----------------------------------------------------------');
7410       write_message('After inserting row_transaction_rec ');
7411 
7412       -----------------------------------------------------------
7413        -- Selecting Event Type Code
7414       -----------------------------------------------------------
7415       Begin
7416 
7417         Select event_type_code into g_transaction_rec.event_type_code
7418         FROM   zx_evnt_typ_mappings
7419         WHERE  application_id = g_suite_rec_tbl.APPLICATION_ID(l_initial_row)
7420         AND    entity_code = g_suite_rec_tbl.ENTITY_CODE(l_initial_row)
7421         AND    event_class_code = g_suite_rec_tbl.EVENT_CLASS_CODE(l_initial_row)
7422         AND    tax_event_type_code = 'UPDATE';
7423 
7424       EXCEPTION
7425         WHEN NO_DATA_FOUND THEN
7426         FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
7427         FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','Fetching event type code in cancel logic: '||sqlerrm);
7428         write_message(substr(fnd_message.get,1,200));
7429         FND_MSG_PUB.Add;
7430         WHEN OTHERS THEN
7431         FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
7432         FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','Fetching Event type Code in cancel logic: '||sqlerrm);
7433         write_message(substr(fnd_message.get,1,200));
7434         FND_MSG_PUB.Add;
7435       END;
7436 
7437 
7438       -----------------------------------------------------------
7439       -- Inserting into zx_trx_headers_gt and
7440       -- zx_transaction_lines_gt
7441       -----------------------------------------------------------
7442 
7443        Insert into zx_trx_headers_gt
7444                    ( INTERNAL_ORGANIZATION_ID,
7445                      APPLICATION_ID,
7446                      ENTITY_CODE,
7447                      EVENT_CLASS_CODE,
7448                      EVENT_TYPE_CODE,
7449                      TRX_ID,
7450                      TRX_DATE,
7451                      TRX_CURRENCY_CODE,
7452                      PRECISION,
7453                      LEGAL_ENTITY_ID)
7454               SELECT INTERNAL_ORGANIZATION_ID,
7455                      APPLICATION_ID,
7456                      ENTITY_CODE,
7457                      EVENT_CLASS_CODE,
7458                      G_TRANSACTION_REC.EVENT_TYPE_CODE,
7459                      TRX_ID,
7460                      TRX_DATE,
7461                      TRX_CURRENCY_CODE,
7462                      PRECISION,
7463                      LEGAL_ENTITY_ID
7464               FROM   zx_lines
7465               WHERE  trx_id = p_transaction_id
7466               AND    tax_only_line_flag= 'N';
7467 
7468  --- Inserting into zx_transaction_lines_gt has changed. Correct it later.
7469  /*      Insert into zx_transaction_lines_gt
7470                    ( APPLICATION_ID,
7471                      ENTITY_CODE,
7472                      EVENT_CLASS_CODE,
7473                      TRX_LEVEL_TYPE,
7474                      LINE_LEVEL_ACTION,
7475                      TRX_BUSINESS_CATEGORY,
7476                      LINE_AMT,
7477                      TRX_LINE_QUANTITY,
7478                      UNIT_PRICE,
7479                      --UOM_CODE,                --Commented for V6 Changes.
7480                      TRX_LINE_GL_DATE,
7481                      LINE_AMT_INCLUDES_TAX_FLAG)
7482              SELECT  APPLICATION_ID,
7483                      ENTITY_CODE,
7484                      EVENT_CLASS_CODE,
7485                      TRX_LEVEL_TYPE,
7486                      'DISCARD',
7487                      TRX_BUSINESS_CATEGORY,
7488                      LINE_AMT,
7489                      TRX_LINE_QUANTITY,
7490                      UNIT_PRICE,
7491                      --UOM_CODE,                        -- Commented for V6 Changes.
7492                      sysdate, --TRX_LINE_GL_DATE,       -- Commented for V6 changes.
7493                      'A'   --LINE_AMT_INCLUDES_TAX_FLAG -- Commented for V6 Changes.
7494               FROM   zx_lines
7495               WHERE  trx_id = p_transaction_id
7496               AND    tax_only_line_flag= 'N'; */
7497 
7498       -----------------------------------------------------------
7499       -- Proceeds to Call the APIs Calculate Tax
7500       -----------------------------------------------------------
7501       zx_api_pub.calculate_tax (
7502                      p_api_version      => l_api_version      ,
7503                      p_init_msg_list    => l_init_msg_list    ,
7504                      p_commit           => l_commit           ,
7505                      p_validation_level => l_validation_level ,
7506                      x_return_status    => l_return_status    ,
7507                      x_msg_count        => l_msg_count        ,
7508                      x_msg_data         => l_msg_data
7509                      );
7510       write_message('----------------------------------------------------------');
7511       write_message('Service ZX_API_PUB.CALCULATE_TAX has been called! For '||
7512                     'Suite: '||p_suite_number||' and Case: '||p_case_number);
7513       write_message('x_return_status : '||l_return_status);
7514       write_message('x_msg_count     : '||l_msg_count    );
7515       write_message('x_msg_data      : '||l_msg_data    );
7516       write_message('Trx Id          : '||to_char(p_transaction_id));
7517 
7518        l_flag := 'N';
7519 
7520       Begin
7521 
7522         SELECT 'X' into l_flag
7523         FROM zx_lines
7524         WHERE trx_id = p_transaction_id
7525         AND   tax_only_line_flag= 'Y';
7526 
7527       EXCEPTION
7528         WHEN NO_DATA_FOUND THEN
7529         FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
7530         FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','Tax Only Lines Flag: '||sqlerrm);
7531         write_message(substr(fnd_message.get,1,200));
7532         FND_MSG_PUB.Add;
7533         WHEN OTHERS THEN
7534         FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
7535         FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','Tax Only Lines Flag: '||sqlerrm);
7536         write_message(substr(fnd_message.get,1,200));
7537         FND_MSG_PUB.Add;
7538       END;
7539 
7540        IF l_flag = 'X' THEN
7541 
7542       -----------------------------------------------------------
7543       -- Calling  Discard tax only Lines
7544       -----------------------------------------------------------
7545 
7546          zx_api_pub.Discard_tax_only_lines
7547          (
7548            p_api_version => l_api_version      ,
7549            p_init_msg_list => l_init_msg_list    ,
7550            p_commit => l_commit           ,
7551            p_validation_level => l_validation_level ,
7552            x_return_status => l_return_status    ,
7553            x_msg_count => l_msg_count        ,
7554            x_msg_data => l_msg_data         ,
7555            p_transaction_rec => g_transaction_rec  );
7556 
7557            write_message('----------------------------------------------------------');
7558            write_message('Service ZX_API_PUB.Discard_Tax_only_lines has been called ');
7559            write_message('x_return_status : '||l_return_status);
7560 
7561        END IF;
7562 
7563       -----------------------------------------------------------
7564        --  Inserting into rev_dist_lines_gt
7565       -----------------------------------------------------------
7566 
7567           insert_into_rev_dist_lines_gt(p_transaction_id);
7568 
7569       -----------------------------------------------------------
7570        -- Proceeds to Call Reverse Distributions
7571       -----------------------------------------------------------
7572             zx_api_pub.Reverse_distributions (
7573                            p_api_version => l_api_version      ,
7574                            p_init_msg_list => l_init_msg_list    ,
7575                            p_commit => l_commit           ,
7576                            p_validation_level => l_validation_level ,
7577                            x_return_status => l_return_status    ,
7578                            x_msg_count => l_msg_count        ,
7579                            x_msg_data  => l_msg_data         );
7580 
7581             write_message('Service Reverse_Distributions');
7582             write_message('After calling Reverse_distributions ');
7583             write_message('x_return_status : '||l_return_status);
7584             write_message('x_msg_count     : '||l_msg_count    );
7585             write_message('x_msg_data      : '||l_msg_data     );
7586 
7587       ----------------------------------------------------------------------
7588        --   Call validate_document_for_tax
7589       ----------------------------------------------------------------------
7590 
7591 	    zx_api_pub.validate_document_for_tax (
7592 		     p_api_version       => l_api_version,
7593 		     p_init_msg_list     => l_init_msg_list,
7594 		     p_commit            => l_commit,
7595 		     p_validation_level  => l_validation_level,
7596 		     x_return_status     => l_return_status,
7597 		     x_msg_count         => l_msg_count,
7598 		     x_msg_data          => l_msg_data,
7599 		     p_transaction_rec   => g_transaction_rec,
7600 		     x_validation_status => l_validation_status,
7601              x_hold_codes_tbl    => l_hold_codes_tbl);
7602 
7603       write_message('----------------------------------------------------------');
7604       write_message('Service ZX_API_PUB.VALIDATE_DOCUMENT_FOR_TAX ');
7605       write_message('x_return_status : '||l_return_status);
7606       write_message('x_msg_count     : '||l_msg_count    );
7607       write_message('x_msg_data      : '||l_msg_data    );
7608 
7609       l_first := TRUE;
7610 
7611       IF l_hold_codes_tbl.count > 1 THEN
7612         For i in 1..l_hold_codes_tbl.LAST
7613         LOOP
7614           IF l_first THEN
7615             l_tax_hold_code := l_hold_codes_tbl(i);
7616             l_first := FALSE;
7617           ELSE
7618             l_tax_hold_code := l_tax_hold_code||'+'||l_hold_codes_tbl(i);
7619           END IF;
7620         END LOOP;
7621       END IF;
7622 
7623       ----------------------------------------------------------------------
7624        --   Selecting event type code for tax event type 'CANCEL'
7625       ----------------------------------------------------------------------
7626 
7627            --g_transaction_rec.tax_hold_released_code := l_tax_hold_code;
7628            BEGIN
7629            Select event_type_code into g_transaction_rec.event_type_code
7630            FROM   zx_evnt_typ_mappings
7631            WHERE  application_id = g_suite_rec_tbl.APPLICATION_ID(l_initial_row)
7632            AND    entity_code = g_suite_rec_tbl.ENTITY_CODE(l_initial_row)
7633            AND    event_class_code = g_suite_rec_tbl.EVENT_CLASS_CODE(l_initial_row)
7634            AND    tax_event_type_code = 'CANCEL';
7635 
7636            EXCEPTION
7637              WHEN NO_DATA_FOUND THEN
7638              FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
7639              FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','Event Type for Tax event type CANCEL in Cancel Logic: '||sqlerrm);
7640              write_message(substr(fnd_message.get,1,200));
7641              FND_MSG_PUB.Add;
7642              WHEN OTHERS THEN
7643              FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
7644              FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','Event Type Code for Tax Event type CANCEL in Cancel Logic: '||sqlerrm);
7645              write_message(substr(fnd_message.get,1,200));
7646              FND_MSG_PUB.Add;
7647            END;
7648 
7649       ----------------------------------------------------------------------
7650       --   Call global_document_update
7651       ----------------------------------------------------------------------
7652 
7653             zx_api_pub.global_document_update (
7654                      p_api_version      => l_api_version,
7655                      p_init_msg_list    => l_init_msg_list,
7656                      p_commit           => l_commit,
7657                      p_validation_level => l_validation_level ,
7658                      x_return_status    => l_return_status ,
7659                      x_msg_count        => l_msg_count ,
7660                      x_msg_data         => l_msg_data ,
7661                      p_transaction_rec  => g_transaction_rec );
7662 
7663       write_message('----------------------------------------------------------');
7664       write_message('Service ZX_API_PUB.GLOBAL_DOCUMENT_FOR_UPDATE has been called');
7665       write_message('x_return_status : '||l_return_status);
7666       write_message('x_msg_count     : '||l_msg_count    );
7667       write_message('x_msg_data      : '||l_msg_data    );
7668 
7669       ----------------------------------------------------------------------
7670        --   Selecting event type code for tax event type 'RELEASE_HOLD'
7671       ----------------------------------------------------------------------
7672 
7673          BEGIN
7674            Select event_type_code into g_transaction_rec.event_type_code
7675            FROM   zx_evnt_typ_mappings
7676            WHERE  application_id = g_suite_rec_tbl.APPLICATION_ID(l_initial_row)
7677            AND    entity_code = g_suite_rec_tbl.ENTITY_CODE(l_initial_row)
7678            AND    event_class_code = g_suite_rec_tbl.EVENT_CLASS_CODE(l_initial_row)
7679            AND    tax_event_type_code = 'RELEASE_HOLD';
7680          EXCEPTION
7681              WHEN NO_DATA_FOUND THEN
7682              FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
7683              FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','Deriving Event type code for Tax event type release_code in Cancel Logic: '||sqlerrm);
7684              write_message(substr(fnd_message.get,1,200));
7685              FND_MSG_PUB.Add;
7686              WHEN OTHERS THEN
7687              FND_MESSAGE.SET_NAME('ZX','GENERIC_MESSAGE');
7688              FND_MESSAGE.SET_TOKEN('GENERIC_TEXT','Deriving Event type code for Tax event type release_code in Cancel Logic: '||sqlerrm);
7689              write_message(substr(fnd_message.get,1,200));
7690              FND_MSG_PUB.Add;
7691          END;
7692 
7693       ----------------------------------------------------------------------
7694       --   Call global_document_update
7695       ----------------------------------------------------------------------
7696 
7697             zx_api_pub.global_document_update (
7698                      p_api_version => l_api_version ,
7699                      p_init_msg_list => l_init_msg_list    ,
7700                      p_commit => l_commit,
7701                      p_validation_level => l_validation_level ,
7702                      x_return_status => l_return_status ,
7703                      x_msg_count => l_msg_count ,
7704                      x_msg_data => l_msg_data ,
7705                      p_transaction_rec => g_transaction_rec );
7706 
7707       write_message('----------------------------------------------------------');
7708       write_message('Service ZX_API_PUB.GLOBAL_DOCUMENT_UPDATE has been called ');
7709       write_message('x_return_status : '||l_return_status);
7710       write_message('x_msg_count     : '||l_msg_count    );
7711       write_message('x_msg_data     : '||l_msg_data    );
7712 
7713    END IF;
7714 
7715    write_message('--------------------------------------');
7716    write_message('Calls to the APIs have been completed.');
7717    write_message('Populating report table.');
7718    write_message('--------------------------------------');
7719 
7720     ----------------------------------------------------
7721     -- After Calling the API Call populate Report Tables
7722     ----------------------------------------------------
7723     IF l_return_status = 'S' then
7724       IF l_msg_data is not null then
7725         l_error_flag := 'Y';
7726       ELSE
7727         l_error_flag := 'N';
7728       END IF;
7729 
7730       ---------------------------------------------
7731       -- Print messages only when there is a error.
7732       ---------------------------------------------
7733       l_error_flag := 'N';
7734     ELSE
7735       l_error_flag := 'Y';
7736     END IF;
7737 
7738 
7739     If l_return_status = 'S' and l_error_flag = 'Y' then
7740        write_message('Call to API was SUCCESSFUL!, messages are returned.');
7741     Elsif l_return_status = 'S' and l_error_flag = 'N' then
7742        write_message('Call to API was SUCCESSFUL!, no messages are returned.');
7743     Elsif l_return_status <> 'S' and l_error_flag = 'Y' then
7744        write_message('Call to API was NOT SUCCESSFUL!, messages are returned.');
7745     Elsif l_return_status <> 'S' and l_error_flag = 'N' then
7746        write_message('Call to API was NOT SUCCESSFUL!, no messages are returned.');
7747     Else
7748        write_message('Call to API was NOT SUCCESSFUL!');
7749        write_message('return_status:'||l_return_status);
7750        write_message('error_flag:'||l_error_flag);
7751     End if;
7752 
7753 
7754     IF l_msg_count = 1 THEN
7755       --------------------------------------------------------
7756       --If there is one message raised by the API, so it has
7757       --been sent out in the parameter x_msg_dat a, get it.
7758       --------------------------------------------------------
7759       write_message('Retrieving unique message returned by the API...');
7760       write_message('x_msg_data      : '||l_msg_data     );
7761     ELSIF l_msg_count > 1 THEN
7762       -----------------------------------------------------------
7763       --If the messages on the stack are more than one, create a
7764       --loop and put the messages in a PL/SQL table.
7765       -----------------------------------------------------------
7766      write_message('Retrieving multiple messages returned by API...');
7767      LOOP
7768       l_mesg := FND_MSG_PUB.Get(FND_MSG_PUB.G_NEXT,FND_API.G_FALSE);
7769       IF  l_mesg IS NULL THEN
7770          EXIT;
7771       ELSE
7772         write_message(l_mesg);
7773         l_msg_data := l_msg_data ||' '|| ltrim(rtrim(l_mesg));
7774       END IF;
7775      END LOOP;
7776     END IF;
7777 
7778     -----------------------------------------------------
7779     -- If there are messages in ZX_ERRORS_GT extract them
7780     -----------------------------------------------------
7781     get_zx_errors_gt(l_zx_errors_gt);
7782     IF ltrim(rtrim(l_zx_errors_gt)) IS NOT NULL THEN
7783       l_msg_data := l_msg_data ||' Errors from ZX_ERRORS_GT:'||l_zx_errors_gt;
7784       write_message(l_msg_data);
7785     END IF;
7786 
7787     ---------------------------------------------------------
7788     -- Proceed to pupulate the table used by the report
7789     ---------------------------------------------------------
7790     populate_report_table(
7791                           p_suite          => p_suite_number,
7792                           p_case           => p_case_number ,
7793                           p_service        => p_api_service ,
7794                           p_transaction_id => p_transaction_id,
7795                           p_error_flag     => l_error_flag,
7796                           p_error_message  => l_msg_data
7797                          );
7798 
7799   END call_api;
7800 
7801 
7802 /* ====================================================================================*
7803  | PROCEDURE insert_into_gts : Logic to Insert in the Global Temporary Tables,         |
7804  |                             Records or Records of Tables                            |
7805  * ====================================================================================*/
7806   PROCEDURE insert_into_gts (p_suite_number    IN VARCHAR2,
7807                              p_case_number     IN VARCHAR2,
7808                              p_service         IN VARCHAR2,
7809                              p_structure       IN VARCHAR2,
7810                              p_header_row_id   IN NUMBER,
7811                              p_starting_row_id IN NUMBER,
7812                              p_ending_row_id   IN NUMBER,
7813                              p_prev_trx_id     IN NUMBER) IS
7814   l_trx_id       NUMBER;
7815   l_initial_row  NUMBER;
7816   l_ending_row   NUMBER;
7817   l_header_row   NUMBER;
7818 
7819   BEGIN
7820     IF p_service = 'CALCULATE_TAX' THEN
7821       ---------------------------------------------------------------
7822       --Insert the data in the GTT for Transaction Headers
7823       ---------------------------------------------------------------
7824       insert_data_trx_headers_gt(p_header_row_id);
7825       write_message('Row has been inserted in ZX_TRX_HEADERS_GT!');
7826 
7827       ---------------------------------------------------------------
7828       --Insert the data in the GTT for Transaction Lines
7829       ---------------------------------------------------------------
7830       insert_data_trx_lines_gt(p_header_row_id,
7831                                p_starting_row_id,
7832                                p_ending_row_id);
7833       write_message('Row(s) have been inserted in TRX_LINES_GT!');
7834 
7835       ---------------------------------------------------------------
7836       --Insert the data in the MRC Table
7837       ---------------------------------------------------------------
7838       insert_data_mrc_gt(p_header_row_id);
7839       write_message('Row(s) have been inserted in ZX_MRC_GT!');
7840 
7841 
7842     ELSIF p_service = 'DETERMINE_RECOVERY'         THEN
7843           ----------------------------------------------------------
7844           -- Retrieve the initial and ending lines for Imp Tax Lines
7845           ----------------------------------------------------------
7846           get_start_end_rows_structure
7847           (
7848            p_suite     =>  p_suite_number,
7849            p_case      =>  p_case_number,
7850            p_structure =>  'STRUCTURE_TRANSACTION_HEADER',
7851            x_start_row =>  l_initial_row,
7852            x_end_row   =>  l_ending_row
7853            );
7854 
7855           l_header_row := l_initial_row;
7856 
7857           ----------------------------------------------------------------------------
7858           -- BUG 4376581. For Determine Recovery will be required to reinsert
7859           --              the header information. Not to re-use the Header of
7860           --              the Calculate Tax, because Determine Recovery header
7861           --              requires the following header value:
7862           --                 EVENT_TYPE_CODE = STANDARD DISTRIBUTE
7863           --              I'll delete and reinsert the entire Header Information
7864           --              for Determine Recovey as other columns may have changed.
7865           ----------------------------------------------------------------------------
7866           DELETE from ZX_TRX_HEADERS_GT
7867           WHERE  trx_id = g_suite_rec_tbl.TRX_ID(p_header_row_id);
7868 
7869           write_message('--Row for Calculate has been deleted from ZX_TRX_HEADERS_GT!!!');
7870 
7871 
7872           ----------------------------------
7873           -- Insert the Transaction Header
7874           ----------------------------------
7875           insert_data_trx_headers_gt(l_header_row);
7876           write_message('--Row for Recovery has been inserted in ZX_TRX_HEADERS_GT!!!');
7877 
7878 
7879           ----------------------------------------------------------
7880           -- Retrieve the initial and ending lines for Imp Tax Lines
7881           ----------------------------------------------------------
7882           get_start_end_rows_structure
7883           (
7884            p_suite     =>  p_suite_number,
7885            p_case      =>  p_case_number,
7886            p_structure =>  'STRUCTURE_ITEM_DISTRIBUTIONS',
7887            x_start_row =>  l_initial_row,
7888            x_end_row   =>  l_ending_row
7889            );
7890 
7891 
7892           ----------------------------------
7893           -- Insert the Item Distribution
7894           ----------------------------------
7895           insert_itm_distributions_gt
7896              (
7897               p_header_row           => l_header_row,
7898               p_sta_row_item_dist    => l_initial_row,
7899               p_end_row_item_dist    => l_ending_row
7900               );
7901 
7902           write_message('--Row(s) has been inserted in ZX_ITM_DISTRIBUTIONS_GT!!!');
7903 
7904           ---------------------------------------------------------------
7905           --Insert the data in the MRC Table
7906           ---------------------------------------------------------------
7907           insert_data_mrc_gt(p_header_row_id);
7908           write_message('--Row(s) have been inserted in ZX_MRC_GT!');
7909 
7910 
7911 
7912     ELSIF p_service = 'SYNCHRONIZE_TAX_REPOSITORY' THEN
7913 
7914           ----------------------------------------------------
7915           --Insert the row in the g_sync_trx_rec
7916           ----------------------------------------------------
7917           insert_sync_trx_rec(
7918               p_header_row                   =>  p_header_row_id,
7919               x_sync_trx_rec                 =>  g_sync_trx_rec);
7920           write_message('A row has been inserted in g_sync_trx_rec.');
7921 
7922           ----------------------------------------------------
7923           --Insert the row in the g_sync_trx_lines_tbl
7924           ----------------------------------------------------
7925           insert_sync_trx_lines_tbl(
7926               p_header_row                   =>  p_header_row_id,
7927               p_starting_row_sync_trx_lines  =>  p_starting_row_id,
7928               p_ending_row_sync_trx_lines    =>  p_ending_row_id,
7929               x_sync_trx_lines_tbl           =>  g_sync_trx_lines_tbl);
7930           write_message('Rows have been inserted in g_sync_trx_lines_tbl.');
7931 
7932 
7933     ELSIF p_service = 'OVERRIDE_TAX'               THEN
7934           --------------------------
7935           --Insert the row in the GT
7936           --------------------------
7937           insert_data_trx_headers_gt(p_header_row_id);
7938           write_message('-- A row has been inserted in ZX_TRX_HEADERS_GT!!!');
7939 
7940           -----------------------------------------------------------
7941           -- Logic to get the start and end number in the case
7942           -----------------------------------------------------------
7943           get_start_end_rows_structure
7944            (
7945              p_suite     =>  p_suite_number,
7946              p_case      =>  p_case_number,
7947              p_structure =>  'STRUCTURE_TRANSACTION_RECORD',
7948              x_start_row =>  l_initial_row,
7949              x_end_row   =>  l_ending_row
7950            );
7951 
7952           -----------------------------------------------------------
7953           -- Inserting into transaction record
7954           -----------------------------------------------------------
7955           insert_row_transaction_rec(g_transaction_rec,l_initial_row);
7956           write_message('-- A row has been inserted in TRANSACTION RECORD!!!');
7957 
7958     ELSIF p_service = 'GLOBAL_DOCUMENT_UPDATE'     THEN
7959           --------------------------
7960           --Insert the row in the GT
7961           --------------------------
7962           insert_transaction_rec(g_transaction_rec);
7963           write_message('A row has been inserted in transaction_rec.');
7964 
7965     ELSIF p_service = 'MARK_TAX_LINES_DELETED'     THEN
7966           -----------------------------------------------------------
7967           -- Logic to get the start and end number in the case
7968           -----------------------------------------------------------
7969           get_start_end_rows_structure
7970            (
7971              p_suite     =>  p_suite_number,
7972              p_case      =>  p_case_number,
7973              p_structure =>  'STRUCTURE_TRANSACTION_LINE_RECORD',
7974              x_start_row =>  l_initial_row,
7975              x_end_row   =>  l_ending_row
7976            );
7977 
7978           --------------------------
7979           --Insert the row in the GT
7980           --------------------------
7981           insert_transaction_line_rec(g_transaction_line_rec,
7982                                       l_initial_row);
7983 
7984 
7985     ELSIF p_service = 'IMPORT_DOCUMENT_WITH_TAX'   THEN
7986           ---------------------------------------------------------------
7987           --Insert the data in the GTT for Transaction Headers
7988           ---------------------------------------------------------------
7989           insert_data_trx_headers_gt(p_header_row_id);
7990           write_message('Row has been inserted in ZX_TRX_HEADERS_GT!');
7991 
7992           --------------------------------------------------------------
7993           -- Retrieve the initial and ending lines for Transaction Lines
7994           --------------------------------------------------------------
7995           get_start_end_rows_structure
7996           (
7997            p_suite     =>  p_suite_number,
7998            p_case      =>  p_case_number,
7999            p_structure =>  'STRUCTURE_TRANSACTION_LINES',
8000            x_start_row =>  l_initial_row,
8001            x_end_row   =>  l_ending_row
8002            );
8003           --------------------------
8004           --Insert the row in the GT
8005           --------------------------
8006           insert_data_trx_lines_gt(p_header_row_id,
8007                                    l_initial_row,
8008                                    l_ending_row);
8009           write_message('Row(s) have been inserted in TRX_LINES_GT!');
8010 
8011 
8012           ---------------------------------------------------------------
8013           -- Retrieve the initial and ending lines for Imported Tax Lines
8014           ---------------------------------------------------------------
8015           get_start_end_rows_structure
8016           (
8017            p_suite     =>  p_suite_number,
8018            p_case      =>  p_case_number,
8019            p_structure =>  'STRUCTURE_IMPORTED_TAX_LINES',
8020            x_start_row =>  l_initial_row,
8021            x_end_row   =>  l_ending_row
8022            );
8023 
8024           --------------------------------------------
8025           -- Call Insert into Import Summary Tax Lines
8026           --------------------------------------------
8027           insert_import_sum_tax_lines_gt(
8028                                  p_starting_row_tax_lines => l_initial_row,
8029                                  p_ending_row_tax_lines   => l_ending_row);
8030 
8031           ----------------------------------------------------------
8032           -- Retrieve the initial and ending lines for Imp Tax Lines
8033           ----------------------------------------------------------
8034           get_start_end_rows_structure
8035           (
8036            p_suite     =>  p_suite_number,
8037            p_case      =>  p_case_number,
8038            p_structure =>  'STRUCTURE_IMPORTED_TAX_LINES_ALLOCATION',
8039            x_start_row =>  l_initial_row,
8040            x_end_row   =>  l_ending_row
8041            );
8042 
8043           ----------------------------------------------------------------
8044           -- Allocation is Optional in this scenario. So, only if provided
8045           -- will be called.
8046           ----------------------------------------------------------------
8047           IF l_initial_row is not null THEN
8048             write_message('To Call TRX_TAX_LINK_GT insert the initial row is'||to_char(l_initial_row));
8049             -------------------------------------
8050             -- Call Insert into TRX_TAX_LINK_GT
8051             -------------------------------------
8052             insert_trx_tax_link_gt
8053             (
8054               p_sta_row_imp_tax_link  => l_initial_row,
8055               p_end_row_imp_tax_link  => l_ending_row
8056             );
8057           END IF;
8058 
8059           write_message('Rows have been inserted in ZX_TRANSACTION_LINES_GT');
8060           write_message('.                          ZX_IMPORT_TAX_LINES_GT');
8061           write_message('.                          ZX_TRX_TAX_LINE_GT.');
8062 
8063     ELSIF p_service = 'VALIDATE_DOCUMENT_WITH_TAX' THEN
8064           --------------------------
8065           --Insert the row in the GT
8066           --------------------------
8067           insert_transaction_rec(g_transaction_rec);
8068           write_message('A row has been inserted in transaction_rec.');
8069 
8070 
8071     ELSIF p_service = 'REVERSE_DOCUMENT'           THEN
8072           --------------------------
8073           --Insert the row in the GT
8074           --------------------------
8075           insert_reverse_trx_lines_gt;
8076           write_message('A row has been inserted in reverse_trx_lines_gt.');
8077 
8078     ELSIF p_service = 'REVERSE_DISTRIBUTIONS'      THEN
8079           --------------------------
8080           --Insert the row in the GT
8081           --------------------------
8082           insert_reverse_dist_lines_gt;
8083           write_message('A row has been inserted in reverse_dist_lines_gt.');
8084 
8085 
8086     ELSIF p_service = 'OVERRIDE_RECOVERY'          THEN
8087           --------------------------
8088           --Insert the row in the GT
8089           --------------------------
8090           insert_transaction_rec(g_transaction_rec
8091                                  );
8092           write_message('A row has been inserted in transaction_rec.');
8093 
8094     ELSIF p_service = 'FREEZE_DISTRIBUTION_LINES'  THEN
8095           --------------------------
8096           --Insert the row in the GT
8097           --------------------------
8098           insert_transaction_rec(g_transaction_rec);
8099           ----------------------------------
8100           -- Insert the Tax Dist Id
8101           ----------------------------------
8102           insert_tax_dist_id_gt
8103              (
8104               p_suite         => p_suite_number,
8105               p_case          => p_case_number,
8106               p_structure     => 'STRUCTURE_ITEM_DISTRIBUTION_KEY'
8107               );
8108 
8109           write_message('A row has been inserted in transaction_rec.');
8110           write_message('                           distribution_lines_gt.');
8111     END IF;
8112   END insert_into_gts;
8113 
8114 
8115 /* ======================================================================*
8116  | PROCEDURE Get_Tax_Event_Type : Get Tax Event Type                     |
8117  * ======================================================================*/
8118   FUNCTION Get_Tax_Event_Type
8119   (
8120     p_appln_id             IN     NUMBER,
8121     p_entity_code          IN     VARCHAR2,
8122     p_evnt_cls_code        IN     VARCHAR2,
8123     p_evnt_typ_code        IN     VARCHAR2
8124   ) RETURN VARCHAR2
8125   IS
8126     x_tx_evnt_typ_code VARCHAR2(80);
8127 
8128   BEGIN
8129 
8130     SELECT zxevntmap.tax_event_type_code
8131     INTO   x_tx_evnt_typ_code
8132     FROM   zx_evnt_typ_mappings zxevntmap
8133     WHERE  zxevntmap.event_class_code = p_evnt_cls_code
8134     AND    zxevntmap.application_id = p_appln_id
8135     AND    zxevntmap.entity_code = p_entity_code
8136     AND    zxevntmap.event_type_code = p_evnt_typ_code
8137     AND    zxevntmap.enabled_flag = 'Y';
8138 
8139 
8140     RETURN x_tx_evnt_typ_code;
8141 
8142   EXCEPTION
8143 
8144     WHEN OTHERS THEN
8145       write_message('~  The Event Type Mapping is Invalid for:');
8146       write_message('~                             APPLN_ID      :'||p_appln_id);
8147       write_message('~                             ENTITY_CODE   :'||p_entity_code);
8148       write_message('~                             EVENT_CLS_CODE:'||p_evnt_cls_code);
8149       write_message('~                             EVENT_TYP_CODE:'||p_evnt_typ_code);
8150 
8151       FND_MESSAGE.SET_NAME('ZX','ZX_EVNT_TYP_MPG_INVALID');
8152       FND_MSG_PUB.Add;
8153       Return null;
8154 
8155   END Get_Tax_Event_Type;
8156 
8157  /* ====================================================================================*
8158   | FUNCTION RETRIEVE_NTH_ELEMENT: Retrieves a element from a string                   |
8159   * ====================================================================================*/
8160   FUNCTION get_nth_element
8161    (
8162      p_element_number IN NUMBER,
8163      p_string         IN VARCHAR2,
8164      p_separator      IN VARCHAR2
8165    ) RETURN VARCHAR2 IS
8166 
8167   l_position_first_separator  NUMBER;
8168   l_position_second_separator NUMBER;
8169   l_element_length            NUMBER;
8170   l_element_value             VARCHAR2(4000);
8171 
8172   BEGIN
8173     --------------------------------------
8174     -- Calculates position first separator
8175     --------------------------------------
8176     If p_element_number <> 1 then
8177       l_position_first_separator := instr(p_string,p_separator,1,p_element_number-1);
8178     Else
8179       l_position_first_separator := 0;
8180     End if;
8181 
8182     --------------------------------------
8183     -- Calculates position second separator
8184     --------------------------------------
8185     l_position_second_separator := instr(p_string,p_separator,1,p_element_number);
8186 
8187     ---------------------------------------
8188     -- Calculates the length of the element
8189     ---------------------------------------
8190     l_element_length := l_position_second_separator - l_position_first_separator;
8191     l_position_first_separator := l_position_first_separator + 1;
8192     ----------------------------------------
8193     -- Calculates the Element String
8194     ----------------------------------------
8195     If l_element_length = 0 then
8196       -- This element is not in the string
8197       l_element_value := null;
8198     Elsif l_element_length < 0 then
8199       -- This element is the last in the string
8200       l_element_value := substr(p_string,l_position_first_separator);
8201     Elsif l_element_length = 1 then
8202       l_element_value := null;
8203     Else
8204       -- This element exists in the string.
8205       l_element_value := substr(p_string,l_position_first_separator,l_element_length-1);
8206     End If;
8207     RETURN l_element_value;
8208   END get_nth_element;
8209 
8210 /*==========================================================================*
8211  | PROCEDURE Populate_Report_Table : Populates the Report Table to display  |
8212  |                                   the results of the Suite.              |
8213  |                                   First, it has to fetch the information |
8214  |                                   from ZX_LINES,ZX_LINES_SUMMARY and     |
8215  |                                   ZX_REC_NREC_DIST tables, then Bulk     |
8216  |                                   Collect into memory structures and then|
8217  |                                   Bulk insert into the temporary table.  |
8218  *==========================================================================*/
8219 
8220   PROCEDURE Populate_Report_Table
8221   (
8222     p_suite                IN     VARCHAR2,
8223     p_case                 IN     VARCHAR2,
8224     p_service              IN     VARCHAR2,
8225     p_transaction_id       IN     NUMBER,
8226     p_error_flag           IN     VARCHAR2,
8227     p_error_message        IN     VARCHAR2
8228   ) IS
8229 
8230     c_lines_per_fetch           CONSTANT NUMBER:= 1000;
8231     l_counter                   BINARY_INTEGER;
8232     l_counter2                  BINARY_INTEGER;
8233     l_tax_rate_name             NUMBER;
8234     l_tax_rate_type             NUMBER;
8235     l_dummy                     NUMBER;
8236     l_application_id            NUMBER;
8237     l_entity_code               VARCHAR2(2000);
8238     l_event_class_code          VARCHAR2(2000);
8239     l_initial_row               VARCHAR2(2000);
8240     l_ending_row                VARCHAR2(2000);
8241 
8242   BEGIN
8243 
8244     --------------------------------------------------------------
8245     -- Obtain the App, Entity Code and Event Class Code for the
8246     -- current Case.
8247     --------------------------------------------------------------
8248 
8249     FOR i IN g_suite_rec_tbl.ROW_SUITE.FIRST..g_suite_rec_tbl.ROW_SUITE.LAST LOOP
8250       IF g_suite_rec_tbl.ROW_SUITE(i)     = p_suite AND
8251          g_suite_rec_tbl.ROW_CASE(i)      = p_case  AND
8252          g_suite_rec_tbl.APPLICATION_ID(i) IS NOT NULL AND
8253          g_suite_rec_tbl.ENTITY_CODE(i) IS NOT NULL AND
8254          g_suite_rec_tbl.EVENT_CLASS_CODE(i) IS NOT NULL
8255           THEN
8256           l_application_id   := g_suite_rec_tbl.APPLICATION_ID(i);
8257           l_entity_code      := g_suite_rec_tbl.ENTITY_CODE(i);
8258           l_event_class_code := g_suite_rec_tbl.EVENT_CLASS_CODE(i);
8259 
8260       END IF;
8261     END LOOP;
8262 
8263     IF p_error_flag <> 'Y' THEN
8264 
8265       --------------------------------------------------
8266       -- Proceed to Insert ZX_LINES data
8267       --------------------------------------------------
8268       select count(*)
8269       into   l_dummy
8270       from   zx_lines l
8271       where  l.trx_id           = p_transaction_id
8272       and    l.application_id   = l_application_id
8273       and    l.entity_code      = l_entity_code
8274       and    l.event_class_code = l_event_class_code;
8275 
8276 
8277       write_message('The number of rows in ZX_LINES for transaction id '||to_char(p_transaction_id)||' are '||to_char(l_dummy));
8278 
8279       INSERT INTO ZX_TEST_API_GT(
8280           SUITE_NUMBER                                ,
8281           CASE_NUMBER                                 ,
8282           TRX_ID                                      ,
8283           TRX_NUMBER                                  ,
8284           TRX_LINE_NUMBER                             ,
8285           TRX_DATE                                    ,
8286           TRX_CURRENCY_CODE                           ,
8287           SUMMARY_TAX_LINE_ID                         ,
8288           TAX_LINE_ID                                 ,
8289           TAX_REGIME_CODE                             ,
8290           TAX_JURISDICTION_ID                         ,
8291           TAX                                         ,
8292           TAX_STATUS_CODE                             ,
8293           TAX_RATE_ID                                 ,
8294           TAX_RATE_CODE                               ,
8295           TAX_RATE                                    ,
8296           TAX_AMT                                     ,
8297           TAXABLE_AMT                                 ,
8298           REC_TAX_AMT                                 ,
8299           NREC_TAX_AMT                                ,
8300           TAX_AMT_FUNCL_CURR                          ,
8301           TOTAL_REC_TAX_AMT                           ,
8302           TOTAL_NREC_TAX_AMT                          ,
8303           TOTAL_REC_TAX_AMT_FUNCL_CURR                ,
8304           TOTAL_NREC_TAX_AMT_FUNCL_CURR               ,
8305           SELF_ASSESSED_FLAG                          ,
8306           MANUALLY_ENTERED_FLAG                       ,
8307           LINE_AMT_INCLUDES_TAX_FLAG                  ,
8308           TAXABLE_AMT_FUNCL_CURR                      ,
8309           REC_TAX_AMT_FUNCL_CURR                      ,
8310           NREC_TAX_AMT_FUNCL_CURR                     ,
8311           TAX_AMT_INCLUDED_FLAG                       ,
8312           TAX_EXEMPTION_ID                            ,
8313           EXEMPTION_RATE                              ,
8314           EXEMPT_REASON_CODE                          ,
8315           TAX_APPORTIONMENT_LINE_NUMBER               ,
8316           TAX_REGISTRATION_NUMBER                     ,
8317           TAX_HOLD_CODE                               ,
8318           TAX_HOLD_RELEASED_CODE                      ,
8319           LINE_AMT                                    ,
8320           TAX_JURISDICTION_CODE                       ,
8321           TAX_RATE_NAME                               ,
8322           TAX_RATE_TYPE                               ,
8323           TAX_DETERMINE_DATE                          ,
8324           CANCEL_FLAG                                 ,
8325           EVENT_CLASS_CODE                            ,
8326           EVENT_TYPE_CODE                             ,
8327           ETAX_API                                    ,
8328           ERROR_FLAG                                  ,
8329           ERROR_MESSAGE                               )
8330           select
8331           p_suite                                                ,
8332           p_case                                                 ,
8333           p_transaction_id                                       ,
8334           zx_lines.TRX_NUMBER                                    ,
8335           zx_lines.trx_line_id                                   , --zx_lines.TRX_LINE_NUMBER,
8336           zx_lines.TRX_DATE                                      ,
8337           zx_lines.TRX_CURRENCY_CODE                             ,
8338           zx_lines.SUMMARY_TAX_LINE_ID                           ,
8339           zx_lines.TAX_LINE_ID                                   ,
8340           zx_lines.TAX_REGIME_CODE                               ,
8341           zx_lines.TAX_JURISDICTION_ID                           ,
8342           zx_lines.TAX                                           ,
8343           zx_lines.TAX_STATUS_CODE                               ,
8344           zx_lines.TAX_RATE_ID                                   ,
8345           zx_lines.TAX_RATE_CODE                                 ,
8346           zx_lines.TAX_RATE                                      ,
8347           zx_lines.TAX_AMT                                       ,
8348           zx_lines.TAXABLE_AMT                                   ,
8349           zx_lines.REC_TAX_AMT                                   ,
8350           zx_lines.NREC_TAX_AMT                                  ,
8351           zx_lines.TAX_AMT_FUNCL_CURR                            ,
8352           NULL                                                   ,
8353           NULL                                                   ,
8354           NULL                                                   ,
8355           NULL                                                   ,
8356           zx_lines.SELF_ASSESSED_FLAG                            ,
8357           zx_lines.MANUALLY_ENTERED_FLAG                         ,
8358           'A', --substr(zx_lines.LINE_AMT_INCLUDES_TAX_FLAG,1,1)  , --Commented V6 Changes.
8359           zx_lines.TAXABLE_AMT_FUNCL_CURR                        ,
8360           zx_lines.REC_TAX_AMT_FUNCL_CURR                        ,
8361           zx_lines.NREC_TAX_AMT_FUNCL_CURR                       ,
8362           zx_lines.TAX_AMT_INCLUDED_FLAG                         ,
8363           zx_lines.TAX_EXEMPTION_ID                              ,
8364           NULL,      -- zx_lines.EXEMPTION_RATE, --Commented for V6 changes
8365           zx_lines.EXEMPT_REASON_CODE                            ,
8366           zx_lines.TAX_APPORTIONMENT_LINE_NUMBER                 ,
8367           zx_lines.TAX_REGISTRATION_NUMBER                       ,
8368           zx_lines.TAX_HOLD_CODE                                 ,
8369           zx_lines.TAX_HOLD_RELEASED_CODE                        ,
8370           zx_lines.LINE_AMT                                      ,
8371           zx_lines.TAX_JURISDICTION_CODE                         ,
8372           zx_rates_b.tax_rate_code,   --l_TAX_RATE_NAME ,-- Has to be calculated
8373           zx_rates_b.rate_type_code,  --l_TAX_RATE_TYPE_CODE ,-- Has to be calculated
8374           zx_lines.TAX_DETERMINE_DATE                            ,
8375           zx_lines.CANCEL_FLAG                                   ,
8376           zx_lines.EVENT_CLASS_CODE                              ,
8377           zx_lines.EVENT_TYPE_CODE                               ,
8378           p_service                                              ,
8379           'N',   --ERROR_FLAG                                    ,
8380           g_party_rec.prod_family_grp_code||' LINE' --ERROR_MESSAGE
8381           FROM   ZX_LINES,
8382                  ZX_RATES_B
8383           WHERE  trx_id = p_transaction_id
8384           AND    application_id   = l_application_id
8385           AND    entity_code      = l_entity_code
8386           AND    event_class_code = l_event_class_code
8387           AND    zx_lines.tax_rate_id(+) = zx_rates_b.tax_rate_id
8388           ORDER BY trx_id,
8389           trx_line_id;
8390 
8391 
8392       --------------------------------------------------
8393       -- Insert ZX_LINES_SUMMARY data
8394       --------------------------------------------------
8395    select count(*) into l_dummy from zx_lines_summary where trx_id =p_transaction_id;
8396     write_message('The number of rows in ZX_LINES_SUMMARY for transaction id '
8397     ||to_char(p_transaction_id)||' are '||to_char(l_dummy));
8398 
8399         INSERT INTO ZX_TEST_API_GT(
8400           SUITE_NUMBER                                ,
8401           CASE_NUMBER                                 ,
8402           TRX_ID                                      ,
8403           TRX_NUMBER                                  ,
8404           TRX_LINE_NUMBER                             ,
8405           TRX_DATE                                    ,
8406           TRX_CURRENCY_CODE                           ,
8407           SUMMARY_TAX_LINE_ID                         ,
8408           TAX_LINE_ID                                 ,
8409           TAX_REGIME_CODE                             ,
8410           TAX_JURISDICTION_ID                         ,
8411           TAX                                         ,
8412           TAX_STATUS_CODE                             ,
8413           TAX_RATE_ID                                 ,
8414           TAX_RATE_CODE                               ,
8415           TAX_RATE                                    ,
8416           TAX_AMT                                     ,
8417           TAXABLE_AMT                                 ,
8418           REC_TAX_AMT                                 ,
8419           NREC_TAX_AMT                                ,
8420           TAX_AMT_FUNCL_CURR                          ,
8421           TOTAL_REC_TAX_AMT                           ,
8422           TOTAL_NREC_TAX_AMT                          ,
8423           TOTAL_REC_TAX_AMT_FUNCL_CURR                ,
8424           TOTAL_NREC_TAX_AMT_FUNCL_CURR               ,
8425           SELF_ASSESSED_FLAG                          ,
8426           MANUALLY_ENTERED_FLAG                       ,
8427           LINE_AMT_INCLUDES_TAX_FLAG                  ,
8428           TAXABLE_AMT_FUNCL_CURR                      ,
8429           REC_TAX_AMT_FUNCL_CURR                      ,
8430           NREC_TAX_AMT_FUNCL_CURR                     ,
8431           TAX_AMT_INCLUDED_FLAG                       ,
8432           TAX_EXEMPTION_ID                            ,
8433           EXEMPTION_RATE                              ,
8434           EXEMPT_REASON_CODE                          ,
8435           TAX_APPORTIONMENT_LINE_NUMBER               ,
8436           TAX_REGISTRATION_NUMBER                     ,
8437           TAX_HOLD_CODE                               ,
8438           TAX_HOLD_RELEASED_CODE                      ,
8439           LINE_AMT                                    ,
8440           TAX_JURISDICTION_CODE                       ,
8441           TAX_RATE_NAME                               ,
8442           TAX_RATE_TYPE                               ,
8443           TAX_DETERMINE_DATE                          ,
8444           CANCEL_FLAG                                 ,
8445           EVENT_CLASS_CODE                            ,
8446           EVENT_TYPE_CODE                             ,
8447           ETAX_API                                    ,
8448           ERROR_FLAG                                  ,
8449           ERROR_MESSAGE                               )
8450           select p_suite                              ,
8451           p_case                                      ,
8452           p_transaction_id                            ,
8453           zx_lines_summary.TRX_NUMBER                 ,
8454           null,   --TRX_LINE_NUMBER                   ,
8455           null,   --TRX_DATE                          ,
8456           null,   --TRX_CURRENCY_CODE                 ,
8457           zx_lines_summary.SUMMARY_TAX_LINE_ID                  ,
8458           null,   --TAX_LINE_ID                                 ,
8459           zx_lines_summary.TAX_REGIME_CODE                      ,
8460           null,   --zx_lines_summary.TAX_JURISDICTION_ID,  Commented for V6 Changes.
8461           zx_lines_summary.TAX                                  ,
8462           zx_lines_summary.TAX_STATUS_CODE                      ,
8463           zx_lines_summary.TAX_RATE_ID                          ,
8464           zx_lines_summary.TAX_RATE_CODE                        ,
8465           zx_lines_summary.TAX_RATE                             ,
8466           zx_lines_summary.TAX_AMT                              ,
8467           null,   --TAXABLE_AMT                                               ,
8468           null,   --REC_TAX_AMT                                               ,
8469           null,   --NREC_TAX_AMT                                              ,
8470           zx_lines_summary.TAX_AMT_FUNCL_CURR                   ,
8471           zx_lines_summary.TOTAL_REC_TAX_AMT                    ,
8472           zx_lines_summary.TOTAL_NREC_TAX_AMT                   ,
8473           zx_lines_summary.TOTAL_REC_TAX_AMT_FUNCL_CURR         ,
8474           zx_lines_summary.TOTAL_NREC_TAX_AMT_FUNCL_CURR        ,
8475           zx_lines_summary.SELF_ASSESSED_FLAG                   ,
8476           zx_lines_summary.MANUALLY_ENTERED_FLAG                ,
8477           null,   --LINE_AMT_INCLUDES_TAX_FLAG                                ,
8478           null,   --TAXABLE_AMT_FUNCL_CURR                                    ,
8479           null,   --REC_TAX_AMT_FUNCL_CURR                                    ,
8480           null,   --NREC_TAX_AMT_FUNCL_CURR                                   ,
8481           zx_lines_summary.TAX_AMT_INCLUDED_FLAG                ,
8482           null,   --TAX_EXEMPTION_ID                                          ,
8483           null,   --EXEMPTION_RATE                                            ,
8484           null,   --EXEMPT_REASON_CODE                                        ,
8485           null,   --TAX_APPORTIONMENT_LINE_NUMBER                             ,
8486           null,   --TAX_REGISTRATION_NUMBER                                   ,
8487           null,   --TAX_HOLD_CODE                                             ,
8488           null,   --TAX_HOLD_RELEASED_CODE                                    ,
8489           null,   --LINE_AMT                                                  ,
8490           zx_lines_summary.TAX_JURISDICTION_CODE                ,
8491           zx_rates_b.tax_rate_code, --null, --TAX_RATE_NAME     ,
8492           zx_rates_b.rate_type_code, --null, --TAX_RATE_TYPE         ,
8493           null,   --TAX_DETERMINE_DATE                          ,
8494           zx_lines_summary.CANCEL_FLAG                          ,
8495           zx_lines_summary.EVENT_CLASS_CODE                     ,
8496           null,   --EVENT_TYPE_CODE                                           ,
8497           p_service                                                           ,
8498           'N',    --ERROR_FLAG                                             ,
8499           g_party_rec.prod_family_grp_code||' SUMMARY' --ERROR_MESSAGE
8500           FROM    ZX_LINES_SUMMARY,
8501                   ZX_RATES_B
8502           WHERE   trx_id = p_transaction_id
8503           AND     application_id   = l_application_id
8504           AND     entity_code      = l_entity_code
8505           AND     event_class_code = l_event_class_code
8506           AND     zx_lines_summary.tax_rate_id(+) = zx_rates_b.tax_rate_id;
8507 
8508 
8509       --------------------------------------------------
8510       -- Insert ZX_REC_NREC_DIST data
8511       --------------------------------------------------
8512       /*select count(*) into l_dummy from zx_rec_nrec_dist where trx_id =p_transaction_id;
8513       write_message('The number of rows in zx_rec_nrec_dist for transaction id '||to_char(p_transaction_id)||' are '||to_char(l_dummy));*/
8514         INSERT INTO ZX_TEST_API_GT(
8515           SUITE_NUMBER                                ,
8516           CASE_NUMBER                                 ,
8517           TRX_ID                                      ,
8518           TRX_NUMBER                                  ,
8519           TRX_LINE_NUMBER                             ,
8520           TRX_DATE                                    ,
8521           TRX_CURRENCY_CODE                           ,
8522           SUMMARY_TAX_LINE_ID                         ,
8523           TAX_LINE_ID                                 ,
8524           TAX_REGIME_CODE                             ,
8525           TAX_JURISDICTION_ID                         ,
8526           TAX                                         ,
8527           TAX_STATUS_CODE                             ,
8528           TAX_RATE_ID                                 ,
8529           TAX_RATE_CODE                               ,
8530           TAX_RATE                                    ,
8531           TAX_AMT                                     ,
8532           TAXABLE_AMT                                 ,
8533           REC_TAX_AMT                                 ,
8534           NREC_TAX_AMT                                ,
8535           TAX_AMT_FUNCL_CURR                          ,
8536           TOTAL_REC_TAX_AMT                           ,
8537           TOTAL_NREC_TAX_AMT                          ,
8538           TOTAL_REC_TAX_AMT_FUNCL_CURR                ,
8539           TOTAL_NREC_TAX_AMT_FUNCL_CURR               ,
8540           SELF_ASSESSED_FLAG                          ,
8541           MANUALLY_ENTERED_FLAG                       ,
8542           LINE_AMT_INCLUDES_TAX_FLAG                  ,
8543           TAXABLE_AMT_FUNCL_CURR                      ,
8544           REC_TAX_AMT_FUNCL_CURR                      ,
8545           NREC_TAX_AMT_FUNCL_CURR                     ,
8546           TAX_AMT_INCLUDED_FLAG                       ,
8547           TAX_EXEMPTION_ID                            ,
8548           EXEMPTION_RATE                              ,
8549           EXEMPT_REASON_CODE                          ,
8550           TAX_APPORTIONMENT_LINE_NUMBER               ,
8551           TAX_REGISTRATION_NUMBER                     ,
8552           TAX_HOLD_CODE                               ,
8553           TAX_HOLD_RELEASED_CODE                      ,
8554           LINE_AMT                                    ,
8555           TAX_JURISDICTION_CODE                       ,
8556           TAX_RATE_NAME                               ,
8557           TAX_RATE_TYPE                               ,
8558           TAX_DETERMINE_DATE                          ,
8559           CANCEL_FLAG                                 ,
8560           EVENT_CLASS_CODE                            ,
8561           EVENT_TYPE_CODE                             ,
8562           ETAX_API                                    ,
8563           ERROR_FLAG                                  ,
8564           ERROR_MESSAGE                               )
8565    SELECT p_suite                                    ,
8566           p_case                                     ,
8567           p_transaction_id                           ,
8568           null                                       ,   --TRX_NUMBER
8569           zx_rec_nrec_dist.trx_line_id               ,   --zx_rec_nrec_dist.TRX_LINE_NUMBER
8570           null                                       ,   --TRX_DATE
8571           null                                       ,   --TRX_CURRENCY_CODE
8572           zx_rec_nrec_dist.SUMMARY_TAX_LINE_ID       ,
8573           zx_rec_nrec_dist.TAX_LINE_ID               ,
8574           zx_rec_nrec_dist.TAX_REGIME_CODE           ,
8575           null                                       ,   --TAX_JURISDICTION_ID
8576           zx_rec_nrec_dist.TAX                       ,
8577           zx_rec_nrec_dist.TAX_STATUS_CODE           ,
8578           zx_rec_nrec_dist.TAX_RATE_ID               ,
8579           zx_rec_nrec_dist.TAX_RATE_CODE             ,
8580           zx_rec_nrec_dist.TAX_RATE                  ,
8581           zx_rec_nrec_dist.REC_NREC_TAX_AMT          ,   --TAX_AMT --BUG 4376481, Is this the Tax Amt?
8582           zx_rec_nrec_dist.TAXABLE_AMT               ,
8583           null                                       ,   --REC_TAX_AMT
8584           null                                       ,   --NREC_TAX_AMT
8585           null                                       ,   --zx_rec_nrec_dist.TAX_AMT_FUNCL_CURR
8586           null                                       ,   --TOTAL_REC_TAX_AMT
8587           null                                       ,   --TOTAL_NREC_TAX_AMT
8588           null                                       ,   --TOTAL_REC_TAX_AMT_FUNCL_CURR
8589           null                                       ,   --TOTAL_NREC_TAX_AMT_FUNCL_CURR
8590           null                                       ,   --zx_rec_nrec_dist.SELF_ASSESSED_FLAG
8591           null                                       ,   --MANUALLY_ENTERED_FLAG
8592           null                                       ,   --LINE_AMT_INCLUDES_TAX_FLAG
8593           null                                       ,   --TAXABLE_AMT_FUNCL_CURR
8594           null                                       ,   --REC_TAX_AMT_FUNCL_CURR
8595           null                                       ,   --NREC_TAX_AMT_FUNCL_CURR
8596           null                                       ,   --TAX_AMT_INCLUDED_FLAG
8597           null                                       ,   --TAX_EXEMPTION_ID
8598           null                                       ,   --EXEMPTION_RATE
8599           null                                       ,   --EXEMPT_REASON_CODE
8600           null                                       ,   --TAX_APPORTIONMENT_LINE_NUMBER
8601           null                                       ,   --TAX_REGISTRATION_NUMBER
8602           null                                       ,   --TAX_HOLD_CODE
8603           null                                       ,   --TAX_HOLD_RELEASED_CODE
8604           null                                       ,   --LINE_AMT
8605           null                                       ,   --TAX_JURISDICTION_CODE
8606           null                                       ,   --TAX_RATE_NAME
8607           null                                       ,   --TAX_RATE_TYPE
8608           null                                       ,   --TAX_DETERMINE_DATE
8609           null                                       ,   --CANCEL_FLAG
8610           zx_rec_nrec_dist.EVENT_CLASS_CODE          ,
8611           zx_rec_nrec_dist.EVENT_TYPE_CODE           ,
8612           p_service                                  ,
8613           'N'                                        ,    --ERROR_FLAG
8614           g_party_rec.prod_family_grp_code||' DIST'       --ERROR_MESSAGE
8615           FROM    zx_rec_nrec_dist,
8616                   zx_rates_b
8617           WHERE   trx_id = p_transaction_id
8618           AND     application_id   = l_application_id
8619           AND     entity_code      = l_entity_code
8620           AND     event_class_code = l_event_class_code
8621           AND     zx_rec_nrec_dist.tax_rate_id(+) = zx_rates_b.tax_rate_id;
8622 
8623      ELSIF p_error_flag = 'Y' THEN
8624        Write_Message('Error messages will be inserted in the Report Table');
8625        -------------------------------------------------------------------
8626        -- IF the Error Flag indicates, error message will be inserted
8627        -- in Report Table.
8628        --------------------------------------------------------------------
8629        INSERT INTO ZX_TEST_API_GT
8630          (SUITE_NUMBER                                ,
8631           CASE_NUMBER                                 ,
8632           TRX_ID                                      ,
8633           TRX_NUMBER                                  ,
8634           TRX_LINE_NUMBER                             ,
8635           TRX_DATE                                    ,
8636           TRX_CURRENCY_CODE                           ,
8637           SUMMARY_TAX_LINE_ID                         ,
8638           TAX_LINE_ID                                 ,
8639           TAX_REGIME_CODE                             ,
8640           TAX_JURISDICTION_ID                         ,
8641           TAX                                         ,
8642           TAX_STATUS_CODE                             ,
8643           TAX_RATE_ID                                 ,
8644           TAX_RATE_CODE                               ,
8645           TAX_RATE                                    ,
8646           TAX_AMT                                     ,
8647           TAXABLE_AMT                                 ,
8648           REC_TAX_AMT                                 ,
8649           NREC_TAX_AMT                                ,
8650           TAX_AMT_FUNCL_CURR                          ,
8651           TOTAL_REC_TAX_AMT                           ,
8652           TOTAL_NREC_TAX_AMT                          ,
8653           TOTAL_REC_TAX_AMT_FUNCL_CURR                ,
8654           TOTAL_NREC_TAX_AMT_FUNCL_CURR               ,
8655           SELF_ASSESSED_FLAG                          ,
8656           MANUALLY_ENTERED_FLAG                       ,
8657           LINE_AMT_INCLUDES_TAX_FLAG                  ,
8658           TAXABLE_AMT_FUNCL_CURR                      ,
8659           REC_TAX_AMT_FUNCL_CURR                      ,
8660           NREC_TAX_AMT_FUNCL_CURR                     ,
8661           TAX_AMT_INCLUDED_FLAG                       ,
8662           TAX_EXEMPTION_ID                            ,
8663           EXEMPTION_RATE                              ,
8664           EXEMPT_REASON_CODE                          ,
8665           TAX_APPORTIONMENT_LINE_NUMBER               ,
8666           TAX_REGISTRATION_NUMBER                     ,
8667           TAX_HOLD_CODE                               ,
8668           TAX_HOLD_RELEASED_CODE                      ,
8669           LINE_AMT                                    ,
8670           TAX_JURISDICTION_CODE                       ,
8671           TAX_RATE_NAME                               ,
8672           TAX_RATE_TYPE                               ,
8673           TAX_DETERMINE_DATE                          ,
8674           CANCEL_FLAG                                 ,
8675           EVENT_CLASS_CODE                            ,
8676           EVENT_TYPE_CODE                             ,
8677           ETAX_API                                    ,
8678           ERROR_FLAG                                  ,
8679           ERROR_MESSAGE)
8680           VALUES
8681          (p_suite                                                  ,
8682           p_case                                                   ,
8683           p_transaction_id,   --TRX_ID                             ,
8684           null,   --TRX_NUMBER                                     ,
8685           null,   --TRX_LINE_NUMBER                                ,
8686           null,   --TRX_DATE                                       ,
8687           null,   --TRX_CURRENCY_CODE                              ,
8688           null,   --SUMMARY_TAX_LINE_ID                            ,
8689           null,   --TAX_LINE_ID                                    ,
8690           null,   --TAX_REGIME_CODE                                ,
8691           null,   --TAX_JURISDICTION_ID                            ,
8692           null,   --TAX                                            ,
8693           null,   --TAX_STATUS_CODE                                ,
8694           null,   --TAX_RATE_ID                                    ,
8695           null,   --TAX_RATE_CODE                                  ,
8696           null,   --TAX_RATE                                       ,
8697           null,   --TAX_AMT                                        ,
8698           null,   --TAXABLE_AMT                                    ,
8699           null,   --REC_TAX_AMT                                    ,
8700           null,   --NREC_TAX_AMT                                   ,
8701           null,   --TAX_AMT_FUNCL_CURR                             ,
8702           null,   --TOTAL_REC_TAX_AMT                              ,
8703           null,   --TOTAL_NREC_TAX_AMT                             ,
8704           null,   --TOTAL_REC_TAX_AMT_FUNCL_CURR                   ,
8705           null,   --TOTAL_NREC_TAX_AMT_FUNCL_CURR                  ,
8706           null,   --SELF_ASSESSED_FLAG                             ,
8707           null,   --MANUALLY_ENTERED_FLAG                          ,
8708           null,   --LINE_AMT_INCLUDES_TAX_FLAG                     ,
8709           null,   --TAXABLE_AMT_FUNCL_CURR                         ,
8710           null,   --REC_TAX_AMT_FUNCL_CURR                         ,
8711           null,   --NREC_TAX_AMT_FUNCL_CURR                        ,
8712           null,   --TAX_AMT_INCLUDED_FLAG                          ,
8713           null,   --TAX_EXEMPTION_ID                               ,
8714           null,   --EXEMPTION_RATE                                 ,
8715           null,   --EXEMPT_REASON_CODE                             ,
8716           null,   --TAX_APPORTIONMENT_LINE_NUMBER                  ,
8717           null,   --TAX_REGISTRATION_NUMBER                        ,
8718           null,   --TAX_HOLD_CODE                                  ,
8719           null,   --TAX_HOLD_RELEASED_CODE                         ,
8720           null,   --LINE_AMT                                       ,
8721           null,   --TAX_JURISDICTION_CODE                          ,
8722           null,   --TAX_RATE_NAME                                  ,
8723           null,   --TAX_RATE_TYPE                                  ,
8724           null,   --TAX_DETERMINE_DATE                             ,
8725           null,   --CANCEL_FLAG                                    ,
8726           null,   --EVENT_CLASS_CODE                               ,
8727           null,   --EVENT_TYPE_CODE                                ,
8728           p_service                                                ,
8729           p_error_flag                                             ,
8730           p_error_message);
8731 
8732      END IF;
8733   END Populate_Report_Table;
8734 
8735 
8736 /* ===========================================================================*
8737  | PROCEDURE populate_trx_header_cache : Caches the Transaction Header Info   |
8738  |                                       from a row in g_suite_rec_tbl        |
8739  * ===========================================================================*/
8740   PROCEDURE populate_trx_header_cache(p_header_row_id IN NUMBER) IS
8741 
8742   BEGIN
8743     g_header_cache_counter := g_header_cache_counter + 1;
8744     --------------------------------------------
8745     -- Put the Header Information in the Cache
8746     -------------------------------------------
8747     g_trx_headers_cache_rec_tbl.INTERNAL_ORGANIZATION_ID(g_header_cache_counter)       :=g_suite_rec_tbl.INTERNAL_ORGANIZATION_ID(p_header_row_id);
8748     g_trx_headers_cache_rec_tbl.APPLICATION_ID(g_header_cache_counter)                 :=g_suite_rec_tbl.APPLICATION_ID(p_header_row_id);
8749     g_trx_headers_cache_rec_tbl.ENTITY_CODE(g_header_cache_counter)                    :=g_suite_rec_tbl.ENTITY_CODE(p_header_row_id);
8750     g_trx_headers_cache_rec_tbl.EVENT_CLASS_CODE(g_header_cache_counter)               :=g_suite_rec_tbl.EVENT_CLASS_CODE(p_header_row_id);
8751     g_trx_headers_cache_rec_tbl.EVENT_TYPE_CODE(g_header_cache_counter)                :=g_suite_rec_tbl.EVENT_TYPE_CODE(p_header_row_id);
8752     g_trx_headers_cache_rec_tbl.TRX_ID(g_header_cache_counter)                         :=g_suite_rec_tbl.TRX_ID(p_header_row_id);
8753     g_trx_headers_cache_rec_tbl.TRX_DATE(g_header_cache_counter)                       :=g_suite_rec_tbl.TRX_DATE(p_header_row_id);
8754     g_trx_headers_cache_rec_tbl.TRX_DOC_REVISION(g_header_cache_counter)               :=g_suite_rec_tbl.TRX_DOC_REVISION(p_header_row_id);
8755     g_trx_headers_cache_rec_tbl.LEDGER_ID(g_header_cache_counter)                      :=g_suite_rec_tbl.LEDGER_ID(p_header_row_id);
8756     g_trx_headers_cache_rec_tbl.TRX_CURRENCY_CODE(g_header_cache_counter)              :=g_suite_rec_tbl.TRX_CURRENCY_CODE(p_header_row_id);
8757     g_trx_headers_cache_rec_tbl.CURRENCY_CONVERSION_DATE(g_header_cache_counter)       :=g_suite_rec_tbl.CURRENCY_CONVERSION_DATE(p_header_row_id);
8758     g_trx_headers_cache_rec_tbl.CURRENCY_CONVERSION_RATE(g_header_cache_counter)       :=g_suite_rec_tbl.CURRENCY_CONVERSION_RATE(p_header_row_id);
8759     g_trx_headers_cache_rec_tbl.CURRENCY_CONVERSION_TYPE(g_header_cache_counter)       :=g_suite_rec_tbl.CURRENCY_CONVERSION_TYPE(p_header_row_id);
8760     g_trx_headers_cache_rec_tbl.MINIMUM_ACCOUNTABLE_UNIT(g_header_cache_counter)       :=g_suite_rec_tbl.MINIMUM_ACCOUNTABLE_UNIT(p_header_row_id);
8761     g_trx_headers_cache_rec_tbl.PRECISION(g_header_cache_counter)                      :=g_suite_rec_tbl.PRECISION(p_header_row_id);
8762     g_trx_headers_cache_rec_tbl.LEGAL_ENTITY_ID(g_header_cache_counter)                :=g_suite_rec_tbl.LEGAL_ENTITY_ID(p_header_row_id);
8763     g_trx_headers_cache_rec_tbl.ROUNDING_SHIP_TO_PARTY_ID(g_header_cache_counter)      :=g_suite_rec_tbl.ROUNDING_SHIP_TO_PARTY_ID(p_header_row_id);
8764     g_trx_headers_cache_rec_tbl.ROUNDING_SHIP_FROM_PARTY_ID(g_header_cache_counter)    :=g_suite_rec_tbl.ROUNDING_SHIP_FROM_PARTY_ID(p_header_row_id);
8765     g_trx_headers_cache_rec_tbl.ROUNDING_BILL_TO_PARTY_ID(g_header_cache_counter)      :=g_suite_rec_tbl.ROUNDING_BILL_TO_PARTY_ID(p_header_row_id);
8766     g_trx_headers_cache_rec_tbl.ROUNDING_BILL_FROM_PARTY_ID(g_header_cache_counter)    :=g_suite_rec_tbl.ROUNDING_BILL_FROM_PARTY_ID(p_header_row_id);
8767     g_trx_headers_cache_rec_tbl.RNDG_SHIP_TO_PARTY_SITE_ID(g_header_cache_counter)     :=g_suite_rec_tbl.RNDG_SHIP_TO_PARTY_SITE_ID(p_header_row_id);
8768     g_trx_headers_cache_rec_tbl.RNDG_SHIP_FROM_PARTY_SITE_ID(g_header_cache_counter)   :=g_suite_rec_tbl.RNDG_SHIP_FROM_PARTY_SITE_ID(p_header_row_id);
8769     g_trx_headers_cache_rec_tbl.RNDG_BILL_TO_PARTY_SITE_ID(g_header_cache_counter)     :=g_suite_rec_tbl.RNDG_BILL_TO_PARTY_SITE_ID(p_header_row_id);
8770     g_trx_headers_cache_rec_tbl.RNDG_BILL_FROM_PARTY_SITE_ID(g_header_cache_counter)   :=g_suite_rec_tbl.RNDG_BILL_FROM_PARTY_SITE_ID(p_header_row_id);
8771     g_trx_headers_cache_rec_tbl.ESTABLISHMENT_ID(g_header_cache_counter)               :=g_suite_rec_tbl.ESTABLISHMENT_ID(p_header_row_id);
8772     g_trx_headers_cache_rec_tbl.RECEIVABLES_TRX_TYPE_ID(g_header_cache_counter)        :=g_suite_rec_tbl.RECEIVABLES_TRX_TYPE_ID(p_header_row_id);
8773     g_trx_headers_cache_rec_tbl.RELATED_DOC_APPLICATION_ID(g_header_cache_counter)     :=g_suite_rec_tbl.RELATED_DOC_APPLICATION_ID(p_header_row_id);
8774     g_trx_headers_cache_rec_tbl.RELATED_DOC_ENTITY_CODE(g_header_cache_counter)        :=g_suite_rec_tbl.RELATED_DOC_ENTITY_CODE(p_header_row_id);
8775     g_trx_headers_cache_rec_tbl.RELATED_DOC_EVENT_CLASS_CODE(g_header_cache_counter)   :=g_suite_rec_tbl.RELATED_DOC_EVENT_CLASS_CODE(p_header_row_id);
8776     g_trx_headers_cache_rec_tbl.RELATED_DOC_TRX_ID(g_header_cache_counter)             :=g_suite_rec_tbl.RELATED_DOC_TRX_ID(p_header_row_id);
8777     g_trx_headers_cache_rec_tbl.RELATED_DOC_NUMBER(g_header_cache_counter)             :=g_suite_rec_tbl.RELATED_DOC_NUMBER(p_header_row_id);
8778     g_trx_headers_cache_rec_tbl.RELATED_DOC_DATE(g_header_cache_counter)               :=g_suite_rec_tbl.RELATED_DOC_DATE(p_header_row_id);
8779     g_trx_headers_cache_rec_tbl.DEFAULT_TAXATION_COUNTRY(g_header_cache_counter)       :=g_suite_rec_tbl.DEFAULT_TAXATION_COUNTRY(p_header_row_id);
8780     g_trx_headers_cache_rec_tbl.QUOTE_FLAG(g_header_cache_counter)                      :=g_suite_rec_tbl.QUOTE_FLAG(p_header_row_id);
8781     g_trx_headers_cache_rec_tbl.TRX_NUMBER(g_header_cache_counter)                     :=g_suite_rec_tbl.TRX_NUMBER(p_header_row_id);
8782     g_trx_headers_cache_rec_tbl.TRX_DESCRIPTION(g_header_cache_counter)                :=g_suite_rec_tbl.TRX_DESCRIPTION(p_header_row_id);
8783     g_trx_headers_cache_rec_tbl.TRX_COMMUNICATED_DATE(g_header_cache_counter)          :=g_suite_rec_tbl.TRX_COMMUNICATED_DATE(p_header_row_id);
8784     g_trx_headers_cache_rec_tbl.BATCH_SOURCE_ID(g_header_cache_counter)                :=g_suite_rec_tbl.BATCH_SOURCE_ID(p_header_row_id);
8785     g_trx_headers_cache_rec_tbl.BATCH_SOURCE_NAME(g_header_cache_counter)              :=g_suite_rec_tbl.BATCH_SOURCE_NAME(p_header_row_id);
8786     g_trx_headers_cache_rec_tbl.DOC_SEQ_ID(g_header_cache_counter)                     :=g_suite_rec_tbl.DOC_SEQ_ID(p_header_row_id);
8787     g_trx_headers_cache_rec_tbl.DOC_SEQ_NAME(g_header_cache_counter)                   :=g_suite_rec_tbl.DOC_SEQ_NAME(p_header_row_id);
8788     g_trx_headers_cache_rec_tbl.DOC_SEQ_VALUE(g_header_cache_counter)                  :=g_suite_rec_tbl.DOC_SEQ_VALUE(p_header_row_id);
8789     g_trx_headers_cache_rec_tbl.TRX_DUE_DATE(g_header_cache_counter)                   :=g_suite_rec_tbl.TRX_DUE_DATE(p_header_row_id);
8790     g_trx_headers_cache_rec_tbl.TRX_TYPE_DESCRIPTION(g_header_cache_counter)           :=g_suite_rec_tbl.TRX_TYPE_DESCRIPTION(p_header_row_id);
8791     g_trx_headers_cache_rec_tbl.DOCUMENT_SUB_TYPE(g_header_cache_counter)              :=g_suite_rec_tbl.DOCUMENT_SUB_TYPE(p_header_row_id);
8792     g_trx_headers_cache_rec_tbl.SUPPLIER_TAX_INVOICE_NUMBER(g_header_cache_counter)    :=g_suite_rec_tbl.SUPPLIER_TAX_INVOICE_NUMBER(p_header_row_id);
8793     g_trx_headers_cache_rec_tbl.SUPPLIER_TAX_INVOICE_DATE(g_header_cache_counter)      :=g_suite_rec_tbl.SUPPLIER_TAX_INVOICE_DATE(p_header_row_id);
8794     g_trx_headers_cache_rec_tbl.SUPPLIER_EXCHANGE_RATE(g_header_cache_counter)         :=g_suite_rec_tbl.SUPPLIER_EXCHANGE_RATE(p_header_row_id);
8795     g_trx_headers_cache_rec_tbl.TAX_INVOICE_DATE(g_header_cache_counter)               :=g_suite_rec_tbl.TAX_INVOICE_DATE(p_header_row_id);
8796     g_trx_headers_cache_rec_tbl.TAX_INVOICE_NUMBER(g_header_cache_counter)             :=g_suite_rec_tbl.TAX_INVOICE_NUMBER(p_header_row_id);
8797     g_trx_headers_cache_rec_tbl.PORT_OF_ENTRY_CODE(g_header_cache_counter)             :=g_suite_rec_tbl.PORT_OF_ENTRY_CODE(g_header_cache_counter);
8798 
8799   END populate_trx_header_cache;
8800 
8801 
8802 /* ===========================================================================*
8803  | PROCEDURE populate_trx_lines_cache : Caches the Transaction Line Info      |
8804  |                                       from a row in g_suite_rec_tbl        |
8805  * ===========================================================================*/
8806   PROCEDURE populate_trx_lines_cache(p_header_row_id IN NUMBER,
8807                                      p_line_row_id IN NUMBER) IS
8808 
8809   BEGIN
8810     g_line_cache_counter := g_line_cache_counter+1;
8811     --------------------------------------------
8812     -- Put the Line Information in the Cache
8813     -------------------------------------------
8814     g_trx_lines_cache_rec_tbl.APPLICATION_ID(g_line_cache_counter)               := g_suite_rec_tbl.APPLICATION_ID(p_header_row_id);
8815     g_trx_lines_cache_rec_tbl.ENTITY_CODE(g_line_cache_counter)                  := g_suite_rec_tbl.ENTITY_CODE(p_header_row_id);
8816     g_trx_lines_cache_rec_tbl.EVENT_CLASS_CODE(g_line_cache_counter)             := g_suite_rec_tbl.EVENT_CLASS_CODE(p_header_row_id);
8817     g_trx_lines_cache_rec_tbl.TRX_ID(g_line_cache_counter)                       := g_suite_rec_tbl.TRX_ID(p_line_row_id);
8818     g_trx_lines_cache_rec_tbl.TRX_LINE_ID(g_line_cache_counter)                  := g_suite_rec_tbl.TRX_LINE_ID(p_line_row_id);
8819     g_trx_lines_cache_rec_tbl.LINE_LEVEL_ACTION(g_line_cache_counter)            := g_suite_rec_tbl.LINE_LEVEL_ACTION(p_line_row_id);
8820     g_trx_lines_cache_rec_tbl.TRX_LINE_TYPE(g_line_cache_counter)                := g_suite_rec_tbl.TRX_LINE_TYPE(p_line_row_id);
8821     g_trx_lines_cache_rec_tbl.TRX_LINE_DATE(g_line_cache_counter)                := g_suite_rec_tbl.TRX_LINE_DATE(p_line_row_id);
8822     g_trx_lines_cache_rec_tbl.TRX_BUSINESS_CATEGORY(g_line_cache_counter)        := g_suite_rec_tbl.TRX_BUSINESS_CATEGORY(p_line_row_id);
8823     g_trx_lines_cache_rec_tbl.LINE_INTENDED_USE(g_line_cache_counter)            := g_suite_rec_tbl.LINE_INTENDED_USE(p_line_row_id);
8824     g_trx_lines_cache_rec_tbl.USER_DEFINED_FISC_CLASS(g_line_cache_counter)      := g_suite_rec_tbl.USER_DEFINED_FISC_CLASS(p_line_row_id);
8825     g_trx_lines_cache_rec_tbl.LINE_AMT(g_line_cache_counter)                     := g_suite_rec_tbl.LINE_AMT(p_line_row_id);
8826     g_trx_lines_cache_rec_tbl.TRX_LINE_QUANTITY(g_line_cache_counter)            := g_suite_rec_tbl.TRX_LINE_QUANTITY(p_line_row_id);
8827     g_trx_lines_cache_rec_tbl.UNIT_PRICE(g_line_cache_counter)                   := g_suite_rec_tbl.UNIT_PRICE(p_line_row_id);
8828     g_trx_lines_cache_rec_tbl.PRODUCT_ID(g_line_cache_counter)                   := g_suite_rec_tbl.PRODUCT_ID(p_line_row_id);
8829     g_trx_lines_cache_rec_tbl.PRODUCT_FISC_CLASSIFICATION(g_line_cache_counter)  := g_suite_rec_tbl.PRODUCT_FISC_CLASSIFICATION(p_line_row_id);
8830     g_trx_lines_cache_rec_tbl.PRODUCT_ORG_ID(g_line_cache_counter)               := g_suite_rec_tbl.PRODUCT_ORG_ID(p_line_row_id);
8831     g_trx_lines_cache_rec_tbl.UOM_CODE(g_line_cache_counter)                     := g_suite_rec_tbl.UOM_CODE(p_line_row_id);
8832     g_trx_lines_cache_rec_tbl.PRODUCT_TYPE(g_line_cache_counter)                 := g_suite_rec_tbl.PRODUCT_TYPE(p_line_row_id);
8833     g_trx_lines_cache_rec_tbl.PRODUCT_CODE(g_line_cache_counter)                 := g_suite_rec_tbl.PRODUCT_CODE(p_line_row_id);
8834     g_trx_lines_cache_rec_tbl.PRODUCT_CATEGORY(g_line_cache_counter)             := g_suite_rec_tbl.PRODUCT_CATEGORY(p_line_row_id);
8835     g_trx_lines_cache_rec_tbl.MERCHANT_PARTY_ID(g_line_cache_counter)            := g_suite_rec_tbl.MERCHANT_PARTY_ID(p_line_row_id);
8836     g_trx_lines_cache_rec_tbl.ACCOUNT_CCID(g_line_cache_counter)                 := g_suite_rec_tbl.ACCOUNT_CCID(p_line_row_id);
8837     g_trx_lines_cache_rec_tbl.ACCOUNT_STRING(g_line_cache_counter)               := g_suite_rec_tbl.ACCOUNT_STRING(p_line_row_id);
8838     g_trx_lines_cache_rec_tbl.REF_DOC_APPLICATION_ID(g_line_cache_counter)       := g_suite_rec_tbl.REF_DOC_APPLICATION_ID(p_line_row_id);
8839     g_trx_lines_cache_rec_tbl.REF_DOC_ENTITY_CODE(g_line_cache_counter)          := g_suite_rec_tbl.REF_DOC_ENTITY_CODE(p_line_row_id);
8840     g_trx_lines_cache_rec_tbl.REF_DOC_EVENT_CLASS_CODE(g_line_cache_counter)     := g_suite_rec_tbl.REF_DOC_EVENT_CLASS_CODE(p_line_row_id);
8841     g_trx_lines_cache_rec_tbl.REF_DOC_TRX_ID(g_line_cache_counter)               := g_suite_rec_tbl.REF_DOC_TRX_ID(p_line_row_id);
8842     g_trx_lines_cache_rec_tbl.REF_DOC_LINE_ID(g_line_cache_counter)              := g_suite_rec_tbl.REF_DOC_LINE_ID(p_line_row_id);
8843     g_trx_lines_cache_rec_tbl.REF_DOC_LINE_QUANTITY(g_line_cache_counter)        := g_suite_rec_tbl.REF_DOC_LINE_QUANTITY(p_line_row_id);
8844     g_trx_lines_cache_rec_tbl.APPLIED_FROM_APPLICATION_ID(g_line_cache_counter)  := g_suite_rec_tbl.APPLIED_FROM_APPLICATION_ID(p_line_row_id);
8845     g_trx_lines_cache_rec_tbl.APPLIED_FROM_ENTITY_CODE(g_line_cache_counter)     := g_suite_rec_tbl.APPLIED_FROM_ENTITY_CODE(p_line_row_id);
8846     g_trx_lines_cache_rec_tbl.APPLIED_FROM_EVENT_CLASS_CODE(g_line_cache_counter):= g_suite_rec_tbl.APPLIED_FROM_EVENT_CLASS_CODE(p_line_row_id);
8847     g_trx_lines_cache_rec_tbl.APPLIED_FROM_TRX_ID(g_line_cache_counter)          := g_suite_rec_tbl.APPLIED_FROM_TRX_ID(p_line_row_id);
8848     g_trx_lines_cache_rec_tbl.APPLIED_FROM_LINE_ID(g_line_cache_counter)         := g_suite_rec_tbl.APPLIED_FROM_LINE_ID(p_line_row_id);
8849     g_trx_lines_cache_rec_tbl.ADJUSTED_DOC_APPLICATION_ID(g_line_cache_counter)  := g_suite_rec_tbl.ADJUSTED_DOC_APPLICATION_ID(p_line_row_id);
8850     g_trx_lines_cache_rec_tbl.adjusted_doc_entity_code(g_line_cache_counter)     := g_suite_rec_tbl.adjusted_doc_entity_code(p_line_row_id);
8851     g_trx_lines_cache_rec_tbl.ADJUSTED_DOC_EVENT_CLASS_CODE(g_line_cache_counter):= g_suite_rec_tbl.ADJUSTED_DOC_EVENT_CLASS_CODE(p_line_row_id);
8852     g_trx_lines_cache_rec_tbl.ADJUSTED_DOC_TRX_ID(g_line_cache_counter)          := g_suite_rec_tbl.ADJUSTED_DOC_TRX_ID(p_line_row_id);
8853     g_trx_lines_cache_rec_tbl.ADJUSTED_DOC_LINE_ID(g_line_cache_counter)         := g_suite_rec_tbl.ADJUSTED_DOC_LINE_ID(p_line_row_id);
8854     g_trx_lines_cache_rec_tbl.TRX_LINE_NUMBER(g_line_cache_counter)              := g_suite_rec_tbl.TRX_LINE_NUMBER(p_line_row_id);
8855     g_trx_lines_cache_rec_tbl.TRX_LINE_DESCRIPTION(g_line_cache_counter)         := g_suite_rec_tbl.TRX_LINE_DESCRIPTION(p_line_row_id);
8856     g_trx_lines_cache_rec_tbl.TRX_LINE_GL_DATE(g_line_cache_counter)             := g_suite_rec_tbl.TRX_LINE_GL_DATE(p_line_row_id);
8857     g_trx_lines_cache_rec_tbl.LINE_AMT_INCLUDES_TAX_FLAG(g_line_cache_counter)   := g_suite_rec_tbl.LINE_AMT_INCLUDES_TAX_FLAG(p_line_row_id);
8858     g_trx_lines_cache_rec_tbl.TRX_LEVEL_TYPE(g_line_cache_counter)               := g_suite_rec_tbl.TRX_LEVEL_TYPE(p_line_row_id);
8859 
8860   END populate_trx_lines_cache;
8861 
8862 
8863 /* ===========================================================================*
8864  | PROCEDURE populate_dist_lines_cache : Caches the Distribution Lines Info   |
8865  |                                       from a row in g_suite_rec_tbl        |
8866  * ===========================================================================*/
8867   PROCEDURE populate_dist_lines_cache(p_dist_row_id IN NUMBER) IS
8868 
8869   l_dist_cache_counter NUMBER;
8870   BEGIN
8871     g_dist_cache_counter := g_dist_cache_counter + 1;
8872     -----------------------------------------------------
8873     -- Put the Distribution Line Information in the Cache
8874     -----------------------------------------------------
8875     g_dist_lines_cache_rec_tbl.APPLICATION_ID(g_dist_cache_counter)        :=g_suite_rec_tbl.APPLICATION_ID(p_dist_row_id);
8876     g_dist_lines_cache_rec_tbl.ENTITY_CODE(g_dist_cache_counter)           :=g_suite_rec_tbl.ENTITY_CODE(p_dist_row_id);
8877     g_dist_lines_cache_rec_tbl.EVENT_CLASS_CODE(g_dist_cache_counter)      :=g_suite_rec_tbl.EVENT_CLASS_CODE(p_dist_row_id);
8878     g_dist_lines_cache_rec_tbl.EVENT_TYPE_CODE(g_dist_cache_counter)       :=g_suite_rec_tbl.EVENT_TYPE_CODE(p_dist_row_id);
8879     g_dist_lines_cache_rec_tbl.TRX_ID(g_dist_cache_counter)                :=g_suite_rec_tbl.TRX_ID(p_dist_row_id);
8880     g_dist_lines_cache_rec_tbl.TRX_LINE_ID(g_dist_cache_counter)           :=g_suite_rec_tbl.TRX_LINE_ID(p_dist_row_id);
8881     g_dist_lines_cache_rec_tbl.TRX_LINE_QUANTITY(g_dist_cache_counter)     :=g_suite_rec_tbl.TRX_LINE_QUANTITY(p_dist_row_id);
8882     g_dist_lines_cache_rec_tbl.TRX_LEVEL_TYPE(g_dist_cache_counter)        :=g_suite_rec_tbl.TRX_LEVEL_TYPE(p_dist_row_id);
8883     g_dist_lines_cache_rec_tbl.TRX_LINE_DIST_ID(g_dist_cache_counter)      :=g_suite_rec_tbl.TRX_LINE_DIST_ID(p_dist_row_id);
8884     g_dist_lines_cache_rec_tbl.TRX_LINE_DIST_AMT(g_dist_cache_counter)     :=g_suite_rec_tbl.TRX_LINE_DIST_AMT(p_dist_row_id);
8885     g_dist_lines_cache_rec_tbl.TRX_LINE_DIST_QUANTITY(g_dist_cache_counter):=g_suite_rec_tbl.TRX_LINE_DIST_QUANTITY(p_dist_row_id);
8886     g_dist_lines_cache_rec_tbl.DIST_LEVEL_ACTION(g_dist_cache_counter)     :=g_suite_rec_tbl.DIST_LEVEL_ACTION(p_dist_row_id);
8887     g_dist_lines_cache_rec_tbl.TRX_LINE_DIST_DATE(g_dist_cache_counter)    :=g_suite_rec_tbl.TRX_LINE_DIST_DATE(p_dist_row_id);
8888     g_dist_lines_cache_rec_tbl.ITEM_DIST_NUMBER(g_dist_cache_counter)      :=g_suite_rec_tbl.ITEM_DIST_NUMBER(p_dist_row_id);
8889     g_dist_lines_cache_rec_tbl.DIST_INTENDED_USE(g_dist_cache_counter)     :=g_suite_rec_tbl.DIST_INTENDED_USE(p_dist_row_id);
8890     g_dist_lines_cache_rec_tbl.TAX_INCLUSION_FLAG(g_dist_cache_counter)    :=g_suite_rec_tbl.TAX_INCLUSION_FLAG(p_dist_row_id);
8891     g_dist_lines_cache_rec_tbl.TAX_CODE(g_dist_cache_counter)              :=g_suite_rec_tbl.TAX_CODE(p_dist_row_id);
8892     g_dist_lines_cache_rec_tbl.TASK_ID(g_dist_cache_counter)               :=g_suite_rec_tbl.TASK_ID(p_dist_row_id);
8893     g_dist_lines_cache_rec_tbl.AWARD_ID(g_dist_cache_counter)              :=g_suite_rec_tbl.AWARD_ID(p_dist_row_id);
8894     g_dist_lines_cache_rec_tbl.PROJECT_ID(g_dist_cache_counter)            :=g_suite_rec_tbl.PROJECT_ID(p_dist_row_id);
8895   END populate_dist_lines_cache;
8896 
8897 
8898 /* ============================================================================*
8899  | PROCEDURE update_trx_header_cache : Update the Cache Transaction Header Info|
8900  |                                     from a row in g_suite_rec_tbl           |
8901  * ===========================================================================*/
8902 PROCEDURE update_trx_header_cache(p_header_row_id IN NUMBER) IS
8903   l_updateable_row NUMBER;
8904   i NUMBER;
8905   BEGIN
8906     -----------------------------------------------------
8907     -- Loop to find the Header Row with Same Trx_id
8908     -- That will be updated
8909     -----------------------------------------------------
8910     FOR i in g_trx_headers_cache_rec_tbl.trx_id.FIRST..g_trx_headers_cache_rec_tbl.trx_id.LAST LOOP
8911       If g_trx_headers_cache_rec_tbl.trx_id(i) = g_suite_rec_tbl.TRX_ID(p_header_row_id) THEN
8912         l_updateable_row := i;
8913         EXIT;
8914       END IF;
8915     END LOOP;
8916     write_message('=========================================');
8917     write_message('==Updating Transaction Header Cache');
8918     Write_message('==Row to be updated is'||l_updateable_row);
8919     write_message('=========================================');
8920     --------------------------------------------
8921     -- Update the Header Information in the Cache
8922     -------------------------------------------
8923     g_trx_headers_cache_rec_tbl.INTERNAL_ORGANIZATION_ID(l_updateable_row)       :=g_suite_rec_tbl.INTERNAL_ORGANIZATION_ID(p_header_row_id);
8924     g_trx_headers_cache_rec_tbl.APPLICATION_ID(l_updateable_row)                 :=g_suite_rec_tbl.APPLICATION_ID(p_header_row_id);
8925     g_trx_headers_cache_rec_tbl.ENTITY_CODE(l_updateable_row)                    :=g_suite_rec_tbl.ENTITY_CODE(p_header_row_id);
8926     g_trx_headers_cache_rec_tbl.EVENT_CLASS_CODE(l_updateable_row)               :=g_suite_rec_tbl.EVENT_CLASS_CODE(p_header_row_id);
8927     g_trx_headers_cache_rec_tbl.EVENT_TYPE_CODE(l_updateable_row)                :=g_suite_rec_tbl.EVENT_TYPE_CODE(p_header_row_id);
8928     g_trx_headers_cache_rec_tbl.TRX_ID(l_updateable_row)                         :=g_suite_rec_tbl.TRX_ID(p_header_row_id);
8929     g_trx_headers_cache_rec_tbl.TRX_DATE(l_updateable_row)                       :=g_suite_rec_tbl.TRX_DATE(p_header_row_id);
8930     g_trx_headers_cache_rec_tbl.TRX_DOC_REVISION(l_updateable_row)               :=g_suite_rec_tbl.TRX_DOC_REVISION(p_header_row_id);
8931     g_trx_headers_cache_rec_tbl.LEDGER_ID(l_updateable_row)                      :=g_suite_rec_tbl.LEDGER_ID(p_header_row_id);
8932     g_trx_headers_cache_rec_tbl.TRX_CURRENCY_CODE(l_updateable_row)              :=g_suite_rec_tbl.TRX_CURRENCY_CODE(p_header_row_id);
8933     g_trx_headers_cache_rec_tbl.CURRENCY_CONVERSION_DATE(l_updateable_row)       :=g_suite_rec_tbl.CURRENCY_CONVERSION_DATE(p_header_row_id);
8934     g_trx_headers_cache_rec_tbl.CURRENCY_CONVERSION_RATE(l_updateable_row)       :=g_suite_rec_tbl.CURRENCY_CONVERSION_RATE(p_header_row_id);
8935     g_trx_headers_cache_rec_tbl.CURRENCY_CONVERSION_TYPE(l_updateable_row)       :=g_suite_rec_tbl.CURRENCY_CONVERSION_TYPE(p_header_row_id);
8936     g_trx_headers_cache_rec_tbl.MINIMUM_ACCOUNTABLE_UNIT(l_updateable_row)       :=g_suite_rec_tbl.MINIMUM_ACCOUNTABLE_UNIT(p_header_row_id);
8937     g_trx_headers_cache_rec_tbl.PRECISION(l_updateable_row)                      :=g_suite_rec_tbl.PRECISION(p_header_row_id);
8938     g_trx_headers_cache_rec_tbl.LEGAL_ENTITY_ID(l_updateable_row)                :=g_suite_rec_tbl.LEGAL_ENTITY_ID(p_header_row_id);
8939     g_trx_headers_cache_rec_tbl.ROUNDING_SHIP_TO_PARTY_ID(l_updateable_row)      :=g_suite_rec_tbl.ROUNDING_SHIP_TO_PARTY_ID(p_header_row_id);
8940     g_trx_headers_cache_rec_tbl.ROUNDING_SHIP_FROM_PARTY_ID(l_updateable_row)    :=g_suite_rec_tbl.ROUNDING_SHIP_FROM_PARTY_ID(p_header_row_id);
8941     g_trx_headers_cache_rec_tbl.ROUNDING_BILL_TO_PARTY_ID(l_updateable_row)      :=g_suite_rec_tbl.ROUNDING_BILL_TO_PARTY_ID(p_header_row_id);
8942     g_trx_headers_cache_rec_tbl.ROUNDING_BILL_FROM_PARTY_ID(l_updateable_row)    :=g_suite_rec_tbl.ROUNDING_BILL_FROM_PARTY_ID(p_header_row_id);
8943     g_trx_headers_cache_rec_tbl.RNDG_SHIP_TO_PARTY_SITE_ID(l_updateable_row)     :=g_suite_rec_tbl.RNDG_SHIP_TO_PARTY_SITE_ID(p_header_row_id);
8944     g_trx_headers_cache_rec_tbl.RNDG_SHIP_FROM_PARTY_SITE_ID(l_updateable_row)   :=g_suite_rec_tbl.RNDG_SHIP_FROM_PARTY_SITE_ID(p_header_row_id);
8945     g_trx_headers_cache_rec_tbl.RNDG_BILL_TO_PARTY_SITE_ID(l_updateable_row)     :=g_suite_rec_tbl.RNDG_BILL_TO_PARTY_SITE_ID(p_header_row_id);
8946     g_trx_headers_cache_rec_tbl.RNDG_BILL_FROM_PARTY_SITE_ID(l_updateable_row)   :=g_suite_rec_tbl.RNDG_BILL_FROM_PARTY_SITE_ID(p_header_row_id);
8947     g_trx_headers_cache_rec_tbl.ESTABLISHMENT_ID(l_updateable_row)               :=g_suite_rec_tbl.ESTABLISHMENT_ID(p_header_row_id);
8948     g_trx_headers_cache_rec_tbl.RECEIVABLES_TRX_TYPE_ID(l_updateable_row)        :=g_suite_rec_tbl.RECEIVABLES_TRX_TYPE_ID(p_header_row_id);
8949     g_trx_headers_cache_rec_tbl.RELATED_DOC_APPLICATION_ID(l_updateable_row)     :=g_suite_rec_tbl.RELATED_DOC_APPLICATION_ID(p_header_row_id);
8950     g_trx_headers_cache_rec_tbl.RELATED_DOC_ENTITY_CODE(l_updateable_row)        :=g_suite_rec_tbl.RELATED_DOC_ENTITY_CODE(p_header_row_id);
8951     g_trx_headers_cache_rec_tbl.RELATED_DOC_EVENT_CLASS_CODE(l_updateable_row)   :=g_suite_rec_tbl.RELATED_DOC_EVENT_CLASS_CODE(p_header_row_id);
8952     g_trx_headers_cache_rec_tbl.RELATED_DOC_TRX_ID(l_updateable_row)             :=g_suite_rec_tbl.RELATED_DOC_TRX_ID(p_header_row_id);
8953     g_trx_headers_cache_rec_tbl.RELATED_DOC_NUMBER(l_updateable_row)             :=g_suite_rec_tbl.RELATED_DOC_NUMBER(p_header_row_id);
8954     g_trx_headers_cache_rec_tbl.RELATED_DOC_DATE(l_updateable_row)               :=g_suite_rec_tbl.RELATED_DOC_DATE(p_header_row_id);
8955     g_trx_headers_cache_rec_tbl.DEFAULT_TAXATION_COUNTRY(l_updateable_row)       :=g_suite_rec_tbl.DEFAULT_TAXATION_COUNTRY(p_header_row_id);
8956     g_trx_headers_cache_rec_tbl.QUOTE_FLAG(l_updateable_row)                     :=g_suite_rec_tbl.QUOTE_FLAG(p_header_row_id);
8957     g_trx_headers_cache_rec_tbl.TRX_NUMBER(l_updateable_row)                     :=g_suite_rec_tbl.TRX_NUMBER(p_header_row_id);
8958     g_trx_headers_cache_rec_tbl.TRX_DESCRIPTION(l_updateable_row)                :=g_suite_rec_tbl.TRX_DESCRIPTION(p_header_row_id);
8959     g_trx_headers_cache_rec_tbl.TRX_COMMUNICATED_DATE(l_updateable_row)          :=g_suite_rec_tbl.TRX_COMMUNICATED_DATE(p_header_row_id);
8960     g_trx_headers_cache_rec_tbl.BATCH_SOURCE_ID(l_updateable_row)                :=g_suite_rec_tbl.BATCH_SOURCE_ID(p_header_row_id);
8961     g_trx_headers_cache_rec_tbl.BATCH_SOURCE_NAME(l_updateable_row)              :=g_suite_rec_tbl.BATCH_SOURCE_NAME(p_header_row_id);
8962     g_trx_headers_cache_rec_tbl.DOC_SEQ_ID(l_updateable_row)                     :=g_suite_rec_tbl.DOC_SEQ_ID(p_header_row_id);
8963     g_trx_headers_cache_rec_tbl.DOC_SEQ_NAME(l_updateable_row)                   :=g_suite_rec_tbl.DOC_SEQ_NAME(p_header_row_id);
8964     g_trx_headers_cache_rec_tbl.DOC_SEQ_VALUE(l_updateable_row)                  :=g_suite_rec_tbl.DOC_SEQ_VALUE(p_header_row_id);
8965     g_trx_headers_cache_rec_tbl.TRX_DUE_DATE(l_updateable_row)                   :=g_suite_rec_tbl.TRX_DUE_DATE(p_header_row_id);
8966     g_trx_headers_cache_rec_tbl.TRX_TYPE_DESCRIPTION(l_updateable_row)           :=g_suite_rec_tbl.TRX_TYPE_DESCRIPTION(p_header_row_id);
8967     g_trx_headers_cache_rec_tbl.DOCUMENT_SUB_TYPE(l_updateable_row)              :=g_suite_rec_tbl.DOCUMENT_SUB_TYPE(p_header_row_id);
8968     g_trx_headers_cache_rec_tbl.SUPPLIER_TAX_INVOICE_NUMBER(l_updateable_row)    :=g_suite_rec_tbl.SUPPLIER_TAX_INVOICE_NUMBER(p_header_row_id);
8969     g_trx_headers_cache_rec_tbl.SUPPLIER_TAX_INVOICE_DATE(l_updateable_row)      :=g_suite_rec_tbl.SUPPLIER_TAX_INVOICE_DATE(p_header_row_id);
8970     g_trx_headers_cache_rec_tbl.SUPPLIER_EXCHANGE_RATE(l_updateable_row)         :=g_suite_rec_tbl.SUPPLIER_EXCHANGE_RATE(p_header_row_id);
8971     g_trx_headers_cache_rec_tbl.TAX_INVOICE_DATE(l_updateable_row)               :=g_suite_rec_tbl.TAX_INVOICE_DATE(p_header_row_id);
8972     g_trx_headers_cache_rec_tbl.TAX_INVOICE_NUMBER(l_updateable_row)             :=g_suite_rec_tbl.TAX_INVOICE_NUMBER(p_header_row_id);
8973 
8974   END update_trx_header_cache;
8975 
8976 
8977 /* =======================================================================*
8978  | PROCEDURE update_trx_lines_cache : Update the Cache Lines Info         |
8979  |                                    from a row in g_suite_rec_tbl       |
8980  * =======================================================================*/
8981   PROCEDURE update_trx_lines_cache(p_header_row_id IN NUMBER,
8982                                      p_line_row_id IN NUMBER) IS
8983 
8984   l_trx_line_exists_flag VARCHAR2(1);
8985   l_updateable_row NUMBER;
8986   i NUMBER;
8987   BEGIN
8988     l_trx_line_exists_flag := 'N';
8989 
8990     -----------------------------------------------------
8991     -- Loop to find the Cached Trx Line Row with Same Trx_id
8992     -- That will be updated
8993     -----------------------------------------------------
8994     FOR i in g_trx_lines_cache_rec_tbl.trx_id.FIRST..g_trx_lines_cache_rec_tbl.trx_id.LAST LOOP
8995       If   g_trx_lines_cache_rec_tbl.trx_id(i)      = g_suite_rec_tbl.TRX_ID(p_header_row_id)
8996       AND  g_trx_lines_cache_rec_tbl.trx_line_id(i) = g_suite_rec_tbl.TRX_LINE_ID(p_line_row_id)
8997       THEN
8998         l_updateable_row := i;
8999         l_trx_line_exists_flag := 'Y';
9000       ELSE
9001         l_trx_line_exists_flag := 'N';
9002       END IF;
9003       ------------------------------------------------
9004       -- If the Line to be updated does not exist then
9005       -- Create the Line in the Cache, if not update.
9006       ------------------------------------------------
9007       IF l_trx_line_exists_flag = 'N' THEN
9008         populate_trx_lines_cache(p_header_row_id,
9009                                  i);
9010       ELSIF l_trx_line_exists_flag = 'Y' THEN
9011         write_message('=========================================');
9012         write_message('==Updating Transaction Line Header Cache' );
9013         write_message('==Row to be updated is'||l_updateable_row );
9014         write_message('=========================================');
9015         --------------------------------------------
9016         -- Update the Line Information in the Cache
9017         -------------------------------------------
9018         g_trx_lines_cache_rec_tbl.APPLICATION_ID(l_updateable_row)             := g_suite_rec_tbl.APPLICATION_ID(p_header_row_id);
9019         g_trx_lines_cache_rec_tbl.ENTITY_CODE(l_updateable_row)                := g_suite_rec_tbl.ENTITY_CODE(p_header_row_id);
9020         g_trx_lines_cache_rec_tbl.EVENT_CLASS_CODE(l_updateable_row)           := g_suite_rec_tbl.EVENT_CLASS_CODE(p_header_row_id);
9021         g_trx_lines_cache_rec_tbl.TRX_ID(l_updateable_row)                     := g_suite_rec_tbl.TRX_ID(p_line_row_id);
9022         g_trx_lines_cache_rec_tbl.TRX_LINE_ID(l_updateable_row)                := g_suite_rec_tbl.TRX_LINE_ID(p_line_row_id);
9023         g_trx_lines_cache_rec_tbl.LINE_LEVEL_ACTION(l_updateable_row)          := g_suite_rec_tbl.LINE_LEVEL_ACTION(p_line_row_id);
9024         g_trx_lines_cache_rec_tbl.TRX_LINE_TYPE(l_updateable_row)              := g_suite_rec_tbl.TRX_LINE_TYPE(p_line_row_id);
9025         g_trx_lines_cache_rec_tbl.TRX_LINE_DATE(l_updateable_row)              := g_suite_rec_tbl.TRX_LINE_DATE(p_line_row_id);
9026         g_trx_lines_cache_rec_tbl.TRX_BUSINESS_CATEGORY(l_updateable_row)      := g_suite_rec_tbl.TRX_BUSINESS_CATEGORY(p_line_row_id);
9027         g_trx_lines_cache_rec_tbl.LINE_INTENDED_USE(l_updateable_row)          := g_suite_rec_tbl.LINE_INTENDED_USE(p_line_row_id);
9028         g_trx_lines_cache_rec_tbl.USER_DEFINED_FISC_CLASS(l_updateable_row)    := g_suite_rec_tbl.USER_DEFINED_FISC_CLASS(p_line_row_id);
9029         g_trx_lines_cache_rec_tbl.LINE_AMT(l_updateable_row)                   := g_suite_rec_tbl.LINE_AMT(p_line_row_id);
9030         g_trx_lines_cache_rec_tbl.TRX_LINE_QUANTITY(l_updateable_row)          := g_suite_rec_tbl.TRX_LINE_QUANTITY(p_line_row_id);
9031         g_trx_lines_cache_rec_tbl.UNIT_PRICE(l_updateable_row)                 := g_suite_rec_tbl.UNIT_PRICE(p_line_row_id);
9032         g_trx_lines_cache_rec_tbl.PRODUCT_ID(l_updateable_row)                 := g_suite_rec_tbl.PRODUCT_ID(p_line_row_id);
9033         g_trx_lines_cache_rec_tbl.PRODUCT_FISC_CLASSIFICATION(l_updateable_row):= g_suite_rec_tbl.PRODUCT_FISC_CLASSIFICATION(p_line_row_id);
9034         g_trx_lines_cache_rec_tbl.PRODUCT_ORG_ID(l_updateable_row)             := g_suite_rec_tbl.PRODUCT_ORG_ID(p_line_row_id);
9035         g_trx_lines_cache_rec_tbl.UOM_CODE(l_updateable_row)                   := g_suite_rec_tbl.UOM_CODE(p_line_row_id);
9036         g_trx_lines_cache_rec_tbl.PRODUCT_TYPE(l_updateable_row)               := g_suite_rec_tbl.PRODUCT_TYPE(p_line_row_id);
9037         g_trx_lines_cache_rec_tbl.PRODUCT_CODE(l_updateable_row)               := g_suite_rec_tbl.PRODUCT_CODE(p_line_row_id);
9038         g_trx_lines_cache_rec_tbl.PRODUCT_CATEGORY(l_updateable_row)           := g_suite_rec_tbl.PRODUCT_CATEGORY(p_line_row_id);
9039         g_trx_lines_cache_rec_tbl.MERCHANT_PARTY_ID(l_updateable_row)          := g_suite_rec_tbl.MERCHANT_PARTY_ID(p_line_row_id);
9040         g_trx_lines_cache_rec_tbl.ACCOUNT_CCID(l_updateable_row)               := g_suite_rec_tbl.ACCOUNT_CCID(p_line_row_id);
9041         g_trx_lines_cache_rec_tbl.ACCOUNT_STRING(l_updateable_row)             := g_suite_rec_tbl.ACCOUNT_STRING(p_line_row_id);
9042         g_trx_lines_cache_rec_tbl.REF_DOC_APPLICATION_ID(l_updateable_row)     := g_suite_rec_tbl.REF_DOC_APPLICATION_ID(p_line_row_id);
9043         g_trx_lines_cache_rec_tbl.REF_DOC_ENTITY_CODE(l_updateable_row)        := g_suite_rec_tbl.REF_DOC_ENTITY_CODE(p_line_row_id);
9044         g_trx_lines_cache_rec_tbl.REF_DOC_EVENT_CLASS_CODE(l_updateable_row)   := g_suite_rec_tbl.REF_DOC_EVENT_CLASS_CODE(p_line_row_id);
9045         g_trx_lines_cache_rec_tbl.REF_DOC_TRX_ID(l_updateable_row)             := g_suite_rec_tbl.REF_DOC_TRX_ID(p_line_row_id);
9046         g_trx_lines_cache_rec_tbl.REF_DOC_LINE_ID(l_updateable_row)            := g_suite_rec_tbl.REF_DOC_LINE_ID(p_line_row_id);
9047         g_trx_lines_cache_rec_tbl.REF_DOC_LINE_QUANTITY(l_updateable_row)      := g_suite_rec_tbl.REF_DOC_LINE_QUANTITY(p_line_row_id);
9048         g_trx_lines_cache_rec_tbl.APPLIED_FROM_APPLICATION_ID(l_updateable_row):= g_suite_rec_tbl.APPLIED_FROM_APPLICATION_ID(p_line_row_id);
9049         g_trx_lines_cache_rec_tbl.APPLIED_FROM_ENTITY_CODE(l_updateable_row)   := g_suite_rec_tbl.APPLIED_FROM_ENTITY_CODE(p_line_row_id);
9050         g_trx_lines_cache_rec_tbl.APPLIED_FROM_EVENT_CLASS_CODE(l_updateable_row):= g_suite_rec_tbl.APPLIED_FROM_EVENT_CLASS_CODE(p_line_row_id);
9051         g_trx_lines_cache_rec_tbl.APPLIED_FROM_TRX_ID(l_updateable_row)        := g_suite_rec_tbl.APPLIED_FROM_TRX_ID(p_line_row_id);
9052         g_trx_lines_cache_rec_tbl.APPLIED_FROM_LINE_ID(l_updateable_row)       := g_suite_rec_tbl.APPLIED_FROM_LINE_ID(p_line_row_id);
9053         g_trx_lines_cache_rec_tbl.ADJUSTED_DOC_APPLICATION_ID(l_updateable_row):= g_suite_rec_tbl.ADJUSTED_DOC_APPLICATION_ID(p_line_row_id);
9054         g_trx_lines_cache_rec_tbl.adjusted_doc_entity_code(l_updateable_row)   := g_suite_rec_tbl.adjusted_doc_entity_code(p_line_row_id);
9055         g_trx_lines_cache_rec_tbl.ADJUSTED_DOC_EVENT_CLASS_CODE(l_updateable_row):= g_suite_rec_tbl.ADJUSTED_DOC_EVENT_CLASS_CODE(p_line_row_id);
9056         g_trx_lines_cache_rec_tbl.ADJUSTED_DOC_TRX_ID(l_updateable_row)        := g_suite_rec_tbl.ADJUSTED_DOC_TRX_ID(p_line_row_id);
9057         g_trx_lines_cache_rec_tbl.ADJUSTED_DOC_LINE_ID(l_updateable_row)       := g_suite_rec_tbl.ADJUSTED_DOC_LINE_ID(p_line_row_id);
9058         g_trx_lines_cache_rec_tbl.TRX_LINE_NUMBER(l_updateable_row)            := g_suite_rec_tbl.TRX_LINE_NUMBER(p_line_row_id);
9059         g_trx_lines_cache_rec_tbl.TRX_LINE_DESCRIPTION(l_updateable_row)       := g_suite_rec_tbl.TRX_LINE_DESCRIPTION(p_line_row_id);
9060         g_trx_lines_cache_rec_tbl.TRX_LINE_GL_DATE(l_updateable_row)           := g_suite_rec_tbl.TRX_LINE_GL_DATE(p_line_row_id);
9061         g_trx_lines_cache_rec_tbl.LINE_AMT_INCLUDES_TAX_FLAG(l_updateable_row) := g_suite_rec_tbl.LINE_AMT_INCLUDES_TAX_FLAG(p_line_row_id);
9062         g_trx_lines_cache_rec_tbl.TRX_LEVEL_TYPE(l_updateable_row)             := g_suite_rec_tbl.TRX_LEVEL_TYPE(p_line_row_id);
9063       END IF;
9064     END LOOP;
9065   END update_trx_lines_cache;
9066 
9067 
9068 /* =======================================================================*
9069  | PROCEDURE update_dist_lines_cache : Update the Cache Dist Lines Info   |
9070  |                                    from a row in g_suite_rec_tbl       |
9071  * =======================================================================*/
9072   PROCEDURE update_dist_lines_cache
9073    (
9074     p_dist_row_id IN NUMBER
9075    ) IS
9076 
9077   l_dist_line_exists_flag VARCHAR2(1);
9078   l_updateable_row NUMBER;
9079   i NUMBER;
9080 
9081   BEGIN
9082     l_dist_line_exists_flag := 'N';
9083     ---------------------------------------------------------------
9084     -- Loop to find the Dist Row with Same Trx_id and trx_line_id
9085     -- That will be updated
9086     ---------------------------------------------------------------
9087     FOR i in g_dist_lines_cache_rec_tbl.trx_id.FIRST..g_dist_lines_cache_rec_tbl.trx_id.LAST LOOP
9088       If   g_dist_lines_cache_rec_tbl.trx_id(i)      = g_suite_rec_tbl.TRX_ID(p_dist_row_id)
9089       AND  g_dist_lines_cache_rec_tbl.trx_line_dist_id(i) = g_suite_rec_tbl.TRX_LINE_DIST_ID(p_dist_row_id)
9090       THEN
9091         l_updateable_row := i;
9092         l_dist_line_exists_flag := 'Y';
9093 
9094         write_message('=========================================');
9095         write_message('==Updating Distribution Lines Cache' );
9096         write_message('==Row to be updated is'||l_updateable_row );
9097         write_message('=========================================');
9098         ---------------------------------------------------------
9099         -- Update the Distribution Line Information in the Cache
9100         ---------------------------------------------------------
9101         g_dist_lines_cache_rec_tbl.APPLICATION_ID(l_updateable_row)        :=g_suite_rec_tbl.APPLICATION_ID(p_dist_row_id);
9102         g_dist_lines_cache_rec_tbl.ENTITY_CODE(l_updateable_row)           :=g_suite_rec_tbl.ENTITY_CODE(p_dist_row_id);
9103         g_dist_lines_cache_rec_tbl.EVENT_CLASS_CODE(l_updateable_row)      :=g_suite_rec_tbl.EVENT_CLASS_CODE(p_dist_row_id);
9104         g_dist_lines_cache_rec_tbl.EVENT_TYPE_CODE(l_updateable_row)       :=g_suite_rec_tbl.EVENT_TYPE_CODE(p_dist_row_id);
9105         g_dist_lines_cache_rec_tbl.TRX_ID(l_updateable_row)                :=g_suite_rec_tbl.TRX_ID(p_dist_row_id);
9106         g_dist_lines_cache_rec_tbl.TRX_LINE_ID(l_updateable_row)           :=g_suite_rec_tbl.TRX_LINE_ID(p_dist_row_id);
9107         g_dist_lines_cache_rec_tbl.TRX_LINE_QUANTITY(l_updateable_row)     :=g_suite_rec_tbl.TRX_LINE_QUANTITY(p_dist_row_id);
9108         g_dist_lines_cache_rec_tbl.TRX_LEVEL_TYPE(l_updateable_row)        :=g_suite_rec_tbl.TRX_LEVEL_TYPE(p_dist_row_id);
9109         g_dist_lines_cache_rec_tbl.TRX_LINE_DIST_ID(l_updateable_row)      :=g_suite_rec_tbl.TRX_LINE_DIST_ID(p_dist_row_id);
9110         g_dist_lines_cache_rec_tbl.TRX_LINE_DIST_AMT(l_updateable_row)     :=g_suite_rec_tbl.TRX_LINE_DIST_AMT(p_dist_row_id);
9111         g_dist_lines_cache_rec_tbl.TRX_LINE_DIST_QUANTITY(l_updateable_row):=g_suite_rec_tbl.TRX_LINE_DIST_QUANTITY(p_dist_row_id);
9112         g_dist_lines_cache_rec_tbl.DIST_LEVEL_ACTION(l_updateable_row)     :=g_suite_rec_tbl.DIST_LEVEL_ACTION(p_dist_row_id);
9113         g_dist_lines_cache_rec_tbl.TRX_LINE_DIST_DATE(l_updateable_row)    :=g_suite_rec_tbl.TRX_LINE_DIST_DATE(p_dist_row_id);
9114         g_dist_lines_cache_rec_tbl.ITEM_DIST_NUMBER(l_updateable_row)      :=g_suite_rec_tbl.ITEM_DIST_NUMBER(p_dist_row_id);
9115         g_dist_lines_cache_rec_tbl.DIST_INTENDED_USE(l_updateable_row)     :=g_suite_rec_tbl.DIST_INTENDED_USE(p_dist_row_id);
9116         g_dist_lines_cache_rec_tbl.TAX_INCLUSION_FLAG(l_updateable_row)     :=g_suite_rec_tbl.TAX_INCLUSION_FLAG(p_dist_row_id);
9117         g_dist_lines_cache_rec_tbl.TAX_CODE(l_updateable_row)              :=g_suite_rec_tbl.TAX_CODE(p_dist_row_id);
9118         g_dist_lines_cache_rec_tbl.TASK_ID(l_updateable_row)               :=g_suite_rec_tbl.TASK_ID(p_dist_row_id);
9119         g_dist_lines_cache_rec_tbl.AWARD_ID(l_updateable_row)              :=g_suite_rec_tbl.AWARD_ID(p_dist_row_id);
9120         g_dist_lines_cache_rec_tbl.PROJECT_ID(l_updateable_row)            :=g_suite_rec_tbl.PROJECT_ID(p_dist_row_id);
9121       END IF;
9122     END LOOP;
9123     ----------------------------------------------------
9124     -- If the Line to be updated does not exist display
9125     -- a message in the log.
9126     ----------------------------------------------------
9127     IF l_dist_line_exists_flag = 'N' THEN
9128       write_message('The Distribution Line Does not exists!!!!!!!');
9129       write_message('Please review the data for Distributions');
9130     END IF;
9131   END update_dist_lines_cache;
9132 
9133 /* ============================================================================*
9134  | PROCEDURE merge_with_dist_lines_cache : Merges Dist Lines for current Case  |
9135  |                                         when RE-DISTRIBUTE for DETERMINE    |
9136  |                                         RECOVERY. Merges the                |
9137  |                                         actual given lines plus the lines   |
9138  |                                         not given but existing in the cache |
9139  |                                         Lines taken from Cache will be      |
9140  |                                         marked as NO-ACTION.                |
9141  | Logic to Sync Distributions Cache and Suite Structure                       |
9142  | 1) Lets Call Distributions Cache "A"                                        |
9143  | 2) Lets Call Suite Structure "B"                                            |
9144  | 3) If A(i) exists in B(l) then A(i) = B(l)                                  |
9145  | 4) If A(i) does not exists in B(l) then                                     |
9146  |                    A(i) = "NO_ACTION"                                       |
9147  |                    Insert A(l) into B                                       |
9148  | 5) If B(i) is not in A(l) Do nothing                                        |
9149  | 6) If B(i) is not in A(l) insert into A                                     |
9150  * ===========================================================================*/
9151   PROCEDURE merge_with_dist_lines_cache
9152    (
9153     p_suite         IN VARCHAR2,
9154     p_case          IN VARCHAR2
9155    )
9156   IS
9157 
9158   l_dist_is_in_cache_flag VARCHAR2(1);
9159   l_row NUMBER;
9160   i NUMBER;
9161   l NUMBER;
9162 
9163   BEGIN
9164     l_dist_is_in_cache_flag := 'N';
9165 
9166     ---------------------------------------------------------------
9167     -- Loop The Distributions Cache to sync Cache vs Suite
9168     ---------------------------------------------------------------
9169     FOR i in g_dist_lines_cache_rec_tbl.trx_id.FIRST..g_dist_lines_cache_rec_tbl.trx_id.LAST LOOP
9170 
9171       l_dist_is_in_cache_flag := 'N';
9172       --------------------------------------------------------------------------
9173       -- Loop the Suite and Case in Memory to see if the record in Cache matches
9174       --------------------------------------------------------------------------
9175       FOR l in g_suite_rec_tbl.trx_id.FIRST..g_suite_rec_tbl.trx_id.LAST LOOP
9176         IF  g_suite_rec_tbl.TRX_ID(l)    = g_dist_lines_cache_rec_tbl.trx_id(i) AND
9177             g_suite_rec_tbl.ROW_SUITE(l) = p_suite AND
9178             g_suite_rec_tbl.ROW_CASE(l)  = p_case   THEN
9179           -------------------------------------------------------------------
9180           -- If the record exists, then update dist cache with it, if not
9181           -- then update cache with "NO-ACTION" and insert in Suite and Case
9182           -------------------------------------------------------------------
9183           IF g_suite_rec_tbl.TRX_LINE_ID(l) = g_dist_lines_cache_rec_tbl.trx_line_id(i) THEN
9184             l_dist_is_in_cache_flag := 'Y';
9185             write_message('=========================================');
9186             write_message('==Updating Distribution Lines Cache to NO ACTION' );
9187             write_message('=========================================');
9188             ----------------------------------------------------------------------------------
9189             -- Update the Distribution Line Information in the Cache with the info from Suite
9190             ----------------------------------------------------------------------------------
9191             g_dist_lines_cache_rec_tbl.APPLICATION_ID(l)        :=g_suite_rec_tbl.APPLICATION_ID(i);
9192             g_dist_lines_cache_rec_tbl.ENTITY_CODE(l)           :=g_suite_rec_tbl.ENTITY_CODE(i);
9193             g_dist_lines_cache_rec_tbl.EVENT_CLASS_CODE(l)      :=g_suite_rec_tbl.EVENT_CLASS_CODE(i);
9194             g_dist_lines_cache_rec_tbl.EVENT_TYPE_CODE(l)       :=g_suite_rec_tbl.EVENT_TYPE_CODE(i);
9195             g_dist_lines_cache_rec_tbl.TRX_ID(l)                :=g_suite_rec_tbl.TRX_ID(i);
9196             g_dist_lines_cache_rec_tbl.TRX_LINE_ID(l)           :=g_suite_rec_tbl.TRX_LINE_ID(i);
9197             g_dist_lines_cache_rec_tbl.TRX_LINE_QUANTITY(l)     :=g_suite_rec_tbl.TRX_LINE_QUANTITY(i);
9198             g_dist_lines_cache_rec_tbl.TRX_LEVEL_TYPE(l)        :=g_suite_rec_tbl.TRX_LEVEL_TYPE(i);
9199             g_dist_lines_cache_rec_tbl.TRX_LINE_DIST_ID(l)      :=g_suite_rec_tbl.TRX_LINE_DIST_ID(i);
9200             g_dist_lines_cache_rec_tbl.TRX_LINE_DIST_AMT(l)     :=g_suite_rec_tbl.TRX_LINE_DIST_AMT(i);
9201             g_dist_lines_cache_rec_tbl.TRX_LINE_DIST_QUANTITY(l):=g_suite_rec_tbl.TRX_LINE_DIST_QUANTITY(i);
9202             g_dist_lines_cache_rec_tbl.DIST_LEVEL_ACTION(l)     :=g_suite_rec_tbl.DIST_LEVEL_ACTION(i);
9203             g_dist_lines_cache_rec_tbl.TRX_LINE_DIST_DATE(l)    :=g_suite_rec_tbl.TRX_LINE_DIST_DATE(i);
9204             g_dist_lines_cache_rec_tbl.ITEM_DIST_NUMBER(l)      :=g_suite_rec_tbl.ITEM_DIST_NUMBER(i);
9205             g_dist_lines_cache_rec_tbl.DIST_INTENDED_USE(l)     :=g_suite_rec_tbl.DIST_INTENDED_USE(i);
9206             g_dist_lines_cache_rec_tbl.TAX_INCLUSION_FLAG(l)     :=g_suite_rec_tbl.TAX_INCLUSION_FLAG(i);
9207             g_dist_lines_cache_rec_tbl.TAX_CODE(l)              :=g_suite_rec_tbl.TAX_CODE(i);
9208             g_dist_lines_cache_rec_tbl.TASK_ID(l)               :=g_suite_rec_tbl.TASK_ID(i);
9209             g_dist_lines_cache_rec_tbl.AWARD_ID(l)              :=g_suite_rec_tbl.AWARD_ID(i);
9210             g_dist_lines_cache_rec_tbl.PROJECT_ID(l)            :=g_suite_rec_tbl.PROJECT_ID(i);
9211             EXIT;
9212           END IF;
9213         END IF;
9214       END LOOP;
9215       ---------------------------------------------------------------------------
9216       --If Line from Dist Cache is not in the Suite then update the Cache Line
9217       --with "NO_ACTION" and the insert the Cache Line in the Suite_Rec_Tbl
9218       ----------------------------------------------------------------------------
9219       IF l_dist_is_in_cache_flag = 'N' THEN
9220         g_dist_lines_cache_rec_tbl.DIST_LEVEL_ACTION(i)     :='NO_ACTION';
9221         -----------------------------------------------
9222         -- Inserts the Cache line in the Suite_Rec_Tbl
9223         -----------------------------------------------
9224         l_row := g_suite_rec_tbl.trx_id.LAST + 1;
9225         initialize_row(p_record_counter => l_row);
9226 
9227         g_suite_rec_tbl.ROW_SUITE(l_row)              := p_Suite ;
9228         g_suite_rec_tbl.ROW_CASE(l_row)               := p_Case;
9229         g_suite_rec_tbl.ROW_API(l_row)                := 'ZX_API_PUB';
9230         g_suite_rec_tbl.ROW_SERVICE(l_row)            := 'DETERMINE_RECOVERY';
9231         g_suite_rec_tbl.APPLICATION_ID(l_row)         := g_dist_lines_cache_rec_tbl.APPLICATION_ID(i);
9232         g_suite_rec_tbl.ENTITY_CODE(l_row)            := g_dist_lines_cache_rec_tbl.ENTITY_CODE(i);
9233         g_suite_rec_tbl.EVENT_CLASS_CODE(l_row)       := g_dist_lines_cache_rec_tbl.EVENT_CLASS_CODE(i);
9234         g_suite_rec_tbl.EVENT_TYPE_CODE(l_row)        := g_dist_lines_cache_rec_tbl.EVENT_TYPE_CODE(i);
9235         g_suite_rec_tbl.TRX_ID(l_row)                 := g_dist_lines_cache_rec_tbl.TRX_ID(i);
9236         g_suite_rec_tbl.TRX_LINE_ID(l_row)            := g_dist_lines_cache_rec_tbl.TRX_LINE_ID(i);
9237         g_suite_rec_tbl.TRX_LINE_QUANTITY(l_row)      := g_dist_lines_cache_rec_tbl.TRX_LINE_QUANTITY(i);
9238         g_suite_rec_tbl.TRX_LEVEL_TYPE(l_row)         := g_dist_lines_cache_rec_tbl.TRX_LEVEL_TYPE(i);
9239         g_suite_rec_tbl.TRX_LINE_DIST_ID(l_row)       := g_dist_lines_cache_rec_tbl.TRX_LINE_DIST_ID(i);
9240         g_suite_rec_tbl.TRX_LINE_DIST_AMT(l_row)      := g_dist_lines_cache_rec_tbl.TRX_LINE_DIST_AMT(i);
9241         g_suite_rec_tbl.TRX_LINE_DIST_QUANTITY(l_row) := g_dist_lines_cache_rec_tbl.TRX_LINE_DIST_QUANTITY(i);
9242         g_suite_rec_tbl.DIST_LEVEL_ACTION(l_row)      := g_dist_lines_cache_rec_tbl.DIST_LEVEL_ACTION(i);
9243         g_suite_rec_tbl.TRX_LINE_DIST_DATE(l_row)     := g_dist_lines_cache_rec_tbl.TRX_LINE_DIST_DATE(i);
9244         g_suite_rec_tbl.ITEM_DIST_NUMBER(l_row)       := g_dist_lines_cache_rec_tbl.ITEM_DIST_NUMBER(i);
9245         g_suite_rec_tbl.DIST_INTENDED_USE(l_row)      := g_dist_lines_cache_rec_tbl.DIST_INTENDED_USE(i);
9246         g_suite_rec_tbl.TAX_INCLUSION_FLAG(l_row)      := g_dist_lines_cache_rec_tbl.TAX_INCLUSION_FLAG(i);
9247         g_suite_rec_tbl.TAX_CODE(l_row)               := g_dist_lines_cache_rec_tbl.TAX_CODE(i);
9248         g_suite_rec_tbl.TASK_ID(l_row)                := g_dist_lines_cache_rec_tbl.TASK_ID(i);
9249         g_suite_rec_tbl.AWARD_ID(l_row)               := g_dist_lines_cache_rec_tbl.AWARD_ID(i);
9250         g_suite_rec_tbl.PROJECT_ID(l_row)             := g_dist_lines_cache_rec_tbl.PROJECT_ID(i);
9251       END IF;
9252     END LOOP;
9253     ---------------------------------------------------------------
9254     -- Now, Loop The Suite to sync the Distributions Cache vs Suite
9255     ---------------------------------------------------------------
9256     FOR i in g_suite_rec_tbl.trx_id.FIRST..g_suite_rec_tbl.trx_id.LAST LOOP
9257       IF g_suite_rec_tbl.ROW_SUITE(i) = p_suite AND
9258         g_suite_rec_tbl.ROW_CASE(i)  = p_case  THEN
9259         ------------------------------------------------------------------
9260         -- Loop the Distribution Cache to see if record in Suite Matches
9261         ------------------------------------------------------------------
9262         l_dist_is_in_cache_flag := 'N';
9263         FOR l in g_dist_lines_cache_rec_tbl.trx_id.FIRST..g_dist_lines_cache_rec_tbl.trx_id.LAST LOOP
9264           IF g_suite_rec_tbl.TRX_ID(i)    = g_dist_lines_cache_rec_tbl.trx_id(l) THEN
9265             l_dist_is_in_cache_flag := 'Y';
9266             EXIT;
9267           END IF;
9268         END LOOP;
9269         IF l_dist_is_in_cache_flag = 'N' THEN
9270           l_row := g_dist_lines_cache_rec_tbl.trx_id.LAST + 1;
9271           -----------------------------------------------------------
9272           -- If is not in Cache then Insert into Cache from the Suite
9273           -----------------------------------------------------------
9274           g_dist_lines_cache_rec_tbl.APPLICATION_ID(l_row)        :=g_suite_rec_tbl.APPLICATION_ID(i);
9275           g_dist_lines_cache_rec_tbl.ENTITY_CODE(l_row)           :=g_suite_rec_tbl.ENTITY_CODE(i);
9276           g_dist_lines_cache_rec_tbl.EVENT_CLASS_CODE(l_row)      :=g_suite_rec_tbl.EVENT_CLASS_CODE(i);
9277           g_dist_lines_cache_rec_tbl.EVENT_TYPE_CODE(l_row)       :=g_suite_rec_tbl.EVENT_TYPE_CODE(i);
9278           g_dist_lines_cache_rec_tbl.TRX_ID(l_row)                :=g_suite_rec_tbl.TRX_ID(i);
9279           g_dist_lines_cache_rec_tbl.TRX_LINE_ID(l_row)           :=g_suite_rec_tbl.TRX_LINE_ID(i);
9280           g_dist_lines_cache_rec_tbl.TRX_LINE_QUANTITY(l_row)     :=g_suite_rec_tbl.TRX_LINE_QUANTITY(i);
9281           g_dist_lines_cache_rec_tbl.TRX_LEVEL_TYPE(l_row)        :=g_suite_rec_tbl.TRX_LEVEL_TYPE(i);
9282           g_dist_lines_cache_rec_tbl.TRX_LINE_DIST_ID(l_row)      :=g_suite_rec_tbl.TRX_LINE_DIST_ID(i);
9283           g_dist_lines_cache_rec_tbl.TRX_LINE_DIST_AMT(l_row)     :=g_suite_rec_tbl.TRX_LINE_DIST_AMT(i);
9284           g_dist_lines_cache_rec_tbl.TRX_LINE_DIST_QUANTITY(l_row):=g_suite_rec_tbl.TRX_LINE_DIST_QUANTITY(i);
9285           g_dist_lines_cache_rec_tbl.DIST_LEVEL_ACTION(l_row)     :=g_suite_rec_tbl.DIST_LEVEL_ACTION(i);
9286           g_dist_lines_cache_rec_tbl.TRX_LINE_DIST_DATE(l_row)    :=g_suite_rec_tbl.TRX_LINE_DIST_DATE(i);
9287           g_dist_lines_cache_rec_tbl.ITEM_DIST_NUMBER(l_row)      :=g_suite_rec_tbl.ITEM_DIST_NUMBER(i);
9288           g_dist_lines_cache_rec_tbl.DIST_INTENDED_USE(l_row)     :=g_suite_rec_tbl.DIST_INTENDED_USE(i);
9289           g_dist_lines_cache_rec_tbl.TAX_INCLUSION_FLAG(l_row)     :=g_suite_rec_tbl.TAX_INCLUSION_FLAG(i);
9290           g_dist_lines_cache_rec_tbl.TAX_CODE(l_row)              :=g_suite_rec_tbl.TAX_CODE(i);
9291           g_dist_lines_cache_rec_tbl.TASK_ID(l_row)               :=g_suite_rec_tbl.TASK_ID(i);
9292           g_dist_lines_cache_rec_tbl.AWARD_ID(l_row)              :=g_suite_rec_tbl.AWARD_ID(i);
9293           g_dist_lines_cache_rec_tbl.PROJECT_ID(l_row)            :=g_suite_rec_tbl.PROJECT_ID(i);
9294         END IF;
9295       END IF;
9296     END LOOP;
9297   END merge_with_dist_lines_cache;
9298 
9299 /* =========================================================================*
9300  | PROCEDURE insert_tax_dist_id_gt :Retrieves TAX_DIST_ID depending on      |
9301  |                                  what STRUCTURE is being passed when     |
9302  |                                  calling using service                   |
9303  |                                  FREEZE_DISTRIBUTIONS                    |
9304  |                                   The Structures are:                    |
9305  |                                      STRUCTURE_TAX_LINE_KEY              |
9306  |                                      STRUCTURE_ITEM_DISTRIBUTION_KEY     |
9307  |                                      STRUCTURE_TRANSACTION_LINE_KEY      |
9308  |                                  Also Pupulates ZX_TAX_DIST_ID_GT        |
9309  * =========================================================================*/
9310   PROCEDURE insert_tax_dist_id_gt
9311    (
9312     p_suite         IN VARCHAR2,
9313     p_case          IN VARCHAR2,
9314     p_structure     IN VARCHAR2
9315    ) IS
9316 
9317   l_rec_nrec_tax_dist_id NUMBER;
9318   l_start_row NUMBER;
9319   l_end_row NUMBER;
9320   l_header_row NUMBER;
9321 
9322 
9323   BEGIN
9324     WRITE_MESSAGE('Calling insert_tax_dist_id with '||p_structure);
9325     IF p_structure = 'STRUCTURE_TRANSACTION_LINE_KEY'  THEN
9326       BEGIN
9327         --------------------------------------------------------
9328         -- Retrieve the start and ending rows for the structure
9329         --------------------------------------------------------
9330         get_start_end_rows_structure
9331         (
9332           p_suite      => p_suite,
9333           p_case       => p_case,
9334           p_structure  => p_structure,
9335           x_start_row  => l_start_row,
9336           x_end_row    => l_end_row
9337         );
9338 
9339         -----------------------------------
9340         -- Inserts into ZX_TAX_DIST_ID_GT
9341         -----------------------------------
9342         FOR i in l_start_row..l_end_row LOOP
9343           INSERT INTO ZX_TAX_DIST_ID_GT
9344             (
9345               TAX_DIST_ID
9346             )
9347             (SELECT
9348               REC_NREC_TAX_DIST_ID
9349            FROM   zx_rec_nrec_dist
9350            WHERE  tax_id in (SELECT tax_id
9351                              FROM   zx_lines l
9352                              WHERE  l.application_id   = g_suite_rec_tbl.APPLICATION_ID(i)
9353                              AND    l.entity_code      = g_suite_rec_tbl.ENTITY_CODE(i)
9354                              AND    l.event_class_code = g_suite_rec_tbl.EVENT_CLASS_CODE(i)
9355                              AND    l.trx_id           = g_suite_rec_tbl.TRX_ID(i)
9356                              AND    l.trx_line_id      = g_suite_rec_tbl.TRX_LINE_ID(i)));
9357         END LOOP;
9358 
9359       EXCEPTION
9360         --Code the Appropiate Exception Here
9361         WHEN OTHERS THEN
9362           write_message('An error has ocurred while populating ZX_TAX_DIST_ID_GT for Structure Trx Line Key');
9363       END;
9364 
9365 
9366     ELSIF p_structure = 'STRUCTURE_ITEM_DISTRIBUTION_KEY' THEN
9367         --------------------------------------------------------
9368         -- Retrieve the start and ending rows for the structure
9369         --------------------------------------------------------
9370         get_start_end_rows_structure
9371         (
9372           p_suite      => p_suite,
9373           p_case       => p_case,
9374           p_structure  => 'STRUCTURE_ITEM_DISTRIBUTION_KEY',
9375           x_start_row  => l_start_row,
9376           x_end_row    => l_end_row
9377         );
9378 
9379       BEGIN
9380         -----------------------------------
9381         -- Inserts into ZX_TAX_DIST_ID_GT
9382         -----------------------------------
9383         FOR i in l_start_row..l_end_row LOOP
9384           INSERT INTO ZX_TAX_DIST_ID_GT
9385           (
9386            TAX_DIST_ID
9387           )
9388           (SELECT rec_nrec_tax_dist_id
9389              REC_NREC_TAX_DIST_ID
9390            FROM   zx_rec_nrec_dist d
9391            WHERE  d.application_id   = g_suite_rec_tbl.APPLICATION_ID(i)
9392            AND    d.entity_code      = g_suite_rec_tbl.ENTITY_CODE(i)
9393            AND    d.event_class_code = g_suite_rec_tbl.EVENT_CLASS_CODE(i)
9394            AND    d.trx_id           = g_suite_rec_tbl.TRX_ID(i)
9395            AND    d.trx_line_id      = g_suite_rec_tbl.TRX_LINE_ID(i)
9396            AND    d.trx_line_dist_id = g_suite_rec_tbl.TRX_LINE_DIST_ID(i));
9397         END LOOP;
9398       EXCEPTION
9399         --Code the Appropiate Exception Here, by now only messages.
9400         WHEN OTHERS THEN
9401           write_message('An error has ocurred while populating ZX_TAX_DIST_ID_GT for Structure Item Dist Key');
9402       END;
9403 
9404     ELSIF p_structure = 'STRUCTURE_TAX_LINE_KEY'          THEN
9405       BEGIN
9406         --------------------------------------------------------
9407         -- Retrieve the start and ending rows for the structure
9408         --------------------------------------------------------
9409         get_start_end_rows_structure
9410         (
9411           p_suite      => p_suite,
9412           p_case       => p_case,
9413           p_structure  => 'STRUCTURE_TAX_LINE_KEY',
9414           x_start_row  => l_start_row,
9415           x_end_row    => l_end_row
9416         );
9417         -----------------------------------
9418         -- Inserts into ZX_TAX_DIST_ID_GT
9419         -----------------------------------
9420         FOR i in l_start_row..l_end_row LOOP
9421           INSERT INTO ZX_TAX_DIST_ID_GT
9422           (
9423             TAX_DIST_ID
9424           )
9425           (SELECT
9426             REC_NREC_TAX_DIST_ID
9427            FROM   zx_rec_nrec_dist
9428            WHERE  tax_id in (SELECT tax_id
9429                              FROM   zx_lines l
9430                              WHERE  l.application_id   = g_suite_rec_tbl.APPLICATION_ID(i)
9431                              AND    l.entity_code      = g_suite_rec_tbl.ENTITY_CODE(i)
9432                              AND    l.event_class_code = g_suite_rec_tbl.EVENT_CLASS_CODE(i)
9433                              AND    l.trx_id           = g_suite_rec_tbl.TRX_ID(i)
9434                              AND    l.trx_line_id      = g_suite_rec_tbl.TRX_LINE_ID(i)
9435                              AND    l.tax_regime_code  = g_suite_rec_tbl.TAX_REGIME_CODE(i)
9436                              AND    l.tax              = g_suite_rec_tbl.TAX(i)
9437                              AND    l.tax_status_code  = g_suite_rec_tbl.TAX_STATUS_CODE(i)
9438                              AND    l.tax_line_number  = g_suite_rec_tbl.TAX_LINE_NUMBER(i)));
9439         END LOOP;
9440       EXCEPTION
9441         --Code the Appropiate Exception Here, by now only messages.
9442         WHEN OTHERS THEN
9443           write_message('An error has ocurred populating ZX_TAX_DIST_ID_GT for Structure Tax Line Key');
9444       END;
9445     ELSIF p_structure = 'STRUCTURE_ITEM_DISTRIBUTIONS' THEN
9446 
9447         ---------------------------------------------------------------
9448         -- Retrieve the start and ending rows for the Header structure
9449         ---------------------------------------------------------------
9450         get_start_end_rows_structure
9451         (
9452           p_suite      => p_suite,
9453           p_case       => p_case,
9454           p_structure  => 'STRUCTURE_TRANSACTION_HEADER',
9455           x_start_row  => l_header_row,
9456           x_end_row    => l_end_row
9457         );
9458 
9459       --------------------------------------------------------
9460       -- Retrieve the start and ending rows for the structure
9461       --------------------------------------------------------
9462        get_start_end_rows_structure
9463         (
9464           p_suite      => p_suite,
9465           p_case       => p_case,
9466           p_structure  => 'STRUCTURE_ITEM_DISTRIBUTIONS',
9467           x_start_row  => l_start_row,
9468           x_end_row    => l_end_row
9469         );
9470         -----------------------------------
9471         -- Inserts into ZX_TAX_DIST_ID_GT
9472         -----------------------------------
9473         --write_message(to_char(l_start_row)||','||to_char(l_end_row));
9474         FOR i in l_start_row..l_end_row LOOP
9475         --write_message('i:'||to_number(i));
9476         --write_message('tax_dist_id:'||g_suite_rec_tbl.tax_dist_id(i));
9477           INSERT INTO ZX_TAX_DIST_ID_GT
9478           (
9479            TAX_DIST_ID
9480           )
9481           VALUES
9482           (
9483            g_suite_rec_tbl.tax_dist_id(i)
9484           );
9485         END LOOP;
9486 
9487     END IF;
9488   END insert_tax_dist_id_gt;
9489 
9490 
9491 /* ============================================================================*
9492  | PROCEDURE perform_data_caching : Calls all the procedures needed for Caching|
9493  |                                  depending on the Scenario Executed         |
9494  * ===========================================================================*/
9495 
9496 PROCEDURE perform_data_caching (p_suite_number    IN VARCHAR2,
9497                              p_case_number     IN VARCHAR2,
9498                              p_service         IN VARCHAR2,
9499                              p_structure       IN VARCHAR2,
9500                              p_header_row_id   IN NUMBER,
9501                              p_starting_row_id IN NUMBER,
9502                              p_ending_row_id   IN NUMBER,
9503                              p_prev_trx_id     IN NUMBER) IS
9504 
9505   l_structure VARCHAR2(2000);
9506   l_tax_event_type_code VARCHAR2(80);
9507   l_initial_row NUMBER;
9508   l_ending_row NUMBER;
9509   i NUMBER;
9510   BEGIN
9511     ------------------------------------------------------------
9512     -- Proceed to do Data Caching when the API is Calculate Tax
9513     -- and the tax_event_type is CREATE. So Cache the entire
9514     -- Header and Lines
9515     ------------------------------------------------------------
9516     IF p_service  = 'CALCULATE_TAX' THEN
9517       FOR i IN p_header_row_id..p_ending_row_id LOOP
9518         l_tax_event_type_code := g_suite_rec_tbl.TAX_EVENT_TYPE_CODE(p_header_row_id);
9519         l_structure := g_suite_rec_tbl.ROW_STRUCTURE(i);
9520         ---------------------------------------------------------------
9521         -- Handle the Data Caching when Tax Event Type Code is CREATE
9522         ---------------------------------------------------------------
9523         IF l_tax_event_type_code = 'CREATE' THEN
9524           IF l_structure = 'STRUCTURE_TRANSACTION_HEADER' THEN
9525             --write_message('Im going to cache Header row:'||to_char(i));
9526             populate_trx_header_cache(p_header_row_id => p_header_row_id);
9527             --write_message('==================================================');
9528             write_message('==A line for Header has been cached');
9529             --write_message('==tax_event_type_code:'||l_tax_event_type_code);
9530             --write_message('==          Structure:'||l_structure);
9531             --write_message('==                Row:'||to_char(i));
9532             --write_message('==================================================');
9533 
9534           ELSIF l_structure = 'STRUCTURE_TRANSACTION_LINES' THEN
9535             --write_message('Im going to cache line row:'||to_char(i));
9536             --write_message('Im going to cache Structur:'||nvl(l_structure,'EMPTY'));
9537             populate_trx_lines_cache(p_header_row_id => p_header_row_id,
9538                                      p_line_row_id   => i);
9539             --write_message('==================================================');
9540             write_message('==A line for Line has been cached  ');
9541             --write_message('==tax_event_type_code:'||l_tax_event_type_code);
9542             --write_message('==          Structure:'||l_structure);
9543             --write_message('==                Row:'||to_char(i));
9544             --write_message('==================================================');
9545 
9546           END IF;
9547         ---------------------------------------------------------------
9548         -- Handle the Data Caching when Tax Event Type Code is UPDATE
9549         ---------------------------------------------------------------
9550         ELSIF l_tax_event_type_code = 'UPDATE' THEN
9551           IF l_structure = 'STRUCTURE_TRANSACTION_HEADER' THEN
9552             update_trx_header_cache(p_header_row_id => p_header_row_id);
9553             write_message('==================================================');
9554             write_message('==A line for Header cache has been updated');
9555             write_message('==tax_event_type_code:'||l_tax_event_type_code);
9556             write_message('==          Structure:'||l_structure);
9557             write_message('==                Row:'||to_char(i));
9558             write_message('==================================================');
9559 
9560           ELSIF l_structure = 'STRUCTURE_TRANSACTION_LINES' THEN
9561             update_trx_lines_cache(p_header_row_id   => p_header_row_id,
9562                                      p_line_row_id   => i);
9563             write_message('==================================================');
9564             write_message('==A line for Line cache has been updated');
9565             write_message('==tax_event_type_code:'||l_tax_event_type_code);
9566             write_message('==          Structure:'||l_structure);
9567             write_message('==                Row:'||to_char(i));
9568             write_message('==================================================');
9569           END IF;
9570         END IF;
9571       END LOOP;
9572     ------------------------------------------------------------
9573     -- Proceed to do Data Caching when the API is Calculate Tax
9574     -- and the tax_event_type is CREATE. So Cache the entire
9575     -- Header and Lines
9576     ------------------------------------------------------------
9577     ELSIF p_service  = 'DETERMINE_RECOVERY' THEN
9578       ----------------------------------------------------------
9579       -- Retrieve the initial and ending lines for Imp Tax Lines
9580       ----------------------------------------------------------
9581       get_start_end_rows_structure
9582        (
9583         p_suite     =>  p_suite_number,
9584         p_case      =>  p_case_number,
9585         p_structure =>  'STRUCTURE_TRANSACTION_HEADER',
9586         x_start_row =>  l_initial_row,
9587         x_end_row   =>  l_ending_row
9588        );
9589 
9590       FOR i IN l_initial_row..l_ending_row LOOP
9591         l_tax_event_type_code := g_suite_rec_tbl.TAX_EVENT_TYPE_CODE(l_initial_row);
9592         l_structure := g_suite_rec_tbl.ROW_STRUCTURE(i);
9593         -----------------------------------------------------------------
9594         -- Handle the Data Caching when Tax Event Type Code is DISTRIBUTE
9595         -----------------------------------------------------------------
9596         IF l_tax_event_type_code = 'DISTRIBUTE' THEN
9597           IF l_structure = 'STRUCTURE_TRANSACTION_HEADER' THEN
9598             populate_trx_header_cache(p_header_row_id => p_header_row_id);
9599             write_message('==================================================');
9600             write_message('==A line for Header has been cached');
9601             write_message('==tax_event_type_code:'||l_tax_event_type_code);
9602             write_message('==          Structure:'||l_structure);
9603             write_message('==                Row:'||to_char(i));
9604             write_message('==================================================');
9605 
9606           ELSIF l_structure = 'STRUCTURE_ITEM_DISTRIBUTIONS' THEN
9607             populate_dist_lines_cache(p_dist_row_id => i);
9608             write_message('==================================================');
9609             write_message('==A line for Line has been cached  ');
9610             write_message('==tax_event_type_code:'||l_tax_event_type_code);
9611             write_message('==          Structure:'||l_structure);
9612             write_message('==                Row:'||to_char(i));
9613             write_message('==================================================');
9614           END IF;
9615 
9616         END IF;
9617       END LOOP;
9618     END IF;
9619   END perform_data_caching;
9620 
9621 /*============================================================================*
9622  | PROCEDURE get_start_end_rows_structure: Retrieves the initial and ending   |
9623  |                                    rows of a Structure in g_suite_rec_tbl  |
9624  |                                    The Structure lines always have to be   |
9625  |                                    contiguos.                              |
9626  *============================================================================*/
9627   PROCEDURE get_start_end_rows_structure
9628     (
9629       p_suite                IN VARCHAR2,
9630       p_case                 IN VARCHAR2,
9631       p_structure            IN VARCHAR2,
9632       x_start_row            OUT NOCOPY NUMBER,
9633       x_end_row              OUT NOCOPY NUMBER
9634     ) IS
9635   l_start_row NUMBER;
9636   l_end_row   NUMBER;
9637   i           NUMBER;
9638   BEGIN
9639     l_start_row := NULL;
9640     l_end_row   := NULL;
9641 
9642 
9643     FOR i IN g_suite_rec_tbl.ROW_SUITE.FIRST..g_suite_rec_tbl.ROW_SUITE.LAST LOOP
9644       IF g_suite_rec_tbl.ROW_SUITE(i)     = p_suite AND
9645          g_suite_rec_tbl.ROW_CASE(i)      = p_case  AND
9646          g_suite_rec_tbl.ROW_STRUCTURE(i) = p_structure THEN
9647         IF l_start_row is NULL THEN
9648           l_start_row := i;
9649         END IF;
9650         l_end_row := i;
9651       END IF;
9652     END LOOP;
9653     x_start_row := l_start_row;
9654     x_end_row := l_end_row;
9655   END get_start_end_rows_structure;
9656 
9657 
9658 /*============================================================================*
9659  | PROCEDURE get_zx_errors_gt: Retrieves the errors stored in ZX_ERRORS_GT    |
9660  *============================================================================*/
9661   PROCEDURE get_zx_errors_gt
9662     (x_message            OUT NOCOPY VARCHAR2)
9663   IS
9664   l_zx_errors_gt_count     NUMBER;
9665   l_message                VARCHAR2(4000);
9666 
9667   CURSOR c_errors IS
9668     SELECT message_text
9669     FROM   zx_errors_gt;
9670   BEGIN
9671 
9672     ----------------------------------------------------------------
9673     -- Detects if there are messages in the table ZX_ERRORS_GT
9674     -- if so, extract them and print them.
9675     ----------------------------------------------------------------
9676     BEGIN
9677       Select count(*) into l_zx_errors_gt_count from ZX_ERRORS_GT;
9678     EXCEPTION
9679       WHEN OTHERS THEN NULL;
9680     END;
9681 
9682     IF l_zx_errors_gt_count = 0 then
9683       l_message := NULL;
9684     ELSE
9685       FOR c in c_errors LOOP
9686         l_message := l_message || c.message_text ||' ';
9687       END LOOP;
9688     END IF;
9689     x_message := l_message;
9690 
9691   END get_zx_errors_gt;
9692 
9693 
9694 /*============================================================================*
9695  | PROCEDURE TEST_API: This is the main procedure of Testing APIs             |
9696  |                     The parameters being passed are the name and location  |
9697  |                     of the Text Data file.                                 |
9698  |                     The procedure returns a LONG variable containing the   |
9699  |                     log that will be visible from report in the application|
9700  *============================================================================*/
9701 
9702 PROCEDURE TEST_API(p_file      IN VARCHAR2,
9703                    p_directory IN VARCHAR2,
9704                    x_log       OUT NOCOPY LONG)  IS
9705 
9706 l_file_curr_line_counter          NUMBER;
9707 l_suite_curr_line_counter         NUMBER;
9708 l_sid                             NUMBER;
9709 l_file_completed                  VARCHAR2(2000);
9710 l_return_status                   VARCHAR2(2000);
9711 l_curr_case_header_row            NUMBER;
9712 l_curr_case_line_start_row        NUMBER;
9713 l_curr_case_line_end_row          NUMBER;
9714 l_prev_case_header_row            NUMBER;
9715 l_prev_case_line_start_row        NUMBER;
9716 l_prev_case_line_end_row          NUMBER;
9717 l_file_curr_line_string           VARCHAR2(2000);
9718 l_file_curr_line_suite_number     VARCHAR2(30);
9719 l_file_curr_line_case_number      VARCHAR2(30);
9720 l_file_curr_line_api              VARCHAR2(90);
9721 l_file_curr_line_task             VARCHAR2(90);
9722 l_file_curr_line_structure        VARCHAR2(90);
9723 l_file_prev_line_suite_number     VARCHAR2(30);
9724 l_file_prev_line_case_number      VARCHAR2(30);
9725 l_file_prev_line_api              VARCHAR2(90);
9726 l_file_prev_line_task             VARCHAR2(90);
9727 l_file_prev_line_structure        VARCHAR2(90);
9728 l_previous_trx_id                 NUMBER;
9729 l_file_line_counter               NUMBER;
9730 l_suite_line_counter              NUMBER;
9731 l_record_counter                  NUMBER;
9732 l_current_datafile_section        VARCHAR2(2000);
9733 l_suite_line_header               NUMBER;
9734 l_suite_line_begin_lines          NUMBER;
9735 l_suite_line_end_lines            NUMBER;
9736 l_file_curr_line_end_of_case      VARCHAR2(90);
9737 l_curr_case_trx_id                NUMBER;
9738 l_initial_row                     NUMBER;
9739 l_ending_row                      NUMBER;
9740 l_environment                     VARCHAR2(2000);
9741 l_user_id                         NUMBER;
9742 
9743 BEGIN
9744   -----------------------------------
9745   --Initialize Global Variables
9746   -----------------------------------
9747   g_log_destination           := 'LOGVARIABLE'; --SPOOL,LOGFILE,LOGV
9748   g_line_max_size             := 32767;
9749   g_initial_file_reading_flag := 'Y';
9750   g_separator                 := '~';
9751   g_last_portion_prev_string  := '';
9752   g_string_segment            := '';
9753   g_line_segment_string       := '';
9754   g_retrieve_another_segment  := 'Y';
9755   g_line_segment_counter      := 0;
9756   g_element_in_segment_count  := 0;
9757   g_file_curr_line_counter    := 0;
9758   g_api_version               := 1.0;
9759   g_header_cache_counter      := 0;
9760   g_line_cache_counter        := 0;
9761   g_dist_cache_counter        := 0;
9762 
9763   -----------------------------------
9764   -- Initialize Local Variables
9765   -----------------------------------
9766   l_file_curr_line_counter  := 0;
9767   l_suite_curr_line_counter := 0;
9768   l_file_completed          := 'N';
9769   l_suite_line_counter      := 0;
9770 
9771 
9772   write_message('---------------------------------------');
9773   write_message('--      eTAX TESTING OF APIs         --');
9774   write_message('--      --------------------         --');
9775   write_message('-- File Name is :'||p_file);
9776   write_message('---------------------------------------');
9777   ------------------
9778   -- Initialization
9779   ------------------
9780   --FND_GLOBAL.INITIALIZE(l_sid,0,20420,1,null,null,0,0,null,null,null,null);
9781   --------------------------------------------------------------------------------
9782   --Bug 4216336. The Initialization is required to obtain for a concurrent
9783   --             program (The calling report of ZX_TEST_API) as per bug 3771348.
9784   --             The initialization is made for the settings of user "BTT".
9785   --------------------------------------------------------------------------------
9786   BEGIN
9787     Select user_id
9788       into l_user_id
9789       from fnd_user_view
9790      where user_name = 'BTT';
9791   EXCEPTION
9792     WHEN OTHERS THEN
9793      write_message('ERROR: Cannot retrieve the User ID for user BTT. Please review');
9794   END;
9795 
9796   FND_GLOBAL.APPS_INITIALIZE( USER_ID      => l_user_id,  --User BTT
9797                               RESP_ID      =>     60252,  --Resp ZX Testing Tool
9798                               RESP_APPL_ID =>      235); --Application eBTax
9799   write_message( 'User name           = ' || fnd_global.user_name);
9800   write_message( 'User id             = ' || fnd_global.user_id);
9801   write_message( 'Resp name           = ' || fnd_global.resp_name);
9802   write_message( 'Resp id             = ' || fnd_global.resp_id);
9803   write_message( 'Resp app short name = ' || fnd_global.application_short_name);
9804   write_message( 'Resp app id         = ' || fnd_global.resp_appl_id);
9805 
9806 
9807   ----------------------------
9808   -- Open the file to process
9809   ----------------------------
9810   INITIALIZE_FILE(p_directory,p_file,l_return_status);
9811 
9812   l_file_curr_line_suite_number          := null;
9813   l_file_curr_line_case_number           := null;
9814   l_file_curr_line_api                   := null;
9815   l_file_curr_line_task                  := null;
9816   l_file_curr_line_structure             := null;
9817   l_file_prev_line_suite_number          := null;
9818   l_file_prev_line_case_number           := null;
9819   l_file_prev_line_api                   := null;
9820   l_file_prev_line_task                  := null;
9821   l_file_prev_line_structure             := null;
9822   l_file_curr_line_end_of_case           := 'N';
9823   g_initial_file_reading_flag            := 'Y';
9824 
9825   ----------------------------------------------------------------
9826   -- Start the cycle of reading the file line by line
9827   -- and putting the Suite in the memory structure g_suite_rec_tbl.
9828   -----------------------------------------------------------------
9829   LOOP
9830     -------------------------
9831     -- Read a line from file
9832     -------------------------
9833     READ_LINE(
9834        x_line_suite               => l_file_curr_line_suite_number,
9835        x_line_case                => l_file_curr_line_case_number,
9836        x_line_api                 => l_file_curr_line_api,
9837        x_line_task                => l_file_curr_line_task,
9838        x_line_structure           => l_file_curr_line_structure,
9839        x_line_counter             => l_file_line_counter,
9840        x_line_is_end_of_case      => l_file_curr_line_end_of_case,
9841        x_current_datafile_section => l_current_datafile_section,
9842 	   x_return_status            => l_return_status);
9843 
9844     IF l_return_status = 'FAILURE' THEN
9845       write_message('--------------------------------------------------------');
9846       write_message('--File Reading has been completed.  End of Processing --');
9847       write_message('--------------------------------------------------------');
9848       EXIT;
9849     END IF;
9850 
9851 
9852     write_message('-- Reading line number : '||to_char(l_file_line_counter));
9853 
9854     l_file_curr_line_string := substr(g_line_buffer,1,1000);
9855 
9856     -------------------------------------------------------------------
9857     -- Identify where the different structures are for each Case     --
9858     -------------------------------------------------------------------
9859     If g_current_datafile_section = 'INPUT_DATA' THEN
9860       l_suite_line_counter := l_suite_line_counter + 1;
9861 
9862       ----------------------------------------------------------------
9863       --Identify header row information and begin and end of lines
9864       ----------------------------------------------------------------
9865       IF l_file_curr_line_structure = 'STRUCTURE_TRANSACTION_HEADER' THEN
9866         -----------------------------------------------------------
9867         -- Identifies in wich line of Suite is the Header
9868         -----------------------------------------------------------
9869         l_curr_case_header_row          := l_suite_line_counter;
9870 
9871       ELSIF l_file_curr_line_structure = 'STRUCTURE_TRANSACTION_LINES' THEN
9872         ---------------------------------------------------------------
9873         -- Identifies in wich lines of Suite are Begin and End of Lines
9874         ---------------------------------------------------------------
9875         IF l_curr_case_line_start_row IS NULL THEN
9876           l_curr_case_line_start_row := l_suite_line_counter;
9877         END IF;
9878         l_curr_case_line_end_row := l_suite_line_counter;
9879       END IF;
9880     END IF;
9881 
9882     -------------------------------------------------------------
9883     -- Populate a record in the structure that holds the Suite with
9884     -- the info from the line retrieved from the file.
9885     -------------------------------------------------------------
9886     put_line_in_suite_rec_tbl
9887         (
9888           x_suite_number    => l_file_curr_line_suite_number   ,
9889           x_case_number     => l_file_curr_line_case_number    ,
9890           x_api_name        => l_file_curr_line_api            ,
9891           x_api_service     => l_file_curr_line_task           ,
9892           x_api_structure   => l_file_curr_line_structure      ,
9893           p_header_row      => l_curr_case_header_row          ,
9894           p_record_counter  => l_suite_line_counter
9895         );
9896 
9897     write_message('-----------------------------------------------');
9898     write_message('-- Row has been inserted in  Suite Structure --');
9899     write_message('-- put_line_in_suite_rec_tbl                 --');
9900     write_message('-- l_suite_number:'||        l_file_curr_line_suite_number);
9901     write_message('-- l_case_number :'||        l_file_curr_line_case_number);
9902     write_message('-- l_service     :'||        l_file_curr_line_task);
9903     write_message('-- l_structure   :'||        l_file_curr_line_structure);
9904     write_message('------------------------------------------------');
9905 
9906     ---------------------------------------------------------------------
9907     -- Perform this Data Caching ONLY for the Case of Re-Distribute
9908     -- in DETERMINE_RECOVERY
9909     ---------------------------------------------------------------------
9910 
9911     IF l_file_curr_line_task = 'DETERMINE_RECOVERY' THEN
9912       ----------------------------------------------------------
9913       -- Retrieve the initial and ending lines for Imp Tax Lines
9914       ----------------------------------------------------------
9915       get_start_end_rows_structure
9916        (
9917         p_suite     =>  l_file_curr_line_suite_number,
9918         p_case      =>  l_file_curr_line_case_number,
9919         p_structure =>  'STRUCTURE_TRANSACTION_HEADER',
9920         x_start_row =>  l_initial_row,
9921         x_end_row   =>  l_ending_row
9922        );
9923 
9924       write_message('Data Caching for Determine Recovery');
9925       IF g_suite_rec_tbl.TAX_EVENT_TYPE_CODE(l_initial_row) = 'RE-DISTRIBUTE' THEN
9926         -----------------------------------------------------------
9927         -- Perform this Data Caching only for the Case of Re-Distribute
9928         -- in DETERMINE_RECOVERY
9929         -----------------------------------------------------------
9930         merge_with_dist_lines_cache(
9931                         p_suite         => l_file_curr_line_suite_number,
9932                         p_case          => l_file_curr_line_case_number);
9933       END IF;
9934     END IF;
9935 
9936     ----------------------------------------------------------------------------
9937     -- If the current line is the end of a case,
9938     -- Insert into the Global Temporary Tables before calling API
9939     ----------------------------------------------------------------------------
9940     IF l_file_curr_line_end_of_case = 'Y' THEN
9941 
9942       ----------------------------------------------------------
9943       -- Retrieve the row of the Header
9944       ----------------------------------------------------------
9945       get_start_end_rows_structure
9946        (
9947         p_suite     =>  l_file_curr_line_suite_number,
9948         p_case      =>  l_file_curr_line_case_number,
9949         p_structure =>  'STRUCTURE_TRANSACTION_HEADER',
9950         x_start_row =>  l_initial_row,
9951         x_end_row   =>  l_ending_row
9952        );
9953       l_curr_case_header_row := l_initial_row;
9954 
9955       ----------------------------------------------------------
9956       -- Retrieve the row of the Lines
9957       ----------------------------------------------------------
9958       get_start_end_rows_structure
9959        (
9960         p_suite     =>  l_file_curr_line_suite_number,
9961         p_case      =>  l_file_curr_line_case_number,
9962         p_structure =>  'STRUCTURE_TRANSACTION_LINES',
9963         x_start_row =>  l_initial_row,
9964         x_end_row   =>  l_ending_row
9965        );
9966       l_curr_case_line_start_row := l_initial_row;
9967       l_curr_case_line_end_row := l_ending_row;
9968 
9969       ------------------------------------------------
9970       -- Obtains the Transaction ID of the Header row
9971       ------------------------------------------------
9972 
9973       If l_curr_case_header_row IS NOT NULL then
9974         l_curr_case_trx_id := g_suite_rec_tbl.trx_id(l_curr_case_header_row);
9975       ELSE
9976         l_curr_case_trx_id := g_suite_rec_tbl.trx_id(l_suite_line_counter);
9977       END IF;
9978 
9979       write_message('-- Inserting into Global Temporary Tables --');
9980       write_message('-- For the Following values:              --');
9981       write_message('p_suite_number   ->l_curr_line_suite_number   '||l_file_curr_line_suite_number);
9982       write_message('p_case_number    ->l_curr_line_case_number    '||l_file_curr_line_case_number);
9983       write_message('p_service        ->l_curr_line_task           '||l_file_curr_line_task);
9984       write_message('p_structure      ->l_curr_line_structure      '||l_file_curr_line_structure);
9985       write_message('p_header_line_id ->l_curr_case_header_row     '||to_char(l_curr_case_header_row));
9986       write_message('p_starting_line_id>l_curr_case_line_start_row '||to_char(l_curr_case_line_start_row));
9987       write_message('p_ending_line_id  >l_curr_case_line_end_row   '||to_char(l_curr_case_line_end_row));
9988       write_message('p_curr_case_trx_id>l_curr_case_trx_id         '||to_char(l_curr_case_trx_id));
9989       write_message('--------------------------------------------');
9990 
9991       write_message('---------------------------------------');
9992       write_message('-- Insert into GTs will be performed --');
9993       write_message('---------------------------------------');
9994       insert_into_gts(p_suite_number    =>  l_file_curr_line_suite_number,
9995                       p_case_number     =>  l_file_curr_line_case_number,
9996                       p_service         =>  l_file_curr_line_task,
9997                       p_structure       =>  l_file_curr_line_structure,
9998                       p_header_row_id   =>  l_curr_case_header_row,
9999                       p_starting_row_id =>  l_curr_case_line_start_row,
10000                       p_ending_row_id   =>  l_curr_case_line_end_row,
10001                       p_prev_trx_id     =>  l_curr_case_trx_id);
10002 
10003       write_message('---------------------------------------');
10004       write_message('--   Insert into GTs is completed.   --');
10005       write_message('---------------------------------------');
10006 
10007       ---------------------------------------------------------------
10008       -- Perform Data Caching for all scenarios <> than RE-DISTRIBUTE
10009       ---------------------------------------------------------------
10010       write_message('-- Data Caching will been performed...');
10011       write_message('p_suite_number  =>'||         l_file_curr_line_suite_number);
10012       write_message('p_case_number   =>'||         l_file_curr_line_case_number);
10013       write_message('p_service       =>'||         l_file_curr_line_task);
10014       write_message('p_structure     =>'||         l_file_curr_line_structure);
10015       write_message('p_header_row_id =>'||to_char( l_curr_case_header_row));
10016       write_message('p_starting_row_id => '||to_char( l_curr_case_line_start_row));
10017       write_message('p_ending_row_id =>'||to_char( l_curr_case_line_end_row));
10018       write_message('p_prev_trx_id   =>'||to_char( l_curr_case_trx_id));
10019 
10020       perform_data_caching(
10021                       p_suite_number    =>  l_file_curr_line_suite_number,
10022                       p_case_number     =>  l_file_curr_line_case_number,
10023                       p_service         =>  l_file_curr_line_task,
10024                       p_structure       =>  l_file_curr_line_structure,
10025                       p_header_row_id   =>  l_curr_case_header_row,
10026                       p_starting_row_id =>  l_curr_case_line_start_row,
10027                       p_ending_row_id   =>  l_curr_case_line_end_row,
10028                       p_prev_trx_id     =>  l_curr_case_trx_id);
10029       write_message('-- Data Caching Completed...');
10030 
10031       ---------------------------------------------------------------
10032       -- Call the APIs after Data Caching and GT are populated
10033       ---------------------------------------------------------------
10034       write_message('----------------------------------------------------');
10035       write_message('-- Calling the Service ==> '||l_file_curr_line_task);
10036       write_message('--               Suite ==> '||l_file_curr_line_suite_number);
10037       write_message('--                Case ==> '||l_file_curr_line_case_number);
10038       write_message('--      Transaction Id ==> '||to_char(l_curr_case_trx_id));
10039       call_api( p_api_service    => l_file_curr_line_task,
10040                 p_suite_number   => l_file_curr_line_suite_number,
10041                 p_case_number    => l_file_curr_line_case_number,
10042                 p_transaction_id => l_curr_case_trx_id);
10043 
10044       COMMIT;
10045 
10046       ---------------------------------------------------------------
10047       -- Clean up the Table --NOTE delete_table has to be used to
10048       -- initilize the memory for the next SUITE.
10049       ---------------------------------------------------------------
10050       -- delete_table;
10051 
10052       ---------------------------------------------------------------
10053       -- Reset variables for next case
10054       ---------------------------------------------------------------
10055       l_curr_case_line_start_row := null;
10056 
10057     END IF;
10058   END LOOP;
10059 
10060   -----------------------------------------
10061   -- Close the file.
10062   -----------------------------------------
10063   CLOSE_FILE(l_return_status);
10064 
10065   -----------------------------------------------------
10066   -- Returns the Log in a variable used by the report
10067   -----------------------------------------------------
10068   x_log := g_log_variable;
10069   g_log_variable := null;
10070 
10071 END TEST_API;
10072 END ZX_TEST_API;