DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_CRT_FINANCE_SEGMENT

Source


1 Package  body ota_crt_finance_segment as
2 /* $Header: otcrtfhr.pkb 120.0.12000000.2 2007/04/20 13:43:11 pekasi noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |-----------------------------<create_segment>------------------------------|
6 -- ----------------------------------------------------------------------------
7 -- {Start Of Comments}
8 --
9 -- Description:
10 --   This package is used for self service application to create finance header
11 --   data when user enroll in the class.
12 --
13 -- Prerequisites:
14 --
15 -- In Parameters:
16 --
17 -- Post Success:
18 --   Finanece Header infrmation will be created.
19 --
20 -- Post Failure:
21 --   Status will be passed to the caller and the caller will raise a notification.
22 --
23 -- Developer Implementation Notes:
24 --   The attrbute in parameters should be modified as to the business process
25 --   requirements.
26 --
27 -- Access Status:
28 --   Internal Development Use Only.
29 --
30 -- {End Of Comments}
31 -- ----------------------------------------------------------------------------
32 Procedure create_segment
33   (p_assignment_id                        in     number
34   ,p_business_group_id_from               in     number
35   ,p_business_group_id_to                 in     number
36   ,p_organization_id				in     number
37   ,p_sponsor_organization_id              in     number
38   ,p_event_id 					in 	 number
39   ,p_person_id					in     number
40   ,p_currency_code				in     varchar2
41   ,p_cost_allocation_keyflex_id           in     number
42   ,p_user_id                              in     number
43   ,p_finance_header_id			 out nocopy    number
44   ,p_object_version_number		 out nocopy    number
45   ,p_result                     	 out nocopy    varchar2
46   ,p_from_result                          out nocopy    varchar2
47   ,p_to_result                            out nocopy    varchar2
48   ) IS
49 
50 TYPE from_rec_type IS RECORD
51    (colname    varchar2(30),
52     destcolname  varchar2(30),
53     colvalue   varchar2(200));
54 
55 TYPE from_arr_type IS TABLE OF from_rec_type INDEX BY BINARY_INTEGER;
56 
57 
58 TYPE to_rec_type IS RECORD
59    (colname    varchar2(30),
60     destcolname  varchar2(30),
61     colvalue   varchar2(200));
62 
63 TYPE to_arr_type IS TABLE OF to_rec_type INDEX BY BINARY_INTEGER;
64 
65 
66 l_organization_id  number(15);
67 l_cost_allocation_keyflex_id number(9);
68 l_user_id        number ;
69 
70 
71 source_cursor           INTEGER;
72 ret                     INTEGER;
73 l_segment               varchar2(200);
74 l_paying_cost_center    varchar2(2000);
75 l_receiving_cost_center varchar2(2000);
76 l_chart_of_accounts_id  number(15);
77 l_set_of_books_id       number(15);
78 l_from_set_of_books_id  number(15);
79 l_to_set_of_books_id    number(15);
80 l_receivable_type       ota_finance_headers.receivable_type%type;
81 l_sequence 			number(3);
82 l_delimiter   		varchar2(1);
83 l_length      		number(3);
84 l_dynamicSqlString  	varchar2(2000);
85 i          			number;
86 --cc_arr     		cc_arr_type;
87 j          			number;
88 k          			number;
89 g_from_arr   		from_arr_type;
90 g_to_arr   			to_arr_type;
91 l_from_cc_id  		number;
92 l_to_cc_id  		number;
93 l_map                   varchar2(1);
94 l_error                 varchar(2000);
95 l_authorizer_person_id  ota_finance_headers.authorizer_person_id%type;
96 l_auto_transfer         varchar2(1) := FND_PROFILE.VALUE('OTA_SSHR_AUTO_GL_TRANSFER');
97 l_transfer_status       ota_finance_headers.transfer_status%type;
98 l_administrator         ota_finance_headers.administrator%type;
99 l_date_format varchar2(200);
100 l_hr_cost_segment       ota_hr_gl_flex_maps.hr_cost_segment%type;
101 
102 l_offering_id   		ota_events.offering_id%type;
103 
104 CURSOR THG_FROM(p_business_group_id in number)
105 IS
106 Select
107       tcc.gl_set_of_books_id,
108 	thg.SEGMENT
109 	,thg.SEGMENT_NUM
110 	,thg.HR_DATA_SOURCE
111 	,thg.CONSTANT
112 	,thg.HR_COST_SEGMENT
113 FROM  OTA_HR_GL_FLEX_MAPS THG
114       ,OTA_CROSS_CHARGES TCC
115 WHERE THG.Cross_charge_id = TCC.Cross_charge_id and
116       TCC.Business_group_id = p_business_group_id and
117       TCC.Type = 'E' and
118       TCC.FROM_TO = 'F' and
119       Trunc(sysdate) between tcc.start_date_active and nvl(tcc.end_date_active,sysdate)
120 ORDER BY thg.segment_num;
121 
122 
123 CURSOR THG_TO(p_business_group_id in number)
124 IS
125 Select
126       tcc.gl_set_of_books_id,
127 	thg.SEGMENT
128 	,thg.SEGMENT_NUM
129 	,thg.HR_DATA_SOURCE
130 	,thg.CONSTANT
131 	,thg.HR_COST_SEGMENT
132 FROM  OTA_HR_GL_FLEX_MAPS THG
133       ,OTA_CROSS_CHARGES TCC
134 WHERE THG.Cross_charge_id = TCC.Cross_charge_id and
135       TCC.Business_group_id = p_business_group_id_to and
136       TCC.Type = 'E' and
137       TCC.FROM_TO = 'T' and
138       Trunc(sysdate) between tcc.start_date_active and nvl(tcc.end_date_active,sysdate)
139 ORDER BY thg.segment_num;
140 
141 
142 
143 CURSOR ORG
144 IS
145 SELECT
146   COST_ALLOCATION_KEYFLEX_ID
147 FROM HR_ALL_ORGANIZATION_UNITS
148 WHERE ORGANIZATION_ID = l_organization_id;
149 
150 CURSOR SOB(p_set_of_books_id in number)
151  IS
152 SELECT CHART_OF_ACCOUNTS_ID
153 FROM GL_SETS_OF_BOOKS
154 WHERE SET_OF_BOOKS_ID = p_set_of_books_id;
155 
156 CURSOR OFA IS
157 SELECT hr.COST_ALLOCATION_KEYFLEX_ID
158 FROM   HR_ALL_ORGANIZATION_UNITS hr ,
159        PER_ALL_ASSIGNMENTS_F asg
160 WHERE hr.organization_id = asg.organization_id and
161       asg.organization_id = p_organization_id and
162       asg.assignment_id = p_assignment_id and
163       trunc(sysdate) between asg.effective_start_date and
164                              asg.effective_end_date;
165 
166 CURSOR SPO IS
167 SELECT hr.COST_ALLOCATION_KEYFLEX_ID
168 FROM   HR_ALL_ORGANIZATION_UNITS hr ,
169        OTA_EVENTS EVT
170 WHERE  hr.organization_id = evt.organization_id and
171        evt.event_id = p_event_id;
172 
173 /* For Ilearning */
174 CURSOR csr_event
175 IS
176 SELECT offering_id
177 FROM ota_events
178 where event_id= p_event_id;
179 
180 Begin
181   p_result := 'S';
182   l_sequence := 1;
183   j := 1;
184 
185 
186 
187   /*-----------------------------------------------------------
188   | For Transfer from logic                                    |
189   |                                                           |
190   ------------------------------------------------------------*/
191   for from_rec  in thg_from(p_business_group_id_from)
192   LOOP
193      if l_sequence = 1 then
194 
195          OPEN sob(from_rec.gl_set_of_books_id);
196            FETCH sob into l_chart_of_accounts_id;
197 
198          CLOSE sob;
199            l_delimiter := FND_FLEX_EXT.GET_DELIMITER('SQLGL', 'GL#', l_chart_of_accounts_id);
200 
201            l_from_set_of_books_id := from_rec.gl_set_of_books_id;
202 
203      for  i in 1..30
204      loop
205 		 g_from_arr(i).colname := 'SEGMENT'||to_char(i);
206  	  	 g_from_arr(i).destcolname := 'FROM_SEGMENT'||to_char(i);
207 		 g_from_arr(i).colvalue := null;
208      end loop;
209 
210      end if;
211 
212      l_sequence := 2;
213 
214      l_segment := null;
215      l_cost_allocation_keyflex_id := null;
216      l_hr_cost_segment:=from_rec.hr_cost_segment;
217 
218      IF from_rec.hr_data_source = 'BGP' THEN
219         IF from_rec.HR_COST_SEGMENT is not null THEN
220            BEGIN
221 
222              SELECT COST_ALLOCATION_KEYFLEX_ID INTO l_cost_allocation_keyflex_id
223              FROM   HR_ALL_ORGANIZATION_UNITS WHERE organization_id = p_business_group_id_from;
224 
225 
226             l_dynamicSqlString := 'SELECT '|| l_hr_cost_segment ||' FROM PAY_COST_ALLOCATION_KEYFLEX
227                        WHERE COST_ALLOCATION_KEYFLEX_ID = :txn '  ;
228              BEGIN
229   	   		 execute immediate l_dynamicSqlString
230           		 into l_segment
231          		 using l_cost_allocation_keyflex_id;
232           		 EXCEPTION WHEN NO_DATA_FOUND Then
233                    null;
234        	 END;
235 
236              EXCEPTION WHEN NO_DATA_FOUND Then
237               null;
238            END;
239 
240          ELSE
241             IF from_rec.constant is not null then
242                l_segment := from_rec.constant;
243             else
244                p_result := 'E';
245                p_from_result  := 'B';
246             end if;
247          END IF;
248 
249          IF l_segment is null then
250             IF from_rec.constant is not null then
251                l_segment := from_rec.constant;
252             ELSE
253                p_from_result  := 'B';
254                p_result := 'E';
255             END IF;
256          END IF;
257 
258      ELSIF  from_rec.hr_data_source = 'ASG' THEN
259 
260       IF from_rec.HR_COST_SEGMENT is not null THEN
261          l_dynamicSqlString := 'SELECT '|| l_hr_cost_segment || ' FROM PAY_COST_ALLOCATION_KEYFLEX
262                        WHERE COST_ALLOCATION_KEYFLEX_ID = :txn '  ;
263          BEGIN
264   	     execute immediate l_dynamicSqlString
265            into l_segment
266            using p_cost_allocation_keyflex_id;
267            EXCEPTION WHEN NO_DATA_FOUND Then
268               null;
269          END;
270       ELSE
271         IF from_rec.constant is not null then
272             l_segment := from_rec.constant;
273         ELSE
274            p_from_result  := 'A';
275            p_result := 'E';
276         END IF;
277       END IF;
278        IF l_segment is null then
279             IF from_rec.constant is not null then
280                l_segment := from_rec.constant;
281             ELSE
282                p_from_result  := 'A';
283                p_result := 'E';
284             END IF;
285          END IF;
286      ELSIF from_rec.hr_data_source = 'OFA' THEN
287       IF from_rec.HR_COST_SEGMENT is not null THEN
288          BEGIN
289           OPEN OFA;
290           FETCH OFA INTO l_cost_allocation_keyflex_id ;
291           CLOSE OFA;
292        /*   SELECT hr.COST_ALLOCATION_KEYFLEX_ID INTO l_cost_allocation_keyflex_id
293           FROM   HR_ALL_ORGANIZATION_UNITS hr ,
294                  PER_ALL_ASSIGNMENTS_F asg
295           WHERE hr.organization_id = asg.organization_id and
296                 asg.organization_id = p_organization_id and
297                 asg.assignment_id = p_assignment_id ; */
298 
299  	    l_dynamicSqlString := 'SELECT '||l_hr_cost_segment || ' FROM PAY_COST_ALLOCATION_KEYFLEX
300                        WHERE COST_ALLOCATION_KEYFLEX_ID = :txn '  ;
301          BEGIN
302   	    execute immediate l_dynamicSqlString
303           into l_segment
304           using l_cost_allocation_keyflex_id;
305           EXCEPTION WHEN NO_DATA_FOUND Then
306              null;
307          END;
308           EXCEPTION WHEN NO_DATA_FOUND Then
309              null;
310         END;
311        ELSE
312         IF from_rec.constant is not null then
313             l_segment := from_rec.constant;
314         ELSE
315            p_from_result  := 'O';
316            p_result := 'E';
317         END IF;
318       END IF;
319        IF l_segment is null then
320             IF from_rec.constant is not null then
321                l_segment := from_rec.constant;
322             ELSE
323                p_from_result  := 'O';
324                p_result := 'E';
325             END IF;
326          END IF;
327 
328      ELSIF  from_rec.hr_data_source = 'SPO' THEN
329       IF from_rec.HR_COST_SEGMENT is not null THEN
330         BEGIN
331           OPEN SPO;
332           FETCH SPO INTO l_cost_allocation_keyflex_id ;
333           CLOSE SPO;
334 
335          /* SELECT hr.COST_ALLOCATION_KEYFLEX_ID INTO l_cost_allocation_keyflex_id
336           FROM   HR_ALL_ORGANIZATION_UNITS hr ,
337                  OTA_EVENTS EVT
338           WHERE hr.organization_id = evt.organization_id and
339                 evt.event_id = p_event_id; */
340           l_dynamicSqlString := 'SELECT '||l_hr_cost_segment || ' FROM PAY_COST_ALLOCATION_KEYFLEX
341                        WHERE COST_ALLOCATION_KEYFLEX_ID = :txn '  ;
342 
343  	    BEGIN
344   	       execute immediate l_dynamicSqlString
345              into l_segment
346              using l_cost_allocation_keyflex_id;
347              EXCEPTION WHEN NO_DATA_FOUND Then
348              null;
349           END;
350          EXCEPTION WHEN NO_DATA_FOUND Then
351              null;
352         END;
353        ELSE
354          IF from_rec.constant is not null then
355             l_segment := from_rec.constant;
356          ELSE
357            p_from_result  := 'S';
358            p_result := 'E';
359         END IF;
360       END IF;
361        IF l_segment is null then
362             IF from_rec.constant is not null then
363                l_segment := from_rec.constant;
364             ELSE
365                p_from_result  := 'S';
366                p_result := 'E';
367             END IF;
368          END IF;
369 
370      --  END;
371      ELSE
372        IF from_rec.constant is null then
373           p_from_result  := 'S';
374           p_result := 'E';
375        ELSE
376           l_segment := from_rec.constant;
377        END IF;
378      END IF;
379 
380      /*if l_segment is null then
381         l_segment := from_rec.constant;
382      end if;*/
383 
384      if l_paying_cost_center is null then
385         l_paying_cost_center := l_segment;
386      else
387         l_paying_cost_center := l_paying_cost_center ||l_delimiter||l_segment;
388      end if;
389 
390       j := to_number(substr(from_rec.SEGMENT,8,2));
391       if ( g_from_arr(j).colname = from_rec.SEGMENT  ) THEN
392     	    g_from_arr(j).colvalue := l_segment;
393 
394          -- j:= j +1 ;
395       end if;
396 
397 
398   /* IF p_result = 'E' then
399       RETURN;
400    END IF; */
401 
402   END LOOP;
403   if p_result = 'S' then
404      if l_paying_cost_center is not null then
405       l_length := length (l_paying_cost_center);
406       l_from_cc_id :=FND_FLEX_EXT.GET_CCID('SQLGL', 'GL#', l_chart_of_accounts_id, fnd_date.date_to_displaydate(sysdate),
407                              l_paying_cost_center);
408 
409       if l_from_cc_id =0 then
410          p_from_result  := 'C';
411          p_result := 'E';
412       end if;
413      else
414          p_from_result  := 'N';
415          p_result := 'E';
416     end if;
417   end if;
418 
419 
420 
421 if p_result = 'S' then
422 
423   l_sequence := 1;
424   k := 1;
425   /*-----------------------------------------------------------
426   | For Transfer to logic                                     |
427   |                                                           |
428   ------------------------------------------------------------*/
429   for to_rec  in thg_to(p_business_group_id_to)
430   LOOP
431      if l_sequence = 1 then
432 
433         OPEN sob(to_rec.gl_set_of_books_id);
434          FETCH sob into l_chart_of_accounts_id;
435         CLOSE sob;
436         l_delimiter := FND_FLEX_EXT.GET_DELIMITER('SQLGL', 'GL#', l_chart_of_accounts_id);
437 
438         l_to_set_of_books_id := to_rec.gl_set_of_books_id;
439      for  l in 1..30
440      loop
441 		 g_to_arr(l).colname := 'SEGMENT'||to_char(l);
445 
442  	  	 g_to_arr(l).destcolname := 'TO_SEGMENT'||to_char(l);
443 		 g_to_arr(l).colvalue := null;
444      end loop;
446 
447      end if;
448 
449      l_sequence := 2;
450 
451      l_segment := null;
452      l_cost_allocation_keyflex_id := null;
453      l_hr_cost_segment :=to_rec.hr_cost_segment;
454 
455      IF to_rec.hr_data_source = 'BGP' THEN
456         IF to_rec.HR_COST_SEGMENT is not null THEN
457            BEGIN
458              SELECT COST_ALLOCATION_KEYFLEX_ID INTO l_cost_allocation_keyflex_id
459              FROM   HR_ALL_ORGANIZATION_UNITS WHERE organization_id = p_business_group_id_to;
460 
461 
462             l_dynamicSqlString := 'SELECT '||l_hr_cost_segment || ' FROM PAY_COST_ALLOCATION_KEYFLEX
463                        WHERE COST_ALLOCATION_KEYFLEX_ID = :txn '  ;
464              BEGIN
465   	   		 execute immediate l_dynamicSqlString
466           		 into l_segment
467          		 using l_cost_allocation_keyflex_id;
468           		 EXCEPTION WHEN NO_DATA_FOUND Then
469                    null;
470          	 END;
471 
472              EXCEPTION WHEN NO_DATA_FOUND Then
473              null;
474            END;
475         ELSE
476             IF to_rec.constant is not null then
477                l_segment := to_rec.constant;
478             else
479                p_result := 'E';
480                p_to_result  := 'B';
481             end if;
482          END IF;
483 
484          IF l_segment is null then
485             IF to_rec.constant is not null then
486                l_segment := to_rec.constant;
487             ELSE
488                p_to_result  := 'B';
489                p_result := 'E';
490             END IF;
491          END IF;
492 
493      ELSIF  to_rec.hr_data_source = 'ASG' THEN
494       IF to_rec.HR_COST_SEGMENT is not null THEN
495          l_dynamicSqlString := 'SELECT '||l_hr_cost_segment || ' FROM PAY_COST_ALLOCATION_KEYFLEX
496                        WHERE COST_ALLOCATION_KEYFLEX_ID = :txn '  ;
497          BEGIN
498   	    execute immediate l_dynamicSqlString
499           into l_segment
500           using p_cost_allocation_keyflex_id;
501           EXCEPTION WHEN NO_DATA_FOUND Then
502              null;
503          END;
504 
505 
506       ELSE
507             IF to_rec.constant is not null then
508                l_segment := to_rec.constant;
509             else
510                p_result := 'E';
511                p_to_result  := 'A';
512             end if;
513       END IF;
514 
515          IF l_segment is null then
516             IF to_rec.constant is not null then
517                l_segment := to_rec.constant;
518             ELSE
519                p_to_result  := 'A';
520                p_result := 'E';
521             END IF;
522          END IF;
523 
524 
525      ELSIF to_rec.hr_data_source = 'OFA' THEN
526       IF to_rec.HR_COST_SEGMENT is not null THEN
527          BEGIN
528           OPEN OFA;
529           FETCH OFA INTO l_cost_allocation_keyflex_id ;
530           CLOSE OFA;
531          /* SELECT hr.COST_ALLOCATION_KEYFLEX_ID INTO l_cost_allocation_keyflex_id
532           FROM   HR_ALL_ORGANIZATION_UNITS hr ,
533                  PER_ALL_ASSIGNMENTS_F asg
534           WHERE hr.organization_id = asg.organization_id and
535                 asg.organization_id = p_organization_id and
536                 asg.assignment_id = p_assignment_id  ; */
537 
538  	    l_dynamicSqlString := 'SELECT '||l_hr_cost_segment || ' FROM PAY_COST_ALLOCATION_KEYFLEX
539                        WHERE COST_ALLOCATION_KEYFLEX_ID = :txn '  ;
540          BEGIN
541   	    execute immediate l_dynamicSqlString
542           into l_segment
543           using l_cost_allocation_keyflex_id;
544           EXCEPTION WHEN NO_DATA_FOUND Then
545              null;
546          END;
547 
548         END;
549        ELSE
550             IF to_rec.constant is not null then
551                l_segment := to_rec.constant;
552             else
553                p_result := 'E';
554                p_to_result  := 'O';
555             end if;
556       END IF;
557 
558          IF l_segment is null then
559             IF to_rec.constant is not null then
560                l_segment := to_rec.constant;
561             ELSE
562                p_to_result  := 'O';
563                p_result := 'E';
564             END IF;
565          END IF;
566      ELSIF  to_rec.hr_data_source = 'SPO' THEN
567        IF to_rec.HR_COST_SEGMENT is not null THEN
568         BEGIN
569            OPEN SPO;
570           FETCH SPO INTO l_cost_allocation_keyflex_id ;
571           CLOSE SPO;
572 
573         /*  SELECT hr.COST_ALLOCATION_KEYFLEX_ID INTO l_cost_allocation_keyflex_id
574           FROM   HR_ALL_ORGANIZATION_UNITS hr ,
575                  OTA_EVENTS EVT
576           WHERE hr.organization_id = evt.organization_id and
577                 evt.event_id = p_event_id; */
578         l_dynamicSqlString := 'SELECT '||l_hr_cost_segment || ' FROM PAY_COST_ALLOCATION_KEYFLEX
579                        WHERE COST_ALLOCATION_KEYFLEX_ID = :txn '  ;
580 
581  	    BEGIN
582   	       execute immediate l_dynamicSqlString
586              null;
583              into l_segment
584              using l_cost_allocation_keyflex_id;
585              EXCEPTION WHEN NO_DATA_FOUND Then
587           END;
588          EXCEPTION WHEN NO_DATA_FOUND Then
589              null;
590         END;
591        ELSE
592          IF to_rec.constant is not null then
593             l_segment := to_rec.constant;
594         ELSE
595            p_from_result  := 'S';
596            p_result := 'E';
597         END IF;
598       END IF;
599        IF l_segment is null then
600             IF to_rec.constant is not null then
601                l_segment := to_rec.constant;
602             ELSE
603                p_to_result  := 'S';
604                p_result := 'E';
605             END IF;
606          END IF;
607 
608      --  END;
609      ELSE
610 
611       IF to_rec.constant is null then
612           p_to_result  := 'S';
613           p_result := 'E';
614        ELSE
615           l_segment := to_rec.constant;
616        END IF;
617 
618 
619      END IF;
620 
621     /* if l_segment is null then
622         l_segment := to_rec.constant;
623      end if; */
624 
625      if l_receiving_cost_center is null then
626         l_receiving_cost_center := l_segment;
627      else
628         l_receiving_cost_center := l_receiving_cost_center ||l_delimiter||l_segment;
629      end if;
630 
631      k := to_number(substr(to_rec.SEGMENT,8,2));
632 
633      if ( to_rec.SEGMENT = g_to_arr(k).colname) THEN
634         g_to_arr(k).colvalue := l_segment;
635         --k:= k +1 ;
636      end if;
637 
638  --  IF p_result = 'E' then
639  --     RETURN;
640   -- END IF;
641 
642   END LOOP;
643    if p_result = 'S' then
644        if l_receiving_cost_center is not null then
645          l_length := length (l_receiving_cost_center);
646           l_to_cc_id :=FND_FLEX_EXT.GET_CCID('SQLGL', 'GL#', l_chart_of_accounts_id, fnd_date.date_to_displaydate(sysdate),
647                              l_receiving_cost_center);
648 
649          if l_to_cc_id = 0 then
650             p_result := 'E';
651             p_to_result  := 'C';
652          end if;
653     else
654          p_to_result  := 'N';
655          p_result := 'E';
656     end if;
657   end if;
658 end if;
659 
660 IF p_result = 'S' THEN
661    /* For Ilearning */
662    OPEN csr_event;
663    FETCH csr_event into l_offering_id;
664    CLOSE csr_event;
665 
666    l_administrator  :=p_user_id;
667    if l_auto_transfer = 'Y' then
668       if l_offering_id is null then
669          l_authorizer_person_id := p_user_id;
670          l_transfer_status := 'AT';
671       else
672          l_authorizer_person_id := null;
673          l_transfer_status := 'NT';
674       end if;
675    else
676       l_authorizer_person_id := null;
677       l_transfer_status := 'NT';
678    end if;
679 
680       ota_tfh_api_ins.ins
681        (
682         p_finance_header_id         =>  p_finance_header_id
683        ,p_object_version_number     =>  p_object_version_number
684        ,p_organization_id           =>  p_organization_id
685        ,p_administrator             =>  l_administrator
686        ,p_cancelled_flag            =>  'N'
687        ,p_currency_code             =>  p_currency_code
688        ,p_date_raised               =>  sysdate
689        ,p_payment_status_flag       =>  'N'
690        ,p_transfer_status           =>  l_transfer_status
691        ,P_type                      =>  'CT'
692        ,p_authorizer_person_id      =>  l_authorizer_person_id
693        ,p_receivable_type	      =>  l_receivable_type
694        ,P_paying_cost_center        =>  l_paying_cost_center
695        ,P_receiving_cost_center     =>  l_receiving_cost_center
696        ,p_transfer_from_set_of_book_id => l_from_set_of_books_id
697        ,p_transfer_to_set_of_book_id => l_to_set_of_books_id
698        ,p_from_segment1             =>  g_from_arr(1).colvalue
699        ,p_from_segment2             =>  g_from_arr(2).colvalue
700        ,p_from_segment3             =>  g_from_arr(3).colvalue
701        ,p_from_segment4             =>  g_from_arr(4).colvalue
702        ,p_from_segment5             =>  g_from_arr(5).colvalue
703        ,p_from_segment6             =>  g_from_arr(6).colvalue
704        ,p_from_segment7             =>  g_from_arr(7).colvalue
705        ,p_from_segment8             =>  g_from_arr(8).colvalue
706        ,p_from_segment9             =>  g_from_arr(9).colvalue
707        ,p_from_segment10            =>  g_from_arr(10).colvalue
708        ,p_from_segment11            =>  g_from_arr(11).colvalue
709        ,p_from_segment12            =>  g_from_arr(12).colvalue
710        ,p_from_segment13            =>  g_from_arr(13).colvalue
711        ,p_from_segment14            =>  g_from_arr(14).colvalue
712        ,p_from_segment15            =>  g_from_arr(15).colvalue
713        ,p_from_segment16            =>  g_from_arr(16).colvalue
714        ,p_from_segment17            =>  g_from_arr(17).colvalue
715        ,p_from_segment18            =>  g_from_arr(18).colvalue
716        ,p_from_segment19            =>  g_from_arr(19).colvalue
717        ,p_from_segment20            =>  g_from_arr(20).colvalue
718        ,p_from_segment21            =>  g_from_arr(21).colvalue
719        ,p_from_segment22            =>  g_from_arr(22).colvalue
720        ,p_from_segment23            =>  g_from_arr(23).colvalue
721        ,p_from_segment24            =>  g_from_arr(24).colvalue
722        ,p_from_segment25            =>  g_from_arr(25).colvalue
723        ,p_from_segment26            =>  g_from_arr(26).colvalue
724        ,p_from_segment27            =>  g_from_arr(27).colvalue
725        ,p_from_segment28            =>  g_from_arr(28).colvalue
726        ,p_from_segment29            =>  g_from_arr(29).colvalue
727        ,p_from_segment30            =>  g_from_arr(30).colvalue
728        ,p_to_segment1               =>  g_to_arr(1).colvalue
729        ,p_to_segment2               =>  g_to_arr(2).colvalue
730        ,p_to_segment3               =>  g_to_arr(3).colvalue
731        ,p_to_segment4               =>  g_to_arr(4).colvalue
732        ,p_to_segment5               =>  g_to_arr(5).colvalue
733        ,p_to_segment6               =>  g_to_arr(6).colvalue
734        ,p_to_segment7               =>  g_to_arr(7).colvalue
735        ,p_to_segment8               =>  g_to_arr(8).colvalue
736        ,p_to_segment9               =>  g_to_arr(9).colvalue
737        ,p_to_segment10              =>  g_to_arr(10).colvalue
738        ,p_to_segment11              =>  g_to_arr(11).colvalue
739        ,p_to_segment12              =>  g_to_arr(12).colvalue
740        ,p_to_segment13              =>  g_to_arr(13).colvalue
741        ,p_to_segment14              =>  g_to_arr(14).colvalue
742        ,p_to_segment15              =>  g_to_arr(15).colvalue
743        ,p_to_segment16              =>  g_to_arr(16).colvalue
744        ,p_to_segment17              =>  g_to_arr(17).colvalue
745        ,p_to_segment18              =>  g_to_arr(18).colvalue
746        ,p_to_segment19              =>  g_to_arr(19).colvalue
747        ,p_to_segment20              =>  g_to_arr(20).colvalue
748        ,p_to_segment21              =>  g_to_arr(21).colvalue
749        ,p_to_segment22              =>  g_to_arr(22).colvalue
750        ,p_to_segment23              =>  g_to_arr(23).colvalue
751        ,p_to_segment24              =>  g_to_arr(24).colvalue
752        ,p_to_segment25              =>  g_to_arr(25).colvalue
753        ,p_to_segment26              =>  g_to_arr(26).colvalue
754        ,p_to_segment27              =>  g_to_arr(27).colvalue
755        ,p_to_segment28              =>  g_to_arr(28).colvalue
756        ,p_to_segment29              =>  g_to_arr(29).colvalue
757        ,p_to_segment30              =>  g_to_arr(30).colvalue
758        ,p_transfer_from_cc_id       =>  l_from_cc_id
759        ,p_transfer_to_cc_id         =>  l_to_cc_id
760        ,P_validate                  =>  false
761        ,P_transaction_type          =>  'INSERT');
762 END IF;
763 
764 end create_segment;
765 --
766 end ota_crt_finance_segment;