DBA Data[Home] [Help]

PACKAGE BODY: APPS.WMA_CFM

Source


1 PACKAGE BODY wma_cfm AS
2 /* $Header: wmapcfmb.pls 115.16 2003/10/01 21:14:33 rseela ship $ */
3 
4    /**
5     * This procedure is the entry point for work order-less/flow transaction.
6     * Parameters:
7     *   parameters  CfmParam contains values from the mobile form.
8     *   status      Indicates success (0), failure (-1).
9     *   errMessage  The error or warning message, if any.
10     */
11    PROCEDURE process(param      IN     CfmParam,
12                      status     OUT NOCOPY NUMBER,
13                      errMessage OUT NOCOPY VARCHAR2) IS
14      cfmRec CfmRecord;
15      errMsg VARCHAR2(241);
16    Begin
17      if ( derive(param, cfmRec, errMsg) = false ) then
18        status := -1;
19        errMessage := errMsg;
20        return;
21      end if;
22 
23      if ( put(cfmRec, errMsg) = false ) then
24        status := -1;
25        errMessage := errMsg;
26        return;
27      end if;
28 
29    EXCEPTION
30     when others then
31       status := -1;
32       fnd_message.set_name ('WIP', 'GENERIC_ERROR');
33       fnd_message.set_token ('FUNCTION', 'wma_cfm.process');
34       fnd_message.set_token ('ERROR', SQLCODE || ' ' || SQLERRM);
35       errMessage := fnd_message.get;
36    End process;
37 
38   PROCEDURE process(lpnParam   IN     LpnCfmParam,
39                     status     OUT NOCOPY NUMBER,
40                     errMessage OUT NOCOPY VARCHAR2) IS
41      lpnCfmRec LpnCfmRecord;
42      errMsg VARCHAR2(241);
43    Begin
44      if ( derive(lpnParam, lpnCfmRec, errMsg) = false ) then
45        status := -1;
46        errMessage := errMsg;
47        return;
48      end if;
49 
50      if ( put(lpnCfmRec, errMsg) = false ) then
51        status := -1;
52        errMessage := errMsg;
53        return;
54      end if;
55 
56    EXCEPTION
57     when others then
58       status := -1;
59       fnd_message.set_name ('WIP', 'GENERIC_ERROR');
60       fnd_message.set_token ('FUNCTION', 'wma_cfm.process');
61       fnd_message.set_token ('ERROR', SQLCODE || ' ' || SQLERRM);
62       errMessage := fnd_message.get;
63    End process;
64 
65    /**
66     * This function is used to derive the neccessary information to filled out
67     * the CfmRecord structure to passed into function put.
68     */
69    Function derive(param CfmParam,
70                    cfmRec OUT NOCOPY CfmRecord,
71                    errMsg OUT NOCOPY VARCHAR2) return boolean IS
72      assembly wma_common.Item;
73      periodID number;
74      openPastPeriod boolean := false;
75      defaultPrefix VARCHAR2(200);
76      scheduleNumber VARCHAR2(30);
77      scrapAcctID NUMBER := null;
78      dummy NUMBER;
79      accountingClass VARCHAR2(30);
80      errMesg1 VARCHAR2(30);
81      errClass1 VARCHAR2(10);
82      errMesg2 VARCHAR2(30);
83      errClass2 VARCHAR2(10);
84      x_released_revs_type	NUMBER;
85      x_released_revs_meaning	Varchar2(30);
86 
87 
88    Begin
89 
90      assembly := wma_derive.getItem(param.assemblyID,
91                                     param.environment.orgID,
92                                     param.locatorID);
93 
94      if assembly.revQtyControlCode = WIP_CONSTANTS.REV then
95        /* 3033785 */
96        wip_common.Get_Released_Revs_Type_Meaning (x_released_revs_type,
97                                                   x_released_revs_meaning
98                                                  );
99 
100         BOM_REVISIONS.Get_Revision(
101                         type         => 'PART',
102                         eco_status   => x_released_revs_meaning,
103                         examine_type => 'ALL',
104                         org_id       => param.environment.orgID,
105                         item_id      => param.assemblyID,
106                         rev_date     => param.transactionDate,
107                         itm_rev      => cfmRec.row.revision);
108      else
109        cfmRec.row.revision := NULL;
110      end if;
111 
112      accountingClass := wip_common.default_acc_class(
113                             param.environment.orgID,
114                             param.assemblyID,
115                             4,  -- for flow schedule
116                             assembly.projectID,
117                             errMesg1,
118                             errClass1,
119                             errMesg2,
120                             errClass2);
121 
122      -- get the accounting period
123      invttmtx.tdatechk(
124           org_id           => param.environment.orgID,
125           transaction_date => param.transactionDate,
126           period_id        => periodID,
127           open_past_period => openPastPeriod);
128 
129     if (periodID = -1 or periodID = 0) then
130       fnd_message.set_name(
131         application => 'INV',
132         name        => 'INV_NO_OPEN_PERIOD');
133       errMsg := fnd_message.get;
134       return false;
135     end if;
136 
137      -- default schedule number, it is the value read from profile option 'WIP_JOB_PREFIX'
138      -- appended by a sequence number. We only default it for non flow schedule.
139      -- 3 means unscheduled, 1 means scheduled
140      if ( param.scheduleNumber is null ) then
141        defaultPrefix := substr(fnd_profile.value('WIP_JOB_PREFIX'), 1, 200);
142        scheduleNumber := defaultPrefix || wma_derive.getNextVal('WIP_JOB_NUMBER_S');
143      else
144        scheduleNumber := param.scheduleNumber;
145      end if;
146 
147      cfmRec.row.transaction_date := param.transactionDate;
148 
149      -- derive routing and bom rev info
150      dummy := Wip_Flow_Derive.bom_revision (
151                  p_bom_rev      => cfmRec.row.bom_revision,
152                  p_rev          => cfmRec.row.revision,
153                  p_bom_rev_date => cfmRec.row.bom_revision_date,
154                  p_item_id      => param.assemblyID,
155                  p_start_date   => cfmRec.row.transaction_date,
156                  p_Org_id       => param.environment.orgID);
157 
158      dummy := Wip_Flow_Derive.routing_revision(
159                  p_rout_rev      => cfmRec.row.routing_revision,
160                  p_rout_rev_date => cfmRec.row.routing_revision_date,
161                  p_item_id       => param.assemblyID,
162                  p_start_date    => cfmRec.row.transaction_date,
163                  p_Org_id        => param.environment.orgID);
164 
165 
166      cfmRec.row.transaction_interface_id := param.transactionInterfaceID;
167      cfmRec.row.transaction_header_id := param.transactionHeaderID;
168      cfmRec.row.lock_flag := 2;
169      cfmRec.row.transaction_mode := WIP_CONSTANTS.BACKGROUND;
170      cfmRec.row.process_flag := WIP_CONSTANTS.PENDING;
171      cfmRec.row.validation_required := 1;
172 
173      cfmRec.row.source_code := WMA_COMMON.SOURCE_CODE;
174      cfmRec.row.source_line_id := -1;
175      cfmRec.row.source_header_id := -1;
176 
177      cfmRec.row.last_updated_by := param.environment.userID;
178      cfmRec.row.last_update_date := sysdate;
179      cfmRec.row.creation_date := sysdate;
180      cfmRec.row.created_by := param.environment.userID;
181 
182      cfmRec.row.inventory_item_id := param.assemblyID;
183      cfmRec.row.organization_id := param.environment.orgID;
184      cfmRec.row.acct_period_id := periodID;
185 
186      cfmRec.row.transaction_type_id := param.transactionType;
187      cfmRec.row.negative_req_flag := 1;
188      cfmRec.row.transaction_quantity := param.transactionQty;
189      cfmRec.row.primary_quantity := param.transactionQty;
190 
191      if ( param.transactionType = WIP_CONSTANTS.CPLASSY_TYPE ) then
192         -- for completion
193         cfmRec.row.transaction_action_id := WIP_CONSTANTS.CPLASSY_ACTION;
194      elsif ( param.transactionType = WIP_CONSTANTS.RETASSY_TYPE ) then
195         -- for return
196         cfmRec.row.transaction_action_id := WIP_CONSTANTS.RETASSY_ACTION;
197      elsif ( param.transactionType in (WIP_CONSTANTS.SCRASSY_TYPE,
198                                        WIP_CONSTANTS.RETSCRA_TYPE) ) then
199         -- for scrap
200         cfmRec.row.transaction_action_id := WIP_CONSTANTS.SCRASSY_ACTION;
201         if ( wma_util.getScrapAcctID(param.environment.orgID,
202                                      scrapAcctID,
203                                      errMsg) = false ) then
204           return false;
205         end if;
206      end if;
207 
208      cfmRec.row.distribution_account_id := scrapAcctID;
209      cfmRec.row.transaction_uom := param.transactionUOM;
210      cfmRec.row.subinventory_code := param.subinventoryCode;
211      cfmRec.row.locator_id := param.locatorID;
212      cfmRec.row.reason_id := param.reasonID;
213      cfmRec.row.qa_collection_id := param.qualityID;
214      cfmRec.row.transaction_source_type_id := 5; -- means WIP
215      cfmRec.row.wip_entity_type := 4; -- means flow schedule
216 
217 /***************************************************************************
218  * commented out statement below because we do not need to use this value
219  * below no more. Moreover, the size of
220  * MTL_TRANSACTION_TYPES.TRANSACTION_TYPE_NAME is now VARCHAR2(80), but the
221  * size of cfmRec.row.transaction_source_name is VARCHAR2(30).
222  ***************************************************************************/
223 /*     select transaction_type_name
224        into cfmRec.row.transaction_source_name
225      from mtl_transaction_types
226      where transaction_type_id = param.transactionType;
227 */
228      cfmRec.row.schedule_number := scheduleNumber;
229      cfmRec.row.repetitive_line_id := param.lineId;
230      cfmRec.row.operation_seq_num := param.lineOp;
231      cfmRec.row.scheduled_flag := param.scheduledFlag;
232      cfmRec.row.flow_schedule := 'Y';
233      cfmRec.row.transaction_source_id := param.wipEntityID;
234 
235      cfmRec.row.accounting_class := accountingClass;
236      cfmRec.row.kanban_card_id := param.kanbanID;
237 
238      cfmRec.row.demand_source_header_id := param.demandSourceHeaderID;
239      cfmRec.row.demand_source_line := param.demandSourceLine;
240      cfmRec.row.demand_source_delivery := param.demandSourceDelivery;
241 
242      cfmRec.row.source_project_id := param.projectID;
243      cfmRec.row.source_task_id := param.taskID;
244      if ( param.wipEntityID is not null and param.scheduledFlag = 1 and
245           param.projectID is null ) then
246        select project_id,
247               task_id
248          into cfmRec.row.source_project_id,
249               cfmRec.row.source_task_id
250          from wip_flow_schedules
251         where wip_entity_id = param.wipEntityID
252           and organization_id = param.environment.orgID;
253      end if;
254 
255      /* -- Commented Out By Rajesh as reservation parameters will be passed fromUI
256      if ( param.wipEntityID is not null and param.scheduledFlag = 1 ) then
257        -- if the item is a CTO item then we should populate sales order info to mmtt
258        -- talked to Renga and the following sql should be used to determine whether the
259        -- item is CTO item or not.
260        dummy := 0;
261        select count(*) into dummy
262          from mtl_system_items
263         where inventory_item_id = param.assemblyID
264           and organization_id = param.environment.orgID
265           and build_in_wip_flag = 'Y'
266           and base_item_id is not null
267           and bom_item_type = 4
268           and replenish_to_order_flag = 'Y';
269        if ( dummy = 1 ) then
270          select demand_source_header_id,
271                 demand_source_line,
272                 demand_source_delivery
273            into cfmRec.row.demand_source_header_id,
274                 cfmRec.row.demand_source_line,
275                 cfmRec.row.demand_source_delivery
276            from wip_flow_schedules
277           where organization_id = param.environment.orgID
278             and wip_entity_id = param.wipEntityID;
279        end if;
280      end if;
281      */
282 
283      return true;
284    End derive;
285 
286   Function derive(lpnParam LpnCfmParam,
287                   lpnCfmRec OUT NOCOPY LpnCfmRecord,
288                   errMsg OUT NOCOPY VARCHAR2) return boolean
289  IS
290      assembly wma_common.Item;
291      periodID number;
292      openPastPeriod boolean := false;
293      defaultPrefix VARCHAR2(200);
294      scheduleNumber VARCHAR2(30);
295      scrapAcctID NUMBER := null;
296      dummy NUMBER;
297      accountingClass VARCHAR2(30);
298      errMesg1 VARCHAR2(30);
299      errClass1 VARCHAR2(10);
300      errMesg2 VARCHAR2(30);
301      errClass2 VARCHAR2(10);
302      revision VARCHAR(30);
303      x_released_revs_type	NUMBER;
304      x_released_revs_meaning	Varchar2(30);
305 
306    Begin
307 
308      -- validate the qty to make sure it is greater than zero.
309      if ( lpnParam.transactionQty <= 0 ) then
310        fnd_message.set_name('INV', 'INV_GREATER_THAN_ZERO');
311        errMsg := fnd_message.get;
312        return false;
313      end if;
314 
315      assembly := wma_derive.getItem(lpnParam.assemblyID,
316                                     lpnParam.environment.orgID,
317                                     lpnParam.locatorID);
318 
319      if assembly.revQtyControlCode = WIP_CONSTANTS.REV then
320         /* 3033785 */
321         wip_common.Get_Released_Revs_Type_Meaning (x_released_revs_type,
322                                                    x_released_revs_meaning
323                                                   );
324         BOM_REVISIONS.Get_Revision(
325                         type         => 'PART',
326                         eco_status   => x_released_revs_meaning,
327                         examine_type => 'ALL',
328                         org_id       => lpnParam.environment.orgID,
329                         item_id      => lpnParam.assemblyID,
330                         rev_date     => lpnParam.transactionDate,
331                         itm_rev      => revision);
332      else
333        revision := NULL;
334      end if;
335 
336      accountingClass := wip_common.default_acc_class(
337                             lpnParam.environment.orgID,
338                             lpnParam.assemblyID,
339                             4,  -- for flow schedule
340                             assembly.projectID,
341                             errMesg1,
342                             errClass1,
343                             errMesg2,
344                             errClass2);
345 
346      -- get the accounting period
347      invttmtx.tdatechk(
348           org_id           => lpnParam.environment.orgID,
349           transaction_date => lpnParam.transactionDate,
350           period_id        => periodID,
351           open_past_period => openPastPeriod);
352 
353      if (periodID = -1 or periodID = 0) then
354       fnd_message.set_name(
355         application => 'INV',
356         name        => 'INV_NO_OPEN_PERIOD');
357       errMsg := fnd_message.get;
358       return false;
359     end if;
360 
361      -- default schedule number, it is the value read from profile option 'WIP_JOB_PREFIX'
362      -- appended by a sequence number. We only default it for non flow schedule.
363      -- 3 means unscheduled, 1 means scheduled
364      --if ( lpnParam.scheduledFlag = 3 and lpnParam.scheduleNumber is null ) then
365      --  defaultPrefix := substr(fnd_profile.value('WIP_JOB_PREFIX'), 1, 200);
366      --  scheduleNumber := defaultPrefix || wma_derive.getNextVal('WIP_JOB_NUMBER_S');
367      --else
368      --  scheduleNumber := lpnParam.scheduleNumber;
369      --end if;
370 
371      lpnCfmRec.row.transaction_date := lpnParam.transactionDate;
372 
373      -- derive routing and bom rev info
374      dummy := Wip_Flow_Derive.bom_revision (
375                  p_bom_rev      => lpnCfmRec.row.bom_revision,
376                  p_rev          => revision,--lpnCfmRec.row.revision,
377                  p_bom_rev_date => lpnCfmRec.row.bom_revision_date,
378                  p_item_id      => lpnParam.assemblyID,
379                  p_start_date   => lpnCfmRec.row.transaction_date,
380                  p_Org_id       => lpnParam.environment.orgID);
381 
382      dummy := Wip_Flow_Derive.routing_revision(
383                  p_rout_rev      => lpnCfmRec.row.routing_revision,
384                  p_rout_rev_date => lpnCfmRec.row.routing_revision_date,
385                  p_item_id       => lpnParam.assemblyID,
386                  p_start_date    => lpnCfmRec.row.transaction_date,
387                  p_Org_id        => lpnParam.environment.orgID);
388 
389      -- fix bug 1910976
390      if ( lpnCfmRec.row.bom_revision = NULL) then
391         lpnCfmRec.row.bom_revision := revision;
392      end if;
393 
394      lpnCfmRec.row.header_id := lpnParam.headerID;
395      lpnCfmRec.row.lock_flag := 'N';
396      lpnCfmRec.row.transaction_mode := WIP_CONSTANTS.BACKGROUND;
397 
398 
399      lpnCfmRec.row.last_updated_by := lpnParam.environment.userID;
400      lpnCfmRec.row.last_update_date := sysdate;
401      lpnCfmRec.row.creation_date := sysdate;
402      lpnCfmRec.row.created_by := lpnParam.environment.userID;
403      lpnCfmRec.row.lpn_id := lpnParam.lpnID;
404 
405      lpnCfmRec.row.inventory_item_id := lpnParam.assemblyID;
406      lpnCfmRec.row.organization_id := lpnParam.environment.orgID;
407      lpnCfmRec.row.acct_period_id := periodID;
408 
409      lpnCfmRec.row.transaction_type_id := lpnParam.transactionType;
410      lpnCfmRec.row.transaction_quantity := lpnParam.transactionQty;
411      lpnCfmRec.row.primary_quantity := lpnParam.transactionQty;
412 
413      if ( lpnParam.transactionType = WIP_CONSTANTS.CPLASSY_TYPE ) then
414         -- for completion
415         lpnCfmRec.row.transaction_action_id := WIP_CONSTANTS.CPLASSY_ACTION;
416      elsif ( lpnParam.transactionType = WIP_CONSTANTS.RETASSY_TYPE ) then
417         -- for return
418         lpnCfmRec.row.transaction_action_id := WIP_CONSTANTS.RETASSY_ACTION;
419         lpnCfmRec.row.transaction_quantity := lpnParam.transactionQty * -1;
420         lpnCfmRec.row.primary_quantity := lpnParam.transactionQty * -1;
421      elsif ( lpnParam.transactionType = WIP_CONSTANTS.SCRASSY_TYPE ) then
422         -- for scrap
423         lpnCfmRec.row.transaction_action_id := WIP_CONSTANTS.SCRASSY_ACTION;
424         if ( wma_util.getScrapAcctID(lpnParam.environment.orgID,
425                                      scrapAcctID,
426                                      errMsg) = false ) then
427           return false;
428         end if;
429      elsif ( lpnParam.transactionType = 91 ) then
430         -- for return from scrap, it has the same action id as scrap, you
431         -- can only distinguish them by type id
432         lpnCfmRec.row.transaction_action_id := WIP_CONSTANTS.SCRASSY_ACTION;
433         lpnCfmRec.row.transaction_quantity := lpnParam.transactionQty * -1;
434         lpnCfmRec.row.primary_quantity := lpnParam.transactionQty * -1;
435         if ( wma_util.getScrapAcctID(lpnParam.environment.orgID,
436                                      scrapAcctID,
437                                      errMsg) = false ) then
438           return false;
439         end if;
440      end if;
441 --     lpnCfmRec.row.distribution_account_id := scrapAcctID;
442      lpnCfmRec.row.transaction_uom := lpnParam.transactionUOM;
443      lpnCfmRec.row.subinventory_code := lpnParam.subinventoryCode;
444      lpnCfmRec.row.locator_id := lpnParam.locatorID;
445      lpnCfmRec.row.reason_id := lpnParam.reasonID;
446      lpnCfmRec.row.qa_collection_id := lpnParam.qualityID;
447      lpnCfmRec.row.transaction_source_type_id := 5; -- means WIP
448      lpnCfmRec.row.wip_entity_type := 4; -- means flow schedule
449 
450 --     lpnCfmRec.row.schedule_number := scheduleNumber;
451 --     lpnCfmRec.row.repetitive_line_id := lpnParam.lineId;
452 --     lpnCfmRec.row.operation_seq_num := lpnParam.lineOp;
453      lpnCfmRec.row.completion_transaction_id := lpnParam.completionTxnID;
454      lpnCfmRec.row.wip_entity_id := lpnParam.wipEntityID;
455 --     lpnCfmRec.row.scheduled_flag := lpnParam.scheduledFlag;
456 --     lpnCfmRec.row.flow_schedule := 'Y';
457 
458      lpnCfmRec.row.accounting_class := accountingClass;
459      lpnCfmRec.row.item_project_id := assembly.projectID;
460      lpnCfmRec.row.item_task_id := assembly.taskID;
461      lpnCfmRec.row.kanban_card_id := lpnParam.kanbanID;
462 
463      lpnCfmRec.row.demand_source_header_id := lpnParam.demandSourceHeaderID;
464      lpnCfmRec.row.demand_source_line := lpnParam.demandSourceLine;
465      lpnCfmRec.row.demand_source_delivery := lpnParam.demandSourceDelivery;
466      return true;
467    End derive;
468 
469 
470    /**
471     * This function is used to insert the record encapsulated in cfmRec to
472     * table mtl_transactions_interface and some furthur validation and processing.
473     */
474    Function put(cfmRec CfmRecord, errMsg OUT NOCOPY VARCHAR2) return boolean IS
475    Begin
476      INSERT INTO mtl_transactions_interface
477                 (transaction_interface_id,
478                  transaction_header_id,
479                  lock_flag, transaction_mode,
480                  process_flag, validation_required,
481                  source_code,
482                  source_line_id,
483                  source_header_id,
484                  last_updated_by, last_update_date,
485                  creation_date, created_by,
486                  inventory_item_id,
487                  organization_id,
488                  acct_period_id,
489                  transaction_date,
490                  bom_revision, revision,
491                  bom_revision_date,
492                  routing_revision, routing_revision_date,
493                  transaction_type_id,
494                  negative_req_flag,
495                  transaction_action_id,
496                  transaction_quantity,
497                  primary_quantity,
498                  distribution_account_id,
499                  transaction_uom,
500                  subinventory_code,
501                  locator_id, reason_id,
502                  qa_collection_id,
503                  transaction_source_type_id,
504                  wip_entity_type,
505                  transaction_source_name,
506                  schedule_number,
507                  repetitive_line_id,
508                  operation_seq_num,
509                  scheduled_flag, flow_schedule,
510                  transaction_source_id,
511                  accounting_class,
512                  source_project_id,
513                  source_task_id,
514                  kanban_card_id,
515                  demand_source_header_id,
516                  demand_source_line,
517                  demand_source_delivery
518                 )
519          VALUES (cfmRec.row.transaction_interface_id,
520                  cfmRec.row.transaction_header_id,
521                  cfmRec.row.lock_flag, cfmRec.row.transaction_mode,
522                  cfmRec.row.process_flag, cfmRec.row.validation_required,
523                  cfmRec.row.source_code, cfmRec.row.source_line_id,
524                  cfmRec.row.source_header_id,
525                  cfmRec.row.last_updated_by, cfmRec.row.last_update_date,
526                  cfmRec.row.creation_date, cfmRec.row.created_by,
527                  cfmRec.row.inventory_item_id,
528                  cfmRec.row.organization_id,
529                  cfmRec.row.acct_period_id,
530                  cfmRec.row.transaction_date,
531                  cfmRec.row.bom_revision, cfmRec.row.revision,
532                  cfmRec.row.bom_revision_date,
533                  cfmRec.row.routing_revision, cfmRec.row.routing_revision_date,
534                  cfmRec.row.transaction_type_id,
535                  cfmRec.row.negative_req_flag,
536                  cfmRec.row.transaction_action_id,
537                  cfmRec.row.transaction_quantity,
538                  cfmRec.row.primary_quantity,
539                  cfmRec.row.distribution_account_id,
540                  cfmRec.row.transaction_uom,
541                  cfmRec.row.subinventory_code,
542                  cfmRec.row.locator_id, cfmRec.row.reason_id,
543                  cfmRec.row.qa_collection_id,
544                  cfmRec.row.transaction_source_type_id,
545                  cfmRec.row.wip_entity_type,
546                  cfmRec.row.transaction_source_name,
547                  cfmRec.row.schedule_number,
548                  cfmRec.row.repetitive_line_id,
549                  cfmRec.row.operation_seq_num,
550                  cfmRec.row.scheduled_flag, cfmRec.row.flow_schedule,
551                  cfmRec.row.transaction_source_id,
552                  cfmRec.row.accounting_class,
553                  cfmRec.row.source_project_id,
554                  cfmRec.row.source_task_id,
555                  cfmRec.row.kanban_card_id,
556                  cfmRec.row.demand_source_header_id,
557                  cfmRec.row.demand_source_line,
558                  cfmRec.row.demand_source_delivery
559                 );
560      return true;
561 
562      EXCEPTION
563      when others then
564        fnd_message.set_name ('WIP', 'GENERIC_ERROR');
565        fnd_message.set_token ('FUNCTION', 'wma_work_order_less.derive');
566        fnd_message.set_token ('ERROR', SQLCODE || ' ' || SQLERRM);
567        errMsg := fnd_message.get;
568        return false;
569    End put;
570 
571   Function put(lpnCfmRec LpnCfmRecord, errMsg OUT NOCOPY VARCHAR2) return boolean
572  IS
573    Begin
574      INSERT INTO wip_lpn_completions
575                 (header_id, source_id, source_code,
576                  lock_flag, transaction_mode,
577                  last_updated_by, last_update_date,
578                  creation_date, created_by,
579                  inventory_item_id,
580                  organization_id,
581                  acct_period_id,
582                  transaction_date,
583                  bom_revision, --check later revision,
584                  bom_revision_date,
585                  routing_revision, routing_revision_date,
586                  transaction_type_id,
587                  transaction_action_id,
588                  transaction_quantity,
589                  primary_quantity,
590 --                 distribution_account_id,
591                  transaction_uom,
592                  subinventory_code,
593                  locator_id, reason_id,
594                  qa_collection_id,
595                  transaction_source_type_id,
596                  wip_entity_id,
597                  wip_entity_type,
598                  --repetitive_line_id,
599                  operation_seq_num,
600                  transaction_source_id,
601                  accounting_class,
602                  item_project_id,
603                  item_task_id,
604                  kanban_card_id,
605                  lpn_id,
606                  completion_transaction_id,
607                  demand_source_header_id,
608                  demand_source_line,
609                  demand_source_delivery
610                 )
611          VALUES (lpnCfmRec.row.header_id, lpnCfmRec.row.header_id, WMA_COMMON.SOURCE_CODE,
612                  lpnCfmRec.row.lock_flag, lpnCfmRec.row.transaction_mode,
613                  lpnCfmRec.row.last_updated_by, lpnCfmRec.row.last_update_date,
614                  lpnCfmRec.row.creation_date, lpnCfmRec.row.created_by,
615                  lpnCfmRec.row.inventory_item_id,
616                  lpnCfmRec.row.organization_id,
617                  lpnCfmRec.row.acct_period_id,
618                  lpnCfmRec.row.transaction_date,
619                  lpnCfmRec.row.bom_revision,-- lpnCfmRec.row.revision,
620                  lpnCfmRec.row.bom_revision_date,
621                  lpnCfmRec.row.routing_revision, lpnCfmRec.row.routing_revision_date,
622                  lpnCfmRec.row.transaction_type_id,
623                  lpnCfmRec.row.transaction_action_id,
624                  lpnCfmRec.row.transaction_quantity,
625                  lpnCfmRec.row.primary_quantity,
626 --                 lpnCfmRec.row.distribution_account_id,
627                  lpnCfmRec.row.transaction_uom,
628                  lpnCfmRec.row.subinventory_code,
629                  lpnCfmRec.row.locator_id, lpnCfmRec.row.reason_id,
630                  lpnCfmRec.row.qa_collection_id,
631                  lpnCfmRec.row.transaction_source_type_id,
632                  lpnCfmRec.row.wip_entity_id,
633                  lpnCfmRec.row.wip_entity_type,
634                  --lpnCfmRec.row.repetitive_line_id,
635                  lpnCfmRec.row.operation_seq_num,
636                  lpnCfmRec.row.transaction_source_id,
637                  lpnCfmRec.row.accounting_class,
638                  lpnCfmRec.row.item_project_id, lpnCfmRec.row.item_task_id,
639                  lpnCfmRec.row.kanban_card_id,
640                  lpnCfmRec.row.lpn_id,
641                  lpnCfmRec.row.completion_transaction_id,
642                  lpnCfmRec.row.demand_source_header_id,
643                  lpnCfmRec.row.demand_source_line,
644                  lpnCfmRec.row.demand_source_delivery
645                 );
646      return true;
647 
648      EXCEPTION
649      when others then
650        fnd_message.set_name ('WIP', 'GENERIC_ERROR');
651        fnd_message.set_token ('FUNCTION', 'wma_work_order_less.derive');
652        fnd_message.set_token ('ERROR', SQLCODE || ' ' || SQLERRM);
653        errMsg := fnd_message.get;
654        return false;
655    End put;
656 
657 END wma_cfm;