[Home] [Help]
PACKAGE BODY: APPS.WSM_WIP_LOT_TXN_PVT
Source
1 package body WSM_WIP_LOT_TXN_PVT as
2 /* $Header: WSMVWIPB.pls 120.7 2006/08/03 23:48:01 nlal noship $ */
3
4 /* Package name */
5 g_pkg_name VARCHAR2(20) := 'WSM_WIP_LOT_TXN_PVT';
6
7 /*logging variables*/
8
9 g_log_level_unexpected NUMBER := FND_LOG.LEVEL_UNEXPECTED ;
10 g_log_level_error number := FND_LOG.LEVEL_ERROR ;
11 g_log_level_exception number := FND_LOG.LEVEL_EXCEPTION ;
12 g_log_level_event number := FND_LOG.LEVEL_EVENT ;
13 g_log_level_procedure number := FND_LOG.LEVEL_PROCEDURE ;
14 g_log_level_statement number := FND_LOG.LEVEL_STATEMENT ;
15
16 g_msg_lvl_unexp_error NUMBER := FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR ;
17 g_msg_lvl_error NUMBER := FND_MSG_PUB.G_MSG_LVL_ERROR ;
18 g_msg_lvl_success NUMBER := FND_MSG_PUB.G_MSG_LVL_SUCCESS ;
19 g_msg_lvl_debug_high NUMBER := FND_MSG_PUB.G_MSG_LVL_DEBUG_HIGH ;
20 g_msg_lvl_debug_medium NUMBER := FND_MSG_PUB.G_MSG_LVL_DEBUG_MEDIUM ;
21 g_msg_lvl_debug_low NUMBER := FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW ;
22
23 g_ret_success varchar2(1) := FND_API.G_RET_STS_SUCCESS;
24 g_ret_error varchar2(1) := FND_API.G_RET_STS_ERROR;
25 g_ret_unexpected varchar2(1) := FND_API.G_RET_STS_UNEXP_ERROR;
26
27 -- This procedure is added to log the transaction related data..(serial Numbers data is left out..)
28 Procedure Log_transaction_data ( p_txn_header_rec IN WLTX_TRANSACTIONS_REC_TYPE ,
29 p_starting_jobs_tbl IN WLTX_STARTING_JOBS_TBL_TYPE ,
30 p_resulting_jobs_tbl IN WLTX_RESULTING_JOBS_TBL_TYPE ,
31 p_secondary_qty_tbl IN WSM_JOB_SECONDARY_QTY_TBL_TYPE ,
32 x_return_status OUT NOCOPY VARCHAR2 ,
33 x_msg_count OUT NOCOPY NUMBER ,
34 x_error_msg OUT NOCOPY VARCHAR2
35 )
36
37 IS
38
39 -- Logging variables.....
40 l_log_level number := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
41 l_msg_tokens WSM_log_PVT.token_rec_tbl;
42 l_stmt_num NUMBER;
43 l_module VARCHAR2(100) := 'wsm.plsql.WSM_WIP_LOT_TXN_PVT.Log_transaction_data';
44
45 -- This assumption is based that each individual column to be logged doesnt exceed 3900 chars... (that's the max...)
46 type t_log_message_tbl IS table OF varchar2(3900) index by binary_integer;
47
48 -- MESSAGE_TEXT column in FND_LOG_MESSAGES is 4000 characters long..
49 -- WSM_Log_PVT adds the date information in the start,,, so leave 50 characters for that
50 -- Effective length we would use is 3900
51 l_message_length NUMBER := 3900;
52 l_log_message VARCHAR2(3900);
53
54 l_message_tbl t_log_message_tbl;
55 l_counter NUMBER;
56 l_index NUMBER;
57
58 BEGIN
59 l_stmt_num := 10;
60 x_return_status := G_RET_SUCCESS;
61 x_error_msg := NULL;
62 x_msg_count := 0;
63
64 if( g_log_level_statement >= l_log_level ) then
65
66 WSM_log_PVT.logMessage(p_module_name => l_module ,
67 p_msg_text => 'Entered Log_transaction_data procedure',
68 p_stmt_num => l_stmt_num ,
69 p_msg_tokens => l_msg_tokens,
70 p_fnd_log_level => g_log_level_statement,
71 p_run_log_level => l_log_level
72 );
73
74 WSM_log_PVT.logMessage(p_module_name => l_module ,
75 p_msg_text => '------> Transaction Header Information <---------',
76 p_stmt_num => l_stmt_num ,
77 p_msg_tokens => l_msg_tokens,
78 p_fnd_log_level => g_log_level_statement,
79 p_run_log_level => l_log_level
80 );
81 l_message_tbl.delete;
82
83 l_message_tbl(l_message_tbl.count+1) := 'Transaction Type [' || p_txn_header_rec.transaction_type_id || '] ';
84 l_message_tbl(l_message_tbl.count+1) := 'Transaction Date [' || to_char(p_txn_header_rec.transaction_date,'DD-MON-YYYY HH24:MI:SS') || '] ';
85 l_message_tbl(l_message_tbl.count+1) := 'Transaction Reference [' || p_txn_header_rec.transaction_reference || '] ' ;
86 l_message_tbl(l_message_tbl.count+1) := 'Reason_id [' || p_txn_header_rec.reason_id || '] ' ;
87 l_message_tbl(l_message_tbl.count+1) := 'Transaction_id [' || p_txn_header_rec.transaction_id || '] ' ;
88 l_message_tbl(l_message_tbl.count+1) := 'Employee_id [' || p_txn_header_rec.employee_id || '] ' ;
89 l_message_tbl(l_message_tbl.count+1) := 'Organization_code [' || p_txn_header_rec.organization_code || '] ' ;
90 l_message_tbl(l_message_tbl.count+1) := 'Organization_id [' || p_txn_header_rec.organization_id || '] ' ;
91 -- l_message_tbl(l_message_tbl.count+1) := 'Error_message [' || p_txn_header_rec.error_message || '] ' ;
92 l_message_tbl(l_message_tbl.count+1) := 'Attribute_category [' || p_txn_header_rec.attribute_category || '] ' ;
93 l_message_tbl(l_message_tbl.count+1) := 'Attribute1 [' || p_txn_header_rec.attribute1 || '] ' ;
94 l_message_tbl(l_message_tbl.count+1) := 'Attribute2 [' || p_txn_header_rec.attribute2 || '] ' ;
95 l_message_tbl(l_message_tbl.count+1) := 'Attribute3 [' || p_txn_header_rec.attribute3 || '] ' ;
96 l_message_tbl(l_message_tbl.count+1) := 'Attribute4 [' || p_txn_header_rec.attribute4 || '] ' ;
97 l_message_tbl(l_message_tbl.count+1) := 'Attribute5 [' || p_txn_header_rec.attribute5 || '] ' ;
98 l_message_tbl(l_message_tbl.count+1) := 'Attribute6 [' || p_txn_header_rec.attribute6 || '] ' ;
99 l_message_tbl(l_message_tbl.count+1) := 'Attribute7 [' || p_txn_header_rec.attribute7 || '] ' ;
100 l_message_tbl(l_message_tbl.count+1) := 'Attribute8 [' || p_txn_header_rec.attribute8 || '] ' ;
101 l_message_tbl(l_message_tbl.count+1) := 'Attribute9 [' || p_txn_header_rec.attribute9 || '] ' ;
102 l_message_tbl(l_message_tbl.count+1) := 'Attribute10 [' || p_txn_header_rec.attribute10 || '] ' ;
103 l_message_tbl(l_message_tbl.count+1) := 'Attribute11 [' || p_txn_header_rec.attribute11 || '] ' ;
104 l_message_tbl(l_message_tbl.count+1) := 'Attribute12 [' || p_txn_header_rec.attribute12 || '] ' ;
105 l_message_tbl(l_message_tbl.count+1) := 'Attribute13 [' || p_txn_header_rec.attribute13 || '] ' ;
106 l_message_tbl(l_message_tbl.count+1) := 'Attribute14 [' || p_txn_header_rec.attribute14 || '] ' ;
107 l_message_tbl(l_message_tbl.count+1) := 'Attribute15 [' || p_txn_header_rec.attribute15 || '] ' ;
108
109 l_counter := l_message_tbl.first;
110 l_log_message := null;
111
112 while l_counter is not null loop
113
114 IF length(l_log_message || l_message_tbl(l_counter)) > 3900 THEN
115 -- Log the data in l_log_message...
116 WSM_log_PVT.logMessage(p_module_name => l_module ,
117 p_msg_text => l_log_message ,
118 p_stmt_num => l_stmt_num ,
119 p_msg_tokens => l_msg_tokens ,
120 p_fnd_log_level => g_log_level_statement ,
121 p_run_log_level => l_log_level
122 );
123 l_log_message := null;
124 END IF;
125
126 l_log_message := l_log_message || l_message_tbl(l_counter);
127 l_counter := l_message_tbl.next(l_counter);
128
129 end loop;
130
131 -- Log the remainder data..
132 IF l_log_message IS NOT NULL THEN
133 -- Log the data in l_log_message...
134 WSM_log_PVT.logMessage(p_module_name => l_module ,
135 p_msg_text => l_log_message ,
136 p_stmt_num => l_stmt_num ,
137 p_msg_tokens => l_msg_tokens ,
138 p_fnd_log_level => g_log_level_statement ,
139 p_run_log_level => l_log_level
140 );
141
142 END IF;
143
144 l_log_message := null;
145 l_stmt_num := 20;
146 -- Log the starting jobs data....
147 WSM_log_PVT.logMessage(p_module_name => l_module ,
148 p_msg_text => '=========------> Starting Jobs Information <---------============',
149 p_stmt_num => l_stmt_num ,
150 p_msg_tokens => l_msg_tokens ,
151 p_fnd_log_level => g_log_level_statement ,
152 p_run_log_level => l_log_level
153 );
154 l_index := p_starting_jobs_tbl.first;
155
156 while l_index is not null loop
157
158 l_message_tbl.delete;
159
160 l_message_tbl(l_message_tbl.count+1) := 'Wip entity id [' || p_starting_jobs_tbl(l_index).wip_entity_id || '] ';
161 l_message_tbl(l_message_tbl.count+1) := 'Wip entity name [' || p_starting_jobs_tbl(l_index).wip_entity_name || '] ';
162 l_message_tbl(l_message_tbl.count+1) := 'Job type [' || p_starting_jobs_tbl(l_index).job_type || '] ';
163 l_message_tbl(l_message_tbl.count+1) := 'Status type [' || p_starting_jobs_tbl(l_index).status_type || '] ';
164 l_message_tbl(l_message_tbl.count+1) := 'Description [' || p_starting_jobs_tbl(l_index).description || '] ';
165 l_message_tbl(l_message_tbl.count+1) := 'Representative flag [' || p_starting_jobs_tbl(l_index).representative_flag || '] ';
166 l_message_tbl(l_message_tbl.count+1) := 'Serial track flag [' || p_starting_jobs_tbl(l_index).serial_track_flag || '] ';
167 l_message_tbl(l_message_tbl.count+1) := 'Class code [' || p_starting_jobs_tbl(l_index).class_code || '] ';
168 l_message_tbl(l_message_tbl.count+1) := 'Demand class [' || p_starting_jobs_tbl(l_index).demand_class || '] ';
169 l_message_tbl(l_message_tbl.count+1) := 'Organization code [' || p_starting_jobs_tbl(l_index).organization_code || '] ';
170 l_message_tbl(l_message_tbl.count+1) := 'Primary item id [' || p_starting_jobs_tbl(l_index).primary_item_id || '] ';
171 l_message_tbl(l_message_tbl.count+1) := 'Item name [' || p_starting_jobs_tbl(l_index).item_name || '] ';
172 l_message_tbl(l_message_tbl.count+1) := 'Organization id [' || p_starting_jobs_tbl(l_index).organization_id || '] ';
173 l_message_tbl(l_message_tbl.count+1) := 'Intraoperation step [' || p_starting_jobs_tbl(l_index).intraoperation_step || '] ';
174 l_message_tbl(l_message_tbl.count+1) := 'Operation seq num [' || p_starting_jobs_tbl(l_index).operation_seq_num || '] ';
175 l_message_tbl(l_message_tbl.count+1) := 'Operation code [' || p_starting_jobs_tbl(l_index).operation_code || '] ';
176 l_message_tbl(l_message_tbl.count+1) := 'Operation description [' || p_starting_jobs_tbl(l_index).operation_description || '] ';
177 l_message_tbl(l_message_tbl.count+1) := 'Operation seq id [' || p_starting_jobs_tbl(l_index).operation_seq_id || '] ';
178 l_message_tbl(l_message_tbl.count+1) := 'Standard operation id [' || p_starting_jobs_tbl(l_index).standard_operation_id || '] ';
179 l_message_tbl(l_message_tbl.count+1) := 'Department id [' || p_starting_jobs_tbl(l_index).department_id || '] ';
180 l_message_tbl(l_message_tbl.count+1) := 'Department code [' || p_starting_jobs_tbl(l_index).department_code || '] ';
181 l_message_tbl(l_message_tbl.count+1) := 'Start quantity [' || p_starting_jobs_tbl(l_index).start_quantity || '] ';
182 l_message_tbl(l_message_tbl.count+1) := 'Quantity available [' || p_starting_jobs_tbl(l_index).quantity_available || '] ';
183 l_message_tbl(l_message_tbl.count+1) := 'Net quantity [' || p_starting_jobs_tbl(l_index).net_quantity || '] ';
184 l_message_tbl(l_message_tbl.count+1) := 'Routing reference id [' || p_starting_jobs_tbl(l_index).routing_reference_id || '] ';
185 l_message_tbl(l_message_tbl.count+1) := 'Bom reference id [' || p_starting_jobs_tbl(l_index).bom_reference_id || '] ';
186 l_message_tbl(l_message_tbl.count+1) := 'Common bill sequence id [' || p_starting_jobs_tbl(l_index).common_bill_sequence_id || '] ';
187 l_message_tbl(l_message_tbl.count+1) := 'Bom revision [' || p_starting_jobs_tbl(l_index).bom_revision || '] ';
188 l_message_tbl(l_message_tbl.count+1) := 'Bom revision date [' || to_char(p_starting_jobs_tbl(l_index).bom_revision_date,'DD-MON-YYYY HH24:MI:SS') || '] ';
189 l_message_tbl(l_message_tbl.count+1) := 'Alternate bom designator [' || p_starting_jobs_tbl(l_index).alternate_bom_designator || '] ';
190 l_message_tbl(l_message_tbl.count+1) := 'Alternate routing designator ['|| p_starting_jobs_tbl(l_index).alternate_routing_designator || '] ';
191 l_message_tbl(l_message_tbl.count+1) := 'Common routing sequence id [' || p_starting_jobs_tbl(l_index).common_routing_sequence_id || '] ';
192 l_message_tbl(l_message_tbl.count+1) := 'Routing revision [' || p_starting_jobs_tbl(l_index).routing_revision || '] ';
193 l_message_tbl(l_message_tbl.count+1) := 'Routing revision date [' || to_char(p_starting_jobs_tbl(l_index).routing_revision_date,'DD-MON-YYYY HH24:MI:SS') || '] ';
194 l_message_tbl(l_message_tbl.count+1) := 'Completion subinventory [' || p_starting_jobs_tbl(l_index).completion_subinventory || '] ';
195 l_message_tbl(l_message_tbl.count+1) := 'Completion locator id [' || p_starting_jobs_tbl(l_index).completion_locator_id || '] ';
196 l_message_tbl(l_message_tbl.count+1) := 'Completion locator [' || p_starting_jobs_tbl(l_index).completion_locator || '] ';
197 l_message_tbl(l_message_tbl.count+1) := 'Date released [' || p_starting_jobs_tbl(l_index).date_released || '] ';
198 l_message_tbl(l_message_tbl.count+1) := 'Scheduled start date [' || to_char(p_starting_jobs_tbl(l_index).scheduled_start_date,'DD-MON-YYYY HH24:MI:SS') || '] ';
199 l_message_tbl(l_message_tbl.count+1) := 'Scheduled completion date [' || to_char(p_starting_jobs_tbl(l_index).scheduled_completion_date,'DD-MON-YYYY HH24:MI:SS') || '] ';
200 l_message_tbl(l_message_tbl.count+1) := 'Coproducts supply [' || p_starting_jobs_tbl(l_index).coproducts_supply || '] ';
201 l_message_tbl(l_message_tbl.count+1) := 'Kanban card id [' || p_starting_jobs_tbl(l_index).kanban_card_id || '] ';
202 l_message_tbl(l_message_tbl.count+1) := 'Wip supply type [' || p_starting_jobs_tbl(l_index).wip_supply_type || '] ';
203 l_message_tbl(l_message_tbl.count+1) := 'Attribute category [' || p_starting_jobs_tbl(l_index).attribute_category || '] ';
204 l_message_tbl(l_message_tbl.count+1) := 'Attribute1 [' || p_starting_jobs_tbl(l_index).attribute1 || '] ';
205 l_message_tbl(l_message_tbl.count+1) := 'Attribute2 [' || p_starting_jobs_tbl(l_index).attribute2 || '] ';
206 l_message_tbl(l_message_tbl.count+1) := 'Attribute3 [' || p_starting_jobs_tbl(l_index).attribute3 || '] ';
207 l_message_tbl(l_message_tbl.count+1) := 'Attribute4 [' || p_starting_jobs_tbl(l_index).attribute4 || '] ';
208 l_message_tbl(l_message_tbl.count+1) := 'Attribute5 [' || p_starting_jobs_tbl(l_index).attribute5 || '] ';
209 l_message_tbl(l_message_tbl.count+1) := 'Attribute6 [' || p_starting_jobs_tbl(l_index).attribute6 || '] ';
210 l_message_tbl(l_message_tbl.count+1) := 'Attribute7 [' || p_starting_jobs_tbl(l_index).attribute7 || '] ';
211 l_message_tbl(l_message_tbl.count+1) := 'Attribute8 [' || p_starting_jobs_tbl(l_index).attribute8 || '] ';
212 l_message_tbl(l_message_tbl.count+1) := 'Attribute9 [' || p_starting_jobs_tbl(l_index).attribute9 || '] ';
213 l_message_tbl(l_message_tbl.count+1) := 'Attribute10 [' || p_starting_jobs_tbl(l_index).attribute10 || '] ';
214 l_message_tbl(l_message_tbl.count+1) := 'Attribute11 [' || p_starting_jobs_tbl(l_index).attribute11 || '] ';
215 l_message_tbl(l_message_tbl.count+1) := 'Attribute12 [' || p_starting_jobs_tbl(l_index).attribute12 || '] ';
216 l_message_tbl(l_message_tbl.count+1) := 'Attribute13 [' || p_starting_jobs_tbl(l_index).attribute13 || '] ';
217 l_message_tbl(l_message_tbl.count+1) := 'Attribute14 [' || p_starting_jobs_tbl(l_index).attribute14 || '] ';
218 l_message_tbl(l_message_tbl.count+1) := 'Attribute15 [' || p_starting_jobs_tbl(l_index).attribute15 || '] ';
219
220 --
221 l_counter := l_message_tbl.first;
222 l_log_message := null;
223
224 while l_counter is not null loop
225
226 IF length(l_log_message || l_message_tbl(l_counter)) > 3900 THEN
227 -- Log the data in l_log_message...
228 WSM_log_PVT.logMessage(p_module_name => l_module ,
229 p_msg_text => l_log_message ,
230 p_stmt_num => l_stmt_num ,
231 p_msg_tokens => l_msg_tokens ,
232 p_fnd_log_level => g_log_level_statement ,
233 p_run_log_level => l_log_level
234 );
235 l_log_message := null;
236 END IF;
237
238 l_log_message := l_log_message || l_message_tbl(l_counter);
239 l_counter := l_message_tbl.next(l_counter);
240
241 end loop;
242
243 -- Log the remainder data..
244 IF l_log_message IS NOT NULL THEN
245 -- Log the data in l_log_message...
246 WSM_log_PVT.logMessage(p_module_name => l_module ,
247 p_msg_text => l_log_message ,
248 p_stmt_num => l_stmt_num ,
249 p_msg_tokens => l_msg_tokens ,
250 p_fnd_log_level => g_log_level_statement ,
251 p_run_log_level => l_log_level
252 );
253
254 END IF;
255
256 l_index := p_starting_jobs_tbl.next(l_index);
257 end loop;
258
259 l_stmt_num := 30;
260 -- Log the starting jobs data....
261 WSM_log_PVT.logMessage(p_module_name => l_module ,
262 p_msg_text => '=========------> Resulting Jobs Information <---------============',
263 p_stmt_num => l_stmt_num ,
264 p_msg_tokens => l_msg_tokens ,
265 p_fnd_log_level => g_log_level_statement ,
266 p_run_log_level => l_log_level
267 );
268
269 l_index := p_resulting_jobs_tbl.first;
270
271 while l_index is not null loop
272
273 l_message_tbl.delete;
274
275 l_message_tbl(l_message_tbl.count+1) := 'Wip entity name [' || p_resulting_jobs_tbl(l_index).wip_entity_name || '] ' ;
276 l_message_tbl(l_message_tbl.count+1) := 'Wip entity id [' || p_resulting_jobs_tbl(l_index).wip_entity_id || '] ' ;
277 l_message_tbl(l_message_tbl.count+1) := 'Description [' || p_resulting_jobs_tbl(l_index).description || '] ' ;
278 l_message_tbl(l_message_tbl.count+1) := 'Job type [' || p_resulting_jobs_tbl(l_index).job_type || '] ' ;
279 l_message_tbl(l_message_tbl.count+1) := 'Status type [' || p_resulting_jobs_tbl(l_index).status_type || '] ' ;
280 l_message_tbl(l_message_tbl.count+1) := 'wip supply type [' || p_resulting_jobs_tbl(l_index).wip_supply_type || '] ' ;
281 l_message_tbl(l_message_tbl.count+1) := 'Organization id [' || p_resulting_jobs_tbl(l_index).organization_id || '] ' ;
282 l_message_tbl(l_message_tbl.count+1) := 'Organization code [' || p_resulting_jobs_tbl(l_index).organization_code || '] ' ;
283 l_message_tbl(l_message_tbl.count+1) := 'Item name [' || p_resulting_jobs_tbl(l_index).item_name || '] ' ;
284 l_message_tbl(l_message_tbl.count+1) := 'Primary item id [' || p_resulting_jobs_tbl(l_index).primary_item_id || '] ' ;
285 l_message_tbl(l_message_tbl.count+1) := 'Class code [' || p_resulting_jobs_tbl(l_index).class_code || '] ' ;
286 l_message_tbl(l_message_tbl.count+1) := 'Bom reference item [' || p_resulting_jobs_tbl(l_index).bom_reference_item || '] ' ;
287 l_message_tbl(l_message_tbl.count+1) := 'Bom reference id [' || p_resulting_jobs_tbl(l_index).bom_reference_id || '] ' ;
288 l_message_tbl(l_message_tbl.count+1) := 'Routing reference item [' || p_resulting_jobs_tbl(l_index).routing_reference_item || '] ' ;
289 l_message_tbl(l_message_tbl.count+1) := 'Routing reference id [' || p_resulting_jobs_tbl(l_index).routing_reference_id || '] ' ;
290 l_message_tbl(l_message_tbl.count+1) := 'Common bom sequence id [' || p_resulting_jobs_tbl(l_index).common_bom_sequence_id || '] ' ;
291 l_message_tbl(l_message_tbl.count+1) := 'Common routing sequence id [' || p_resulting_jobs_tbl(l_index).common_routing_sequence_id || '] ' ;
292 l_message_tbl(l_message_tbl.count+1) := 'Bom revision [' || p_resulting_jobs_tbl(l_index).bom_revision || '] ' ;
293 l_message_tbl(l_message_tbl.count+1) := 'Routing revision [' || p_resulting_jobs_tbl(l_index).routing_revision || '] ' ;
294 l_message_tbl(l_message_tbl.count+1) := 'Bom revision date [' || to_char(p_resulting_jobs_tbl(l_index).bom_revision_date,'DD-MON-YYYY HH24:MI:SS') || '] ' ;
295 l_message_tbl(l_message_tbl.count+1) := 'Routing revision date [' || to_char(p_resulting_jobs_tbl(l_index).routing_revision_date,'DD-MON-YYYY HH24:MI:SS') || '] ' ;
296 l_message_tbl(l_message_tbl.count+1) := 'Alternate bom designator [' || p_resulting_jobs_tbl(l_index).alternate_bom_designator || '] ' ;
297 l_message_tbl(l_message_tbl.count+1) := 'Alternate routing designator [' || p_resulting_jobs_tbl(l_index).alternate_routing_designator || '] ' ;
298 l_message_tbl(l_message_tbl.count+1) := 'Start quantity [' || p_resulting_jobs_tbl(l_index).start_quantity || '] ' ;
299 l_message_tbl(l_message_tbl.count+1) := 'Net quantity [' || p_resulting_jobs_tbl(l_index).net_quantity || '] ' ;
300 l_message_tbl(l_message_tbl.count+1) := 'Starting operation seq num [' || p_resulting_jobs_tbl(l_index).starting_operation_seq_num || '] ' ;
301 l_message_tbl(l_message_tbl.count+1) := 'Starting intraoperation step [' || p_resulting_jobs_tbl(l_index).starting_intraoperation_step || '] ' ;
302 l_message_tbl(l_message_tbl.count+1) := 'Starting operation code [' || p_resulting_jobs_tbl(l_index).starting_operation_code || '] ' ;
303 l_message_tbl(l_message_tbl.count+1) := 'Starting operation seq id [' || p_resulting_jobs_tbl(l_index).starting_operation_seq_id || '] ' ;
304 l_message_tbl(l_message_tbl.count+1) := 'Starting std op id [' || p_resulting_jobs_tbl(l_index).starting_std_op_id || '] ' ;
305 l_message_tbl(l_message_tbl.count+1) := 'Department id [' || p_resulting_jobs_tbl(l_index).department_id || '] ' ;
306 l_message_tbl(l_message_tbl.count+1) := 'Department code [' || p_resulting_jobs_tbl(l_index).department_code || '] ' ;
307 l_message_tbl(l_message_tbl.count+1) := 'Operation description [' || p_resulting_jobs_tbl(l_index).operation_description || '] ' ;
308 l_message_tbl(l_message_tbl.count+1) := 'Job operation seq num [' || p_resulting_jobs_tbl(l_index).job_operation_seq_num || '] ' ;
309 l_message_tbl(l_message_tbl.count+1) := 'Split has update assy [' || p_resulting_jobs_tbl(l_index).split_has_update_assy || '] ' ;
310 l_message_tbl(l_message_tbl.count+1) := 'Completion subinventory [' || p_resulting_jobs_tbl(l_index).completion_subinventory || '] ' ;
311 l_message_tbl(l_message_tbl.count+1) := 'Completion locator id [' || p_resulting_jobs_tbl(l_index).completion_locator_id || '] ' ;
312 l_message_tbl(l_message_tbl.count+1) := 'Completion locator [' || p_resulting_jobs_tbl(l_index).completion_locator || '] ' ;
313 l_message_tbl(l_message_tbl.count+1) := 'Scheduled start date [' || to_char(p_resulting_jobs_tbl(l_index).scheduled_start_date,'DD-MON-YYYY HH24:MI:SS') || '] ' ;
314 l_message_tbl(l_message_tbl.count+1) := 'Scheduled completion date [' || to_char(p_resulting_jobs_tbl(l_index).scheduled_completion_date,'DD-MON-YYYY HH24:MI:SS') || '] ' ;
315 l_message_tbl(l_message_tbl.count+1) := 'Bonus acct id [' || p_resulting_jobs_tbl(l_index).bonus_acct_id || '] ' ;
316 l_message_tbl(l_message_tbl.count+1) := 'Coproducts supply [' || p_resulting_jobs_tbl(l_index).coproducts_supply || '] ' ;
317 l_message_tbl(l_message_tbl.count+1) := 'Kanban card id [' || p_resulting_jobs_tbl(l_index).kanban_card_id || '] ' ;
318 l_message_tbl(l_message_tbl.count+1) := 'Attribute category [' || p_resulting_jobs_tbl(l_index).attribute_category || '] ' ;
319 l_message_tbl(l_message_tbl.count+1) := 'Attribute1 [' || p_resulting_jobs_tbl(l_index).attribute1 || '] ' ;
320 l_message_tbl(l_message_tbl.count+1) := 'Attribute2 [' || p_resulting_jobs_tbl(l_index).attribute2 || '] ' ;
321 l_message_tbl(l_message_tbl.count+1) := 'Attribute3 [' || p_resulting_jobs_tbl(l_index).attribute3 || '] ' ;
322 l_message_tbl(l_message_tbl.count+1) := 'Attribute4 [' || p_resulting_jobs_tbl(l_index).attribute4 || '] ' ;
323 l_message_tbl(l_message_tbl.count+1) := 'Attribute5 [' || p_resulting_jobs_tbl(l_index).attribute5 || '] ' ;
324 l_message_tbl(l_message_tbl.count+1) := 'Attribute6 [' || p_resulting_jobs_tbl(l_index).attribute6 || '] ' ;
325 l_message_tbl(l_message_tbl.count+1) := 'Attribute7 [' || p_resulting_jobs_tbl(l_index).attribute7 || '] ' ;
326 l_message_tbl(l_message_tbl.count+1) := 'Attribute8 [' || p_resulting_jobs_tbl(l_index).attribute8 || '] ' ;
327 l_message_tbl(l_message_tbl.count+1) := 'Attribute9 [' || p_resulting_jobs_tbl(l_index).attribute9 || '] ' ;
328 l_message_tbl(l_message_tbl.count+1) := 'Attribute10 [' || p_resulting_jobs_tbl(l_index).attribute10 || '] ' ;
329 l_message_tbl(l_message_tbl.count+1) := 'Attribute11 [' || p_resulting_jobs_tbl(l_index).attribute11 || '] ' ;
330 l_message_tbl(l_message_tbl.count+1) := 'Attribute12 [' || p_resulting_jobs_tbl(l_index).attribute12 || '] ' ;
331 l_message_tbl(l_message_tbl.count+1) := 'Attribute13 [' || p_resulting_jobs_tbl(l_index).attribute13 || '] ' ;
332 l_message_tbl(l_message_tbl.count+1) := 'Attribute14 [' || p_resulting_jobs_tbl(l_index).attribute14 || '] ' ;
333 l_message_tbl(l_message_tbl.count+1) := 'Attribute15 [' || p_resulting_jobs_tbl(l_index).attribute15 || '] ' ;
334
335 l_counter := l_message_tbl.first;
336 l_log_message := null;
337
338 while l_counter is not null loop
339
340 IF length(l_log_message || l_message_tbl(l_counter)) > 3900 THEN
341 -- Log the data in l_log_message...
342 WSM_log_PVT.logMessage(p_module_name => l_module ,
343 p_msg_text => l_log_message ,
344 p_stmt_num => l_stmt_num ,
345 p_msg_tokens => l_msg_tokens ,
346 p_fnd_log_level => g_log_level_statement ,
347 p_run_log_level => l_log_level
348 );
349 l_log_message := null;
350 END IF;
351
352 l_log_message := l_log_message || l_message_tbl(l_counter);
353 l_counter := l_message_tbl.next(l_counter);
354
355 end loop;
356
357 -- Log the remainder data..
358 IF l_log_message IS NOT NULL THEN
359 -- Log the data in l_log_message...
360 WSM_log_PVT.logMessage(p_module_name => l_module ,
361 p_msg_text => l_log_message ,
362 p_stmt_num => l_stmt_num ,
363 p_msg_tokens => l_msg_tokens ,
364 p_fnd_log_level => g_log_level_statement ,
365 p_run_log_level => l_log_level
366 );
367
368 END IF;
369
370 l_index := p_resulting_jobs_tbl.next(l_index);
371 end loop;
372 l_stmt_num := 40;
373 -- Log the starting jobs data....
374 WSM_log_PVT.logMessage(p_module_name => l_module ,
375 p_msg_text => '=========------> Secondary quantities Information <---------============',
376 p_stmt_num => l_stmt_num ,
377 p_msg_tokens => l_msg_tokens ,
378 p_fnd_log_level => g_log_level_statement ,
379 p_run_log_level => l_log_level
380 );
381
382 l_index := p_secondary_qty_tbl.first;
383
384 while l_index is not null loop
385
386 l_message_tbl.delete;
387
388 l_message_tbl(l_message_tbl.count+1) := 'Wip entity id [' || p_secondary_qty_tbl(l_index).wip_entity_id || '] ';
389 l_message_tbl(l_message_tbl.count+1) := 'Wip entity name [' || p_secondary_qty_tbl(l_index).wip_entity_name || '] ';
390 l_message_tbl(l_message_tbl.count+1) := 'Organization id [' || p_secondary_qty_tbl(l_index).organization_id || '] ';
391 l_message_tbl(l_message_tbl.count+1) := 'Uom code [' || p_secondary_qty_tbl(l_index).uom_code || '] ';
392 l_message_tbl(l_message_tbl.count+1) := 'Current quantity [' || p_secondary_qty_tbl(l_index).current_quantity || '] ';
393 l_message_tbl(l_message_tbl.count+1) := 'Currently active [' || p_secondary_qty_tbl(l_index).currently_active || '] ';
394
395 l_counter := l_message_tbl.first;
396 l_log_message := null;
397
398 while l_counter is not null loop
399
400 IF length(l_log_message || l_message_tbl(l_counter)) > 3900 THEN
401 -- Log the data in l_log_message...
402 WSM_log_PVT.logMessage(p_module_name => l_module ,
403 p_msg_text => l_log_message ,
404 p_stmt_num => l_stmt_num ,
405 p_msg_tokens => l_msg_tokens ,
406 p_fnd_log_level => g_log_level_statement ,
407 p_run_log_level => l_log_level
408 );
409 l_log_message := null;
410 END IF;
411
412 l_log_message := l_log_message || l_message_tbl(l_counter);
413 l_counter := l_message_tbl.next(l_counter);
414
415 end loop;
416
417 -- Log the remainder data..
418 IF l_log_message IS NOT NULL THEN
419 -- Log the data in l_log_message...
420 WSM_log_PVT.logMessage(p_module_name => l_module ,
421 p_msg_text => l_log_message ,
422 p_stmt_num => l_stmt_num ,
423 p_msg_tokens => l_msg_tokens ,
424 p_fnd_log_level => g_log_level_statement ,
425 p_run_log_level => l_log_level
426 );
427
428 END IF;
429
430 l_index := p_secondary_qty_tbl.next(l_index);
431 end loop;
432
433 -- Log the data in l_log_message...
434 WSM_log_PVT.logMessage(p_module_name => l_module ,
435 p_msg_text => 'Sucessfully logged the transaction data',
436 p_stmt_num => l_stmt_num ,
437 p_msg_tokens => l_msg_tokens ,
438 p_fnd_log_level => g_log_level_statement ,
439 p_run_log_level => l_log_level
440 );
441
442 END IF;
443
444 EXCEPTION
445 WHEN OTHERS THEN
446
447 x_return_status := G_RET_UNEXPECTED;
448
449 IF (G_LOG_LEVEL_UNEXPECTED >= l_log_level) OR
450 (FND_MSG_PUB.check_msg_level(G_MSG_LVL_UNEXP_ERROR))
451 THEN
452 WSM_log_PVT.handle_others( p_module_name => l_module ,
453 p_stmt_num => l_stmt_num ,
454 p_fnd_log_level => G_LOG_LEVEL_UNEXPECTED ,
455 p_run_log_level => l_log_level
456 );
457 END IF;
458
459 FND_MSG_PUB.Count_And_Get (p_encoded => 'F' ,
460 p_count => x_msg_count ,
461 p_data => x_error_msg
462
463 );
464 END Log_transaction_data;
465
466 -- OverLoaded procedure created for the bug 5263262 with an additional parameter p_invoke_req_worker...
467 -- The old procedure will call the new one with NULL passed..
468 PROCEDURE invoke_txn_API ( p_api_version IN NUMBER ,
469 p_commit IN VARCHAR2 ,
470 p_validation_level IN NUMBER ,
471 p_init_msg_list IN VARCHAR2 DEFAULT NULL ,
472 p_calling_mode IN NUMBER ,
473 p_txn_header_rec IN WLTX_TRANSACTIONS_REC_TYPE ,
474 p_starting_jobs_tbl IN WLTX_STARTING_JOBS_TBL_TYPE ,
475 p_resulting_jobs_tbl IN WLTX_RESULTING_JOBS_TBL_TYPE ,
476 P_wsm_serial_num_tbl IN WSM_SERIAL_SUPPORT_GRP.WSM_SERIAL_NUM_TBL ,
477 p_secondary_qty_tbl IN WSM_JOB_SECONDARY_QTY_TBL_TYPE ,
478 x_return_status OUT NOCOPY VARCHAR2 ,
479 x_msg_count OUT NOCOPY NUMBER ,
480 x_error_msg OUT NOCOPY VARCHAR2
481 )
482
483 IS
484
485 BEGIN
486 invoke_txn_API( p_api_version => p_api_version ,
487 p_commit => p_commit ,
488 p_validation_level => p_validation_level ,
489 p_init_msg_list => p_init_msg_list ,
490 p_calling_mode => p_calling_mode ,
491 p_txn_header_rec => p_txn_header_rec ,
492 p_starting_jobs_tbl => p_starting_jobs_tbl ,
493 p_resulting_jobs_tbl => p_resulting_jobs_tbl ,
494 P_wsm_serial_num_tbl => P_wsm_serial_num_tbl ,
495 p_secondary_qty_tbl => p_secondary_qty_tbl ,
496 -- ST : Added for bug 5263262
497 p_invoke_req_worker => NULL ,
498 x_return_status => x_return_status ,
499 x_msg_count => x_msg_count ,
500 x_error_msg => x_error_msg
501 );
502 END;
503
504 PROCEDURE invoke_txn_API ( p_api_version IN NUMBER ,
505 p_commit IN VARCHAR2 ,
506 p_validation_level IN NUMBER ,
507 p_init_msg_list IN VARCHAR2 DEFAULT NULL ,
508 p_calling_mode IN NUMBER ,
509 p_txn_header_rec IN WLTX_TRANSACTIONS_REC_TYPE ,
510 p_starting_jobs_tbl IN WLTX_STARTING_JOBS_TBL_TYPE ,
511 p_resulting_jobs_tbl IN WLTX_RESULTING_JOBS_TBL_TYPE ,
512 P_wsm_serial_num_tbl IN WSM_SERIAL_SUPPORT_GRP.WSM_SERIAL_NUM_TBL,
513 p_secondary_qty_tbl IN WSM_JOB_SECONDARY_QTY_TBL_TYPE ,
514 -- ST : Added for bug 5263262
515 p_invoke_req_worker IN NUMBER ,
516 x_return_status OUT NOCOPY VARCHAR2 ,
517 x_msg_count OUT NOCOPY NUMBER ,
518 x_error_msg OUT NOCOPY VARCHAR2
519 )
520 IS
521 l_txn_header_rec WLTX_TRANSACTIONS_REC_TYPE;
522 l_starting_jobs_tbl WLTX_STARTING_JOBS_TBL_TYPE;
523 l_resulting_jobs_tbl WLTX_RESULTING_JOBS_TBL_TYPE;
524 l_wsm_serial_num_tbl WSM_SERIAL_SUPPORT_GRP.WSM_SERIAL_NUM_TBL;
525 l_secondary_qty_tbl WSM_JOB_SECONDARY_QTY_TBL_TYPE;
526 l_poreq_request_id NUMBER;
527 l_index NUMBER;
528
529 l_wltx_resulting_job_rec WSM_WIP_LOT_TXN_PVT.WLTX_RESULTING_JOBS_REC_TYPE; --ADD AH
530
531 -- Logging variables.....
532 l_msg_tokens WSM_Log_PVT.token_rec_tbl;
533 l_log_level NUMBER := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
534
535 l_stmt_num NUMBER;
536 l_module VARCHAR2(100) := 'wsm.plsql.WSM_WIP_LOT_TXN_PVT.invoke_txn_API';
537
538 e_validation_error EXCEPTION;
539 begin
540 l_stmt_num := 10;
541 x_return_status := G_RET_SUCCESS;
542 x_error_msg := NULL;
543 x_msg_count := 0;
544
545 /*assign the input data into local tables*/
546 l_txn_header_rec := p_txn_header_rec ;
547 l_starting_jobs_tbl := p_starting_jobs_tbl ;
548 l_resulting_jobs_tbl := p_resulting_jobs_tbl ;
549 l_wsm_serial_num_tbl := P_wsm_serial_num_tbl ;
550 l_secondary_qty_tbl := p_secondary_qty_tbl ;
551
552 if( g_log_level_statement >= l_log_level ) then
553 l_msg_tokens.delete;
554 WSM_log_PVT.logMessage(p_module_name => l_module ,
555 p_msg_text => 'Entered Invoke Txn API procedure',
556 p_stmt_num => l_stmt_num ,
557 p_msg_tokens => l_msg_tokens,
558 p_fnd_log_level => g_log_level_statement,
559 p_run_log_level => l_log_level
560 );
561
562 -- Log the transaction data...
563 Log_transaction_data ( p_txn_header_rec => p_txn_header_rec ,
564 p_starting_jobs_tbl => p_starting_jobs_tbl ,
565 p_resulting_jobs_tbl => p_resulting_jobs_tbl ,
566 p_secondary_qty_tbl => p_secondary_qty_tbl ,
567 x_return_status => x_return_status ,
568 x_msg_count => x_msg_count ,
569 x_error_msg => x_error_msg
570 );
571
572 if x_return_status <> G_RET_SUCCESS then
573 IF x_return_status = G_RET_ERROR THEN
574 raise FND_API.G_EXC_ERROR;
575 ELSIF x_return_status = G_RET_UNEXPECTED THEN
576 raise FND_API.G_EXC_UNEXPECTED_ERROR;
577 END IF;
578 end if;
579 End if;
580
581 if l_txn_header_rec.transaction_type_id = WSMPCNST.SPLIT then
582
583 /*..... invoke split.. but also do the following checks...
584 i) Only one starting job...
585 ii) Atleast one resulting job....
586 */
587 l_stmt_num := 12;
588 if( g_log_level_statement >= l_log_level ) then
589 l_msg_tokens.delete;
590 WSM_log_PVT.logMessage(p_module_name => l_module,
591 p_msg_text => 'Txn type Split',
592 p_stmt_num => l_stmt_num,
593 p_msg_tokens => l_msg_tokens,
594 p_fnd_log_level => g_log_level_statement,
595 p_run_log_level => l_log_level
596 );
597 End if;
598
599 l_stmt_num := 15;
600
601 if l_starting_jobs_tbl.count <> 1 then
602 /* error out... */
603 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
604
605 l_msg_tokens.delete;
606 WSM_log_PVT.logMessage(p_module_name=> l_module ,
607 p_msg_name => 'WSM_START_LOT_REQUIRED',
608 p_msg_appl_name => 'WSM',
609 p_msg_tokens => l_msg_tokens ,
610 p_stmt_num => l_stmt_num ,
611 p_fnd_msg_level => G_MSG_LVL_ERROR ,
612 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
613 p_run_log_level => l_log_level
614 );
615 END IF;
616 RAISE FND_API.G_EXC_ERROR;
617
618 end if;
619
620 if l_resulting_jobs_tbl.count <1 then
621 /* error out... */
622 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
623
624 l_msg_tokens.delete;
625 WSM_log_PVT.logMessage(p_module_name=> l_module ,
626 p_msg_name => 'WSM_RESULT_LOT_REQUIRED',
627 p_msg_appl_name => 'WSM',
628 p_msg_tokens => l_msg_tokens ,
629 p_stmt_num => l_stmt_num ,
630 p_fnd_msg_level => G_MSG_LVL_ERROR ,
631 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
632 p_run_log_level => l_log_level
633 );
634 END IF;
635 RAISE FND_API.G_EXC_ERROR;
636 end if;
637
638 l_stmt_num := 25;
639
640 if( g_log_level_statement >= l_log_level ) then
641 l_msg_tokens.delete;
642 WSM_log_PVT.logMessage(p_module_name => l_module ,
643 p_msg_text => 'Before calling SPLIT TXN procedure',
644 p_stmt_num => l_stmt_num ,
645 p_msg_tokens => l_msg_tokens,
646 p_fnd_log_level => g_log_level_statement,
647 p_run_log_level => l_log_level
648 );
649 End if;
650
651
652 SPLIT_TXN( p_api_version => 1.0,
653 p_commit => FND_API.G_FALSE,
654 p_init_msg_list => FND_API.G_TRUE,
655 p_validation_level => 0,
656 p_calling_mode => p_calling_mode,
657 p_wltx_header => l_txn_header_rec,
658 p_wltx_starting_job_rec => l_starting_jobs_tbl(l_starting_jobs_tbl.first),
659 p_wltx_resulting_jobs_tbl => l_resulting_jobs_tbl,
660 p_wltx_secondary_qty_tbl => l_secondary_qty_tbl,
661 x_return_status => x_return_status,
662 x_msg_count => x_msg_count,
663 x_msg_data => x_error_msg
664 );
665
666 l_stmt_num := 30;
667
668 if( g_log_level_statement >= l_log_level ) then
669 l_msg_tokens.delete;
670 WSM_log_PVT.logMessage(p_module_name => l_module,
671 p_msg_text =>'Returned from SPLIT TXN procedure.Return status:'|| x_return_status,
672 p_stmt_num => l_stmt_num ,
673 p_msg_tokens => l_msg_tokens,
674 p_fnd_log_level => g_log_level_statement,
675 p_run_log_level => l_log_level
676 );
677 End if;
678
679
680 if x_return_status <> G_RET_SUCCESS then
681 IF x_return_status = G_RET_ERROR THEN
682 raise FND_API.G_EXC_ERROR;
683 ELSIF x_return_status = G_RET_UNEXPECTED THEN
684 raise FND_API.G_EXC_UNEXPECTED_ERROR;
685 END IF;
686 end if;
687 l_stmt_num := 55;
688
689 /* Is it Merge ?? If yes, go ahead */
690 elsif l_txn_header_rec.transaction_type_id = WSMPCNST.MERGE then
691
692 l_stmt_num := 60;
693
694 if l_starting_jobs_tbl.count < 2 then
695 /* error out... */
696 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
697
698 l_msg_tokens.delete;
699 WSM_log_PVT.logMessage(p_module_name => l_module ,
700 p_msg_text => 'No. of SJs cannot be less than 2 in case of Merge',
701 p_stmt_num => l_stmt_num ,
702 p_msg_tokens => l_msg_tokens,
703 p_fnd_msg_level => G_MSG_LVL_ERROR ,
704 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
705 p_run_log_level => l_log_level
706 );
707 END IF;
708 RAISE FND_API.G_EXC_ERROR;
709
710 end if;
711
712 if l_resulting_jobs_tbl.count <> 1 then
713 /* error out... */
714 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
715
716 l_msg_tokens.delete;
717 WSM_log_PVT.logMessage(p_module_name=> l_module ,
718 p_msg_name => 'WSM_RESULT_LOT_REQUIRED',
719 p_msg_appl_name => 'WSM',
720 p_msg_tokens => l_msg_tokens ,
721 p_stmt_num => l_stmt_num ,
722 p_fnd_msg_level => G_MSG_LVL_ERROR ,
723 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
724 p_run_log_level => l_log_level
725 );
726 END IF;
727 RAISE FND_API.G_EXC_ERROR;
728 end if;
729
730 l_stmt_num := 70;
731
732 MERGE_TXN ( p_api_version => 1.0,
733 p_commit => FND_API.G_FALSE,
734 p_init_msg_list => FND_API.G_TRUE,
735 p_validation_level => 0,
736 p_calling_mode => p_calling_mode,
737 p_wltx_header => l_txn_header_rec,
738 p_wltx_starting_jobs_tbl => l_starting_jobs_tbl,
739 p_wltx_resulting_job_rec => l_resulting_jobs_tbl(l_resulting_jobs_tbl.first),
740 p_wltx_secondary_qty_tbl => l_secondary_qty_tbl,
741 x_return_status => x_return_status,
742 x_msg_count => x_msg_count,
743 x_msg_data => x_error_msg
744 );
745
746 /* if not success return error.... */ --Start AH
747 --log proc exit
748
749 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
750 /* Txn errored....*/
751 /* Log the Procedure exit point.... */
752 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
753
754 l_msg_tokens.delete;
755 WSM_log_PVT.logMessage(p_module_name => l_module ,
756 p_msg_text => 'Merge API Failed',
757 p_stmt_num => l_stmt_num ,
758 p_msg_tokens => l_msg_tokens,
759 p_fnd_msg_level => G_MSG_LVL_ERROR ,
760 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
761 p_run_log_level => l_log_level
762 );
763 END IF;
764 RAISE FND_API.G_EXC_ERROR;
765
766 if x_return_status <> G_RET_SUCCESS then
767 IF x_return_status = G_RET_ERROR THEN
768 raise FND_API.G_EXC_ERROR;
769 ELSIF x_return_status = G_RET_UNEXPECTED THEN
770 raise FND_API.G_EXC_UNEXPECTED_ERROR;
771 END IF;
772 end if;
773
774 end if; --End AH
775
776 /* Is it Update Assembly ?? If yes, go ahead */
777 elsif l_txn_header_rec.transaction_type_id = WSMPCNST.UPDATE_ASSEMBLY then
778
779 if l_starting_jobs_tbl.count <> 1 then
780 /* error out... */
781 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
782
783 l_msg_tokens.delete;
784 WSM_log_PVT.logMessage(p_module_name=> l_module ,
785 p_msg_name => 'WSM_START_LOT_REQUIRED',
786 p_msg_appl_name => 'WSM',
787 p_msg_tokens => l_msg_tokens ,
788 p_stmt_num => l_stmt_num ,
789 p_fnd_msg_level => G_MSG_LVL_ERROR ,
790 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
791 p_run_log_level => l_log_level
792 );
793 END IF;
794 RAISE FND_API.G_EXC_ERROR;
795 end if;
796
797 if l_resulting_jobs_tbl.count <> 1 then
798 /* error out... */
799 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
800
801 l_msg_tokens.delete;
802 WSM_log_PVT.logMessage(p_module_name=> l_module ,
803 p_msg_name => 'WSM_RESULT_LOT_REQUIRED',
804 p_msg_appl_name => 'WSM',
805 p_msg_tokens => l_msg_tokens ,
806 p_stmt_num => l_stmt_num ,
807 p_fnd_msg_level => G_MSG_LVL_ERROR ,
808 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
809 p_run_log_level => l_log_level
810 );
811 END IF;
812 RAISE FND_API.G_EXC_ERROR;
813 end if;
814
815 UPDATE_ASSEMBLY_TXN ( p_api_version => 1.0,
816 p_commit => FND_API.G_FALSE,
817 p_init_msg_list => FND_API.G_TRUE,
818 p_validation_level => 0,
819 p_calling_mode => p_calling_mode,
820 p_wltx_header => l_txn_header_rec,
821 p_wltx_starting_job_rec => l_starting_jobs_tbl(l_starting_jobs_tbl.first),
822 p_wltx_resulting_job_rec => l_resulting_jobs_tbl(l_resulting_jobs_tbl.first),
823 p_wltx_secondary_qty_tbl => l_secondary_qty_tbl,
824 x_return_status => x_return_status,
825 x_msg_count => x_msg_count,
826 x_msg_data => x_error_msg
827 );
828
829 /* if not success return error.... */ --Start AH
830 --log exit to fnd_log
831
832 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
833 /* Txn errored....*/
834 /* Log the Procedure exit point.... */
835 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
836
837 l_msg_tokens.delete;
838 WSM_log_PVT.logMessage(p_module_name => l_module ,
839 p_msg_text => 'Update Assembly Txn procedure failed.' ,
840 p_stmt_num => l_stmt_num ,
841 p_msg_tokens => l_msg_tokens,
842 p_fnd_msg_level => G_MSG_LVL_ERROR ,
843 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
844 p_run_log_level => l_log_level
845 );
846 END IF;
847 RAISE FND_API.G_EXC_ERROR;
848
849 if x_return_status <> G_RET_SUCCESS then
850 IF x_return_status = G_RET_ERROR THEN
851 raise FND_API.G_EXC_ERROR;
852 ELSIF x_return_status = G_RET_UNEXPECTED THEN
853 raise FND_API.G_EXC_UNEXPECTED_ERROR;
854 END IF;
855 end if;
856 end if; --End AH
857
858 /* Is it Update Routing ?? If yes, go ahead */
859 elsif l_txn_header_rec.transaction_type_id = WSMPCNST.UPDATE_ROUTING then
860
861 if l_starting_jobs_tbl.count <> 1 then
862 /* error out... */
863 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
864
865 l_msg_tokens.delete;
866 WSM_log_PVT.logMessage(p_module_name=> l_module ,
867 p_msg_name => 'WSM_START_LOT_REQUIRED',
868 p_msg_appl_name => 'WSM',
869 p_stmt_num => l_stmt_num ,
870 p_msg_tokens => l_msg_tokens ,
871 p_fnd_msg_level => G_MSG_LVL_ERROR ,
872 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
873 p_run_log_level => l_log_level
874 );
875 END IF;
876 RAISE FND_API.G_EXC_ERROR;
877 end if;
878
879 if l_resulting_jobs_tbl.count <> 1 then
880 /* error out... */
881 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
882
883 l_msg_tokens.delete;
884 WSM_log_PVT.logMessage(p_module_name=> l_module ,
885 p_msg_name => 'WSM_RESULT_LOT_REQUIRED',
886 p_msg_appl_name => 'WSM',
887 p_stmt_num => l_stmt_num ,
888 p_msg_tokens => l_msg_tokens ,
889 p_fnd_msg_level => G_MSG_LVL_ERROR ,
890 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
891 p_run_log_level => l_log_level
892 );
893 END IF;
894 RAISE FND_API.G_EXC_ERROR;
895 end if;
896
897 UPDATE_ROUTING_TXN( p_api_version => 1.0,
898 p_commit => FND_API.G_FALSE,
899 p_init_msg_list => FND_API.G_TRUE,
900 p_validation_level => 0,
901 p_calling_mode => p_calling_mode,
902 p_wltx_header => l_txn_header_rec,
903 p_wltx_starting_job_rec => l_starting_jobs_tbl(l_starting_jobs_tbl.first),
904 p_wltx_resulting_job_rec => l_resulting_jobs_tbl(l_resulting_jobs_tbl.first),
905 p_wltx_secondary_qty_tbl => l_secondary_qty_tbl,
906 x_return_status => x_return_status,
907 x_msg_count => x_msg_count,
908 x_msg_data => x_error_msg
909 );
910
911 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
912 /* Txn errored....*/
913 /* Log the Procedure exit point.... */
914 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
915
916 l_msg_tokens.delete;
917 WSM_log_PVT.logMessage(p_module_name => l_module ,
918 p_msg_text => 'Update Routing Txn procedure failed.',
919 p_stmt_num => l_stmt_num ,
920 p_msg_tokens => l_msg_tokens,
921 p_fnd_msg_level => G_MSG_LVL_ERROR ,
922 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
923 p_run_log_level => l_log_level
924 );
925 END IF;
926 RAISE FND_API.G_EXC_ERROR;
927
928 if x_return_status <> G_RET_SUCCESS then
929 IF x_return_status = G_RET_ERROR THEN
930 raise FND_API.G_EXC_ERROR;
931 ELSIF x_return_status = G_RET_UNEXPECTED THEN
932 raise FND_API.G_EXC_UNEXPECTED_ERROR;
933 END IF;
934 end if;
935
936 end if; --End AH
937
938 /* Is it Update Qty ?? If yes, go ahead */
939 elsif l_txn_header_rec.transaction_type_id = WSMPCNST.UPDATE_QUANTITY then
940
941 if l_starting_jobs_tbl.count <> 1 then
942 /* error out... */
943 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
944
945 l_msg_tokens.delete;
946 WSM_log_PVT.logMessage(p_module_name=> l_module ,
947 p_msg_name => 'WSM_START_LOT_REQUIRED',
948 p_msg_appl_name => 'WSM',
949 p_stmt_num => l_stmt_num ,
950 p_msg_tokens => l_msg_tokens ,
951 p_fnd_msg_level => G_MSG_LVL_ERROR ,
952 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
953 p_run_log_level => l_log_level
954 );
955 END IF;
956 RAISE FND_API.G_EXC_ERROR;
957 end if;
958
959 if l_resulting_jobs_tbl.count <> 1 then
960 /* error out... */
961 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
962
963 l_msg_tokens.delete;
964 WSM_log_PVT.logMessage(p_module_name=> l_module ,
965 p_msg_name => 'WSM_RESULT_LOT_REQUIRED',
966 p_msg_appl_name => 'WSM',
967 p_stmt_num => l_stmt_num ,
968 p_msg_tokens => l_msg_tokens ,
969 p_fnd_msg_level => G_MSG_LVL_ERROR ,
970 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
971 p_run_log_level => l_log_level
972 );
973 END IF;
974 RAISE FND_API.G_EXC_ERROR;
975 end if;
976
977 UPDATE_QUANTITY_TXN( p_api_version => 1.0,
978 p_commit => FND_API.G_FALSE,
979 p_init_msg_list => FND_API.G_TRUE,
980 p_validation_level => 0,
981 p_calling_mode => p_calling_mode,
982 p_wltx_header => l_txn_header_rec,
983 p_wltx_starting_job_rec => l_starting_jobs_tbl(l_starting_jobs_tbl.first),
984 p_wltx_resulting_job_rec => l_resulting_jobs_tbl(l_resulting_jobs_tbl.first),
985 p_wltx_secondary_qty_tbl => l_secondary_qty_tbl,
986 x_return_status => x_return_status,
987 x_msg_count => x_msg_count,
988 x_msg_data => x_error_msg
989 );
990
991
992 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
993 /* Txn errored....*/
994 /* Log the Procedure exit point.... */
995 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
996
997 l_msg_tokens.delete;
998 /* Bugfix 5352389 Changed p_fnd_log_level from ERROR to STATEMENT */
999 WSM_log_PVT.logMessage(p_module_name => l_module ,
1000 p_msg_text => 'Update Quantity Txn procedure failed.',
1001 p_stmt_num => l_stmt_num ,
1002 p_msg_tokens => l_msg_tokens,
1003 p_fnd_msg_level => G_MSG_LVL_ERROR ,
1004 p_fnd_log_level => G_LOG_LEVEL_STATEMENT ,
1005 p_run_log_level => l_log_level
1006 );
1007 END IF;
1008 RAISE FND_API.G_EXC_ERROR;
1009
1010 if x_return_status <> G_RET_SUCCESS then
1011 IF x_return_status = G_RET_ERROR THEN
1012 raise FND_API.G_EXC_ERROR;
1013 ELSIF x_return_status = G_RET_UNEXPECTED THEN
1014 raise FND_API.G_EXC_UNEXPECTED_ERROR;
1015 END IF;
1016 end if;
1017 end if; --End AH
1018
1019 /* Is it Update Lot Name ?? If yes, go ahead */
1020 elsif l_txn_header_rec.transaction_type_id = WSMPCNST.UPDATE_LOT_NAME then
1021
1022 if l_starting_jobs_tbl.count <> 1 then
1023 /* error out... */
1024 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
1025
1026 l_msg_tokens.delete;
1027 WSM_log_PVT.logMessage(p_module_name=> l_module ,
1028 p_msg_name => 'WSM_START_LOT_REQUIRED',
1029 p_msg_appl_name => 'WSM',
1030 p_msg_tokens => l_msg_tokens ,
1031 p_stmt_num => l_stmt_num ,
1032 p_fnd_msg_level => G_MSG_LVL_ERROR ,
1033 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
1034 p_run_log_level => l_log_level
1035 );
1036 END IF;
1037 RAISE FND_API.G_EXC_ERROR;
1038 end if;
1039
1040 if l_resulting_jobs_tbl.count <> 1 then
1041 /* error out... */
1042 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
1043
1044 l_msg_tokens.delete;
1045 WSM_log_PVT.logMessage(p_module_name=> l_module ,
1046 p_msg_name => 'WSM_RESULT_LOT_REQUIRED',
1047 p_msg_appl_name => 'WSM',
1048 p_msg_tokens => l_msg_tokens ,
1049 p_stmt_num => l_stmt_num ,
1050 p_fnd_msg_level => G_MSG_LVL_ERROR ,
1051 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
1052 p_run_log_level => l_log_level
1053 );
1054 END IF;
1055 RAISE FND_API.G_EXC_ERROR;
1056 end if;
1057
1058 UPDATE_LOTNAME_TXN( p_api_version => 1.0,
1059 p_commit => FND_API.G_FALSE,
1060 p_init_msg_list => FND_API.G_TRUE,
1061 p_validation_level => 0,
1062 p_calling_mode => p_calling_mode,
1063 p_wltx_header => l_txn_header_rec,
1064 p_wltx_starting_job_rec => l_starting_jobs_tbl(l_starting_jobs_tbl.first),
1065 p_wltx_resulting_job_rec => l_resulting_jobs_tbl(l_resulting_jobs_tbl.first),
1066 p_wltx_secondary_qty_tbl => l_secondary_qty_tbl,
1067 x_return_status => x_return_status,
1068 x_msg_count => x_msg_count,
1069 x_msg_data => x_error_msg
1070 );
1071
1072
1073 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
1074 /* Txn errored....*/
1075 /* Log the Procedure exit point.... */
1076 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
1077
1078 l_msg_tokens.delete;
1079 WSM_log_PVT.logMessage(p_module_name => l_module ,
1080 p_msg_text => 'Update Lot Name Txn procedure failed.',
1081 p_stmt_num => l_stmt_num ,
1082 p_msg_tokens => l_msg_tokens,
1083 p_fnd_msg_level => G_MSG_LVL_ERROR ,
1084 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
1085 p_run_log_level => l_log_level
1086 );
1087 END IF;
1088 RAISE FND_API.G_EXC_ERROR;
1089
1090
1091 if x_return_status <> G_RET_SUCCESS then
1092 IF x_return_status = G_RET_ERROR THEN
1093 raise FND_API.G_EXC_ERROR;
1094 ELSIF x_return_status = G_RET_UNEXPECTED THEN
1095 raise FND_API.G_EXC_UNEXPECTED_ERROR;
1096 END IF;
1097 end if;
1098
1099 end if; --End AH
1100
1101 elsif l_txn_header_rec.transaction_type_id = WSMPCNST.BONUS then
1102
1103 if l_resulting_jobs_tbl.count <> 1 then
1104 /* error out... */
1105 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
1106
1107 l_msg_tokens.delete;
1108 WSM_log_PVT.logMessage(p_module_name=> l_module ,
1109 p_msg_name => 'WSM_RESULT_LOT_REQUIRED',
1110 p_msg_appl_name => 'WSM',
1111 p_msg_tokens => l_msg_tokens ,
1112 p_stmt_num => l_stmt_num ,
1113 p_fnd_msg_level => G_MSG_LVL_ERROR ,
1114 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
1115 p_run_log_level => l_log_level
1116 );
1117 END IF;
1118 RAISE FND_API.G_EXC_ERROR;
1119 end if;
1120
1121 BONUS_TXN ( p_api_version => 1.0,
1122 p_commit => FND_API.G_FALSE,
1123 p_init_msg_list => FND_API.G_TRUE,
1124 p_validation_level => 0,
1125 p_calling_mode => p_calling_mode,
1126 p_wltx_header => l_txn_header_rec,
1127 p_wltx_resulting_job_rec => l_resulting_jobs_tbl(l_resulting_jobs_tbl.first),
1128 p_wltx_secondary_qty_tbl => l_secondary_qty_tbl,
1129 x_return_status => x_return_status,
1130 x_msg_count => x_msg_count,
1131 x_msg_data => x_error_msg
1132 );
1133
1134
1135 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
1136 /* Txn errored....*/
1137 /* Log the Procedure exit point.... */
1138 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
1139
1140 l_msg_tokens.delete;
1141 WSM_log_PVT.logMessage(p_module_name => l_module ,
1142 p_msg_text => 'Bonus Txn procedure failed.',
1143 p_stmt_num => l_stmt_num ,
1144 p_msg_tokens => l_msg_tokens,
1145 p_fnd_msg_level => G_MSG_LVL_ERROR ,
1146 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
1147 p_run_log_level => l_log_level
1148 );
1149 END IF;
1150 RAISE FND_API.G_EXC_ERROR;
1151
1152
1153 if x_return_status <> G_RET_SUCCESS then
1154 IF x_return_status = G_RET_ERROR THEN
1155 raise FND_API.G_EXC_ERROR;
1156 ELSIF x_return_status = G_RET_UNEXPECTED THEN
1157 raise FND_API.G_EXC_UNEXPECTED_ERROR;
1158 END IF;
1159 end if;
1160
1161 end if; --End AH
1162
1163 ELSE
1164 /* error out.... */
1165 null;
1166 end if;
1167
1168 -- ST : Commenting out the check on return status.. not required..
1169 if p_calling_mode <> 2 then
1170
1171 WSM_WLT_VALIDATE_PVT.insert_txn_data ( p_transaction_id => l_txn_header_rec.transaction_id,
1172 p_wltx_header => l_txn_header_rec,
1173 p_wltx_starting_jobs_tbl => l_starting_jobs_tbl,
1174 p_wltx_resulting_jobs_tbl => l_resulting_jobs_tbl,
1175 x_return_status => x_return_status,
1176 x_msg_count => x_msg_count,
1177 x_msg_data => x_error_msg
1178 );
1179
1180 if x_return_status <> fnd_api.g_ret_sts_success then
1181 --log error
1182 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
1183
1184 l_msg_tokens.delete;
1185 WSM_log_PVT.logMessage(p_module_name => l_module ,
1186 p_msg_text => 'WSM_WLT_VALIDATE_PVT.insert_txn_data failed',
1187 p_stmt_num => l_stmt_num ,
1188 p_msg_tokens => l_msg_tokens,
1189 p_fnd_msg_level => G_MSG_LVL_ERROR ,
1190 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
1191 p_run_log_level => l_log_level
1192 );
1193 END IF;
1194 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1195 end if;
1196
1197 -- Calling mode = 2 Indicates forms
1198 elsif p_calling_mode = 2 then
1199
1200 l_index := l_resulting_jobs_tbl.first;
1201
1202 while l_index is not null loop
1203 update wsm_sm_resulting_jobs
1204 set wip_entity_id = l_resulting_jobs_tbl(l_index).wip_entity_id,
1205 job_operation_seq_num = l_resulting_jobs_tbl(l_index).job_operation_seq_num
1206 where transaction_id = l_txn_header_rec.transaction_id
1207 and wip_entity_name = l_resulting_jobs_tbl(l_index).wip_entity_name;
1208
1209 l_index := l_resulting_jobs_tbl.next(l_index);
1210 end loop;
1211
1212 end if;
1213
1214 -- Invoke the WIP Lot Transaction Serial Processor...
1215 WSM_Serial_Support_PVT.WLT_serial_processor ( p_calling_mode => p_calling_mode ,
1216 p_wlt_txn_type => l_txn_header_rec.transaction_type_id ,
1217 p_organization_id => l_txn_header_rec.organization_id ,
1218 p_txn_id => l_txn_header_rec.transaction_id ,
1219 p_starting_jobs_tbl => l_starting_jobs_tbl ,
1220 p_resulting_jobs_tbl => l_resulting_jobs_tbl ,
1221 p_serial_num_tbl => l_wsm_serial_num_tbl ,
1222 x_return_status => x_return_status ,
1223 x_error_msg => x_error_msg ,
1224 x_error_count => x_msg_count
1225 );
1226
1227 if x_return_status <> G_RET_SUCCESS then
1228 IF x_return_status = G_RET_ERROR THEN
1229 raise FND_API.G_EXC_ERROR;
1230 ELSIF x_return_status = G_RET_UNEXPECTED THEN
1231 raise FND_API.G_EXC_UNEXPECTED_ERROR;
1232 END IF;
1233 end if;
1234
1235 if( g_log_level_statement >= l_log_level ) then
1236 l_msg_tokens.delete;
1237 WSM_log_PVT.logMessage(p_module_name => l_module ,
1238 p_msg_text => 'Returned sucessfully from WSM_Serial_Support_PVT.WLT_serial_processor',
1239 p_stmt_num => l_stmt_num ,
1240 p_msg_tokens => l_msg_tokens,
1241 p_fnd_log_level => g_log_level_statement,
1242 p_run_log_level => l_log_level
1243 );
1244 End if;
1245 --Bug 5263262:Req import was not invoked because of
1246 --incorrect check on l_request_id in WSMPJUPD.This has been fixed and
1247 --hence the following fix is not needed.
1248 -- Invoke the Req Processor if needed (for forms and MES)
1249 -- ST : Fix for bug 5263262 : Invoke the worker for MES, forms..
1250 -- For interface it will be done in a single shot in WSMPLOAD
1251 --IF nvl(p_invoke_req_worker,1) = 1 AND WSMPJUPD.g_osp_exists = 1 THEN
1252 -- l_poreq_request_id := fnd_request.submit_request('PO', 'REQIMPORT', NULL, NULL, FALSE,'WIP', NULL, 'ITEM',
1253 -- NULL ,'N', 'Y' , chr(0), NULL, NULL, NULL,
1254 -- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1255 -- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1256 -- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1257 -- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1258 -- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1259 -- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1260 -- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1261 -- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1262 -- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
1263 -- ) ;
1264 -- if( g_log_level_statement >= l_log_level ) then
1265 -- l_msg_tokens.delete;
1266 -- WSM_log_PVT.logMessage(p_module_name => l_module ,
1267 -- p_msg_text => 'Concurrent Request : ' || l_poreq_request_id || ' for Requisition Import Submitted',
1268 -- p_stmt_num => l_stmt_num ,
1269 -- p_msg_tokens => l_msg_tokens,
1270 -- p_fnd_log_level => g_log_level_statement,
1271 -- p_run_log_level => l_log_level
1272 -- );
1273 --End if;
1274 --END IF;
1275 -- ST : Fix for bug 5263262 End --
1276
1277 FND_MSG_PUB.Count_And_Get (p_encoded => 'F' ,
1278 p_count => x_msg_count ,
1279 p_data => x_error_msg
1280 );
1281
1282 if( g_log_level_statement >= l_log_level ) then
1283 l_msg_tokens.delete;
1284 WSM_log_PVT.logMessage(p_module_name => l_module ,
1285 p_msg_text => 'Invoke Txn API completed sucessfully',
1286 p_stmt_num => l_stmt_num ,
1287 p_msg_tokens => l_msg_tokens,
1288 p_fnd_log_level => g_log_level_statement,
1289 p_run_log_level => l_log_level
1290 );
1291 End if;
1292
1293 EXCEPTION
1294
1295 WHEN FND_API.G_EXC_ERROR THEN
1296
1297 x_return_status := G_RET_ERROR;
1298 FND_MSG_PUB.Count_And_Get (p_encoded => 'F' ,
1299 p_count => x_msg_count ,
1300 p_data => x_error_msg
1301 );
1302
1303 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1304
1305 x_return_status := G_RET_UNEXPECTED;
1306
1307 FND_MSG_PUB.Count_And_Get (p_encoded => 'F' ,
1308 p_count => x_msg_count ,
1309 p_data => x_error_msg
1310
1311 );
1312 WHEN OTHERS THEN
1313
1314 x_return_status := G_RET_UNEXPECTED;
1315
1316 IF (G_LOG_LEVEL_UNEXPECTED >= l_log_level) OR
1317 (FND_MSG_PUB.check_msg_level(G_MSG_LVL_UNEXP_ERROR))
1318 THEN
1319 WSM_log_PVT.handle_others( p_module_name => l_module ,
1320 p_stmt_num => l_stmt_num ,
1321 p_fnd_log_level => G_LOG_LEVEL_UNEXPECTED ,
1322 p_run_log_level => l_log_level
1323 );
1324 END IF;
1325
1326 FND_MSG_PUB.Count_And_Get (p_encoded => 'F' ,
1327 p_count => x_msg_count ,
1328 p_data => x_error_msg
1329
1330 );
1331 END;
1332
1333 /* API for Split transaction.... */
1334 PROCEDURE SPLIT_TXN ( p_api_version IN NUMBER,
1335 p_commit IN VARCHAR2 DEFAULT NULL,
1336 p_init_msg_list IN VARCHAR2 DEFAULT NULL,
1337 p_validation_level IN NUMBER DEFAULT NULL,
1338 p_calling_mode IN NUMBER,
1339 p_wltx_header IN OUT NOCOPY WLTX_TRANSACTIONS_REC_TYPE,
1340 p_wltx_starting_job_rec IN OUT NOCOPY WLTX_STARTING_JOBS_REC_TYPE,
1341 p_wltx_resulting_jobs_tbl IN OUT NOCOPY WLTX_RESULTING_JOBS_TBL_TYPE,
1342 p_wltx_secondary_qty_tbl IN OUT NOCOPY WSM_JOB_SECONDARY_QTY_TBL_TYPE ,
1343 x_return_status OUT NOCOPY VARCHAR2,
1344 x_msg_count OUT NOCOPY NUMBER,
1345 x_msg_data OUT NOCOPY VARCHAR2
1346 ) IS
1347
1348
1349 /* API version stored locally */
1350 l_api_version NUMBER := 1.0;
1351 l_api_name VARCHAR2(20) := 'SPLIT_TXN';
1352
1353
1354 /* Other locals */
1355 l_txn_id NUMBER;
1356 i NUMBER;
1357
1358 /* Have to create a table.... for the starting job */
1359 l_wltx_starting_jobs_tbl WLTX_STARTING_JOBS_TBL_TYPE;
1360
1361 -- Logging variables.....
1362 l_msg_tokens WSM_Log_PVT.token_rec_tbl;
1363 l_log_level number := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
1364 l_stmt_num NUMBER;
1365 l_module VARCHAR2(100) := 'wsm.plsql.WSM_WIP_LOT_TXN_PVT.SPLIT_TXN';
1366 -- Logging variables...
1367
1368 BEGIN
1369
1370 /* Have a starting point */
1371 savepoint start_split_txn;
1372
1373 l_stmt_num := 10;
1374 /* Initialize API return status to success */
1375 x_return_status := G_RET_SUCCESS;
1376 x_msg_count := NULL;
1377 x_msg_data := 0;
1378
1379 /* Log the Procedure entry point.... */
1380 if( g_log_level_statement >= l_log_level ) then
1381 l_msg_tokens.delete;
1382 WSM_log_PVT.logMessage(p_module_name => l_module ,
1383 p_msg_text => 'Entered Split Txn procedure' ,
1384 p_stmt_num => l_stmt_num ,
1385 p_msg_tokens => l_msg_tokens,
1386 p_fnd_log_level => g_log_level_statement,
1387 p_run_log_level => l_log_level
1388 );
1389 End if;
1390
1391 l_stmt_num := 20;
1392
1393 /* Initialize message list if p_init_msg_list is set to TRUE. */
1394 IF FND_API.to_Boolean( p_init_msg_list ) THEN
1395 l_stmt_num := 30;
1396 FND_MSG_PUB.initialize;
1397 end if;
1398
1399 l_stmt_num := 40;
1400
1401 /* Check for the API compatibilty */
1402 IF NOT FND_API.Compatible_API_Call( l_api_version,
1403 p_api_version,
1404 g_pkg_name,
1405 l_api_name
1406 )
1407 THEN
1408 /* Incompatible versions...*/
1409 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
1410
1411 l_msg_tokens.delete;
1412 WSM_log_PVT.logMessage(p_module_name => l_module ,
1413 p_msg_text => 'Incompatible API called for Split Txn',
1414 p_stmt_num => l_stmt_num ,
1415 p_msg_tokens => l_msg_tokens,
1416 p_fnd_msg_level => G_MSG_LVL_ERROR ,
1417 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
1418 p_run_log_level => l_log_level
1419 );
1420 END IF;
1421 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1422 END IF;
1423
1424
1425 /* logginng .... */
1426 if( g_log_level_statement >= l_log_level ) then
1427 l_msg_tokens.delete;
1428 WSM_log_PVT.logMessage(p_module_name => l_module ,
1429 p_msg_text => 'API compatibility succeeded' ,
1430 p_stmt_num => l_stmt_num ,
1431 p_msg_tokens => l_msg_tokens,
1432 p_fnd_log_level => g_log_level_statement,
1433 p_run_log_level => l_log_level
1434 );
1435 End if;
1436
1437 if p_calling_mode <> 2 then --if Interface /MES then do the validations
1438
1439 l_stmt_num := 50;
1440
1441 /* Txn Header Validation.................... */
1442
1443 /* Log the Procedure entry point.... */
1444 if( g_log_level_statement >= l_log_level ) then
1445 l_msg_tokens.delete;
1446 WSM_log_PVT.logMessage(p_module_name => l_module ,
1447 p_msg_text => 'Calling WSM_WLT_VALIDATE_PVT.validate_txn_details',
1448 p_stmt_num => l_stmt_num ,
1449 p_msg_tokens => l_msg_tokens,
1450 p_fnd_log_level => g_log_level_statement,
1451 p_run_log_level => l_log_level
1452 );
1453 End if;
1454
1455 WSM_WLT_VALIDATE_PVT.validate_txn_header ( p_wltx_header => p_wltx_header,
1456 x_return_status => x_return_status,
1457 x_msg_count => x_msg_count,
1458 x_msg_data => x_msg_data
1459 );
1460
1461 /* End header Validation */
1462
1463 /* Log the Procedure exit point.... */
1464 if( g_log_level_statement >= l_log_level ) then
1465 l_msg_tokens.delete;
1466 WSM_log_PVT.logMessage(p_module_name => l_module ,
1467 p_msg_text => 'Returning from WSM_WLT_VALIDATE_PVT.validate_txn_header',
1468 p_stmt_num => l_stmt_num ,
1469 p_msg_tokens => l_msg_tokens,
1470 p_fnd_log_level => g_log_level_statement,
1471 p_run_log_level => l_log_level
1472 );
1473 End if;
1474
1475 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
1476 /* Txn errored....*/
1477 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
1478
1479 l_msg_tokens.delete;
1480 WSM_log_PVT.logMessage(p_module_name => l_module ,
1481 p_msg_text => 'validate_txn_header failed.' ,
1482 p_stmt_num => l_stmt_num ,
1483 p_msg_tokens => l_msg_tokens,
1484 p_fnd_msg_level => G_MSG_LVL_ERROR ,
1485 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
1486 p_run_log_level => l_log_level
1487 );
1488 END IF;
1489 if x_return_status <> G_RET_SUCCESS then
1490 IF x_return_status = G_RET_ERROR THEN
1491 raise FND_API.G_EXC_ERROR;
1492 ELSIF x_return_status = G_RET_UNEXPECTED THEN
1493 raise FND_API.G_EXC_UNEXPECTED_ERROR;
1494 END IF;
1495 end if;
1496 end if;
1497
1498 /* Log the Procedure exit point.... */
1499 if( g_log_level_statement >= l_log_level ) then
1500 l_msg_tokens.delete;
1501 WSM_log_PVT.logMessage(p_module_name => l_module ,
1502 p_msg_text => 'Validated the Transaction Header Information .... Success ' ,
1503 p_stmt_num => l_stmt_num ,
1504 p_msg_tokens => l_msg_tokens,
1505 p_fnd_log_level => g_log_level_statement,
1506 p_run_log_level => l_log_level
1507 );
1508 End if;
1509
1510 l_stmt_num := 60;
1511
1512 /* Here we actually call the code to default the job details... */
1513
1514 /* Log the Procedure entry point.... */
1515 if( g_log_level_statement >= l_log_level ) then
1516 l_msg_tokens.delete;
1517 WSM_log_PVT.logMessage(p_module_name => l_module ,
1518 p_msg_text => 'Calling WSM_WLT_VALIDATE_PVT.default_starting_job_details',
1519 p_stmt_num => l_stmt_num ,
1520 p_msg_tokens => l_msg_tokens,
1521 p_fnd_log_level => g_log_level_statement,
1522 p_run_log_level => l_log_level
1523 );
1524 End if;
1525
1526 WSM_WLT_VALIDATE_PVT.derive_val_st_job_details ( p_txn_type => p_wltx_header.transaction_type_id,
1527 p_txn_org_id => p_wltx_header.organization_id,
1528 -- ST : Added for bug fix 4351071
1529 p_txn_date => p_wltx_header.transaction_date,
1530 p_starting_job_rec => p_wltx_starting_job_rec,
1531 x_return_status => x_return_status,
1532 x_msg_count => x_msg_count,
1533 x_msg_data => x_msg_data
1534 );
1535
1536 /* Log the Procedure exit point.... */
1537 if( g_log_level_statement >= l_log_level ) then
1538 l_msg_tokens.delete;
1539 WSM_log_PVT.logMessage(p_module_name => l_module ,
1540 p_msg_text => 'Returning from WSM_WLT_VALIDATE_PVT.default_starting_job_details',
1541 p_stmt_num => l_stmt_num ,
1542 p_msg_tokens => l_msg_tokens,
1543 p_fnd_log_level => g_log_level_statement,
1544 p_run_log_level => l_log_level
1545 );
1546 End if;
1547
1548
1549 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
1550 /* Txn errored....*/
1551 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
1552
1553 l_msg_tokens.delete;
1554 WSM_log_PVT.logMessage(p_module_name => l_module ,
1555 p_msg_text => 'derive_val_st_job_details failed.' ,
1556 p_stmt_num => l_stmt_num ,
1557 p_msg_tokens => l_msg_tokens,
1558 p_fnd_msg_level => G_MSG_LVL_ERROR ,
1559 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
1560 p_run_log_level => l_log_level
1561 );
1562 END IF;
1563 if x_return_status <> G_RET_SUCCESS then
1564 IF x_return_status = G_RET_ERROR THEN
1565 raise FND_API.G_EXC_ERROR;
1566 ELSIF x_return_status = G_RET_UNEXPECTED THEN
1567 raise FND_API.G_EXC_UNEXPECTED_ERROR;
1568 END IF;
1569 end if;
1570 end if;
1571
1572 /* Log the Procedure exit point.... */
1573 if( g_log_level_statement >= l_log_level ) then
1574 l_msg_tokens.delete;
1575 WSM_log_PVT.logMessage(p_module_name => l_module ,
1576 p_msg_text => 'Defaulting the starting job details ... Success ',
1577 p_stmt_num => l_stmt_num ,
1578 p_msg_tokens => l_msg_tokens,
1579 p_fnd_log_level => g_log_level_statement,
1580 p_run_log_level => l_log_level
1581 );
1582 End if;
1583
1584 l_stmt_num := 70;
1585
1586 /* Log the Procedure entry point.... */
1587 if( g_log_level_statement >= l_log_level ) then
1588 l_msg_tokens.delete;
1589 WSM_log_PVT.logMessage(p_module_name => l_module ,
1590 p_msg_text => 'Calling WSM_WLT_VALIDATE_PVT.validate_resulting_job ',
1591 p_stmt_num => l_stmt_num ,
1592 p_msg_tokens => l_msg_tokens,
1593 p_fnd_log_level => g_log_level_statement,
1594 p_run_log_level => l_log_level
1595 );
1596 End if;
1597
1598 /* This validates the main job details...... */
1599
1600 WSM_WLT_VALIDATE_PVT.derive_val_res_job_details( p_txn_org_id => p_wltx_header.organization_id,
1601 p_txn_type => p_wltx_header.transaction_type_id,
1602 p_starting_job_rec => p_wltx_starting_job_rec,
1603 p_resulting_jobs_tbl => p_wltx_resulting_jobs_tbl,
1604 x_return_status => x_return_status,
1605 x_msg_count => x_msg_count,
1606 x_msg_data => x_msg_data
1607 );
1608
1609 /* Log the Procedure exit point.... */
1610 if( g_log_level_statement >= l_log_level ) then
1611 l_msg_tokens.delete;
1612 WSM_log_PVT.logMessage(p_module_name => l_module ,
1613 p_msg_text => 'Returning from WSM_WLT_VALIDATE_PVT.validate_resulting_job',
1614 p_stmt_num => l_stmt_num ,
1615 p_msg_tokens => l_msg_tokens,
1616 p_fnd_log_level => g_log_level_statement,
1617 p_run_log_level => l_log_level
1618 );
1619 End if;
1620
1621 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
1622 /* Txn errored....*/
1623 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
1624
1625 l_msg_tokens.delete;
1626 /* Bugfix 5438722 Changed p_fnd_log_level from ERROR to STATEMENT */
1627 WSM_log_PVT.logMessage(p_module_name => l_module ,
1628 p_msg_text => 'derive_val_res_job_details failed.'||x_return_status,
1629 p_stmt_num => l_stmt_num ,
1630 p_msg_tokens => l_msg_tokens,
1631 p_fnd_msg_level => G_MSG_LVL_ERROR ,
1632 p_fnd_log_level => G_LOG_LEVEL_STATEMENT ,
1633 p_run_log_level => l_log_level
1634 );
1635 END IF;
1636 if x_return_status <> G_RET_SUCCESS then
1637 IF x_return_status = G_RET_ERROR THEN
1638 raise FND_API.G_EXC_ERROR;
1639 ELSIF x_return_status = G_RET_UNEXPECTED THEN
1640 raise FND_API.G_EXC_UNEXPECTED_ERROR;
1641 END IF;
1642 end if;
1643 end if;
1644 /* Log the Procedure exit point.... */
1645 if( g_log_level_statement >= l_log_level ) then
1646 l_msg_tokens.delete;
1647 WSM_log_PVT.logMessage(p_module_name => l_module ,
1648 p_msg_text => 'Validation of the resulting jobs details ... Success',
1649 p_stmt_num => l_stmt_num ,
1650 p_msg_tokens => l_msg_tokens,
1651 p_fnd_log_level => g_log_level_statement,
1652 p_run_log_level => l_log_level
1653 );
1654 End if;
1655
1656 /* Validation and default completed....*/
1657 end if; --Validation for interface/MES ended
1658
1659 l_stmt_num := 120;
1660
1661 /* Log the Procedure entry point.... */
1662 if( g_log_level_statement >= l_log_level ) then
1663 l_msg_tokens.delete;
1664 WSM_log_PVT.logMessage(p_module_name => l_module ,
1665 p_msg_text => 'Calling WWSMPJUPD.PROCESS_LOTS : Transaction Id : ' || l_txn_id ,
1666 p_stmt_num => l_stmt_num ,
1667 p_msg_tokens => l_msg_tokens,
1668 p_fnd_log_level => g_log_level_statement,
1669 p_run_log_level => l_log_level
1670 );
1671 End if;
1672
1673 l_wltx_starting_jobs_tbl(1) := (p_wltx_starting_job_rec);
1674
1675 /* call Process lots now....*/
1676 WSMPJUPD.PROCESS_LOTS (p_copy_qa => null,
1677 p_txn_org_id => p_wltx_header.organization_id,
1678 p_rep_job_index => l_wltx_starting_jobs_tbl.first,
1679 p_wltx_header => p_wltx_header,
1680 p_wltx_starting_jobs_tbl => l_wltx_starting_jobs_tbl,
1681 p_wltx_resulting_jobs_tbl => p_wltx_resulting_jobs_tbl,
1682 p_secondary_qty_tbl => p_wltx_secondary_qty_tbl,
1683 x_return_status => x_return_status,
1684 x_msg_count => x_msg_count,
1685 x_error_msg => x_msg_data
1686 );
1687
1688 /* Log the Procedure exit point.... */
1689 if( g_log_level_statement >= l_log_level ) then
1690 l_msg_tokens.delete;
1691 WSM_log_PVT.logMessage(p_module_name => l_module ,
1692 p_msg_text => 'Returning from WWSMPJUPD.PROCESS_LOTS',
1693 p_stmt_num => l_stmt_num ,
1694 p_msg_tokens => l_msg_tokens,
1695 p_fnd_log_level => g_log_level_statement,
1696 p_run_log_level => l_log_level
1697 );
1698 End if;
1699
1700 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
1701 /* Txn errored....*/
1702 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
1703
1704 l_msg_tokens.delete;
1705 WSM_log_PVT.logMessage(p_module_name => l_module ,
1706 p_msg_text => 'PROCESS_LOTS failed.' ,
1707 p_stmt_num => l_stmt_num ,
1708 p_msg_tokens => l_msg_tokens,
1709 p_fnd_msg_level => G_MSG_LVL_ERROR ,
1710 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
1711 p_run_log_level => l_log_level
1712 );
1713 END IF;
1714 if x_return_status <> G_RET_SUCCESS then
1715 IF x_return_status = G_RET_ERROR THEN
1716 raise FND_API.G_EXC_ERROR;
1717 ELSIF x_return_status = G_RET_UNEXPECTED THEN
1718 raise FND_API.G_EXC_UNEXPECTED_ERROR;
1719 END IF;
1720 end if;
1721 end if;
1722
1723 -- Assign back...
1724 p_wltx_starting_job_rec := l_wltx_starting_jobs_tbl(1);
1725
1726 /* Log the Procedure exit point.... */
1727 if( g_log_level_statement >= l_log_level ) then
1728 l_msg_tokens.delete;
1729 WSM_log_PVT.logMessage(p_module_name => l_module ,
1730 p_msg_text => 'Processing of the Wip Lot Transaction ... Success',
1731 p_stmt_num => l_stmt_num ,
1732 p_msg_tokens => l_msg_tokens,
1733 p_fnd_log_level => g_log_level_statement,
1734 p_run_log_level => l_log_level
1735 );
1736 End if;
1737
1738 l_stmt_num := 130;
1739 /* Standard check of p_commit. */
1740 IF FND_API.To_Boolean( p_commit ) THEN
1741 l_stmt_num := 140;
1742
1743 COMMIT;
1744 /* Log the Procedure exit point.... */
1745 --'WIp Lot Transaction ... Commit complete')
1746 if( g_log_level_statement >= l_log_level ) then
1747 l_msg_tokens.delete;
1748 WSM_log_PVT.logMessage(p_module_name => l_module ,
1749 p_msg_text => 'Wip Lot Transaction ... Commit complete',
1750 p_stmt_num => l_stmt_num ,
1751 p_msg_tokens => l_msg_tokens,
1752 p_fnd_log_level => g_log_level_statement,
1753 p_run_log_level => l_log_level
1754 );
1755 End if;
1756 END IF;
1757
1758
1759 EXCEPTION
1760
1761 WHEN FND_API.G_EXC_ERROR THEN
1762 ROLLBACK TO start_split_txn;
1763
1764 x_return_status := G_RET_ERROR;
1765 FND_MSG_PUB.Count_And_Get (p_encoded => 'F' ,
1766 p_count => x_msg_count ,
1767 p_data => x_msg_data
1768 );
1769
1770 -- remove this later...
1771
1772 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1773
1774 ROLLBACK TO start_split_txn;
1775
1776 x_return_status := G_RET_UNEXPECTED;
1777
1778 FND_MSG_PUB.Count_And_Get (p_encoded => 'F' ,
1779 p_count => x_msg_count ,
1780 p_data => x_msg_data
1781 );
1782 -- remove this later...
1783
1784 WHEN OTHERS THEN
1785
1786 ROLLBACK TO start_split_txn;
1787
1788 x_return_status := G_RET_UNEXPECTED;
1789
1790 IF (G_LOG_LEVEL_UNEXPECTED >= l_log_level) OR
1791 (FND_MSG_PUB.check_msg_level(G_MSG_LVL_UNEXP_ERROR))
1792 THEN
1793 WSM_log_PVT.handle_others( p_module_name => l_module ,
1794 p_stmt_num => l_stmt_num ,
1795 p_fnd_log_level => G_LOG_LEVEL_UNEXPECTED ,
1796 p_run_log_level => l_log_level
1797 );
1798 END IF;
1799
1800 FND_MSG_PUB.Count_And_Get (p_encoded => 'F' ,
1801 p_count => x_msg_count ,
1802 p_data => x_msg_data
1803 );
1804
1805 END;
1806
1807
1808 /* API for Merge transaction.... */
1809 PROCEDURE MERGE_TXN ( p_api_version IN NUMBER,
1810 p_commit IN VARCHAR2 DEFAULT NULL,
1811 p_init_msg_list IN VARCHAR2 DEFAULT NULL,
1812 p_validation_level IN NUMBER DEFAULT NULL,
1813 p_calling_mode IN NUMBER,
1814 p_wltx_header IN OUT NOCOPY WLTX_TRANSACTIONS_REC_TYPE,
1815 p_wltx_starting_jobs_tbl IN OUT NOCOPY WLTX_STARTING_JOBS_TBL_TYPE,
1816 p_wltx_resulting_job_rec IN OUT NOCOPY WLTX_RESULTING_JOBS_REC_TYPE,
1817 p_wltx_secondary_qty_tbl IN OUT NOCOPY WSM_JOB_SECONDARY_QTY_TBL_TYPE ,
1818 x_return_status OUT NOCOPY VARCHAR2,
1819 x_msg_count OUT NOCOPY NUMBER,
1820 x_msg_data OUT NOCOPY VARCHAR2
1821 ) IS
1822
1823
1824 /* API version stored locally */
1825 l_api_version NUMBER := 1.0;
1826 l_api_name VARCHAR2(20) := 'MERGE_TXN';
1827
1828
1829 /* Other locals */
1830 l_txn_id NUMBER;
1831 l_rep_job_index NUMBER;
1832 l_total_avail_quantity NUMBER := 0; --Add AH
1833 l_total_net_quantity NUMBER := 0; --Add AH
1834 i NUMBER;
1835 l_job_serial_code NUMBER;
1836
1837 /* Have to create a table.... for the starting job */
1838 l_wltx_starting_jobs_tbl WLTX_STARTING_JOBS_TBL_TYPE;
1839 l_wltx_rep_job_rec WLTX_STARTING_JOBS_REC_TYPE; --Add AH
1840
1841 -- Logging variables.....
1842 l_msg_tokens WSM_Log_PVT.token_rec_tbl;
1843 l_log_level number := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
1844
1845 l_stmt_num NUMBER;
1846 l_module VARCHAR2(100) := 'wsm.plsql.WSM_WIP_LOT_TXN_PVT.MERGE_TXN';
1847 -- Logging variables...
1848
1849 /* Have to create a table.... for the starting job */
1850 l_wltx_resulting_jobs_tbl WLTX_RESULTING_JOBS_TBL_TYPE;
1851
1852 BEGIN
1853 /* Have a starting point */
1854 savepoint start_merge_txn;
1855
1856 l_stmt_num := 10;
1857 /* Initialize API return status to success */
1858 x_return_status := G_RET_SUCCESS;
1859 x_msg_count := NULL;
1860 x_msg_data := 0;
1861
1862 /* Log the Procedure entry point.... */
1863 if( g_log_level_statement >= l_log_level ) then
1864 l_msg_tokens.delete;
1865 WSM_log_PVT.logMessage(p_module_name => l_module ,
1866 p_msg_text => 'Entering the Merge_Txn API' ,
1867 p_stmt_num => l_stmt_num ,
1868 p_msg_tokens => l_msg_tokens,
1869 p_fnd_log_level => g_log_level_statement,
1870 p_run_log_level => l_log_level
1871 );
1872 End if;
1873
1874 /* W'll log the parameter values as and where they get modified....*/
1875 /* Log the standard api parameters.... */
1876 l_stmt_num := 20;
1877
1878 IF FND_API.to_Boolean( p_init_msg_list ) THEN
1879 l_stmt_num := 30;
1880 FND_MSG_PUB.initialize;
1881 /* Message list enabled....-- EVENT */
1882 --'FND_MSG_PUB Message Table Initialized'
1883 end if;
1884
1885 /* Log the Procedure entry point.... */
1886 --'Calling FND_API.Compatible_API_Call');
1887
1888 l_stmt_num := 40;
1889
1890 /* Check for the API compatibilty */
1891 IF NOT FND_API.Compatible_API_Call( l_api_version,
1892 p_api_version,
1893 g_pkg_name,
1894 l_api_name
1895 )
1896 THEN
1897 /* Incompatible versions...*/
1898 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
1899
1900 l_msg_tokens.delete;
1901 WSM_log_PVT.logMessage(p_module_name => l_module ,
1902 p_msg_text => 'Incompatible API called for Merge Txn',
1903 p_stmt_num => l_stmt_num ,
1904 p_msg_tokens => l_msg_tokens,
1905 p_fnd_msg_level => G_MSG_LVL_ERROR ,
1906 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
1907 p_run_log_level => l_log_level
1908 );
1909 END IF;
1910 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1911
1912 END IF;
1913 /* lgging -proc level */
1914 --'API compatibility success ');
1915
1916 if p_calling_mode <> 2 then
1917 l_stmt_num := 50; --Start AH
1918
1919 /* Txn Header Validation.................... */
1920
1921 /* Log the Procedure entry point.... */
1922 if( g_log_level_statement >= l_log_level ) then
1923 l_msg_tokens.delete;
1924 WSM_log_PVT.logMessage(p_module_name => l_module ,
1925 p_msg_text => 'Calling WSM_WLT_VALIDATE_PVT.validate_txn_details',
1926 p_stmt_num => l_stmt_num ,
1927 p_msg_tokens => l_msg_tokens,
1928 p_fnd_log_level => g_log_level_statement,
1929 p_run_log_level => l_log_level
1930 );
1931 End if;
1932 WSM_WLT_VALIDATE_PVT.validate_txn_header ( p_wltx_header => p_wltx_header,
1933 x_return_status => x_return_status,
1934 x_msg_count => x_msg_count,
1935 x_msg_data => x_msg_data
1936 );
1937
1938 /* End header Validation */
1939 /* Log the Procedure exit point.... */
1940 if( g_log_level_statement >= l_log_level ) then
1941 l_msg_tokens.delete;
1942 WSM_log_PVT.logMessage(p_module_name => l_module ,
1943 p_msg_text => 'Returning from WSM_WLT_VALIDATE_PVT.validate_txn_header',
1944 p_stmt_num => l_stmt_num ,
1945 p_msg_tokens => l_msg_tokens,
1946 p_fnd_log_level => g_log_level_statement,
1947 p_run_log_level => l_log_level
1948 );
1949 End if;
1950
1951 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
1952 /* Txn errored....*/
1953 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
1954
1955 l_msg_tokens.delete;
1956 WSM_log_PVT.logMessage(p_module_name => l_module ,
1957 p_msg_text => 'validate_txn_header failed.' ,
1958 p_stmt_num => l_stmt_num ,
1959 p_msg_tokens => l_msg_tokens,
1960 p_fnd_msg_level => G_MSG_LVL_ERROR ,
1961 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
1962 p_run_log_level => l_log_level
1963 );
1964 END IF;
1965 if x_return_status <> G_RET_SUCCESS then
1966 IF x_return_status = G_RET_ERROR THEN
1967 raise FND_API.G_EXC_ERROR;
1968 ELSIF x_return_status = G_RET_UNEXPECTED THEN
1969 raise FND_API.G_EXC_UNEXPECTED_ERROR;
1970 END IF;
1971 end if;
1972 end if;
1973
1974 /* Log the Procedure exit point....event level */
1975 if( g_log_level_statement >= l_log_level ) then
1976 l_msg_tokens.delete;
1977 WSM_log_PVT.logMessage(p_module_name => l_module ,
1978 p_msg_text => 'Validated the Transaction Header Information .... Success ' ,
1979 p_stmt_num => l_stmt_num ,
1980 p_msg_tokens => l_msg_tokens,
1981 p_fnd_log_level => g_log_level_statement,
1982 p_run_log_level => l_log_level
1983 );
1984 End if;
1985
1986 l_stmt_num := 60;
1987
1988 /* Here we actually call the code to default the job details... */
1989 /* Log the Procedure entry point.... proc level*/
1990 if( g_log_level_statement >= l_log_level ) then
1991 l_msg_tokens.delete;
1992 WSM_log_PVT.logMessage(p_module_name => l_module ,
1993 p_msg_text => 'Calling WSM_WLT_VALIDATE_PVT.default_starting_job_details',
1994 p_stmt_num => l_stmt_num ,
1995 p_msg_tokens => l_msg_tokens,
1996 p_fnd_log_level => g_log_level_statement,
1997 p_run_log_level => l_log_level
1998 );
1999 End if;
2000
2001 WSM_WLT_VALIDATE_PVT.derive_val_st_job_details( p_txn_org_id => p_wltx_header.organization_id,
2002 p_txn_type => p_wltx_header.transaction_type_id,
2003 -- ST : Added for bug fix 4351071
2004 p_txn_date => p_wltx_header.transaction_date,
2005 p_starting_jobs_tbl => p_wltx_starting_jobs_tbl,
2006 p_rep_job_index => l_rep_job_index,
2007 p_total_avail_quantity => l_total_avail_quantity,
2008 p_total_net_quantity => l_total_net_quantity,
2009 -- ST : Serial Support Project Added for serial...
2010 x_job_serial_code => l_job_serial_code,
2011 x_return_status => x_return_status,
2012 x_msg_count => x_msg_count,
2013 x_msg_data => x_msg_data
2014 );
2015
2016 /* Log the Procedure exit point....proc level,stmt level*/
2017 if( g_log_level_statement >= l_log_level ) then
2018 l_msg_tokens.delete;
2019 WSM_log_PVT.logMessage(p_module_name => l_module ,
2020 p_msg_text => 'Returning from WSM_WLT_VALIDATE_PVT.default_starting_job_details',
2021 p_stmt_num => l_stmt_num ,
2022 p_msg_tokens => l_msg_tokens,
2023 p_fnd_log_level => g_log_level_statement,
2024 p_run_log_level => l_log_level
2025 );
2026 End if;
2027
2028 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
2029 /* Txn errored....*/
2030 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
2031
2032 l_msg_tokens.delete;
2033 WSM_log_PVT.logMessage(p_module_name => l_module ,
2034 p_msg_text => 'derive_val_st_job_details failed.' ,
2035 p_stmt_num => l_stmt_num ,
2036 p_msg_tokens => l_msg_tokens,
2037 p_fnd_msg_level => G_MSG_LVL_ERROR ,
2038 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
2039 p_run_log_level => l_log_level
2040 );
2041 END IF;
2042 if x_return_status <> G_RET_SUCCESS then
2043 IF x_return_status = G_RET_ERROR THEN
2044 raise FND_API.G_EXC_ERROR;
2045 ELSIF x_return_status = G_RET_UNEXPECTED THEN
2046 raise FND_API.G_EXC_UNEXPECTED_ERROR;
2047 END IF;
2048 end if;
2049 end if;
2050
2051 /* Log the Procedure exit point.... */
2052 if( g_log_level_statement >= l_log_level ) then
2053 l_msg_tokens.delete;
2054 WSM_log_PVT.logMessage(p_module_name => l_module ,
2055 p_msg_text => 'Defaulting the starting job details ... Success ',
2056 p_stmt_num => l_stmt_num ,
2057 p_msg_tokens => l_msg_tokens,
2058 p_fnd_log_level => g_log_level_statement,
2059 p_run_log_level => l_log_level
2060 );
2061 End if;
2062
2063 l_stmt_num := 70;
2064
2065 /* Log the Procedure entry point....proc level */
2066 if( g_log_level_statement >= l_log_level ) then
2067 l_msg_tokens.delete;
2068 WSM_log_PVT.logMessage(p_module_name => l_module ,
2069 p_msg_text => 'Calling WSM_WLT_VALIDATE_PVT.validate_resulting_job ',
2070 p_stmt_num => l_stmt_num ,
2071 p_msg_tokens => l_msg_tokens,
2072 p_fnd_log_level => g_log_level_statement,
2073 p_run_log_level => l_log_level
2074 );
2075 End if;
2076
2077 /* This validates the main job details.....specific to merge.... */
2078 /* Before calling derive validate for resulting jobs,assign the representative job details to a local pl/sql record*/
2079 l_wltx_rep_job_rec := p_wltx_starting_jobs_tbl(l_rep_job_index); --Is this the expected way? (AH)
2080
2081 WSM_WLT_VALIDATE_PVT.derive_val_res_job_details( p_txn_type => p_wltx_header.transaction_type_id,
2082 p_txn_org_id => p_wltx_header.organization_id,
2083 p_starting_job_rec => l_wltx_rep_job_rec,
2084 p_job_quantity => l_total_avail_quantity,
2085 p_job_net_quantity => l_total_net_quantity,
2086 p_job_serial_code => l_job_serial_code,
2087 p_resulting_job_rec => p_wltx_resulting_job_rec,
2088 x_return_status => x_return_status,
2089 x_msg_count => x_msg_count,
2090 x_msg_data => x_msg_data
2091 );
2092
2093
2094 /* Log the Procedure exit point.... */
2095 if( g_log_level_statement >= l_log_level ) then
2096 l_msg_tokens.delete;
2097 WSM_log_PVT.logMessage(p_module_name => l_module ,
2098 p_msg_text => 'Returning from WSM_WLT_VALIDATE_PVT.validate_resulting_job',
2099 p_stmt_num => l_stmt_num ,
2100 p_msg_tokens => l_msg_tokens,
2101 p_fnd_log_level => g_log_level_statement,
2102 p_run_log_level => l_log_level
2103 );
2104 End if;
2105
2106 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
2107 /* Txn errored....*/
2108 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
2109
2110 l_msg_tokens.delete;
2111 WSM_log_PVT.logMessage(p_module_name => l_module ,
2112 p_msg_text => 'derive_val_res_job_details failed.' ,
2113 p_stmt_num => l_stmt_num ,
2114 p_msg_tokens => l_msg_tokens,
2115 p_fnd_msg_level => G_MSG_LVL_ERROR ,
2116 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
2117 p_run_log_level => l_log_level
2118 );
2119 END IF;
2120 if x_return_status <> G_RET_SUCCESS then
2121 IF x_return_status = G_RET_ERROR THEN
2122 raise FND_API.G_EXC_ERROR;
2123 ELSIF x_return_status = G_RET_UNEXPECTED THEN
2124 raise FND_API.G_EXC_UNEXPECTED_ERROR;
2125 END IF;
2126 end if;
2127 end if;
2128
2129 /* Log the Procedure exit point.... */
2130 if( g_log_level_statement >= l_log_level ) then
2131 l_msg_tokens.delete;
2132 WSM_log_PVT.logMessage(p_module_name => l_module ,
2133 p_msg_text => 'Validation of the resulting jobs details ... Success',
2134 p_stmt_num => l_stmt_num ,
2135 p_msg_tokens => l_msg_tokens,
2136 p_fnd_log_level => g_log_level_statement,
2137 p_run_log_level => l_log_level
2138 );
2139 End if;
2140
2141 /* Validation and default completed....*/
2142 else
2143 for l_counter in p_wltx_starting_jobs_tbl.first .. p_wltx_starting_jobs_tbl.last loop
2144 if p_wltx_starting_jobs_tbl(l_counter).REPRESENTATIVE_FLAG = 'Y' then
2145 l_rep_job_index := l_counter;
2146 end if;
2147 end loop;
2148 end if ; --end of validation procs for I/f or MES
2149
2150 l_stmt_num := 120;
2151
2152 /* Log the Procedure entry point....proc entry */
2153 if( g_log_level_statement >= l_log_level ) then
2154 l_msg_tokens.delete;
2155 WSM_log_PVT.logMessage(p_module_name => l_module ,
2156 p_msg_text => 'Calling WWSMPJUPD.PROCESS_LOTS : Transaction Id : ' || l_txn_id ,
2157 p_stmt_num => l_stmt_num,
2158 p_msg_tokens => l_msg_tokens,
2159 p_fnd_log_level => g_log_level_statement,
2160 p_run_log_level => l_log_level
2161 );
2162 End if;
2163
2164 /* call Process lots now....*/
2165 l_wltx_resulting_jobs_tbl(1) := p_wltx_resulting_job_rec;
2166 WSMPJUPD.PROCESS_LOTS (p_copy_qa => null,
2167 p_txn_org_id => p_wltx_header.organization_id,
2168 p_rep_job_index => l_rep_job_index,
2169 p_wltx_header => p_wltx_header,
2170 p_wltx_starting_jobs_tbl => p_wltx_starting_jobs_tbl,
2171 p_wltx_resulting_jobs_tbl => l_wltx_resulting_jobs_tbl,
2172 p_secondary_qty_tbl => p_wltx_secondary_qty_tbl,
2173 x_return_status => x_return_status,
2174 x_msg_count => x_msg_count,
2175 x_error_msg => x_msg_data
2176 );
2177
2178 /* Log the Procedure exit point....proc exit */
2179 if( g_log_level_statement >= l_log_level ) then
2180 l_msg_tokens.delete;
2181 WSM_log_PVT.logMessage(p_module_name => l_module ,
2182 p_msg_text => 'Returning from WWSMPJUPD.PROCESS_LOTS',
2183 p_stmt_num => l_stmt_num ,
2184 p_msg_tokens => l_msg_tokens,
2185 p_fnd_log_level => g_log_level_statement,
2186 p_run_log_level => l_log_level
2187 );
2188 End if;
2189
2190 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
2191 /* Txn errored....*/
2192 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
2193
2194 l_msg_tokens.delete;
2195 WSM_log_PVT.logMessage(p_module_name => l_module ,
2196 p_msg_text => 'PROCESS_LOTS failed.' ,
2197 p_stmt_num => l_stmt_num ,
2198 p_msg_tokens => l_msg_tokens,
2199 p_fnd_msg_level => G_MSG_LVL_ERROR ,
2200 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
2201 p_run_log_level => l_log_level
2202 );
2203 END IF;
2204 if x_return_status <> G_RET_SUCCESS then
2205 IF x_return_status = G_RET_ERROR THEN
2206 raise FND_API.G_EXC_ERROR;
2207 ELSIF x_return_status = G_RET_UNEXPECTED THEN
2208 raise FND_API.G_EXC_UNEXPECTED_ERROR;
2209 END IF;
2210 end if;
2211 end if;
2212
2213 -- Assign back ....
2214 p_wltx_resulting_job_rec := l_wltx_resulting_jobs_tbl(1) ;
2215
2216 /* Log the Procedure exit point.... */
2217 if( g_log_level_statement >= l_log_level ) then
2218 l_msg_tokens.delete;
2219 WSM_log_PVT.logMessage(p_module_name => l_module ,
2220 p_msg_text => 'Processing of the WIp Lot Transaction ... Success',
2221 p_stmt_num => l_stmt_num ,
2222 p_msg_tokens => l_msg_tokens,
2223 p_fnd_log_level => g_log_level_statement,
2224 p_run_log_level => l_log_level
2225 );
2226 End if;
2227
2228 l_stmt_num := 130;
2229
2230 /* Standard check of p_commit. */
2231 IF FND_API.To_Boolean( p_commit ) THEN
2232 l_stmt_num := 140;
2233 COMMIT;
2234 /* Log the Procedure exit point.... */
2235 if( g_log_level_statement >= l_log_level ) then
2236 l_msg_tokens.delete;
2237 WSM_log_PVT.logMessage(p_module_name => l_module ,
2238 p_msg_text => 'Wip Lot Transaction ... Commit complete',
2239 p_stmt_num => l_stmt_num ,
2240 p_msg_tokens => l_msg_tokens,
2241 p_fnd_log_level => g_log_level_statement,
2242 p_run_log_level => l_log_level
2243 );
2244 End if;
2245 END IF;
2246
2247
2248 EXCEPTION
2249 WHEN FND_API.G_EXC_ERROR THEN
2250 ROLLBACK TO start_merge_txn;
2251
2252 x_return_status := G_RET_ERROR;
2253 FND_MSG_PUB.Count_And_Get (p_encoded => 'F' ,
2254 p_count => x_msg_count ,
2255 p_data => x_msg_data
2256 );
2257 fnd_file.put_line(fnd_file.log,' WSM_WIP_LOT_TXN_PVT.merge_txn : ' || l_stmt_num || ' Error : ');
2258
2259 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2260
2261 ROLLBACK TO start_merge_txn;
2262
2263 x_return_status := G_RET_UNEXPECTED;
2264
2265 FND_MSG_PUB.Count_And_Get (p_encoded => 'F' ,
2266 p_count => x_msg_count,
2267 p_data => x_msg_data
2268 );
2269 fnd_file.put_line(fnd_file.log,' WSM_WIP_LOT_TXN_PVT.merge_txn : ' || l_stmt_num || ' Unexp error : ');
2270
2271 WHEN OTHERS THEN
2272
2273 ROLLBACK TO start_merge_txn;
2274
2275 x_return_status := G_RET_UNEXPECTED;
2276
2277 IF (G_LOG_LEVEL_UNEXPECTED >= l_log_level) OR
2278 (FND_MSG_PUB.check_msg_level(G_MSG_LVL_UNEXP_ERROR))
2279 THEN
2280 WSM_log_PVT.handle_others( p_module_name => l_module ,
2281 p_stmt_num => l_stmt_num ,
2282 p_fnd_log_level => G_LOG_LEVEL_UNEXPECTED ,
2283 p_run_log_level => l_log_level
2284 );
2285 END IF;
2286
2287 FND_MSG_PUB.Count_And_Get (p_encoded => 'F' ,
2288 p_count => x_msg_count ,
2289 p_data => x_msg_data
2290 );
2291 fnd_file.put_line(fnd_file.log,' WSM_WIP_LOT_TXN_PVT.merge_txn : ' || l_stmt_num || ' Other error : ' || SQLCODE || ' : ' || substrb(SQLERRM,1,1000) );
2292 END;
2293
2294 /* API for Update Assembly transaction.... */
2295 Procedure UPDATE_ASSEMBLY_TXN ( p_api_version IN NUMBER,
2296 p_commit IN VARCHAR2 DEFAULT NULL,
2297 p_init_msg_list IN VARCHAR2 DEFAULT NULL,
2298 p_validation_level IN NUMBER DEFAULT NULL,
2299 p_calling_mode IN NUMBER,
2300 p_wltx_header IN OUT NOCOPY WLTX_TRANSACTIONS_REC_TYPE,
2301 p_wltx_starting_job_rec IN OUT NOCOPY WLTX_STARTING_JOBS_REC_TYPE,
2302 p_wltx_resulting_job_rec IN OUT NOCOPY WLTX_RESULTING_JOBS_REC_TYPE,
2303 p_wltx_secondary_qty_tbl IN OUT NOCOPY WSM_JOB_SECONDARY_QTY_TBL_TYPE ,
2304 x_return_status OUT NOCOPY VARCHAR2,
2305 x_msg_count OUT NOCOPY NUMBER,
2306 x_msg_data OUT NOCOPY VARCHAR2
2307 ) IS
2308
2309 /* API version stored locally */
2310 l_api_version NUMBER := 1.0;
2311 l_api_name VARCHAR2(20) := 'UPDATE_ASSEMBLY_TXN';
2312
2313
2314 /* Other locals */
2315 l_txn_id NUMBER;
2316
2317 -- Logging variables.....
2318 l_msg_tokens WSM_Log_PVT.token_rec_tbl;
2319 l_log_level number := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
2320
2321 l_stmt_num NUMBER;
2322 l_module VARCHAR2(100) := 'wsm.plsql.WSM_WIP_LOT_TXN_PVT.UPDATE_ASSEMBLY_TXN';
2323
2324 /* Have to create a table.... for the starting and resulting job */
2325 l_wltx_starting_jobs_tbl WLTX_STARTING_JOBS_TBL_TYPE;
2326 l_wltx_resulting_jobs_tbl WLTX_RESULTING_JOBS_TBL_TYPE;
2327
2328 BEGIN
2329 /* Have a starting point */
2330 savepoint start_upd_assy_txn;
2331
2332 l_stmt_num := 10;
2333 /* Initialize API return status to success */
2334 x_return_status := G_RET_SUCCESS;
2335 x_msg_count := NULL;
2336 x_msg_data := 0;
2337
2338 /* Log the Procedure entry point.... */
2339 /* Logging into the FND_MSG_PUB will be to the level of G_MSG_LVL_SUCCESS
2340 G_MSG_LVL_DEBUG_HIGH , G_MSG_LVL_DEBUG_MEDIUM ,G_MSG_LVL_DEBUG_LOW not considered as of now...
2341 */
2342
2343 --'Entering the Update Assembly Txn API');
2344
2345 /* W'll log the parameter values as and where they get modified....*/
2346 /* Log the standard api parameters.... */
2347
2348 l_stmt_num := 20;
2349
2350 /* Log the Procedure entry point....proc level */
2351 --'Calling FND_API.to_Boolean');
2352
2353 /* Initialize message list if p_init_msg_list is set to TRUE. */
2354 /* Initialize message list if p_init_msg_list is set to TRUE. */
2355 IF FND_API.to_Boolean( p_init_msg_list ) THEN
2356
2357 l_stmt_num := 30;
2358 FND_MSG_PUB.initialize;
2359 /* Message list enabled....-- EVENT */
2360 --'FND_MSG_PUB Message Table Initialized');
2361 end if;
2362
2363 /* FND_MSG_PUB logginng .... */
2364 --'Inside Update_Assembly_Txn API ' );
2365
2366
2367 /* Log the Procedure entry point....proc */
2368 --'Calling FND_API.Compatible_API_Call');
2369
2370
2371 l_stmt_num := 40;
2372
2373 /* Check for the API compatibilty */
2374 IF NOT FND_API.Compatible_API_Call( l_api_version,
2375 p_api_version,
2376 g_pkg_name,
2377 l_api_name
2378 )
2379 THEN
2380 /* Incompatible versions...*/
2381 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
2382
2383 l_msg_tokens.delete;
2384 WSM_log_PVT.logMessage(p_module_name => l_module ,
2385 p_msg_text => 'Incompatible API called for Upd Assy Txn',
2386 p_stmt_num => l_stmt_num ,
2387 p_msg_tokens => l_msg_tokens,
2388 p_fnd_msg_level => G_MSG_LVL_ERROR ,
2389 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
2390 p_run_log_level => l_log_level
2391 );
2392 END IF;
2393 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2394
2395 END IF;
2396 /*proc level logging*/
2397 --API compatibility success ');
2398 /*event lvl logging*/
2399 --API compatibility success ');
2400
2401 /* FND_MSG_PUB logginng .... */
2402 --' API compatibility success ' );
2403
2404 if p_calling_mode <> 2 then
2405
2406 l_stmt_num := 50; --Start AH
2407
2408 /* Txn Header Validation.................... */
2409
2410 /* Log the Procedure entry point....proc level */
2411 if( g_log_level_statement >= l_log_level ) then
2412 l_msg_tokens.delete;
2413 WSM_log_PVT.logMessage(p_module_name => l_module ,
2414 p_msg_text => 'Calling WSM_WLT_VALIDATE_PVT.validate_txn_details',
2415 p_stmt_num => l_stmt_num ,
2416 p_msg_tokens => l_msg_tokens,
2417 p_fnd_log_level => g_log_level_statement,
2418 p_run_log_level => l_log_level
2419 );
2420 End if;
2421
2422 WSM_WLT_VALIDATE_PVT.validate_txn_header ( p_wltx_header => p_wltx_header,
2423 x_return_status => x_return_status,
2424 x_msg_count => x_msg_count,
2425 x_msg_data => x_msg_data
2426 );
2427
2428 /* End header Validation */
2429 /* Log the Procedure exit point.... */
2430 if( g_log_level_statement >= l_log_level ) then
2431 l_msg_tokens.delete;
2432 WSM_log_PVT.logMessage(p_module_name => l_module ,
2433 p_msg_text => 'Returning from WSM_WLT_VALIDATE_PVT.validate_txn_header',
2434 p_stmt_num => l_stmt_num ,
2435 p_msg_tokens => l_msg_tokens,
2436 p_fnd_log_level => g_log_level_statement,
2437 p_run_log_level => l_log_level
2438 );
2439 End if;
2440
2441 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
2442 /* Txn errored....*/
2443 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
2444
2445 l_msg_tokens.delete;
2446 WSM_log_PVT.logMessage(p_module_name => l_module ,
2447 p_msg_text => 'validate_txn_header failed.' ,
2448 p_stmt_num => l_stmt_num ,
2449 p_msg_tokens => l_msg_tokens,
2450 p_fnd_msg_level => G_MSG_LVL_ERROR ,
2451 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
2452 p_run_log_level => l_log_level
2453 );
2454 END IF;
2455 if x_return_status <> G_RET_SUCCESS then
2456 IF x_return_status = G_RET_ERROR THEN
2457 raise FND_API.G_EXC_ERROR;
2458 ELSIF x_return_status = G_RET_UNEXPECTED THEN
2459 raise FND_API.G_EXC_UNEXPECTED_ERROR;
2460 END IF;
2461 end if;
2462 end if;
2463
2464 /* Log the Procedure exit point.... */
2465 if( g_log_level_statement >= l_log_level ) then
2466 l_msg_tokens.delete;
2467 WSM_log_PVT.logMessage(p_module_name => l_module ,
2468 p_msg_text => 'Validated the Transaction Header Information .... Success ' ,
2469 p_stmt_num => l_stmt_num ,
2470 p_msg_tokens => l_msg_tokens,
2471 p_fnd_log_level => g_log_level_statement,
2472 p_run_log_level => l_log_level
2473 );
2474 End if;
2475
2476 l_stmt_num := 60;
2477
2478 /* Here we actually call the code to default the job details... */
2479 /* Log the Procedure entry point....proc lvl */
2480 if( g_log_level_statement >= l_log_level ) then
2481 l_msg_tokens.delete;
2482 WSM_log_PVT.logMessage(p_module_name => l_module ,
2483 p_msg_text => 'Calling WSM_WLT_VALIDATE_PVT.default_starting_job_details',
2484 p_stmt_num => l_stmt_num ,
2485 p_msg_tokens => l_msg_tokens,
2486 p_fnd_log_level => g_log_level_statement,
2487 p_run_log_level => l_log_level
2488 );
2489 End if;
2490
2491 WSM_WLT_VALIDATE_PVT.derive_val_st_job_details( p_txn_org_id => p_wltx_header.organization_id,
2492 p_txn_type => p_wltx_header.transaction_type_id,
2493 -- ST : Added for bug fix 4351071
2494 p_txn_date => p_wltx_header.transaction_date,
2495 p_starting_job_rec => p_wltx_starting_job_rec,
2496 x_return_status => x_return_status,
2497 x_msg_count => x_msg_count,
2498 x_msg_data => x_msg_data
2499 );
2500
2501 /* Log the Procedure exit point.... */
2502 if( g_log_level_statement >= l_log_level ) then
2503 l_msg_tokens.delete;
2504 WSM_log_PVT.logMessage(p_module_name => l_module ,
2505 p_msg_text => 'Returning from WSM_WLT_VALIDATE_PVT.default_starting_job_details',
2506 p_stmt_num => l_stmt_num ,
2507 p_msg_tokens => l_msg_tokens,
2508 p_fnd_log_level => g_log_level_statement,
2509 p_run_log_level => l_log_level
2510 );
2511 End if;
2512
2513 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
2514 /* Txn errored....*/
2515 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
2516
2517 l_msg_tokens.delete;
2518 WSM_log_PVT.logMessage(p_module_name => l_module ,
2519 p_msg_text => 'derive_val_st_job_details failed.' ,
2520 p_stmt_num => l_stmt_num ,
2521 p_msg_tokens => l_msg_tokens,
2522 p_fnd_msg_level => G_MSG_LVL_ERROR ,
2523 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
2524 p_run_log_level => l_log_level
2525 );
2526 END IF;
2527 if x_return_status <> G_RET_SUCCESS then
2528 IF x_return_status = G_RET_ERROR THEN
2529 raise FND_API.G_EXC_ERROR;
2530 ELSIF x_return_status = G_RET_UNEXPECTED THEN
2531 raise FND_API.G_EXC_UNEXPECTED_ERROR;
2532 END IF;
2533 end if;
2534 end if;
2535
2536 /* Log the Procedure exit point.... */
2537 if( g_log_level_statement >= l_log_level ) then
2538 l_msg_tokens.delete;
2539 WSM_log_PVT.logMessage(p_module_name => l_module ,
2540 p_msg_text => 'Defaulting the starting job details ... Success ',
2541 p_stmt_num => l_stmt_num ,
2542 p_msg_tokens => l_msg_tokens,
2543 p_fnd_log_level => g_log_level_statement,
2544 p_run_log_level => l_log_level
2545 );
2546 End if;
2547
2548 l_stmt_num := 70;
2549
2550 /* Log the Procedure entry point....proc lvl */
2551 if( g_log_level_statement >= l_log_level ) then
2552 l_msg_tokens.delete;
2553 WSM_log_PVT.logMessage(p_module_name => l_module ,
2554 p_msg_text => 'Calling WSM_WLT_VALIDATE_PVT.validate_resulting_job ',
2555 p_stmt_num => l_stmt_num ,
2556 p_msg_tokens => l_msg_tokens,
2557 p_fnd_log_level => g_log_level_statement,
2558 p_run_log_level => l_log_level
2559 );
2560 End if;
2561
2562 /* This validates the main job details.....for non-merge and non-split txns.... */
2563
2564 WSM_WLT_VALIDATE_PVT.derive_val_res_job_details( p_txn_type => p_wltx_header.transaction_type_id,
2565 p_txn_org_id => p_wltx_header.organization_id,
2566 p_transaction_date => SYSDATE,
2567 p_starting_job_rec => p_wltx_starting_job_rec,
2568 p_resulting_job_rec => p_wltx_resulting_job_rec,
2569 x_return_status => x_return_status,
2570 x_msg_count => x_msg_count,
2571 x_msg_data => x_msg_data
2572 );
2573
2574 /* Log the Procedure exit point....proc lvl */
2575 if( g_log_level_statement >= l_log_level ) then
2576 l_msg_tokens.delete;
2577 WSM_log_PVT.logMessage(p_module_name => l_module ,
2578 p_msg_text => 'Returning from WSM_WLT_VALIDATE_PVT.validate_resulting_job',
2579 p_stmt_num => l_stmt_num ,
2580 p_msg_tokens => l_msg_tokens,
2581 p_fnd_log_level => g_log_level_statement,
2582 p_run_log_level => l_log_level
2583 );
2584 End if;
2585
2586 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
2587 /* Txn errored....*/
2588 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
2589
2590 l_msg_tokens.delete;
2591 WSM_log_PVT.logMessage(p_module_name => l_module ,
2592 p_msg_text => 'derive_val_res_job_details failed.' ,
2593 p_stmt_num => l_stmt_num ,
2594 p_msg_tokens => l_msg_tokens,
2595 p_fnd_msg_level => G_MSG_LVL_ERROR ,
2596 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
2597 p_run_log_level => l_log_level
2598 );
2599 END IF;
2600 if x_return_status <> G_RET_SUCCESS then
2601 IF x_return_status = G_RET_ERROR THEN
2602 raise FND_API.G_EXC_ERROR;
2603 ELSIF x_return_status = G_RET_UNEXPECTED THEN
2604 raise FND_API.G_EXC_UNEXPECTED_ERROR;
2605 END IF;
2606 end if;
2607 end if;
2608
2609 /* Log the Procedure exit point.... */
2610 if( g_log_level_statement >= l_log_level ) then
2611 l_msg_tokens.delete;
2612 WSM_log_PVT.logMessage(p_module_name => l_module ,
2613 p_msg_text => 'Validation of the resulting jobs details ... Success',
2614 p_stmt_num => l_stmt_num ,
2615 p_msg_tokens => l_msg_tokens,
2616 p_fnd_log_level => g_log_level_statement,
2617 p_run_log_level => l_log_level
2618 );
2619 End if;
2620
2621 end if; --End of validation procs
2622 l_stmt_num := 120;
2623
2624 /* Log the Procedure entry point.... */
2625 if( g_log_level_statement >= l_log_level ) then
2626 l_msg_tokens.delete;
2627 WSM_log_PVT.logMessage(p_module_name => l_module ,
2628 p_msg_text => 'Calling WWSMPJUPD.PROCESS_LOTS : Transaction Id : ' || l_txn_id ,
2629 p_stmt_num => l_stmt_num ,
2630 p_msg_tokens => l_msg_tokens,
2631 p_fnd_log_level => g_log_level_statement,
2632 p_run_log_level => l_log_level
2633 );
2634 End if;
2635
2636 /* call Process lots now....*/
2637 l_wltx_starting_jobs_tbl(1) := p_wltx_starting_job_rec;
2638 l_wltx_resulting_jobs_tbl(1) := p_wltx_resulting_job_rec;
2639
2640 WSMPJUPD.PROCESS_LOTS( p_copy_qa => null,
2641 p_txn_org_id => p_wltx_header.organization_id,
2642 p_rep_job_index => l_wltx_starting_jobs_tbl.first,
2643 p_wltx_header => p_wltx_header,
2644 p_wltx_starting_jobs_tbl => l_wltx_starting_jobs_tbl,
2645 p_wltx_resulting_jobs_tbl => l_wltx_resulting_jobs_tbl,
2646 p_secondary_qty_tbl => p_wltx_secondary_qty_tbl,
2647 x_return_status => x_return_status,
2648 x_msg_count => x_msg_count,
2649 x_error_msg => x_msg_data
2650 );
2651
2652 /* Log the Procedure exit point.... */
2653 if( g_log_level_statement >= l_log_level ) then
2654 l_msg_tokens.delete;
2655 WSM_log_PVT.logMessage(p_module_name => l_module ,
2656 p_msg_text => 'Returning from WWSMPJUPD.PROCESS_LOTS',
2657 p_stmt_num => l_stmt_num ,
2658 p_msg_tokens => l_msg_tokens,
2659 p_fnd_log_level => g_log_level_statement,
2660 p_run_log_level => l_log_level
2661 );
2662 End if;
2663
2664 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
2665 /* Txn errored....*/
2666 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
2667
2668 l_msg_tokens.delete;
2669 WSM_log_PVT.logMessage(p_module_name => l_module ,
2670 p_msg_text => 'PROCESS_LOTS failed.' ,
2671 p_stmt_num => l_stmt_num ,
2672 p_msg_tokens => l_msg_tokens,
2673 p_fnd_msg_level => G_MSG_LVL_ERROR ,
2674 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
2675 p_run_log_level => l_log_level
2676 );
2677 END IF;
2678 if x_return_status <> G_RET_SUCCESS then
2679 IF x_return_status = G_RET_ERROR THEN
2680 raise FND_API.G_EXC_ERROR;
2681 ELSIF x_return_status = G_RET_UNEXPECTED THEN
2682 raise FND_API.G_EXC_UNEXPECTED_ERROR;
2683 END IF;
2684 end if;
2685 end if;
2686
2687 -- Assign back ....
2688 p_wltx_starting_job_rec := l_wltx_starting_jobs_tbl(1) ;
2689 p_wltx_resulting_job_rec := l_wltx_resulting_jobs_tbl(1) ;
2690
2691 /* Log the Procedure exit point.... */
2692 if( g_log_level_statement >= l_log_level ) then
2693 l_msg_tokens.delete;
2694 WSM_log_PVT.logMessage(p_module_name => l_module ,
2695 p_msg_text => 'Processing of the WIp Lot Transaction ... Success',
2696 p_stmt_num => l_stmt_num ,
2697 p_msg_tokens => l_msg_tokens,
2698 p_fnd_log_level => g_log_level_statement,
2699 p_run_log_level => l_log_level
2700 );
2701 End if;
2702
2703
2704 l_stmt_num := 130;
2705 /* Standard check of p_commit. */
2706 IF FND_API.To_Boolean( p_commit ) THEN
2707 l_stmt_num := 140;
2708 COMMIT;
2709 /* Log the Procedure exit point....event */
2710 if( g_log_level_statement >= l_log_level ) then
2711 l_msg_tokens.delete;
2712 WSM_log_PVT.logMessage(p_module_name => l_module ,
2713 p_msg_text => 'Wip Lot Transaction ... Commit complete',
2714 p_stmt_num => l_stmt_num ,
2715 p_msg_tokens => l_msg_tokens,
2716 p_fnd_log_level => g_log_level_statement,
2717 p_run_log_level => l_log_level
2718 );
2719 End if;
2720
2721 END IF;
2722
2723 EXCEPTION
2724 WHEN FND_API.G_EXC_ERROR THEN
2725 ROLLBACK TO start_upd_assy_txn;
2726
2727 x_return_status := G_RET_ERROR;
2728 FND_MSG_PUB.Count_And_Get (p_encoded => 'F' ,
2729 p_count => x_msg_count ,
2730 p_data => x_msg_data
2731 );
2732
2733 fnd_file.put_line(fnd_file.log,' WSM_WIP_LOT_TXN_PVT.update_assembly_txn : ' || l_stmt_num || ' Error : ');
2734
2735 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2736
2737 ROLLBACK TO start_upd_assy_txn;
2738
2739 x_return_status := G_RET_UNEXPECTED;
2740
2741 FND_MSG_PUB.Count_And_Get (p_encoded => 'F' ,
2742 p_count => x_msg_count ,
2743 p_data => x_msg_data
2744 );
2745 fnd_file.put_line(fnd_file.log,' WSM_WIP_LOT_TXN_PVT.update_assembly_txn : ' || l_stmt_num || ' Un Exp Error : ');
2746 WHEN OTHERS THEN
2747
2748 ROLLBACK TO start_upd_assy_txn;
2749
2750 x_return_status := G_RET_UNEXPECTED;
2751
2752 IF (G_LOG_LEVEL_UNEXPECTED >= l_log_level) OR
2753 (FND_MSG_PUB.check_msg_level(G_MSG_LVL_UNEXP_ERROR))
2754 THEN
2755 WSM_log_PVT.handle_others( p_module_name => l_module ,
2756 p_stmt_num => l_stmt_num ,
2757 p_fnd_log_level => G_LOG_LEVEL_UNEXPECTED ,
2758 p_run_log_level => l_log_level
2759 );
2760 END IF;
2761
2762 FND_MSG_PUB.Count_And_Get (p_encoded => 'F' ,
2763 p_count => x_msg_count ,
2764 p_data => x_msg_data
2765 );
2766 fnd_file.put_line(fnd_file.log,' WSM_WIP_LOT_TXN_PVT.update_assembly_txn : ' || l_stmt_num || ' Other Error : ');
2767 END;
2768
2769 /* API for Update Routing transaction.... */
2770 Procedure UPDATE_ROUTING_TXN ( p_api_version IN NUMBER,
2771 p_commit IN VARCHAR2 DEFAULT NULL,
2772 p_init_msg_list IN VARCHAR2 DEFAULT NULL,
2773 p_validation_level IN NUMBER DEFAULT NULL,
2774 p_calling_mode IN NUMBER,
2775 p_wltx_header IN OUT NOCOPY WLTX_TRANSACTIONS_REC_TYPE,
2776 p_wltx_starting_job_rec IN OUT NOCOPY WLTX_STARTING_JOBS_REC_TYPE,
2777 p_wltx_resulting_job_rec IN OUT NOCOPY WLTX_RESULTING_JOBS_REC_TYPE,
2778 p_wltx_secondary_qty_tbl IN OUT NOCOPY WSM_JOB_SECONDARY_QTY_TBL_TYPE ,
2779 x_return_status OUT NOCOPY VARCHAR2,
2780 x_msg_count OUT NOCOPY NUMBER,
2781 x_msg_data OUT NOCOPY VARCHAR2
2782 ) IS
2783
2784
2785 /* API version stored locally */
2786 l_api_version NUMBER := 1.0;
2787 l_api_name VARCHAR2(20) := 'UPDATE_ROUTING_TXN';
2788
2789
2790 /* Other locals */
2791 l_txn_id NUMBER;
2792
2793 -- Logging variables.....
2794 l_msg_tokens WSM_Log_PVT.token_rec_tbl;
2795 l_log_level number := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
2796
2797 l_stmt_num NUMBER;
2798 l_module VARCHAR2(100) := 'wsm.plsql.WSM_WIP_LOT_TXN_PVT.UPDATE_ROUTING_TXN';
2799
2800 /* Have to create a table.... for the starting job */
2801 l_wltx_starting_jobs_tbl WLTX_STARTING_JOBS_TBL_TYPE;
2802 l_wltx_resulting_jobs_tbl WLTX_RESULTING_JOBS_TBL_TYPE;
2803
2804 BEGIN
2805
2806 /* Have a starting point */
2807 savepoint start_upd_rtg_txn;
2808
2809 l_stmt_num := 10;
2810 /* Initialize API return status to success */
2811 x_return_status := G_RET_SUCCESS;
2812 x_msg_count := NULL;
2813 x_msg_data := 0;
2814
2815
2816 /* Log the Procedure entry point.... */
2817 /* Logging into the FND_MSG_PUB will be to the level of G_MSG_LVL_SUCCESS
2818 G_MSG_LVL_DEBUG_HIGH , G_MSG_LVL_DEBUG_MEDIUM ,G_MSG_LVL_DEBUG_LOW not considered as of now...
2819 */
2820 /*proc level*/
2821 --'Entering the Update Routing Txn API');
2822
2823 /* W'll log the parameter values as and where they get modified....*/
2824 /* Log the standard api parameters.... */
2825
2826 l_stmt_num := 20;
2827
2828 /* Log the Procedure entry point.... */
2829 --'Calling FND_API.to_Boolean');
2830
2831 /* Initialize message list if p_init_msg_list is set to TRUE. */
2832 /* Initialize message list if p_init_msg_list is set to TRUE. */
2833 IF FND_API.to_Boolean( p_init_msg_list ) THEN
2834
2835 l_stmt_num := 30;
2836 FND_MSG_PUB.initialize;
2837 /* Message list enabled....-- EVENT */
2838 --'FND_MSG_PUB Message Table Initialized');
2839
2840 end if;
2841
2842 /* FND_MSG_PUB logginng .... */
2843 --'Inside Update_Routing_Txn API ' );
2844
2845 /* Log the Procedure entry point.... proc*/
2846 --'Calling FND_API.Compatible_API_Call');
2847
2848 l_stmt_num := 40;
2849
2850 /* Check for the API compatibilty */
2851 IF NOT FND_API.Compatible_API_Call( l_api_version,
2852 p_api_version,
2853 g_pkg_name,
2854 l_api_name
2855 )
2856 THEN
2857 /* Incompatible versions...*/
2858 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
2859
2860 l_msg_tokens.delete;
2861 WSM_log_PVT.logMessage(p_module_name => l_module ,
2862 p_msg_text => 'Incompatible API called for Upd Routing Txn',
2863 p_stmt_num => l_stmt_num ,
2864 p_msg_tokens => l_msg_tokens,
2865 p_fnd_msg_level => G_MSG_LVL_ERROR ,
2866 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
2867 p_run_log_level => l_log_level
2868 );
2869 END IF;
2870 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2871
2872 END IF;
2873 /*proc lelvel logginh*/
2874 --'API compatibility success ');
2875
2876 /*event lelvel logginh*/
2877 --'API compatibility success ');
2878
2879 /* FND_MSG_PUB logginng .... */
2880 -- API compatibility success ' );
2881 if p_calling_mode <> 2 then
2882 l_stmt_num := 50; --Start AH
2883
2884 /* Txn Header Validation.................... */
2885
2886 /* Log the Procedure entry point....proc */
2887 if( g_log_level_statement >= l_log_level ) then
2888 l_msg_tokens.delete;
2889 WSM_log_PVT.logMessage(p_module_name => l_module ,
2890 p_msg_text => 'Calling WSM_WLT_VALIDATE_PVT.validate_txn_details',
2891 p_stmt_num => l_stmt_num ,
2892 p_msg_tokens => l_msg_tokens,
2893 p_fnd_log_level => g_log_level_statement,
2894 p_run_log_level => l_log_level
2895 );
2896 End if;
2897
2898 WSM_WLT_VALIDATE_PVT.validate_txn_header ( p_wltx_header => p_wltx_header,
2899 x_return_status => x_return_status,
2900 x_msg_count => x_msg_count,
2901 x_msg_data => x_msg_data
2902 );
2903
2904 /* End header Validation */
2905 /* Log the Procedure exit point.... */
2906 if( g_log_level_statement >= l_log_level ) then
2907 l_msg_tokens.delete;
2908 WSM_log_PVT.logMessage(p_module_name => l_module ,
2909 p_msg_text => 'Returning from WSM_WLT_VALIDATE_PVT.validate_txn_header',
2910 p_stmt_num => l_stmt_num ,
2911 p_msg_tokens => l_msg_tokens,
2912 p_fnd_log_level => g_log_level_statement,
2913 p_run_log_level => l_log_level
2914 );
2915 End if;
2916
2917 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
2918 /* Txn errored....*/
2919 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
2920
2921 l_msg_tokens.delete;
2922 WSM_log_PVT.logMessage(p_module_name => l_module ,
2923 p_msg_text => 'validate_txn_header failed.' ,
2924 p_stmt_num => l_stmt_num ,
2925 p_msg_tokens => l_msg_tokens,
2926 p_fnd_msg_level => G_MSG_LVL_ERROR ,
2927 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
2928 p_run_log_level => l_log_level
2929 );
2930 END IF;
2931 if x_return_status <> G_RET_SUCCESS then
2932 IF x_return_status = G_RET_ERROR THEN
2933 raise FND_API.G_EXC_ERROR;
2934 ELSIF x_return_status = G_RET_UNEXPECTED THEN
2935 raise FND_API.G_EXC_UNEXPECTED_ERROR;
2936 END IF;
2937 end if;
2938 end if;
2939
2940 /* Log the Procedure exit point.... */
2941 if( g_log_level_statement >= l_log_level ) then
2942 l_msg_tokens.delete;
2943 WSM_log_PVT.logMessage(p_module_name => l_module ,
2944 p_msg_text => 'Validated the Transaction Header Information .... Success ' ,
2945 p_stmt_num => l_stmt_num ,
2946 p_msg_tokens => l_msg_tokens,
2947 p_fnd_log_level => g_log_level_statement,
2948 p_run_log_level => l_log_level
2949 );
2950 End if;
2951
2952 l_stmt_num := 60;
2953
2954 /* Here we actually call the code to default the job details... */
2955 /* Log the Procedure entry point.... */
2956 if( g_log_level_statement >= l_log_level ) then
2957 l_msg_tokens.delete;
2958 WSM_log_PVT.logMessage(p_module_name => l_module ,
2959 p_msg_text => 'Calling WSM_WLT_VALIDATE_PVT.default_starting_job_details',
2960 p_stmt_num => l_stmt_num ,
2961 p_msg_tokens => l_msg_tokens,
2962 p_fnd_log_level => g_log_level_statement,
2963 p_run_log_level => l_log_level
2964 );
2965 End if;
2966
2967 WSM_WLT_VALIDATE_PVT.derive_val_st_job_details( p_txn_org_id => p_wltx_header.organization_id,
2968 p_txn_type => p_wltx_header.transaction_type_id,
2969 -- ST : Added for bug fix 4351071
2970 p_txn_date => p_wltx_header.transaction_date,
2971 p_starting_job_rec => p_wltx_starting_job_rec,
2972 x_return_status => x_return_status,
2973 x_msg_count => x_msg_count,
2974 x_msg_data => x_msg_data
2975 );
2976
2977 /* Log the Procedure exit point.... */
2978 if( g_log_level_statement >= l_log_level ) then
2979 l_msg_tokens.delete;
2980 WSM_log_PVT.logMessage(p_module_name => l_module ,
2981 p_msg_text => 'Returning from WSM_WLT_VALIDATE_PVT.default_starting_job_details',
2982 p_stmt_num => l_stmt_num ,
2983 p_msg_tokens => l_msg_tokens,
2984 p_fnd_log_level => g_log_level_statement,
2985 p_run_log_level => l_log_level
2986 );
2987 End if;
2988
2989 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
2990 /* Txn errored....*/
2991 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
2992
2993 l_msg_tokens.delete;
2994 WSM_log_PVT.logMessage(p_module_name => l_module ,
2995 p_msg_text => 'derive_val_st_job_details failed.' ,
2996 p_stmt_num => l_stmt_num ,
2997 p_msg_tokens => l_msg_tokens,
2998 p_fnd_msg_level => G_MSG_LVL_ERROR ,
2999 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
3000 p_run_log_level => l_log_level
3001 );
3002 END IF;
3003 if x_return_status <> G_RET_SUCCESS then
3004 IF x_return_status = G_RET_ERROR THEN
3005 raise FND_API.G_EXC_ERROR;
3006 ELSIF x_return_status = G_RET_UNEXPECTED THEN
3007 raise FND_API.G_EXC_UNEXPECTED_ERROR;
3008 END IF;
3009 end if;
3010 end if;
3011
3012 /* Log the Procedure exit point....event */
3013 if( g_log_level_statement >= l_log_level ) then
3014 l_msg_tokens.delete;
3015 WSM_log_PVT.logMessage(p_module_name => l_module ,
3016 p_msg_text => 'Defaulting the starting job details ... Success ',
3017 p_stmt_num => l_stmt_num ,
3018 p_msg_tokens => l_msg_tokens,
3019 p_fnd_log_level => g_log_level_statement,
3020 p_run_log_level => l_log_level
3021 );
3022 End if;
3023
3024 l_stmt_num := 70;
3025
3026 /* Log the Procedure entry point.... */
3027 if( g_log_level_statement >= l_log_level ) then
3028 l_msg_tokens.delete;
3029 WSM_log_PVT.logMessage(p_module_name => l_module ,
3030 p_msg_text => 'Calling WSM_WLT_VALIDATE_PVT.validate_resulting_job ',
3031 p_stmt_num => l_stmt_num ,
3032 p_msg_tokens => l_msg_tokens,
3033 p_fnd_log_level => g_log_level_statement,
3034 p_run_log_level => l_log_level
3035 );
3036 End if;
3037
3038 /* This validates the main job details.....for non-merge and non-split txns.... */
3039
3040 WSM_WLT_VALIDATE_PVT.derive_val_res_job_details( p_txn_type => p_wltx_header.transaction_type_id,
3041 p_txn_org_id => p_wltx_header.organization_id,
3042 p_transaction_date => SYSDATE,
3043 p_starting_job_rec => p_wltx_starting_job_rec,
3044 p_resulting_job_rec => p_wltx_resulting_job_rec,
3045 x_return_status => x_return_status,
3046 x_msg_count => x_msg_count,
3047 x_msg_data => x_msg_data
3048 );
3049
3050 /* Log the Procedure exit point.... */
3051 if( g_log_level_statement >= l_log_level ) then
3052 l_msg_tokens.delete;
3053 WSM_log_PVT.logMessage(p_module_name => l_module ,
3054 p_msg_text => 'Returning from WSM_WLT_VALIDATE_PVT.validate_resulting_job',
3055 p_stmt_num => l_stmt_num ,
3056 p_msg_tokens => l_msg_tokens,
3057 p_fnd_log_level => g_log_level_statement,
3058 p_run_log_level => l_log_level
3059 );
3060 End if;
3061
3062 /*stmt lvl*/
3063
3064 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
3065 /* Txn errored....*/
3066 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
3067
3068 l_msg_tokens.delete;
3069 WSM_log_PVT.logMessage(p_module_name => l_module ,
3070 p_msg_text => 'derive_val_res_job_details failed.' ,
3071 p_stmt_num => l_stmt_num ,
3072 p_msg_tokens => l_msg_tokens,
3073 p_fnd_msg_level => G_MSG_LVL_ERROR ,
3074 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
3075 p_run_log_level => l_log_level
3076 );
3077 END IF;
3078 if x_return_status <> G_RET_SUCCESS then
3079 IF x_return_status = G_RET_ERROR THEN
3080 raise FND_API.G_EXC_ERROR;
3081 ELSIF x_return_status = G_RET_UNEXPECTED THEN
3082 raise FND_API.G_EXC_UNEXPECTED_ERROR;
3083 END IF;
3084 end if;
3085 end if;
3086
3087 /* Log the Procedure exit point.... event*/
3088 if( g_log_level_statement >= l_log_level ) then
3089 l_msg_tokens.delete;
3090 WSM_log_PVT.logMessage(p_module_name => l_module ,
3091 p_msg_text => 'Validation of the resulting jobs details ... Success',
3092 p_stmt_num => l_stmt_num ,
3093 p_msg_tokens => l_msg_tokens,
3094 p_fnd_log_level => g_log_level_statement,
3095 p_run_log_level => l_log_level
3096 );
3097 End if;
3098
3099 end if; --end of validation procs
3100
3101 l_stmt_num := 120;
3102
3103 /* Log the Procedure entry point.... */
3104 if( g_log_level_statement >= l_log_level ) then
3105 l_msg_tokens.delete;
3106 WSM_log_PVT.logMessage(p_module_name => l_module ,
3107 p_msg_text => 'Calling WWSMPJUPD.PROCESS_LOTS : Transaction Id : ' || l_txn_id ,
3108 p_stmt_num => l_stmt_num ,
3109 p_msg_tokens => l_msg_tokens,
3110 p_fnd_log_level => g_log_level_statement,
3111 p_run_log_level => l_log_level
3112 );
3113 End if;
3114
3115 /* call Process lots now....*/
3116 l_wltx_starting_jobs_tbl(1) := p_wltx_starting_job_rec;
3117 l_wltx_resulting_jobs_tbl(1) := p_wltx_resulting_job_rec;
3118
3119 WSMPJUPD.PROCESS_LOTS( p_copy_qa => null,
3120 p_txn_org_id => p_wltx_header.organization_id,
3121 p_rep_job_index => l_wltx_starting_jobs_tbl.first,
3122 p_wltx_header => p_wltx_header,
3123 p_wltx_starting_jobs_tbl => l_wltx_starting_jobs_tbl,
3124 p_wltx_resulting_jobs_tbl => l_wltx_resulting_jobs_tbl,
3125 p_secondary_qty_tbl => p_wltx_secondary_qty_tbl,
3126 x_return_status => x_return_status,
3127 x_msg_count => x_msg_count,
3128 x_error_msg => x_msg_data
3129 );
3130
3131 /* Log the Procedure exit point.... */
3132 if( g_log_level_statement >= l_log_level ) then
3133 l_msg_tokens.delete;
3134 WSM_log_PVT.logMessage(p_module_name => l_module ,
3135 p_msg_text => 'Returning from WWSMPJUPD.PROCESS_LOTS',
3136 p_stmt_num => l_stmt_num ,
3137 p_msg_tokens => l_msg_tokens,
3138 p_fnd_log_level => g_log_level_statement,
3139 p_run_log_level => l_log_level
3140 );
3141 End if;
3142
3143 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
3144 /* Txn errored....*/
3145 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
3146
3147 l_msg_tokens.delete;
3148 WSM_log_PVT.logMessage(p_module_name => l_module ,
3149 p_msg_text => 'PROCESS_LOTS failed.' ,
3150 p_stmt_num => l_stmt_num ,
3151 p_msg_tokens => l_msg_tokens,
3152 p_fnd_msg_level => G_MSG_LVL_ERROR ,
3153 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
3154 p_run_log_level => l_log_level
3155 );
3156 END IF;
3157 if x_return_status <> G_RET_SUCCESS then
3158 IF x_return_status = G_RET_ERROR THEN
3159 raise FND_API.G_EXC_ERROR;
3160 ELSIF x_return_status = G_RET_UNEXPECTED THEN
3161 raise FND_API.G_EXC_UNEXPECTED_ERROR;
3162 END IF;
3163 end if;
3164 end if;
3165
3166 -- Assign back ....
3167 p_wltx_starting_job_rec := l_wltx_starting_jobs_tbl(1) ;
3168 p_wltx_resulting_job_rec := l_wltx_resulting_jobs_tbl(1) ;
3169
3170 /* Log the Procedure exit point.... event*/
3171 if( g_log_level_statement >= l_log_level ) then
3172 l_msg_tokens.delete;
3173 WSM_log_PVT.logMessage(p_module_name => l_module ,
3174 p_msg_text => 'Processing of the WIp Lot Transaction ... Success',
3175 p_stmt_num => l_stmt_num ,
3176 p_msg_tokens => l_msg_tokens,
3177 p_fnd_log_level => g_log_level_statement,
3178 p_run_log_level => l_log_level
3179 );
3180 End if;
3181
3182 l_stmt_num := 130;
3183 /* Standard check of p_commit. */
3184 IF FND_API.To_Boolean( p_commit ) THEN
3185 l_stmt_num := 140;
3186 COMMIT;
3187 /* Log the Procedure exit point....event */
3188 if( g_log_level_statement >= l_log_level ) then
3189 l_msg_tokens.delete;
3190 WSM_log_PVT.logMessage(p_module_name => l_module ,
3191 p_msg_text => 'Wip Lot Transaction ... Commit complete',
3192 p_stmt_num => l_stmt_num ,
3193 p_msg_tokens => l_msg_tokens,
3194 p_fnd_log_level => g_log_level_statement,
3195 p_run_log_level => l_log_level
3196 );
3197 End if;
3198 END IF;
3199
3200 EXCEPTION
3201 WHEN FND_API.G_EXC_ERROR THEN
3202 ROLLBACK TO start_upd_rtg_txn;
3203
3204 x_return_status := G_RET_ERROR;
3205 FND_MSG_PUB.Count_And_Get (p_encoded => 'F' ,
3206 p_count => x_msg_count ,
3207 p_data => x_msg_data
3208 );
3209
3210 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3211
3212 ROLLBACK TO start_upd_rtg_txn;
3213
3214 x_return_status := G_RET_UNEXPECTED;
3215
3216 FND_MSG_PUB.Count_And_Get (p_encoded => 'F' ,
3217 p_count => x_msg_count ,
3218 p_data => x_msg_data
3219 );
3220
3221 WHEN OTHERS THEN
3222
3223 ROLLBACK TO start_upd_rtg_txn;
3224
3225 x_return_status := G_RET_UNEXPECTED;
3226
3227 IF (G_LOG_LEVEL_UNEXPECTED >= l_log_level) OR
3228 (FND_MSG_PUB.check_msg_level(G_MSG_LVL_UNEXP_ERROR))
3229 THEN
3230 WSM_log_PVT.handle_others( p_module_name => l_module ,
3231 p_stmt_num => l_stmt_num ,
3232 p_fnd_log_level => G_LOG_LEVEL_UNEXPECTED ,
3233 p_run_log_level => l_log_level
3234 );
3235 END IF;
3236
3237 FND_MSG_PUB.Count_And_Get (p_encoded => 'F' ,
3238 p_count => x_msg_count ,
3239 p_data => x_msg_data
3240 );
3241 END;
3242
3243 /* API for Update Quantity transaction.... */
3244 Procedure UPDATE_QUANTITY_TXN ( p_api_version IN NUMBER,
3245 p_commit IN VARCHAR2 DEFAULT NULL,
3246 p_init_msg_list IN VARCHAR2 DEFAULT NULL,
3247 p_validation_level IN NUMBER DEFAULT NULL,
3248 p_calling_mode IN NUMBER,
3249 p_wltx_header IN OUT NOCOPY WLTX_TRANSACTIONS_REC_TYPE,
3250 p_wltx_starting_job_rec IN OUT NOCOPY WLTX_STARTING_JOBS_REC_TYPE,
3251 p_wltx_resulting_job_rec IN OUT NOCOPY WLTX_RESULTING_JOBS_REC_TYPE,
3252 p_wltx_secondary_qty_tbl IN OUT NOCOPY WSM_JOB_SECONDARY_QTY_TBL_TYPE ,
3253 x_return_status OUT NOCOPY VARCHAR2,
3254 x_msg_count OUT NOCOPY NUMBER,
3255 x_msg_data OUT NOCOPY VARCHAR2
3256 ) IS
3257 /* API version stored locally */
3258 l_api_version NUMBER := 1.0;
3259 l_api_name VARCHAR2(20) := 'UPDATE_QUANTITY_TXN';
3260
3261
3262
3263 /* Other locals */
3264 l_txn_id NUMBER;
3265
3266 -- Logging variables.....
3267 l_msg_tokens WSM_Log_PVT.token_rec_tbl;
3268 l_log_level number := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
3269
3270 l_stmt_num NUMBER;
3271 l_module VARCHAR2(100) := 'wsm.plsql.WSM_WIP_LOT_TXN_PVT.UPDATE_QUANTITY_TXN';
3272
3273 /* Have to create a table.... for the starting job */
3274 l_wltx_starting_jobs_tbl WLTX_STARTING_JOBS_TBL_TYPE;
3275 l_wltx_resulting_jobs_tbl WLTX_RESULTING_JOBS_TBL_TYPE;
3276
3277 BEGIN
3278
3279 /* Have a starting point */
3280 savepoint start_upd_qty_txn;
3281
3282 l_stmt_num := 10;
3283 /* Initialize API return status to success */
3284 x_return_status := G_RET_SUCCESS;
3285 x_msg_count := NULL;
3286 x_msg_data := 0;
3287
3288
3289 /* Log the Procedure entry point.... */
3290 /* Logging into the FND_MSG_PUB will be to the level of G_MSG_LVL_SUCCESS
3291 G_MSG_LVL_DEBUG_HIGH , G_MSG_LVL_DEBUG_MEDIUM ,G_MSG_LVL_DEBUG_LOW not considered as of now...
3292 */
3293 /*stmt lvl*/
3294 --'Entering the Update Quantity Txn API');
3295
3296 /* W'll log the parameter values as and where they get modified....*/
3297 /* Log the standard api parameters.... */
3298
3299 l_stmt_num := 20;
3300
3301 /* Log the Procedure entry point....proc */
3302 --Calling FND_API.to_Boolean');
3303
3304 /* Initialize message list if p_init_msg_list is set to TRUE. */
3305 /* Initialize message list if p_init_msg_list is set to TRUE. */
3306 IF FND_API.to_Boolean( p_init_msg_list ) THEN
3307
3308 l_stmt_num := 30;
3309 FND_MSG_PUB.initialize;
3310 /* Message list enabled....-- EVENT */
3311 --'FND_MSG_PUB Message Table Initialized');
3312 end if;
3313
3314 /* FND_MSG_PUB logginng .... */
3315 --'Inside Update_Quantity_Txn API ' );
3316
3317 /* Log the Procedure entry point.... */
3318 --'Calling FND_API.Compatible_API_Call');
3319
3320 l_stmt_num := 40;
3321
3322 /* Check for the API compatibilty */
3323 IF NOT FND_API.Compatible_API_Call( l_api_version,
3324 p_api_version,
3325 g_pkg_name,
3326 l_api_name
3327 )
3328 THEN
3329 /* Incompatible versions...*/
3330 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
3331
3332 l_msg_tokens.delete;
3333 WSM_log_PVT.logMessage(p_module_name => l_module ,
3334 p_msg_text => 'Incompatible API called for Upd Qty Txn',
3335 p_stmt_num => l_stmt_num ,
3336 p_msg_tokens => l_msg_tokens,
3337 p_fnd_msg_level => G_MSG_LVL_ERROR ,
3338 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
3339 p_run_log_level => l_log_level
3340 );
3341 END IF;
3342 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3343
3344 END IF;
3345 /*proc level*/
3346 --'API compatibility success ');
3347 /*event level*/
3348 --'API compatibility success ');
3349
3350 /* FND_MSG_PUB logginng .... */
3351 --' API compatibility success ' );
3352
3353 if P_calling_mode <> 2 then
3354
3355 l_stmt_num := 50; --Start AH
3356
3357 /* Txn Header Validation.................... */
3358
3359
3360 /* Log the Procedure entry point....proc level */
3361 if( g_log_level_statement >= l_log_level ) then
3362 l_msg_tokens.delete;
3363 WSM_log_PVT.logMessage(p_module_name => l_module ,
3364 p_msg_text => 'Calling WSM_WLT_VALIDATE_PVT.validate_txn_details',
3365 p_stmt_num => l_stmt_num ,
3366 p_msg_tokens => l_msg_tokens,
3367 p_fnd_log_level => g_log_level_statement,
3368 p_run_log_level => l_log_level
3369 );
3370 End if;
3371
3372 WSM_WLT_VALIDATE_PVT.validate_txn_header ( p_wltx_header => p_wltx_header,
3373 x_return_status => x_return_status,
3374 x_msg_count => x_msg_count,
3375 x_msg_data => x_msg_data
3376 );
3377
3378 /* End header Validation */
3379 /* Log the Procedure exit point.... */
3380 if( g_log_level_statement >= l_log_level ) then
3381 l_msg_tokens.delete;
3382 WSM_log_PVT.logMessage(p_module_name => l_module ,
3383 p_msg_text => 'Returning from WSM_WLT_VALIDATE_PVT.validate_txn_header',
3384 p_stmt_num => l_stmt_num ,
3385 p_msg_tokens => l_msg_tokens,
3386 p_fnd_log_level => g_log_level_statement,
3387 p_run_log_level => l_log_level
3388 );
3389 End if;
3390
3391 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
3392 /* Txn errored....*/
3393 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
3394
3395 l_msg_tokens.delete;
3396 WSM_log_PVT.logMessage(p_module_name => l_module ,
3397 p_msg_text => 'validate_txn_header failed.' ,
3398 p_stmt_num => l_stmt_num ,
3399 p_msg_tokens => l_msg_tokens,
3400 p_fnd_msg_level => G_MSG_LVL_ERROR ,
3401 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
3402 p_run_log_level => l_log_level
3403 );
3404 END IF;
3405 if x_return_status <> G_RET_SUCCESS then
3406 IF x_return_status = G_RET_ERROR THEN
3407 raise FND_API.G_EXC_ERROR;
3408 ELSIF x_return_status = G_RET_UNEXPECTED THEN
3409 raise FND_API.G_EXC_UNEXPECTED_ERROR;
3410 END IF;
3411 end if;
3412 end if;
3413
3414 /* Log the Procedure exit point.... */
3415 if( g_log_level_statement >= l_log_level ) then
3416 l_msg_tokens.delete;
3417 WSM_log_PVT.logMessage(p_module_name => l_module ,
3418 p_msg_text => 'Validated the Transaction Header Information .... Success ' ,
3419 p_stmt_num => l_stmt_num ,
3420 p_msg_tokens => l_msg_tokens,
3421 p_fnd_log_level => g_log_level_statement,
3422 p_run_log_level => l_log_level
3423 );
3424 End if;
3425
3426 l_stmt_num := 60;
3427
3428 /* Here we actually call the code to default the job details... */
3429 /* Log the Procedure entry point.... */
3430 if( g_log_level_statement >= l_log_level ) then
3431 l_msg_tokens.delete;
3432 WSM_log_PVT.logMessage(p_module_name => l_module ,
3433 p_msg_text => 'Calling WSM_WLT_VALIDATE_PVT.default_starting_job_details',
3434 p_stmt_num => l_stmt_num ,
3435 p_msg_tokens => l_msg_tokens,
3436 p_fnd_log_level => g_log_level_statement,
3437 p_run_log_level => l_log_level
3438 );
3439 End if;
3440
3441 WSM_WLT_VALIDATE_PVT.derive_val_st_job_details( p_txn_org_id => p_wltx_header.organization_id,
3442 p_txn_type => p_wltx_header.transaction_type_id,
3443 -- ST : Added for bug fix 4351071
3444 p_txn_date => p_wltx_header.transaction_date,
3445 p_starting_job_rec => p_wltx_starting_job_rec,
3446 x_return_status => x_return_status,
3447 x_msg_count => x_msg_count,
3448 x_msg_data => x_msg_data
3449 );
3450
3451 /* Log the Procedure exit point.... */
3452 if( g_log_level_statement >= l_log_level ) then
3453 l_msg_tokens.delete;
3454 WSM_log_PVT.logMessage(p_module_name => l_module ,
3455 p_msg_text => 'Returning from WSM_WLT_VALIDATE_PVT.default_starting_job_details',
3456 p_stmt_num => l_stmt_num ,
3457 p_msg_tokens => l_msg_tokens,
3458 p_fnd_log_level => g_log_level_statement,
3459 p_run_log_level => l_log_level
3460 );
3461 End if;
3462
3463 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
3464 /* Txn errored....*/
3465 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
3466
3467 l_msg_tokens.delete;
3468 WSM_log_PVT.logMessage(p_module_name => l_module ,
3469 p_msg_text => 'derive_val_st_job_details failed.' ,
3470 p_stmt_num => l_stmt_num ,
3471 p_msg_tokens => l_msg_tokens,
3472 p_fnd_msg_level => G_MSG_LVL_ERROR ,
3473 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
3474 p_run_log_level => l_log_level
3475 );
3476 END IF;
3477 if x_return_status <> G_RET_SUCCESS then
3478 IF x_return_status = G_RET_ERROR THEN
3479 raise FND_API.G_EXC_ERROR;
3480 ELSIF x_return_status = G_RET_UNEXPECTED THEN
3481 raise FND_API.G_EXC_UNEXPECTED_ERROR;
3482 END IF;
3483 end if;
3484 end if;
3485
3486 /* Log the Procedure exit point.... */
3487 if (g_log_level_statement >= l_log_level ) then
3488 l_msg_tokens.delete;
3489 WSM_log_PVT.logMessage(p_module_name => l_module ,
3490 p_msg_text => 'Defaulting the starting job details ... Success ',
3491 p_stmt_num => l_stmt_num ,
3492 p_msg_tokens => l_msg_tokens,
3493 p_fnd_log_level => g_log_level_statement,
3494 p_run_log_level => l_log_level
3495 );
3496 End if;
3497
3498 l_stmt_num := 70;
3499
3500 /* Log the Procedure entry point.... */
3501 if( g_log_level_statement >= l_log_level ) then
3502 l_msg_tokens.delete;
3503 WSM_log_PVT.logMessage(p_module_name => l_module ,
3504 p_msg_text => 'Calling WSM_WLT_VALIDATE_PVT.validate_resulting_job ',
3505 p_stmt_num => l_stmt_num ,
3506 p_msg_tokens => l_msg_tokens,
3507 p_fnd_log_level => g_log_level_statement,
3508 p_run_log_level => l_log_level
3509 );
3510 End if;
3511
3512 /* This validates the main job details.....for non-merge and non-split txns.... */
3513
3514 WSM_WLT_VALIDATE_PVT.derive_val_res_job_details( p_txn_type => p_wltx_header.transaction_type_id,
3515 p_txn_org_id => p_wltx_header.organization_id,
3516 p_transaction_date => SYSDATE,
3517 p_starting_job_rec => p_wltx_starting_job_rec,
3518 p_resulting_job_rec => p_wltx_resulting_job_rec,
3519 x_return_status => x_return_status,
3520 x_msg_count => x_msg_count,
3521 x_msg_data => x_msg_data
3522 );
3523
3524 /* Log the Procedure exit point.... */
3525 if( g_log_level_statement >= l_log_level ) then
3526 l_msg_tokens.delete;
3527 WSM_log_PVT.logMessage(p_module_name => l_module ,
3528 p_msg_text => 'Returning from WSM_WLT_VALIDATE_PVT.validate_resulting_job',
3529 p_stmt_num => l_stmt_num ,
3530 p_msg_tokens => l_msg_tokens,
3531 p_fnd_log_level => g_log_level_statement,
3532 p_run_log_level => l_log_level
3533 );
3534 End if;
3535
3536 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
3537 /* Txn errored....*/
3538 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
3539
3540 l_msg_tokens.delete;
3541 /* Bugfix 5352389 changed fnd_log_level from ERROR to STATEMENT */
3542 WSM_log_PVT.logMessage(p_module_name => l_module ,
3543 p_msg_text => 'derive_val_res_job_details failed.' ,
3544 p_stmt_num => l_stmt_num ,
3545 p_msg_tokens => l_msg_tokens,
3546 p_fnd_msg_level => G_MSG_LVL_ERROR ,
3547 p_fnd_log_level => G_LOG_LEVEL_STATEMENT ,
3548 p_run_log_level => l_log_level
3549 );
3550 END IF;
3551 if x_return_status <> G_RET_SUCCESS then
3552 IF x_return_status = G_RET_ERROR THEN
3553 raise FND_API.G_EXC_ERROR;
3554 ELSIF x_return_status = G_RET_UNEXPECTED THEN
3555 raise FND_API.G_EXC_UNEXPECTED_ERROR;
3556 END IF;
3557 end if;
3558 end if;
3559
3560 /* Log the Procedure exit point....event */
3561 if( g_log_level_statement >= l_log_level ) then
3562 l_msg_tokens.delete;
3563 WSM_log_PVT.logMessage(p_module_name => l_module ,
3564 p_msg_text => 'Validation of the resulting jobs details ... Success',
3565 p_stmt_num => l_stmt_num ,
3566 p_msg_tokens => l_msg_tokens,
3567 p_fnd_log_level => g_log_level_statement,
3568 p_run_log_level => l_log_level
3569 );
3570 End if;
3571 end if ; --end of validation procs
3572
3573 /* Validation and default completed....*/
3574 /*now call process lots*/
3575
3576 l_stmt_num := 120;
3577
3578 /* Log the Procedure entry point.... */
3579 if( g_log_level_statement >= l_log_level ) then
3580 l_msg_tokens.delete;
3581 WSM_log_PVT.logMessage(p_module_name => l_module ,
3582 p_msg_text => 'Calling WWSMPJUPD.PROCESS_LOTS : Transaction Id : ' || l_txn_id ,
3583 p_stmt_num => l_stmt_num ,
3584 p_msg_tokens => l_msg_tokens,
3585 p_fnd_log_level => g_log_level_statement,
3586 p_run_log_level => l_log_level
3587 );
3588 End if;
3589
3590 /* call Process lots now....*/
3591 l_wltx_starting_jobs_tbl(1) := p_wltx_starting_job_rec;
3592 l_wltx_resulting_jobs_tbl(1) := p_wltx_resulting_job_rec;
3593
3594 WSMPJUPD.PROCESS_LOTS ( p_copy_qa => null,
3595 p_txn_org_id => p_wltx_header.organization_id,
3596 p_rep_job_index => l_wltx_starting_jobs_tbl.first,
3597 p_wltx_header => p_wltx_header,
3598 p_wltx_starting_jobs_tbl => l_wltx_starting_jobs_tbl,
3599 p_wltx_resulting_jobs_tbl => l_wltx_resulting_jobs_tbl,
3600 p_secondary_qty_tbl => p_wltx_secondary_qty_tbl,
3601 x_return_status => x_return_status,
3602 x_msg_count => x_msg_count,
3603 x_error_msg => x_msg_data
3604 );
3605
3606 /* Log the Procedure exit point.... */
3607 if( g_log_level_statement >= l_log_level ) then
3608 l_msg_tokens.delete;
3609 WSM_log_PVT.logMessage(p_module_name => l_module ,
3610 p_msg_text => 'Returning from WWSMPJUPD.PROCESS_LOTS',
3611 p_stmt_num => l_stmt_num ,
3612 p_msg_tokens => l_msg_tokens,
3613 p_fnd_log_level => g_log_level_statement,
3614 p_run_log_level => l_log_level
3615 );
3616 End if;
3617
3618 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
3619 /* Txn errored....*/
3620 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
3621
3622 l_msg_tokens.delete;
3623 WSM_log_PVT.logMessage(p_module_name => l_module ,
3624 p_msg_text => 'PROCESS_LOTS failed.' ,
3625 p_stmt_num => l_stmt_num ,
3626 p_msg_tokens => l_msg_tokens,
3627 p_fnd_msg_level => G_MSG_LVL_ERROR ,
3628 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
3629 p_run_log_level => l_log_level
3630 );
3631 END IF;
3632 if x_return_status <> G_RET_SUCCESS then
3633 IF x_return_status = G_RET_ERROR THEN
3634 raise FND_API.G_EXC_ERROR;
3635 ELSIF x_return_status = G_RET_UNEXPECTED THEN
3636 raise FND_API.G_EXC_UNEXPECTED_ERROR;
3637 END IF;
3638 end if;
3639 end if;
3640
3641 -- Assign back ....
3642 p_wltx_starting_job_rec := l_wltx_starting_jobs_tbl(1) ;
3643 p_wltx_resulting_job_rec := l_wltx_resulting_jobs_tbl(1) ;
3644
3645 /* Log the Procedure exit point.... */
3646 if( g_log_level_statement >= l_log_level ) then
3647 l_msg_tokens.delete;
3648 WSM_log_PVT.logMessage(p_module_name => l_module ,
3649 p_msg_text => 'Processing of the WIp Lot Transaction ... Success',
3650 p_stmt_num => l_stmt_num ,
3651 p_msg_tokens => l_msg_tokens,
3652 p_fnd_log_level => g_log_level_statement,
3653 p_run_log_level => l_log_level
3654 );
3655 End if;
3656
3657 l_stmt_num := 130;
3658 /* Standard check of p_commit. */
3659 IF FND_API.To_Boolean( p_commit ) THEN
3660 l_stmt_num := 140;
3661 COMMIT;
3662 /* Log the Procedure exit point....event */
3663 if( g_log_level_statement >= l_log_level ) then
3664 l_msg_tokens.delete;
3665 WSM_log_PVT.logMessage(p_module_name => l_module ,
3666 p_msg_text => 'Wip Lot Transaction ... Commit complete',
3667 p_stmt_num => l_stmt_num ,
3668 p_msg_tokens => l_msg_tokens,
3669 p_fnd_log_level => g_log_level_statement,
3670 p_run_log_level => l_log_level
3671 );
3672 End if;
3673
3674 END IF;
3675
3676
3677 EXCEPTION
3678 WHEN FND_API.G_EXC_ERROR THEN
3679 ROLLBACK TO start_upd_qty_txn;
3680
3681 x_return_status := G_RET_ERROR;
3682 FND_MSG_PUB.Count_And_Get (p_encoded => 'F' ,
3683 p_count => x_msg_count ,
3684 p_data => x_msg_data
3685 );
3686
3687 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3688
3689
3690 ROLLBACK TO start_upd_qty_txn;
3691
3692 x_return_status := G_RET_UNEXPECTED;
3693
3694 FND_MSG_PUB.Count_And_Get (p_encoded => 'F' ,
3695 p_count => x_msg_count ,
3696 p_data => x_msg_data
3697 );
3698 WHEN OTHERS THEN
3699
3700 ROLLBACK TO start_upd_qty_txn;
3701
3702 x_return_status := G_RET_UNEXPECTED;
3703
3704 IF (G_LOG_LEVEL_UNEXPECTED >= l_log_level) OR
3705 (FND_MSG_PUB.check_msg_level(G_MSG_LVL_UNEXP_ERROR))
3706 THEN
3707 WSM_log_PVT.handle_others( p_module_name => l_module ,
3708 p_stmt_num => l_stmt_num ,
3709 p_fnd_log_level => G_LOG_LEVEL_UNEXPECTED ,
3710 p_run_log_level => l_log_level
3711 );
3712 END IF;
3713
3714 FND_MSG_PUB.Count_And_Get (p_encoded => 'F' ,
3715 p_count => x_msg_count ,
3716 p_data => x_msg_data
3717 );
3718 END;
3719
3720 /* API for Update Lot name transaction.... */
3721 Procedure UPDATE_LOTNAME_TXN ( p_api_version IN NUMBER,
3722 p_commit IN VARCHAR2 DEFAULT NULL,
3723 p_init_msg_list IN VARCHAR2 DEFAULT NULL,
3724 p_validation_level IN NUMBER DEFAULT NULL,
3725 p_calling_mode IN NUMBER,
3726 p_wltx_header IN OUT NOCOPY WLTX_TRANSACTIONS_REC_TYPE,
3727 p_wltx_starting_job_rec IN OUT NOCOPY WLTX_STARTING_JOBS_REC_TYPE,
3728 p_wltx_resulting_job_rec IN OUT NOCOPY WLTX_RESULTING_JOBS_REC_TYPE,
3729 p_wltx_secondary_qty_tbl IN OUT NOCOPY WSM_JOB_SECONDARY_QTY_TBL_TYPE ,
3730 x_return_status OUT NOCOPY VARCHAR2,
3731 x_msg_count OUT NOCOPY NUMBER,
3732 x_msg_data OUT NOCOPY VARCHAR2
3733 ) IS
3734 /* API version stored locally */
3735 l_api_version NUMBER := 1.0;
3736 l_api_name VARCHAR2(20) := 'UPDATE_LOTNAME_TXN';
3737
3738
3739 /* Other locals */
3740 l_txn_id NUMBER;
3741
3742 -- Logging variables.....
3743 l_msg_tokens WSM_Log_PVT.token_rec_tbl;
3744 l_log_level number := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
3745
3746 l_stmt_num NUMBER;
3747 l_module VARCHAR2(100) :='wsm.plsql.WSM_WIP_LOT_TXN_PVT.UPDATE_LOTNAME_TXN';
3748
3749 /* Have to create a table.... for the starting job */
3750 l_wltx_starting_jobs_tbl WLTX_STARTING_JOBS_TBL_TYPE;
3751 l_wltx_resulting_jobs_tbl WLTX_RESULTING_JOBS_TBL_TYPE;
3752
3753 BEGIN
3754
3755 /* Have a starting point */
3756 savepoint start_upd_lotname_txn;
3757
3758 l_stmt_num := 10;
3759 /* Initialize API return status to success */
3760 x_return_status := G_RET_SUCCESS;
3761 x_msg_count := NULL;
3762 x_msg_data := 0;
3763
3764
3765 /* Log the Procedure entry point.... */
3766 if( g_log_level_statement >= l_log_level ) then
3767 l_msg_tokens.delete;
3768 WSM_log_PVT.logMessage(p_module_name => l_module ,
3769 p_msg_text => 'Entering the Update Lotname Txn API',
3770 p_stmt_num => l_stmt_num ,
3771 p_msg_tokens => l_msg_tokens,
3772 p_fnd_log_level => g_log_level_statement,
3773 p_run_log_level => l_log_level
3774 );
3775 End if;
3776
3777 l_stmt_num := 20;
3778
3779 /* Initialize message list if p_init_msg_list is set to TRUE. */
3780 IF FND_API.to_Boolean( p_init_msg_list ) THEN
3781
3782 l_stmt_num := 30;
3783 FND_MSG_PUB.initialize;
3784 /* Message list enabled....-- EVENT */
3785 if( g_log_level_statement >= l_log_level ) then
3786 l_msg_tokens.delete;
3787 WSM_log_PVT.logMessage(p_module_name => l_module ,
3788 p_msg_text => 'Message Table Initialized',
3789 p_stmt_num => l_stmt_num ,
3790 p_msg_tokens => l_msg_tokens,
3791 p_fnd_log_level => g_log_level_statement,
3792 p_run_log_level => l_log_level
3793 );
3794 End if;
3795 end if;
3796
3797 l_stmt_num := 40;
3798
3799 /* Check for the API compatibilty */
3800 IF NOT FND_API.Compatible_API_Call( l_api_version,
3801 p_api_version,
3802 g_pkg_name,
3803 l_api_name
3804 )
3805 THEN
3806 /* Incompatible versions...*/
3807 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
3808
3809 l_msg_tokens.delete;
3810 WSM_log_PVT.logMessage(p_module_name => l_module ,
3811 p_msg_text => 'Incompatible API called for Upd Lotname Txn',
3812 p_stmt_num => l_stmt_num ,
3813 p_msg_tokens => l_msg_tokens,
3814 p_fnd_msg_level => G_MSG_LVL_ERROR ,
3815 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
3816 p_run_log_level => l_log_level
3817 );
3818 END IF;
3819 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3820
3821 END IF;
3822
3823
3824 if p_calling_mode <> 2 then
3825
3826 l_stmt_num := 50; --Start AH
3827
3828 /* Txn Header Validation.................... */
3829
3830 /* Log the Procedure entry point.... */
3831 if( g_log_level_statement >= l_log_level ) then
3832 l_msg_tokens.delete;
3833 WSM_log_PVT.logMessage(p_module_name => l_module ,
3834 p_msg_text => 'Calling WSM_WLT_VALIDATE_PVT.validate_txn_details',
3835 p_stmt_num => l_stmt_num ,
3836 p_msg_tokens => l_msg_tokens,
3837 p_fnd_log_level => g_log_level_statement,
3838 p_run_log_level => l_log_level
3839 );
3840 End if;
3841
3842 WSM_WLT_VALIDATE_PVT.validate_txn_header ( p_wltx_header => p_wltx_header,
3843 x_return_status => x_return_status,
3844 x_msg_count => x_msg_count,
3845 x_msg_data => x_msg_data
3846 );
3847
3848 /* End header Validation */
3849 /* Log the Procedure exit point.... */
3850 if( g_log_level_statement >= l_log_level ) then
3851 l_msg_tokens.delete;
3852 WSM_log_PVT.logMessage(p_module_name => l_module ,
3853 p_msg_text => 'Returning from WSM_WLT_VALIDATE_PVT.validate_txn_header',
3854 p_stmt_num => l_stmt_num ,
3855 p_msg_tokens => l_msg_tokens,
3856 p_fnd_log_level => g_log_level_statement,
3857 p_run_log_level => l_log_level
3858 );
3859 End if;
3860
3861 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
3862 /* Txn errored....*/
3863 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
3864
3865 l_msg_tokens.delete;
3866 WSM_log_PVT.logMessage(p_module_name => l_module ,
3867 p_msg_text => 'validate_txn_header failed.' ,
3868 p_stmt_num => l_stmt_num ,
3869 p_msg_tokens => l_msg_tokens,
3870 p_fnd_msg_level => G_MSG_LVL_ERROR ,
3871 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
3872 p_run_log_level => l_log_level
3873 );
3874 END IF;
3875 if x_return_status <> G_RET_SUCCESS then
3876 IF x_return_status = G_RET_ERROR THEN
3877 raise FND_API.G_EXC_ERROR;
3878 ELSIF x_return_status = G_RET_UNEXPECTED THEN
3879 raise FND_API.G_EXC_UNEXPECTED_ERROR;
3880 END IF;
3881 end if;
3882 end if;
3883
3884 /* Log the Procedure exit point.... */
3885 if( g_log_level_statement >= l_log_level ) then
3886 l_msg_tokens.delete;
3887 WSM_log_PVT.logMessage(p_module_name => l_module ,
3888 p_msg_text => 'Validated the Transaction Header Information .... Success ' ,
3889 p_stmt_num => l_stmt_num ,
3890 p_msg_tokens => l_msg_tokens,
3891 p_fnd_log_level => g_log_level_statement,
3892 p_run_log_level => l_log_level
3893 );
3894 End if;
3895
3896 l_stmt_num := 60;
3897
3898 /* Here we actually call the code to default the job details... */
3899 /* Log the Procedure entry point.... */
3900 if( g_log_level_statement >= l_log_level ) then
3901 l_msg_tokens.delete;
3902 WSM_log_PVT.logMessage(p_module_name => l_module ,
3903 p_msg_text => 'Calling WSM_WLT_VALIDATE_PVT.default_starting_job_details',
3904 p_stmt_num => l_stmt_num ,
3905 p_msg_tokens => l_msg_tokens,
3906 p_fnd_log_level => g_log_level_statement,
3907 p_run_log_level => l_log_level
3908 );
3909 End if;
3910
3911 WSM_WLT_VALIDATE_PVT.derive_val_st_job_details( p_txn_org_id => p_wltx_header.organization_id,
3912 p_txn_type => p_wltx_header.transaction_type_id,
3913 -- ST : Added for bug fix 4351071
3914 p_txn_date => p_wltx_header.transaction_date,
3915 p_starting_job_rec => p_wltx_starting_job_rec,
3916 x_return_status => x_return_status,
3917 x_msg_count => x_msg_count,
3918 x_msg_data => x_msg_data
3919 );
3920
3921 /* Log the Procedure exit point.... */
3922 if( g_log_level_statement >= l_log_level ) then
3923 l_msg_tokens.delete;
3924 WSM_log_PVT.logMessage(p_module_name => l_module ,
3925 p_msg_text => 'Returning from WSM_WLT_VALIDATE_PVT.default_starting_job_details',
3926 p_stmt_num => l_stmt_num ,
3927 p_msg_tokens => l_msg_tokens,
3928 p_fnd_log_level => g_log_level_statement,
3929 p_run_log_level => l_log_level
3930 );
3931 End if;
3932
3933 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
3934 /* Txn errored....*/
3935 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
3936
3937 l_msg_tokens.delete;
3938 WSM_log_PVT.logMessage(p_module_name => l_module ,
3939 p_msg_text => 'derive_val_st_job_details failed.' ,
3940 p_stmt_num => l_stmt_num ,
3941 p_msg_tokens => l_msg_tokens,
3942 p_fnd_msg_level => G_MSG_LVL_ERROR ,
3943 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
3944 p_run_log_level => l_log_level
3945 );
3946 END IF;
3947 if x_return_status <> G_RET_SUCCESS then
3948 IF x_return_status = G_RET_ERROR THEN
3949 raise FND_API.G_EXC_ERROR;
3950 ELSIF x_return_status = G_RET_UNEXPECTED THEN
3951 raise FND_API.G_EXC_UNEXPECTED_ERROR;
3952 END IF;
3953 end if;
3954 end if;
3955
3956 /* Log the Procedure exit point.... */
3957 if( g_log_level_statement >= l_log_level ) then
3958 l_msg_tokens.delete;
3959 WSM_log_PVT.logMessage(p_module_name => l_module ,
3960 p_msg_text => 'Defaulting the starting job details ... Success ',
3961 p_stmt_num => l_stmt_num ,
3962 p_msg_tokens => l_msg_tokens,
3963 p_fnd_log_level => g_log_level_statement,
3964 p_run_log_level => l_log_level
3965 );
3966 End if;
3967
3968 l_stmt_num := 70;
3969
3970 /* Log the Procedure entry point.... */
3971 if( g_log_level_statement >= l_log_level ) then
3972 l_msg_tokens.delete;
3973 WSM_log_PVT.logMessage(p_module_name => l_module ,
3974 p_msg_text => 'Calling WSM_WLT_VALIDATE_PVT.validate_resulting_job ',
3975 p_stmt_num => l_stmt_num ,
3976 p_msg_tokens => l_msg_tokens,
3977 p_fnd_log_level => g_log_level_statement,
3978 p_run_log_level => l_log_level
3979 );
3980 End if;
3981
3982 /* This validates the main job details.....for non-merge and non-split txns.... */
3983
3984 WSM_WLT_VALIDATE_PVT.derive_val_res_job_details( p_txn_type => p_wltx_header.transaction_type_id,
3985 p_txn_org_id => p_wltx_header.organization_id,
3986 p_transaction_date => SYSDATE,
3987 p_starting_job_rec => p_wltx_starting_job_rec,
3988 p_resulting_job_rec => p_wltx_resulting_job_rec,
3989 x_return_status => x_return_status,
3990 x_msg_count => x_msg_count,
3991 x_msg_data => x_msg_data
3992 );
3993
3994 /* Log the Procedure exit point.... */
3995 if( g_log_level_statement >= l_log_level ) then
3996 l_msg_tokens.delete;
3997 WSM_log_PVT.logMessage(p_module_name => l_module ,
3998 p_msg_text => 'Returning from WSM_WLT_VALIDATE_PVT.validate_resulting_job',
3999 p_stmt_num => l_stmt_num ,
4000 p_msg_tokens => l_msg_tokens,
4001 p_fnd_log_level => g_log_level_statement,
4002 p_run_log_level => l_log_level
4003 );
4004 End if;
4005
4006 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
4007 /* Txn errored....*/
4008 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
4009
4010 l_msg_tokens.delete;
4011 WSM_log_PVT.logMessage(p_module_name => l_module ,
4012 p_msg_text => 'derive_val_res_job_details failed.' ,
4013 p_stmt_num => l_stmt_num ,
4014 p_msg_tokens => l_msg_tokens,
4015 p_fnd_msg_level => G_MSG_LVL_ERROR ,
4016 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
4017 p_run_log_level => l_log_level
4018 );
4019 END IF;
4020 if x_return_status <> G_RET_SUCCESS then
4021 IF x_return_status = G_RET_ERROR THEN
4022 raise FND_API.G_EXC_ERROR;
4023 ELSIF x_return_status = G_RET_UNEXPECTED THEN
4024 raise FND_API.G_EXC_UNEXPECTED_ERROR;
4025 END IF;
4026 end if;
4027 end if;
4028
4029 /* Log the Procedure exit point.... event*/
4030 if( g_log_level_statement >= l_log_level ) then
4031 l_msg_tokens.delete;
4032 WSM_log_PVT.logMessage(p_module_name => l_module ,
4033 p_msg_text => 'Validation of the resulting jobs details ... Success',
4034 p_stmt_num => l_stmt_num ,
4035 p_msg_tokens => l_msg_tokens,
4036 p_fnd_log_level => g_log_level_statement,
4037 p_run_log_level => l_log_level
4038 );
4039 End if;
4040
4041 end if ; --end of validation procs
4042
4043 /* Validation and default completed....*/
4044 /*now call process lots*/
4045
4046 l_stmt_num := 120;
4047
4048
4049 /* Log the Procedure entry point.... */
4050 if( g_log_level_statement >= l_log_level ) then
4051 l_msg_tokens.delete;
4052 WSM_log_PVT.logMessage(p_module_name => l_module ,
4053 p_msg_text => 'Calling WWSMPJUPD.PROCESS_LOTS : Transaction Id : ' || l_txn_id ,
4054 p_stmt_num => l_stmt_num ,
4055 p_msg_tokens => l_msg_tokens,
4056 p_fnd_log_level => g_log_level_statement,
4057 p_run_log_level => l_log_level
4058 );
4059 End if;
4060
4061 /* call Process lots now....*/
4062 l_wltx_starting_jobs_tbl(1) := p_wltx_starting_job_rec;
4063 l_wltx_resulting_jobs_tbl(1) := p_wltx_resulting_job_rec;
4064
4065 WSMPJUPD.PROCESS_LOTS ( p_copy_qa => null,
4066 p_txn_org_id => p_wltx_header.organization_id,
4067 p_rep_job_index => l_wltx_starting_jobs_tbl.first,
4068 p_wltx_header => p_wltx_header,
4069 p_wltx_starting_jobs_tbl => l_wltx_starting_jobs_tbl,
4070 p_wltx_resulting_jobs_tbl => l_wltx_resulting_jobs_tbl,
4071 p_secondary_qty_tbl => p_wltx_secondary_qty_tbl,
4072 x_return_status => x_return_status,
4073 x_msg_count => x_msg_count,
4074 x_error_msg => x_msg_data
4075 );
4076
4077 /* Log the Procedure exit point.... */
4078 if( g_log_level_statement >= l_log_level ) then
4079 l_msg_tokens.delete;
4080 WSM_log_PVT.logMessage(p_module_name => l_module ,
4081 p_msg_text => 'Returning from WWSMPJUPD.PROCESS_LOTS',
4082 p_stmt_num => l_stmt_num ,
4083 p_msg_tokens => l_msg_tokens,
4084 p_fnd_log_level => g_log_level_statement,
4085 p_run_log_level => l_log_level
4086 );
4087 End if;
4088
4089 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
4090 /* Txn errored....*/
4091 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
4092
4093 l_msg_tokens.delete;
4094 WSM_log_PVT.logMessage(p_module_name => l_module ,
4095 p_msg_text => 'PROCESS_LOTS failed.' ,
4096 p_stmt_num => l_stmt_num ,
4097 p_msg_tokens => l_msg_tokens,
4098 p_fnd_msg_level => G_MSG_LVL_ERROR ,
4099 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
4100 p_run_log_level => l_log_level
4101 );
4102 END IF;
4103 if x_return_status <> G_RET_SUCCESS then
4104 IF x_return_status = G_RET_ERROR THEN
4105 raise FND_API.G_EXC_ERROR;
4106 ELSIF x_return_status = G_RET_UNEXPECTED THEN
4107 raise FND_API.G_EXC_UNEXPECTED_ERROR;
4108 END IF;
4109 end if;
4110 end if;
4111
4112 -- Assign back ....
4113 p_wltx_starting_job_rec := l_wltx_starting_jobs_tbl(1) ;
4114 p_wltx_resulting_job_rec := l_wltx_resulting_jobs_tbl(1) ;
4115
4116 /* Log the Procedure exit point.... event*/
4117 if( g_log_level_statement >= l_log_level ) then
4118 l_msg_tokens.delete;
4119 WSM_log_PVT.logMessage(p_module_name => l_module ,
4120 p_msg_text => 'Processing of the WIp Lot Transaction ... Success',
4121 p_stmt_num => l_stmt_num ,
4122 p_msg_tokens => l_msg_tokens,
4123 p_fnd_log_level => g_log_level_statement,
4124 p_run_log_level => l_log_level
4125 );
4126 End if;
4127
4128 l_stmt_num := 130;
4129 /* Standard check of p_commit. */
4130 IF FND_API.To_Boolean( p_commit ) THEN
4131 l_stmt_num := 140;
4132 COMMIT;
4133 /* Log the Procedure exit point....event */
4134 if( g_log_level_statement >= l_log_level ) then
4135 l_msg_tokens.delete;
4136 WSM_log_PVT.logMessage(p_module_name => l_module ,
4137 p_msg_text => 'Wip Lot Transaction ... Commit complete',
4138 p_stmt_num => l_stmt_num ,
4139 p_msg_tokens => l_msg_tokens,
4140 p_fnd_log_level => g_log_level_statement,
4141 p_run_log_level => l_log_level
4142 );
4143 End if;
4144
4145 END IF;
4146
4147 EXCEPTION
4148 WHEN FND_API.G_EXC_ERROR THEN
4149 ROLLBACK TO start_upd_lotname_txn;
4150
4151 x_return_status := G_RET_ERROR;
4152 FND_MSG_PUB.Count_And_Get (p_encoded => 'F' ,
4153 p_count => x_msg_count ,
4154 p_data => x_msg_data
4155 );
4156
4157 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4158
4159 x_return_status := G_RET_UNEXPECTED;
4160
4161 FND_MSG_PUB.Count_And_Get (p_encoded => 'F' ,
4162 p_count => x_msg_count ,
4163 p_data => x_msg_data
4164 );
4165
4166 WHEN OTHERS THEN
4167
4168 ROLLBACK TO start_upd_lotname_txn;
4169
4170 x_return_status := G_RET_UNEXPECTED;
4171
4172 IF (G_LOG_LEVEL_UNEXPECTED >= l_log_level) OR
4173 (FND_MSG_PUB.check_msg_level(G_MSG_LVL_UNEXP_ERROR))
4174 THEN
4175 WSM_log_PVT.handle_others( p_module_name => l_module ,
4176 p_stmt_num => l_stmt_num ,
4177 p_fnd_log_level => G_LOG_LEVEL_UNEXPECTED ,
4178 p_run_log_level => l_log_level
4179 );
4180 END IF;
4181
4182 FND_MSG_PUB.Count_And_Get (p_encoded => 'F' ,
4183 p_count => x_msg_count ,
4184 p_data => x_msg_data
4185 );
4186 END;
4187
4188
4189 /* API for BONUS transaction.... */
4190 Procedure BONUS_TXN ( p_api_version IN NUMBER,
4191 p_commit IN VARCHAR2 DEFAULT NULL,
4192 p_init_msg_list IN VARCHAR2 DEFAULT NULL,
4193 p_validation_level IN NUMBER DEFAULT NULL,
4194 p_calling_mode IN NUMBER,
4195 p_wltx_header IN OUT NOCOPY WLTX_TRANSACTIONS_REC_TYPE,
4196 p_wltx_resulting_job_rec IN OUT NOCOPY WLTX_RESULTING_JOBS_REC_TYPE,
4197 p_wltx_secondary_qty_tbl IN OUT NOCOPY WSM_JOB_SECONDARY_QTY_TBL_TYPE ,
4198 x_return_status OUT NOCOPY VARCHAR2,
4199 x_msg_count OUT NOCOPY NUMBER,
4200 x_msg_data OUT NOCOPY VARCHAR2
4201 ) IS
4202
4203 /* API version stored locally */
4204 l_api_version NUMBER := 1.0;
4205 l_api_name VARCHAR2(20) := 'BONUS_TXN';
4206
4207
4208 /* Other locals */
4209 l_txn_id NUMBER;
4210
4211 -- Logging variables.....
4212 l_msg_tokens WSM_Log_PVT.token_rec_tbl;
4213 l_log_level number := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
4214
4215 l_stmt_num NUMBER;
4216 l_module VARCHAR2(100) :='wsm.plsql.WSM_WIP_LOT_TXN_PVT.BONUS_TXN';
4217
4218 l_wltx_starting_job_rec WLTX_STARTING_JOBS_REC_TYPE;
4219
4220 /* Have to create a table.... for the starting job */
4221 l_wltx_starting_jobs_tbl WLTX_STARTING_JOBS_TBL_TYPE;
4222 l_wltx_resulting_jobs_tbl WLTX_RESULTING_JOBS_TBL_TYPE;
4223
4224 BEGIN
4225
4226 /* Have a starting point */
4227 savepoint start_bonus_txn;
4228
4229 l_stmt_num := 10;
4230 /* Initialize API return status to success */
4231 x_return_status := G_RET_SUCCESS;
4232 x_msg_count := NULL;
4233 x_msg_data := 0;
4234
4235
4236 /* Log the Procedure entry point.... */
4237 if( g_log_level_statement >= l_log_level ) then
4238 l_msg_tokens.delete;
4239 WSM_log_PVT.logMessage(p_module_name => l_module ,
4240 p_msg_text => 'Entering the Bonus Txn API',
4241 p_stmt_num => l_stmt_num ,
4242 p_msg_tokens => l_msg_tokens,
4243 p_fnd_log_level => g_log_level_statement,
4244 p_run_log_level => l_log_level
4245 );
4246 End if;
4247
4248 l_stmt_num := 20;
4249
4250 /* Initialize message list if p_init_msg_list is set to TRUE. */
4251 IF FND_API.to_Boolean( p_init_msg_list ) THEN
4252 l_stmt_num := 30;
4253 FND_MSG_PUB.initialize;
4254 /* Message list enabled....-- EVENT */
4255 end if;
4256
4257 l_stmt_num := 40;
4258
4259 /* Check for the API compatibilty */
4260 IF NOT FND_API.Compatible_API_Call( l_api_version,
4261 p_api_version,
4262 g_pkg_name,
4263 l_api_name
4264 )
4265 THEN
4266 /* Incompatible versions...*/
4267 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
4268
4269 l_msg_tokens.delete;
4270 WSM_log_PVT.logMessage(p_module_name => l_module ,
4271 p_msg_text => 'Incompatible API called for Bonus Txn',
4272 p_stmt_num => l_stmt_num ,
4273 p_msg_tokens => l_msg_tokens,
4274 p_fnd_msg_level => G_MSG_LVL_ERROR ,
4275 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
4276 p_run_log_level => l_log_level
4277 );
4278 END IF;
4279 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4280
4281 END IF;
4282
4283
4284 if p_calling_mode <> 2 then
4285
4286 l_stmt_num := 50; --Start AH
4287
4288 /* Txn Header Validation.................... */
4289
4290 /* Log the Procedure entry point.... */
4291 if( g_log_level_statement >= l_log_level ) then
4292 l_msg_tokens.delete;
4293 WSM_log_PVT.logMessage(p_module_name => l_module ,
4294 p_msg_text => 'Calling WSM_WLT_VALIDATE_PVT.validate_txn_details',
4295 p_stmt_num => l_stmt_num ,
4296 p_msg_tokens => l_msg_tokens,
4297 p_fnd_log_level => g_log_level_statement,
4298 p_run_log_level => l_log_level
4299 );
4300 End if;
4301
4302 WSM_WLT_VALIDATE_PVT.validate_txn_header ( p_wltx_header => p_wltx_header,
4303 x_return_status => x_return_status,
4304 x_msg_count => x_msg_count,
4305 x_msg_data => x_msg_data
4306 );
4307
4308 /* End header Validation */
4309 /* Log the Procedure exit point.... */
4310 if( g_log_level_statement >= l_log_level ) then
4311 l_msg_tokens.delete;
4312 WSM_log_PVT.logMessage(p_module_name => l_module ,
4313 p_msg_text => 'Returning from WSM_WLT_VALIDATE_PVT.validate_txn_header',
4314 p_stmt_num => l_stmt_num ,
4315 p_msg_tokens => l_msg_tokens,
4316 p_fnd_log_level => g_log_level_statement,
4317 p_run_log_level => l_log_level
4318 );
4319 End if;
4320
4321 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
4322 /* Txn errored....*/
4323 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
4324
4325 l_msg_tokens.delete;
4326 WSM_log_PVT.logMessage(p_module_name => l_module ,
4327 p_msg_text => 'validate_txn_header failed.' ,
4328 p_stmt_num => l_stmt_num ,
4329 p_msg_tokens => l_msg_tokens,
4330 p_fnd_msg_level => G_MSG_LVL_ERROR ,
4331 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
4332 p_run_log_level => l_log_level
4333 );
4334 END IF;
4335 if x_return_status <> G_RET_SUCCESS then
4336 IF x_return_status = G_RET_ERROR THEN
4337 raise FND_API.G_EXC_ERROR;
4338 ELSIF x_return_status = G_RET_UNEXPECTED THEN
4339 raise FND_API.G_EXC_UNEXPECTED_ERROR;
4340 END IF;
4341 end if;
4342 end if;
4343
4344 /* Log the Procedure exit point.... */
4345 if( g_log_level_statement >= l_log_level ) then
4346 l_msg_tokens.delete;
4347 WSM_log_PVT.logMessage(p_module_name => l_module ,
4348 p_msg_text => 'Validated the Transaction Header Information .... Success ' ,
4349 p_stmt_num => l_stmt_num ,
4350 p_msg_tokens => l_msg_tokens,
4351 p_fnd_log_level => g_log_level_statement,
4352 p_run_log_level => l_log_level
4353 );
4354 End if;
4355
4356 l_stmt_num := 70;
4357
4358 /* Log the Procedure entry point.... */
4359 if( g_log_level_statement >= l_log_level ) then
4360 l_msg_tokens.delete;
4361 WSM_log_PVT.logMessage(p_module_name => l_module ,
4362 p_msg_text => 'Calling WSM_WLT_VALIDATE_PVT.validate_resulting_job ',
4363 p_stmt_num => l_stmt_num ,
4364 p_msg_tokens => l_msg_tokens,
4365 p_fnd_log_level => g_log_level_statement,
4366 p_run_log_level => l_log_level
4367 );
4368 End if;
4369
4370 /* This validates the main job details.....for bonus txns.... */
4371
4372 WSM_WLT_VALIDATE_PVT.derive_val_res_job_details( p_txn_type => p_wltx_header.transaction_type_id,
4373 p_txn_org_id => p_wltx_header.organization_id,
4374 p_transaction_date => SYSDATE,
4375 p_resulting_job_rec => p_wltx_resulting_job_rec,
4376 x_return_status => x_return_status,
4377 x_msg_count => x_msg_count,
4378 x_msg_data => x_msg_data
4379 );
4380
4381 /* Log the Procedure exit point.... */
4382 if( g_log_level_statement >= l_log_level ) then
4383 l_msg_tokens.delete;
4384 WSM_log_PVT.logMessage(p_module_name => l_module ,
4385 p_msg_text => 'Returning from WSM_WLT_VALIDATE_PVT.validate_resulting_job',
4386 p_stmt_num => l_stmt_num ,
4387 p_msg_tokens => l_msg_tokens,
4388 p_fnd_log_level => g_log_level_statement,
4389 p_run_log_level => l_log_level
4390 );
4391 End if;
4392
4393 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
4394 /* Txn errored....*/
4395 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
4396
4397 l_msg_tokens.delete;
4398 WSM_log_PVT.logMessage(p_module_name => l_module ,
4399 p_msg_text => 'derive_val_res_job_details failed.' ,
4400 p_stmt_num => l_stmt_num ,
4401 p_msg_tokens => l_msg_tokens,
4402 p_fnd_msg_level => G_MSG_LVL_ERROR ,
4403 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
4404 p_run_log_level => l_log_level
4405 );
4406 END IF;
4407 if x_return_status <> G_RET_SUCCESS then
4408 IF x_return_status = G_RET_ERROR THEN
4409 raise FND_API.G_EXC_ERROR;
4410 ELSIF x_return_status = G_RET_UNEXPECTED THEN
4411 raise FND_API.G_EXC_UNEXPECTED_ERROR;
4412 END IF;
4413 end if;
4414 end if;
4415
4416 /* Log the Procedure exit point.... event*/
4417 if( g_log_level_statement >= l_log_level ) then
4418 l_msg_tokens.delete;
4419 WSM_log_PVT.logMessage(p_module_name => l_module ,
4420 p_msg_text => 'Validation of the resulting jobs details ... Success',
4421 p_stmt_num => l_stmt_num ,
4422 p_msg_tokens => l_msg_tokens,
4423 p_fnd_log_level => g_log_level_statement,
4424 p_run_log_level => l_log_level
4425 );
4426 End if;
4427
4428 end if ; --end of validation procs
4429
4430 /* Validation and default completed....*/
4431 /*now call process lots*/
4432
4433 l_stmt_num := 120;
4434
4435 /* Log the Procedure entry point.... */
4436 if( g_log_level_statement >= l_log_level ) then
4437 l_msg_tokens.delete;
4438 WSM_log_PVT.logMessage(p_module_name => l_module ,
4439 p_msg_text => 'Calling WWSMPJUPD.PROCESS_LOTS : Transaction Id : ' || l_txn_id ,
4440 p_stmt_num => l_stmt_num,
4441 p_msg_tokens => l_msg_tokens,
4442 p_fnd_log_level => g_log_level_statement,
4443 p_run_log_level => l_log_level
4444 );
4445 End if;
4446
4447 /* call Process lots now....*/
4448 l_wltx_resulting_jobs_tbl(1) := p_wltx_resulting_job_rec;
4449
4450 WSMPJUPD.PROCESS_LOTS ( p_copy_qa => null,
4451 p_txn_org_id => p_wltx_header.organization_id,
4452 p_rep_job_index => l_wltx_starting_jobs_tbl.first,
4453 p_wltx_header => p_wltx_header,
4454 p_wltx_starting_jobs_tbl => l_wltx_starting_jobs_tbl,
4455 p_wltx_resulting_jobs_tbl => l_wltx_resulting_jobs_tbl,
4456 p_secondary_qty_tbl => p_wltx_secondary_qty_tbl,
4457 x_return_status => x_return_status,
4458 x_msg_count => x_msg_count,
4459 x_error_msg => x_msg_data
4460 );
4461
4462 /* Log the Procedure exit point.... */
4463 if( g_log_level_statement >= l_log_level ) then
4464 l_msg_tokens.delete;
4465 WSM_log_PVT.logMessage(p_module_name => l_module ,
4466 p_msg_text => 'Returning from WWSMPJUPD.PROCESS_LOTS',
4467 p_stmt_num => l_stmt_num ,
4468 p_msg_tokens => l_msg_tokens,
4469 p_fnd_log_level => g_log_level_statement,
4470 p_run_log_level => l_log_level
4471 );
4472 End if;
4473
4474 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
4475 /* Txn errored....*/
4476 IF G_LOG_LEVEL_ERROR >= l_log_level OR FND_MSG_PUB.check_msg_level(g_msg_lvl_error) THEN
4477
4478 l_msg_tokens.delete;
4479 WSM_log_PVT.logMessage(p_module_name => l_module ,
4480 p_msg_text => 'PROCESS_LOTS failed.' ,
4481 p_stmt_num => l_stmt_num ,
4482 p_msg_tokens => l_msg_tokens,
4483 p_fnd_msg_level => G_MSG_LVL_ERROR ,
4484 p_fnd_log_level => G_LOG_LEVEL_ERROR ,
4485 p_run_log_level => l_log_level
4486 );
4487 END IF;
4488 if x_return_status <> G_RET_SUCCESS then
4489 IF x_return_status = G_RET_ERROR THEN
4490 raise FND_API.G_EXC_ERROR;
4491 ELSIF x_return_status = G_RET_UNEXPECTED THEN
4492 raise FND_API.G_EXC_UNEXPECTED_ERROR;
4493 END IF;
4494 end if;
4495 end if;
4496
4497 -- Assign back ....
4498 p_wltx_resulting_job_rec := l_wltx_resulting_jobs_tbl(1) ;
4499
4500
4501 /* Log the Procedure exit point.... event*/
4502 if( g_log_level_statement >= l_log_level ) then
4503 l_msg_tokens.delete;
4504 WSM_log_PVT.logMessage(p_module_name => l_module ,
4505 p_msg_text => 'Processing of the WIp Lot Transaction ... Success',
4506 p_stmt_num => l_stmt_num ,
4507 p_msg_tokens => l_msg_tokens,
4508 p_fnd_log_level => g_log_level_statement,
4509 p_run_log_level => l_log_level
4510 );
4511 End if;
4512
4513 l_stmt_num := 130;
4514 /* Standard check of p_commit. */
4515 IF FND_API.To_Boolean( p_commit ) THEN
4516 l_stmt_num := 140;
4517 COMMIT;
4518 /* Log the Procedure exit point....event */
4519 if( g_log_level_statement >= l_log_level ) then
4520 l_msg_tokens.delete;
4521 WSM_log_PVT.logMessage(p_module_name => l_module ,
4522 p_msg_text => 'Wip Lot Transaction ... Commit complete',
4523 p_stmt_num => l_stmt_num ,
4524 p_msg_tokens => l_msg_tokens,
4525 p_fnd_log_level => g_log_level_statement,
4526 p_run_log_level => l_log_level
4527 );
4528 End if;
4529
4530 END IF;
4531
4532
4533 EXCEPTION
4534 WHEN FND_API.G_EXC_ERROR THEN
4535 ROLLBACK TO start_bonus_txn;
4536
4537 x_return_status := G_RET_ERROR;
4538 FND_MSG_PUB.Count_And_Get (p_encoded => 'F' ,
4539 p_count => x_msg_count ,
4540 p_data => x_msg_data
4541 );
4542
4543 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4544
4545 x_return_status := G_RET_UNEXPECTED;
4546
4547 FND_MSG_PUB.Count_And_Get (p_encoded => 'F' ,
4548 p_count => x_msg_count ,
4549 p_data => x_msg_data
4550 );
4551
4552 WHEN OTHERS THEN
4553
4554 ROLLBACK TO start_bonus_txn;
4555
4556 x_return_status := G_RET_UNEXPECTED;
4557
4558 IF (G_LOG_LEVEL_UNEXPECTED >= l_log_level) OR
4559 (FND_MSG_PUB.check_msg_level(G_MSG_LVL_UNEXP_ERROR))
4560 THEN
4561 WSM_log_PVT.handle_others( p_module_name => l_module ,
4562 p_stmt_num => l_stmt_num ,
4563 p_fnd_log_level => G_LOG_LEVEL_UNEXPECTED ,
4564 p_run_log_level => l_log_level
4565 );
4566 END IF;
4567
4568 FND_MSG_PUB.Count_And_Get (p_encoded => 'F' ,
4569 p_count => x_msg_count ,
4570 p_data => x_msg_data
4571 );
4572 END;
4573
4574 /* APIS not coded start */
4575 PROCEDURE UPDATE_BOM ( p_api_version IN VARCHAR2,
4576 p_commit IN VARCHAR2 DEFAULT NULL,
4577 p_init_msg_list IN VARCHAR2 DEFAULT NULL,
4578 p_validation_level IN NUMBER DEFAULT NULL,
4579 p_wltx_header IN OUT NOCOPY WLTX_TRANSACTIONS_REC_TYPE,
4580 p_wltx_starting_job_rec IN OUT NOCOPY WLTX_STARTING_JOBS_REC_TYPE,
4581 p_wltx_resulting_job_rec IN OUT NOCOPY WLTX_RESULTING_JOBS_REC_TYPE,
4582 x_return_status OUT NOCOPY VARCHAR2,
4583 x_msg_count OUT NOCOPY NUMBER,
4584 x_msg_data OUT NOCOPY VARCHAR2
4585 ) IS
4586
4587 BEGIN
4588
4589 null;
4590
4591 END;
4592
4593 PROCEDURE UPDATE_STATUS ( p_api_version IN VARCHAR2,
4594 p_commit IN VARCHAR2 DEFAULT NULL,
4595 p_init_msg_list IN VARCHAR2 DEFAULT NULL,
4596 p_validation_level IN NUMBER DEFAULT NULL,
4597 p_wltx_header IN OUT NOCOPY WLTX_TRANSACTIONS_REC_TYPE,
4598 p_wltx_starting_job_rec IN OUT NOCOPY WLTX_STARTING_JOBS_REC_TYPE,
4599 p_wltx_resulting_job_rec IN OUT NOCOPY WLTX_RESULTING_JOBS_REC_TYPE,
4600 x_return_status OUT NOCOPY VARCHAR2,
4601 x_msg_count OUT NOCOPY NUMBER,
4602 x_msg_data OUT NOCOPY VARCHAR2
4603 ) IS
4604
4605 BEGIN
4606
4607 null;
4608
4609 END;
4610
4611
4612 PROCEDURE UPDATE_COMP_SUBINV_LOC( p_api_version IN VARCHAR2,
4613 p_commit IN VARCHAR2 DEFAULT NULL,
4614 p_init_msg_list IN VARCHAR2 DEFAULT NULL,
4615 p_validation_level IN NUMBER DEFAULT NULL,
4616 p_wltx_header IN OUT NOCOPY WLTX_TRANSACTIONS_REC_TYPE,
4617 p_wltx_starting_job_rec IN OUT NOCOPY WLTX_STARTING_JOBS_REC_TYPE,
4618 p_wltx_resulting_job_rec IN OUT NOCOPY WLTX_RESULTING_JOBS_REC_TYPE,
4619 x_return_status OUT NOCOPY VARCHAR2,
4620 x_msg_count OUT NOCOPY NUMBER,
4621 x_msg_data OUT NOCOPY VARCHAR2
4622 ) IS
4623
4624 BEGIN
4625
4626 null;
4627
4628 END;
4629
4630 /* APIS not coded end */
4631
4632 end WSM_WIP_LOT_TXN_PVT;