6: G_PKG_NAME CONSTANT VARCHAR2(100) := 'IBU_ORDER_CAPTURE';
7:
8: PROCEDURE CREATE_RETURN (
9: p_api_version_number IN NUMBER,
10: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
11: p_commit IN VARCHAR := FND_API.G_FALSE,
12: p_header_id IN NUMBER,
13: HEADER_REC IN HEADER_REC_TYPE,
14: HEADER_SHIPMENT_REC IN HEADER_SHIPMENT_REC_TYPE,
7:
8: PROCEDURE CREATE_RETURN (
9: p_api_version_number IN NUMBER,
10: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
11: p_commit IN VARCHAR := FND_API.G_FALSE,
12: p_header_id IN NUMBER,
13: HEADER_REC IN HEADER_REC_TYPE,
14: HEADER_SHIPMENT_REC IN HEADER_SHIPMENT_REC_TYPE,
15: LINE_TBL IN LINE_TBL_TYPE,
42:
43: l_dummy_id NUMBER;
44:
45: l_source_document_id NUMBER:= NULL;
46: l_org_id NUMBER:= FND_API.G_MISS_NUM;
47: l_source_document_type_id NUMBER:= NULL;
48: l_pricelist_id NUMBER:= FND_API.G_MISS_NUM;
49: l_transaction_curr_code VARCHAR2 (15):=FND_API.G_MISS_CHAR;
50: l_quote_source_code VARCHAR2(240):=NULL;
44:
45: l_source_document_id NUMBER:= NULL;
46: l_org_id NUMBER:= FND_API.G_MISS_NUM;
47: l_source_document_type_id NUMBER:= NULL;
48: l_pricelist_id NUMBER:= FND_API.G_MISS_NUM;
49: l_transaction_curr_code VARCHAR2 (15):=FND_API.G_MISS_CHAR;
50: l_quote_source_code VARCHAR2(240):=NULL;
51:
52: l_line_cursor NUMBER;
45: l_source_document_id NUMBER:= NULL;
46: l_org_id NUMBER:= FND_API.G_MISS_NUM;
47: l_source_document_type_id NUMBER:= NULL;
48: l_pricelist_id NUMBER:= FND_API.G_MISS_NUM;
49: l_transaction_curr_code VARCHAR2 (15):=FND_API.G_MISS_CHAR;
50: l_quote_source_code VARCHAR2(240):=NULL;
51:
52: l_line_cursor NUMBER;
53: l_line_cursor_stmt VARCHAR2(4000);
51:
52: l_line_cursor NUMBER;
53: l_line_cursor_stmt VARCHAR2(4000);
54:
55: l_line_org_id NUMBER := FND_API.G_MISS_NUM;
56: l_ship_from_org_id NUMBER := FND_API.G_MISS_NUM;
57: l_inventory_item_id NUMBER := FND_API.G_MISS_NUM;
58: l_ordered_quantity_uom VARCHAR2(3) :=FND_API.G_MISS_CHAR;
59: l_line_price_list_id NUMBER :=FND_API.G_MISS_NUM;
52: l_line_cursor NUMBER;
53: l_line_cursor_stmt VARCHAR2(4000);
54:
55: l_line_org_id NUMBER := FND_API.G_MISS_NUM;
56: l_ship_from_org_id NUMBER := FND_API.G_MISS_NUM;
57: l_inventory_item_id NUMBER := FND_API.G_MISS_NUM;
58: l_ordered_quantity_uom VARCHAR2(3) :=FND_API.G_MISS_CHAR;
59: l_line_price_list_id NUMBER :=FND_API.G_MISS_NUM;
60: l_unit_list_price NUMBER :=FND_API.G_MISS_NUM;
53: l_line_cursor_stmt VARCHAR2(4000);
54:
55: l_line_org_id NUMBER := FND_API.G_MISS_NUM;
56: l_ship_from_org_id NUMBER := FND_API.G_MISS_NUM;
57: l_inventory_item_id NUMBER := FND_API.G_MISS_NUM;
58: l_ordered_quantity_uom VARCHAR2(3) :=FND_API.G_MISS_CHAR;
59: l_line_price_list_id NUMBER :=FND_API.G_MISS_NUM;
60: l_unit_list_price NUMBER :=FND_API.G_MISS_NUM;
61: l_unit_selling_price NUMBER :=FND_API.G_MISS_NUM;
54:
55: l_line_org_id NUMBER := FND_API.G_MISS_NUM;
56: l_ship_from_org_id NUMBER := FND_API.G_MISS_NUM;
57: l_inventory_item_id NUMBER := FND_API.G_MISS_NUM;
58: l_ordered_quantity_uom VARCHAR2(3) :=FND_API.G_MISS_CHAR;
59: l_line_price_list_id NUMBER :=FND_API.G_MISS_NUM;
60: l_unit_list_price NUMBER :=FND_API.G_MISS_NUM;
61: l_unit_selling_price NUMBER :=FND_API.G_MISS_NUM;
62:
55: l_line_org_id NUMBER := FND_API.G_MISS_NUM;
56: l_ship_from_org_id NUMBER := FND_API.G_MISS_NUM;
57: l_inventory_item_id NUMBER := FND_API.G_MISS_NUM;
58: l_ordered_quantity_uom VARCHAR2(3) :=FND_API.G_MISS_CHAR;
59: l_line_price_list_id NUMBER :=FND_API.G_MISS_NUM;
60: l_unit_list_price NUMBER :=FND_API.G_MISS_NUM;
61: l_unit_selling_price NUMBER :=FND_API.G_MISS_NUM;
62:
63: l_ibu_ret_error_msg VARCHAR2(4000);
56: l_ship_from_org_id NUMBER := FND_API.G_MISS_NUM;
57: l_inventory_item_id NUMBER := FND_API.G_MISS_NUM;
58: l_ordered_quantity_uom VARCHAR2(3) :=FND_API.G_MISS_CHAR;
59: l_line_price_list_id NUMBER :=FND_API.G_MISS_NUM;
60: l_unit_list_price NUMBER :=FND_API.G_MISS_NUM;
61: l_unit_selling_price NUMBER :=FND_API.G_MISS_NUM;
62:
63: l_ibu_ret_error_msg VARCHAR2(4000);
64: l_aso_debug_file VARCHAR2(1000);
57: l_inventory_item_id NUMBER := FND_API.G_MISS_NUM;
58: l_ordered_quantity_uom VARCHAR2(3) :=FND_API.G_MISS_CHAR;
59: l_line_price_list_id NUMBER :=FND_API.G_MISS_NUM;
60: l_unit_list_price NUMBER :=FND_API.G_MISS_NUM;
61: l_unit_selling_price NUMBER :=FND_API.G_MISS_NUM;
62:
63: l_ibu_ret_error_msg VARCHAR2(4000);
64: l_aso_debug_file VARCHAR2(1000);
65: l_ibu_ret_header_info VARCHAR2(8000);
71: l_ibu_ret_line_prpt_info VARCHAR2(8000);
72: l_ibu_ret_line_dtl_prpt_info VARCHAR2(8000);
73:
74: l_booked_profile_value VARCHAR2(100);
75: l_salesrep_id NUMBER :=FND_API.G_MISS_NUM;
76: l_person_id NUMBER :=FND_API.G_MISS_NUM;
77:
78: Cursor Get_order_salesrep_id (p_header_id NUMBER) IS
79: select salesrep_id
72: l_ibu_ret_line_dtl_prpt_info VARCHAR2(8000);
73:
74: l_booked_profile_value VARCHAR2(100);
75: l_salesrep_id NUMBER :=FND_API.G_MISS_NUM;
76: l_person_id NUMBER :=FND_API.G_MISS_NUM;
77:
78: Cursor Get_order_salesrep_id (p_header_id NUMBER) IS
79: select salesrep_id
80: from OE_ORDER_HEADERS_ALL
97: aso_debug_pub.debug_on;
98: l_aso_debug_file := 'debug=' || l_aso_debug_file;
99:
100: -- Initialize message list if p_init_msg_list is set to TRUE.
101: IF FND_API.to_Boolean( p_init_msg_list ) THEN
102: null;
103: FND_MSG_PUB.initialize;
104: FND_MSG_PUB.initialize;
105: END IF;
102: null;
103: FND_MSG_PUB.initialize;
104: FND_MSG_PUB.initialize;
105: END IF;
106: X_Return_Status := FND_API.G_RET_STS_SUCCESS;
107:
108: FND_MESSAGE.SET_NAME('IBU','IBU_MESSAGE');
109: FND_MESSAGE.SET_TOKEN ('TOKEN', l_aso_debug_file);
110: FND_MSG_PUB.Add;
137: dbms_sql.column_value (l_header_cursor, 6, l_quote_source_code);
138:
139:
140: else
141: X_RETURN_STATUS := FND_API.G_RET_STS_ERROR;
142: FND_MESSAGE.SET_NAME('IBU','IBU_RET_REF_ORD_INVALID');
143: FND_MSG_PUB.Add;
144: RAISE FND_API.G_EXC_ERROR;
145: end if;
140: else
141: X_RETURN_STATUS := FND_API.G_RET_STS_ERROR;
142: FND_MESSAGE.SET_NAME('IBU','IBU_RET_REF_ORD_INVALID');
143: FND_MSG_PUB.Add;
144: RAISE FND_API.G_EXC_ERROR;
145: end if;
146:
147: -- validate org_id, pricelist_id, transaction_curr_code
148: if (l_org_id is null OR l_org_id = FND_API.G_MISS_NUM OR l_pricelist_id is null OR l_pricelist_id = FND_API.G_MISS_NUM OR l_transaction_curr_code is null OR l_transaction_curr_code= FND_API.G_MISS_CHAR) then
144: RAISE FND_API.G_EXC_ERROR;
145: end if;
146:
147: -- validate org_id, pricelist_id, transaction_curr_code
148: if (l_org_id is null OR l_org_id = FND_API.G_MISS_NUM OR l_pricelist_id is null OR l_pricelist_id = FND_API.G_MISS_NUM OR l_transaction_curr_code is null OR l_transaction_curr_code= FND_API.G_MISS_CHAR) then
149: X_RETURN_STATUS := FND_API.G_RET_STS_ERROR;
150: FND_MESSAGE.SET_NAME('IBU','IBU_RET_REF_ORD_INVALID');
151: FND_MSG_PUB.Add;
152: RAISE FND_API.G_EXC_ERROR;
145: end if;
146:
147: -- validate org_id, pricelist_id, transaction_curr_code
148: if (l_org_id is null OR l_org_id = FND_API.G_MISS_NUM OR l_pricelist_id is null OR l_pricelist_id = FND_API.G_MISS_NUM OR l_transaction_curr_code is null OR l_transaction_curr_code= FND_API.G_MISS_CHAR) then
149: X_RETURN_STATUS := FND_API.G_RET_STS_ERROR;
150: FND_MESSAGE.SET_NAME('IBU','IBU_RET_REF_ORD_INVALID');
151: FND_MSG_PUB.Add;
152: RAISE FND_API.G_EXC_ERROR;
153: end if;
148: if (l_org_id is null OR l_org_id = FND_API.G_MISS_NUM OR l_pricelist_id is null OR l_pricelist_id = FND_API.G_MISS_NUM OR l_transaction_curr_code is null OR l_transaction_curr_code= FND_API.G_MISS_CHAR) then
149: X_RETURN_STATUS := FND_API.G_RET_STS_ERROR;
150: FND_MESSAGE.SET_NAME('IBU','IBU_RET_REF_ORD_INVALID');
151: FND_MSG_PUB.Add;
152: RAISE FND_API.G_EXC_ERROR;
153: end if;
154:
155: --fill l_qte_header_rec
156:
174: OPEN Get_order_salesrep_id (p_header_id);
175: FETCH Get_order_salesrep_id into l_salesrep_id;
176: CLOSE Get_order_salesrep_id ;
177:
178: if l_salesrep_id is NULL or l_salesrep_id = FND_API.G_MISS_NUM then
179: if FND_PROFILE.VALUE_WNPS('ASO_DEFAULT_PERSON_ID') is not NULL then
180: OPEN Get_person_id ( FND_PROFILE.VALUE_WNPS('ASO_DEFAULT_PERSON_ID'));
181: FETCH Get_person_id into l_person_id;
182: CLOSE Get_person_id ;
196:
197: l_ibu_ret_header_prpt_info := 'l_qte_header_rec::';
198: aso_debug_pub.add('IBU: l_qte_header_rec::', 1, 'Y');
199:
200: if (l_qte_header_rec.quote_header_id <> FND_API.G_MISS_NUM) then
201: l_ibu_ret_header_info := 'quote_header_id = ' || l_qte_header_rec.quote_header_id || ' , ';
202: else
203: l_ibu_ret_header_info := 'quote_header_id = ';
204: end if;
203: l_ibu_ret_header_info := 'quote_header_id = ';
204: end if;
205: aso_debug_pub.add ('IBU: quote_header_id = ' || l_qte_header_rec.quote_header_id , 1, 'Y');
206:
207: if (l_qte_header_rec.org_id <> FND_API.G_MISS_NUM) then
208: l_ibu_ret_header_info := 'org_id = ' || l_qte_header_rec.org_id || ' , ';
209: else
210: l_ibu_ret_header_info := 'org_id = ';
211: end if;
211: end if;
212:
213: aso_debug_pub.add ('IBU: org_id = ' || l_qte_header_rec.org_id , 1, 'Y');
214:
215: if ( l_qte_header_rec.quote_source_code <> FND_API.G_MISS_CHAR) then
216: l_ibu_ret_header_info := 'quote_source_code = ' || l_qte_header_rec.quote_source_code || ' , ';
217: else
218: l_ibu_ret_header_info := 'quote_source_code = ';
219: end if;
218: l_ibu_ret_header_info := 'quote_source_code = ';
219: end if;
220: aso_debug_pub.add ('IBU: quote_source_code = ' || l_qte_header_rec.quote_source_code , 1, 'Y');
221:
222: if ( l_qte_header_rec.party_id <> FND_API.G_MISS_NUM ) then
223: l_ibu_ret_header_info := 'party_id = ' || l_qte_header_rec.party_id || ' , ';
224: else
225: l_ibu_ret_header_info := 'party_id = ';
226: end if;
225: l_ibu_ret_header_info := 'party_id = ';
226: end if;
227: aso_debug_pub.add ('IBU: party_id = ' || l_qte_header_rec.party_id , 1, 'Y');
228:
229: if ( l_qte_header_rec.cust_account_id <> FND_API.G_MISS_NUM ) then
230: l_ibu_ret_header_info := 'cust_account_id = ' || l_qte_header_rec.cust_account_id || ' , ';
231: else
232: l_ibu_ret_header_info := 'cust_account_id = ';
233: end if;
233: end if;
234: aso_debug_pub.add ('IBU: cust_account_id = ' || l_qte_header_rec.cust_account_id , 1, 'Y');
235:
236:
237: if ( l_qte_header_rec.org_contact_id <> FND_API.G_MISS_NUM ) then
238: l_ibu_ret_header_info := 'org_contact_id = ' || l_qte_header_rec.org_contact_id || ' , ';
239: else
240: l_ibu_ret_header_info := 'org_contact_id = ';
241: end if;
240: l_ibu_ret_header_info := 'org_contact_id = ';
241: end if;
242: aso_debug_pub.add ('IBU: org_contact_id = ' || l_qte_header_rec.org_contact_id , 1, 'Y');
243:
244: if ( l_qte_header_rec.invoice_to_party_site_id <> FND_API.G_MISS_NUM ) then
245: l_ibu_ret_header_info := 'inv_to_py_site_id= ' || l_qte_header_rec.invoice_to_party_site_id || ' , ';
246: else
247: l_ibu_ret_header_info := 'inv_to_py_site_id= ';
248: end if;
247: l_ibu_ret_header_info := 'inv_to_py_site_id= ';
248: end if;
249: aso_debug_pub.add ('IBU: inv_to_py_site_id= ' || l_qte_header_rec.invoice_to_party_site_id , 1, 'Y');
250:
251: if ( l_qte_header_rec.order_type_id <> FND_API.G_MISS_NUM ) then
252: l_ibu_ret_header_info := 'order_type_id = ' || l_qte_header_rec.order_type_id || ' , ';
253: else
254: l_ibu_ret_header_info := 'order_type_id = ';
255: end if;
254: l_ibu_ret_header_info := 'order_type_id = ';
255: end if;
256: aso_debug_pub.add ('IBU: order_type_id = ' || l_qte_header_rec.order_type_id , 1, 'Y');
257:
258: if ( l_qte_header_rec.quote_category_code <> FND_API.G_MISS_CHAR ) then
259: l_ibu_ret_header_info := 'quote_ca_code = ' || l_qte_header_rec.quote_category_code || ' , ';
260: else
261: l_ibu_ret_header_info := 'quote_ca_code = ';
262: end if;
262: end if;
263:
264: aso_debug_pub.add ('IBU: quote_ca_code = ' || l_qte_header_rec.quote_category_code , 1, 'Y');
265:
266: if ( l_qte_header_rec.ordered_date <> FND_API.G_MISS_DATE ) then
267: l_ibu_ret_header_info := 'ordered_date = ' || l_qte_header_rec.ordered_date || ' , ';
268: else
269: l_ibu_ret_header_info := 'ordered_date = ';
270: end if;
272: aso_debug_pub.add ('IBU:ordered_date = ' || l_qte_header_rec.ordered_date , 1, 'Y');
273:
274:
275:
276: if ( l_qte_header_rec.employee_person_id <> FND_API.G_MISS_NUM ) then
277: l_ibu_ret_header_info := 'emp_person_id = ' || l_qte_header_rec.employee_person_id || ' , ';
278: else
279: l_ibu_ret_header_info := 'emp_person_id = ';
280: end if;
279: l_ibu_ret_header_info := 'emp_person_id = ';
280: end if;
281: aso_debug_pub.add ('IBU: emp_person_id = ' || l_qte_header_rec.employee_person_id , 1, 'Y');
282:
283: if ( l_qte_header_rec.price_list_id <> FND_API.G_MISS_NUM ) then
284: l_ibu_ret_header_info := 'price_list_id = ' || l_qte_header_rec.price_list_id || ' , ';
285: else
286: l_ibu_ret_header_info := 'price_list_id = ';
287: end if;
286: l_ibu_ret_header_info := 'price_list_id = ';
287: end if;
288: aso_debug_pub.add ('IBU: price_list_id = ' || l_qte_header_rec.price_list_id , 1, 'Y');
289:
290: if ( l_qte_header_rec.currency_code <> FND_API.G_MISS_CHAR) then
291: l_ibu_ret_header_info := 'currency_code = ' || l_qte_header_rec.currency_code || ' , ';
292: else
293: l_ibu_ret_header_info := 'currency_code = ';
294: end if;
296:
297: l_ibu_ret_head_ship_prpt_info := 'l_header_shipment_tbl(1)::';
298: aso_debug_pub.add ('IBU:l_header_shipment_tbl(1)::' , 1, 'Y');
299:
300: if ( l_header_shipment_tbl(1).request_date <> FND_API.G_MISS_DATE) then
301: l_ibu_ret_head_ship_info := 'request_date = ' || l_header_shipment_tbl(1).request_date || ' , ';
302: else
303: l_ibu_ret_head_ship_info := 'request_date = ';
304: end if;
303: l_ibu_ret_head_ship_info := 'request_date = ';
304: end if;
305: aso_debug_pub.add ('IBU: request_date = ' || l_header_shipment_tbl(1).request_date , 1, 'Y');
306:
307: if ( l_header_shipment_tbl(1).schedule_ship_date <> FND_API.G_MISS_DATE ) then
308: l_ibu_ret_head_ship_info := 'sch_ship_date = ' || l_header_shipment_tbl(1).schedule_ship_date || ' , ';
309: else
310: l_ibu_ret_head_ship_info := 'sch_ship_date = ';
311: end if;
310: l_ibu_ret_head_ship_info := 'sch_ship_date = ';
311: end if;
312: aso_debug_pub.add ('IBU: sch_ship_date = ' || l_header_shipment_tbl(1).schedule_ship_date , 1, 'Y');
313:
314: if ( l_header_shipment_tbl(1).ship_to_party_site_id <> FND_API.G_MISS_NUM) then
315: l_ibu_ret_head_ship_info := 'ship_to_py_site_id = ' || l_header_shipment_tbl(1).ship_to_party_site_id || ' , ';
316: else
317: l_ibu_ret_head_ship_info := 'ship_to_py_site_id = ';
318: end if;
317: l_ibu_ret_head_ship_info := 'ship_to_py_site_id = ';
318: end if;
319: aso_debug_pub.add ('IBU: ship_to_py_site_id = ' || l_header_shipment_tbl(1).ship_to_party_site_id , 1, 'Y');
320:
321: if ( l_header_shipment_tbl(1).freight_carrier_code <> FND_API.G_MISS_CHAR) then
322: l_ibu_ret_head_ship_info := 'freigt_carr_code = ' || l_header_shipment_tbl(1).freight_carrier_code || ' , ';
323: else
324: l_ibu_ret_head_ship_info := 'freigt_carr_code = ';
325: end if;
356: dbms_sql.column_value (l_line_cursor, 7, l_unit_selling_price);
357:
358:
359: else
360: X_RETURN_STATUS := FND_API.G_RET_STS_ERROR;
361: FND_MESSAGE.SET_NAME('IBU','IBU_RET_REF_LINE_INVALID)');
362: FND_MSG_PUB.Add;
363: RAISE FND_API.G_EXC_ERROR;
364: end if;
359: else
360: X_RETURN_STATUS := FND_API.G_RET_STS_ERROR;
361: FND_MESSAGE.SET_NAME('IBU','IBU_RET_REF_LINE_INVALID)');
362: FND_MSG_PUB.Add;
363: RAISE FND_API.G_EXC_ERROR;
364: end if;
365:
366: -- validate line_org_id, ship_from_org_id, inventory_item_id, rdered_quantity_uom, line_pricelist_id, unit_list_price, unit_selling_price
367: if (l_line_org_id is null OR l_line_org_id = FND_API.G_MISS_NUM or l_inventory_item_id is null or l_inventory_item_id = FND_API.G_MISS_NUM) then
363: RAISE FND_API.G_EXC_ERROR;
364: end if;
365:
366: -- validate line_org_id, ship_from_org_id, inventory_item_id, rdered_quantity_uom, line_pricelist_id, unit_list_price, unit_selling_price
367: if (l_line_org_id is null OR l_line_org_id = FND_API.G_MISS_NUM or l_inventory_item_id is null or l_inventory_item_id = FND_API.G_MISS_NUM) then
368: X_RETURN_STATUS := FND_API.G_RET_STS_ERROR;
369: FND_MESSAGE.SET_NAME('IBU','IBU_RET_REF_LINE_INVALID)');
370: FND_MSG_PUB.Add;
371: RAISE FND_API.G_EXC_ERROR;
364: end if;
365:
366: -- validate line_org_id, ship_from_org_id, inventory_item_id, rdered_quantity_uom, line_pricelist_id, unit_list_price, unit_selling_price
367: if (l_line_org_id is null OR l_line_org_id = FND_API.G_MISS_NUM or l_inventory_item_id is null or l_inventory_item_id = FND_API.G_MISS_NUM) then
368: X_RETURN_STATUS := FND_API.G_RET_STS_ERROR;
369: FND_MESSAGE.SET_NAME('IBU','IBU_RET_REF_LINE_INVALID)');
370: FND_MSG_PUB.Add;
371: RAISE FND_API.G_EXC_ERROR;
372: end if;
367: if (l_line_org_id is null OR l_line_org_id = FND_API.G_MISS_NUM or l_inventory_item_id is null or l_inventory_item_id = FND_API.G_MISS_NUM) then
368: X_RETURN_STATUS := FND_API.G_RET_STS_ERROR;
369: FND_MESSAGE.SET_NAME('IBU','IBU_RET_REF_LINE_INVALID)');
370: FND_MSG_PUB.Add;
371: RAISE FND_API.G_EXC_ERROR;
372: end if;
373:
374: if (l_ordered_quantity_uom is null or l_ordered_quantity_uom = FND_API.G_MISS_CHAR or l_line_price_list_id is null or l_line_price_list_id = FND_API.G_MISS_NUM) then
375: X_RETURN_STATUS := FND_API.G_RET_STS_ERROR;
370: FND_MSG_PUB.Add;
371: RAISE FND_API.G_EXC_ERROR;
372: end if;
373:
374: if (l_ordered_quantity_uom is null or l_ordered_quantity_uom = FND_API.G_MISS_CHAR or l_line_price_list_id is null or l_line_price_list_id = FND_API.G_MISS_NUM) then
375: X_RETURN_STATUS := FND_API.G_RET_STS_ERROR;
376: FND_MESSAGE.SET_NAME('IBU','IBU_RET_REF_LINE_INVALID)');
377: FND_MSG_PUB.Add;
378: RAISE FND_API.G_EXC_ERROR;
371: RAISE FND_API.G_EXC_ERROR;
372: end if;
373:
374: if (l_ordered_quantity_uom is null or l_ordered_quantity_uom = FND_API.G_MISS_CHAR or l_line_price_list_id is null or l_line_price_list_id = FND_API.G_MISS_NUM) then
375: X_RETURN_STATUS := FND_API.G_RET_STS_ERROR;
376: FND_MESSAGE.SET_NAME('IBU','IBU_RET_REF_LINE_INVALID)');
377: FND_MSG_PUB.Add;
378: RAISE FND_API.G_EXC_ERROR;
379: end if;
374: if (l_ordered_quantity_uom is null or l_ordered_quantity_uom = FND_API.G_MISS_CHAR or l_line_price_list_id is null or l_line_price_list_id = FND_API.G_MISS_NUM) then
375: X_RETURN_STATUS := FND_API.G_RET_STS_ERROR;
376: FND_MESSAGE.SET_NAME('IBU','IBU_RET_REF_LINE_INVALID)');
377: FND_MSG_PUB.Add;
378: RAISE FND_API.G_EXC_ERROR;
379: end if;
380:
381: if (l_unit_list_price is null or l_unit_list_price = FND_API.G_MISS_NUM or l_unit_selling_price is null or l_unit_selling_price = FND_API.G_MISS_NUM) then
382: X_RETURN_STATUS := FND_API.G_RET_STS_ERROR;
377: FND_MSG_PUB.Add;
378: RAISE FND_API.G_EXC_ERROR;
379: end if;
380:
381: if (l_unit_list_price is null or l_unit_list_price = FND_API.G_MISS_NUM or l_unit_selling_price is null or l_unit_selling_price = FND_API.G_MISS_NUM) then
382: X_RETURN_STATUS := FND_API.G_RET_STS_ERROR;
383: FND_MESSAGE.SET_NAME('IBU','IBU_RET_REF_LINE_INVALID)');
384: FND_MSG_PUB.Add;
385: RAISE FND_API.G_EXC_ERROR;
378: RAISE FND_API.G_EXC_ERROR;
379: end if;
380:
381: if (l_unit_list_price is null or l_unit_list_price = FND_API.G_MISS_NUM or l_unit_selling_price is null or l_unit_selling_price = FND_API.G_MISS_NUM) then
382: X_RETURN_STATUS := FND_API.G_RET_STS_ERROR;
383: FND_MESSAGE.SET_NAME('IBU','IBU_RET_REF_LINE_INVALID)');
384: FND_MSG_PUB.Add;
385: RAISE FND_API.G_EXC_ERROR;
386: end if;
381: if (l_unit_list_price is null or l_unit_list_price = FND_API.G_MISS_NUM or l_unit_selling_price is null or l_unit_selling_price = FND_API.G_MISS_NUM) then
382: X_RETURN_STATUS := FND_API.G_RET_STS_ERROR;
383: FND_MESSAGE.SET_NAME('IBU','IBU_RET_REF_LINE_INVALID)');
384: FND_MSG_PUB.Add;
385: RAISE FND_API.G_EXC_ERROR;
386: end if;
387:
388: --fill in the line related table values
389:
423:
424:
425: l_ibu_ret_line_prpt_info := '';
426:
427: if ( l_qte_line_tbl (i).operation_code <> FND_API.G_MISS_CHAR ) then
428: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'operation_code = ' || l_qte_line_tbl (i).operation_code || ' , ';
429: else
430: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'operation_code = ';
431: end if;
430: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'operation_code = ';
431: end if;
432: aso_debug_pub.add ('IBU: operation_code = ' || l_qte_line_tbl (i).operation_code , 1, 'Y');
433:
434: if ( l_qte_line_tbl (i).org_id <> FND_API.G_MISS_NUM ) then
435: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'org_id = ' || l_qte_line_tbl (i).org_id || ' , ';
436: else
437: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'org_id = ' ;
438: end if;
437: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'org_id = ' ;
438: end if;
439: aso_debug_pub.add ('IBU: org_id = ' || l_qte_line_tbl (i).org_id , 1, 'Y');
440:
441: if ( l_qte_line_tbl (i).line_category_code <> FND_API.G_MISS_CHAR ) then
442: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'line_category_code = ' || l_qte_line_tbl (i).line_category_code || ' , ';
443: else
444: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'line_category_code = ';
445: end if;
444: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'line_category_code = ';
445: end if;
446: aso_debug_pub.add ('IBU: line_category_code = ' || l_qte_line_tbl (i).line_category_code , 1, 'Y');
447:
448: if ( l_qte_line_tbl (i).order_line_type_id <> FND_API.G_MISS_NUM) then
449: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'ord_li_tp_id = ' || l_qte_line_tbl (i).order_line_type_id || ',';
450: else
451: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'ord_li_tp_id = ';
452: end if;
451: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'ord_li_tp_id = ';
452: end if;
453: aso_debug_pub.add ('IBU: ord_li_tp_id = ' || l_qte_line_tbl (i).order_line_type_id , 1, 'Y');
454:
455: if ( l_qte_line_tbl (i).invoice_to_party_site_id <> FND_API.G_MISS_NUM) then
456: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'inv_to_pty_site_id = ' || l_qte_line_tbl (i).invoice_to_party_site_id || ' , ';
457: else
458: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'inv_to_pty_site_id = ';
459: end if;
458: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'inv_to_pty_site_id = ';
459: end if;
460: aso_debug_pub.add ('IBU: inv_to_pty_site_id = ' || l_qte_line_tbl (i).invoice_to_party_site_id , 1, 'Y');
461:
462: if ( l_qte_line_tbl (i).inventory_item_id <> FND_API.G_MISS_NUM) then
463: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'inv_item_id = ' || l_qte_line_tbl (i).inventory_item_id || ' , ';
464: else
465: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'inv_item_id = ';
466: end if;
465: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'inv_item_id = ';
466: end if;
467: aso_debug_pub.add ('IBU: inv_item_id = ' || l_qte_line_tbl (i).inventory_item_id , 1, 'Y');
468:
469: if ( l_qte_line_tbl (i).quantity <> FND_API.G_MISS_NUM) then
470: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'quantity = ' || l_qte_line_tbl (i).quantity || ' , ';
471: else
472: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'quantity = ';
473: end if;
472: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'quantity = ';
473: end if;
474: aso_debug_pub.add ('IBU: quantity = ' || l_qte_line_tbl (i).quantity , 1, 'Y');
475:
476: if ( l_qte_line_tbl (i).uom_code <> FND_API.G_MISS_CHAR ) then
477: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'uom_code = ' || l_qte_line_tbl (i).uom_code || ' , ';
478: else
479: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'uom_code = ';
480: end if;
479: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'uom_code = ';
480: end if;
481: aso_debug_pub.add ('IBU: uom_code = ' || l_qte_line_tbl (i).uom_code , 1, 'Y');
482:
483: if ( l_qte_line_tbl (i).price_list_id <> FND_API.G_MISS_NUM ) then
484: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'price_list_id = ' || l_qte_line_tbl (i).price_list_id || ' , ';
485: else
486: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'price_list_id = ';
487: end if;
486: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'price_list_id = ';
487: end if;
488: aso_debug_pub.add ('IBU: price_list_id = ' || l_qte_line_tbl (i).price_list_id , 1, 'Y');
489:
490: if ( l_qte_line_tbl (i).line_list_price <> FND_API.G_MISS_NUM ) then
491: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'line_list_price = ' || l_qte_line_tbl (i).line_list_price || ' , ';
492: else
493: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'line_list_price = ' ;
494: end if;
493: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'line_list_price = ' ;
494: end if;
495: aso_debug_pub.add ('IBU: line_list_price = ' || l_qte_line_tbl (i).line_list_price , 1, 'Y');
496:
497: if ( l_qte_line_tbl (i).line_quote_price <> FND_API.G_MISS_NUM ) then
498: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'line_quote_price = ' || l_qte_line_tbl (i).line_quote_price || ' , ';
499: else
500: l_ibu_ret_line_info := l_ibu_ret_line_prpt_info || 'line_quote_price = ';
501: end if;
504: l_ibu_ret_line_dtl_prpt_info := 'l_qte_line_dtl_tbl(' || i || '): ';
505: aso_debug_pub.add ('IBU: l_qte_line_dtl_tbl(' || i || '): ' , 1, 'Y');
506:
507: l_ibu_ret_line_dtl_prpt_info := '';
508: if ( l_qte_line_dtl_tbl (i).operation_code <> FND_API.G_MISS_CHAR ) then
509: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'operation_code = ' || l_qte_line_dtl_tbl (i).operation_code || ' , ';
510: else
511: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'operation_code = ';
512: end if;
511: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'operation_code = ';
512: end if;
513: aso_debug_pub.add ('IBU: operation_code = ' || l_qte_line_dtl_tbl (i).operation_code , 1, 'Y');
514:
515: if ( l_qte_line_dtl_tbl (i).qte_line_index <> FND_API.G_MISS_NUM) then
516: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'qte_line_index = ' || l_qte_line_dtl_tbl (i).qte_line_index || ' , ';
517: else
518: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'qte_line_index = ' ;
519: end if;
518: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'qte_line_index = ' ;
519: end if;
520: aso_debug_pub.add ('IBU: qte_line_index = ' || l_qte_line_dtl_tbl (i).qte_line_index , 1, 'Y');
521:
522: if ( l_qte_line_dtl_tbl (i).return_ref_type <> FND_API.G_MISS_CHAR ) then
523: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'ret_ref_type = ' || l_qte_line_dtl_tbl (i).return_ref_type || ' , ';
524: else
525: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'ret_ref_type = ';
526: end if;
525: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'ret_ref_type = ';
526: end if;
527: aso_debug_pub.add ('IBU: ret_ref_type = ' || l_qte_line_dtl_tbl (i).return_ref_type , 1, 'Y');
528:
529: if ( l_qte_line_dtl_tbl (i).return_attribute1 <> FND_API.G_MISS_CHAR) then
530: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'return_att1 = ' || l_qte_line_dtl_tbl (i).return_attribute1 || ' , ';
531: else
532: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'return_att1 = ';
533: end if;
532: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'return_att1 = ';
533: end if;
534: aso_debug_pub.add ('IBU: return_att1 = ' || l_qte_line_dtl_tbl (i).return_attribute1 , 1, 'Y');
535:
536: if ( l_qte_line_dtl_tbl (i).return_attribute2 <> FND_API.G_MISS_CHAR) then
537: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'return_att2 = ' || l_qte_line_dtl_tbl (i).return_attribute2 || ' , ';
538: else
539: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'return_att2 = ';
540: end if;
539: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'return_att2 = ';
540: end if;
541: aso_debug_pub.add ('IBU: return_att2 = ' || l_qte_line_dtl_tbl (i).return_attribute2 , 1, 'Y');
542:
543: if ( l_qte_line_dtl_tbl (i).return_ref_header_id <> FND_API.G_MISS_NUM) then
544: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'ret_head_id_ = ' || l_qte_line_dtl_tbl (i).return_ref_header_id || ' , ';
545: else
546: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'ret_head_id_ = ' ;
547: end if;
546: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'ret_head_id_ = ' ;
547: end if;
548: aso_debug_pub.add ('IBU: ret_head_id_ = ' || l_qte_line_dtl_tbl (i).return_ref_header_id , 1, 'Y');
549:
550: if ( l_qte_line_dtl_tbl (i).return_ref_line_id <> FND_API.G_MISS_NUM) then
551: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'ret_line_id = ' || l_qte_line_dtl_tbl (i).return_ref_line_id || ' , ';
552: else
553: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'ret_line_id = ';
554: end if;
554: end if;
555: aso_debug_pub.add ('IBU: ret_line_id = ' || l_qte_line_dtl_tbl (i).return_ref_line_id , 1, 'Y');
556:
557:
558: if ( l_qte_line_dtl_tbl (i).return_reason_code <> FND_API.G_MISS_CHAR) then
559: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 're_reas_code = ' || l_qte_line_dtl_tbl (i).return_reason_code || ' , ';
560: else
561: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 're_reas_code = ';
562: end if;
569:
570:
571: l_ibu_ret_line_dtl_prpt_info :='';
572:
573: if ( l_line_shipment_tbl (i).operation_code <> FND_API.G_MISS_CHAR ) then
574:
575: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'op_code = ' || l_line_shipment_tbl (i).operation_code || ' , ';
576: else
577: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'op_code = ';
577: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'op_code = ';
578: end if;
579: aso_debug_pub.add ('IBU: op_code = ' || l_line_shipment_tbl (i).operation_code , 1, 'Y');
580:
581: if ( l_line_shipment_tbl (i).qte_line_index <> FND_API.G_MISS_NUM ) then
582: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'qte_line_index = ' || l_line_shipment_tbl (i).qte_line_index || ' , ';
583: else
584: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'qte_line_index = ';
585: end if;
584: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'qte_line_index = ';
585: end if;
586: aso_debug_pub.add ('IBU: qte_line_index = ' || l_line_shipment_tbl (i).qte_line_index , 1, 'Y');
587:
588: if ( l_line_shipment_tbl (i).quantity <> FND_API.G_MISS_NUM ) then
589: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'quantity = ' || l_line_shipment_tbl (i).quantity || ' , ';
590: else
591: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'quantity = ';
592: end if;
591: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'quantity = ';
592: end if;
593: aso_debug_pub.add ('IBU: quantity = ' || l_line_shipment_tbl (i).quantity , 1, 'Y');
594:
595: if ( l_line_shipment_tbl (i).freight_carrier_code <> FND_API.G_MISS_CHAR) then
596: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'freight_car_code = ' || l_line_shipment_tbl (i).freight_carrier_code || ' , ';
597: else
598: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'freight_car_code = ';
599: end if;
599: end if;
600: aso_debug_pub.add ('IBU: freight_car_code = ' || l_line_shipment_tbl (i).freight_carrier_code , 1, 'Y');
601:
602:
603: if ( l_line_shipment_tbl (i).schedule_ship_date <> FND_API.G_MISS_DATE) then
604: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'sche_ship_date = ' || l_line_shipment_tbl (i).schedule_ship_date || ' , ';
605: else
606: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'sche_ship_date = ' ;
607: end if;
606: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'sche_ship_date = ' ;
607: end if;
608: aso_debug_pub.add ('IBU: sche_ship_date = ' || l_line_shipment_tbl (i).schedule_ship_date , 1, 'Y');
609:
610: if ( l_line_shipment_tbl (i).request_date <> FND_API.G_MISS_DATE) then
611: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'request_date = ' || l_line_shipment_tbl (i).request_date || ' , ';
612: else
613: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'request_date = ' ;
614: end if;
613: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'request_date = ' ;
614: end if;
615: aso_debug_pub.add ('IBU: request_date = ' || l_line_shipment_tbl (i).request_date , 1, 'Y');
616:
617: if ( l_line_shipment_tbl (i).ship_to_party_site_id <> FND_API.G_MISS_NUM) then
618: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'ship_to_pty_site_id = ' || l_line_shipment_tbl (i).ship_to_party_site_id || ' , ';
619: else
620: l_ibu_ret_line_dtl_info := l_ibu_ret_line_dtl_prpt_info || 'ship_to_pty_site_id = ';
621: end if;
624: end loop;
625: end if;
626: l_booked_profile_value := FND_PROFILE.VALUE_WNPS('ASO_DEFAULT_ORDER_STATE');
627: if ( l_booked_profile_value = 'BOOKED' ) then
628: l_control_rec.book_flag := FND_API.G_TRUE;
629: else
630: l_control_rec.book_flag := FND_API.G_FALSE;
631: end if;
632:
626: l_booked_profile_value := FND_PROFILE.VALUE_WNPS('ASO_DEFAULT_ORDER_STATE');
627: if ( l_booked_profile_value = 'BOOKED' ) then
628: l_control_rec.book_flag := FND_API.G_TRUE;
629: else
630: l_control_rec.book_flag := FND_API.G_FALSE;
631: end if;
632:
633: l_ibu_ret_header_prpt_info := 'bk_flg='|| l_control_rec.book_flag ;
634:
635: aso_debug_pub.add ('IBU: ' || l_ibu_ret_header_prpt_info , 1, 'Y');
636:
637: aso_order_int.create_order (
638: p_api_version_number => 1.0,
639: p_init_msg_list => FND_API.G_FALSE,
640: p_commit => FND_API.G_FALSE,
641: p_qte_rec => l_qte_header_rec,
642: p_header_shipment_tbl => l_header_shipment_tbl,
643: p_qte_line_tbl => l_qte_line_tbl,
636:
637: aso_order_int.create_order (
638: p_api_version_number => 1.0,
639: p_init_msg_list => FND_API.G_FALSE,
640: p_commit => FND_API.G_FALSE,
641: p_qte_rec => l_qte_header_rec,
642: p_header_shipment_tbl => l_header_shipment_tbl,
643: p_qte_line_tbl => l_qte_line_tbl,
644: p_qte_line_dtl_tbl => l_qte_line_dtl_tbl,
651: x_msg_data => X_MSG_DATA );
652:
653:
654:
655: if (x_return_status <> FND_API.G_RET_STS_SUCCESS) then
656:
657: RAISE FND_API.G_EXC_ERROR;
658: end if;
659:
653:
654:
655: if (x_return_status <> FND_API.G_RET_STS_SUCCESS) then
656:
657: RAISE FND_API.G_EXC_ERROR;
658: end if;
659:
660: X_RETURN_HEADER_REC.ORDER_NUMBER := l_return_header_rec.order_number;
661: X_RETURN_HEADER_REC.ORDER_HEADER_ID := l_return_header_rec.order_header_id;
669: end loop;
670: end if;
671:
672: -- Standard check of p_commit.
673: IF FND_API.To_Boolean( p_commit ) THEN
674: COMMIT WORK;
675: END IF;
676: -- Standard call to get message count and if count is 1, get message info.
677: FND_MSG_PUB.Count_And_Get
681:
682:
683: EXCEPTION
684:
685: WHEN FND_API.G_EXC_ERROR THEN
686: FND_MESSAGE.SET_NAME('IBU', 'IBU Return Failed' );
687: FND_MSG_PUB.Add;
688: FND_MSG_PUB.Count_And_Get
689: (p_count => x_msg_count ,
691: );
692: /*
693: WHEN OTHERS THEN
694:
695: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
696: IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
697: FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME ,l_api_name);
698:
699: END IF;
738: BEGIN
739:
740: FOR l_count in 1..NVL(p_message_count,0) LOOP
741: if l_count = 1 then
742: l_temp_msg := fnd_msg_pub.get(fnd_msg_pub.g_first, fnd_api.g_true);
743: else
744: l_temp_msg := fnd_msg_pub.get(fnd_msg_pub.g_next, fnd_api.g_true);
745: end if ;
746: fnd_message.parse_encoded(l_temp_msg, l_appl_short_name, l_message_name);
740: FOR l_count in 1..NVL(p_message_count,0) LOOP
741: if l_count = 1 then
742: l_temp_msg := fnd_msg_pub.get(fnd_msg_pub.g_first, fnd_api.g_true);
743: else
744: l_temp_msg := fnd_msg_pub.get(fnd_msg_pub.g_next, fnd_api.g_true);
745: end if ;
746: fnd_message.parse_encoded(l_temp_msg, l_appl_short_name, l_message_name);
747: OPEN Get_Appl_Id (l_appl_short_name);
748: FETCH Get_Appl_Id into l_id;
756: FETCH Get_Message_Num into l_message_num;
757: CLOSE Get_Message_Num;
758: END IF;
759:
760: l_temp_msg := fnd_msg_pub.get(fnd_msg_pub.g_previous, fnd_api.g_true);
761:
762: IF NVL(l_message_num, 0) <> 0
763: THEN
764: l_temp_msg := 'APP-' || to_char(l_message_num) || ': ';
768:
769: IF l_count = 1
770: THEN
771: l_msg_list := l_msg_list || l_temp_msg ||
772: fnd_msg_pub.get(fnd_msg_pub.g_first, fnd_api.g_false);
773: ELSE
774: l_msg_list := l_msg_list || l_temp_msg ||
775: fnd_msg_pub.get(fnd_msg_pub.g_next, fnd_api.g_false);
776: END IF;
771: l_msg_list := l_msg_list || l_temp_msg ||
772: fnd_msg_pub.get(fnd_msg_pub.g_first, fnd_api.g_false);
773: ELSE
774: l_msg_list := l_msg_list || l_temp_msg ||
775: fnd_msg_pub.get(fnd_msg_pub.g_next, fnd_api.g_false);
776: END IF;
777:
778: l_msg_list := l_msg_list || '
779: ';
799: FUNCTION GET_RETURN_LINES_TOTAL(
800: P_HEADER_ID IN NUMBER)
801: RETURN NUMBER
802: IS
803: l_Total NUMBER := FND_API.G_MISS_NUM;
804:
805: CURSOR ALL_HEADER_LINES (c_header_id NUMBER) IS
806: SELECT LINE_ID, LINE_NUMBER
807: FROM ASO_I_OE_ORDER_LINES_V
816: LOOP
817: FETCH ALL_HEADER_LINES INTO l_line_id, l_line_no;
818: EXIT WHEN ALL_HEADER_LINES%NOTFOUND;
819:
820: IF (l_Total = FND_API.G_MISS_NUM) THEN
821: l_Total := 0;
822: END IF;
823:
824: l_Total := l_Total + OE_OE_TOTALS_SUMMARY.LINE_TOTAL(
833: RETURN (l_Total);
834:
835: EXCEPTION
836: WHEN no_data_found THEN
837: l_Total := FND_API.G_MISS_NUM;
838:
839: IF ALL_HEADER_LINES%ISOPEN then
840: CLOSE ALL_HEADER_LINES;
841: END IF;
838:
839: IF ALL_HEADER_LINES%ISOPEN then
840: CLOSE ALL_HEADER_LINES;
841: END IF;
842: return FND_API.G_MISS_NUM;
843:
844: WHEN too_many_rows THEN
845: --RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
846: IF ALL_HEADER_LINES%ISOPEN then
841: END IF;
842: return FND_API.G_MISS_NUM;
843:
844: WHEN too_many_rows THEN
845: --RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
846: IF ALL_HEADER_LINES%ISOPEN then
847: CLOSE ALL_HEADER_LINES;
848: END IF;
849: return FND_API.G_MISS_NUM;
845: --RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
846: IF ALL_HEADER_LINES%ISOPEN then
847: CLOSE ALL_HEADER_LINES;
848: END IF;
849: return FND_API.G_MISS_NUM;
850: WHEN others THEN
851: --RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
852: IF ALL_HEADER_LINES%ISOPEN then
853: CLOSE ALL_HEADER_LINES;
847: CLOSE ALL_HEADER_LINES;
848: END IF;
849: return FND_API.G_MISS_NUM;
850: WHEN others THEN
851: --RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
852: IF ALL_HEADER_LINES%ISOPEN then
853: CLOSE ALL_HEADER_LINES;
854: END IF;
855: return FND_API.G_MISS_NUM;
851: --RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
852: IF ALL_HEADER_LINES%ISOPEN then
853: CLOSE ALL_HEADER_LINES;
854: END IF;
855: return FND_API.G_MISS_NUM;
856:
857:
858: END GET_RETURN_LINES_TOTAL;
859: