19:
20:
21: BEGIN
22:
23: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
24: Ibe_Util.debug('Begin IBE_ORDER_SAVE_PVT:Get_Order_Status');
25: END IF;
26:
27: OPEN c_gethdrstatus(p_header_id);
20:
21: BEGIN
22:
23: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
24: Ibe_Util.debug('Begin IBE_ORDER_SAVE_PVT:Get_Order_Status');
25: END IF;
26:
27: OPEN c_gethdrstatus(p_header_id);
28: FETCH c_gethdrstatus INTO l_gethdrstatus;
34: x_last_update_date := l_gethdrstatus.last_update_date;
35: END IF;
36: CLOSE c_gethdrstatus;
37:
38: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
39: Ibe_Util.debug('End IBE_ORDER_SAVE_PVT:Get_Order_Status');
40: END IF;
41:
42: END Get_Order_Status;
35: END IF;
36: CLOSE c_gethdrstatus;
37:
38: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
39: Ibe_Util.debug('End IBE_ORDER_SAVE_PVT:Get_Order_Status');
40: END IF;
41:
42: END Get_Order_Status;
43:
73: l_msg_type VARCHAR2(30);
74:
75: BEGIN
76:
77: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
78: Ibe_Util.debug('Begin IBE_ORDER_SAVE_PVT:Retrieve_OE_Messages');
79: END IF;
80:
81: OE_MSG_PUB.Count_And_Get
74:
75: BEGIN
76:
77: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
78: Ibe_Util.debug('Begin IBE_ORDER_SAVE_PVT:Retrieve_OE_Messages');
79: END IF;
80:
81: OE_MSG_PUB.Count_And_Get
82: ( p_count => l_msg_count,
134: END IF;
135:
136: x_msg_data := l_msg_context||l_msg_data;
137:
138: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
139: Ibe_Util.debug('Retrieve_OE_Messages - x_msg_data: '||x_msg_data);
140: END IF;
141:
142: l_len_sqlerrm := Length(x_msg_data) ;
135:
136: x_msg_data := l_msg_context||l_msg_data;
137:
138: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
139: Ibe_Util.debug('Retrieve_OE_Messages - x_msg_data: '||x_msg_data);
140: END IF;
141:
142: l_len_sqlerrm := Length(x_msg_data) ;
143: WHILE l_len_sqlerrm >= i
151: END IF;
152: END LOOP;
153: END IF;
154:
155: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
156: Ibe_Util.debug('End IBE_ORDER_SAVE_PVT:Retrieve_OE_Messages');
157: END IF;
158:
159: END Retrieve_OE_Messages;
152: END LOOP;
153: END IF;
154:
155: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
156: Ibe_Util.debug('End IBE_ORDER_SAVE_PVT:Retrieve_OE_Messages');
157: END IF;
158:
159: END Retrieve_OE_Messages;
160:
166: IS
167:
168: BEGIN
169:
170: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
171: Ibe_Util.debug('Begin IBE_ORDER_SAVE_PVT:Deactivate Order: ' || p_party_id || ' : '||p_cust_account_id);
172: END IF;
173:
174:
167:
168: BEGIN
169:
170: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
171: Ibe_Util.debug('Begin IBE_ORDER_SAVE_PVT:Deactivate Order: ' || p_party_id || ' : '||p_cust_account_id);
172: END IF;
173:
174:
175: IBE_ACTIVE_QUOTES_ALL_PKG.Update_row(
183: X_LAST_UPDATE_LOGIN => 1,
184: X_RECORD_TYPE => 'ORDER');
185:
186:
187: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
188: Ibe_Util.debug('End IBE_ORDER_SAVE_PVT:DeactivateOrder');
189: END IF;
190:
191: END DeactivateOrder;
184: X_RECORD_TYPE => 'ORDER');
185:
186:
187: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
188: Ibe_Util.debug('End IBE_ORDER_SAVE_PVT:DeactivateOrder');
189: END IF;
190:
191: END DeactivateOrder;
192:
215:
216:
217: BEGIN
218:
219: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
220: Ibe_Util.debug('Begin IBE_ORDER_SAVE_PVT:ActivateOrder');
221: END IF;
222:
223: open c_check_pr_aqa( p_party_id,p_cust_account_id,p_currency_code);
216:
217: BEGIN
218:
219: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
220: Ibe_Util.debug('Begin IBE_ORDER_SAVE_PVT:ActivateOrder');
221: END IF;
222:
223: open c_check_pr_aqa( p_party_id,p_cust_account_id,p_currency_code);
224: fetch c_check_pr_aqa into rec_check_pr_aqa;
223: open c_check_pr_aqa( p_party_id,p_cust_account_id,p_currency_code);
224: fetch c_check_pr_aqa into rec_check_pr_aqa;
225: if (c_check_pr_aqa%notfound) then
226:
227: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
228: Ibe_Util.debug('Pending Return Not Exists');
229: END IF;
230: IBE_ACTIVE_QUOTES_ALL_PKG.Insert_row(
231: X_OBJECT_VERSION_NUMBER => 1,
224: fetch c_check_pr_aqa into rec_check_pr_aqa;
225: if (c_check_pr_aqa%notfound) then
226:
227: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
228: Ibe_Util.debug('Pending Return Not Exists');
229: END IF;
230: IBE_ACTIVE_QUOTES_ALL_PKG.Insert_row(
231: X_OBJECT_VERSION_NUMBER => 1,
232: X_ORDER_HEADER_ID => p_order_header_id,
242: X_ORG_ID => mo_global.GET_CURRENT_ORG_ID());
243:
244:
245: else
246: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
247: Ibe_Util.debug('Pending Return Already Exists');
248: END IF;
249:
250: IBE_ACTIVE_QUOTES_ALL_PKG.update_row(
243:
244:
245: else
246: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
247: Ibe_Util.debug('Pending Return Already Exists');
248: END IF;
249:
250: IBE_ACTIVE_QUOTES_ALL_PKG.update_row(
251: X_OBJECT_VERSION_NUMBER => 1,
260:
261:
262: END IF;
263:
264: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
265: Ibe_Util.debug('End IBE_ORDER_SAVE_PVT:ActivateOrder');
266: END IF;
267:
268: END ActivateOrder;
261:
262: END IF;
263:
264: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
265: Ibe_Util.debug('End IBE_ORDER_SAVE_PVT:ActivateOrder');
266: END IF;
267:
268: END ActivateOrder;
269:
292: l_parseKey varchar2(40) :='ORDER_SAVE_LINE_IDS';
293:
294: BEGIN
295:
296: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
297: Ibe_Util.debug('Begin IBE_ORDER_SAVE_PVT:DefaultFromLineSiteId');
298: END IF;
299:
300: for lineIdx in 1..p_line_tbl.count
293:
294: BEGIN
295:
296: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
297: Ibe_Util.debug('Begin IBE_ORDER_SAVE_PVT:DefaultFromLineSiteId');
298: END IF;
299:
300: for lineIdx in 1..p_line_tbl.count
301: loop
306: END IF;
307: end loop;
308:
309:
310: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
311: Ibe_util.debug('p_line_ids set: '||p_line_ids);
312: end if;
313:
314: /** This API is called for parsing the where condition PlSQL Bind Variables Std. **/
307: end loop;
308:
309:
310: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
311: Ibe_util.debug('p_line_ids set: '||p_line_ids);
312: end if;
313:
314: /** This API is called for parsing the where condition PlSQL Bind Variables Std. **/
315: IBE_LEAD_IMPORT_PVT.parseInput (p_line_ids, 'CHAR', l_parseKey,l_parseNum, l_line_id_query);
319: 'WHERE csu.status = ''A'' AND site_use_code = :siteusecode '||
320: 'AND csu.site_use_id IN ('||l_line_id_query||')';
321:
322:
323: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
324: IBE_Util.debug('qry executed: '|| l_tmp_query);
325: end if;
326: open psitetype_tmp for l_tmp_query using p_siteuse_type,l_parseKey;
327: fetch psitetype_tmp into l_linesite_use_id;
320: 'AND csu.site_use_id IN ('||l_line_id_query||')';
321:
322:
323: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
324: IBE_Util.debug('qry executed: '|| l_tmp_query);
325: end if;
326: open psitetype_tmp for l_tmp_query using p_siteuse_type,l_parseKey;
327: fetch psitetype_tmp into l_linesite_use_id;
328: close psitetype_tmp;
325: end if;
326: open psitetype_tmp for l_tmp_query using p_siteuse_type,l_parseKey;
327: fetch psitetype_tmp into l_linesite_use_id;
328: close psitetype_tmp;
329: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
330: IBE_Util.debug('site use id from line: '|| l_linesite_use_id);
331: end if;
332: x_site_use_id := l_linesite_use_id;
333:
326: open psitetype_tmp for l_tmp_query using p_siteuse_type,l_parseKey;
327: fetch psitetype_tmp into l_linesite_use_id;
328: close psitetype_tmp;
329: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
330: IBE_Util.debug('site use id from line: '|| l_linesite_use_id);
331: end if;
332: x_site_use_id := l_linesite_use_id;
333:
334: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
330: IBE_Util.debug('site use id from line: '|| l_linesite_use_id);
331: end if;
332: x_site_use_id := l_linesite_use_id;
333:
334: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
335: Ibe_Util.debug('End IBE_ORDER_SAVE_PVT:DefaultFromLineSiteId');
336: END IF;
337:
338: END DefaultFromLineSiteId;
331: end if;
332: x_site_use_id := l_linesite_use_id;
333:
334: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
335: Ibe_Util.debug('End IBE_ORDER_SAVE_PVT:DefaultFromLineSiteId');
336: END IF;
337:
338: END DefaultFromLineSiteId;
339:
353: l_line_rec c_get_lineInfo%rowType;
354:
355: BEGIN
356:
357: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
358: IBE_Util.Debug('IBE_ORDER_SAVE_PVT:MergeLines - START');
359: END IF;
360: open c_get_lineInfo(p_order_line_rec.return_attribute2,
361: p_order_line_rec.return_attribute1,
354:
355: BEGIN
356:
357: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
358: IBE_Util.Debug('IBE_ORDER_SAVE_PVT:MergeLines - START');
359: END IF;
360: open c_get_lineInfo(p_order_line_rec.return_attribute2,
361: p_order_line_rec.return_attribute1,
362: p_header_id
363: );
364: Fetch c_get_lineInfo into l_line_rec;
365:
366: if (c_get_lineInfo%found) then
367: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
368: Ibe_Util.Debug('MergeLines Already a record exists.');
369: END IF;
370: x_line_rec := OE_ORDER_PUB.G_MISS_LINE_REC;
371: x_line_rec.item_type_code := p_order_line_rec.item_type_code;
364: Fetch c_get_lineInfo into l_line_rec;
365:
366: if (c_get_lineInfo%found) then
367: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
368: Ibe_Util.Debug('MergeLines Already a record exists.');
369: END IF;
370: x_line_rec := OE_ORDER_PUB.G_MISS_LINE_REC;
371: x_line_rec.item_type_code := p_order_line_rec.item_type_code;
372: x_line_rec.ordered_quantity := p_order_line_rec.ordered_quantity + l_line_rec.ordered_quantity;
372: x_line_rec.ordered_quantity := p_order_line_rec.ordered_quantity + l_line_rec.ordered_quantity;
373: x_line_rec.line_id := l_line_rec.line_id;
374: x_line_rec.operation := OE_Globals.G_OPR_UPDATE;
375: else
376: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
377: Ibe_Util.Debug('MergeLines else part: No previous record');
378: end if;
379: x_line_rec := p_order_line_rec;
380: x_line_rec.operation := OE_GLOBALS.G_OPR_CREATE;
373: x_line_rec.line_id := l_line_rec.line_id;
374: x_line_rec.operation := OE_Globals.G_OPR_UPDATE;
375: else
376: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
377: Ibe_Util.Debug('MergeLines else part: No previous record');
378: end if;
379: x_line_rec := p_order_line_rec;
380: x_line_rec.operation := OE_GLOBALS.G_OPR_CREATE;
381: end if;
380: x_line_rec.operation := OE_GLOBALS.G_OPR_CREATE;
381: end if;
382: close c_get_lineInfo;
383:
384: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
385: IBE_Util.Debug('End IBE_ORDER_SAVE_PVT:MergeLines');
386: END IF;
387: END MergeLines;
388:
381: end if;
382: close c_get_lineInfo;
383:
384: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
385: IBE_Util.Debug('End IBE_ORDER_SAVE_PVT:MergeLines');
386: END IF;
387: END MergeLines;
388:
389:
399: l_linetypeinfo c_linetypeinfo%rowtype;
400:
401: BEGIN
402:
403: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
404: IBE_Util.Debug('BEgin IBE_ORDER_SAVE_PVT:DefaultLineTypes');
405: END IF;
406: open c_linetypeInfo(p_header_type_id);
407: fetch c_linetypeinfo into l_linetypeinfo;
400:
401: BEGIN
402:
403: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
404: IBE_Util.Debug('BEgin IBE_ORDER_SAVE_PVT:DefaultLineTypes');
405: END IF;
406: open c_linetypeInfo(p_header_type_id);
407: fetch c_linetypeinfo into l_linetypeinfo;
408: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
404: IBE_Util.Debug('BEgin IBE_ORDER_SAVE_PVT:DefaultLineTypes');
405: END IF;
406: open c_linetypeInfo(p_header_type_id);
407: fetch c_linetypeinfo into l_linetypeinfo;
408: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
409: IBE_util.debug('line type id info' || c_linetypeinfo%rowcount);
410: end if;
411: x_line_type_id := l_linetypeinfo.DEFAULT_INBOUND_LINE_TYPE_ID;
412: close c_linetypeinfo;
405: END IF;
406: open c_linetypeInfo(p_header_type_id);
407: fetch c_linetypeinfo into l_linetypeinfo;
408: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
409: IBE_util.debug('line type id info' || c_linetypeinfo%rowcount);
410: end if;
411: x_line_type_id := l_linetypeinfo.DEFAULT_INBOUND_LINE_TYPE_ID;
412: close c_linetypeinfo;
413:
410: end if;
411: x_line_type_id := l_linetypeinfo.DEFAULT_INBOUND_LINE_TYPE_ID;
412: close c_linetypeinfo;
413:
414: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
415: IBE_Util.Debug('End IBE_ORDER_SAVE_PVT:DefaultLineTypes');
416: END IF;
417:
418: END DefaultLineTypes;
411: x_line_type_id := l_linetypeinfo.DEFAULT_INBOUND_LINE_TYPE_ID;
412: close c_linetypeinfo;
413:
414: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
415: IBE_Util.Debug('End IBE_ORDER_SAVE_PVT:DefaultLineTypes');
416: END IF;
417:
418: END DefaultLineTypes;
419:
446: l_orderhdr_typeid NUMBER;
447:
448: BEGIN
449:
450: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
451: Ibe_util.Debug('Begin IBE_ORDER_SAVE_PVT: DefaultLineRecord');
452: END IF;
453: For j IN 1..p_order_line_tbl.COUNT
454: Loop
447:
448: BEGIN
449:
450: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
451: Ibe_util.Debug('Begin IBE_ORDER_SAVE_PVT: DefaultLineRecord');
452: END IF;
453: For j IN 1..p_order_line_tbl.COUNT
454: Loop
455: l_order_line_tbl(j) := p_order_line_tbl(j);
474:
475: DefaultLineTypes(p_header_type_id => l_orderhdr_typeid
476: ,x_line_type_id => l_linetype_id);
477:
478: IF (IBE_UTIL.G_DEBUGON = l_true) then
479: IBE_util.debug('p_save_type: ' || p_save_type);
480: end if;
481:
482: For i in 1..l_order_line_tbl.COUNT
475: DefaultLineTypes(p_header_type_id => l_orderhdr_typeid
476: ,x_line_type_id => l_linetype_id);
477:
478: IF (IBE_UTIL.G_DEBUGON = l_true) then
479: IBE_util.debug('p_save_type: ' || p_save_type);
480: end if;
481:
482: For i in 1..l_order_line_tbl.COUNT
483: LOOP
500: MergeLines(p_header_id => p_order_header_rec.HEADER_ID,
501: p_order_line_rec => l_order_line_tbl(i),
502: x_line_rec => lx_line_rec);
503:
504: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
505: ibe_util.Debug('Save:line_tbl.ordered_quantity' || lx_line_rec.ORDERED_QUANTITY);
506: ibe_util.Debug('Save:line_tbl.operation ' || lx_line_rec.operation);
507: END IF;
508: l_order_line_tbl(i) := lx_line_rec;
501: p_order_line_rec => l_order_line_tbl(i),
502: x_line_rec => lx_line_rec);
503:
504: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
505: ibe_util.Debug('Save:line_tbl.ordered_quantity' || lx_line_rec.ORDERED_QUANTITY);
506: ibe_util.Debug('Save:line_tbl.operation ' || lx_line_rec.operation);
507: END IF;
508: l_order_line_tbl(i) := lx_line_rec;
509:
502: x_line_rec => lx_line_rec);
503:
504: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
505: ibe_util.Debug('Save:line_tbl.ordered_quantity' || lx_line_rec.ORDERED_QUANTITY);
506: ibe_util.Debug('Save:line_tbl.operation ' || lx_line_rec.operation);
507: END IF;
508: l_order_line_tbl(i) := lx_line_rec;
509:
510: /* The following IF LOOP would be executed when there is already an active pending Return And
535: THEN
536: IF (l_linetype_id is not null AND l_linetype_id <> FND_API.G_MISS_NUM)
537: THEN
538: l_order_line_tbl(i).line_type_id := l_linetype_id;
539: IF (IBE_UTIL.G_DEBUGON = l_true) then
540: ibe_util.debug('line type id..'||l_order_line_tbl(i).line_type_id);
541: end if;
542: ELSE
543: FND_Message.Set_Name('IBE', 'IBE_ERR_OT_LINE_TYPE_ID_MISS');
536: IF (l_linetype_id is not null AND l_linetype_id <> FND_API.G_MISS_NUM)
537: THEN
538: l_order_line_tbl(i).line_type_id := l_linetype_id;
539: IF (IBE_UTIL.G_DEBUGON = l_true) then
540: ibe_util.debug('line type id..'||l_order_line_tbl(i).line_type_id);
541: end if;
542: ELSE
543: FND_Message.Set_Name('IBE', 'IBE_ERR_OT_LINE_TYPE_ID_MISS');
544: FND_Msg_Pub.Add;
550:
551: /* This flow will be executed when both HEader and Line level are 'CREATE'.
552: ie first time creation of a Return */
553:
554: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
555: ibe_util.Debug('Inside Line Values Defaulting flow');
556: END IF;
557: l_order_line_tbl(i).operation := OE_GLOBALS.G_OPR_CREATE;
558: l_order_line_tbl(i).line_category_code := 'RETURN';
551: /* This flow will be executed when both HEader and Line level are 'CREATE'.
552: ie first time creation of a Return */
553:
554: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
555: ibe_util.Debug('Inside Line Values Defaulting flow');
556: END IF;
557: l_order_line_tbl(i).operation := OE_GLOBALS.G_OPR_CREATE;
558: l_order_line_tbl(i).line_category_code := 'RETURN';
559: l_order_line_tbl(i).return_context := 'ORDER';
578: THEN
579: IF (l_linetype_id is not null AND l_linetype_id <> FND_API.G_MISS_NUM)
580: THEN
581: l_order_line_tbl(i).line_type_id := l_linetype_id;
582: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
583: ibe_util.debug('line type id..'||l_order_line_tbl(i).line_type_id);
584: end if;
585: ELSE
586: FND_Message.Set_Name('IBE', 'IBE_ERR_OT_LINE_TYPE_ID_MISS');
579: IF (l_linetype_id is not null AND l_linetype_id <> FND_API.G_MISS_NUM)
580: THEN
581: l_order_line_tbl(i).line_type_id := l_linetype_id;
582: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
583: ibe_util.debug('line type id..'||l_order_line_tbl(i).line_type_id);
584: end if;
585: ELSE
586: FND_Message.Set_Name('IBE', 'IBE_ERR_OT_LINE_TYPE_ID_MISS');
587: FND_Msg_Pub.Add;
601: Loop
602: x_order_line_tbl(k) := l_order_line_tbl(k);
603: End Loop;
604:
605: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
606: Ibe_util.Debug('End IBE_ORDER_SAVE_PVT:DefaultLineRecord');
607: END IF;
608:
609: END DefaultLineRecord;
602: x_order_line_tbl(k) := l_order_line_tbl(k);
603: End Loop;
604:
605: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
606: Ibe_util.Debug('End IBE_ORDER_SAVE_PVT:DefaultLineRecord');
607: END IF;
608:
609: END DefaultLineRecord;
610:
626: l_active_returnid NUMBER:= FND_API.G_MISS_NUM;
627:
628: BEGIN
629:
630: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
631: Ibe_util.Debug('Begin IBE_ORDER_SAVE_PVT: GetActiveReturnOrder');
632: END IF;
633:
634: OPEN c_getactive_pendret(p_cust_acct_id,
627:
628: BEGIN
629:
630: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
631: Ibe_util.Debug('Begin IBE_ORDER_SAVE_PVT: GetActiveReturnOrder');
632: END IF;
633:
634: OPEN c_getactive_pendret(p_cust_acct_id,
635: p_curr_code,
643: END IF;
644:
645: CLOSE c_getactive_pendret;
646:
647: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
648: Ibe_util.Debug('End IBE_ORDER_SAVE_PVT: GetActiveReturnOrder');
649: END IF;
650:
651: END GetActiveReturnOrder;
644:
645: CLOSE c_getactive_pendret;
646:
647: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
648: Ibe_util.Debug('End IBE_ORDER_SAVE_PVT: GetActiveReturnOrder');
649: END IF;
650:
651: END GetActiveReturnOrder;
652:
674: l_preApprove_prof VARCHAR2(10) := 'N';
675:
676: BEGIN
677:
678: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
679: Ibe_util.Debug('Begin IBE_ORDER_SAVE_PVT: DefaultHeaderRecord');
680: END IF;
681:
682: x_order_header_rec := p_order_header_rec;
675:
676: BEGIN
677:
678: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
679: Ibe_util.Debug('Begin IBE_ORDER_SAVE_PVT: DefaultHeaderRecord');
680: END IF;
681:
682: x_order_header_rec := p_order_header_rec;
683:
680: END IF;
681:
682: x_order_header_rec := p_order_header_rec;
683:
684: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
685: Ibe_util.Debug('p_save_type: ' || p_save_type ||'::'||x_order_header_rec.header_id);
686: Ibe_util.Debug('category_code ' || x_order_header_rec.ORDER_CATEGORY_CODE);
687: END IF;
688:
681:
682: x_order_header_rec := p_order_header_rec;
683:
684: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
685: Ibe_util.Debug('p_save_type: ' || p_save_type ||'::'||x_order_header_rec.header_id);
686: Ibe_util.Debug('category_code ' || x_order_header_rec.ORDER_CATEGORY_CODE);
687: END IF;
688:
689:
682: x_order_header_rec := p_order_header_rec;
683:
684: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
685: Ibe_util.Debug('p_save_type: ' || p_save_type ||'::'||x_order_header_rec.header_id);
686: Ibe_util.Debug('category_code ' || x_order_header_rec.ORDER_CATEGORY_CODE);
687: END IF;
688:
689:
690: IF (p_save_type = SAVE_ADDITEMS) THEN
708: IF (x_order_header_rec.header_id is not null AND
709: x_order_header_rec.header_id <> FND_API.G_MISS_NUM)
710: THEN
711:
712: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
713: Ibe_util.Debug('Header id is not null, so cheking its status');
714: END IF;
715:
716: Get_Order_Status(p_header_id => x_order_header_rec.header_id
709: x_order_header_rec.header_id <> FND_API.G_MISS_NUM)
710: THEN
711:
712: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
713: Ibe_util.Debug('Header id is not null, so cheking its status');
714: END IF;
715:
716: Get_Order_Status(p_header_id => x_order_header_rec.header_id
717: ,x_order_status => l_flow_status_code
716: Get_Order_Status(p_header_id => x_order_header_rec.header_id
717: ,x_order_status => l_flow_status_code
718: ,x_last_update_date => l_last_update_date);
719:
720: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
721: Ibe_util.Debug('last_update_date sent from ui: '||
722: to_char(x_order_header_rec.last_update_date,'dd-mm-yyyy hh:mi:ss'));
723: Ibe_util.Debug('last_update_date from db: '||
724: to_char(l_last_update_date,'dd-mm-yyyy hh:mi:ss'));
717: ,x_order_status => l_flow_status_code
718: ,x_last_update_date => l_last_update_date);
719:
720: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
721: Ibe_util.Debug('last_update_date sent from ui: '||
722: to_char(x_order_header_rec.last_update_date,'dd-mm-yyyy hh:mi:ss'));
723: Ibe_util.Debug('last_update_date from db: '||
724: to_char(l_last_update_date,'dd-mm-yyyy hh:mi:ss'));
725: Ibe_util.Debug('l_flow_status_code: '||l_flow_status_code);
719:
720: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
721: Ibe_util.Debug('last_update_date sent from ui: '||
722: to_char(x_order_header_rec.last_update_date,'dd-mm-yyyy hh:mi:ss'));
723: Ibe_util.Debug('last_update_date from db: '||
724: to_char(l_last_update_date,'dd-mm-yyyy hh:mi:ss'));
725: Ibe_util.Debug('l_flow_status_code: '||l_flow_status_code);
726: END IF;
727:
721: Ibe_util.Debug('last_update_date sent from ui: '||
722: to_char(x_order_header_rec.last_update_date,'dd-mm-yyyy hh:mi:ss'));
723: Ibe_util.Debug('last_update_date from db: '||
724: to_char(l_last_update_date,'dd-mm-yyyy hh:mi:ss'));
725: Ibe_util.Debug('l_flow_status_code: '||l_flow_status_code);
726: END IF;
727:
728: IF ((l_flow_status_code = 'BOOKED' OR l_flow_status_code='CLOSED' OR
729: l_flow_status_code = 'CANCELLED')
733: FND_Msg_Pub.Add;
734: RAISE FND_API.G_EXC_ERROR;
735: ELSE
736: x_order_header_rec.operation := OE_Globals.G_OPR_UPDATE;
737: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
738: Ibe_util.Debug('Return not booked loop: ' ||x_order_header_rec.operation);
739: END IF;
740: END IF;
741:
734: RAISE FND_API.G_EXC_ERROR;
735: ELSE
736: x_order_header_rec.operation := OE_Globals.G_OPR_UPDATE;
737: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
738: Ibe_util.Debug('Return not booked loop: ' ||x_order_header_rec.operation);
739: END IF;
740: END IF;
741:
742: ELSIF (x_order_header_rec.ORDER_CATEGORY_CODE) = 'RETURN' THEN
745: ,p_curr_code => x_order_header_rec.transactional_curr_code
746: ,p_party_id => p_party_id
747: ,x_order_header_id => l_order_header_id);
748:
749: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
750: Ibe_util.Debug('Active pending Return: '||l_order_header_id);
751: END IF;
752:
753: IF(l_order_header_id is null OR l_order_header_id = FND_API.G_MISS_NUM) THEN
746: ,p_party_id => p_party_id
747: ,x_order_header_id => l_order_header_id);
748:
749: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
750: Ibe_util.Debug('Active pending Return: '||l_order_header_id);
751: END IF;
752:
753: IF(l_order_header_id is null OR l_order_header_id = FND_API.G_MISS_NUM) THEN
754:
770: RAISE FND_API.G_EXC_ERROR;
771: END IF;
772: end if; -- if order type id
773:
774: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
775: Ibe_util.Debug('Order Type Id: ' ||x_order_header_rec.order_type_id);
776: END IF;
777:
778: -- Get the User's Session ORG_ID
771: END IF;
772: end if; -- if order type id
773:
774: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
775: Ibe_util.Debug('Order Type Id: ' ||x_order_header_rec.order_type_id);
776: END IF;
777:
778: -- Get the User's Session ORG_ID
779: l_user_orgid := mo_global.GET_CURRENT_ORG_ID();
776: END IF;
777:
778: -- Get the User's Session ORG_ID
779: l_user_orgid := mo_global.GET_CURRENT_ORG_ID();
780: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
781: Ibe_util.Debug('Current Org id : ' ||l_user_orgid);
782: END IF;
783:
784: -- Get the Sales Rep Number from the ASO Utility package
777:
778: -- Get the User's Session ORG_ID
779: l_user_orgid := mo_global.GET_CURRENT_ORG_ID();
780: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
781: Ibe_util.Debug('Current Org id : ' ||l_user_orgid);
782: END IF;
783:
784: -- Get the Sales Rep Number from the ASO Utility package
785: l_salesrep_number := ASO_UTILITY_PVT.GET_OU_ATTRIBUTE_VALUE(aso_utility_pvt.GET_DEFAULT_SALESREP,l_user_orgid);
782: END IF;
783:
784: -- Get the Sales Rep Number from the ASO Utility package
785: l_salesrep_number := ASO_UTILITY_PVT.GET_OU_ATTRIBUTE_VALUE(aso_utility_pvt.GET_DEFAULT_SALESREP,l_user_orgid);
786: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
787: Ibe_util.Debug('Sales Rep Number for Current Org : ' ||l_salesrep_number);
788: END IF;
789: -- Bug 5255625, Proper error message when default salesrep is not set
790: IF (l_salesrep_number is null) THEN
783:
784: -- Get the Sales Rep Number from the ASO Utility package
785: l_salesrep_number := ASO_UTILITY_PVT.GET_OU_ATTRIBUTE_VALUE(aso_utility_pvt.GET_DEFAULT_SALESREP,l_user_orgid);
786: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
787: Ibe_util.Debug('Sales Rep Number for Current Org : ' ||l_salesrep_number);
788: END IF;
789: -- Bug 5255625, Proper error message when default salesrep is not set
790: IF (l_salesrep_number is null) THEN
791: FND_Message.Set_Name('IBE', 'IBE_ERR_OT_SALESREPID_MISS');
795: -- Get the sales rep id from the sales rep number using the JTF table
796: select SALESREP_ID into l_salesrep_id from JTF_RS_SALESREPS where SALESREP_NUMBER = l_salesrep_number and ORG_ID = l_user_orgid;
797: END IF;
798:
799: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
800: Ibe_util.Debug('Sales Rep Id : ' ||l_salesrep_id);
801: END IF;
802: --l_salesrep_id := FND_PROFILE.VALUE('ASO_DEFAULT_PERSON_ID');
803:
796: select SALESREP_ID into l_salesrep_id from JTF_RS_SALESREPS where SALESREP_NUMBER = l_salesrep_number and ORG_ID = l_user_orgid;
797: END IF;
798:
799: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
800: Ibe_util.Debug('Sales Rep Id : ' ||l_salesrep_id);
801: END IF;
802: --l_salesrep_id := FND_PROFILE.VALUE('ASO_DEFAULT_PERSON_ID');
803:
804: IF (l_salesrep_id is null) THEN
809: x_order_header_rec.salesrep_id := l_salesrep_id;
810: END IF;
811: x_order_header_rec.source_document_type_id := 13; -- iStore Account
812:
813: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
814: Ibe_util.Debug('OM::Get_Code_Release_Level: ' ||OE_CODE_CONTROL.Get_Code_Release_Level);
815: END IF;
816:
817: l_preApprove_prof := FND_PROFILE.VALUE('IBE_ENABLE_RETURN_PREBOOK');
810: END IF;
811: x_order_header_rec.source_document_type_id := 13; -- iStore Account
812:
813: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
814: Ibe_util.Debug('OM::Get_Code_Release_Level: ' ||OE_CODE_CONTROL.Get_Code_Release_Level);
815: END IF;
816:
817: l_preApprove_prof := FND_PROFILE.VALUE('IBE_ENABLE_RETURN_PREBOOK');
818: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
814: Ibe_util.Debug('OM::Get_Code_Release_Level: ' ||OE_CODE_CONTROL.Get_Code_Release_Level);
815: END IF;
816:
817: l_preApprove_prof := FND_PROFILE.VALUE('IBE_ENABLE_RETURN_PREBOOK');
818: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
819: Ibe_util.Debug('Enable Pre-Approval Profile value: ' ||l_preApprove_prof);
820: END IF;
821:
822: IF (x_order_header_rec.order_category_code = 'RETURN' AND
815: END IF;
816:
817: l_preApprove_prof := FND_PROFILE.VALUE('IBE_ENABLE_RETURN_PREBOOK');
818: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
819: Ibe_util.Debug('Enable Pre-Approval Profile value: ' ||l_preApprove_prof);
820: END IF;
821:
822: IF (x_order_header_rec.order_category_code = 'RETURN' AND
823: OE_CODE_CONTROL.Get_Code_Release_Level > '110509' AND
836: -- and the user tries to create a return without sending active pending return's HeaderId
837: -- in oe_order_header_rec.header_id. So here defaulting should be done from existing active pending
838: -- return's header record.
839:
840: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
841: IBE_Util.Debug('Inside Header Record update defaulting flow');
842: END IF;
843: x_order_header_rec.header_id := l_order_header_id;
844: open c_defaulthdr_rec(l_order_header_id);
837: -- in oe_order_header_rec.header_id. So here defaulting should be done from existing active pending
838: -- return's header record.
839:
840: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
841: IBE_Util.Debug('Inside Header Record update defaulting flow');
842: END IF;
843: x_order_header_rec.header_id := l_order_header_id;
844: open c_defaulthdr_rec(l_order_header_id);
845: fetch c_defaulthdr_rec into l_ordertype_id;
852: x_order_header_rec.operation := OE_Globals.G_OPR_UPDATE;
853:
854: END IF; -- if order_header_id
855:
856: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
857: Ibe_util.Debug('Operation: ' ||x_order_header_rec.operation);
858: END IF;
859:
860: ELSIF (x_order_header_rec.ORDER_CATEGORY_CODE) = 'ORDER' OR (x_order_header_rec.ORDER_CATEGORY_CODE) = 'MIXED'
853:
854: END IF; -- if order_header_id
855:
856: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
857: Ibe_util.Debug('Operation: ' ||x_order_header_rec.operation);
858: END IF;
859:
860: ELSIF (x_order_header_rec.ORDER_CATEGORY_CODE) = 'ORDER' OR (x_order_header_rec.ORDER_CATEGORY_CODE) = 'MIXED'
861: THEN
862: -- For future enhancements.
863: null;
864: END IF; --IF ORDER_CATEG_CODE
865:
866: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
867: Ibe_util.Debug('End IBE_ORDER_SAVE_PVT:DefaultHeaderRecord');
868: END IF;
869:
870: END DefaultHeaderRecord;
863: null;
864: END IF; --IF ORDER_CATEG_CODE
865:
866: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
867: Ibe_util.Debug('End IBE_ORDER_SAVE_PVT:DefaultHeaderRecord');
868: END IF;
869:
870: END DefaultHeaderRecord;
871:
883: l_order_category_code VARCHAR2(30);
884:
885: BEGIN
886:
887: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
888: Ibe_util.Debug('Begin IBE_Order_Save_Pvt.CancelOrder');
889: END IF;
890:
891: x_order_header_rec := p_order_header_rec;
884:
885: BEGIN
886:
887: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
888: Ibe_util.Debug('Begin IBE_Order_Save_Pvt.CancelOrder');
889: END IF;
890:
891: x_order_header_rec := p_order_header_rec;
892:
896: x_order_header_rec.FLOW_STATUS_CODE := l_header_rec.FLOW_STATUS_CODE;
897: x_order_header_rec.ORDER_CATEGORY_CODE := l_header_rec.ORDER_CATEGORY_CODE;
898: end loop;
899:
900: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
901: Ibe_util.Debug('CancelOrder - FLOW_STATUS_CODE: '||x_order_header_rec.FLOW_STATUS_CODE);
902: Ibe_util.Debug('CancelOrder - ORDER_CATEGORY_CODE: '||x_order_header_rec.ORDER_CATEGORY_CODE);
903: END IF;
904:
897: x_order_header_rec.ORDER_CATEGORY_CODE := l_header_rec.ORDER_CATEGORY_CODE;
898: end loop;
899:
900: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
901: Ibe_util.Debug('CancelOrder - FLOW_STATUS_CODE: '||x_order_header_rec.FLOW_STATUS_CODE);
902: Ibe_util.Debug('CancelOrder - ORDER_CATEGORY_CODE: '||x_order_header_rec.ORDER_CATEGORY_CODE);
903: END IF;
904:
905: IF (x_order_header_rec.FLOW_STATUS_CODE in ('ENTERED','WORKING') AND
898: end loop;
899:
900: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
901: Ibe_util.Debug('CancelOrder - FLOW_STATUS_CODE: '||x_order_header_rec.FLOW_STATUS_CODE);
902: Ibe_util.Debug('CancelOrder - ORDER_CATEGORY_CODE: '||x_order_header_rec.ORDER_CATEGORY_CODE);
903: END IF;
904:
905: IF (x_order_header_rec.FLOW_STATUS_CODE in ('ENTERED','WORKING') AND
906: x_order_header_rec.ORDER_CATEGORY_CODE = 'RETURN') THEN
916:
917: END IF;
918:
919:
920: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
921: Ibe_util.Debug('End IBE_ORDER_SAVE_PVT:CancelOrder');
922: END IF;
923:
924: END CancelOrder;
917: END IF;
918:
919:
920: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
921: Ibe_util.Debug('End IBE_ORDER_SAVE_PVT:CancelOrder');
922: END IF;
923:
924: END CancelOrder;
925:
955: l_party_id NUMBER;
956:
957: BEGIN
958:
959: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
960: Ibe_util.Debug('Begin IBE_ORDER_SAVE_PVT:DefaultHdrLineAddress');
961: end if;
962:
963: -- Initialize API return status to success
956:
957: BEGIN
958:
959: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
960: Ibe_util.Debug('Begin IBE_ORDER_SAVE_PVT:DefaultHdrLineAddress');
961: end if;
962:
963: -- Initialize API return status to success
964: x_return_status := FND_API.G_RET_STS_SUCCESS;
970: loop
971: x_order_line_tbl(lineIdx) := p_order_line_tbl(lineIdx);
972: end loop;
973:
974: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
975: Ibe_util.Debug('Inside DefaultHdrLineAddress party_id' ||p_party_id);
976: END IF;
977:
978: OPEN c_party_type(p_party_id);
971: x_order_line_tbl(lineIdx) := p_order_line_tbl(lineIdx);
972: end loop;
973:
974: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
975: Ibe_util.Debug('Inside DefaultHdrLineAddress party_id' ||p_party_id);
976: END IF;
977:
978: OPEN c_party_type(p_party_id);
979: FETCH c_party_type into l_party_type;
977:
978: OPEN c_party_type(p_party_id);
979: FETCH c_party_type into l_party_type;
980: CLOSE c_party_type;
981: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
982: Ibe_util.Debug('DefaultHdrLineAddress l_party_type'||l_party_type);
983: END IF;
984:
985: -- No need to default any address for line level because OE always
978: OPEN c_party_type(p_party_id);
979: FETCH c_party_type into l_party_type;
980: CLOSE c_party_type;
981: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
982: Ibe_util.Debug('DefaultHdrLineAddress l_party_type'||l_party_type);
983: END IF;
984:
985: -- No need to default any address for line level because OE always
986: -- override the values at line level referencing from original order lines.
1017: ,x_msg_data => x_msg_data
1018: ,x_msg_count => x_msg_count
1019: );
1020:
1021: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1022: Ibe_util.Debug('DefaultHdrLineAddress: After call to Get_Cust_Acct_Site_Use-ShipTO '||x_return_status);
1023: END IF;
1024:
1025:
1018: ,x_msg_count => x_msg_count
1019: );
1020:
1021: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1022: Ibe_util.Debug('DefaultHdrLineAddress: After call to Get_Cust_Acct_Site_Use-ShipTO '||x_return_status);
1023: END IF;
1024:
1025:
1026: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1029: FND_Msg_Pub.Add;
1030: RAISE FND_API.G_EXC_ERROR;
1031: END IF;
1032:
1033: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1034: Ibe_util.Debug('DefaultHdrLineAddress: '||lx_header_siteuse_id);
1035: END IF;
1036:
1037: IF (lx_header_siteuse_id is not null AND lx_header_siteuse_id <> FND_API.G_MISS_NUM)
1030: RAISE FND_API.G_EXC_ERROR;
1031: END IF;
1032:
1033: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1034: Ibe_util.Debug('DefaultHdrLineAddress: '||lx_header_siteuse_id);
1035: END IF;
1036:
1037: IF (lx_header_siteuse_id is not null AND lx_header_siteuse_id <> FND_API.G_MISS_NUM)
1038: THEN
1053: x_order_header_rec.ship_to_org_id := lx_header_siteuse_id;
1054: ELSE
1055:
1056:
1057: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1058: Ibe_util.Debug('DefaultHdrLineAddress: Final Attempt- Ship To');
1059: END IF;
1060:
1061: -- If final attempt also fails, no other go, Raise An Exception
1054: ELSE
1055:
1056:
1057: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1058: Ibe_util.Debug('DefaultHdrLineAddress: Final Attempt- Ship To');
1059: END IF;
1060:
1061: -- If final attempt also fails, no other go, Raise An Exception
1062: FND_Message.Set_Name('IBE', 'IBE_ERR_OT_INVALID_SHIPTO_ADDR');
1087: ,x_msg_count => x_msg_count
1088: );
1089:
1090:
1091: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1092: Ibe_util.Debug('DefaultHdrLineAddress: After call to Get_Cust_Acct_Site_Use-BillTO '||x_return_status);
1093: END IF;
1094:
1095: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1088: );
1089:
1090:
1091: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1092: Ibe_util.Debug('DefaultHdrLineAddress: After call to Get_Cust_Acct_Site_Use-BillTO '||x_return_status);
1093: END IF;
1094:
1095: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1096: FND_Message.Set_Name('IBE', 'IBE_ERR_OT_INVALID_BILLTO_ADDR');
1116: THEN
1117: x_order_header_rec.invoice_to_org_id := lx_header_siteuse_id;
1118: ELSE
1119: -- If final attempt also fails, no other go,Raise An Exception
1120: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1121: Ibe_util.Debug('DefaultHdrLineAddress: Final Attempt- Bill To');
1122: END IF;
1123:
1124: FND_Message.Set_Name('IBE', 'IBE_ERR_OT_INVALID_BILLTO_ADDR');
1117: x_order_header_rec.invoice_to_org_id := lx_header_siteuse_id;
1118: ELSE
1119: -- If final attempt also fails, no other go,Raise An Exception
1120: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1121: Ibe_util.Debug('DefaultHdrLineAddress: Final Attempt- Bill To');
1122: END IF;
1123:
1124: FND_Message.Set_Name('IBE', 'IBE_ERR_OT_INVALID_BILLTO_ADDR');
1125: FND_Msg_Pub.Add;
1133: FND_Msg_Pub.Add;
1134: RAISE FND_API.G_EXC_ERROR;
1135: END IF;
1136:
1137: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1138: Ibe_util.Debug('DefaultHdrLineAddress ship_to_org_id: ' || x_order_header_rec.ship_to_org_id);
1139: Ibe_util.Debug('DefaultHdrLineAddress bill_to_org_id: ' || x_order_header_rec.invoice_to_org_id);
1140: END IF;
1141:
1134: RAISE FND_API.G_EXC_ERROR;
1135: END IF;
1136:
1137: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1138: Ibe_util.Debug('DefaultHdrLineAddress ship_to_org_id: ' || x_order_header_rec.ship_to_org_id);
1139: Ibe_util.Debug('DefaultHdrLineAddress bill_to_org_id: ' || x_order_header_rec.invoice_to_org_id);
1140: END IF;
1141:
1142: /**************** B2C LineLevel *******************/
1135: END IF;
1136:
1137: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1138: Ibe_util.Debug('DefaultHdrLineAddress ship_to_org_id: ' || x_order_header_rec.ship_to_org_id);
1139: Ibe_util.Debug('DefaultHdrLineAddress bill_to_org_id: ' || x_order_header_rec.invoice_to_org_id);
1140: END IF;
1141:
1142: /**************** B2C LineLevel *******************/
1143:
1202: x_order_header_rec.invoice_to_contact_id := l_cust_acct_role_id;
1203: END IF;
1204: end if;
1205:
1206: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1207: Ibe_util.Debug('End IBE_ORDER_SAVE_PVT:DefaultHdrLineAddress');
1208: END IF;
1209:
1210: FND_MSG_PUB.Count_And_Get
1203: END IF;
1204: end if;
1205:
1206: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1207: Ibe_util.Debug('End IBE_ORDER_SAVE_PVT:DefaultHdrLineAddress');
1208: END IF;
1209:
1210: FND_MSG_PUB.Count_And_Get
1211: ( p_count => x_msg_count,
1217: x_return_status := FND_API.G_RET_STS_ERROR;
1218: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
1219: p_count => x_msg_count ,
1220: p_data => x_msg_data);
1221: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1222: IBE_Util.Debug('Error IBE_ORDER_SAVE_PVT:DefaultHdrLineAddress()'|| sqlerrm);
1223: END IF;
1224:
1225: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1218: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
1219: p_count => x_msg_count ,
1220: p_data => x_msg_data);
1221: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1222: IBE_Util.Debug('Error IBE_ORDER_SAVE_PVT:DefaultHdrLineAddress()'|| sqlerrm);
1223: END IF;
1224:
1225: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1226: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1226: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1227: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
1228: p_count => x_msg_count ,
1229: p_data => x_msg_data);
1230: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1231: IBE_Util.Debug('UNEXPError IBE_ORDER_SAVE_PVT:DefaultHdrLineAddress()' || sqlerrm);
1232: END IF;
1233:
1234: WHEN OTHERS THEN
1227: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
1228: p_count => x_msg_count ,
1229: p_data => x_msg_data);
1230: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1231: IBE_Util.Debug('UNEXPError IBE_ORDER_SAVE_PVT:DefaultHdrLineAddress()' || sqlerrm);
1232: END IF;
1233:
1234: WHEN OTHERS THEN
1235: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1240:
1241: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
1242: p_count => x_msg_count ,
1243: p_data => x_msg_data);
1244: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1245: IBE_Util.Debug('Other IBE_ORDER_SAVE_PVT:DefaultHdrLineAddress()' || sqlerrm);
1246: END IF;
1247:
1248: END DefaultHdrLineAddress;
1241: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
1242: p_count => x_msg_count ,
1243: p_data => x_msg_data);
1244: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1245: IBE_Util.Debug('Other IBE_ORDER_SAVE_PVT:DefaultHdrLineAddress()' || sqlerrm);
1246: END IF;
1247:
1248: END DefaultHdrLineAddress;
1249:
1276: lineid_tmp lineid_type;
1277:
1278: BEGIN
1279:
1280: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1281: IBE_Util.Debug('Begin IBE_ORDER_SAVE_PVT:setlineshipinvoiceids');
1282: IBE_Util.Debug('setlineshipinvoiceids invoicetoorgid: '|| p_order_header_rec.invoice_to_org_id);
1283: END IF;
1284:
1277:
1278: BEGIN
1279:
1280: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1281: IBE_Util.Debug('Begin IBE_ORDER_SAVE_PVT:setlineshipinvoiceids');
1282: IBE_Util.Debug('setlineshipinvoiceids invoicetoorgid: '|| p_order_header_rec.invoice_to_org_id);
1283: END IF;
1284:
1285: for i in 1..p_order_line_tbl.count
1278: BEGIN
1279:
1280: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1281: IBE_Util.Debug('Begin IBE_ORDER_SAVE_PVT:setlineshipinvoiceids');
1282: IBE_Util.Debug('setlineshipinvoiceids invoicetoorgid: '|| p_order_header_rec.invoice_to_org_id);
1283: END IF;
1284:
1285: for i in 1..p_order_line_tbl.count
1286: loop
1305: -- J
1306: -- Uncommenting all the above lines since the bug has been fixed by OM as per Bug# 3336052
1307: -- Prereq for this is ONT.J
1308:
1309: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1310: IBE_Util.Debug('Begin IBE_ORDER_SAVE_PVT:setlineshipinvoiceids');
1311: IBE_Util.Debug('setlineshipinvoiceids invoicetoorgid: '|| p_order_header_rec.invoice_to_org_id);
1312: END IF;
1313:
1306: -- Uncommenting all the above lines since the bug has been fixed by OM as per Bug# 3336052
1307: -- Prereq for this is ONT.J
1308:
1309: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1310: IBE_Util.Debug('Begin IBE_ORDER_SAVE_PVT:setlineshipinvoiceids');
1311: IBE_Util.Debug('setlineshipinvoiceids invoicetoorgid: '|| p_order_header_rec.invoice_to_org_id);
1312: END IF;
1313:
1314: l_shipto_org_id := p_order_header_rec.ship_to_org_id; --Bug# 3334581
1307: -- Prereq for this is ONT.J
1308:
1309: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1310: IBE_Util.Debug('Begin IBE_ORDER_SAVE_PVT:setlineshipinvoiceids');
1311: IBE_Util.Debug('setlineshipinvoiceids invoicetoorgid: '|| p_order_header_rec.invoice_to_org_id);
1312: END IF;
1313:
1314: l_shipto_org_id := p_order_header_rec.ship_to_org_id; --Bug# 3334581
1315: l_invoiceto_org_id := p_order_header_rec.invoice_to_org_id;
1313:
1314: l_shipto_org_id := p_order_header_rec.ship_to_org_id; --Bug# 3334581
1315: l_invoiceto_org_id := p_order_header_rec.invoice_to_org_id;
1316:
1317: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1318: IBE_Util.Debug('Order header_id: '|| p_order_header_rec.header_id);
1319: END IF;
1320:
1321: for l_get_hdr_ids in c_get_hdr_ids(p_order_header_rec.header_id)
1314: l_shipto_org_id := p_order_header_rec.ship_to_org_id; --Bug# 3334581
1315: l_invoiceto_org_id := p_order_header_rec.invoice_to_org_id;
1316:
1317: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1318: IBE_Util.Debug('Order header_id: '|| p_order_header_rec.header_id);
1319: END IF;
1320:
1321: for l_get_hdr_ids in c_get_hdr_ids(p_order_header_rec.header_id)
1322: loop
1346: -- fetch line ids NOT IN the set from oe_order_lines _all
1347: -- basically to update the other existing lines also.
1348:
1349: l_linetbl_count := l_order_line_tbl.count;
1350: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1351: IBE_Util.Debug('No. of lines to be updated: '|| l_linetbl_count);
1352: END IF;
1353:
1354: for lineIdx in 1..l_order_line_tbl.count
1347: -- basically to update the other existing lines also.
1348:
1349: l_linetbl_count := l_order_line_tbl.count;
1350: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1351: IBE_Util.Debug('No. of lines to be updated: '|| l_linetbl_count);
1352: END IF;
1353:
1354: for lineIdx in 1..l_order_line_tbl.count
1355: loop
1355: loop
1356: p_lineids_set := p_lineids_set || ','|| l_order_line_tbl(lineIdx).line_id;
1357: end loop;
1358:
1359: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1360: IBE_Util.Debug('Line Ids to be parsed: '|| p_lineids_set);
1361: END IF;
1362:
1363: IBE_LEAD_IMPORT_PVT.parseInput (p_lineids_set, 'CHAR', l_parseKey, l_parseNum, l_all_lineids_query);
1356: p_lineids_set := p_lineids_set || ','|| l_order_line_tbl(lineIdx).line_id;
1357: end loop;
1358:
1359: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1360: IBE_Util.Debug('Line Ids to be parsed: '|| p_lineids_set);
1361: END IF;
1362:
1363: IBE_LEAD_IMPORT_PVT.parseInput (p_lineids_set, 'CHAR', l_parseKey, l_parseNum, l_all_lineids_query);
1364:
1361: END IF;
1362:
1363: IBE_LEAD_IMPORT_PVT.parseInput (p_lineids_set, 'CHAR', l_parseKey, l_parseNum, l_all_lineids_query);
1364:
1365: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1366: IBE_Util.Debug('After calling Lead_Import package');
1367: END IF;
1368:
1369: l_linetmp_qry := 'select line_id from oe_order_lines_all '||
1362:
1363: IBE_LEAD_IMPORT_PVT.parseInput (p_lineids_set, 'CHAR', l_parseKey, l_parseNum, l_all_lineids_query);
1364:
1365: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1366: IBE_Util.Debug('After calling Lead_Import package');
1367: END IF;
1368:
1369: l_linetmp_qry := 'select line_id from oe_order_lines_all '||
1370: 'where header_id= :1 and '||
1369: l_linetmp_qry := 'select line_id from oe_order_lines_all '||
1370: 'where header_id= :1 and '||
1371: 'line_id NOT IN('|| l_all_lineids_query ||')';
1372:
1373: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1374: IBE_Util.Debug('Line qry to be executed: '|| l_linetmp_qry);
1375: END IF;
1376:
1377: open lineid_tmp for l_linetmp_qry using p_order_header_rec.header_id,l_parseKey;
1370: 'where header_id= :1 and '||
1371: 'line_id NOT IN('|| l_all_lineids_query ||')';
1372:
1373: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1374: IBE_Util.Debug('Line qry to be executed: '|| l_linetmp_qry);
1375: END IF;
1376:
1377: open lineid_tmp for l_linetmp_qry using p_order_header_rec.header_id,l_parseKey;
1378: loop
1377: open lineid_tmp for l_linetmp_qry using p_order_header_rec.header_id,l_parseKey;
1378: loop
1379: fetch lineid_tmp into l_lineid;
1380: exit when lineid_tmp%notfound;
1381: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1382: IBE_Util.debug('line id from line: '|| l_lineid);
1383: end if;
1384: l_linetbl_count := l_linetbl_count +1;
1385: l_order_line_tbl(l_linetbl_count) := OE_Order_PUB.G_MISS_LINE_REC;
1378: loop
1379: fetch lineid_tmp into l_lineid;
1380: exit when lineid_tmp%notfound;
1381: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1382: IBE_Util.debug('line id from line: '|| l_lineid);
1383: end if;
1384: l_linetbl_count := l_linetbl_count +1;
1385: l_order_line_tbl(l_linetbl_count) := OE_Order_PUB.G_MISS_LINE_REC;
1386: l_order_line_tbl(l_linetbl_count).line_id := l_lineid;
1395: loop
1396: x_order_line_tbl(j) := l_order_line_tbl(j);
1397: end loop;
1398:
1399: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1400: IBE_Util.Debug('End OE_ORDER_SAVE_PVT:setlineshipinvoiceids');
1401: END IF;
1402:
1403: END SetLineShipInvoiceIds;
1396: x_order_line_tbl(j) := l_order_line_tbl(j);
1397: end loop;
1398:
1399: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1400: IBE_Util.Debug('End OE_ORDER_SAVE_PVT:setlineshipinvoiceids');
1401: END IF;
1402:
1403: END SetLineShipInvoiceIds;
1404:
1457: l_line_type VARCHAR2(30) := '';
1458:
1459: BEGIN
1460:
1461: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1462: IBE_Util.Debug('OE_Order_Save_PVT.SaveMDLRelatedOperations -BEGIN');
1463: IBE_Util.Debug('p_context_type - p_save_type: ' ||p_context_type ||' :: '||p_save_type);
1464: END IF;
1465:
1458:
1459: BEGIN
1460:
1461: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1462: IBE_Util.Debug('OE_Order_Save_PVT.SaveMDLRelatedOperations -BEGIN');
1463: IBE_Util.Debug('p_context_type - p_save_type: ' ||p_context_type ||' :: '||p_save_type);
1464: END IF;
1465:
1466: for i in 1.. p_order_line_tbl.COUNT
1459: BEGIN
1460:
1461: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1462: IBE_Util.Debug('OE_Order_Save_PVT.SaveMDLRelatedOperations -BEGIN');
1463: IBE_Util.Debug('p_context_type - p_save_type: ' ||p_context_type ||' :: '||p_save_type);
1464: END IF;
1465:
1466: for i in 1.. p_order_line_tbl.COUNT
1467: loop
1468: l_order_line_tbl(i) := p_order_line_tbl(i);
1469: end loop;
1470:
1471: l_linetbl_count := (l_order_line_tbl.count);
1472: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1473: IBE_Util.Debug('l_linetbl_count: '||l_linetbl_count);
1474: END IF;
1475:
1476: if p_context_type = 'SAVE' and p_save_type =SAVE_REMOVEITEMS then
1469: end loop;
1470:
1471: l_linetbl_count := (l_order_line_tbl.count);
1472: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1473: IBE_Util.Debug('l_linetbl_count: '||l_linetbl_count);
1474: END IF;
1475:
1476: if p_context_type = 'SAVE' and p_save_type =SAVE_REMOVEITEMS then
1477: for i in 1..l_order_line_tbl.count
1476: if p_context_type = 'SAVE' and p_save_type =SAVE_REMOVEITEMS then
1477: for i in 1..l_order_line_tbl.count
1478: loop
1479:
1480: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1481: IBE_Util.Debug('item_type_code: ' || l_order_line_tbl(i).item_type_code);
1482: END IF;
1483:
1484: if (l_order_line_tbl(i).ITEM_TYPE_CODE IN ('MODEL','KIT'))
1477: for i in 1..l_order_line_tbl.count
1478: loop
1479:
1480: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1481: IBE_Util.Debug('item_type_code: ' || l_order_line_tbl(i).item_type_code);
1482: END IF;
1483:
1484: if (l_order_line_tbl(i).ITEM_TYPE_CODE IN ('MODEL','KIT'))
1485: then
1482: END IF;
1483:
1484: if (l_order_line_tbl(i).ITEM_TYPE_CODE IN ('MODEL','KIT'))
1485: then
1486: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1487: IBE_Util.Debug('Inside MDL check loop');
1488: END IF;
1489: for l_childlineid_rec in l_childlineid_cur(l_order_line_tbl(i).LINE_ID,p_order_header_id)
1490: loop
1483:
1484: if (l_order_line_tbl(i).ITEM_TYPE_CODE IN ('MODEL','KIT'))
1485: then
1486: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1487: IBE_Util.Debug('Inside MDL check loop');
1488: END IF;
1489: for l_childlineid_rec in l_childlineid_cur(l_order_line_tbl(i).LINE_ID,p_order_header_id)
1490: loop
1491: l_linetbl_count := l_linetbl_count+1;
1501:
1502: for i in 1..l_order_line_tbl.count
1503: loop
1504:
1505: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1506: IBE_Util.Debug('item_type_code: ' || l_order_line_tbl(i).item_type_code);
1507: END IF;
1508:
1509: if (l_order_line_tbl(i).item_type_code IN ('MODEL','KIT'))
1502: for i in 1..l_order_line_tbl.count
1503: loop
1504:
1505: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1506: IBE_Util.Debug('item_type_code: ' || l_order_line_tbl(i).item_type_code);
1507: END IF;
1508:
1509: if (l_order_line_tbl(i).item_type_code IN ('MODEL','KIT'))
1510: then
1511: for l_tmpparent_rec in l_tmpparent_cur(l_order_line_tbl(i).LINE_ID)
1512: loop
1513: l_origparent_qty :=l_tmpparent_rec.ORDERED_QUANTITY;
1514: end loop;
1515: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1516: IBE_Util.Debug('l_origparent_qty: ' || l_origparent_qty);
1517: END IF;
1518:
1519: for l_childlineid_rec in l_childlineid_cur(l_order_line_tbl(i).LINE_ID,p_order_header_id)
1512: loop
1513: l_origparent_qty :=l_tmpparent_rec.ORDERED_QUANTITY;
1514: end loop;
1515: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1516: IBE_Util.Debug('l_origparent_qty: ' || l_origparent_qty);
1517: END IF;
1518:
1519: for l_childlineid_rec in l_childlineid_cur(l_order_line_tbl(i).LINE_ID,p_order_header_id)
1520: loop
1526: if(l_order_line_tbl(i).ORDERED_QUANTITY is not null
1527: AND l_order_line_tbl(i).ORDERED_QUANTITY <> FND_API.G_MISS_NUM)
1528: then
1529: l_new_qty := l_order_line_tbl(i).ORDERED_QUANTITY;
1530: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1531: IBE_Util.Debug('Incoming qty: ' || l_new_qty);
1532: END IF;
1533: l_origchild_qty := l_childlineid_rec.ORDERED_QUANTITY;
1534: IF (l_origparent_qty = 0) THEN
1527: AND l_order_line_tbl(i).ORDERED_QUANTITY <> FND_API.G_MISS_NUM)
1528: then
1529: l_new_qty := l_order_line_tbl(i).ORDERED_QUANTITY;
1530: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1531: IBE_Util.Debug('Incoming qty: ' || l_new_qty);
1532: END IF;
1533: l_origchild_qty := l_childlineid_rec.ORDERED_QUANTITY;
1534: IF (l_origparent_qty = 0) THEN
1535: l_order_line_tbl(l_linetbl_count).ORDERED_QUANTITY
1562: loop
1563: l_line_type := c_linetmp_rec.ITEM_TYPE_CODE;
1564: end loop;
1565:
1566: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1567: IBE_Util.Debug('l_line_type: ' || l_line_type);
1568: END IF;
1569:
1570: -- if model item then propagate contactIds and OrgIds to all children
1563: l_line_type := c_linetmp_rec.ITEM_TYPE_CODE;
1564: end loop;
1565:
1566: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1567: IBE_Util.Debug('l_line_type: ' || l_line_type);
1568: END IF;
1569:
1570: -- if model item then propagate contactIds and OrgIds to all children
1571: if (l_line_type IN ('MODEL','KIT')) then
1601:
1602: end loop; --main for loop
1603: end if; --main if
1604:
1605: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1606: IBE_Util.Debug('l_order_line_tbl.count: '||l_order_line_tbl.count);
1607: END IF;
1608:
1609: for k in 1..l_order_line_tbl.count
1602: end loop; --main for loop
1603: end if; --main if
1604:
1605: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1606: IBE_Util.Debug('l_order_line_tbl.count: '||l_order_line_tbl.count);
1607: END IF;
1608:
1609: for k in 1..l_order_line_tbl.count
1610: loop
1609: for k in 1..l_order_line_tbl.count
1610: loop
1611: x_order_line_tbl(k) := l_order_line_tbl(k);
1612: x_order_line_tbl(k).item_type_code := FND_API.G_MISS_CHAR;
1613: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1614: IBE_Util.Debug('x_order_line_tbl.LineId: ' || x_order_line_tbl(k).LINE_ID);
1615: IBE_Util.Debug('x_order_line_tbl.orderd_qty: ' || x_order_line_tbl(k).ORDERED_QUANTITY);
1616: IBE_Util.Debug('x_order_line_tbl.reason_code: ' || x_order_line_tbl(k).RETURN_REASON_CODE);
1617: IBE_Util.Debug('x_order_line_tbl.invoice contact: ' || x_order_line_tbl(k).INVOICE_TO_CONTACT_ID);
1610: loop
1611: x_order_line_tbl(k) := l_order_line_tbl(k);
1612: x_order_line_tbl(k).item_type_code := FND_API.G_MISS_CHAR;
1613: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1614: IBE_Util.Debug('x_order_line_tbl.LineId: ' || x_order_line_tbl(k).LINE_ID);
1615: IBE_Util.Debug('x_order_line_tbl.orderd_qty: ' || x_order_line_tbl(k).ORDERED_QUANTITY);
1616: IBE_Util.Debug('x_order_line_tbl.reason_code: ' || x_order_line_tbl(k).RETURN_REASON_CODE);
1617: IBE_Util.Debug('x_order_line_tbl.invoice contact: ' || x_order_line_tbl(k).INVOICE_TO_CONTACT_ID);
1618: IBE_Util.Debug('x_order_line_tbl.invoice org: ' || x_order_line_tbl(k).INVOICE_TO_ORG_ID);
1611: x_order_line_tbl(k) := l_order_line_tbl(k);
1612: x_order_line_tbl(k).item_type_code := FND_API.G_MISS_CHAR;
1613: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1614: IBE_Util.Debug('x_order_line_tbl.LineId: ' || x_order_line_tbl(k).LINE_ID);
1615: IBE_Util.Debug('x_order_line_tbl.orderd_qty: ' || x_order_line_tbl(k).ORDERED_QUANTITY);
1616: IBE_Util.Debug('x_order_line_tbl.reason_code: ' || x_order_line_tbl(k).RETURN_REASON_CODE);
1617: IBE_Util.Debug('x_order_line_tbl.invoice contact: ' || x_order_line_tbl(k).INVOICE_TO_CONTACT_ID);
1618: IBE_Util.Debug('x_order_line_tbl.invoice org: ' || x_order_line_tbl(k).INVOICE_TO_ORG_ID);
1619: END IF;
1612: x_order_line_tbl(k).item_type_code := FND_API.G_MISS_CHAR;
1613: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1614: IBE_Util.Debug('x_order_line_tbl.LineId: ' || x_order_line_tbl(k).LINE_ID);
1615: IBE_Util.Debug('x_order_line_tbl.orderd_qty: ' || x_order_line_tbl(k).ORDERED_QUANTITY);
1616: IBE_Util.Debug('x_order_line_tbl.reason_code: ' || x_order_line_tbl(k).RETURN_REASON_CODE);
1617: IBE_Util.Debug('x_order_line_tbl.invoice contact: ' || x_order_line_tbl(k).INVOICE_TO_CONTACT_ID);
1618: IBE_Util.Debug('x_order_line_tbl.invoice org: ' || x_order_line_tbl(k).INVOICE_TO_ORG_ID);
1619: END IF;
1620: end loop;
1613: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1614: IBE_Util.Debug('x_order_line_tbl.LineId: ' || x_order_line_tbl(k).LINE_ID);
1615: IBE_Util.Debug('x_order_line_tbl.orderd_qty: ' || x_order_line_tbl(k).ORDERED_QUANTITY);
1616: IBE_Util.Debug('x_order_line_tbl.reason_code: ' || x_order_line_tbl(k).RETURN_REASON_CODE);
1617: IBE_Util.Debug('x_order_line_tbl.invoice contact: ' || x_order_line_tbl(k).INVOICE_TO_CONTACT_ID);
1618: IBE_Util.Debug('x_order_line_tbl.invoice org: ' || x_order_line_tbl(k).INVOICE_TO_ORG_ID);
1619: END IF;
1620: end loop;
1621:
1614: IBE_Util.Debug('x_order_line_tbl.LineId: ' || x_order_line_tbl(k).LINE_ID);
1615: IBE_Util.Debug('x_order_line_tbl.orderd_qty: ' || x_order_line_tbl(k).ORDERED_QUANTITY);
1616: IBE_Util.Debug('x_order_line_tbl.reason_code: ' || x_order_line_tbl(k).RETURN_REASON_CODE);
1617: IBE_Util.Debug('x_order_line_tbl.invoice contact: ' || x_order_line_tbl(k).INVOICE_TO_CONTACT_ID);
1618: IBE_Util.Debug('x_order_line_tbl.invoice org: ' || x_order_line_tbl(k).INVOICE_TO_ORG_ID);
1619: END IF;
1620: end loop;
1621:
1622: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1618: IBE_Util.Debug('x_order_line_tbl.invoice org: ' || x_order_line_tbl(k).INVOICE_TO_ORG_ID);
1619: END IF;
1620: end loop;
1621:
1622: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1623: IBE_Util.Debug('OE_Order_Save_PVT.SaveMDLRelatedOperations -END');
1624: END IF;
1625:
1626: END SaveMDLRelatedOperations;
1619: END IF;
1620: end loop;
1621:
1622: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1623: IBE_Util.Debug('OE_Order_Save_PVT.SaveMDLRelatedOperations -END');
1624: END IF;
1625:
1626: END SaveMDLRelatedOperations;
1627:
1638: l_db_user_id NUMBER;
1639:
1640: BEGIN
1641:
1642: IF (IBE_UTIL.G_DEBUGON = l_true) then
1643: IBE_UTIL.DEBUG('Order_Save_Pvt: ValidateOrderAccess - BEGIN');
1644: IBE_UTIL.DEBUG('User id obtained from environment is: '||l_env_user_id);
1645: IBE_UTIL.DEBUG('Incoming Header Id: '||p_order_header_id);
1646: END IF;
1639:
1640: BEGIN
1641:
1642: IF (IBE_UTIL.G_DEBUGON = l_true) then
1643: IBE_UTIL.DEBUG('Order_Save_Pvt: ValidateOrderAccess - BEGIN');
1644: IBE_UTIL.DEBUG('User id obtained from environment is: '||l_env_user_id);
1645: IBE_UTIL.DEBUG('Incoming Header Id: '||p_order_header_id);
1646: END IF;
1647:
1640: BEGIN
1641:
1642: IF (IBE_UTIL.G_DEBUGON = l_true) then
1643: IBE_UTIL.DEBUG('Order_Save_Pvt: ValidateOrderAccess - BEGIN');
1644: IBE_UTIL.DEBUG('User id obtained from environment is: '||l_env_user_id);
1645: IBE_UTIL.DEBUG('Incoming Header Id: '||p_order_header_id);
1646: END IF;
1647:
1648: -- Initialize API return status to success
1641:
1642: IF (IBE_UTIL.G_DEBUGON = l_true) then
1643: IBE_UTIL.DEBUG('Order_Save_Pvt: ValidateOrderAccess - BEGIN');
1644: IBE_UTIL.DEBUG('User id obtained from environment is: '||l_env_user_id);
1645: IBE_UTIL.DEBUG('Incoming Header Id: '||p_order_header_id);
1646: END IF;
1647:
1648: -- Initialize API return status to success
1649: x_return_status := FND_API.G_RET_STS_SUCCESS;
1651: open c_createdby_info(p_order_header_id);
1652: fetch c_createdby_info into l_db_user_id;
1653: close c_createdby_info;
1654:
1655: IF (IBE_UTIL.G_DEBUGON = l_true) then
1656: IBE_UTIL.DEBUG('User id obtained from db is: '|| l_db_user_id);
1657: END IF;
1658:
1659: IF (l_db_user_id <> l_env_user_id)
1652: fetch c_createdby_info into l_db_user_id;
1653: close c_createdby_info;
1654:
1655: IF (IBE_UTIL.G_DEBUGON = l_true) then
1656: IBE_UTIL.DEBUG('User id obtained from db is: '|| l_db_user_id);
1657: END IF;
1658:
1659: IF (l_db_user_id <> l_env_user_id)
1660: THEN
1657: END IF;
1658:
1659: IF (l_db_user_id <> l_env_user_id)
1660: THEN
1661: IF (IBE_UTIL.G_DEBUGON = l_true) then
1662: IBE_UTIL.DEBUG('Inside If');
1663: END IF;
1664: FND_Message.Set_Name('IBE', 'IBE_OT_ERR_USERACCESS');
1665: FND_Msg_Pub.Add;
1658:
1659: IF (l_db_user_id <> l_env_user_id)
1660: THEN
1661: IF (IBE_UTIL.G_DEBUGON = l_true) then
1662: IBE_UTIL.DEBUG('Inside If');
1663: END IF;
1664: FND_Message.Set_Name('IBE', 'IBE_OT_ERR_USERACCESS');
1665: FND_Msg_Pub.Add;
1666: RAISE FND_API.G_EXC_ERROR;
1665: FND_Msg_Pub.Add;
1666: RAISE FND_API.G_EXC_ERROR;
1667: END IF;
1668:
1669: IF (IBE_UTIL.G_DEBUGON = l_true) then
1670: IBE_UTIL.DEBUG('Order_Save_Pvt: ValidateOrderAccess - END');
1671: END IF;
1672:
1673: END ValidateOrderAccess;
1666: RAISE FND_API.G_EXC_ERROR;
1667: END IF;
1668:
1669: IF (IBE_UTIL.G_DEBUGON = l_true) then
1670: IBE_UTIL.DEBUG('Order_Save_Pvt: ValidateOrderAccess - END');
1671: END IF;
1672:
1673: END ValidateOrderAccess;
1674:
1743:
1744:
1745: BEGIN
1746:
1747: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1748: IBE_Util.Debug('Begin IBE_ORDER_SAVE_PVT:CheckOverReturnQty()');
1749: IBE_Util.Debug('Incoming Order Header Id: '|| p_order_header_id);
1750: END IF;
1751:
1744:
1745: BEGIN
1746:
1747: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1748: IBE_Util.Debug('Begin IBE_ORDER_SAVE_PVT:CheckOverReturnQty()');
1749: IBE_Util.Debug('Incoming Order Header Id: '|| p_order_header_id);
1750: END IF;
1751:
1752: -- Initialize API return status to success
1745: BEGIN
1746:
1747: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1748: IBE_Util.Debug('Begin IBE_ORDER_SAVE_PVT:CheckOverReturnQty()');
1749: IBE_Util.Debug('Incoming Order Header Id: '|| p_order_header_id);
1750: END IF;
1751:
1752: -- Initialize API return status to success
1753: x_return_status := FND_API.G_RET_STS_SUCCESS;
1766: -- x_error_tbl --> It maintains all the qty validation failing Line Ids
1767: -- returned from OM API call.
1768: ***********/
1769:
1770: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1771: IBE_Util.Debug('Line Ids Sent To OM for Qty Validations');
1772: END IF;
1773: OPEN QtyChkLineCur(p_order_header_id);
1774: LOOP
1767: -- returned from OM API call.
1768: ***********/
1769:
1770: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1771: IBE_Util.Debug('Line Ids Sent To OM for Qty Validations');
1772: END IF;
1773: OPEN QtyChkLineCur(p_order_header_id);
1774: LOOP
1775: FETCH QtyChkLineCur INTO QtyChkLineRec;
1774: LOOP
1775: FETCH QtyChkLineCur INTO QtyChkLineRec;
1776: EXIT WHEN QtyChkLineCur%NOTFOUND;
1777: l_order_line_tbl(lineTblCnt) := OE_Order_PUB.G_MISS_LINE_REC;
1778: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1779: IBE_Util.Debug('Line Id: '||QtyChkLineRec.LINE_ID);
1780: END IF;
1781: l_order_line_tbl(lineTblCnt).LINE_ID := QtyChkLineRec.LINE_ID;
1782: l_order_line_tbl(lineTblCnt).REFERENCE_LINE_ID := QtyChkLineRec.REFERENCE_LINE_ID;
1775: FETCH QtyChkLineCur INTO QtyChkLineRec;
1776: EXIT WHEN QtyChkLineCur%NOTFOUND;
1777: l_order_line_tbl(lineTblCnt) := OE_Order_PUB.G_MISS_LINE_REC;
1778: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1779: IBE_Util.Debug('Line Id: '||QtyChkLineRec.LINE_ID);
1780: END IF;
1781: l_order_line_tbl(lineTblCnt).LINE_ID := QtyChkLineRec.LINE_ID;
1782: l_order_line_tbl(lineTblCnt).REFERENCE_LINE_ID := QtyChkLineRec.REFERENCE_LINE_ID;
1783: l_order_line_tbl(lineTblCnt).ORDERED_QUANTITY := QtyChkLineRec.ORDERED_QUANTITY;
1788: lineTblCnt := lineTblCnt+1;
1789: END LOOP;
1790: CLOSE QtyChkLineCur;
1791:
1792: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1793: IBE_Util.Debug('l_order_line_tbl size: '|| l_order_line_tbl.COUNT);
1794: IBE_Util.Debug('Before Calling OE_RMA_GRP.Is_Over_Return()');
1795: END IF;
1796:
1789: END LOOP;
1790: CLOSE QtyChkLineCur;
1791:
1792: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1793: IBE_Util.Debug('l_order_line_tbl size: '|| l_order_line_tbl.COUNT);
1794: IBE_Util.Debug('Before Calling OE_RMA_GRP.Is_Over_Return()');
1795: END IF;
1796:
1797: OE_RMA_GRP.Is_Over_Return(p_api_version => 1.0
1790: CLOSE QtyChkLineCur;
1791:
1792: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1793: IBE_Util.Debug('l_order_line_tbl size: '|| l_order_line_tbl.COUNT);
1794: IBE_Util.Debug('Before Calling OE_RMA_GRP.Is_Over_Return()');
1795: END IF;
1796:
1797: OE_RMA_GRP.Is_Over_Return(p_api_version => 1.0
1798: , p_line_tbl => l_order_line_tbl
1802: , x_msg_data => x_msg_data
1803: );
1804:
1805:
1806: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1807: IBE_Util.Debug('After Calling Is_Over_Return - return_status: '|| x_return_status);
1808: END IF;
1809:
1810: IF x_return_status <> FND_API.G_RET_STS_SUCCESS then
1803: );
1804:
1805:
1806: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1807: IBE_Util.Debug('After Calling Is_Over_Return - return_status: '|| x_return_status);
1808: END IF;
1809:
1810: IF x_return_status <> FND_API.G_RET_STS_SUCCESS then
1811: IF (IBE_UTIL.G_DEBUGON = l_true) then
1807: IBE_Util.Debug('After Calling Is_Over_Return - return_status: '|| x_return_status);
1808: END IF;
1809:
1810: IF x_return_status <> FND_API.G_RET_STS_SUCCESS then
1811: IF (IBE_UTIL.G_DEBUGON = l_true) then
1812: IBE_UTIL.DEBUG('Error Table Count: ' || x_error_tbl.count);
1813: end if;
1814:
1815: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1808: END IF;
1809:
1810: IF x_return_status <> FND_API.G_RET_STS_SUCCESS then
1811: IF (IBE_UTIL.G_DEBUGON = l_true) then
1812: IBE_UTIL.DEBUG('Error Table Count: ' || x_error_tbl.count);
1813: end if;
1814:
1815: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1816: IBE_Util.Debug('Line Quantity Validation Details Returned from OM');
1811: IF (IBE_UTIL.G_DEBUGON = l_true) then
1812: IBE_UTIL.DEBUG('Error Table Count: ' || x_error_tbl.count);
1813: end if;
1814:
1815: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1816: IBE_Util.Debug('Line Quantity Validation Details Returned from OM');
1817: ENd IF;
1818: for j in 1.. x_error_tbl.count
1819: loop
1812: IBE_UTIL.DEBUG('Error Table Count: ' || x_error_tbl.count);
1813: end if;
1814:
1815: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1816: IBE_Util.Debug('Line Quantity Validation Details Returned from OM');
1817: ENd IF;
1818: for j in 1.. x_error_tbl.count
1819: loop
1820: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1816: IBE_Util.Debug('Line Quantity Validation Details Returned from OM');
1817: ENd IF;
1818: for j in 1.. x_error_tbl.count
1819: loop
1820: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1821: IBE_Util.Debug('line_id= '||x_error_tbl(j).line_id||' : '||
1822: 'prev_qty= '||x_error_tbl(j).previous_quantity||' : '||
1823: 'curr_qty= '||x_error_tbl(j).current_quantity||' : '||
1824: 'orig_qty= '||x_error_tbl(j).original_quantity||' : '||
1817: ENd IF;
1818: for j in 1.. x_error_tbl.count
1819: loop
1820: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1821: IBE_Util.Debug('line_id= '||x_error_tbl(j).line_id||' : '||
1822: 'prev_qty= '||x_error_tbl(j).previous_quantity||' : '||
1823: 'curr_qty= '||x_error_tbl(j).current_quantity||' : '||
1824: 'orig_qty= '||x_error_tbl(j).original_quantity||' : '||
1825: 'ret_stat= '||x_error_tbl(j).return_status);
1826: END IF;
1827: p_tmp_error_lineIds := p_tmp_error_lineIds || ','||x_error_tbl(j).LINE_ID;
1828: end loop;
1829:
1830: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1831: Ibe_util.debug('l_tmp_error_lineIds set: '||p_tmp_error_lineIds);
1832: end if;
1833:
1834: IBE_LEAD_IMPORT_PVT.parseInput (p_tmp_error_lineIds, 'CHAR', l_parseKey, l_parseNum, l_tmp_error_lineIds);
1827: p_tmp_error_lineIds := p_tmp_error_lineIds || ','||x_error_tbl(j).LINE_ID;
1828: end loop;
1829:
1830: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1831: Ibe_util.debug('l_tmp_error_lineIds set: '||p_tmp_error_lineIds);
1832: end if;
1833:
1834: IBE_LEAD_IMPORT_PVT.parseInput (p_tmp_error_lineIds, 'CHAR', l_parseKey, l_parseNum, l_tmp_error_lineIds);
1835:
1855: 'FROM oe_order_lines_all '||
1856: 'WHERE line_id in('||l_tmp_error_lineIds||')))';
1857:
1858:
1859: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1860: IBE_Util.debug('qry executed: '|| l_qty_tmp_query);
1861: end if;
1862:
1863: open qty_error_cur for l_qty_tmp_query using l_parseKey;
1856: 'WHERE line_id in('||l_tmp_error_lineIds||')))';
1857:
1858:
1859: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1860: IBE_Util.debug('qry executed: '|| l_qty_tmp_query);
1861: end if;
1862:
1863: open qty_error_cur for l_qty_tmp_query using l_parseKey;
1864: LOOP
1864: LOOP
1865: FETCH qty_error_cur INTO l_tmp_orderNo,l_tmp_pNo,l_tmp_itemdesc,l_tmp_lineId,l_tmp_itemtype;
1866: EXIT WHEN qty_error_cur%NOTFOUND;
1867: l_tmp_order_line_tbl(l_tmp_lineTblCnt).ORIG_ORDER_LINE_ID := l_tmp_lineId;
1868: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1869: IBE_Util.debug('l_tmp_lineId: '|| l_tmp_lineId);
1870: end if;
1871: l_tmp_order_line_tbl(l_tmp_lineTblCnt).ORDERED_ITEM := l_tmp_pNo;
1872: l_tmp_order_line_tbl(l_tmp_lineTblCnt).ORDER_NUMBER := l_tmp_orderNo;
1865: FETCH qty_error_cur INTO l_tmp_orderNo,l_tmp_pNo,l_tmp_itemdesc,l_tmp_lineId,l_tmp_itemtype;
1866: EXIT WHEN qty_error_cur%NOTFOUND;
1867: l_tmp_order_line_tbl(l_tmp_lineTblCnt).ORIG_ORDER_LINE_ID := l_tmp_lineId;
1868: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1869: IBE_Util.debug('l_tmp_lineId: '|| l_tmp_lineId);
1870: end if;
1871: l_tmp_order_line_tbl(l_tmp_lineTblCnt).ORDERED_ITEM := l_tmp_pNo;
1872: l_tmp_order_line_tbl(l_tmp_lineTblCnt).ORDER_NUMBER := l_tmp_orderNo;
1873: l_tmp_order_line_tbl(l_tmp_lineTblCnt).ITEM_TYPE_CODE := l_tmp_itemtype;
1911: -- For instance, l_tmp_order_line_tbl --> ModParentId1 and
1912: -- x_error_tbl --> ChldId1,ChldId2.
1913: -- To identify such flows l_errorflow var is introduced.
1914:
1915: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1916: IBE_Util.debug('ibe:temp Err and OM:error Table Counts: '|| l_tmp_order_line_tbl.count|| ' , '||x_error_tbl.count);
1917: end if;
1918:
1919: ---- New Changes for sorting in sync w/ UI
1912: -- x_error_tbl --> ChldId1,ChldId2.
1913: -- To identify such flows l_errorflow var is introduced.
1914:
1915: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1916: IBE_Util.debug('ibe:temp Err and OM:error Table Counts: '|| l_tmp_order_line_tbl.count|| ' , '||x_error_tbl.count);
1917: end if;
1918:
1919: ---- New Changes for sorting in sync w/ UI
1920: -- Setting the Quantity details as this is needed for STD item Error Message.
1934: END LOOP;
1935: l_tmp_index1:=l_tmp_order_line_tbl.NEXT(l_tmp_index1);
1936: END LOOP;
1937:
1938: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1939: IBE_Util.debug('After retrieving the quantity details for the failing lineids from OM error table');
1940: end if;
1941:
1942: /*** Now start to Append the FND stack having the original Plsql table sent to
1935: l_tmp_index1:=l_tmp_order_line_tbl.NEXT(l_tmp_index1);
1936: END LOOP;
1937:
1938: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1939: IBE_Util.debug('After retrieving the quantity details for the failing lineids from OM error table');
1940: end if;
1941:
1942: /*** Now start to Append the FND stack having the original Plsql table sent to
1943: OM, for qty validations, as
1953: IF (l_tmp_order_line_tbl(l_index2).item_type_code='STANDARD') then
1954: tempQty := (l_tmp_order_line_tbl(l_index2).orig_ordered_qty) -
1955: (l_tmp_order_line_tbl(l_index2).already_return_qty);
1956:
1957: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1958: IBE_Util.debug('STD-Item: Fails for Qty: Order#='||l_tmp_order_line_tbl(l_index2).order_number
1959: ||' : '||trim(l_tmp_order_line_tbl(l_index2).description)||' : '
1960: ||'allowed Qty = '||tempQty);
1961: end if;
1954: tempQty := (l_tmp_order_line_tbl(l_index2).orig_ordered_qty) -
1955: (l_tmp_order_line_tbl(l_index2).already_return_qty);
1956:
1957: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1958: IBE_Util.debug('STD-Item: Fails for Qty: Order#='||l_tmp_order_line_tbl(l_index2).order_number
1959: ||' : '||trim(l_tmp_order_line_tbl(l_index2).description)||' : '
1960: ||'allowed Qty = '||tempQty);
1961: end if;
1962: FND_MESSAGE.Set_Name('IBE','IBE_ERR_OT_LINE_OVER_QTY');
1966: FND_MESSAGE.Set_Token('QTY', tempQty);
1967: FND_Msg_Pub.Add;
1968:
1969: ELSIF(l_tmp_order_line_tbl(l_index2).item_type_code IN ('MODEL','KIT')) then
1970: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1971: IBE_Util.debug('MDL-Item: Fails for Qty: Order#='||l_tmp_order_line_tbl(l_index2).order_number||
1972: ' : '||trim(l_tmp_order_line_tbl(l_index2).description));
1973: end if;
1974: FND_MESSAGE.Set_Name('IBE','IBE_ERR_OT_MDL_LINE_OVER_QTY');
1967: FND_Msg_Pub.Add;
1968:
1969: ELSIF(l_tmp_order_line_tbl(l_index2).item_type_code IN ('MODEL','KIT')) then
1970: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
1971: IBE_Util.debug('MDL-Item: Fails for Qty: Order#='||l_tmp_order_line_tbl(l_index2).order_number||
1972: ' : '||trim(l_tmp_order_line_tbl(l_index2).description));
1973: end if;
1974: FND_MESSAGE.Set_Name('IBE','IBE_ERR_OT_MDL_LINE_OVER_QTY');
1975: FND_MESSAGE.Set_Token('ORD', l_tmp_order_line_tbl(l_index2).order_number);
2013:
2014: FND_MSG_PUB.Count_And_Get ( p_count => x_msg_count,
2015: p_data => x_msg_data);
2016:
2017: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2018: IBE_Util.Debug('End OE_ORDER_SAVE_PVT.CheckReturnQty()');
2019: END IF;
2020:
2021:
2014: FND_MSG_PUB.Count_And_Get ( p_count => x_msg_count,
2015: p_data => x_msg_data);
2016:
2017: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2018: IBE_Util.Debug('End OE_ORDER_SAVE_PVT.CheckReturnQty()');
2019: END IF;
2020:
2021:
2022: EXCEPTION
2025: x_return_status := FND_API.G_RET_STS_ERROR;
2026: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
2027: p_count => x_msg_count ,
2028: p_data => x_msg_data);
2029: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2030: IBE_Util.Debug('Error IBE_ORDER_SAVE_PVT:CheckOverReturnQty()'|| sqlerrm);
2031: END IF;
2032:
2033: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2026: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
2027: p_count => x_msg_count ,
2028: p_data => x_msg_data);
2029: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2030: IBE_Util.Debug('Error IBE_ORDER_SAVE_PVT:CheckOverReturnQty()'|| sqlerrm);
2031: END IF;
2032:
2033: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2034: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2034: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2035: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
2036: p_count => x_msg_count ,
2037: p_data => x_msg_data);
2038: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2039: IBE_Util.Debug('UNEXPECTEDError IBE_ORDER_SAVE_PVT:CheckOverReturnQty()' || sqlerrm);
2040: END IF;
2041: WHEN OTHERS THEN
2042: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2035: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
2036: p_count => x_msg_count ,
2037: p_data => x_msg_data);
2038: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2039: IBE_Util.Debug('UNEXPECTEDError IBE_ORDER_SAVE_PVT:CheckOverReturnQty()' || sqlerrm);
2040: END IF;
2041: WHEN OTHERS THEN
2042: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2043:
2048:
2049: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
2050: p_count => x_msg_count ,
2051: p_data => x_msg_data);
2052: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2053: IBE_Util.Debug('Other IBE_ORDER_SAVE_PVT:CheckOverReturnQty()' || sqlerrm);
2054: END IF;
2055:
2056: END CheckOverReturnQty;
2049: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
2050: p_count => x_msg_count ,
2051: p_data => x_msg_data);
2052: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2053: IBE_Util.Debug('Other IBE_ORDER_SAVE_PVT:CheckOverReturnQty()' || sqlerrm);
2054: END IF;
2055:
2056: END CheckOverReturnQty;
2057:
2081: BEGIN
2082:
2083: x_return_status := FND_API.G_RET_STS_SUCCESS;
2084:
2085: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2086: IBE_Util.debug('IBE_Order_Save_Pvt.TCA_AddressValidate BEGIN order_hdr_id: '||p_order_header_id);
2087: end if;
2088:
2089: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2082:
2083: x_return_status := FND_API.G_RET_STS_SUCCESS;
2084:
2085: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2086: IBE_Util.debug('IBE_Order_Save_Pvt.TCA_AddressValidate BEGIN order_hdr_id: '||p_order_header_id);
2087: end if;
2088:
2089: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2090: IBE_Util.debug('IBE_Order_Save_Pvt.TCA_AddressValidate BEGIN site_use_type : '||p_site_use_type);
2085: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2086: IBE_Util.debug('IBE_Order_Save_Pvt.TCA_AddressValidate BEGIN order_hdr_id: '||p_order_header_id);
2087: end if;
2088:
2089: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2090: IBE_Util.debug('IBE_Order_Save_Pvt.TCA_AddressValidate BEGIN site_use_type : '||p_site_use_type);
2091: end if;
2092:
2093:
2086: IBE_Util.debug('IBE_Order_Save_Pvt.TCA_AddressValidate BEGIN order_hdr_id: '||p_order_header_id);
2087: end if;
2088:
2089: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2090: IBE_Util.debug('IBE_Order_Save_Pvt.TCA_AddressValidate BEGIN site_use_type : '||p_site_use_type);
2091: end if;
2092:
2093:
2094: if(p_user_type = 'PARTY_RELATIONSHIP') then
2184: 'and status=''A'')';
2185: end if; -- if p_site_use_type
2186: end if; -- p_user_type
2187:
2188: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2189: IBE_Util.debug('Qry executed for Address validation: '||l_addr_validate_qry);
2190: end if;
2191: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2192: IBE_Util.debug('Qry executed for Address validation: '||l_addr_validate_qry);
2185: end if; -- if p_site_use_type
2186: end if; -- p_user_type
2187:
2188: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2189: IBE_Util.debug('Qry executed for Address validation: '||l_addr_validate_qry);
2190: end if;
2191: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2192: IBE_Util.debug('Qry executed for Address validation: '||l_addr_validate_qry);
2193: end if;
2187:
2188: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2189: IBE_Util.debug('Qry executed for Address validation: '||l_addr_validate_qry);
2190: end if;
2191: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2192: IBE_Util.debug('Qry executed for Address validation: '||l_addr_validate_qry);
2193: end if;
2194:
2195: open Addr_error_cur for l_addr_validate_qry using p_order_header_id;
2188: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2189: IBE_Util.debug('Qry executed for Address validation: '||l_addr_validate_qry);
2190: end if;
2191: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2192: IBE_Util.debug('Qry executed for Address validation: '||l_addr_validate_qry);
2193: end if;
2194:
2195: open Addr_error_cur for l_addr_validate_qry using p_order_header_id;
2196: loop
2199: tmpCount := tmpCount+1;
2200: FailLines := FND_API.G_TRUE;
2201: end loop;
2202:
2203: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2204: IBE_Util.debug('Check whether any lines failed: '||FailLines);
2205: end if;
2206:
2207: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2200: FailLines := FND_API.G_TRUE;
2201: end loop;
2202:
2203: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2204: IBE_Util.debug('Check whether any lines failed: '||FailLines);
2205: end if;
2206:
2207: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2208: IBE_Util.debug('Check whether any lines failed: '||FailLines);
2203: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2204: IBE_Util.debug('Check whether any lines failed: '||FailLines);
2205: end if;
2206:
2207: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2208: IBE_Util.debug('Check whether any lines failed: '||FailLines);
2209: end if;
2210:
2211: if(FND_API.to_boolean(FailLines)) then
2204: IBE_Util.debug('Check whether any lines failed: '||FailLines);
2205: end if;
2206:
2207: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2208: IBE_Util.debug('Check whether any lines failed: '||FailLines);
2209: end if;
2210:
2211: if(FND_API.to_boolean(FailLines)) then
2212: x_return_status := FND_API.G_RET_STS_ERROR;
2226: if(p_site_use_type='SHIP_TO' AND p_user_type = 'PERSON') then
2227: X_failed_line_ids(failCnt) := 'SHIPADDR:HDR';
2228: end if;
2229: l_index:=l_tmpfail_line_id.NEXT(l_index);
2230: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2231: IBE_Util.debug('Line ID Failed for Addr: '|| X_failed_line_ids(failCnt));
2232: end if;
2233: end loop;
2234: end if;
2227: X_failed_line_ids(failCnt) := 'SHIPADDR:HDR';
2228: end if;
2229: l_index:=l_tmpfail_line_id.NEXT(l_index);
2230: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2231: IBE_Util.debug('Line ID Failed for Addr: '|| X_failed_line_ids(failCnt));
2232: end if;
2233: end loop;
2234: end if;
2235:
2232: end if;
2233: end loop;
2234: end if;
2235:
2236: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2237: IBE_Util.debug('IBE_Order_Save_Pvt.TCA_AddressValidate END '||x_return_status);
2238: end if;
2239:
2240:
2233: end loop;
2234: end if;
2235:
2236: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2237: IBE_Util.debug('IBE_Order_Save_Pvt.TCA_AddressValidate END '||x_return_status);
2238: end if;
2239:
2240:
2241: END TCA_AddressValidate;
2265: BEGIN
2266:
2267: x_return_status := FND_API.G_RET_STS_SUCCESS;
2268:
2269: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2270: IBE_Util.debug('IBE_Order_Save_Pvt.TCA_AddressValidate BEGIN');
2271: end if;
2272:
2273: if (p_site_use_type ='BILL_TO') then
2266:
2267: x_return_status := FND_API.G_RET_STS_SUCCESS;
2268:
2269: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2270: IBE_Util.debug('IBE_Order_Save_Pvt.TCA_AddressValidate BEGIN');
2271: end if;
2272:
2273: if (p_site_use_type ='BILL_TO') then
2274: l_contact_validate_qry:='SELECT LINES.LINE_ID '||
2302: 'AND ACCT_ROLE.STATUS = ''I''';
2303:
2304: end if; -- if p_site_use_type
2305:
2306: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2307: IBE_Util.debug('Contact Query Executed: '||l_contact_validate_qry);
2308: end if;
2309:
2310: open Contact_error_cur for l_contact_validate_qry using p_order_header_id;
2303:
2304: end if; -- if p_site_use_type
2305:
2306: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2307: IBE_Util.debug('Contact Query Executed: '||l_contact_validate_qry);
2308: end if;
2309:
2310: open Contact_error_cur for l_contact_validate_qry using p_order_header_id;
2311: loop
2314: tmpCount := tmpCount+1;
2315: FailLines := FND_API.G_TRUE;
2316: end loop;
2317:
2318: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2319: IBE_Util.debug('Whether Any Lines failed for Contact check: '|| FailLines);
2320: end if;
2321:
2322: if(FND_API.to_boolean(FailLines)) then
2315: FailLines := FND_API.G_TRUE;
2316: end loop;
2317:
2318: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2319: IBE_Util.debug('Whether Any Lines failed for Contact check: '|| FailLines);
2320: end if;
2321:
2322: if(FND_API.to_boolean(FailLines)) then
2323: x_return_status := FND_API.G_RET_STS_ERROR;
2332: X_failed_line_ids(failCnt) := 'SHIPCTNT:'||l_tmpfail_line_id(l_index);
2333: end if;
2334: l_index:=l_tmpfail_line_id.NEXT(l_index);
2335: end loop;
2336: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2337: IBE_Util.debug('Line Id failed for Contact check: '|| X_failed_line_ids(failCnt));
2338: end if;
2339: end if;
2340:
2333: end if;
2334: l_index:=l_tmpfail_line_id.NEXT(l_index);
2335: end loop;
2336: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2337: IBE_Util.debug('Line Id failed for Contact check: '|| X_failed_line_ids(failCnt));
2338: end if;
2339: end if;
2340:
2341: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2337: IBE_Util.debug('Line Id failed for Contact check: '|| X_failed_line_ids(failCnt));
2338: end if;
2339: end if;
2340:
2341: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2342: IBE_Util.debug('IBE_Order_Save_Pvt.TCA_AddressValidate END '||x_return_status);
2343: end if;
2344:
2345: END TCA_ContactValidate;
2338: end if;
2339: end if;
2340:
2341: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2342: IBE_Util.debug('IBE_Order_Save_Pvt.TCA_AddressValidate END '||x_return_status);
2343: end if;
2344:
2345: END TCA_ContactValidate;
2346:
2379:
2380:
2381: BEGIN
2382:
2383: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2384: IBE_Util.Debug('Begin IBE_ORDER_SAVE_PVT:Complete_RetLine_Validation()');
2385: END IF;
2386:
2387: X_failed_line_ids := JTF_VARCHAR2_TABLE_300();
2380:
2381: BEGIN
2382:
2383: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2384: IBE_Util.Debug('Begin IBE_ORDER_SAVE_PVT:Complete_RetLine_Validation()');
2385: END IF;
2386:
2387: X_failed_line_ids := JTF_VARCHAR2_TABLE_300();
2388:
2401:
2402:
2403:
2404:
2405: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2406: IBE_Util.Debug('Before calling TCA_AddressValidate for billto: ');
2407: END IF;
2408:
2409: TCA_AddressValidate(p_order_header_id => p_order_header_id,
2402:
2403:
2404:
2405: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2406: IBE_Util.Debug('Before calling TCA_AddressValidate for billto: ');
2407: END IF;
2408:
2409: TCA_AddressValidate(p_order_header_id => p_order_header_id,
2410: p_user_type => p_user_type,
2412: X_failed_line_ids => x_TCAfail_LineIds,
2413: x_return_status => l_return_status
2414: );
2415:
2416: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2417: IBE_Util.Debug('After calling TCA_AddressValidate Billto: '||l_return_status);
2418: END IF;
2419:
2420: IF l_return_status = FND_API.G_RET_STS_ERROR THEN
2413: x_return_status => l_return_status
2414: );
2415:
2416: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2417: IBE_Util.Debug('After calling TCA_AddressValidate Billto: '||l_return_status);
2418: END IF;
2419:
2420: IF l_return_status = FND_API.G_RET_STS_ERROR THEN
2421: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2417: IBE_Util.Debug('After calling TCA_AddressValidate Billto: '||l_return_status);
2418: END IF;
2419:
2420: IF l_return_status = FND_API.G_RET_STS_ERROR THEN
2421: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2422: IBE_Util.Debug('Address Failing Line count Billto:'|| x_TCAfail_LineIds.count);
2423: END IF;
2424: tCount := X_failed_line_ids.count;
2425: TCAFailLineCnt := x_TCAfail_LineIds.FIRST;
2418: END IF;
2419:
2420: IF l_return_status = FND_API.G_RET_STS_ERROR THEN
2421: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2422: IBE_Util.Debug('Address Failing Line count Billto:'|| x_TCAfail_LineIds.count);
2423: END IF;
2424: tCount := X_failed_line_ids.count;
2425: TCAFailLineCnt := x_TCAfail_LineIds.FIRST;
2426:
2431: X_failed_line_ids(tCount) := x_TCAfail_LineIds(TCAFailLineCnt);
2432: TCAFailLineCnt := x_TCAfail_LineIds.NEXT(TCAFailLineCnt);
2433: end loop;
2434:
2435: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2436: IBE_Util.Debug('Total failLine Ids in Addr Loop Bill to: '|| X_failed_line_ids.count);
2437: for k in 1..X_failed_line_ids.count
2438: loop
2439: IBE_Util.Debug('Total failLine Ids in Addr Loop Billto: '|| X_failed_line_ids(k));
2432: TCAFailLineCnt := x_TCAfail_LineIds.NEXT(TCAFailLineCnt);
2433: end loop;
2434:
2435: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2436: IBE_Util.Debug('Total failLine Ids in Addr Loop Bill to: '|| X_failed_line_ids.count);
2437: for k in 1..X_failed_line_ids.count
2438: loop
2439: IBE_Util.Debug('Total failLine Ids in Addr Loop Billto: '|| X_failed_line_ids(k));
2440: end loop;
2435: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2436: IBE_Util.Debug('Total failLine Ids in Addr Loop Bill to: '|| X_failed_line_ids.count);
2437: for k in 1..X_failed_line_ids.count
2438: loop
2439: IBE_Util.Debug('Total failLine Ids in Addr Loop Billto: '|| X_failed_line_ids(k));
2440: end loop;
2441: END IF;
2442:
2443:
2454: X_failed_line_ids => x_TCAfail_LineIds,
2455: x_return_status => ll_return_status
2456: );
2457:
2458: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2459: IBE_Util.Debug('After calling TCA_ContactValidate: '||ll_return_status);
2460: END IF;
2461: IF ll_return_status = FND_API.G_RET_STS_ERROR THEN
2462: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2455: x_return_status => ll_return_status
2456: );
2457:
2458: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2459: IBE_Util.Debug('After calling TCA_ContactValidate: '||ll_return_status);
2460: END IF;
2461: IF ll_return_status = FND_API.G_RET_STS_ERROR THEN
2462: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2463: IBE_Util.Debug('Failing Line count:'|| x_TCAfail_LineIds.count);
2458: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2459: IBE_Util.Debug('After calling TCA_ContactValidate: '||ll_return_status);
2460: END IF;
2461: IF ll_return_status = FND_API.G_RET_STS_ERROR THEN
2462: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2463: IBE_Util.Debug('Failing Line count:'|| x_TCAfail_LineIds.count);
2464: END IF;
2465: tCount := X_failed_line_ids.count;
2466: TCAFailLineCnt := x_TCAfail_LineIds.FIRST;
2459: IBE_Util.Debug('After calling TCA_ContactValidate: '||ll_return_status);
2460: END IF;
2461: IF ll_return_status = FND_API.G_RET_STS_ERROR THEN
2462: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2463: IBE_Util.Debug('Failing Line count:'|| x_TCAfail_LineIds.count);
2464: END IF;
2465: tCount := X_failed_line_ids.count;
2466: TCAFailLineCnt := x_TCAfail_LineIds.FIRST;
2467:
2472: X_failed_line_ids(tCount) := x_TCAfail_LineIds(TCAFailLineCnt);
2473: TCAFailLineCnt := x_TCAfail_LineIds.NEXT(TCAFailLineCnt);
2474: end loop;
2475:
2476: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2477: IBE_Util.Debug('Total failLine Ids in Contact Loop: '|| X_failed_line_ids.count);
2478: for k in 1..X_failed_line_ids.count
2479: loop
2480: IBE_Util.Debug('Total failLine Ids in Contact Loop: '|| X_failed_line_ids(k));
2473: TCAFailLineCnt := x_TCAfail_LineIds.NEXT(TCAFailLineCnt);
2474: end loop;
2475:
2476: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2477: IBE_Util.Debug('Total failLine Ids in Contact Loop: '|| X_failed_line_ids.count);
2478: for k in 1..X_failed_line_ids.count
2479: loop
2480: IBE_Util.Debug('Total failLine Ids in Contact Loop: '|| X_failed_line_ids(k));
2481: end loop;
2476: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2477: IBE_Util.Debug('Total failLine Ids in Contact Loop: '|| X_failed_line_ids.count);
2478: for k in 1..X_failed_line_ids.count
2479: loop
2480: IBE_Util.Debug('Total failLine Ids in Contact Loop: '|| X_failed_line_ids(k));
2481: end loop;
2482: END IF;
2483:
2484: end if;
2487: Set the Message if either the contact or address is invalid
2488: */
2489: if(l_return_status =FND_API.G_RET_STS_ERROR
2490: OR ll_return_status =FND_API.G_RET_STS_ERROR) then
2491: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2492: IBE_Util.Debug('Invalid Billing Details- Settig the Error to FND stack');
2493: END IF;
2494: FND_MESSAGE.Set_Name('IBE','IBE_ERR_OT_INVALID_BILLDET');
2495: FND_Msg_Pub.Add;
2488: */
2489: if(l_return_status =FND_API.G_RET_STS_ERROR
2490: OR ll_return_status =FND_API.G_RET_STS_ERROR) then
2491: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2492: IBE_Util.Debug('Invalid Billing Details- Settig the Error to FND stack');
2493: END IF;
2494: FND_MESSAGE.Set_Name('IBE','IBE_ERR_OT_INVALID_BILLDET');
2495: FND_Msg_Pub.Add;
2496: end if;
2494: FND_MESSAGE.Set_Name('IBE','IBE_ERR_OT_INVALID_BILLDET');
2495: FND_Msg_Pub.Add;
2496: end if;
2497:
2498: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2499: IBE_Util.Debug('Before calling TCA_AddressValidate: BILL_TO');
2500: END IF;
2501:
2502: -- For Ship To Contact and Address Validation
2495: FND_Msg_Pub.Add;
2496: end if;
2497:
2498: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2499: IBE_Util.Debug('Before calling TCA_AddressValidate: BILL_TO');
2500: END IF;
2501:
2502: -- For Ship To Contact and Address Validation
2503: TCA_AddressValidate(p_order_header_id => p_order_header_id,
2506: X_failed_line_ids => x_TCAfail_LineIds,
2507: x_return_status => l_return_status
2508: );
2509:
2510: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2511: IBE_Util.Debug('After calling TCA_AddressValidate Ship to: '||l_return_status);
2512: END IF;
2513:
2514: IF l_return_status = FND_API.G_RET_STS_ERROR THEN
2507: x_return_status => l_return_status
2508: );
2509:
2510: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2511: IBE_Util.Debug('After calling TCA_AddressValidate Ship to: '||l_return_status);
2512: END IF;
2513:
2514: IF l_return_status = FND_API.G_RET_STS_ERROR THEN
2515: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2511: IBE_Util.Debug('After calling TCA_AddressValidate Ship to: '||l_return_status);
2512: END IF;
2513:
2514: IF l_return_status = FND_API.G_RET_STS_ERROR THEN
2515: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2516: IBE_Util.Debug('Address Failing Line count Shipto:'|| x_TCAfail_LineIds.count);
2517: END IF;
2518: tCount := X_failed_line_ids.count;
2519: TCAFailLineCnt := x_TCAfail_LineIds.FIRST;
2512: END IF;
2513:
2514: IF l_return_status = FND_API.G_RET_STS_ERROR THEN
2515: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2516: IBE_Util.Debug('Address Failing Line count Shipto:'|| x_TCAfail_LineIds.count);
2517: END IF;
2518: tCount := X_failed_line_ids.count;
2519: TCAFailLineCnt := x_TCAfail_LineIds.FIRST;
2520:
2525: X_failed_line_ids(tCount) := x_TCAfail_LineIds(TCAFailLineCnt);
2526: TCAFailLineCnt := x_TCAfail_LineIds.NEXT(TCAFailLineCnt);
2527: end loop;
2528:
2529: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2530: IBE_Util.Debug('Total failLine Ids in Addr Loop:Shipto '|| X_failed_line_ids.count);
2531: for k in 1..X_failed_line_ids.count
2532: loop
2533: IBE_Util.Debug('Total failLine Ids in Addr Loop:Shipto '|| X_failed_line_ids(k));
2526: TCAFailLineCnt := x_TCAfail_LineIds.NEXT(TCAFailLineCnt);
2527: end loop;
2528:
2529: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2530: IBE_Util.Debug('Total failLine Ids in Addr Loop:Shipto '|| X_failed_line_ids.count);
2531: for k in 1..X_failed_line_ids.count
2532: loop
2533: IBE_Util.Debug('Total failLine Ids in Addr Loop:Shipto '|| X_failed_line_ids(k));
2534: end loop;
2529: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2530: IBE_Util.Debug('Total failLine Ids in Addr Loop:Shipto '|| X_failed_line_ids.count);
2531: for k in 1..X_failed_line_ids.count
2532: loop
2533: IBE_Util.Debug('Total failLine Ids in Addr Loop:Shipto '|| X_failed_line_ids(k));
2534: end loop;
2535: END IF;
2536:
2537:
2542: X_failed_line_ids => x_TCAfail_LineIds,
2543: x_return_status => ll_return_status
2544: );
2545:
2546: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2547: IBE_Util.Debug('After calling TCA_ContactValidate: '||ll_return_status);
2548: END IF;
2549: IF ll_return_status = FND_API.G_RET_STS_ERROR THEN
2550: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2543: x_return_status => ll_return_status
2544: );
2545:
2546: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2547: IBE_Util.Debug('After calling TCA_ContactValidate: '||ll_return_status);
2548: END IF;
2549: IF ll_return_status = FND_API.G_RET_STS_ERROR THEN
2550: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2551: IBE_Util.Debug('Failing Line count:'|| x_TCAfail_LineIds.count);
2546: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2547: IBE_Util.Debug('After calling TCA_ContactValidate: '||ll_return_status);
2548: END IF;
2549: IF ll_return_status = FND_API.G_RET_STS_ERROR THEN
2550: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2551: IBE_Util.Debug('Failing Line count:'|| x_TCAfail_LineIds.count);
2552: END IF;
2553: tCount := X_failed_line_ids.count;
2554: TCAFailLineCnt := x_TCAfail_LineIds.FIRST;
2547: IBE_Util.Debug('After calling TCA_ContactValidate: '||ll_return_status);
2548: END IF;
2549: IF ll_return_status = FND_API.G_RET_STS_ERROR THEN
2550: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2551: IBE_Util.Debug('Failing Line count:'|| x_TCAfail_LineIds.count);
2552: END IF;
2553: tCount := X_failed_line_ids.count;
2554: TCAFailLineCnt := x_TCAfail_LineIds.FIRST;
2555:
2560: X_failed_line_ids(tCount) := x_TCAfail_LineIds(TCAFailLineCnt);
2561: TCAFailLineCnt := x_TCAfail_LineIds.NEXT(TCAFailLineCnt);
2562: end loop;
2563:
2564: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2565: IBE_Util.Debug('Total failLine Ids in Contact Loop: '|| X_failed_line_ids.count);
2566: for k in 1..X_failed_line_ids.count
2567: loop
2568: IBE_Util.Debug('Total failLine Ids in Contact Loop: '|| X_failed_line_ids(k));
2561: TCAFailLineCnt := x_TCAfail_LineIds.NEXT(TCAFailLineCnt);
2562: end loop;
2563:
2564: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2565: IBE_Util.Debug('Total failLine Ids in Contact Loop: '|| X_failed_line_ids.count);
2566: for k in 1..X_failed_line_ids.count
2567: loop
2568: IBE_Util.Debug('Total failLine Ids in Contact Loop: '|| X_failed_line_ids(k));
2569: end loop;
2564: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2565: IBE_Util.Debug('Total failLine Ids in Contact Loop: '|| X_failed_line_ids.count);
2566: for k in 1..X_failed_line_ids.count
2567: loop
2568: IBE_Util.Debug('Total failLine Ids in Contact Loop: '|| X_failed_line_ids(k));
2569: end loop;
2570: END IF;
2571:
2572: end if;
2579:
2580:
2581: if(l_return_status =FND_API.G_RET_STS_ERROR
2582: OR ll_return_status =FND_API.G_RET_STS_ERROR) then
2583: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2584: IBE_Util.Debug('Invalid Billing Details- Settig the Error to FND stack');
2585: END IF;
2586: FND_MESSAGE.Set_Name('IBE','IBE_ERR_OT_INVALID_SHIPDET');
2587: FND_Msg_Pub.Add;
2580:
2581: if(l_return_status =FND_API.G_RET_STS_ERROR
2582: OR ll_return_status =FND_API.G_RET_STS_ERROR) then
2583: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2584: IBE_Util.Debug('Invalid Billing Details- Settig the Error to FND stack');
2585: END IF;
2586: FND_MESSAGE.Set_Name('IBE','IBE_ERR_OT_INVALID_SHIPDET');
2587: FND_Msg_Pub.Add;
2588: end if;
2587: FND_Msg_Pub.Add;
2588: end if;
2589:
2590:
2591: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2592: IBE_Util.Debug('Before Calling CheckOverRetQty');
2593: END IF;
2594:
2595: -- Now verify the Over Return Quantity
2588: end if;
2589:
2590:
2591: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2592: IBE_Util.Debug('Before Calling CheckOverRetQty');
2593: END IF;
2594:
2595: -- Now verify the Over Return Quantity
2596:
2601: ,x_msg_count => x_msg_count
2602: ,x_msg_data => x_msg_data
2603: );
2604:
2605: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2606: IBE_Util.Debug('After Calling CheckOverRetQty');
2607: END IF;
2608:
2609: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
2602: ,x_msg_data => x_msg_data
2603: );
2604:
2605: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2606: IBE_Util.Debug('After Calling CheckOverRetQty');
2607: END IF;
2608:
2609: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
2610: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2606: IBE_Util.Debug('After Calling CheckOverRetQty');
2607: END IF;
2608:
2609: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
2610: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2611: IBE_Util.Debug('No. of Lines failing after Qty validations:'|| x_qtyfail_LineIds.count);
2612: END IF;
2613: tCount := X_failed_line_ids.count;
2614: QtyFailLineCnt := x_qtyfail_LineIds.FIRST;
2607: END IF;
2608:
2609: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
2610: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2611: IBE_Util.Debug('No. of Lines failing after Qty validations:'|| x_qtyfail_LineIds.count);
2612: END IF;
2613: tCount := X_failed_line_ids.count;
2614: QtyFailLineCnt := x_qtyfail_LineIds.FIRST;
2615:
2620: X_failed_line_ids(tCount) := x_qtyfail_LineIds(QtyFailLineCnt);
2621: QtyFailLineCnt := x_qtyfail_LineIds.NEXT(QtyFailLineCnt);
2622: end loop;
2623:
2624: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2625: IBE_Util.Debug('Total failLine Ids In final loop: '|| X_failed_line_ids.count);
2626: for k in 1..X_failed_line_ids.count
2627: loop
2628: IBE_Util.Debug('Total failLine Ids in final Loop: '|| X_failed_line_ids(k));
2621: QtyFailLineCnt := x_qtyfail_LineIds.NEXT(QtyFailLineCnt);
2622: end loop;
2623:
2624: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2625: IBE_Util.Debug('Total failLine Ids In final loop: '|| X_failed_line_ids.count);
2626: for k in 1..X_failed_line_ids.count
2627: loop
2628: IBE_Util.Debug('Total failLine Ids in final Loop: '|| X_failed_line_ids(k));
2629: end loop;
2624: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2625: IBE_Util.Debug('Total failLine Ids In final loop: '|| X_failed_line_ids.count);
2626: for k in 1..X_failed_line_ids.count
2627: loop
2628: IBE_Util.Debug('Total failLine Ids in final Loop: '|| X_failed_line_ids(k));
2629: end loop;
2630: END IF;
2631: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2632: raise FND_API.G_EXC_UNEXPECTED_ERROR;
2631: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2632: raise FND_API.G_EXC_UNEXPECTED_ERROR;
2633: END IF;
2634:
2635: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2636: IBE_Util.Debug('Total Failing LineCounts:'||tCount);
2637: END IF;
2638: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2639: IBE_Util.Debug(' Total Failing LineCounts:'||tCount);
2632: raise FND_API.G_EXC_UNEXPECTED_ERROR;
2633: END IF;
2634:
2635: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2636: IBE_Util.Debug('Total Failing LineCounts:'||tCount);
2637: END IF;
2638: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2639: IBE_Util.Debug(' Total Failing LineCounts:'||tCount);
2640: END IF;
2634:
2635: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2636: IBE_Util.Debug('Total Failing LineCounts:'||tCount);
2637: END IF;
2638: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2639: IBE_Util.Debug(' Total Failing LineCounts:'||tCount);
2640: END IF;
2641:
2642: -- If there are validation failing line IDs then set the status as ERROR.
2635: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2636: IBE_Util.Debug('Total Failing LineCounts:'||tCount);
2637: END IF;
2638: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2639: IBE_Util.Debug(' Total Failing LineCounts:'||tCount);
2640: END IF;
2641:
2642: -- If there are validation failing line IDs then set the status as ERROR.
2643:
2644: IF (X_failed_line_ids.count > 0) THEN
2645: raise FND_API.G_EXC_ERROR;
2646: ENd IF;
2647:
2648: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2649: Ibe_util.Debug('End IBE_ORDER_SAVE_PVT:Complete_RetOrder_Validate');
2650: END IF;
2651:
2652: FND_MSG_PUB.Count_And_Get
2645: raise FND_API.G_EXC_ERROR;
2646: ENd IF;
2647:
2648: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2649: Ibe_util.Debug('End IBE_ORDER_SAVE_PVT:Complete_RetOrder_Validate');
2650: END IF;
2651:
2652: FND_MSG_PUB.Count_And_Get
2653: ( p_count => x_msg_count,
2659: x_return_status := FND_API.G_RET_STS_ERROR;
2660: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
2661: p_count => x_msg_count ,
2662: p_data => x_msg_data);
2663: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2664: IBE_Util.Debug('Error IBE_ORDER_SAVE_PVT:Complete_RetOrder_Validate()'|| sqlerrm);
2665: END IF;
2666:
2667: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2660: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
2661: p_count => x_msg_count ,
2662: p_data => x_msg_data);
2663: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2664: IBE_Util.Debug('Error IBE_ORDER_SAVE_PVT:Complete_RetOrder_Validate()'|| sqlerrm);
2665: END IF;
2666:
2667: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2668: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2668: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2669: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
2670: p_count => x_msg_count ,
2671: p_data => x_msg_data);
2672: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2673: IBE_Util.Debug('UNEXPError IBE_ORDER_SAVE_PVT:Complete_RetOrder_Validate()' || sqlerrm);
2674: END IF;
2675:
2676: WHEN OTHERS THEN
2669: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
2670: p_count => x_msg_count ,
2671: p_data => x_msg_data);
2672: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2673: IBE_Util.Debug('UNEXPError IBE_ORDER_SAVE_PVT:Complete_RetOrder_Validate()' || sqlerrm);
2674: END IF;
2675:
2676: WHEN OTHERS THEN
2677: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2682:
2683: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
2684: p_count => x_msg_count ,
2685: p_data => x_msg_data);
2686: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2687: IBE_Util.Debug('Other IBE_ORDER_SAVE_PVT:Complete_RetOrder_Validate()' || sqlerrm);
2688: END IF;
2689:
2690: END Complete_RetOrder_Validate;
2683: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
2684: p_count => x_msg_count ,
2685: p_data => x_msg_data);
2686: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2687: IBE_Util.Debug('Other IBE_ORDER_SAVE_PVT:Complete_RetOrder_Validate()' || sqlerrm);
2688: END IF;
2689:
2690: END Complete_RetOrder_Validate;
2691:
2789: --X_failed_line_ids JTF_VARCHAR2_TABLE_300;
2790: /******/
2791: BEGIN
2792:
2793: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2794: IBE_Util.Debug('Begin IBE_ORDER_SAVE_PVT:Save(): ' || p_save_type);
2795: END IF;
2796:
2797:
2790: /******/
2791: BEGIN
2792:
2793: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2794: IBE_Util.Debug('Begin IBE_ORDER_SAVE_PVT:Save(): ' || p_save_type);
2795: END IF;
2796:
2797:
2798: -- Standard Start of API savepoint
2822:
2823: l_order_header_rec := p_order_header_rec;
2824:
2825:
2826: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2827: IBE_Util.Debug('Begin p_order_header_rec' ||p_order_header_rec.header_id ||'::'|| p_party_id);
2828: END IF;
2829:
2830: -- Call Default Header Record
2823: l_order_header_rec := p_order_header_rec;
2824:
2825:
2826: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2827: IBE_Util.Debug('Begin p_order_header_rec' ||p_order_header_rec.header_id ||'::'|| p_party_id);
2828: END IF;
2829:
2830: -- Call Default Header Record
2831: DefaultHeaderRecord(l_order_header_rec
2834: ,lx_order_header_rec);
2835:
2836: l_order_header_rec := lx_order_header_rec;
2837:
2838: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2839: IBE_Util.Debug('Save:order_hdr_rec.operation: ' || l_order_header_rec.operation);
2840: IBE_Util.Debug('Save:order_hdr_rec.sold_to_org_id: ' || l_order_header_rec.SOLD_TO_ORG_ID);
2841: IBE_Util.Debug('Save:order_hdr_rec.ship_to_org_id: ' || l_order_header_rec.SHIP_TO_ORG_ID);
2842: IBE_Util.Debug('Save:order_hdr_rec.Invoice_to_org_id: ' || l_order_header_rec.INVOICE_TO_ORG_ID);
2835:
2836: l_order_header_rec := lx_order_header_rec;
2837:
2838: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2839: IBE_Util.Debug('Save:order_hdr_rec.operation: ' || l_order_header_rec.operation);
2840: IBE_Util.Debug('Save:order_hdr_rec.sold_to_org_id: ' || l_order_header_rec.SOLD_TO_ORG_ID);
2841: IBE_Util.Debug('Save:order_hdr_rec.ship_to_org_id: ' || l_order_header_rec.SHIP_TO_ORG_ID);
2842: IBE_Util.Debug('Save:order_hdr_rec.Invoice_to_org_id: ' || l_order_header_rec.INVOICE_TO_ORG_ID);
2843: IBE_Util.Debug('Save:order_hdr_rec.header_id: ' || l_order_header_rec.HEADER_ID);
2836: l_order_header_rec := lx_order_header_rec;
2837:
2838: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2839: IBE_Util.Debug('Save:order_hdr_rec.operation: ' || l_order_header_rec.operation);
2840: IBE_Util.Debug('Save:order_hdr_rec.sold_to_org_id: ' || l_order_header_rec.SOLD_TO_ORG_ID);
2841: IBE_Util.Debug('Save:order_hdr_rec.ship_to_org_id: ' || l_order_header_rec.SHIP_TO_ORG_ID);
2842: IBE_Util.Debug('Save:order_hdr_rec.Invoice_to_org_id: ' || l_order_header_rec.INVOICE_TO_ORG_ID);
2843: IBE_Util.Debug('Save:order_hdr_rec.header_id: ' || l_order_header_rec.HEADER_ID);
2844: IBE_Util.Debug('Save:order_hdr_rec.order type id: ' || l_order_header_rec.ORDER_TYPE_ID);
2837:
2838: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2839: IBE_Util.Debug('Save:order_hdr_rec.operation: ' || l_order_header_rec.operation);
2840: IBE_Util.Debug('Save:order_hdr_rec.sold_to_org_id: ' || l_order_header_rec.SOLD_TO_ORG_ID);
2841: IBE_Util.Debug('Save:order_hdr_rec.ship_to_org_id: ' || l_order_header_rec.SHIP_TO_ORG_ID);
2842: IBE_Util.Debug('Save:order_hdr_rec.Invoice_to_org_id: ' || l_order_header_rec.INVOICE_TO_ORG_ID);
2843: IBE_Util.Debug('Save:order_hdr_rec.header_id: ' || l_order_header_rec.HEADER_ID);
2844: IBE_Util.Debug('Save:order_hdr_rec.order type id: ' || l_order_header_rec.ORDER_TYPE_ID);
2845: IBE_Util.Debug('Save:order_hdr_rec.org id: ' || l_order_header_rec.ORG_ID);
2838: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2839: IBE_Util.Debug('Save:order_hdr_rec.operation: ' || l_order_header_rec.operation);
2840: IBE_Util.Debug('Save:order_hdr_rec.sold_to_org_id: ' || l_order_header_rec.SOLD_TO_ORG_ID);
2841: IBE_Util.Debug('Save:order_hdr_rec.ship_to_org_id: ' || l_order_header_rec.SHIP_TO_ORG_ID);
2842: IBE_Util.Debug('Save:order_hdr_rec.Invoice_to_org_id: ' || l_order_header_rec.INVOICE_TO_ORG_ID);
2843: IBE_Util.Debug('Save:order_hdr_rec.header_id: ' || l_order_header_rec.HEADER_ID);
2844: IBE_Util.Debug('Save:order_hdr_rec.order type id: ' || l_order_header_rec.ORDER_TYPE_ID);
2845: IBE_Util.Debug('Save:order_hdr_rec.org id: ' || l_order_header_rec.ORG_ID);
2846: IBE_Util.Debug('Save:order_hdr_rec.trans_curr_code: ' || l_order_header_rec.transactional_curr_code);
2839: IBE_Util.Debug('Save:order_hdr_rec.operation: ' || l_order_header_rec.operation);
2840: IBE_Util.Debug('Save:order_hdr_rec.sold_to_org_id: ' || l_order_header_rec.SOLD_TO_ORG_ID);
2841: IBE_Util.Debug('Save:order_hdr_rec.ship_to_org_id: ' || l_order_header_rec.SHIP_TO_ORG_ID);
2842: IBE_Util.Debug('Save:order_hdr_rec.Invoice_to_org_id: ' || l_order_header_rec.INVOICE_TO_ORG_ID);
2843: IBE_Util.Debug('Save:order_hdr_rec.header_id: ' || l_order_header_rec.HEADER_ID);
2844: IBE_Util.Debug('Save:order_hdr_rec.order type id: ' || l_order_header_rec.ORDER_TYPE_ID);
2845: IBE_Util.Debug('Save:order_hdr_rec.org id: ' || l_order_header_rec.ORG_ID);
2846: IBE_Util.Debug('Save:order_hdr_rec.trans_curr_code: ' || l_order_header_rec.transactional_curr_code);
2847: IBE_Util.Debug('Save:order_hdr_rec.flow_stat_code: ' || l_order_header_rec.flow_status_code);
2840: IBE_Util.Debug('Save:order_hdr_rec.sold_to_org_id: ' || l_order_header_rec.SOLD_TO_ORG_ID);
2841: IBE_Util.Debug('Save:order_hdr_rec.ship_to_org_id: ' || l_order_header_rec.SHIP_TO_ORG_ID);
2842: IBE_Util.Debug('Save:order_hdr_rec.Invoice_to_org_id: ' || l_order_header_rec.INVOICE_TO_ORG_ID);
2843: IBE_Util.Debug('Save:order_hdr_rec.header_id: ' || l_order_header_rec.HEADER_ID);
2844: IBE_Util.Debug('Save:order_hdr_rec.order type id: ' || l_order_header_rec.ORDER_TYPE_ID);
2845: IBE_Util.Debug('Save:order_hdr_rec.org id: ' || l_order_header_rec.ORG_ID);
2846: IBE_Util.Debug('Save:order_hdr_rec.trans_curr_code: ' || l_order_header_rec.transactional_curr_code);
2847: IBE_Util.Debug('Save:order_hdr_rec.flow_stat_code: ' || l_order_header_rec.flow_status_code);
2848: END IF;
2841: IBE_Util.Debug('Save:order_hdr_rec.ship_to_org_id: ' || l_order_header_rec.SHIP_TO_ORG_ID);
2842: IBE_Util.Debug('Save:order_hdr_rec.Invoice_to_org_id: ' || l_order_header_rec.INVOICE_TO_ORG_ID);
2843: IBE_Util.Debug('Save:order_hdr_rec.header_id: ' || l_order_header_rec.HEADER_ID);
2844: IBE_Util.Debug('Save:order_hdr_rec.order type id: ' || l_order_header_rec.ORDER_TYPE_ID);
2845: IBE_Util.Debug('Save:order_hdr_rec.org id: ' || l_order_header_rec.ORG_ID);
2846: IBE_Util.Debug('Save:order_hdr_rec.trans_curr_code: ' || l_order_header_rec.transactional_curr_code);
2847: IBE_Util.Debug('Save:order_hdr_rec.flow_stat_code: ' || l_order_header_rec.flow_status_code);
2848: END IF;
2849:
2842: IBE_Util.Debug('Save:order_hdr_rec.Invoice_to_org_id: ' || l_order_header_rec.INVOICE_TO_ORG_ID);
2843: IBE_Util.Debug('Save:order_hdr_rec.header_id: ' || l_order_header_rec.HEADER_ID);
2844: IBE_Util.Debug('Save:order_hdr_rec.order type id: ' || l_order_header_rec.ORDER_TYPE_ID);
2845: IBE_Util.Debug('Save:order_hdr_rec.org id: ' || l_order_header_rec.ORG_ID);
2846: IBE_Util.Debug('Save:order_hdr_rec.trans_curr_code: ' || l_order_header_rec.transactional_curr_code);
2847: IBE_Util.Debug('Save:order_hdr_rec.flow_stat_code: ' || l_order_header_rec.flow_status_code);
2848: END IF;
2849:
2850:
2843: IBE_Util.Debug('Save:order_hdr_rec.header_id: ' || l_order_header_rec.HEADER_ID);
2844: IBE_Util.Debug('Save:order_hdr_rec.order type id: ' || l_order_header_rec.ORDER_TYPE_ID);
2845: IBE_Util.Debug('Save:order_hdr_rec.org id: ' || l_order_header_rec.ORG_ID);
2846: IBE_Util.Debug('Save:order_hdr_rec.trans_curr_code: ' || l_order_header_rec.transactional_curr_code);
2847: IBE_Util.Debug('Save:order_hdr_rec.flow_stat_code: ' || l_order_header_rec.flow_status_code);
2848: END IF;
2849:
2850:
2851: /********** User Authentication *************/
2889: IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) then
2890: raise FND_API.G_EXC_ERROR;
2891: END IF;
2892:
2893: IF (IBE_UTIL.G_DEBUGON = l_true) then
2894: Ibe_Util.DEBUG('ship_to_org_id returned: ' || lx_order_header_rec.ship_to_org_id);
2895: Ibe_Util.DEBUG('bill_to_org_id returned: ' || lx_order_header_rec.invoice_to_org_id);
2896: end if;
2897:
2890: raise FND_API.G_EXC_ERROR;
2891: END IF;
2892:
2893: IF (IBE_UTIL.G_DEBUGON = l_true) then
2894: Ibe_Util.DEBUG('ship_to_org_id returned: ' || lx_order_header_rec.ship_to_org_id);
2895: Ibe_Util.DEBUG('bill_to_org_id returned: ' || lx_order_header_rec.invoice_to_org_id);
2896: end if;
2897:
2898: IF(lx_order_header_rec.invoice_to_org_id is null OR lx_order_header_rec.invoice_to_org_id = FND_API.G_MISS_NUM)
2891: END IF;
2892:
2893: IF (IBE_UTIL.G_DEBUGON = l_true) then
2894: Ibe_Util.DEBUG('ship_to_org_id returned: ' || lx_order_header_rec.ship_to_org_id);
2895: Ibe_Util.DEBUG('bill_to_org_id returned: ' || lx_order_header_rec.invoice_to_org_id);
2896: end if;
2897:
2898: IF(lx_order_header_rec.invoice_to_org_id is null OR lx_order_header_rec.invoice_to_org_id = FND_API.G_MISS_NUM)
2899: THEN
2902: RAISE FND_API.G_EXC_ERROR;
2903: END IF;
2904:
2905: l_order_header_rec := lx_order_header_rec;
2906: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2907: IBE_Util.Debug('Save :order_hdr_rec.ship_to_org_id: ' || l_order_header_rec.SHIP_TO_ORG_ID);
2908: IBE_Util.Debug('Save :order_hdr_rec.Invoice_to_org_id: ' || l_order_header_rec.INVOICE_TO_ORG_ID);
2909: IBE_Util.Debug('Save :order_hdr_rec.header_id: ' || l_order_header_rec.HEADER_ID);
2910:
2903: END IF;
2904:
2905: l_order_header_rec := lx_order_header_rec;
2906: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2907: IBE_Util.Debug('Save :order_hdr_rec.ship_to_org_id: ' || l_order_header_rec.SHIP_TO_ORG_ID);
2908: IBE_Util.Debug('Save :order_hdr_rec.Invoice_to_org_id: ' || l_order_header_rec.INVOICE_TO_ORG_ID);
2909: IBE_Util.Debug('Save :order_hdr_rec.header_id: ' || l_order_header_rec.HEADER_ID);
2910:
2911: END IF;
2904:
2905: l_order_header_rec := lx_order_header_rec;
2906: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2907: IBE_Util.Debug('Save :order_hdr_rec.ship_to_org_id: ' || l_order_header_rec.SHIP_TO_ORG_ID);
2908: IBE_Util.Debug('Save :order_hdr_rec.Invoice_to_org_id: ' || l_order_header_rec.INVOICE_TO_ORG_ID);
2909: IBE_Util.Debug('Save :order_hdr_rec.header_id: ' || l_order_header_rec.HEADER_ID);
2910:
2911: END IF;
2912: FOR i in 1..lx_line_tbl.COUNT
2905: l_order_header_rec := lx_order_header_rec;
2906: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2907: IBE_Util.Debug('Save :order_hdr_rec.ship_to_org_id: ' || l_order_header_rec.SHIP_TO_ORG_ID);
2908: IBE_Util.Debug('Save :order_hdr_rec.Invoice_to_org_id: ' || l_order_header_rec.INVOICE_TO_ORG_ID);
2909: IBE_Util.Debug('Save :order_hdr_rec.header_id: ' || l_order_header_rec.HEADER_ID);
2910:
2911: END IF;
2912: FOR i in 1..lx_line_tbl.COUNT
2913: LOOP
2933: IF ((l_user_type = 'PERSON') AND
2934: (l_order_header_rec.operation = OE_Globals.G_OPR_UPDATE) AND
2935: (p_submit_control_rec.cancel_flag <> 'Y'))
2936: THEN
2937: IF (IBE_UTIL.G_DEBUGON = l_true) then
2938: Ibe_Util.DEBUG('calling SetLine ids API');
2939: END IF;
2940: SetLineShipInvoiceIds(
2941: p_order_header_rec => l_order_header_rec
2934: (l_order_header_rec.operation = OE_Globals.G_OPR_UPDATE) AND
2935: (p_submit_control_rec.cancel_flag <> 'Y'))
2936: THEN
2937: IF (IBE_UTIL.G_DEBUGON = l_true) then
2938: Ibe_Util.DEBUG('calling SetLine ids API');
2939: END IF;
2940: SetLineShipInvoiceIds(
2941: p_order_header_rec => l_order_header_rec
2942: ,p_order_line_tbl => l_order_line_tbl
2944:
2945: for j in 1..lx_line_tbl.count
2946: loop
2947: l_order_line_tbl(j) := lx_line_tbl(j);
2948: IF (IBE_UTIL.G_DEBUGON = l_true) then
2949: Ibe_Util.DEBUG('Line Level Values after setting: '||l_order_line_tbl(j).line_id||' : '||
2950: l_order_line_tbl(j).ship_to_org_id||' : '||l_order_line_tbl(j).invoice_to_org_id);
2951: END IF;
2952: end loop;
2945: for j in 1..lx_line_tbl.count
2946: loop
2947: l_order_line_tbl(j) := lx_line_tbl(j);
2948: IF (IBE_UTIL.G_DEBUGON = l_true) then
2949: Ibe_Util.DEBUG('Line Level Values after setting: '||l_order_line_tbl(j).line_id||' : '||
2950: l_order_line_tbl(j).ship_to_org_id||' : '||l_order_line_tbl(j).invoice_to_org_id);
2951: END IF;
2952: end loop;
2953:
2952: end loop;
2953:
2954: END IF; -- if operation = update
2955:
2956: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2957: FOR i in 1..l_order_line_tbl.COUNT
2958: LOOP
2959: IBE_Util.Debug('Save:line_tbl.operation: ' || l_order_line_tbl(i).OPERATION);
2960: IBE_Util.Debug('Save:line_tbl.line_id: ' || l_order_line_tbl(i).LINE_ID);
2955:
2956: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2957: FOR i in 1..l_order_line_tbl.COUNT
2958: LOOP
2959: IBE_Util.Debug('Save:line_tbl.operation: ' || l_order_line_tbl(i).OPERATION);
2960: IBE_Util.Debug('Save:line_tbl.line_id: ' || l_order_line_tbl(i).LINE_ID);
2961: IBE_Util.Debug('Save:line_tbl.line_type_id: ' || l_order_line_tbl(i).LINE_TYPE_ID);
2962: IBE_Util.Debug('Save:line_tbl.qty: ' || l_order_line_tbl(i).ORDERED_QUANTITY);
2963: IBE_Util.Debug('Save:line_tbl.inv to org id: ' || l_order_line_tbl(i).INVOICE_TO_ORG_ID);
2956: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2957: FOR i in 1..l_order_line_tbl.COUNT
2958: LOOP
2959: IBE_Util.Debug('Save:line_tbl.operation: ' || l_order_line_tbl(i).OPERATION);
2960: IBE_Util.Debug('Save:line_tbl.line_id: ' || l_order_line_tbl(i).LINE_ID);
2961: IBE_Util.Debug('Save:line_tbl.line_type_id: ' || l_order_line_tbl(i).LINE_TYPE_ID);
2962: IBE_Util.Debug('Save:line_tbl.qty: ' || l_order_line_tbl(i).ORDERED_QUANTITY);
2963: IBE_Util.Debug('Save:line_tbl.inv to org id: ' || l_order_line_tbl(i).INVOICE_TO_ORG_ID);
2964: IBE_Util.Debug('Save:line_tbl.ship to org id: ' || l_order_line_tbl(i).SHIP_TO_ORG_ID);
2957: FOR i in 1..l_order_line_tbl.COUNT
2958: LOOP
2959: IBE_Util.Debug('Save:line_tbl.operation: ' || l_order_line_tbl(i).OPERATION);
2960: IBE_Util.Debug('Save:line_tbl.line_id: ' || l_order_line_tbl(i).LINE_ID);
2961: IBE_Util.Debug('Save:line_tbl.line_type_id: ' || l_order_line_tbl(i).LINE_TYPE_ID);
2962: IBE_Util.Debug('Save:line_tbl.qty: ' || l_order_line_tbl(i).ORDERED_QUANTITY);
2963: IBE_Util.Debug('Save:line_tbl.inv to org id: ' || l_order_line_tbl(i).INVOICE_TO_ORG_ID);
2964: IBE_Util.Debug('Save:line_tbl.ship to org id: ' || l_order_line_tbl(i).SHIP_TO_ORG_ID);
2965: IBE_Util.Debug('Save:line_tbl.return_context: ' || l_order_line_tbl(i).RETURN_CONTEXT);
2958: LOOP
2959: IBE_Util.Debug('Save:line_tbl.operation: ' || l_order_line_tbl(i).OPERATION);
2960: IBE_Util.Debug('Save:line_tbl.line_id: ' || l_order_line_tbl(i).LINE_ID);
2961: IBE_Util.Debug('Save:line_tbl.line_type_id: ' || l_order_line_tbl(i).LINE_TYPE_ID);
2962: IBE_Util.Debug('Save:line_tbl.qty: ' || l_order_line_tbl(i).ORDERED_QUANTITY);
2963: IBE_Util.Debug('Save:line_tbl.inv to org id: ' || l_order_line_tbl(i).INVOICE_TO_ORG_ID);
2964: IBE_Util.Debug('Save:line_tbl.ship to org id: ' || l_order_line_tbl(i).SHIP_TO_ORG_ID);
2965: IBE_Util.Debug('Save:line_tbl.return_context: ' || l_order_line_tbl(i).RETURN_CONTEXT);
2966: IBE_Util.Debug('Save:line_tbl.line categ: ' || l_order_line_tbl(i).LINE_CATEGORY_CODE);
2959: IBE_Util.Debug('Save:line_tbl.operation: ' || l_order_line_tbl(i).OPERATION);
2960: IBE_Util.Debug('Save:line_tbl.line_id: ' || l_order_line_tbl(i).LINE_ID);
2961: IBE_Util.Debug('Save:line_tbl.line_type_id: ' || l_order_line_tbl(i).LINE_TYPE_ID);
2962: IBE_Util.Debug('Save:line_tbl.qty: ' || l_order_line_tbl(i).ORDERED_QUANTITY);
2963: IBE_Util.Debug('Save:line_tbl.inv to org id: ' || l_order_line_tbl(i).INVOICE_TO_ORG_ID);
2964: IBE_Util.Debug('Save:line_tbl.ship to org id: ' || l_order_line_tbl(i).SHIP_TO_ORG_ID);
2965: IBE_Util.Debug('Save:line_tbl.return_context: ' || l_order_line_tbl(i).RETURN_CONTEXT);
2966: IBE_Util.Debug('Save:line_tbl.line categ: ' || l_order_line_tbl(i).LINE_CATEGORY_CODE);
2967: IBE_Util.Debug('Save:line_tbl.ret atr1: ' || l_order_line_tbl(i).return_attribute1);
2960: IBE_Util.Debug('Save:line_tbl.line_id: ' || l_order_line_tbl(i).LINE_ID);
2961: IBE_Util.Debug('Save:line_tbl.line_type_id: ' || l_order_line_tbl(i).LINE_TYPE_ID);
2962: IBE_Util.Debug('Save:line_tbl.qty: ' || l_order_line_tbl(i).ORDERED_QUANTITY);
2963: IBE_Util.Debug('Save:line_tbl.inv to org id: ' || l_order_line_tbl(i).INVOICE_TO_ORG_ID);
2964: IBE_Util.Debug('Save:line_tbl.ship to org id: ' || l_order_line_tbl(i).SHIP_TO_ORG_ID);
2965: IBE_Util.Debug('Save:line_tbl.return_context: ' || l_order_line_tbl(i).RETURN_CONTEXT);
2966: IBE_Util.Debug('Save:line_tbl.line categ: ' || l_order_line_tbl(i).LINE_CATEGORY_CODE);
2967: IBE_Util.Debug('Save:line_tbl.ret atr1: ' || l_order_line_tbl(i).return_attribute1);
2968: IBE_Util.Debug('Save:line_tbl.ret atr2: ' || l_order_line_tbl(i).return_attribute2);
2961: IBE_Util.Debug('Save:line_tbl.line_type_id: ' || l_order_line_tbl(i).LINE_TYPE_ID);
2962: IBE_Util.Debug('Save:line_tbl.qty: ' || l_order_line_tbl(i).ORDERED_QUANTITY);
2963: IBE_Util.Debug('Save:line_tbl.inv to org id: ' || l_order_line_tbl(i).INVOICE_TO_ORG_ID);
2964: IBE_Util.Debug('Save:line_tbl.ship to org id: ' || l_order_line_tbl(i).SHIP_TO_ORG_ID);
2965: IBE_Util.Debug('Save:line_tbl.return_context: ' || l_order_line_tbl(i).RETURN_CONTEXT);
2966: IBE_Util.Debug('Save:line_tbl.line categ: ' || l_order_line_tbl(i).LINE_CATEGORY_CODE);
2967: IBE_Util.Debug('Save:line_tbl.ret atr1: ' || l_order_line_tbl(i).return_attribute1);
2968: IBE_Util.Debug('Save:line_tbl.ret atr2: ' || l_order_line_tbl(i).return_attribute2);
2969: IBE_Util.Debug('Save:line_tbl.rcode: ' || l_order_line_tbl(i).return_reason_code);
2962: IBE_Util.Debug('Save:line_tbl.qty: ' || l_order_line_tbl(i).ORDERED_QUANTITY);
2963: IBE_Util.Debug('Save:line_tbl.inv to org id: ' || l_order_line_tbl(i).INVOICE_TO_ORG_ID);
2964: IBE_Util.Debug('Save:line_tbl.ship to org id: ' || l_order_line_tbl(i).SHIP_TO_ORG_ID);
2965: IBE_Util.Debug('Save:line_tbl.return_context: ' || l_order_line_tbl(i).RETURN_CONTEXT);
2966: IBE_Util.Debug('Save:line_tbl.line categ: ' || l_order_line_tbl(i).LINE_CATEGORY_CODE);
2967: IBE_Util.Debug('Save:line_tbl.ret atr1: ' || l_order_line_tbl(i).return_attribute1);
2968: IBE_Util.Debug('Save:line_tbl.ret atr2: ' || l_order_line_tbl(i).return_attribute2);
2969: IBE_Util.Debug('Save:line_tbl.rcode: ' || l_order_line_tbl(i).return_reason_code);
2970: END LOOP;
2963: IBE_Util.Debug('Save:line_tbl.inv to org id: ' || l_order_line_tbl(i).INVOICE_TO_ORG_ID);
2964: IBE_Util.Debug('Save:line_tbl.ship to org id: ' || l_order_line_tbl(i).SHIP_TO_ORG_ID);
2965: IBE_Util.Debug('Save:line_tbl.return_context: ' || l_order_line_tbl(i).RETURN_CONTEXT);
2966: IBE_Util.Debug('Save:line_tbl.line categ: ' || l_order_line_tbl(i).LINE_CATEGORY_CODE);
2967: IBE_Util.Debug('Save:line_tbl.ret atr1: ' || l_order_line_tbl(i).return_attribute1);
2968: IBE_Util.Debug('Save:line_tbl.ret atr2: ' || l_order_line_tbl(i).return_attribute2);
2969: IBE_Util.Debug('Save:line_tbl.rcode: ' || l_order_line_tbl(i).return_reason_code);
2970: END LOOP;
2971: END IF;
2964: IBE_Util.Debug('Save:line_tbl.ship to org id: ' || l_order_line_tbl(i).SHIP_TO_ORG_ID);
2965: IBE_Util.Debug('Save:line_tbl.return_context: ' || l_order_line_tbl(i).RETURN_CONTEXT);
2966: IBE_Util.Debug('Save:line_tbl.line categ: ' || l_order_line_tbl(i).LINE_CATEGORY_CODE);
2967: IBE_Util.Debug('Save:line_tbl.ret atr1: ' || l_order_line_tbl(i).return_attribute1);
2968: IBE_Util.Debug('Save:line_tbl.ret atr2: ' || l_order_line_tbl(i).return_attribute2);
2969: IBE_Util.Debug('Save:line_tbl.rcode: ' || l_order_line_tbl(i).return_reason_code);
2970: END LOOP;
2971: END IF;
2972:
2965: IBE_Util.Debug('Save:line_tbl.return_context: ' || l_order_line_tbl(i).RETURN_CONTEXT);
2966: IBE_Util.Debug('Save:line_tbl.line categ: ' || l_order_line_tbl(i).LINE_CATEGORY_CODE);
2967: IBE_Util.Debug('Save:line_tbl.ret atr1: ' || l_order_line_tbl(i).return_attribute1);
2968: IBE_Util.Debug('Save:line_tbl.ret atr2: ' || l_order_line_tbl(i).return_attribute2);
2969: IBE_Util.Debug('Save:line_tbl.rcode: ' || l_order_line_tbl(i).return_reason_code);
2970: END LOOP;
2971: END IF;
2972:
2973:
2972:
2973:
2974: /************ Hard Delete logic for Pending Return ****/
2975:
2976: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2977: IBE_Util.Debug('ibe_order_save_pvt:cancel_flag ' ||p_submit_control_rec.cancel_flag);
2978: END IF;
2979:
2980: if (p_submit_control_rec.cancel_flag = 'Y') then
2973:
2974: /************ Hard Delete logic for Pending Return ****/
2975:
2976: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
2977: IBE_Util.Debug('ibe_order_save_pvt:cancel_flag ' ||p_submit_control_rec.cancel_flag);
2978: END IF;
2979:
2980: if (p_submit_control_rec.cancel_flag = 'Y') then
2981: CancelOrder(l_order_header_rec,lx_order_header_rec);
2979:
2980: if (p_submit_control_rec.cancel_flag = 'Y') then
2981: CancelOrder(l_order_header_rec,lx_order_header_rec);
2982: l_order_header_rec := lx_order_header_rec;
2983: IF (IBE_UTIL.G_DEBUGON = l_true) then
2984: ibe_util.debug('after cancelorder header_id:' ||l_order_header_rec.header_id);
2985: ibe_util.debug('after cancelorder operation:' ||l_order_header_rec.operation);
2986: end if;
2987:
2980: if (p_submit_control_rec.cancel_flag = 'Y') then
2981: CancelOrder(l_order_header_rec,lx_order_header_rec);
2982: l_order_header_rec := lx_order_header_rec;
2983: IF (IBE_UTIL.G_DEBUGON = l_true) then
2984: ibe_util.debug('after cancelorder header_id:' ||l_order_header_rec.header_id);
2985: ibe_util.debug('after cancelorder operation:' ||l_order_header_rec.operation);
2986: end if;
2987:
2988: IF(l_order_header_rec.operation = OE_Globals.G_OPR_DELETE) THEN
2981: CancelOrder(l_order_header_rec,lx_order_header_rec);
2982: l_order_header_rec := lx_order_header_rec;
2983: IF (IBE_UTIL.G_DEBUGON = l_true) then
2984: ibe_util.debug('after cancelorder header_id:' ||l_order_header_rec.header_id);
2985: ibe_util.debug('after cancelorder operation:' ||l_order_header_rec.operation);
2986: end if;
2987:
2988: IF(l_order_header_rec.operation = OE_Globals.G_OPR_DELETE) THEN
2989: l_cancel_flow := FND_API.G_TRUE;
3014: loop
3015: l_order_line_tbl(i) := lx_line_tbl(i);
3016: end loop;
3017:
3018: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3019: IBE_Util.Debug('LineTbl cnt returned from SAveMDL API:'||l_order_line_tbl.count);
3020: END IF;
3021: END IF; -- order_category_code = 'RETURN' check
3022: END IF; -- main if for savemdlrel... call
3015: l_order_line_tbl(i) := lx_line_tbl(i);
3016: end loop;
3017:
3018: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3019: IBE_Util.Debug('LineTbl cnt returned from SAveMDL API:'||l_order_line_tbl.count);
3020: END IF;
3021: END IF; -- order_category_code = 'RETURN' check
3022: END IF; -- main if for savemdlrel... call
3023:
3026:
3027: IF (l_order_header_rec.order_category_code = 'RETURN'
3028: AND p_save_type = SAVE_REMOVEITEMS) THEN
3029:
3030: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3031: IBE_Util.debug('Inside Last Item Removal-Hard Delete If Loop');
3032: end if;
3033:
3034: for lineIdx in 1..l_order_line_tbl.count
3027: IF (l_order_header_rec.order_category_code = 'RETURN'
3028: AND p_save_type = SAVE_REMOVEITEMS) THEN
3029:
3030: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3031: IBE_Util.debug('Inside Last Item Removal-Hard Delete If Loop');
3032: end if;
3033:
3034: for lineIdx in 1..l_order_line_tbl.count
3035: loop
3043: l_dl_tmp_qry := 'SELECT count(*) from oe_order_lines_all '||
3044: 'WHERE header_id= :dl_header_id '||
3045: 'AND line_id NOT IN('||l_dl_line_id_qry||')';
3046:
3047: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3048: IBE_Util.debug('qry for finding if last item is removed: '|| l_dl_tmp_qry);
3049: end if;
3050:
3051: open l_dl_tmp for l_dl_tmp_qry using p_order_header_rec.header_id,l_parseKey;
3044: 'WHERE header_id= :dl_header_id '||
3045: 'AND line_id NOT IN('||l_dl_line_id_qry||')';
3046:
3047: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3048: IBE_Util.debug('qry for finding if last item is removed: '|| l_dl_tmp_qry);
3049: end if;
3050:
3051: open l_dl_tmp for l_dl_tmp_qry using p_order_header_rec.header_id,l_parseKey;
3052: fetch l_dl_tmp into No_Of_ExistingLines;
3051: open l_dl_tmp for l_dl_tmp_qry using p_order_header_rec.header_id,l_parseKey;
3052: fetch l_dl_tmp into No_Of_ExistingLines;
3053: close l_dl_tmp;
3054:
3055: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3056: IBE_Util.debug('No. Of lines Existing in the ReturnOrder: '|| l_dl_tmp_qry);
3057: end if;
3058:
3059: IF (No_Of_ExistingLines = 0) THEN -- No More Lines in The Return Order so can be hard deleted.
3052: fetch l_dl_tmp into No_Of_ExistingLines;
3053: close l_dl_tmp;
3054:
3055: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3056: IBE_Util.debug('No. Of lines Existing in the ReturnOrder: '|| l_dl_tmp_qry);
3057: end if;
3058:
3059: IF (No_Of_ExistingLines = 0) THEN -- No More Lines in The Return Order so can be hard deleted.
3060: CancelOrder(l_order_header_rec,lx_order_header_rec);
3058:
3059: IF (No_Of_ExistingLines = 0) THEN -- No More Lines in The Return Order so can be hard deleted.
3060: CancelOrder(l_order_header_rec,lx_order_header_rec);
3061: l_order_header_rec := lx_order_header_rec;
3062: IF (IBE_UTIL.G_DEBUGON = l_true) then
3063: ibe_util.debug('after Remove-Cancelorder header_id:' ||l_order_header_rec.header_id);
3064: ibe_util.debug('after Remove-cancelorder operation:' ||l_order_header_rec.operation);
3065: end if;
3066:
3059: IF (No_Of_ExistingLines = 0) THEN -- No More Lines in The Return Order so can be hard deleted.
3060: CancelOrder(l_order_header_rec,lx_order_header_rec);
3061: l_order_header_rec := lx_order_header_rec;
3062: IF (IBE_UTIL.G_DEBUGON = l_true) then
3063: ibe_util.debug('after Remove-Cancelorder header_id:' ||l_order_header_rec.header_id);
3064: ibe_util.debug('after Remove-cancelorder operation:' ||l_order_header_rec.operation);
3065: end if;
3066:
3067: IF(l_order_header_rec.operation = OE_Globals.G_OPR_DELETE) THEN
3060: CancelOrder(l_order_header_rec,lx_order_header_rec);
3061: l_order_header_rec := lx_order_header_rec;
3062: IF (IBE_UTIL.G_DEBUGON = l_true) then
3063: ibe_util.debug('after Remove-Cancelorder header_id:' ||l_order_header_rec.header_id);
3064: ibe_util.debug('after Remove-cancelorder operation:' ||l_order_header_rec.operation);
3065: end if;
3066:
3067: IF(l_order_header_rec.operation = OE_Globals.G_OPR_DELETE) THEN
3068: l_cancel_flow := FND_API.G_TRUE;
3075:
3076:
3077: /****************** ORDER Booking FLOW ******************/
3078:
3079: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3080: IBE_Util.Debug('Save:submit-control_rec.submit_flag ' || p_submit_control_rec.submit_flag);
3081: END IF;
3082:
3083: IF p_submit_control_rec.submit_flag = 'Y' THEN
3076:
3077: /****************** ORDER Booking FLOW ******************/
3078:
3079: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3080: IBE_Util.Debug('Save:submit-control_rec.submit_flag ' || p_submit_control_rec.submit_flag);
3081: END IF;
3082:
3083: IF p_submit_control_rec.submit_flag = 'Y' THEN
3084:
3085: -- If it is 'post 11590' OE flow and if it is a Return:
3086: -- New, Submit_Order() API should be called for booking it.
3087: -- SO validate the qty, before calling submit_order().
3088:
3089: IF (IBE_UTIL.G_DEBUGON = l_true) then
3090: IBE_UTIL.DEBUG('order_category_code: ' ||l_order_header_rec.order_category_code );
3091: IBE_UTIL.DEBUG('OE-Get_Code_Release_Level ' || OE_CODE_CONTROL.Get_Code_Release_Level);
3092: end if;
3093:
3086: -- New, Submit_Order() API should be called for booking it.
3087: -- SO validate the qty, before calling submit_order().
3088:
3089: IF (IBE_UTIL.G_DEBUGON = l_true) then
3090: IBE_UTIL.DEBUG('order_category_code: ' ||l_order_header_rec.order_category_code );
3091: IBE_UTIL.DEBUG('OE-Get_Code_Release_Level ' || OE_CODE_CONTROL.Get_Code_Release_Level);
3092: end if;
3093:
3094: -- As per Bug# 3522453, a new profile is introduced to drive pre-booking approval
3087: -- SO validate the qty, before calling submit_order().
3088:
3089: IF (IBE_UTIL.G_DEBUGON = l_true) then
3090: IBE_UTIL.DEBUG('order_category_code: ' ||l_order_header_rec.order_category_code );
3091: IBE_UTIL.DEBUG('OE-Get_Code_Release_Level ' || OE_CODE_CONTROL.Get_Code_Release_Level);
3092: end if;
3093:
3094: -- As per Bug# 3522453, a new profile is introduced to drive pre-booking approval
3095: -- flows. So check for flow_status_code if it is "WORKING", then go with
3100: Get_Order_Status(p_header_id => l_order_header_rec.header_id
3101: ,x_order_status => l_flow_status_code
3102: ,x_last_update_date => l_last_update_date);
3103:
3104: IF (IBE_UTIL.G_DEBUGON = l_true) then
3105: IBE_UTIL.DEBUG('SAVE - Pending Return flow_status_code: ' ||l_flow_status_code);
3106: end if;
3107:
3108: IF (l_order_header_rec.order_category_code = 'RETURN' AND
3101: ,x_order_status => l_flow_status_code
3102: ,x_last_update_date => l_last_update_date);
3103:
3104: IF (IBE_UTIL.G_DEBUGON = l_true) then
3105: IBE_UTIL.DEBUG('SAVE - Pending Return flow_status_code: ' ||l_flow_status_code);
3106: end if;
3107:
3108: IF (l_order_header_rec.order_category_code = 'RETURN' AND
3109: l_flow_status_code = 'WORKING') THEN
3107:
3108: IF (l_order_header_rec.order_category_code = 'RETURN' AND
3109: l_flow_status_code = 'WORKING') THEN
3110:
3111: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3112: IBE_Util.Debug('Before Complete Validate API');
3113: END IF;
3114:
3115: Complete_RetOrder_Validate(
3108: IF (l_order_header_rec.order_category_code = 'RETURN' AND
3109: l_flow_status_code = 'WORKING') THEN
3110:
3111: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3112: IBE_Util.Debug('Before Complete Validate API');
3113: END IF;
3114:
3115: Complete_RetOrder_Validate(
3116: P_order_header_id => l_order_header_rec.header_id
3120: ,x_msg_count => x_msg_count
3121: ,x_msg_data => x_msg_data
3122: );
3123:
3124: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3125: IBE_Util.Debug('After Complete Validate API: '|| x_return_status);
3126: END IF;
3127:
3128: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
3121: ,x_msg_data => x_msg_data
3122: );
3123:
3124: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3125: IBE_Util.Debug('After Complete Validate API: '|| x_return_status);
3126: END IF;
3127:
3128: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
3129: raise FND_API.G_EXC_ERROR;
3156:
3157: -- bug# 3069333
3158: OE_STANDARD_WF.SAVE_MESSAGES_OFF;
3159:
3160: IF (IBE_UTIL.G_DEBUGON = l_true) then
3161: IBE_UTIL.DEBUG('l_ProcessOrder_Flow: ' || l_ProcessOrder_Flow );
3162: end if;
3163:
3164: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3157: -- bug# 3069333
3158: OE_STANDARD_WF.SAVE_MESSAGES_OFF;
3159:
3160: IF (IBE_UTIL.G_DEBUGON = l_true) then
3161: IBE_UTIL.DEBUG('l_ProcessOrder_Flow: ' || l_ProcessOrder_Flow );
3162: end if;
3163:
3164: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3165: IBE_Util.Debug('Save Before Process Order:order_hdr_rec.ship_to_org_id: ' || l_order_header_rec.SHIP_TO_ORG_ID);
3160: IF (IBE_UTIL.G_DEBUGON = l_true) then
3161: IBE_UTIL.DEBUG('l_ProcessOrder_Flow: ' || l_ProcessOrder_Flow );
3162: end if;
3163:
3164: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3165: IBE_Util.Debug('Save Before Process Order:order_hdr_rec.ship_to_org_id: ' || l_order_header_rec.SHIP_TO_ORG_ID);
3166: IBE_Util.Debug('Save Bef Process Ord:order_hdr_rec.Invoice_to_org_id: ' || l_order_header_rec.INVOICE_TO_ORG_ID);
3167: IBE_Util.Debug('Save Bef Process Ord:order_hdr_rec.header_id: ' || l_order_header_rec.HEADER_ID);
3168: END IF;
3161: IBE_UTIL.DEBUG('l_ProcessOrder_Flow: ' || l_ProcessOrder_Flow );
3162: end if;
3163:
3164: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3165: IBE_Util.Debug('Save Before Process Order:order_hdr_rec.ship_to_org_id: ' || l_order_header_rec.SHIP_TO_ORG_ID);
3166: IBE_Util.Debug('Save Bef Process Ord:order_hdr_rec.Invoice_to_org_id: ' || l_order_header_rec.INVOICE_TO_ORG_ID);
3167: IBE_Util.Debug('Save Bef Process Ord:order_hdr_rec.header_id: ' || l_order_header_rec.HEADER_ID);
3168: END IF;
3169:
3162: end if;
3163:
3164: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3165: IBE_Util.Debug('Save Before Process Order:order_hdr_rec.ship_to_org_id: ' || l_order_header_rec.SHIP_TO_ORG_ID);
3166: IBE_Util.Debug('Save Bef Process Ord:order_hdr_rec.Invoice_to_org_id: ' || l_order_header_rec.INVOICE_TO_ORG_ID);
3167: IBE_Util.Debug('Save Bef Process Ord:order_hdr_rec.header_id: ' || l_order_header_rec.HEADER_ID);
3168: END IF;
3169:
3170: IF(FND_API.to_Boolean(l_ProcessOrder_Flow)) THEN
3163:
3164: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3165: IBE_Util.Debug('Save Before Process Order:order_hdr_rec.ship_to_org_id: ' || l_order_header_rec.SHIP_TO_ORG_ID);
3166: IBE_Util.Debug('Save Bef Process Ord:order_hdr_rec.Invoice_to_org_id: ' || l_order_header_rec.INVOICE_TO_ORG_ID);
3167: IBE_Util.Debug('Save Bef Process Ord:order_hdr_rec.header_id: ' || l_order_header_rec.HEADER_ID);
3168: END IF;
3169:
3170: IF(FND_API.to_Boolean(l_ProcessOrder_Flow)) THEN
3171:
3170: IF(FND_API.to_Boolean(l_ProcessOrder_Flow)) THEN
3171:
3172: /*************--call process order;--*****************/
3173:
3174: IF (IBE_UTIL.G_DEBUGON = l_true) then
3175: IBE_UTIL.DEBUG('Save - Before Calling Process_Order()');
3176: end if;
3177:
3178: OE_Order_GRP.Process_Order
3171:
3172: /*************--call process order;--*****************/
3173:
3174: IF (IBE_UTIL.G_DEBUGON = l_true) then
3175: IBE_UTIL.DEBUG('Save - Before Calling Process_Order()');
3176: end if;
3177:
3178: OE_Order_GRP.Process_Order
3179: ( p_api_version_number => 1.0
3220: , x_Lot_Serial_val_tbl => l_lot_serial_val_tbl
3221: , x_action_request_tbl => l_action_request_tbl
3222: );
3223:
3224: IF (IBE_UTIL.G_DEBUGON = l_true) then
3225: IBE_UTIL.DEBUG('Save After Calling Process_Order() : ' || x_return_status);
3226: IBE_UTIL.DEBUG('header id from OE Save: ' || lx_order_header_rec.header_id);
3227: end if;
3228:
3221: , x_action_request_tbl => l_action_request_tbl
3222: );
3223:
3224: IF (IBE_UTIL.G_DEBUGON = l_true) then
3225: IBE_UTIL.DEBUG('Save After Calling Process_Order() : ' || x_return_status);
3226: IBE_UTIL.DEBUG('header id from OE Save: ' || lx_order_header_rec.header_id);
3227: end if;
3228:
3229: for j in 1 .. x_msg_count
3222: );
3223:
3224: IF (IBE_UTIL.G_DEBUGON = l_true) then
3225: IBE_UTIL.DEBUG('Save After Calling Process_Order() : ' || x_return_status);
3226: IBE_UTIL.DEBUG('header id from OE Save: ' || lx_order_header_rec.header_id);
3227: end if;
3228:
3229: for j in 1 .. x_msg_count
3230: loop
3228:
3229: for j in 1 .. x_msg_count
3230: loop
3231: x_msg_data:= OE_MSG_PUB.get(fnd_msg_pub.g_next,FND_API.G_FALSE);
3232: IF (IBE_UTIL.G_DEBUGON = l_true) then
3233: IBE_UTIL.DEBUG('Message from OE Save: ' || x_msg_data );
3234: end if;
3235: end loop;
3236:
3229: for j in 1 .. x_msg_count
3230: loop
3231: x_msg_data:= OE_MSG_PUB.get(fnd_msg_pub.g_next,FND_API.G_FALSE);
3232: IF (IBE_UTIL.G_DEBUGON = l_true) then
3233: IBE_UTIL.DEBUG('Message from OE Save: ' || x_msg_data );
3234: end if;
3235: end loop;
3236:
3237: -- This check is for catching Booking Related Exceptions Only.
3245: AND p_submit_control_rec.submit_flag = 'Y'
3246: AND (l_action_request_tbl.EXISTS(1) AND
3247: l_action_request_tbl(1).return_status <> FND_API.G_RET_STS_SUCCESS))
3248: THEN
3249: IF (IBE_UTIL.G_DEBUGON = l_true) then
3250: IBE_UTIL.DEBUG('Error in ProcessOrder Booking Flow' );
3251: end if;
3252: retrieve_oe_messages;
3253: x_return_status := FND_API.G_RET_STS_ERROR;
3246: AND (l_action_request_tbl.EXISTS(1) AND
3247: l_action_request_tbl(1).return_status <> FND_API.G_RET_STS_SUCCESS))
3248: THEN
3249: IF (IBE_UTIL.G_DEBUGON = l_true) then
3250: IBE_UTIL.DEBUG('Error in ProcessOrder Booking Flow' );
3251: end if;
3252: retrieve_oe_messages;
3253: x_return_status := FND_API.G_RET_STS_ERROR;
3254: RAISE FND_API.G_EXC_ERROR;
3255: END IF;
3256:
3257: -- This check is for catching all generic Exceptions.
3258: IF x_return_status <> FND_API.G_RET_STS_SUCCESS then
3259: IF (IBE_UTIL.G_DEBUGON = l_true) then
3260: IBE_UTIL.DEBUG('Error in Procees Order Flow: '||x_return_status );
3261: end if;
3262: retrieve_oe_messages;
3263: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
3256:
3257: -- This check is for catching all generic Exceptions.
3258: IF x_return_status <> FND_API.G_RET_STS_SUCCESS then
3259: IF (IBE_UTIL.G_DEBUGON = l_true) then
3260: IBE_UTIL.DEBUG('Error in Procees Order Flow: '||x_return_status );
3261: end if;
3262: retrieve_oe_messages;
3263: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
3264: raise FND_API.G_EXC_ERROR;
3277: IF((p_submit_control_rec.submit_flag = 'Y')
3278: AND(l_order_header_rec.order_category_code = 'RETURN' AND
3279: l_flow_status_code = 'WORKING'))THEN
3280:
3281: IF (IBE_UTIL.G_DEBUGON = l_true) then
3282: IBE_UTIL.DEBUG('Before Calling OE_RMA_GRP.Submit_Order');
3283: end if;
3284:
3285: OE_RMA_GRP.Submit_Order( p_api_version => 1.0
3278: AND(l_order_header_rec.order_category_code = 'RETURN' AND
3279: l_flow_status_code = 'WORKING'))THEN
3280:
3281: IF (IBE_UTIL.G_DEBUGON = l_true) then
3282: IBE_UTIL.DEBUG('Before Calling OE_RMA_GRP.Submit_Order');
3283: end if;
3284:
3285: OE_RMA_GRP.Submit_Order( p_api_version => 1.0
3286: , p_header_id => l_order_header_rec.header_id
3287: , x_return_status => x_return_status
3288: , x_msg_count => x_msg_count
3289: , x_msg_data => x_msg_data);
3290:
3291: IF (IBE_UTIL.G_DEBUGON = l_true) then
3292: IBE_UTIL.DEBUG('After Calling Submit_Order - return_stats: '||x_return_status);
3293: IBE_UTIL.DEBUG('x_msg_count: '||x_msg_count);
3294: end if;
3295:
3288: , x_msg_count => x_msg_count
3289: , x_msg_data => x_msg_data);
3290:
3291: IF (IBE_UTIL.G_DEBUGON = l_true) then
3292: IBE_UTIL.DEBUG('After Calling Submit_Order - return_stats: '||x_return_status);
3293: IBE_UTIL.DEBUG('x_msg_count: '||x_msg_count);
3294: end if;
3295:
3296: --for logging appropriate error message
3289: , x_msg_data => x_msg_data);
3290:
3291: IF (IBE_UTIL.G_DEBUGON = l_true) then
3292: IBE_UTIL.DEBUG('After Calling Submit_Order - return_stats: '||x_return_status);
3293: IBE_UTIL.DEBUG('x_msg_count: '||x_msg_count);
3294: end if;
3295:
3296: --for logging appropriate error message
3297: if(x_msg_count is not null AND x_msg_count > 0) then
3297: if(x_msg_count is not null AND x_msg_count > 0) then
3298: for j in 1 .. x_msg_count
3299: loop
3300: x_msg_data:= OE_MSG_PUB.get(fnd_msg_pub.g_next,FND_API.G_FALSE);
3301: IF (IBE_UTIL.G_DEBUGON = l_true) then
3302: IBE_UTIL.DEBUG('Message from OE Save: ' || x_msg_data );
3303: end if;
3304: end loop;
3305: end if;
3298: for j in 1 .. x_msg_count
3299: loop
3300: x_msg_data:= OE_MSG_PUB.get(fnd_msg_pub.g_next,FND_API.G_FALSE);
3301: IF (IBE_UTIL.G_DEBUGON = l_true) then
3302: IBE_UTIL.DEBUG('Message from OE Save: ' || x_msg_data );
3303: end if;
3304: end loop;
3305: end if;
3306:
3322: from oe_order_headers_all where header_id=sh_hdr_id;
3323: Begin
3324: open c_submit_hdrattr(x_order_header_id);
3325: fetch c_submit_hdrattr into x_order_number,x_last_update_date,x_flow_status_code;
3326: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3327: IBE_UTIL.DEBUG('order number after submit: ' || x_order_number );
3328: END IF;
3329: close c_submit_hdrattr;
3330: End;
3323: Begin
3324: open c_submit_hdrattr(x_order_header_id);
3325: fetch c_submit_hdrattr into x_order_number,x_last_update_date,x_flow_status_code;
3326: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3327: IBE_UTIL.DEBUG('order number after submit: ' || x_order_number );
3328: END IF;
3329: close c_submit_hdrattr;
3330: End;
3331:
3330: End;
3331:
3332: END If;
3333:
3334: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3335: IBE_UTIL.DEBUG('header id returned from OE: ' || x_order_header_id );
3336: IBE_UTIL.DEBUG('x_flow_status_code: ' || x_flow_status_code );
3337: IBE_UTIL.DEBUG('calling ibe_active_quotes_all package handler: ' || l_cancel_flow);
3338: END IF;
3331:
3332: END If;
3333:
3334: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3335: IBE_UTIL.DEBUG('header id returned from OE: ' || x_order_header_id );
3336: IBE_UTIL.DEBUG('x_flow_status_code: ' || x_flow_status_code );
3337: IBE_UTIL.DEBUG('calling ibe_active_quotes_all package handler: ' || l_cancel_flow);
3338: END IF;
3339:
3332: END If;
3333:
3334: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3335: IBE_UTIL.DEBUG('header id returned from OE: ' || x_order_header_id );
3336: IBE_UTIL.DEBUG('x_flow_status_code: ' || x_flow_status_code );
3337: IBE_UTIL.DEBUG('calling ibe_active_quotes_all package handler: ' || l_cancel_flow);
3338: END IF;
3339:
3340: IF (FND_API.to_Boolean(l_cancel_flow)
3333:
3334: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3335: IBE_UTIL.DEBUG('header id returned from OE: ' || x_order_header_id );
3336: IBE_UTIL.DEBUG('x_flow_status_code: ' || x_flow_status_code );
3337: IBE_UTIL.DEBUG('calling ibe_active_quotes_all package handler: ' || l_cancel_flow);
3338: END IF;
3339:
3340: IF (FND_API.to_Boolean(l_cancel_flow)
3341: OR ((p_save_type = SAVE_NORMAL AND p_submit_control_rec.submit_flag = 'Y')
3347: ActivateOrder(x_order_header_id,p_party_id,l_order_header_rec.sold_to_org_id,
3348: l_order_header_rec.transactional_curr_code);
3349: END IF;
3350:
3351: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3352: IBE_UTIL.DEBUG('back from ibe_active_quotes_all package handler');
3353: END IF;
3354:
3355: -- Calling Notification to the user After successfully booking the order.
3348: l_order_header_rec.transactional_curr_code);
3349: END IF;
3350:
3351: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3352: IBE_UTIL.DEBUG('back from ibe_active_quotes_all package handler');
3353: END IF;
3354:
3355: -- Calling Notification to the user After successfully booking the order.
3356: -- This would send a notification to the user about the conformation of the Return.
3356: -- This would send a notification to the user about the conformation of the Return.
3357:
3358: IF (p_save_type = SAVE_NORMAL AND p_submit_control_rec.submit_flag = 'Y') THEN
3359:
3360: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3361: IBE_UTIL.debug('IBE_ORDER_SAVE_PVT: Before calling Notification API');
3362: END IF;
3363:
3364: IBE_WORKFLOW_PVT.NotifyReturnOrderStatus(
3357:
3358: IF (p_save_type = SAVE_NORMAL AND p_submit_control_rec.submit_flag = 'Y') THEN
3359:
3360: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3361: IBE_UTIL.debug('IBE_ORDER_SAVE_PVT: Before calling Notification API');
3362: END IF;
3363:
3364: IBE_WORKFLOW_PVT.NotifyReturnOrderStatus(
3365: p_api_version => 1,
3370: x_return_status => x_return_status,
3371: x_msg_count => x_msg_count,
3372: x_msg_data => x_msg_data
3373: );
3374: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3375: IBE_UTIL.debug('IBE_ORDER_SAVE_PVT: Notification API is called');
3376: END IF;
3377:
3378: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
3371: x_msg_count => x_msg_count,
3372: x_msg_data => x_msg_data
3373: );
3374: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3375: IBE_UTIL.debug('IBE_ORDER_SAVE_PVT: Notification API is called');
3376: END IF;
3377:
3378: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
3379: RAISE FND_API.G_EXC_ERROR;
3395: THEN
3396: COMMIT WORK;
3397: END IF;
3398:
3399: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3400: IBE_Util.Debug('End OE_ORDER_SAVE_PVT:Save)');
3401: END IF;
3402:
3403: -- Standard call to get message count and if count is 1, get message info.
3396: COMMIT WORK;
3397: END IF;
3398:
3399: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3400: IBE_Util.Debug('End OE_ORDER_SAVE_PVT:Save)');
3401: END IF;
3402:
3403: -- Standard call to get message count and if count is 1, get message info.
3404:
3411: x_return_status := FND_API.G_RET_STS_ERROR;
3412: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
3413: p_count => x_msg_count ,
3414: p_data => x_msg_data);
3415: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3416: IBE_Util.Debug('Error IBE_ORDER_SAVE_PVT:Save()'|| sqlerrm);
3417: END IF;
3418:
3419: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3412: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
3413: p_count => x_msg_count ,
3414: p_data => x_msg_data);
3415: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3416: IBE_Util.Debug('Error IBE_ORDER_SAVE_PVT:Save()'|| sqlerrm);
3417: END IF;
3418:
3419: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3420: ROLLBACK TO SAVE_ORDER_SAVE_PVT;
3421: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3422: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
3423: p_count => x_msg_count ,
3424: p_data => x_msg_data);
3425: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3426: IBE_Util.Debug('UNEXPECTEDError IBE_ORDER_SAVE_PVT:Save()' || sqlerrm);
3427: END IF;
3428: WHEN OTHERS THEN
3429: ROLLBACK TO SAVE_ORDER_SAVE_PVT;
3422: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
3423: p_count => x_msg_count ,
3424: p_data => x_msg_data);
3425: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3426: IBE_Util.Debug('UNEXPECTEDError IBE_ORDER_SAVE_PVT:Save()' || sqlerrm);
3427: END IF;
3428: WHEN OTHERS THEN
3429: ROLLBACK TO SAVE_ORDER_SAVE_PVT;
3430: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3436:
3437: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
3438: p_count => x_msg_count ,
3439: p_data => x_msg_data);
3440: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3441: IBE_Util.Debug('Other IBE_ORDER_SAVE_PVT:Save()' || sqlerrm);
3442: END IF;
3443:
3444:
3437: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
3438: p_count => x_msg_count ,
3439: p_data => x_msg_data);
3440: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3441: IBE_Util.Debug('Other IBE_ORDER_SAVE_PVT:Save()' || sqlerrm);
3442: END IF;
3443:
3444:
3445: END Save;
3538: BEGIN
3539:
3540: x_error_lineids := JTF_VARCHAR2_TABLE_300();
3541:
3542: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3543: IBE_Util.Debug('Begin IBE_ORDER_SAVE_PVT:CheckConstraints()');
3544: END IF;
3545:
3546: -- Standard Start of API savepoint
3539:
3540: x_error_lineids := JTF_VARCHAR2_TABLE_300();
3541:
3542: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3543: IBE_Util.Debug('Begin IBE_ORDER_SAVE_PVT:CheckConstraints()');
3544: END IF;
3545:
3546: -- Standard Start of API savepoint
3547: SAVEPOINT ORDER_CHKCONSTRAINT;
3564: x_return_status := FND_API.G_RET_STS_SUCCESS;
3565:
3566:
3567: -- Start OF API body --
3568: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3569: IBE_Util.Debug('In chkconstraint()');
3570: END IF;
3571:
3572: -- SET HEADER RECORD
3565:
3566:
3567: -- Start OF API body --
3568: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3569: IBE_Util.Debug('In chkconstraint()');
3570: END IF;
3571:
3572: -- SET HEADER RECORD
3573: l_order_header_rec := p_order_header_rec;
3585: END IF;
3586:
3587: -- Get the User's Session ORG_ID
3588: l_user_orgid := mo_global.GET_CURRENT_ORG_ID();
3589: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3590: Ibe_util.Debug('Current Org id : ' ||l_user_orgid);
3591: END IF;
3592:
3593: -- Get the Sales Rep Number from the ASO Utility package
3586:
3587: -- Get the User's Session ORG_ID
3588: l_user_orgid := mo_global.GET_CURRENT_ORG_ID();
3589: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3590: Ibe_util.Debug('Current Org id : ' ||l_user_orgid);
3591: END IF;
3592:
3593: -- Get the Sales Rep Number from the ASO Utility package
3594: l_salesrep_number := ASO_UTILITY_PVT.GET_OU_ATTRIBUTE_VALUE(aso_utility_pvt.GET_DEFAULT_SALESREP,l_user_orgid);
3591: END IF;
3592:
3593: -- Get the Sales Rep Number from the ASO Utility package
3594: l_salesrep_number := ASO_UTILITY_PVT.GET_OU_ATTRIBUTE_VALUE(aso_utility_pvt.GET_DEFAULT_SALESREP,l_user_orgid);
3595: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3596: Ibe_util.Debug('Sales Rep Number for Current Org : ' ||l_salesrep_number);
3597: END IF;
3598:
3599: -- Bug 5359687, Proper error message when default salesrep is not set
3592:
3593: -- Get the Sales Rep Number from the ASO Utility package
3594: l_salesrep_number := ASO_UTILITY_PVT.GET_OU_ATTRIBUTE_VALUE(aso_utility_pvt.GET_DEFAULT_SALESREP,l_user_orgid);
3595: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3596: Ibe_util.Debug('Sales Rep Number for Current Org : ' ||l_salesrep_number);
3597: END IF;
3598:
3599: -- Bug 5359687, Proper error message when default salesrep is not set
3600: IF (l_salesrep_number is null) THEN
3605: -- Get the sales rep id from the sales rep number using the JTF table
3606: select SALESREP_ID into l_salesrep_id from JTF_RS_SALESREPS where SALESREP_NUMBER = l_salesrep_number and ORG_ID = l_user_orgid;
3607: END IF;
3608:
3609: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3610: Ibe_util.Debug('Sales Rep Id : ' ||l_salesrep_id);
3611: END IF;
3612:
3613: --l_salesrep_id := FND_PROFILE.VALUE('ASO_DEFAULT_PERSON_ID');
3606: select SALESREP_ID into l_salesrep_id from JTF_RS_SALESREPS where SALESREP_NUMBER = l_salesrep_number and ORG_ID = l_user_orgid;
3607: END IF;
3608:
3609: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3610: Ibe_util.Debug('Sales Rep Id : ' ||l_salesrep_id);
3611: END IF;
3612:
3613: --l_salesrep_id := FND_PROFILE.VALUE('ASO_DEFAULT_PERSON_ID');
3614:
3619: ELSE
3620: l_order_header_rec.salesrep_id := l_salesrep_id;
3621: END IF;
3622:
3623: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3624: IBE_Util.Debug('chkconstraint-l_order_header_rec.header_id:' || l_order_header_rec.header_id);
3625: IBE_Util.Debug('chkconstraint-l_order_header_rec.sold_to_org_id:' || l_order_header_rec.sold_to_org_id);
3626: IBE_Util.Debug('chkconstraint-l_order_header_rec.operation:' || l_order_header_rec.operation);
3627: IBE_Util.Debug('chkconstraint-l_order_header_rec.order_type_id:' || l_order_header_rec.order_type_id);
3620: l_order_header_rec.salesrep_id := l_salesrep_id;
3621: END IF;
3622:
3623: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3624: IBE_Util.Debug('chkconstraint-l_order_header_rec.header_id:' || l_order_header_rec.header_id);
3625: IBE_Util.Debug('chkconstraint-l_order_header_rec.sold_to_org_id:' || l_order_header_rec.sold_to_org_id);
3626: IBE_Util.Debug('chkconstraint-l_order_header_rec.operation:' || l_order_header_rec.operation);
3627: IBE_Util.Debug('chkconstraint-l_order_header_rec.order_type_id:' || l_order_header_rec.order_type_id);
3628: END IF;
3621: END IF;
3622:
3623: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3624: IBE_Util.Debug('chkconstraint-l_order_header_rec.header_id:' || l_order_header_rec.header_id);
3625: IBE_Util.Debug('chkconstraint-l_order_header_rec.sold_to_org_id:' || l_order_header_rec.sold_to_org_id);
3626: IBE_Util.Debug('chkconstraint-l_order_header_rec.operation:' || l_order_header_rec.operation);
3627: IBE_Util.Debug('chkconstraint-l_order_header_rec.order_type_id:' || l_order_header_rec.order_type_id);
3628: END IF;
3629:
3622:
3623: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3624: IBE_Util.Debug('chkconstraint-l_order_header_rec.header_id:' || l_order_header_rec.header_id);
3625: IBE_Util.Debug('chkconstraint-l_order_header_rec.sold_to_org_id:' || l_order_header_rec.sold_to_org_id);
3626: IBE_Util.Debug('chkconstraint-l_order_header_rec.operation:' || l_order_header_rec.operation);
3627: IBE_Util.Debug('chkconstraint-l_order_header_rec.order_type_id:' || l_order_header_rec.order_type_id);
3628: END IF;
3629:
3630:
3623: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3624: IBE_Util.Debug('chkconstraint-l_order_header_rec.header_id:' || l_order_header_rec.header_id);
3625: IBE_Util.Debug('chkconstraint-l_order_header_rec.sold_to_org_id:' || l_order_header_rec.sold_to_org_id);
3626: IBE_Util.Debug('chkconstraint-l_order_header_rec.operation:' || l_order_header_rec.operation);
3627: IBE_Util.Debug('chkconstraint-l_order_header_rec.order_type_id:' || l_order_header_rec.order_type_id);
3628: END IF;
3629:
3630:
3631: -- SET LINE RECORD
3652: l_order_line_tbl(i).ship_to_org_id := l_line_rec.SHIP_TO_ORG_ID;
3653: l_order_line_tbl(i).invoice_to_org_id := l_line_rec.INVOICE_TO_ORG_ID;
3654: end loop;
3655:
3656: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3657: IBE_Util.Debug('chkconstraint-l_order_line_tbl.lineId: ' || l_order_line_tbl(i).line_id);
3658: IBE_Util.Debug('chkconstraint-l_order_line_tbl.linetypeid: ' || l_order_line_tbl(i).line_type_id);
3659: IBE_Util.Debug('chkconstraint-l_order_line_tbl.shiptoOrgid: ' || l_order_line_tbl(i).ship_to_org_id);
3660: IBE_Util.Debug('chkconstraint-l_order_line_tbl.invoicetoOrgid: ' || l_order_line_tbl(i).invoice_to_org_id);
3653: l_order_line_tbl(i).invoice_to_org_id := l_line_rec.INVOICE_TO_ORG_ID;
3654: end loop;
3655:
3656: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3657: IBE_Util.Debug('chkconstraint-l_order_line_tbl.lineId: ' || l_order_line_tbl(i).line_id);
3658: IBE_Util.Debug('chkconstraint-l_order_line_tbl.linetypeid: ' || l_order_line_tbl(i).line_type_id);
3659: IBE_Util.Debug('chkconstraint-l_order_line_tbl.shiptoOrgid: ' || l_order_line_tbl(i).ship_to_org_id);
3660: IBE_Util.Debug('chkconstraint-l_order_line_tbl.invoicetoOrgid: ' || l_order_line_tbl(i).invoice_to_org_id);
3661: END IF;
3654: end loop;
3655:
3656: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3657: IBE_Util.Debug('chkconstraint-l_order_line_tbl.lineId: ' || l_order_line_tbl(i).line_id);
3658: IBE_Util.Debug('chkconstraint-l_order_line_tbl.linetypeid: ' || l_order_line_tbl(i).line_type_id);
3659: IBE_Util.Debug('chkconstraint-l_order_line_tbl.shiptoOrgid: ' || l_order_line_tbl(i).ship_to_org_id);
3660: IBE_Util.Debug('chkconstraint-l_order_line_tbl.invoicetoOrgid: ' || l_order_line_tbl(i).invoice_to_org_id);
3661: END IF;
3662:
3655:
3656: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3657: IBE_Util.Debug('chkconstraint-l_order_line_tbl.lineId: ' || l_order_line_tbl(i).line_id);
3658: IBE_Util.Debug('chkconstraint-l_order_line_tbl.linetypeid: ' || l_order_line_tbl(i).line_type_id);
3659: IBE_Util.Debug('chkconstraint-l_order_line_tbl.shiptoOrgid: ' || l_order_line_tbl(i).ship_to_org_id);
3660: IBE_Util.Debug('chkconstraint-l_order_line_tbl.invoicetoOrgid: ' || l_order_line_tbl(i).invoice_to_org_id);
3661: END IF;
3662:
3663: END LOOP;
3656: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3657: IBE_Util.Debug('chkconstraint-l_order_line_tbl.lineId: ' || l_order_line_tbl(i).line_id);
3658: IBE_Util.Debug('chkconstraint-l_order_line_tbl.linetypeid: ' || l_order_line_tbl(i).line_type_id);
3659: IBE_Util.Debug('chkconstraint-l_order_line_tbl.shiptoOrgid: ' || l_order_line_tbl(i).ship_to_org_id);
3660: IBE_Util.Debug('chkconstraint-l_order_line_tbl.invoicetoOrgid: ' || l_order_line_tbl(i).invoice_to_org_id);
3661: END IF;
3662:
3663: END LOOP;
3664:
3668: l_order_header_rec.ship_to_org_id := l_siteuse_id;
3669: DefaultFromLineSiteId(l_order_line_tbl,p_party_id,'INVOICE_TO',l_siteuse_id);
3670: l_order_header_rec.invoice_to_org_id := l_siteuse_id;
3671:
3672: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3673: IBE_Util.Debug('Chkconsrnt-l_order_header_rec.shiporgid: ' || l_order_header_rec.ship_to_org_id);
3674: IBE_Util.Debug('Chkconsrnt-l_order_header_rec.invoiceorgid: ' || l_order_header_rec.invoice_to_org_id);
3675: END IF;
3676:
3669: DefaultFromLineSiteId(l_order_line_tbl,p_party_id,'INVOICE_TO',l_siteuse_id);
3670: l_order_header_rec.invoice_to_org_id := l_siteuse_id;
3671:
3672: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3673: IBE_Util.Debug('Chkconsrnt-l_order_header_rec.shiporgid: ' || l_order_header_rec.ship_to_org_id);
3674: IBE_Util.Debug('Chkconsrnt-l_order_header_rec.invoiceorgid: ' || l_order_header_rec.invoice_to_org_id);
3675: END IF;
3676:
3677: -- FIRST CALL To Process_Order to create only the Header Record. Bug#2988993
3670: l_order_header_rec.invoice_to_org_id := l_siteuse_id;
3671:
3672: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3673: IBE_Util.Debug('Chkconsrnt-l_order_header_rec.shiporgid: ' || l_order_header_rec.ship_to_org_id);
3674: IBE_Util.Debug('Chkconsrnt-l_order_header_rec.invoiceorgid: ' || l_order_header_rec.invoice_to_org_id);
3675: END IF;
3676:
3677: -- FIRST CALL To Process_Order to create only the Header Record. Bug#2988993
3678: -- This would avoid the NoDataFound thrown from OM as reported in the bug.
3710: , x_Lot_Serial_val_tbl => l_lot_serial_val_tbl
3711: , x_action_request_tbl => l_action_request_tbl
3712: );
3713:
3714: IF (IBE_UTIL.G_DEBUGON = l_true) then
3715: IBE_UTIL.DEBUG('Return Status of First-Call to Process_Order() : ' || x_return_status);
3716: IBE_UTIL.DEBUG('header id from OE: ' || lx_order_header_rec.header_id);
3717: end if;
3718:
3711: , x_action_request_tbl => l_action_request_tbl
3712: );
3713:
3714: IF (IBE_UTIL.G_DEBUGON = l_true) then
3715: IBE_UTIL.DEBUG('Return Status of First-Call to Process_Order() : ' || x_return_status);
3716: IBE_UTIL.DEBUG('header id from OE: ' || lx_order_header_rec.header_id);
3717: end if;
3718:
3719: IF x_return_status <> FND_API.G_RET_STS_SUCCESS then
3712: );
3713:
3714: IF (IBE_UTIL.G_DEBUGON = l_true) then
3715: IBE_UTIL.DEBUG('Return Status of First-Call to Process_Order() : ' || x_return_status);
3716: IBE_UTIL.DEBUG('header id from OE: ' || lx_order_header_rec.header_id);
3717: end if;
3718:
3719: IF x_return_status <> FND_API.G_RET_STS_SUCCESS then
3720: retrieve_oe_messages;
3740:
3741: FOR i in 1..l_order_line_tbl.COUNT
3742: LOOP
3743: l_order_line_tbl(i).header_id := lx_order_header_rec.header_id;
3744: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3745: IBE_Util.Debug('l_order_line_tbl.lineId: ' || l_order_line_tbl(i).line_id);
3746: IBE_Util.Debug('l_order_line_tbl.HEaderId: ' || l_order_line_tbl(i).header_id);
3747: IBE_Util.Debug('l_order_line_tbl.retattr1: ' || l_order_line_tbl(i).return_attribute1);
3748: IBE_Util.Debug('l_order_line_tbl.retattr2: ' || l_order_line_tbl(i).return_attribute2);
3741: FOR i in 1..l_order_line_tbl.COUNT
3742: LOOP
3743: l_order_line_tbl(i).header_id := lx_order_header_rec.header_id;
3744: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3745: IBE_Util.Debug('l_order_line_tbl.lineId: ' || l_order_line_tbl(i).line_id);
3746: IBE_Util.Debug('l_order_line_tbl.HEaderId: ' || l_order_line_tbl(i).header_id);
3747: IBE_Util.Debug('l_order_line_tbl.retattr1: ' || l_order_line_tbl(i).return_attribute1);
3748: IBE_Util.Debug('l_order_line_tbl.retattr2: ' || l_order_line_tbl(i).return_attribute2);
3749: IBE_Util.Debug('l_order_line_tbl.retcontxt: ' || l_order_line_tbl(i).return_context);
3742: LOOP
3743: l_order_line_tbl(i).header_id := lx_order_header_rec.header_id;
3744: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3745: IBE_Util.Debug('l_order_line_tbl.lineId: ' || l_order_line_tbl(i).line_id);
3746: IBE_Util.Debug('l_order_line_tbl.HEaderId: ' || l_order_line_tbl(i).header_id);
3747: IBE_Util.Debug('l_order_line_tbl.retattr1: ' || l_order_line_tbl(i).return_attribute1);
3748: IBE_Util.Debug('l_order_line_tbl.retattr2: ' || l_order_line_tbl(i).return_attribute2);
3749: IBE_Util.Debug('l_order_line_tbl.retcontxt: ' || l_order_line_tbl(i).return_context);
3750: IBE_Util.Debug('l_order_line_tbl.linetypeid: ' || l_order_line_tbl(i).line_type_id);
3743: l_order_line_tbl(i).header_id := lx_order_header_rec.header_id;
3744: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3745: IBE_Util.Debug('l_order_line_tbl.lineId: ' || l_order_line_tbl(i).line_id);
3746: IBE_Util.Debug('l_order_line_tbl.HEaderId: ' || l_order_line_tbl(i).header_id);
3747: IBE_Util.Debug('l_order_line_tbl.retattr1: ' || l_order_line_tbl(i).return_attribute1);
3748: IBE_Util.Debug('l_order_line_tbl.retattr2: ' || l_order_line_tbl(i).return_attribute2);
3749: IBE_Util.Debug('l_order_line_tbl.retcontxt: ' || l_order_line_tbl(i).return_context);
3750: IBE_Util.Debug('l_order_line_tbl.linetypeid: ' || l_order_line_tbl(i).line_type_id);
3751: IBE_Util.Debug('l_order_line_tbl.operation: ' || l_order_line_tbl(i).operation);
3744: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3745: IBE_Util.Debug('l_order_line_tbl.lineId: ' || l_order_line_tbl(i).line_id);
3746: IBE_Util.Debug('l_order_line_tbl.HEaderId: ' || l_order_line_tbl(i).header_id);
3747: IBE_Util.Debug('l_order_line_tbl.retattr1: ' || l_order_line_tbl(i).return_attribute1);
3748: IBE_Util.Debug('l_order_line_tbl.retattr2: ' || l_order_line_tbl(i).return_attribute2);
3749: IBE_Util.Debug('l_order_line_tbl.retcontxt: ' || l_order_line_tbl(i).return_context);
3750: IBE_Util.Debug('l_order_line_tbl.linetypeid: ' || l_order_line_tbl(i).line_type_id);
3751: IBE_Util.Debug('l_order_line_tbl.operation: ' || l_order_line_tbl(i).operation);
3752: IBE_Util.Debug('l_order_line_tbl.shiptoOrgid: ' || l_order_line_tbl(i).ship_to_org_id);
3745: IBE_Util.Debug('l_order_line_tbl.lineId: ' || l_order_line_tbl(i).line_id);
3746: IBE_Util.Debug('l_order_line_tbl.HEaderId: ' || l_order_line_tbl(i).header_id);
3747: IBE_Util.Debug('l_order_line_tbl.retattr1: ' || l_order_line_tbl(i).return_attribute1);
3748: IBE_Util.Debug('l_order_line_tbl.retattr2: ' || l_order_line_tbl(i).return_attribute2);
3749: IBE_Util.Debug('l_order_line_tbl.retcontxt: ' || l_order_line_tbl(i).return_context);
3750: IBE_Util.Debug('l_order_line_tbl.linetypeid: ' || l_order_line_tbl(i).line_type_id);
3751: IBE_Util.Debug('l_order_line_tbl.operation: ' || l_order_line_tbl(i).operation);
3752: IBE_Util.Debug('l_order_line_tbl.shiptoOrgid: ' || l_order_line_tbl(i).ship_to_org_id);
3753: IBE_Util.Debug('l_order_line_tbl.invoicetoOrgid: ' || l_order_line_tbl(i).invoice_to_org_id);
3746: IBE_Util.Debug('l_order_line_tbl.HEaderId: ' || l_order_line_tbl(i).header_id);
3747: IBE_Util.Debug('l_order_line_tbl.retattr1: ' || l_order_line_tbl(i).return_attribute1);
3748: IBE_Util.Debug('l_order_line_tbl.retattr2: ' || l_order_line_tbl(i).return_attribute2);
3749: IBE_Util.Debug('l_order_line_tbl.retcontxt: ' || l_order_line_tbl(i).return_context);
3750: IBE_Util.Debug('l_order_line_tbl.linetypeid: ' || l_order_line_tbl(i).line_type_id);
3751: IBE_Util.Debug('l_order_line_tbl.operation: ' || l_order_line_tbl(i).operation);
3752: IBE_Util.Debug('l_order_line_tbl.shiptoOrgid: ' || l_order_line_tbl(i).ship_to_org_id);
3753: IBE_Util.Debug('l_order_line_tbl.invoicetoOrgid: ' || l_order_line_tbl(i).invoice_to_org_id);
3754: END IF;
3747: IBE_Util.Debug('l_order_line_tbl.retattr1: ' || l_order_line_tbl(i).return_attribute1);
3748: IBE_Util.Debug('l_order_line_tbl.retattr2: ' || l_order_line_tbl(i).return_attribute2);
3749: IBE_Util.Debug('l_order_line_tbl.retcontxt: ' || l_order_line_tbl(i).return_context);
3750: IBE_Util.Debug('l_order_line_tbl.linetypeid: ' || l_order_line_tbl(i).line_type_id);
3751: IBE_Util.Debug('l_order_line_tbl.operation: ' || l_order_line_tbl(i).operation);
3752: IBE_Util.Debug('l_order_line_tbl.shiptoOrgid: ' || l_order_line_tbl(i).ship_to_org_id);
3753: IBE_Util.Debug('l_order_line_tbl.invoicetoOrgid: ' || l_order_line_tbl(i).invoice_to_org_id);
3754: END IF;
3755: END LOOP;
3748: IBE_Util.Debug('l_order_line_tbl.retattr2: ' || l_order_line_tbl(i).return_attribute2);
3749: IBE_Util.Debug('l_order_line_tbl.retcontxt: ' || l_order_line_tbl(i).return_context);
3750: IBE_Util.Debug('l_order_line_tbl.linetypeid: ' || l_order_line_tbl(i).line_type_id);
3751: IBE_Util.Debug('l_order_line_tbl.operation: ' || l_order_line_tbl(i).operation);
3752: IBE_Util.Debug('l_order_line_tbl.shiptoOrgid: ' || l_order_line_tbl(i).ship_to_org_id);
3753: IBE_Util.Debug('l_order_line_tbl.invoicetoOrgid: ' || l_order_line_tbl(i).invoice_to_org_id);
3754: END IF;
3755: END LOOP;
3756:
3749: IBE_Util.Debug('l_order_line_tbl.retcontxt: ' || l_order_line_tbl(i).return_context);
3750: IBE_Util.Debug('l_order_line_tbl.linetypeid: ' || l_order_line_tbl(i).line_type_id);
3751: IBE_Util.Debug('l_order_line_tbl.operation: ' || l_order_line_tbl(i).operation);
3752: IBE_Util.Debug('l_order_line_tbl.shiptoOrgid: ' || l_order_line_tbl(i).ship_to_org_id);
3753: IBE_Util.Debug('l_order_line_tbl.invoicetoOrgid: ' || l_order_line_tbl(i).invoice_to_org_id);
3754: END IF;
3755: END LOOP;
3756:
3757:
3801: l_line_return_status := lx_line_tbl(j).return_status;
3802: l_line_return_attr2 := lx_line_tbl(j).return_attribute2;
3803:
3804: If(l_line_return_status <> 'S')then
3805: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3806: IBE_UTIL.DEBUG('line id returned from OE' || l_line_id );
3807: IBE_UTIL.DEBUG('return status returned from OE' || l_line_return_status);
3808: IBE_UTIL.DEBUG('return attribute2 returned from OE' || l_line_return_attr2);
3809: END IF;
3802: l_line_return_attr2 := lx_line_tbl(j).return_attribute2;
3803:
3804: If(l_line_return_status <> 'S')then
3805: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3806: IBE_UTIL.DEBUG('line id returned from OE' || l_line_id );
3807: IBE_UTIL.DEBUG('return status returned from OE' || l_line_return_status);
3808: IBE_UTIL.DEBUG('return attribute2 returned from OE' || l_line_return_attr2);
3809: END IF;
3810:
3803:
3804: If(l_line_return_status <> 'S')then
3805: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3806: IBE_UTIL.DEBUG('line id returned from OE' || l_line_id );
3807: IBE_UTIL.DEBUG('return status returned from OE' || l_line_return_status);
3808: IBE_UTIL.DEBUG('return attribute2 returned from OE' || l_line_return_attr2);
3809: END IF;
3810:
3811: l_count := l_count + 1;
3804: If(l_line_return_status <> 'S')then
3805: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3806: IBE_UTIL.DEBUG('line id returned from OE' || l_line_id );
3807: IBE_UTIL.DEBUG('return status returned from OE' || l_line_return_status);
3808: IBE_UTIL.DEBUG('return attribute2 returned from OE' || l_line_return_attr2);
3809: END IF;
3810:
3811: l_count := l_count + 1;
3812: Fail_TmpLineRec_Tbl(l_count) := lx_line_tbl(j).return_attribute2;
3822: x_error_lineids(k) := Fail_TmpLineRec_Tbl(k);
3823: end loop;
3824: end if;
3825:
3826: IF (IBE_UTIL.G_DEBUGON = l_true) then
3827: IBE_Util.debug('ChkConstraint Error Messages count: ' || x_msg_count ||' : '||x_return_status);
3828: end if;
3829:
3830: for j in 1 .. x_msg_count
3823: end loop;
3824: end if;
3825:
3826: IF (IBE_UTIL.G_DEBUGON = l_true) then
3827: IBE_Util.debug('ChkConstraint Error Messages count: ' || x_msg_count ||' : '||x_return_status);
3828: end if;
3829:
3830: for j in 1 .. x_msg_count
3831: loop
3829:
3830: for j in 1 .. x_msg_count
3831: loop
3832: x_msg_data:= OE_MSG_PUB.get(fnd_msg_pub.g_next,FND_API.G_FALSE);
3833: IF (IBE_UTIL.G_DEBUGON = l_true) then
3834: IBE_Util.debug('Chk Constraint Exception Message' || x_msg_data);
3835: end if;
3836: end loop;
3837:
3830: for j in 1 .. x_msg_count
3831: loop
3832: x_msg_data:= OE_MSG_PUB.get(fnd_msg_pub.g_next,FND_API.G_FALSE);
3833: IF (IBE_UTIL.G_DEBUGON = l_true) then
3834: IBE_Util.debug('Chk Constraint Exception Message' || x_msg_data);
3835: end if;
3836: end loop;
3837:
3838: IF x_return_status <> FND_API.G_RET_STS_SUCCESS then
3859: THEN
3860: COMMIT WORK;
3861: END IF;
3862:
3863: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3864: IBE_Util.Debug('End OE_ORDER_SAVE_PVT:CHECKCONSTRAINT()');
3865: END IF;
3866:
3867: -- Standard call to get message count and if count is 1, get message info.
3860: COMMIT WORK;
3861: END IF;
3862:
3863: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3864: IBE_Util.Debug('End OE_ORDER_SAVE_PVT:CHECKCONSTRAINT()');
3865: END IF;
3866:
3867: -- Standard call to get message count and if count is 1, get message info.
3868: FND_MSG_PUB.Count_And_Get ( p_count => x_msg_count,
3875: x_return_status := FND_API.G_RET_STS_ERROR;
3876: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
3877: p_count => x_msg_count ,
3878: p_data => x_msg_data);
3879: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3880: IBE_Util.Debug('Error IBE_ORDER_SAVE_PVT:CHECKCONSTRAINT()'|| sqlerrm);
3881: END IF;
3882:
3883: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3876: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
3877: p_count => x_msg_count ,
3878: p_data => x_msg_data);
3879: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3880: IBE_Util.Debug('Error IBE_ORDER_SAVE_PVT:CHECKCONSTRAINT()'|| sqlerrm);
3881: END IF;
3882:
3883: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3884: ROLLBACK TO ORDER_CHKCONSTRAINT;
3885: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3886: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
3887: p_count => x_msg_count ,
3888: p_data => x_msg_data);
3889: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3890: IBE_Util.Debug('UNEXPECTEDError IBE_ORDER_SAVE_PVT:CHECKCONSTRAINT()' || sqlerrm);
3891: END IF;
3892:
3893: WHEN OTHERS THEN
3886: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
3887: p_count => x_msg_count ,
3888: p_data => x_msg_data);
3889: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3890: IBE_Util.Debug('UNEXPECTEDError IBE_ORDER_SAVE_PVT:CHECKCONSTRAINT()' || sqlerrm);
3891: END IF;
3892:
3893: WHEN OTHERS THEN
3894: ROLLBACK TO ORDER_CHKCONSTRAINT;
3900:
3901: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
3902: p_count => x_msg_count ,
3903: p_data => x_msg_data);
3904: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3905: IBE_Util.Debug('Other IBE_ORDER_SAVE_PVT:CHECKCONSTRAINT()' || sqlerrm);
3906: END IF;
3907:
3908: END CheckConstraint;
3901: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
3902: p_count => x_msg_count ,
3903: p_data => x_msg_data);
3904: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3905: IBE_Util.Debug('Other IBE_ORDER_SAVE_PVT:CHECKCONSTRAINT()' || sqlerrm);
3906: END IF;
3907:
3908: END CheckConstraint;
3909:
3968: l_last_update_date DATE;
3969:
3970: BEGIN
3971:
3972: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3973: IBE_Util.Debug('Begin IBE_ORDER_SAVE_PVT:UpdateLinebilling()');
3974: END IF;
3975:
3976: -- Standard Start of API savepoint
3969:
3970: BEGIN
3971:
3972: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3973: IBE_Util.Debug('Begin IBE_ORDER_SAVE_PVT:UpdateLinebilling()');
3974: END IF;
3975:
3976: -- Standard Start of API savepoint
3977: SAVEPOINT ORDER_UPDTLINEBILL;
3994: x_return_status := FND_API.G_RET_STS_SUCCESS;
3995:
3996: -- Start OF API body --
3997:
3998: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3999: IBE_Util.Debug('Calling Validate Order Access');
4000: END IF;
4001:
4002: /********** User Authentication *************/
3995:
3996: -- Start OF API body --
3997:
3998: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
3999: IBE_Util.Debug('Calling Validate Order Access');
4000: END IF;
4001:
4002: /********** User Authentication *************/
4003:
4011: raise FND_API.G_EXC_ERROR;
4012: END IF;
4013: END IF;
4014:
4015: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4016: Ibe_util.Debug('checking the Return status');
4017: END IF;
4018:
4019:
4012: END IF;
4013: END IF;
4014:
4015: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4016: Ibe_util.Debug('checking the Return status');
4017: END IF;
4018:
4019:
4020: Get_Order_Status(p_header_id => p_order_header_id
4020: Get_Order_Status(p_header_id => p_order_header_id
4021: ,x_order_status => l_flow_status_code
4022: ,x_last_update_date => l_last_update_date);
4023:
4024: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4025: Ibe_util.Debug('last_update_date sent from ui: '||p_last_update_date);
4026: Ibe_util.Debug('last_update_date from db: '||l_last_update_date);
4027: Ibe_util.Debug('l_flow_status_code: '||l_flow_status_code);
4028: END IF;
4021: ,x_order_status => l_flow_status_code
4022: ,x_last_update_date => l_last_update_date);
4023:
4024: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4025: Ibe_util.Debug('last_update_date sent from ui: '||p_last_update_date);
4026: Ibe_util.Debug('last_update_date from db: '||l_last_update_date);
4027: Ibe_util.Debug('l_flow_status_code: '||l_flow_status_code);
4028: END IF;
4029:
4022: ,x_last_update_date => l_last_update_date);
4023:
4024: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4025: Ibe_util.Debug('last_update_date sent from ui: '||p_last_update_date);
4026: Ibe_util.Debug('last_update_date from db: '||l_last_update_date);
4027: Ibe_util.Debug('l_flow_status_code: '||l_flow_status_code);
4028: END IF;
4029:
4030: IF ((l_flow_status_code = 'BOOKED' OR l_flow_status_code='CLOSED' OR
4023:
4024: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4025: Ibe_util.Debug('last_update_date sent from ui: '||p_last_update_date);
4026: Ibe_util.Debug('last_update_date from db: '||l_last_update_date);
4027: Ibe_util.Debug('l_flow_status_code: '||l_flow_status_code);
4028: END IF;
4029:
4030: IF ((l_flow_status_code = 'BOOKED' OR l_flow_status_code='CLOSED' OR
4031: l_flow_status_code = 'CANCELLED')
4050: --l_siteuse_type := 'SHIP_TO';
4051: l_siteuse_shipto := 'SHIP_TO';
4052: END IF;
4053:
4054: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4055: IBE_Util.Debug('UpdateLinebilling-l_siteuse_billto: '||l_siteuse_billto||' : l_siteuse_shipto: '||l_siteuse_shipto);
4056: END IF;
4057:
4058: -- Fetching Invoice To Org Id.
4051: l_siteuse_shipto := 'SHIP_TO';
4052: END IF;
4053:
4054: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4055: IBE_Util.Debug('UpdateLinebilling-l_siteuse_billto: '||l_siteuse_billto||' : l_siteuse_shipto: '||l_siteuse_shipto);
4056: END IF;
4057:
4058: -- Fetching Invoice To Org Id.
4059:
4070: ,x_msg_data => x_msg_data
4071: );
4072:
4073: IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
4074: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4075: IBE_Util.Debug('UpdateLinebilling- Get_Cust_Account_Site_Use() fails raise exception');
4076: END IF;
4077:
4078: FND_Message.Set_Name('IBE', 'IBE_ERR_OT_INVALID_BILLTO_ADDR');
4071: );
4072:
4073: IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
4074: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4075: IBE_Util.Debug('UpdateLinebilling- Get_Cust_Account_Site_Use() fails raise exception');
4076: END IF;
4077:
4078: FND_Message.Set_Name('IBE', 'IBE_ERR_OT_INVALID_BILLTO_ADDR');
4079: FND_Msg_Pub.Add;
4079: FND_Msg_Pub.Add;
4080: RAISE FND_API.G_EXC_ERROR;
4081: END IF;
4082:
4083: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4084: IBE_Util.Debug('UpdateLinebilling-l_acct_siteuse_id: ' || l_billto_acct_siteuse_id);
4085: END IF;
4086: end if;
4087:
4080: RAISE FND_API.G_EXC_ERROR;
4081: END IF;
4082:
4083: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4084: IBE_Util.Debug('UpdateLinebilling-l_acct_siteuse_id: ' || l_billto_acct_siteuse_id);
4085: END IF;
4086: end if;
4087:
4088: if(l_siteuse_shipto = 'SHIP_TO') then
4098: ,x_msg_data => x_msg_data
4099: );
4100:
4101: IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
4102: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4103: IBE_Util.Debug('UpdateLinebilling- Get_Cust_Account_Site_Use() fails raise exception');
4104: END IF;
4105:
4106: FND_Message.Set_Name('IBE', 'IBE_ERR_OT_INVALID_SHIPTO_ADDR');
4099: );
4100:
4101: IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
4102: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4103: IBE_Util.Debug('UpdateLinebilling- Get_Cust_Account_Site_Use() fails raise exception');
4104: END IF;
4105:
4106: FND_Message.Set_Name('IBE', 'IBE_ERR_OT_INVALID_SHIPTO_ADDR');
4107: FND_Msg_Pub.Add;
4106: FND_Message.Set_Name('IBE', 'IBE_ERR_OT_INVALID_SHIPTO_ADDR');
4107: FND_Msg_Pub.Add;
4108: RAISE FND_API.G_EXC_ERROR;
4109: END IF;
4110: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4111: IBE_Util.Debug('UpdateLinebilling-l_acct_siteuse_id: ' || l_shipto_acct_siteuse_id);
4112: END IF;
4113:
4114: end if;
4107: FND_Msg_Pub.Add;
4108: RAISE FND_API.G_EXC_ERROR;
4109: END IF;
4110: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4111: IBE_Util.Debug('UpdateLinebilling-l_acct_siteuse_id: ' || l_shipto_acct_siteuse_id);
4112: END IF;
4113:
4114: end if;
4115:
4127: l_order_line_tbl(1).ship_to_org_id := l_shipto_acct_siteuse_id;
4128: end if;
4129:
4130: -- Fetching InvoiceToContactId
4131: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4132: IBE_Util.Debug('billto_ party_id :: billto_custacct_id: '||p_billto_party_id||' :: '||p_billto_cust_acct_id);
4133: END IF;
4134:
4135: If(p_billto_party_id is not null AND
4128: end if;
4129:
4130: -- Fetching InvoiceToContactId
4131: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4132: IBE_Util.Debug('billto_ party_id :: billto_custacct_id: '||p_billto_party_id||' :: '||p_billto_cust_acct_id);
4133: END IF;
4134:
4135: If(p_billto_party_id is not null AND
4136: p_billto_party_id <> FND_API.G_MISS_NUM AND
4167: l_order_line_tbl(1).ship_to_contact_id := l_cust_acct_role_id;
4168: end if;
4169:
4170:
4171: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4172: IBE_Util.Debug('Line Id: '||l_order_line_tbl(1).line_id);
4173: IBE_Util.Debug('Line operation: ' ||l_order_line_tbl(1).operation);
4174: IBE_Util.Debug('Line invoiceToOrgId: ' ||l_order_line_tbl(1).invoice_to_org_id);
4175: IBE_Util.Debug('Line InvoiceToContactId: '||l_order_line_tbl(1).invoice_to_contact_id);
4168: end if;
4169:
4170:
4171: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4172: IBE_Util.Debug('Line Id: '||l_order_line_tbl(1).line_id);
4173: IBE_Util.Debug('Line operation: ' ||l_order_line_tbl(1).operation);
4174: IBE_Util.Debug('Line invoiceToOrgId: ' ||l_order_line_tbl(1).invoice_to_org_id);
4175: IBE_Util.Debug('Line InvoiceToContactId: '||l_order_line_tbl(1).invoice_to_contact_id);
4176: ENd If;
4169:
4170:
4171: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4172: IBE_Util.Debug('Line Id: '||l_order_line_tbl(1).line_id);
4173: IBE_Util.Debug('Line operation: ' ||l_order_line_tbl(1).operation);
4174: IBE_Util.Debug('Line invoiceToOrgId: ' ||l_order_line_tbl(1).invoice_to_org_id);
4175: IBE_Util.Debug('Line InvoiceToContactId: '||l_order_line_tbl(1).invoice_to_contact_id);
4176: ENd If;
4177:
4170:
4171: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4172: IBE_Util.Debug('Line Id: '||l_order_line_tbl(1).line_id);
4173: IBE_Util.Debug('Line operation: ' ||l_order_line_tbl(1).operation);
4174: IBE_Util.Debug('Line invoiceToOrgId: ' ||l_order_line_tbl(1).invoice_to_org_id);
4175: IBE_Util.Debug('Line InvoiceToContactId: '||l_order_line_tbl(1).invoice_to_contact_id);
4176: ENd If;
4177:
4178: SaveMDLRelatedOperations(p_context_type => 'UPDATELINES',
4171: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4172: IBE_Util.Debug('Line Id: '||l_order_line_tbl(1).line_id);
4173: IBE_Util.Debug('Line operation: ' ||l_order_line_tbl(1).operation);
4174: IBE_Util.Debug('Line invoiceToOrgId: ' ||l_order_line_tbl(1).invoice_to_org_id);
4175: IBE_Util.Debug('Line InvoiceToContactId: '||l_order_line_tbl(1).invoice_to_contact_id);
4176: ENd If;
4177:
4178: SaveMDLRelatedOperations(p_context_type => 'UPDATELINES',
4179: p_order_line_tbl => l_order_line_tbl,
4185: loop
4186: l_order_line_tbl(i) := lx_line_tbl(i);
4187: end loop;
4188:
4189: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4190: IBE_Util.Debug('UpdateLine Linetbl cnt b4 processOrder '||l_order_line_tbl.count);
4191: IBE_Util.Debug('check this: '||l_order_line_tbl(1).LINE_ID);
4192: IBE_Util.Debug('check this: '||l_order_line_tbl(1).INVOICE_TO_ORG_ID);
4193: IBE_Util.Debug('check this: '||l_order_line_tbl(1).INVOICE_TO_CONTACT_ID);
4186: l_order_line_tbl(i) := lx_line_tbl(i);
4187: end loop;
4188:
4189: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4190: IBE_Util.Debug('UpdateLine Linetbl cnt b4 processOrder '||l_order_line_tbl.count);
4191: IBE_Util.Debug('check this: '||l_order_line_tbl(1).LINE_ID);
4192: IBE_Util.Debug('check this: '||l_order_line_tbl(1).INVOICE_TO_ORG_ID);
4193: IBE_Util.Debug('check this: '||l_order_line_tbl(1).INVOICE_TO_CONTACT_ID);
4194: IBE_Util.Debug('check this: '||l_order_line_tbl(1).SHIP_TO_ORG_ID);
4187: end loop;
4188:
4189: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4190: IBE_Util.Debug('UpdateLine Linetbl cnt b4 processOrder '||l_order_line_tbl.count);
4191: IBE_Util.Debug('check this: '||l_order_line_tbl(1).LINE_ID);
4192: IBE_Util.Debug('check this: '||l_order_line_tbl(1).INVOICE_TO_ORG_ID);
4193: IBE_Util.Debug('check this: '||l_order_line_tbl(1).INVOICE_TO_CONTACT_ID);
4194: IBE_Util.Debug('check this: '||l_order_line_tbl(1).SHIP_TO_ORG_ID);
4195: IBE_Util.Debug('check this: '||l_order_line_tbl(1).SHIP_TO_CONTACT_ID);
4188:
4189: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4190: IBE_Util.Debug('UpdateLine Linetbl cnt b4 processOrder '||l_order_line_tbl.count);
4191: IBE_Util.Debug('check this: '||l_order_line_tbl(1).LINE_ID);
4192: IBE_Util.Debug('check this: '||l_order_line_tbl(1).INVOICE_TO_ORG_ID);
4193: IBE_Util.Debug('check this: '||l_order_line_tbl(1).INVOICE_TO_CONTACT_ID);
4194: IBE_Util.Debug('check this: '||l_order_line_tbl(1).SHIP_TO_ORG_ID);
4195: IBE_Util.Debug('check this: '||l_order_line_tbl(1).SHIP_TO_CONTACT_ID);
4196: IBE_Util.Debug('check this: '||l_order_line_tbl(1).OPERATION);
4189: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4190: IBE_Util.Debug('UpdateLine Linetbl cnt b4 processOrder '||l_order_line_tbl.count);
4191: IBE_Util.Debug('check this: '||l_order_line_tbl(1).LINE_ID);
4192: IBE_Util.Debug('check this: '||l_order_line_tbl(1).INVOICE_TO_ORG_ID);
4193: IBE_Util.Debug('check this: '||l_order_line_tbl(1).INVOICE_TO_CONTACT_ID);
4194: IBE_Util.Debug('check this: '||l_order_line_tbl(1).SHIP_TO_ORG_ID);
4195: IBE_Util.Debug('check this: '||l_order_line_tbl(1).SHIP_TO_CONTACT_ID);
4196: IBE_Util.Debug('check this: '||l_order_line_tbl(1).OPERATION);
4197: END IF;
4190: IBE_Util.Debug('UpdateLine Linetbl cnt b4 processOrder '||l_order_line_tbl.count);
4191: IBE_Util.Debug('check this: '||l_order_line_tbl(1).LINE_ID);
4192: IBE_Util.Debug('check this: '||l_order_line_tbl(1).INVOICE_TO_ORG_ID);
4193: IBE_Util.Debug('check this: '||l_order_line_tbl(1).INVOICE_TO_CONTACT_ID);
4194: IBE_Util.Debug('check this: '||l_order_line_tbl(1).SHIP_TO_ORG_ID);
4195: IBE_Util.Debug('check this: '||l_order_line_tbl(1).SHIP_TO_CONTACT_ID);
4196: IBE_Util.Debug('check this: '||l_order_line_tbl(1).OPERATION);
4197: END IF;
4198:
4191: IBE_Util.Debug('check this: '||l_order_line_tbl(1).LINE_ID);
4192: IBE_Util.Debug('check this: '||l_order_line_tbl(1).INVOICE_TO_ORG_ID);
4193: IBE_Util.Debug('check this: '||l_order_line_tbl(1).INVOICE_TO_CONTACT_ID);
4194: IBE_Util.Debug('check this: '||l_order_line_tbl(1).SHIP_TO_ORG_ID);
4195: IBE_Util.Debug('check this: '||l_order_line_tbl(1).SHIP_TO_CONTACT_ID);
4196: IBE_Util.Debug('check this: '||l_order_line_tbl(1).OPERATION);
4197: END IF;
4198:
4199: -- Calling Process Order
4192: IBE_Util.Debug('check this: '||l_order_line_tbl(1).INVOICE_TO_ORG_ID);
4193: IBE_Util.Debug('check this: '||l_order_line_tbl(1).INVOICE_TO_CONTACT_ID);
4194: IBE_Util.Debug('check this: '||l_order_line_tbl(1).SHIP_TO_ORG_ID);
4195: IBE_Util.Debug('check this: '||l_order_line_tbl(1).SHIP_TO_CONTACT_ID);
4196: IBE_Util.Debug('check this: '||l_order_line_tbl(1).OPERATION);
4197: END IF;
4198:
4199: -- Calling Process Order
4200: OE_Order_GRP.Process_Order
4231: , x_Lot_Serial_val_tbl => l_lot_serial_val_tbl
4232: , x_action_request_tbl => l_action_request_tbl
4233: );
4234:
4235: IF (IBE_UTIL.G_DEBUGON = l_true) then
4236: IBE_UTIL.DEBUG('Return status from OE updatelinebill: ' || x_return_status);
4237: IBE_UTIL.DEBUG('header id from OE updatelinebill: ' || lx_order_header_rec.header_id);
4238: end if;
4239:
4232: , x_action_request_tbl => l_action_request_tbl
4233: );
4234:
4235: IF (IBE_UTIL.G_DEBUGON = l_true) then
4236: IBE_UTIL.DEBUG('Return status from OE updatelinebill: ' || x_return_status);
4237: IBE_UTIL.DEBUG('header id from OE updatelinebill: ' || lx_order_header_rec.header_id);
4238: end if;
4239:
4240: for j in 1 .. x_msg_count
4233: );
4234:
4235: IF (IBE_UTIL.G_DEBUGON = l_true) then
4236: IBE_UTIL.DEBUG('Return status from OE updatelinebill: ' || x_return_status);
4237: IBE_UTIL.DEBUG('header id from OE updatelinebill: ' || lx_order_header_rec.header_id);
4238: end if;
4239:
4240: for j in 1 .. x_msg_count
4241: loop
4239:
4240: for j in 1 .. x_msg_count
4241: loop
4242: x_msg_data:= OE_MSG_PUB.get(fnd_msg_pub.g_next,FND_API.G_FALSE);
4243: IF (IBE_UTIL.G_DEBUGON = l_true) then
4244: IBE_UTIL.DEBUG('Message from OE update line bill: ' || x_msg_data );
4245: end if;
4246: end loop;
4247:
4240: for j in 1 .. x_msg_count
4241: loop
4242: x_msg_data:= OE_MSG_PUB.get(fnd_msg_pub.g_next,FND_API.G_FALSE);
4243: IF (IBE_UTIL.G_DEBUGON = l_true) then
4244: IBE_UTIL.DEBUG('Message from OE update line bill: ' || x_msg_data );
4245: end if;
4246: end loop;
4247:
4248: IF x_return_status <> FND_API.G_RET_STS_SUCCESS then
4263: THEN
4264: COMMIT WORK;
4265: END IF;
4266:
4267: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4268: IBE_Util.Debug('End IBE_ORDER_SAVE_PVT:UpdateLinebilling()');
4269: END IF;
4270:
4271: -- Standard call to get message count and if count is 1, get message info.
4264: COMMIT WORK;
4265: END IF;
4266:
4267: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4268: IBE_Util.Debug('End IBE_ORDER_SAVE_PVT:UpdateLinebilling()');
4269: END IF;
4270:
4271: -- Standard call to get message count and if count is 1, get message info.
4272: FND_MSG_PUB.Count_And_Get ( p_count => x_msg_count,
4278: x_return_status := FND_API.G_RET_STS_ERROR;
4279: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
4280: p_count => x_msg_count ,
4281: p_data => x_msg_data);
4282: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4283: IBE_Util.Debug('Error IBE_ORDER_SAVE_PVT:UpdateLineShippingBilling()'|| sqlerrm);
4284: END IF;
4285:
4286: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4279: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
4280: p_count => x_msg_count ,
4281: p_data => x_msg_data);
4282: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4283: IBE_Util.Debug('Error IBE_ORDER_SAVE_PVT:UpdateLineShippingBilling()'|| sqlerrm);
4284: END IF;
4285:
4286: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4287: ROLLBACK TO ORDER_UPDTLINEBILL;
4288: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4289: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
4290: p_count => x_msg_count ,
4291: p_data => x_msg_data);
4292: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4293: IBE_Util.Debug('UNEXPECTEDErr IBE_ORDER_SAVE_PVT:UpdateLineShippingBilling()' || sqlerrm);
4294: END IF;
4295:
4296: WHEN OTHERS THEN
4289: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
4290: p_count => x_msg_count ,
4291: p_data => x_msg_data);
4292: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4293: IBE_Util.Debug('UNEXPECTEDErr IBE_ORDER_SAVE_PVT:UpdateLineShippingBilling()' || sqlerrm);
4294: END IF;
4295:
4296: WHEN OTHERS THEN
4297: ROLLBACK TO ORDER_UPDTLINEBILL;
4303:
4304: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
4305: p_count => x_msg_count ,
4306: p_data => x_msg_data);
4307: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4308: IBE_Util.Debug('OtherExc IBE_ORDER_SAVE_PVT:UpdateLineShippingBilling()' || sqlerrm);
4309: END IF;
4310:
4311: END UpdateLineShippingBilling;
4304: FND_Msg_Pub.Count_And_Get(p_encoded => FND_API.G_FALSE,
4305: p_count => x_msg_count ,
4306: p_data => x_msg_data);
4307: IF (IBE_UTIL.G_DEBUGON = l_true) THEN
4308: IBE_Util.Debug('OtherExc IBE_ORDER_SAVE_PVT:UpdateLineShippingBilling()' || sqlerrm);
4309: END IF;
4310:
4311: END UpdateLineShippingBilling;
4312: