[Home] [Help]
PACKAGE BODY: APPS.IGW_EDI_PROCESSING
Source
1 PACKAGE BODY IGW_EDI_PROCESSING as
2 /* $Header: igwecpob.pls 115.8 2002/11/14 18:44:33 vmedikon ship $ */
3
4
5
6 PROCEDURE Submit ( errbuf IN OUT NOCOPY varchar2
7 ,retcode IN OUT NOCOPY varchar2
8 ,p_proposal_id IN NUMBER
9 ,p_output_path IN VARCHAR2
10 ,p_narrative_type_code IN VARCHAR2
11 ,p_narrative_submission_code IN VARCHAR2
12 ,p_debug_mode IN NUMBER) IS
13
14 CURSOR doc_num IS
15 SELECT ece_output_runs_s.nextval
16 FROM dual;
17
18 cursor c_justification is
19 select substr(abstract,1,200)
20 from igw_prop_abstracts
21 where proposal_id = p_proposal_id
22 and abstract_type_code = 'C.1'
23 and abstract_type = 'IGW_ABSTRACT_TYPES';
24
25 l_doc_num NUMBER;
26 l_abstract VARCHAR2(200);
27 l_call_status BOOLEAN;
28 l_proposal_form_number VARCHAR2(30);
29 l_request_id BINARY_INTEGER;
30 l_msg_count NUMBER;
31 l_msg_data VARCHAR2(2000);
32 l_return_status VARCHAR2(1);
33 l_tmp_out NUMBER;
34 l_procedure_name varchar2(200);
35
36
37
38 BEGIN
39 -- update the narrative_type_code and narrative_submission_code
40 -- in igw_proposals_all
41
42 update igw_proposals_all
43 set narrative_type_code = p_narrative_type_code,
44 narrative_submission_code = p_narrative_submission_code
45 where proposal_id = p_proposal_id;
46
47
48 begin
49 select proposal_form_number
50 into l_proposal_form_number
51 from igw_budgets
52 where proposal_id = p_proposal_id
53 and final_version_flag = 'Y';
54 exception
55 when no_data_found then null;
56
57 when others then
58 raise FND_API.G_EXC_ERROR;
59 end;
60
61 open c_justification;
62 fetch c_justification into l_abstract;
63 close c_justification;
64
65 --dbms_output.put_line('l_proposal_form_number'||l_proposal_form_number);
66 if l_proposal_form_number is not null then
67 igw_report_processing.create_reporting_data(p_proposal_id, l_proposal_form_number, l_return_status,
68 l_msg_data, l_msg_count);
69
70 --dbms_output.put_line('l_return_status first'||l_return_status);
71 --dbms_output.put_line('l_msg_data first'||l_msg_data);
72 if l_return_status <> 'S' then
73 l_procedure_name := 'IGW_REPORT_PROCESSING.CREATE_REPORTING_DATA';
74 raise FND_API.G_EXC_ERROR;
75 end if;
76
77 igw_report_processing.create_base_rate(p_proposal_id, l_proposal_form_number, l_return_status,
78 l_msg_data, l_msg_count);
79 if l_return_status <> 'S' then
80 l_procedure_name := 'IGW_REPORT_PROCESSING.CREATE_BASE_RATE';
81 raise FND_API.G_EXC_ERROR;
82 end if;
83
84 igw_report_processing.create_budget_justification(p_proposal_id
85 ,l_proposal_form_number, l_return_status, l_msg_data);
86 if l_return_status <> 'S' then
87 l_procedure_name := 'IGW_REPORT_PROCESSING.CREATE_BUDGET_JUSTIFICATION';
88 raise FND_API.G_EXC_ERROR;
89 end if;
90
91 if l_abstract is null then
92 igw_report_processing.dump_justification(p_proposal_id
93 ,l_proposal_form_number, l_return_status, l_msg_data);
94 if l_return_status <> 'S' then
95 l_procedure_name := 'IGW_REPORT_PROCESSING.DUMP_JUSTIFICATION';
96 raise FND_API.G_EXC_ERROR;
97 end if;
98 end if;
99 end if;
100
101
102 OPEN doc_num;
103 FETCH doc_num INTO l_doc_num;
104 CLOSE doc_num;
105
106
107 ec_document.send(
108 p_api_version_number => 1.0,
109 i_Output_Path => p_output_path,
110 i_Output_Filename => 'PRPO' || to_char(l_doc_num) ,
111 i_Transaction_Type => 'PRPO',
112 call_status => l_call_status,
113 request_id => l_request_id,
114 x_msg_count => l_msg_count,
115 x_msg_data => l_msg_data,
116 x_return_status => l_return_status,
117 p_parameter1 => p_proposal_id,
118 p_parameter2 => null,
119 p_parameter3 => null,
120 p_parameter4 => null,
121 p_parameter5 => null,
122 p_parameter6 => null,
123 p_parameter7 => null,
124 p_parameter8 => null,
125 p_parameter9 => null,
126 p_parameter10 => null,
127 p_parameter11 => null,
128 p_parameter12 => null,
129 p_parameter13 => null,
130 p_parameter14 => null,
131 p_parameter15 => null,
132 p_parameter16 => null,
133 p_parameter17 => null,
134 p_parameter18 => null,
135 p_parameter19 => null,
136 p_parameter20 => null,
137 I_DEBUG_MODE => p_debug_mode);
138
139 retcode := 0;
140 commit;
141
142 EXCEPTION
143 when FND_API.G_EXC_ERROR then
144 retcode := 2;
145 if l_return_status = 'U' then
146 errbuf := l_msg_data||l_procedure_name;
147 else
148 errbuf:= errbuf||fnd_msg_pub.get(p_msg_index => 1, p_encoded => 'TRUE');
149 end if;
150
151 when others then
152 retcode := 2;
153 l_msg_data := SQLCODE||' '||SQLERRM;
154 errbuf := l_msg_data||'IGW_EDI_PROCESSING';
155 END submit;
156
157
158 PROCEDURE update_edi_date ( x_proposal_id IN NUMBER) is
159 Begin
160 update igw_proposals set edi_generated_date = SYSDATE
161 where proposal_id = x_proposal_id;
162 End update_edi_date;
163
164 END IGW_EDI_PROCESSING;