DBA Data[Home] [Help]

PACKAGE BODY: APPS.WIP_EAMMTLPROC_PRIV

Source


1 package body wip_eamMtlProc_priv as
2  /* $Header: wipemppb.pls 120.9 2008/05/07 20:24:45 fli ship $ */
3 
4   procedure fillIssueParamTbl(p_compRec IN wip_mtlTempProc_grp.comp_rec_t,
5                               x_params OUT NOCOPY wip_logger.param_tbl_t);
6 
7 
8   procedure validateTxns(p_txnHdrID IN NUMBER,
9                          x_returnStatus OUT NOCOPY VARCHAR2) is
10     l_params wip_logger.param_tbl_t;
11     l_logLevel NUMBER := fnd_log.g_current_runtime_level;
12     l_returnStatus VARCHAR2(1);
13     l_errMsg VARCHAR2(240);
14 
15 
16   begin
17     if (l_logLevel <= wip_constants.trace_logging) then
18       l_params(1).paramName := 'p_txnHdrID';
19       l_params(1).paramValue := p_txnHdrID;
20       wip_logger.entryPoint(p_procName => 'wip_eamMtlProc_priv.validateTxns',
21                             p_params => l_params,
22                             x_returnStatus => x_returnStatus);
23       if(x_returnStatus <> fnd_api.g_ret_sts_success) then
24         raise fnd_api.g_exc_unexpected_error;
25       end if;
26     end if;
27     x_returnStatus := fnd_api.g_ret_sts_success;
28 
29 
30 
31     --rebuildable columns(rebuild_item_id, rebuild_serial_number, rebuild_activity_id, rebuild_job_name)
32     --not allowed unless jobs is eam
33     fnd_message.set_name('WIP', 'WIP_MTI_REB_COL_NOT_ALLOWED');
34     l_errMsg := substrb(fnd_message.get, 1, 240);
35     update mtl_transactions_interface mti
36        set last_update_date = sysdate,
37            last_updated_by = fnd_global.user_id,
38            last_update_login = fnd_global.login_id,
39            program_application_id = fnd_global.prog_appl_id,
40            program_id = fnd_global.conc_program_id,
41            program_update_date = sysdate,
42            request_id = fnd_global.conc_request_id,
43            process_flag = 3,
44            lock_flag = 2,
45            error_code = 'WIP_ENTITY_TYPE',
46            error_explanation = l_errMsg
47      where transaction_header_id = p_txnHdrID
48        and process_flag = 1
49        and transaction_source_type_id = 5
50        and wip_entity_type <> wip_constants.eam
51        and (   rebuild_item_id is not null
52             or rebuild_serial_number is not null
53             or rebuild_job_name is not null
54             or rebuild_activity_id is not null);
55 
56 
57 
58     --rebuildable columns(rebuild_item_id, rebuild_serial_number, rebuild_activity_id, rebuild_job_name)
59     --not allowed unless item being issued is a rebuild item
60     fnd_message.set_name('WIP', 'WIP_MTI_INV_ITEM_NOT_REBLD');
61     l_errMsg := substrb(fnd_message.get, 1, 240);
62     update mtl_transactions_interface mti
63        set last_update_date = sysdate,
64            last_updated_by = fnd_global.user_id,
65            last_update_login = fnd_global.login_id,
66            program_application_id = fnd_global.prog_appl_id,
67            program_id = fnd_global.conc_program_id,
68            program_update_date = sysdate,
69            request_id = fnd_global.conc_request_id,
70            process_flag = 3,
71            lock_flag = 2,
72            error_code = 'INVENTORY_ITEM_ID',
73            error_explanation = l_errMsg
74      where transaction_header_id = p_txnHdrID
75        and process_flag = 1
76        and transaction_source_type_id = 5
77        and rebuild_item_id is not null
78        and not exists (select 1
79                          from mtl_system_items msi
80                         where msi.inventory_item_id = mti.inventory_item_id
81                           and msi.organization_id = mti.organization_id
82                           and msi.eam_item_type = 3);
83 
84     --rebuild item must be populated if any other columns are populated
85     fnd_message.set_name('WIP', 'WIP_MTI_REB_ITEM_MISSING');
86     l_errMsg := substrb(fnd_message.get, 1, 240);
87     update mtl_transactions_interface mti
88        set last_update_date = sysdate,
89            last_updated_by = fnd_global.user_id,
90            last_update_login = fnd_global.login_id,
91            program_application_id = fnd_global.prog_appl_id,
92            program_id = fnd_global.conc_program_id,
93            program_update_date = sysdate,
94            request_id = fnd_global.conc_request_id,
95            process_flag = 3,
96            lock_flag = 2,
97            error_code = 'REBUILD_ITEM_ID',
98            error_explanation = l_errMsg
99      where transaction_header_id = p_txnHdrID
100        and process_flag = 1
101        and transaction_source_type_id = 5
102        and rebuild_item_id is null
103        and (   rebuild_serial_number is not null
104             or rebuild_job_name is not null
105             or rebuild_activity_id is not null);
106 
107 
108 
109     --item must exist in organization
110     --item must be rebuildable
111     fnd_message.set_name('WIP', 'WIP_ML_EAM_REBUILD_ITEM');
112     l_errMsg := substrb(fnd_message.get, 1, 240);
113     update mtl_transactions_interface mti
114        set last_update_date = sysdate,
115            last_updated_by = fnd_global.user_id,
116            last_update_login = fnd_global.login_id,
117            program_application_id = fnd_global.prog_appl_id,
118            program_id = fnd_global.conc_program_id,
119            program_update_date = sysdate,
120            request_id = fnd_global.conc_request_id,
121            process_flag = 3,
122            lock_flag = 2,
123            error_code = 'REBUILD_ITEM_ID',
124            error_explanation = l_errMsg
125      where transaction_header_id = p_txnHdrID
126        and process_flag = 1
127        and transaction_source_type_id = 5
128        and rebuild_item_id is not null
129        and not exists(select 1
130                         from mtl_system_items msi, mtl_parameters mp
131                        where mti.rebuild_item_id = msi.inventory_item_id
132                          and msi.organization_id = mp.organization_id
133 						 and mp.maint_organization_id = mti.organization_id
134 						 and msi.eam_item_type = 3
135 						 );
136 
137 
138     --item must exist in organization
139     --item must be an activity
140     fnd_message.set_name('WIP', 'WIP_ML_EAM_ACTIVITY');
141     l_errMsg := substrb(fnd_message.get, 1, 240);
142     update mtl_transactions_interface mti
143        set last_update_date = sysdate,
144            last_updated_by = fnd_global.user_id,
145            last_update_login = fnd_global.login_id,
146            program_application_id = fnd_global.prog_appl_id,
147            program_id = fnd_global.conc_program_id,
148            program_update_date = sysdate,
149            request_id = fnd_global.conc_request_id,
150            process_flag = 3,
151            lock_flag = 2,
152            error_code = 'REBUILD_ACTIVITY_ID',
153            error_explanation = l_errMsg
154      where transaction_header_id = p_txnHdrID
155        and process_flag = 1
156        and transaction_source_type_id = 5
157        and rebuild_activity_id is not null
158        and not exists(select 1
159                         from mtl_system_items msi
160                        where mti.rebuild_activity_id = msi.inventory_item_id
161                          and mti.organization_id = msi.organization_id
162                          and msi.eam_item_type = 2);
163 
164 
165 
166     --txn type must be issue when rebuild columns are populated
167     fnd_message.set_name('WIP', 'WIP_MTI_REBUILD_TXN_TYPE');
168     l_errMsg := substrb(fnd_message.get, 1, 240);
169     update mtl_transactions_interface mti
170        set last_update_date = sysdate,
171            last_updated_by = fnd_global.user_id,
172            last_update_login = fnd_global.login_id,
173            program_application_id = fnd_global.prog_appl_id,
174            program_id = fnd_global.conc_program_id,
175            program_update_date = sysdate,
176            request_id = fnd_global.conc_request_id,
177            process_flag = 3,
178            lock_flag = 2,
179            error_code = 'TRANSACTION_TYPE_ID',
180            error_explanation = l_errMsg
181      where transaction_header_id = p_txnHdrID
182        and process_flag = 1
183        and transaction_source_type_id = 5
184        and transaction_action_id <> wip_constants.isscomp_action
185        and rebuild_item_id is not null;
186 
187 
188 
189     --primary txn qty must be 1 when transacting rebuildable items
190     fnd_message.set_name('WIP', 'WIP_MTI_REBUILD_QTY');
191     l_errMsg := substrb(fnd_message.get, 1, 240);
192     update mtl_transactions_interface mti
193        set last_update_date = sysdate,
194            last_updated_by = fnd_global.user_id,
195            last_update_login = fnd_global.login_id,
196            program_application_id = fnd_global.prog_appl_id,
197            program_id = fnd_global.conc_program_id,
198            program_update_date = sysdate,
199            request_id = fnd_global.conc_request_id,
200            process_flag = 3,
201            lock_flag = 2,
202            error_code = 'PRIMARY_QUANTITY',
203            error_explanation = l_errMsg
204      where transaction_header_id = p_txnHdrID
205        and process_flag = 1
206        and transaction_source_type_id = 5
207        and abs(primary_quantity) <> 1
208        and exists (select 1
209                      from mtl_system_items msi
210                     where msi.inventory_item_id = mti.inventory_item_id
211                       and msi.organization_id = mti.organization_id
212                       and msi.eam_item_type = 3);
213 
214 
215 
216     --rebuild job name already exists in this organization
217     fnd_message.set_name('WIP', 'WIP_ML_JOB_NAME');
218     l_errMsg := substrb(fnd_message.get, 1, 240);
219     update mtl_transactions_interface mti
220        set last_update_date = sysdate,
221            last_updated_by = fnd_global.user_id,
222            last_update_login = fnd_global.login_id,
223            program_application_id = fnd_global.prog_appl_id,
224            program_id = fnd_global.conc_program_id,
225            program_update_date = sysdate,
226            request_id = fnd_global.conc_request_id,
227            process_flag = 3,
228            lock_flag = 2,
229            error_code = 'REBUILD_JOB_NAME',
230            error_explanation = l_errMsg
231      where transaction_header_id = p_txnHdrID
232        and process_flag = 1
233        and transaction_source_type_id = 5
234        and rebuild_item_id is not null
235        and rebuild_job_name is not null
236        and exists (select 1
237                      from wip_entities we
238                     where mti.rebuild_job_name = we.wip_entity_name
239                       and mti.organization_id = we.organization_id);
240 
241 
242 
243 --IB: anjgupta: check this Query one more time!!!!!!!!!!!!!!!!
244     --activity not valid for this rebuild item
245     fnd_message.set_name('WIP', 'WIP_MTI_NO_ACTIVITY_ASSOC');
246     l_errMsg := substrb(fnd_message.get, 1, 240);
247     update mtl_transactions_interface mti
248        set last_update_date = sysdate,
249            last_updated_by = fnd_global.user_id,
250            last_update_login = fnd_global.login_id,
251            program_application_id = fnd_global.prog_appl_id,
252            program_id = fnd_global.conc_program_id,
253            program_update_date = sysdate,
254            request_id = fnd_global.conc_request_id,
255            process_flag = 3,
256            lock_flag = 2,
257            error_code = 'REBUILD_ACTIVITY_ID',
258            error_explanation = l_errMsg
259      where transaction_header_id = p_txnHdrID
260        and process_flag = 1
261        and transaction_source_type_id = 5
262        and rebuild_item_id is not null
263        and rebuild_activity_id is not null
264        and not exists (select 1
265                          from mtl_eam_asset_activities meaa, csi_item_instances cii, eam_org_maint_defaults eomd
266                          where mti.rebuild_activity_id = meaa.asset_activity_id
267                          and meaa.activity_association_id = eomd.object_id
268                          and eomd.object_type = 60
269                          and eomd.organization_id = mti.organization_id
270                          and cii.inventory_item_id =  mti.rebuild_item_id
271                          and cii.serial_number = mti.rebuild_serial_number
272                          and meaa.maintenance_object_id = cii.instance_id
273                          and meaa.maintenance_object_type = 3
274                          and nvl(meaa.start_date_active, mti.transaction_date - 1) <= mti.transaction_date
275                          and nvl(meaa.end_date_active, mti.transaction_date + 1) >= mti.transaction_date);
276 
277 
278 
279     --rebuild item must be serial controlled if rebuild serial number provided
280     fnd_message.set_name('WIP', 'WIP_MTI_REBUILD_SN_CNTRL');
281     l_errMsg := substrb(fnd_message.get, 1, 240);
282     update mtl_transactions_interface mti
283        set last_update_date = sysdate,
284            last_updated_by = fnd_global.user_id,
285            last_update_login = fnd_global.login_id,
286            program_application_id = fnd_global.prog_appl_id,
287            program_id = fnd_global.conc_program_id,
288            program_update_date = sysdate,
289            request_id = fnd_global.conc_request_id,
290            process_flag = 3,
291            lock_flag = 2,
292            error_code = 'REBUILD_ITEM_ID',
293            error_explanation = l_errMsg
294      where transaction_header_id = p_txnHdrID
295        and process_flag = 1
296        and transaction_source_type_id = 5
297        and rebuild_item_id is not null
298        and rebuild_serial_number is not null
299        and not exists(select 1
300                         from mtl_system_items msi, mtl_parameters mp
301                        where mti.rebuild_item_id = msi.inventory_item_id
302                          and mti.organization_id = mp.maint_organization_id
303 			 and mp.organization_id = msi.organization_id
304                          and msi.serial_number_control_code in (wip_constants.full_sn,
305                                                                 wip_constants.dyn_rcv_sn));
306 
307 
308 
309 
310 
311     --serial number must exist in organization
312     -- must be:
313     --  + defined not used
314     --  + issued out and in the asset's genealogy
315     fnd_message.set_name('WIP', 'WIP_ML_EAM_REBUILD_SERIAL');
316     l_errMsg := substrb(fnd_message.get, 1, 240);
317     update mtl_transactions_interface mti
318        set last_update_date = sysdate,
319            last_updated_by = fnd_global.user_id,
320            last_update_login = fnd_global.login_id,
321            program_application_id = fnd_global.prog_appl_id,
322            program_id = fnd_global.conc_program_id,
323            program_update_date = sysdate,
324            request_id = fnd_global.conc_request_id,
325            process_flag = 3,
326            lock_flag = 2,
327            error_code = 'REBUILD_ITEM_ID',
328            error_explanation = l_errMsg
329      where transaction_header_id = p_txnHdrID
330        and process_flag = 1
331        and transaction_source_type_id = 5
332        and rebuild_item_id is not null
333        and rebuild_serial_number is not null
334        and not exists(select 1 --subquery verifies rebuild sn is predefined or (issued out/in stores and in the asset's genealogy)
335                         from mtl_serial_numbers msn
336                        where mti.rebuild_item_id = msn.inventory_item_id
337                        and mti.rebuild_serial_number = msn.serial_number
338                          and (   msn.current_status = 1 --defined not used
339                               or (    msn.current_status in (3,4) --issued out or in stores
340                                   and exists(select 1
341                                                from wip_discrete_jobs wdj, mtl_object_genealogy mog,
342 											    csi_item_instances cii, mtl_serial_numbers msn_parent
343                                               where wdj.maintenance_object_id = cii.instance_id
344                                               and wdj.maintenance_object_type = 3
345                                               and wdj.wip_entity_id = mti.transaction_source_id
346                                               and cii.inventory_item_id = msn_parent.inventory_item_id
347                                               and cii.serial_number = msn_parent.serial_number
348 											  and msn_parent.gen_object_id = mog.parent_object_id --work order's gen_object_id
349                                               and msn.gen_object_id = mog.object_id --rebuild item's gen_object_id
350                                               and mog.start_date_active <= mti.transaction_date
351                                               and (mog.end_date_active is null or mog.end_date_active >= mti.transaction_date)))));
352 
353     if (l_logLevel <= wip_constants.trace_logging) then
354       wip_logger.exitPoint(p_procName => 'wip_eamMtlProc_validateTxns',
355                            p_procReturnStatus => x_returnStatus,
356                            p_msg => 'success',
357                            x_returnStatus => l_returnStatus); --discard logging return status
358     end if;
359   exception
360     when others then
361       x_returnStatus := fnd_api.g_ret_sts_unexp_error;
362       fnd_msg_pub.add_exc_msg(p_pkg_name => 'wip_eamMtlProc_priv',
363                               p_procedure_name => 'validateTxns',
364                               p_error_text => SQLERRM);
365 
366     if (l_logLevel <= wip_constants.trace_logging) then
367       wip_logger.exitPoint(p_procName => 'wip_eamMtlProc_validateTxns',
368                            p_procReturnStatus => x_returnStatus,
369                            p_msg => 'unexp error:' || SQLERRM,
370                            x_returnStatus => l_returnStatus); --discard logging return status
371     end if;
372   end validateTxns;
373 
374   procedure processCompTxn(p_compRec IN wip_mtlTempProc_grp.comp_rec_t,
375                            x_returnStatus OUT NOCOPY VARCHAR2) is
376     l_params wip_logger.param_tbl_t;
377     l_msgData VARCHAR2(2000);
378     l_returnStatus VARCHAR2(1);
379     l_maintObjID NUMBER;
380     l_maintGenObjID NUMBER;
381     l_maintObjType NUMBER;
382     l_maintObjSrc NUMBER;
383     l_errMsg VARCHAR2(2000);
384     l_msgCount NUMBER;
385     l_logLevel NUMBER := fnd_log.g_current_runtime_level;
386 
387     type char_tbl_t is table of varchar2(30);
388     l_serialNumTbl char_tbl_t := char_tbl_t(null);
389 
390   begin
391     if (l_logLevel <= wip_constants.trace_logging) then
392       fillIssueParamTbl(p_compRec => p_compRec,
393                         x_params => l_params);
394       wip_logger.entryPoint(p_procName => 'wip_eamMtlProc_priv.processCompTxn',
395                             p_params => l_params,
396                             x_returnStatus => x_returnStatus);
397       if(x_returnStatus <> fnd_api.g_ret_sts_success) then
398         raise fnd_api.g_exc_unexpected_error;
399       end if;
400     end if;
401     x_returnStatus := fnd_api.g_ret_sts_success;
402 
403     if(p_compRec.eamItemType is null or
404     ((p_compRec.eamItemType <> wip_constants.rebuild_item_type) and
405     (p_compRec.eamItemType <> 1))) then
406       if (l_logLevel <= wip_constants.trace_logging) then
407         wip_logger.exitPoint(p_procName => 'wip_eamMtlProc_priv.processCompTxn',
408                              p_procReturnStatus => x_returnStatus,
409                              p_msg => 'success(not an eam item)',
410                              x_returnStatus => l_returnStatus); --discard logging return status
411       end if;
412       return;
413     end if;
414       --if the issued item is serial controlled, we need to insert a new row in the
415       --assets genealogy w/the serial number.
416     if(p_compRec.serialControlCode in (wip_constants.full_sn, wip_constants.dyn_rcv_sn)) then
417 
418       --rebuildable item transactions must always only involve a qty of 1.
419       --we have already checked the serial_control_code so a serial number must be in MSNT
420       if(p_compRec.lotControlCode = wip_constants.no_lot) then
421         select fm_serial_number
422           bulk collect into l_serialNumTbl
423           from mtl_serial_numbers_temp
424          where transaction_temp_id = p_compRec.txnTmpID;
425       else
426         select fm_serial_number
427           bulk collect into l_serialNumTbl
428           from mtl_serial_numbers_temp
429          where transaction_temp_id = (select serial_transaction_temp_id
430                                         from mtl_transaction_lots_temp
431                                        where transaction_temp_id = p_compRec.txnTmpID);
432       end if;
433 
434     --We are inside the serial number loop, hence obj_type will be 3
435 
436     select wdj.maintenance_object_id, wdj.maintenance_object_type,
437            wdj.maintenance_object_source, msn.gen_object_id
438       into l_maintObjID, l_maintObjType, l_maintObjSrc, l_maintGenObjID
439       from wip_discrete_jobs wdj, csi_item_instances cii, mtl_serial_numbers msn
440      where wdj.wip_entity_id = p_compRec.wipEntityID
441      and wdj.maintenance_object_type = 3
442      and wdj.maintenance_object_id = cii.instance_id
443      and msn.serial_number (+) = cii.serial_number  --Modified outer join for bug 6892336
444      and msn.inventory_item_id (+) = cii.inventory_item_id; --Modified outer join for bug 6892336
445      --and msn.current_organization_id = cii.last_vld_organization_id;
446 
447     IF l_maintGenObjID IS NULL THEN   -- Added for bug 6892336
448       l_maintGenObjID := l_maintObjID;
449     END IF;
450 
451     --obj type=3 means maintenance_object_id is a instance_id in CII
452     --obj src=1 to make sure WO is not from ASO.
453     --this check should be moved to an EAM package.
454     if(l_maintObjType = 3 and l_maintObjSrc = 1) then
455       if(p_compRec.txnActionID = wip_constants.isscomp_action) then
456         --insert the issued item into the asset's genealogy
457         if (l_logLevel <= wip_constants.full_logging) then
458           wip_logger.log('calling create gen', l_returnStatus);
459         end if;
460         x_returnStatus := fnd_api.g_ret_sts_success;
461 
462         if (l_logLevel <= wip_constants.full_logging) then
463           wip_logger.log('maintenance object id is: ' || l_maintObjID, l_returnStatus);
464           wip_logger.log('maintenance object type is: ' || l_maintObjType, l_returnStatus);
465           wip_logger.log('maintenance object source is: ' || l_maintObjSrc, l_returnStatus);
466            wip_logger.log('gen object id is: ' || l_maintGenObjID, l_returnStatus);
467         end if;
468 
469         wip_eam_genealogy_pvt.create_eam_genealogy(p_api_version => 1.0,
470                                                    p_serial_number => l_serialNumTbl(1),
471                                                    p_inventory_item_id => p_compRec.itemID,
472                                                    p_organization_id => p_compRec.orgID,
473                                                    p_parent_object_id => l_maintGenObjID,
474                                                    p_start_date_active => p_compRec.txnDate,
475                                                    x_return_status => x_returnStatus,
476                                                    x_msg_count => l_msgCount,
477                                                    x_msg_data => l_msgData);
478 
479         if (l_logLevel <= wip_constants.full_logging) then
480           wip_logger.log('create gen returned: ' || x_returnStatus, l_returnStatus);
481         end if;
482       elsif(p_compRec.txnActionID = wip_constants.retcomp_action) then
483         if (l_logLevel <= wip_constants.full_logging) then
484           wip_logger.log('calling update gen', l_returnStatus);
485         end if;
486         x_returnStatus := fnd_api.g_ret_sts_success;
487         for i in 1..l_serialNumTbl.count loop
488           wip_eam_genealogy_pvt.update_eam_genealogy(p_api_version => 1.0,
489                                                      p_object_type => 2, /* serial number */
490                                                      p_serial_number => l_serialNumTbl(i),
491                                                      p_inventory_item_id => p_compRec.itemID,
492                                                      p_organization_id => p_compRec.orgID,
493                                                      p_genealogy_type => 5, /* asset item relationship*/
494                                                      p_end_date_active => p_compRec.txnDate,
495                                                      x_return_status => x_returnStatus,
496                                                      x_msg_count => l_msgCount,
497                                                      x_msg_data => l_msgData);
498         end loop;
499         if (l_logLevel <= wip_constants.full_logging) then
500           wip_logger.log('upd gen returned: ' || x_returnStatus, l_returnStatus);
501         end if;
502       end if;
503 
504       if(x_returnStatus <> fnd_api.g_ret_sts_success) then
505         l_errMsg := 'genealogy failed';
506         if(l_msgData is not null) then
507           fnd_message.set_name('FND', 'FND_GENERIC_MESSAGE');
508           fnd_message.set_token('MESSAGE', l_msgData);
509           fnd_msg_pub.add; --add the returned error message to the stack.
510         end if;
511         raise fnd_api.g_exc_unexpected_error;
512       end if;
513     end if;
514   end if; --For bug 6892336, we do not deal with genealogy for non-serial item
515 
516     if(p_compRec.rebuildItemID > 0 and
517        p_compRec.txnActionID = wip_constants.isscomp_action) then
518       ----------------------------------------------------------------------------------
519       --  This call:
520       --  + inserts a record into wjsi
521       --  + submits the mass load concurrent request (will run when final commit occurs)
522       --  + updates the genealogy (removes the rebuild item if under serial control)
523       ----------------------------------------------------------------------------------
524       eam_rebuild.create_rebuild_job(p_tempId => p_compRec.txnTmpID,
525                                      x_retVal => x_returnStatus,
526                                      x_errMsg => l_msgData);
527       if(x_returnStatus <> fnd_api.g_ret_sts_success) then
528         fnd_message.set_name('FND', 'FND_GENERIC_MESSAGE');
529         fnd_message.set_token('MESSAGE', l_msgData);
530         fnd_msg_pub.add; --add the returned error message to the stack.
531         l_errMsg := 'rebuild job creation failed';
532         raise fnd_api.g_exc_unexpected_error;
533       end if;
534       if (l_logLevel <= wip_constants.full_logging) then
535         wip_logger.log('rebuildable job creation succeeded', l_returnStatus);
536       end if;
537     end if;
538     if (l_logLevel <= wip_constants.trace_logging) then
539       wip_logger.exitPoint(p_procName => 'wip_eamMtlProc_priv.processCompTxn',
540                            p_procReturnStatus => x_returnStatus,
541                            p_msg => 'procedure success.',
542                            x_returnStatus => l_returnStatus); --discard logging return status
543     end if;
544   exception
545     when fnd_api.g_exc_unexpected_error then
546       x_returnStatus := fnd_api.g_ret_sts_unexp_error;
547       if (l_logLevel <= wip_constants.trace_logging) then
548         wip_logger.exitPoint(p_procName => 'wip_eamMtlProc_priv.processCompTxn',
549                              p_procReturnStatus => x_returnStatus,
550                              p_msg => l_errMsg,
551                              x_returnStatus => l_returnStatus); --discard logging return status
552       end if;
553     when others then
554       x_returnStatus := fnd_api.g_ret_sts_unexp_error;
555       fnd_msg_pub.add_exc_msg(p_pkg_name => 'wip_eamMtlProc_priv',
556                               p_procedure_name => 'processCompTxn',
557                               p_error_text => SQLERRM);
558       if (l_logLevel <= wip_constants.trace_logging) then
559         wip_logger.exitPoint(p_procName => 'wip_eamMtlProc_priv.processCompTxn',
560                              p_procReturnStatus => x_returnStatus,
561                              p_msg => 'unexpected error: ' || SQLERRM,
562                              x_returnStatus => l_returnStatus); --discard logging return status
563       end if;
564   end processCompTxn;
565 
566   procedure fillIssueParamTbl(p_compRec IN wip_mtlTempProc_grp.comp_rec_t,
567                        x_params OUT NOCOPY wip_logger.param_tbl_t)
568   is begin
569     x_params(1).paramName := 'p_compRec.wipEntityId';
570     x_params(1).paramValue := p_compRec.wipEntityId;
571     x_params(2).paramName := 'p_compRec.repLineID';
572     x_params(2).paramValue := p_compRec.repLineID;
573     x_params(3).paramName := 'p_compRec.orgID';
574     x_params(3).paramValue := p_compRec.orgID;
575     x_params(4).paramName := 'p_compRec.itemID';
576     x_params(4).paramValue := p_compRec.itemID;
577     x_params(5).paramName := 'p_compRec.opSeqNum';
578     x_params(5).paramValue := p_compRec.opSeqNum;
579     x_params(6).paramName := 'p_compRec.primaryQty';
580     x_params(6).paramValue := p_compRec.primaryQty;
581     x_params(7).paramName := 'p_compRec.txnQty';
582     x_params(7).paramValue := p_compRec.txnQty;
583     x_params(8).paramName := 'p_compRec.negReqFlag';
584     x_params(8).paramValue := p_compRec.negReqFlag;
585     x_params(9).paramName := 'p_compRec.wipSupplyType';
586     x_params(9).paramValue := p_compRec.wipSupplyType;
587     x_params(10).paramName := 'p_compRec.wipEntityType';
588     x_params(10).paramValue := p_compRec.wipEntityType;
589     x_params(11).paramName := 'p_compRec.supplySub';
590     x_params(11).paramValue := p_compRec.supplySub;
591     x_params(12).paramName := 'p_compRec.supplyLocID';
592     x_params(12).paramValue := p_compRec.supplyLocID;
593     x_params(13).paramName := 'p_compRec.txnDate';
594     x_params(13).paramValue := p_compRec.txnDate;
595     x_params(14).paramName := 'p_compRec.txnHdrID';
596     x_params(14).paramValue := p_compRec.txnHdrID;
597     x_params(15).paramName := 'p_compRec.movTxnID';
598     x_params(15).paramValue := p_compRec.movTxnID;
599     x_params(16).paramName := 'p_compRec.cplTxnID';
600     x_params(16).paramValue := p_compRec.cplTxnID;
601     x_params(17).paramName := 'p_compRec.mtlTxnID';
602     x_params(17).paramValue := p_compRec.mtlTxnID;
603     x_params(18).paramName := 'p_compRec.qaCollectionID';
604     x_params(18).paramValue := p_compRec.qaCollectionID;
605     x_params(19).paramName := 'p_compRec.deptID';
606     x_params(19).paramValue := p_compRec.deptID;
607     x_params(20).paramName := 'p_compRec.txnActionID';
608     x_params(20).paramValue := p_compRec.txnActionID;
609     x_params(21).paramName := 'p_compRec.serialControlCode';
610     x_params(21).paramValue := p_compRec.serialControlCode;
611     x_params(22).paramName := 'p_compRec.lotControlCode';
612     x_params(22).paramValue := p_compRec.lotControlCode;
613     x_params(23).paramName := 'p_compRec.eamItemType';
614     x_params(23).paramValue := p_compRec.eamItemType;
615     x_params(24).paramName := 'p_compRec.rebuildItemID';
616     x_params(24).paramValue := p_compRec.rebuildItemID;
617     x_params(25).paramName := 'p_compRec.rebuildJobName';
618     x_params(25).paramValue := p_compRec.rebuildJobName;
619     x_params(26).paramName := 'p_compRec.rebuildActivityID';
620     x_params(26).paramValue := p_compRec.rebuildActivityID;
621     x_params(27).paramName := 'p_compRec.rebuildSerialNumber';
622     x_params(27).paramValue := p_compRec.rebuildSerialNumber;
623 
624   end fillIssueParamTbl;
625 
626 end wip_eamMtlProc_priv;