DBA Data[Home] [Help]

PACKAGE BODY: APPS.FV_CST_GL

Source


1 Package BODY FV_CST_GL as
2     -- $Header: FVCSTGLB.pls 115.5 2003/12/17 21:19:58 ksriniva noship $
3 -- ==============================================================
4   g_module_name VARCHAR2(100) := 'fv.plsql.FV_CST_GL.';
5 procedure CORRECT_GL_INTERFACE_ENTRIES (
6 		p_group_id        in  number,
7 		p_Receipt_id    	in  number,
8 		p_Deliver_id    	in  number)
9 --          Purpose of procedure
10 --
11 --          Given group id, rcv transaction id 1, rcv transaction id 2
12 --          select rows from gl interface with that batch id and a reference25
13 --          of transaction id 1 or 2 (receive or deliver) and an actual_flag
14 --          of 'A' (don't want to process encumbrance entries) delete two rows
15 --          with the same value in code_combination_id, one DR and one CR.
16 --          If more or less than  4 rows found, throw an exception
17 IS
18   l_module_name VARCHAR2(200) := g_module_name || 'CORRECT_GL_INTERFACE_ENTRIES';
19   l_errbuf      VARCHAR2(1024);
20   temp_count number;
21   profile_value varchar2(1);
22 BEGIN
23 
24 fnd_profile.get('FV_POST_DETAIL_REC_ACCOUNTING',profile_value);
25 
26 if profile_value = 'N' then
27 
28     select count('should be exactly four rows')
29     into temp_count
30     from gl_interface
31     where reference25 IN (to_char(p_Receipt_id),to_char(p_Deliver_id))
32     and group_id = p_group_id
33     and actual_flag = 'A';
34 
35     if (temp_count) = 4 then
36         delete
37         from gl_interface
38         where group_id = p_group_id
39         and reference25 IN (to_char(p_Receipt_id),to_char(p_Deliver_id))
40         and actual_flag = 'A'
41         and code_combination_id = (
42             select code_combination_id
43             from gl_interface
44             where reference25 IN (to_char(p_Receipt_id),to_char(p_Deliver_id))
45             and group_id = p_group_id
46             and actual_flag = 'A'
47             group by code_combination_id
48             having count(code_combination_id) = 2);
49     else
50         -- we have a problem....
51      null;
52     end if;
53 
54 else
55 -- all lines to be posted to GL don't remove any
56    null;
57 end if;
58 
59 EXCEPTION
60   WHEN OTHERS THEN
61     l_errbuf := SQLERRM;
62     FV_UTILITY.LOG_MESG(FND_LOG.LEVEL_UNEXPECTED, l_module_name||'.final_exception1',l_errbuf);
63     RAISE;
64 END;
65 
66 End  FV_CST_GL;