[Home] [Help]
PACKAGE BODY: APPS.GCS_ENG_CP_UTILITY_PKG
Source
1 PACKAGE BODY GCS_ENG_CP_UTILITY_PKG as
2 /* $Header: gcs_cpeng_utb.pls 120.5 2006/11/07 23:32:43 sangarg noship $ */
3
4 g_api VARCHAR2(80) := 'gcs.plsql.CP_ENG_CP_UTILITY_PKG';
5
6 PROCEDURE generate_xml_and_ntfs(
7 x_errbuf OUT NOCOPY VARCHAR2,
8 x_retcode OUT NOCOPY VARCHAR2,
9 p_execution_type IN VARCHAR2,
10 p_run_name IN VARCHAR2,
11 p_cons_entity_id IN NUMBER,
12 p_category_code IN VARCHAR2,
13 p_child_entity_id IN NUMBER,
14 p_run_detail_id IN NUMBER,
15 p_entry_id IN NUMBER,
16 p_load_id IN NUMBER)
17 IS
18
19 l_ret_status_code BOOLEAN;
20 l_request_id NUMBER(15);
21
22 --Bugfix 5288100: Do not launch the xml generator if Aggregation is NOT_APPLICABLE
23 l_request_error_code VARCHAR2(400);
24
25 BEGIN
26
27 IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_PROCEDURE) THEN
28 FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, g_api || '.GENERATE_XML_AND_NTFS.begin', '<<Enter>>');
29 END IF;
30
31 fnd_file.put_line(fnd_file.log, '<<Parameter Listings>>');
32 fnd_file.put_line(fnd_file.log, 'Execution Type : ' || p_execution_type);
33 fnd_file.put_line(fnd_file.log, 'Run Name : ' || p_run_name);
34 fnd_file.put_line(fnd_file.log, 'Consolidation Entity : ' || p_cons_entity_id);
35 fnd_file.put_line(fnd_file.log, 'Category Code : ' || p_category_code);
36 fnd_file.put_line(fnd_file.log, 'Child Entity : ' || p_child_entity_id);
37 fnd_file.put_line(fnd_file.log, 'Run Detail : ' || p_run_detail_id);
38 fnd_file.put_line(fnd_file.log, 'Entry Identifier : ' || p_entry_id);
39 fnd_file.put_line(fnd_file.log, 'Load Identifier : ' || p_load_id);
40 fnd_file.put_line(fnd_file.log, '<<End of Parameter Listing>>');
41
42 IF (p_execution_type = 'CONS_PROCESS') THEN
43 fnd_file.put_line(fnd_file.log, '<<Obsoleted XML Generation Message>>');
44 --Bugfix 4874306: Eliminate calls to XML Generation in order to leverage data templates
45 --gcs_xml_gen_pkg.submit_entry_xml_gen(
46 -- x_errbuf => x_errbuf,
47 -- x_retcode => x_retcode,
48 -- p_run_name => p_run_name,
49 -- p_cons_entity_id => p_cons_entity_id,
50 -- p_category_code => p_category_code,
51 -- p_child_entity_id => p_child_entity_id,
52 -- p_run_detail_id => p_run_detail_id);
53 ELSIF (p_execution_type = 'IMPACT_ENGINE') THEN
54 fnd_file.put_line(fnd_file.log, '<<Setting Impact Analysis Messages>>');
55 IF (p_load_id <> 0) THEN
56 --In this case the control is coming from Data Submission,
57 --we need to send the notification without attachment. Making call to the notification workflow
58 gcs_wf_ntf_pkg.raise_impact_notification(
59 p_run_name => p_run_name,
60 p_cons_entity_id => p_cons_entity_id,
61 p_entry_id => NVL(p_entry_id,0),
62 p_load_id => NVL(p_load_id,0));
63 ELSE
64 --Start of Bugfix 5524909
65 --In this case the control comes from Manual Adj.
66 --So we need to send notification with attachment. Making a call to GCS_PDF_GEN concurrent program
67 --to generate PDF and sent the notification there after
68 l_request_id := fnd_request.submit_request(
69 application => 'GCS',
70 program => 'FCH_PDF_GEN',
71 sub_request => FALSE,
72 argument1 => p_entry_id,
73 argument2 => p_run_name,
74 argument3 => p_cons_entity_id );
75 fnd_file.put_line(fnd_file.log, 'Submitted PDF Generation Request: '|| l_request_id);
76 END IF;
77 --End of Bugfix 5524909
78 fnd_file.put_line(fnd_file.log, '<<End of Impact Analysis Messages>>');
79 ELSIF (p_execution_type = 'NTF_ONLY' AND p_category_code = 'AGGREGATION') THEN
80 fnd_file.put_line(fnd_file.log, '<<Sending Notification>>');
81 gcs_wf_ntf_pkg.raise_status_notification(
82 p_cons_detail_id => p_run_detail_id);
83 fnd_file.put_line(fnd_file.log, '<<Ending Notification>>');
84 fnd_file.put_line(fnd_file.log, '<<Generating Consolidation Trial Balance XML>>');
85
86 --Bugfix 5288100: If request error code is NOT_APPLICABLE then do not launched XML Writer Program
87 SELECT request_error_code
88 INTO l_request_error_code
89 FROM gcs_cons_eng_run_dtls
90 WHERE run_detail_id = p_run_detail_id;
91
92 IF (l_request_error_code <> 'NOT_APPLICABLE') THEN
93 l_request_id := fnd_request.submit_request(
94 application => 'GCS',
95 program => 'FCH_XML_WRITER',
96 sub_request => FALSE,
97 argument1 => 'CONSOLIDATION',
98 argument2 => p_run_name,
99 argument3 => p_cons_entity_id,
100 argument4 => NULL );
101 commit;
102 END IF;
103 fnd_file.put_line(fnd_file.log, 'Submitted XML Generation Request: '||l_request_id);
104 fnd_file.put_line(fnd_file.log, '<<Ending Generation of Consolidation Trial Balance XML>>');
105 ELSIF (p_execution_type = 'NTF_ONLY') THEN
106 fnd_file.put_line(fnd_file.log, '<<Sending Notification>>');
107 gcs_wf_ntf_pkg.raise_status_notification(
108 p_cons_detail_id => p_run_detail_id);
109 fnd_file.put_line(fnd_file.log, '<<Ending Notification>>');
110 END IF;
111
112
113 IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_PROCEDURE) THEN
114 FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, g_api || '.GENERATE_XML_AND_NTFS.end', '<<Exit>>');
115 END IF;
116 EXCEPTION
117 WHEN OTHERS THEN
118 fnd_file.put_line(fnd_file.log, 'Fatal Error Occurred : ' || SQLERRM);
119 l_ret_status_code := fnd_concurrent.set_completion_status(
120 status => 'ERROR',
121 message => NULL);
122 END generate_xml_and_ntfs;
123
124 PROCEDURE submit_xml_ntf_program(
125 p_execution_type IN VARCHAR2,
126 p_run_name IN VARCHAR2,
127 p_cons_entity_id IN NUMBER,
128 p_category_code IN VARCHAR2,
129 p_child_entity_id IN NUMBER DEFAULT NULL,
130 p_run_detail_id IN NUMBER DEFAULT NULL,
131 p_entry_id IN NUMBER DEFAULT NULL,
132 p_load_id IN NUMBER DEFAULT NULL)
133 IS
134
135 l_request_id NUMBER(15);
136
137 BEGIN
138 IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_PROCEDURE) THEN
139 FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, g_api || '.SUBMIT_XML_NTF_PROGRAM.begin', '<<Enter>>');
140 END IF;
141
142 IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_STATEMENT) THEN
143 FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, g_api || '.SUBMIT_XML_NTF_PROGRAM', 'Execution Type : ' || p_execution_type);
144 FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, g_api || '.SUBMIT_XML_NTF_PROGRAM', 'Run Name : ' || p_run_name);
145 FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, g_api || '.SUBMIT_XML_NTF_PROGRAM', 'Consoliation Entity : ' || p_cons_entity_id);
146 FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, g_api || '.SUBMIT_XML_NTF_PROGRAM', 'Category : ' || p_category_code);
147 FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, g_api || '.SUBMIT_XML_NTF_PROGRAM', 'Child Entity : ' || p_child_entity_id);
148 FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, g_api || '.SUBMIT_XML_NTF_PROGRAM', 'Run Detail ID : ' || p_run_detail_id);
149 FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, g_api || '.SUBMIT_XML_NTF_PROGRAM', 'Entry ID : ' || p_entry_id);
150 FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, g_api || '.SUBMIT_XML_NTF_PROGRAM', 'Load ID : ' || p_load_id);
151 END IF;
152
153 l_request_id := fnd_request.submit_request(
154 application => 'GCS',
155 program => 'FCH_XML_NTF_UTILITY',
156 sub_request => FALSE,
157 argument1 => p_execution_type,
158 argument2 => p_run_name,
159 argument3 => p_cons_entity_id,
160 argument4 => p_category_code,
161 argument5 => p_child_entity_id,
162 argument6 => p_run_detail_id,
163 argument7 => p_entry_id,
164 argument8 => p_load_id);
165
166 IF (FND_LOG.G_CURRENT_RUNTIME_LEVEL <= FND_LOG.LEVEL_PROCEDURE) THEN
167 FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, g_api || '.SUBMIT_XML_NTF_PROGRAM.end', '<<Exit>>');
168 END IF;
169 END submit_xml_ntf_program;
170
171 END GCS_ENG_CP_UTILITY_PKG;