[Home] [Help]
PACKAGE BODY: APPS.JA_CN_GL_EXPORT_PKG
Source
1 PACKAGE BODY JA_CN_GL_EXPORT_PKG AS
2 --$Header: JACNGLEB.pls 120.2 2010/04/06 13:03:03 wuwu noship $
3 --+=======================================================================+
4 --| Copyright (c) 1998 Oracle Corporation |
5 --| Redwood Shores, CA, USA |
6 --| All rights reserved. |
7 --+=======================================================================+
8 --| FILENAME |
9 --| JACNGLEB.pls |
10 --| |
11 --| DESCRIPTION |
12 --| Use this package to export non-FSG report for general ledger |
13 --| |
14 --| PROCEDURE LIST |
15 --| PROCEDURE Export_GL |
16 --| |
17 --| |
18 --| HISTORY |
19 --| 01-Mar-2010 Chaoqun Wu Created |
20 --+======================================================================*/
21
22 GV_MODULE_PREFIX VARCHAR2(100) := 'JA_CN_GL_EXPORT_PKG';
23
24 --==========================================================================
25 -- PROCEDURE NAME:
26 --
27 -- Export_GL Public
28 --
29 -- DESCRIPTION:
30 --
31 -- This procedure is to export non-FSG report for general ledger
32 --
33 -- PARAMETERS:
34 -- Out: pv_errbuf NOCOPY VARCHAR2
35 -- pv_retcode NOCOPY VARCHAR2
36 -- In: pn_legal_entity_id NUMBER identifier of legal entity
37 -- pn_chart_of_account_id NUMBER identifier of chart of account
38 -- pn_ledger_id NUMBER identifier of ledger
39 -- pv_adhoc_prefix VARCHAR2 adhoc prefix
40 -- pv_industry VARCHAR2 industry
41 -- pv_accounting_year VARCHAR2 accounting year
42 -- pv_period_from VARCHAR2 period from
43 -- pv_period_to VARCHAR2 period to
44 -- pn_cfs_report_id NUMBER identifier of cfs report
45 -- pv_xml_template_language VARCHAR2 xml template language
46 -- pv_xml_template_territory VARCHAR2 xml template territory
47 -- pv_xml_output_format VARCHAR2 xml output format
48 --
49 -- DESIGN REFERENCES:
50 -- GL_Chaoqun.doc
51 --
52 -- CHANGE HISTORY:
53 -- 01-Mar-2010 Chaoqun Wu created
54 --==========================================================================
55
56 PROCEDURE Export_GL
57 (pv_errbuf OUT NOCOPY VARCHAR2
58 ,pv_retcode OUT NOCOPY VARCHAR2
59 ,pn_legal_entity_id IN NUMBER
60 ,pn_chart_of_account_id IN NUMBER
61 ,pn_ledger_id IN NUMBER
62 ,pv_adhoc_prefix IN VARCHAR2
63 ,pv_industry IN VARCHAR2
64 ,pv_accounting_year IN VARCHAR2
65 ,pv_period_from IN VARCHAR2
66 ,pv_period_to IN VARCHAR2
67 ,pn_cfs_report_id IN NUMBER
68 ,pv_xml_template_language IN VARCHAR2
69 ,pv_xml_template_territory IN VARCHAR2
70 ,pv_xml_output_format IN VARCHAR2
71 )
72 IS
73 lv_gl_element VARCHAR2(1000);
74 ln_legal_entity_id NUMBER(15);
75 lv_xml_directory VARCHAR2(500);
76 ln_request_id NUMBER(15);
77 lv_procedure_name VARCHAR2(40) := 'Export_GL';
78 ln_dbg_level NUMBER := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
79 ln_proc_level NUMBER := FND_LOG.LEVEL_PROCEDURE;
80 ln_ledger_le_rls NUMBER := NULL;
81 lv_false_flag VARCHAR(1) := 'Y';
82 lv_error_msg VARCHAR2(2000) := NULL;
83 lv_error_status BOOLEAN;
84 NO_DATA EXCEPTION;
85
86 BEGIN
87 --logging for debug
88 IF (ln_proc_level >= ln_dbg_level)
89 THEN
90 FND_LOG.STRING(ln_proc_level,
91 GV_MODULE_PREFIX || '.' || lv_procedure_name ||
92 '.begin',
93 'Enter procedure');
94 -- logging the parameters
95 FND_LOG.STRING(ln_proc_level,
96 lv_procedure_name ||
97 '.parameters',
98 'pn_legal_entity_id=' || pn_legal_entity_id || ',' ||
99 'pn_chart_of_account_id=' || pn_chart_of_account_id || ',' ||
100 'pn_ledger_id=' || pn_ledger_id || ',' ||
101 'pv_adhoc_prefix=' || pv_adhoc_prefix || ',' ||
102 'pv_industry=' || pv_industry || ',' ||
103 'pv_accounting_year=' || pv_accounting_year || ',' ||
104 'pv_period_from=' || pv_period_from || ',' ||
105 'pv_period_to=' || pv_period_to || ',' ||
106 'pn_cfs_report_id=' || pn_cfs_report_id || ',' ||
107 'pv_xml_template_language=' || pv_xml_template_language || ',' ||
108 'pv_xml_template_territory=' || pv_xml_template_territory || ',' ||
109 'pv_xml_output_format=' || pv_xml_output_format);
110 END IF; --l_proc_level>=l_dbg_level
111 FND_FILE.put_line(FND_FILE.log, lv_procedure_name ||
112 '.parameters:'||
113 'pn_legal_entity_id=' || pn_legal_entity_id || ',' ||
114 'pn_chart_of_account_id=' || pn_chart_of_account_id || ',' ||
115 'pn_ledger_id=' || pn_ledger_id || ',' ||
116 'pv_adhoc_prefix=' || pv_adhoc_prefix || ',' ||
117 'pv_industry=' || pv_industry || ',' ||
118 'pv_accounting_year=' || pv_accounting_year || ',' ||
119 'pv_period_from=' || pv_period_from || ',' ||
120 'pv_period_to=' || pv_period_to || ',' ||
121 'pn_cfs_report_id=' || pn_cfs_report_id || ',' ||
122 'pv_xml_template_language=' || pv_xml_template_language || ',' ||
123 'pv_xml_template_territory=' || pv_xml_template_territory || ',' ||
124 'pv_xml_output_format=' || pv_xml_output_format);
125
126 --Step1: Generate XML header part
127 FND_FILE.put_line(FND_FILE.output,'<?xml version="1.0" encoding="'||JA_CN_UTILITY.Get_XML_Encoding||'"?>');
128 lv_gl_element := '<' || Ja_Cn_Utility.Get_XML_Tag('GENERAL_LEDGER') || ' xsi:schemaLocation="http://sxbw.audit.gov.cn/AccountingSoftwareDataInterfaceStandard/2010/SOE/XMLSchema ' ||
129 Ja_Cn_Utility.Get_XML_Tag('GENERAL_LEDGER') || '.xsd" xmlns:' ||
130 Ja_Cn_Utility.Get_XML_Tag('SOE') || '="http://sxbw.audit.gov.cn/AccountingSoftwareDataInterfaceStandard/2010/SOE/XMLSchema"'||
131 ' xmlns="http://sxbw.audit.gov.cn/AccountingSoftwareDataInterfaceStandard/2010/SOE/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">';
132
133 FND_FILE.put_line(FND_FILE.output, lv_gl_element);
134
135 --Step2: Export GL Basic Information
136 Ja_Cn_Utility.Print_Concurrent_Steps_For_Log('2.1', 'GL_BASIC_INFORMATION');
137 JA_CN_GBI_EXPORT_PKG.Add_GL_Basic_Info(pn_coa_id => pn_chart_of_account_id
138 ,pn_cfs_report_id => pn_cfs_report_id
139 );
140
141 --Step3: Export COA
142 Ja_Cn_Utility.Print_Concurrent_Steps_For_Log('2.2', 'CHART_OF_ACCOUNT');
143 JA_CN_COA_EXPORT_PKG.Add_COA(pn_coa_id => pn_chart_of_account_id
144 ,pn_ledger_id => pn_ledger_id
145 ,pn_le_id => pn_legal_entity_id
146 ,pv_xml_template_language => pv_xml_template_language
147 ,pv_xml_template_territory => pv_xml_template_territory
148 ,pv_xml_output_format => pv_xml_output_format
149 );
150
151 --Step4: Export Subsidiary Item of Account
152 Ja_Cn_Utility.Print_Concurrent_Steps_For_Log('2.3', 'SUBSIDIARY_ITEM_OF_ACCOUNT');
153 JA_CN_SIOA_EXPORT_PKG.Add_Sub_Item_Of_Account(pn_ledger_id => pn_ledger_id
154 ,pn_legal_entity_id => pn_legal_entity_id
155 ,pn_chart_of_account_id => pn_chart_of_account_id
156 ,pv_accounting_year => pv_accounting_year
157 );
158 --Step5: Export Cash Flow Items
159 Ja_Cn_Utility.Print_Concurrent_Steps_For_Log('2.4', 'CASH_FLOW_ITEMS');
160 JA_CN_CFI_EXPORT_PKG.Add_Cash_Flow_Items(pn_cfs_report_id => pn_cfs_report_id
161 ,pn_chart_of_account_id => pn_chart_of_account_id
162 );
163
164 --Step6: Export Accounting Period Amount and Balance
165 Ja_Cn_Utility.Print_Concurrent_Steps_For_Log('2.5', 'ACC_PERIOD_AMOUNT_AND_BALANCE');
166 JA_CN_APAB_EXPORT_PKG.Add_Account_Amount_Balance(pn_legal_entity_id => pn_legal_entity_id
167 ,pn_ledger_id => pn_ledger_id
168 ,pv_accounting_year => pv_accounting_year
169 ,pn_coa_id => pn_chart_of_account_id
170 ,pv_period_from => pv_period_from
171 ,pv_period_to => pv_period_to
172 );
173 --Step7: Export Journal
174 Ja_Cn_Utility.Print_Concurrent_Steps_For_Log('2.6', 'JOURNAL');
175 JA_CN_JE_EXPORT_PKG.Add_Journal(pn_legal_entity_id => pn_legal_entity_id
176 ,pn_ledger_id => pn_ledger_id
177 ,pv_accounting_year => pv_accounting_year
178 ,pn_coa_id => pn_chart_of_account_id
179 ,pv_period_from => pv_period_from
180 ,pv_period_to => pv_period_to
181 );
182
183 --Step8: Export Journal Related Cash Flow Items
184 Ja_Cn_Utility.Print_Concurrent_Steps_For_Log('2.7', 'CASH_FLOW_JOURNAL_ITEM_DATA');
185 JA_CN_JRCFI_EXPORT_PKG.Add_Journal_Cash_Flow_Items(pn_legal_entity_id => pn_legal_entity_id
186 ,pn_ledger_id => pn_ledger_id
187 ,pv_accounting_year => pv_accounting_year
188 ,pn_coa_id => pn_chart_of_account_id
189 ,pv_period_from => pv_period_from
190 ,pv_period_to => pv_period_to
191 ,pn_cfs_report_id => pn_cfs_report_id
192 );
193
194 FND_FILE.put_line(FND_FILE.output
195 ,Ja_Cn_Utility.Get_XML_Tag('GENERAL_LEDGER'
196 ,Ja_Cn_Utility.GV_TAG_TYPE_END
197 )
198 );
199
200 --logging for debug
201 IF (ln_proc_level >= ln_dbg_level)
202 THEN
203 FND_LOG.STRING(ln_proc_level,
204 GV_MODULE_PREFIX || '.' || lv_procedure_name || '.end',
205 'Exit procedure');
206 END IF; -- (ln_proc_level>=ln_dbg_level)
207
208 EXCEPTION
209 WHEN OTHERS THEN
210 IF (FND_LOG.LEVEL_UNEXPECTED >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)
211 THEN
212 FND_LOG.STRING(FND_LOG.LEVEL_UNEXPECTED,
213 GV_MODULE_PREFIX || '.' || lv_procedure_name ||
214 '.Other_Exception ',
215 SQLCODE || SQLERRM);
216 END IF; -- (FND_LOG.LEVEL_UNEXPECTED >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)
217 pv_retcode := '2';
218 pv_errbuf := SQLCODE || SQLERRM;
219 FND_FILE.put_line(FND_FILE.log, lv_procedure_name || SQLCODE || SQLERRM);
220
221 END Export_GL;
222
223 END JA_CN_GL_EXPORT_PKG;