72: END IF;
73:
74: x_return_status := FND_API.g_ret_sts_success;
75:
76: IF aso_debug_pub.g_debug_flag = 'Y' THEN
77: aso_debug_pub.add('Check_Tca: begin', 1, 'N');
78: aso_debug_pub.add('Check_Tca: p_qte_rec.party_id: '||p_qte_rec.party_id, 1, 'N');
79: aso_debug_pub.add('Check_Tca: p_qte_rec.cust_party_id: '||p_qte_rec.cust_party_id, 1, 'N');
80: aso_debug_pub.add('Check_Tca: p_qte_rec.cust_account_id: '||p_qte_rec.cust_account_id, 1, 'N');
73:
74: x_return_status := FND_API.g_ret_sts_success;
75:
76: IF aso_debug_pub.g_debug_flag = 'Y' THEN
77: aso_debug_pub.add('Check_Tca: begin', 1, 'N');
78: aso_debug_pub.add('Check_Tca: p_qte_rec.party_id: '||p_qte_rec.party_id, 1, 'N');
79: aso_debug_pub.add('Check_Tca: p_qte_rec.cust_party_id: '||p_qte_rec.cust_party_id, 1, 'N');
80: aso_debug_pub.add('Check_Tca: p_qte_rec.cust_account_id: '||p_qte_rec.cust_account_id, 1, 'N');
81: END IF;
74: x_return_status := FND_API.g_ret_sts_success;
75:
76: IF aso_debug_pub.g_debug_flag = 'Y' THEN
77: aso_debug_pub.add('Check_Tca: begin', 1, 'N');
78: aso_debug_pub.add('Check_Tca: p_qte_rec.party_id: '||p_qte_rec.party_id, 1, 'N');
79: aso_debug_pub.add('Check_Tca: p_qte_rec.cust_party_id: '||p_qte_rec.cust_party_id, 1, 'N');
80: aso_debug_pub.add('Check_Tca: p_qte_rec.cust_account_id: '||p_qte_rec.cust_account_id, 1, 'N');
81: END IF;
82:
75:
76: IF aso_debug_pub.g_debug_flag = 'Y' THEN
77: aso_debug_pub.add('Check_Tca: begin', 1, 'N');
78: aso_debug_pub.add('Check_Tca: p_qte_rec.party_id: '||p_qte_rec.party_id, 1, 'N');
79: aso_debug_pub.add('Check_Tca: p_qte_rec.cust_party_id: '||p_qte_rec.cust_party_id, 1, 'N');
80: aso_debug_pub.add('Check_Tca: p_qte_rec.cust_account_id: '||p_qte_rec.cust_account_id, 1, 'N');
81: END IF;
82:
83: IF (p_application_type_code = 'QUOTING HTML' AND p_operation_code = 'UPDATE') THEN
76: IF aso_debug_pub.g_debug_flag = 'Y' THEN
77: aso_debug_pub.add('Check_Tca: begin', 1, 'N');
78: aso_debug_pub.add('Check_Tca: p_qte_rec.party_id: '||p_qte_rec.party_id, 1, 'N');
79: aso_debug_pub.add('Check_Tca: p_qte_rec.cust_party_id: '||p_qte_rec.cust_party_id, 1, 'N');
80: aso_debug_pub.add('Check_Tca: p_qte_rec.cust_account_id: '||p_qte_rec.cust_account_id, 1, 'N');
81: END IF;
82:
83: IF (p_application_type_code = 'QUOTING HTML' AND p_operation_code = 'UPDATE') THEN
84: l_qte_header_rec := ASO_UTILITY_PVT.query_header_row (p_qte_rec.quote_header_id);
199: END IF;
200:
201: END IF; -- party_id is null
202:
203: IF aso_debug_pub.g_debug_flag = 'Y' THEN
204: aso_debug_pub.add('Check_Tca: p_qte_rec.party_id: '||p_qte_rec.party_id, 1, 'N');
205: END IF;
206:
207: IF p_qte_rec.party_id IS NOT NULL AND p_qte_rec.party_id <> FND_API.G_MISS_NUM THEN
200:
201: END IF; -- party_id is null
202:
203: IF aso_debug_pub.g_debug_flag = 'Y' THEN
204: aso_debug_pub.add('Check_Tca: p_qte_rec.party_id: '||p_qte_rec.party_id, 1, 'N');
205: END IF;
206:
207: IF p_qte_rec.party_id IS NOT NULL AND p_qte_rec.party_id <> FND_API.G_MISS_NUM THEN
208:
211: OPEN C_Party_Type(p_qte_rec.party_id);
212: FETCH C_Party_Type INTO l_party_type;
213: CLOSE C_Party_Type;
214:
215: IF aso_debug_pub.g_debug_flag = 'Y' THEN
216: aso_debug_pub.add('Check_Tca: l_party_type: '||l_party_type, 1, 'N');
217: END IF;
218:
219: IF l_party_type = 'PERSON' OR l_party_type = 'ORGANIZATION' THEN
212: FETCH C_Party_Type INTO l_party_type;
213: CLOSE C_Party_Type;
214:
215: IF aso_debug_pub.g_debug_flag = 'Y' THEN
216: aso_debug_pub.add('Check_Tca: l_party_type: '||l_party_type, 1, 'N');
217: END IF;
218:
219: IF l_party_type = 'PERSON' OR l_party_type = 'ORGANIZATION' THEN
220:
229: END IF;
230:
231: END IF; -- cust_party_id
232:
233: IF aso_debug_pub.g_debug_flag = 'Y' THEN
234: aso_debug_pub.add('Check_Tca: p_qte_rec.cust_party_id: '||p_qte_rec.cust_party_id, 1, 'N');
235: END IF;
236:
237: IF p_qte_rec.cust_account_id IS NULL OR p_qte_rec.cust_account_id = FND_API.G_MISS_NUM THEN
230:
231: END IF; -- cust_party_id
232:
233: IF aso_debug_pub.g_debug_flag = 'Y' THEN
234: aso_debug_pub.add('Check_Tca: p_qte_rec.cust_party_id: '||p_qte_rec.cust_party_id, 1, 'N');
235: END IF;
236:
237: IF p_qte_rec.cust_account_id IS NULL OR p_qte_rec.cust_account_id = FND_API.G_MISS_NUM THEN
238:
235: END IF;
236:
237: IF p_qte_rec.cust_account_id IS NULL OR p_qte_rec.cust_account_id = FND_API.G_MISS_NUM THEN
238:
239: IF aso_debug_pub.g_debug_flag = 'Y' THEN
240: aso_debug_pub.add('Check_Tca: before customer account:p_qte_rec.party_id '||p_qte_rec.party_id, 1, 'N');
241: END IF;
242:
243: Customer_Account(
236:
237: IF p_qte_rec.cust_account_id IS NULL OR p_qte_rec.cust_account_id = FND_API.G_MISS_NUM THEN
238:
239: IF aso_debug_pub.g_debug_flag = 'Y' THEN
240: aso_debug_pub.add('Check_Tca: before customer account:p_qte_rec.party_id '||p_qte_rec.party_id, 1, 'N');
241: END IF;
242:
243: Customer_Account(
244: p_api_version => 1.0,
248: x_return_status => x_return_status,
249: x_msg_count => x_msg_count,
250: x_msg_data => x_msg_data);
251:
252: IF aso_debug_pub.g_debug_flag = 'Y' THEN
253: aso_debug_pub.add('Check_Tca: after customer account:x_Return_Status '||x_Return_Status, 1, 'N');
254: END IF;
255: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
256: raise FND_API.G_EXC_ERROR;
249: x_msg_count => x_msg_count,
250: x_msg_data => x_msg_data);
251:
252: IF aso_debug_pub.g_debug_flag = 'Y' THEN
253: aso_debug_pub.add('Check_Tca: after customer account:x_Return_Status '||x_Return_Status, 1, 'N');
254: END IF;
255: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
256: raise FND_API.G_EXC_ERROR;
257: END IF;
257: END IF;
258:
259: END IF; -- cust_account_id
260:
261: IF aso_debug_pub.g_debug_flag = 'Y' THEN
262: aso_debug_pub.add('Check_Tca: p_qte_rec.cust_account_id: '||p_qte_rec.cust_account_id, 1, 'N');
263: END IF;
264:
265: END IF; -- party_id is not null
258:
259: END IF; -- cust_account_id
260:
261: IF aso_debug_pub.g_debug_flag = 'Y' THEN
262: aso_debug_pub.add('Check_Tca: p_qte_rec.cust_account_id: '||p_qte_rec.cust_account_id, 1, 'N');
263: END IF;
264:
265: END IF; -- party_id is not null
266:
266:
267: lx_cust_account_id := p_qte_rec.cust_account_id;
268:
269: IF lx_cust_account_id IS NOT NULL AND lx_cust_account_id <> FND_API.G_MISS_NUM THEN
270: IF aso_debug_pub.g_debug_flag = 'Y' THEN
271: aso_debug_pub.add('before org contact', 1, 'N');
272: END IF;
273: IF p_qte_rec.party_id is not null and
274: p_qte_rec.party_id <> FND_API.G_MISS_NUM THEN
267: lx_cust_account_id := p_qte_rec.cust_account_id;
268:
269: IF lx_cust_account_id IS NOT NULL AND lx_cust_account_id <> FND_API.G_MISS_NUM THEN
270: IF aso_debug_pub.g_debug_flag = 'Y' THEN
271: aso_debug_pub.add('before org contact', 1, 'N');
272: END IF;
273: IF p_qte_rec.party_id is not null and
274: p_qte_rec.party_id <> FND_API.G_MISS_NUM THEN
275:
272: END IF;
273: IF p_qte_rec.party_id is not null and
274: p_qte_rec.party_id <> FND_API.G_MISS_NUM THEN
275:
276: IF aso_debug_pub.g_debug_flag = 'Y' THEN
277: aso_debug_pub.add('before org contact:p_qte_rec.org_contact_id: '||p_qte_rec.org_contact_id, 1, 'N');
278: END IF;
279: IF p_qte_rec.org_contact_id is NULL OR
280: p_qte_rec.org_contact_id = FND_API.G_MISS_NUM THEN
273: IF p_qte_rec.party_id is not null and
274: p_qte_rec.party_id <> FND_API.G_MISS_NUM THEN
275:
276: IF aso_debug_pub.g_debug_flag = 'Y' THEN
277: aso_debug_pub.add('before org contact:p_qte_rec.org_contact_id: '||p_qte_rec.org_contact_id, 1, 'N');
278: END IF;
279: IF p_qte_rec.org_contact_id is NULL OR
280: p_qte_rec.org_contact_id = FND_API.G_MISS_NUM THEN
281: ASO_MAP_QUOTE_ORDER_INT.get_org_contact(p_party_id => p_qte_rec.party_id,
279: IF p_qte_rec.org_contact_id is NULL OR
280: p_qte_rec.org_contact_id = FND_API.G_MISS_NUM THEN
281: ASO_MAP_QUOTE_ORDER_INT.get_org_contact(p_party_id => p_qte_rec.party_id,
282: x_org_contact => l_org_contact);
283: IF aso_debug_pub.g_debug_flag = 'Y' THEN
284: aso_debug_pub.add('after org contact:l_org_contact: '||l_org_contact, 1, 'N');
285: END IF;
286: ELSE
287: l_org_contact := p_qte_rec.org_contact_id;
280: p_qte_rec.org_contact_id = FND_API.G_MISS_NUM THEN
281: ASO_MAP_QUOTE_ORDER_INT.get_org_contact(p_party_id => p_qte_rec.party_id,
282: x_org_contact => l_org_contact);
283: IF aso_debug_pub.g_debug_flag = 'Y' THEN
284: aso_debug_pub.add('after org contact:l_org_contact: '||l_org_contact, 1, 'N');
285: END IF;
286: ELSE
287: l_org_contact := p_qte_rec.org_contact_id;
288: END IF;
286: ELSE
287: l_org_contact := p_qte_rec.org_contact_id;
288: END IF;
289: IF l_org_contact is not NULL AND l_org_contact <> FND_API.G_MISS_NUM THEN
290: IF aso_debug_pub.g_debug_flag = 'Y' THEN
291: aso_debug_pub.add('deriving org_contact_role:l_org_contact: ' || l_org_contact,1, 'N');
292: END IF;
293: ASO_MAP_QUOTE_ORDER_INT.get_org_contact_role(
294: p_Org_Contact_Id => l_org_contact
287: l_org_contact := p_qte_rec.org_contact_id;
288: END IF;
289: IF l_org_contact is not NULL AND l_org_contact <> FND_API.G_MISS_NUM THEN
290: IF aso_debug_pub.g_debug_flag = 'Y' THEN
291: aso_debug_pub.add('deriving org_contact_role:l_org_contact: ' || l_org_contact,1, 'N');
292: END IF;
293: ASO_MAP_QUOTE_ORDER_INT.get_org_contact_role(
294: p_Org_Contact_Id => l_org_contact
295: ,p_Cust_account_id => lx_cust_account_id
296: ,x_return_status => x_return_status
297: ,x_party_id => l_org_contact_party_id
298: ,x_cust_account_role_id => l_sold_to_contact_id
299: );
300: IF aso_debug_pub.g_debug_flag = 'Y' THEN
301: aso_debug_pub.add('after get org contact. l_org_contact_party_id = ' || l_org_contact_party_id ,1, 'N');
302: aso_debug_pub.add('after get org contact. sold_to_contact_id = ' || l_sold_to_contact_id ,1, 'N');
303: END IF;
304: if p_qte_rec.org_contact_id is not null and p_qte_rec.org_contact_id <> FND_API.G_MISS_NUM then
297: ,x_party_id => l_org_contact_party_id
298: ,x_cust_account_role_id => l_sold_to_contact_id
299: );
300: IF aso_debug_pub.g_debug_flag = 'Y' THEN
301: aso_debug_pub.add('after get org contact. l_org_contact_party_id = ' || l_org_contact_party_id ,1, 'N');
302: aso_debug_pub.add('after get org contact. sold_to_contact_id = ' || l_sold_to_contact_id ,1, 'N');
303: END IF;
304: if p_qte_rec.org_contact_id is not null and p_qte_rec.org_contact_id <> FND_API.G_MISS_NUM then
305: p_qte_rec.party_id := l_org_contact_party_id;
298: ,x_cust_account_role_id => l_sold_to_contact_id
299: );
300: IF aso_debug_pub.g_debug_flag = 'Y' THEN
301: aso_debug_pub.add('after get org contact. l_org_contact_party_id = ' || l_org_contact_party_id ,1, 'N');
302: aso_debug_pub.add('after get org contact. sold_to_contact_id = ' || l_sold_to_contact_id ,1, 'N');
303: END IF;
304: if p_qte_rec.org_contact_id is not null and p_qte_rec.org_contact_id <> FND_API.G_MISS_NUM then
305: p_qte_rec.party_id := l_org_contact_party_id;
306: end if;
313: raise FND_API.G_EXC_ERROR;
314: END IF;
315: IF l_sold_to_contact_id is NULL OR
316: l_sold_to_contact_id = FND_API.G_MISS_NUM THEN
317: IF aso_debug_pub.g_debug_flag = 'Y' THEN
318: aso_debug_pub.add('calling create contact role for org contact ',1, 'N');
319: END IF;
320: ASO_PARTY_INT.Create_Contact_Role (
321: p_api_version => 1.0
314: END IF;
315: IF l_sold_to_contact_id is NULL OR
316: l_sold_to_contact_id = FND_API.G_MISS_NUM THEN
317: IF aso_debug_pub.g_debug_flag = 'Y' THEN
318: aso_debug_pub.add('calling create contact role for org contact ',1, 'N');
319: END IF;
320: ASO_PARTY_INT.Create_Contact_Role (
321: p_api_version => 1.0
322: ,p_party_id =>l_org_contact_party_id
325: ,x_msg_count => x_msg_count
326: ,x_msg_data => x_msg_data
327: ,x_cust_account_role_id => l_sold_to_contact_id
328: );
329: IF aso_debug_pub.g_debug_flag = 'Y' THEN
330: aso_debug_pub.add('after create contact role. sold_to_contact_id = ' || l_sold_to_contact_id ,1, 'N');
331: aso_debug_pub.add('after create contact role. x_return_status = ' || x_return_status ,1, 'N');
332: END IF;
333: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
326: ,x_msg_data => x_msg_data
327: ,x_cust_account_role_id => l_sold_to_contact_id
328: );
329: IF aso_debug_pub.g_debug_flag = 'Y' THEN
330: aso_debug_pub.add('after create contact role. sold_to_contact_id = ' || l_sold_to_contact_id ,1, 'N');
331: aso_debug_pub.add('after create contact role. x_return_status = ' || x_return_status ,1, 'N');
332: END IF;
333: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
334: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
327: ,x_cust_account_role_id => l_sold_to_contact_id
328: );
329: IF aso_debug_pub.g_debug_flag = 'Y' THEN
330: aso_debug_pub.add('after create contact role. sold_to_contact_id = ' || l_sold_to_contact_id ,1, 'N');
331: aso_debug_pub.add('after create contact role. x_return_status = ' || x_return_status ,1, 'N');
332: END IF;
333: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
334: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
335: FND_MESSAGE.Set_Name('ASO', 'ASO_ORG_CONTACT');
345: END IF;
346:
347: END IF; -- lx_cust_account not null
348:
349: IF aso_debug_pub.g_debug_flag = 'Y' THEN
350: aso_debug_pub.add('before check hdr info ',1, 'N');
351: END IF;
352: check_header_account_info(
353: p_api_version => 1.0,
346:
347: END IF; -- lx_cust_account not null
348:
349: IF aso_debug_pub.g_debug_flag = 'Y' THEN
350: aso_debug_pub.add('before check hdr info ',1, 'N');
351: END IF;
352: check_header_account_info(
353: p_api_version => 1.0,
354: p_init_msg_list => p_init_msg_list,
358: x_return_status => x_return_status,
359: x_msg_count => x_msg_count,
360: x_msg_data => x_msg_data );
361:
362: IF aso_debug_pub.g_debug_flag = 'Y' THEN
363: aso_debug_pub.add('after check hdr info:x_return_status: '||x_return_status,1, 'N');
364: END IF;
365: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
366: raise FND_API.G_EXC_ERROR;
359: x_msg_count => x_msg_count,
360: x_msg_data => x_msg_data );
361:
362: IF aso_debug_pub.g_debug_flag = 'Y' THEN
363: aso_debug_pub.add('after check hdr info:x_return_status: '||x_return_status,1, 'N');
364: END IF;
365: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
366: raise FND_API.G_EXC_ERROR;
367: END IF;
480: END IF;
481:
482: x_return_status := FND_API.g_ret_sts_success;
483:
484: IF aso_debug_pub.g_debug_flag = 'Y' THEN
485: aso_debug_pub.add('Check_Hdr_Acct: begin ', 1, 'Y');
486: aso_debug_pub.add('Check_Hdr_Acct: before sold to party site id '|| p_qte_rec.sold_to_party_site_id, 1, 'N');
487: aso_debug_pub.add('Check_Hdr_Acct: p_qte_rec.invoice_to_cust_account_id: '|| p_qte_rec.invoice_to_cust_account_id, 1, 'N');
488: aso_debug_pub.add('Check_Hdr_Acct: p_qte_rec.invoice_to_cust_party_id: '|| p_qte_rec.invoice_to_cust_party_id, 1, 'N');
481:
482: x_return_status := FND_API.g_ret_sts_success;
483:
484: IF aso_debug_pub.g_debug_flag = 'Y' THEN
485: aso_debug_pub.add('Check_Hdr_Acct: begin ', 1, 'Y');
486: aso_debug_pub.add('Check_Hdr_Acct: before sold to party site id '|| p_qte_rec.sold_to_party_site_id, 1, 'N');
487: aso_debug_pub.add('Check_Hdr_Acct: p_qte_rec.invoice_to_cust_account_id: '|| p_qte_rec.invoice_to_cust_account_id, 1, 'N');
488: aso_debug_pub.add('Check_Hdr_Acct: p_qte_rec.invoice_to_cust_party_id: '|| p_qte_rec.invoice_to_cust_party_id, 1, 'N');
489: aso_debug_pub.add('Check_Hdr_Acct: p_qte_rec.invoice_to_party_site_id: '|| p_qte_rec.invoice_to_party_site_id, 1, 'N');
482: x_return_status := FND_API.g_ret_sts_success;
483:
484: IF aso_debug_pub.g_debug_flag = 'Y' THEN
485: aso_debug_pub.add('Check_Hdr_Acct: begin ', 1, 'Y');
486: aso_debug_pub.add('Check_Hdr_Acct: before sold to party site id '|| p_qte_rec.sold_to_party_site_id, 1, 'N');
487: aso_debug_pub.add('Check_Hdr_Acct: p_qte_rec.invoice_to_cust_account_id: '|| p_qte_rec.invoice_to_cust_account_id, 1, 'N');
488: aso_debug_pub.add('Check_Hdr_Acct: p_qte_rec.invoice_to_cust_party_id: '|| p_qte_rec.invoice_to_cust_party_id, 1, 'N');
489: aso_debug_pub.add('Check_Hdr_Acct: p_qte_rec.invoice_to_party_site_id: '|| p_qte_rec.invoice_to_party_site_id, 1, 'N');
490: END IF;
483:
484: IF aso_debug_pub.g_debug_flag = 'Y' THEN
485: aso_debug_pub.add('Check_Hdr_Acct: begin ', 1, 'Y');
486: aso_debug_pub.add('Check_Hdr_Acct: before sold to party site id '|| p_qte_rec.sold_to_party_site_id, 1, 'N');
487: aso_debug_pub.add('Check_Hdr_Acct: p_qte_rec.invoice_to_cust_account_id: '|| p_qte_rec.invoice_to_cust_account_id, 1, 'N');
488: aso_debug_pub.add('Check_Hdr_Acct: p_qte_rec.invoice_to_cust_party_id: '|| p_qte_rec.invoice_to_cust_party_id, 1, 'N');
489: aso_debug_pub.add('Check_Hdr_Acct: p_qte_rec.invoice_to_party_site_id: '|| p_qte_rec.invoice_to_party_site_id, 1, 'N');
490: END IF;
491:
484: IF aso_debug_pub.g_debug_flag = 'Y' THEN
485: aso_debug_pub.add('Check_Hdr_Acct: begin ', 1, 'Y');
486: aso_debug_pub.add('Check_Hdr_Acct: before sold to party site id '|| p_qte_rec.sold_to_party_site_id, 1, 'N');
487: aso_debug_pub.add('Check_Hdr_Acct: p_qte_rec.invoice_to_cust_account_id: '|| p_qte_rec.invoice_to_cust_account_id, 1, 'N');
488: aso_debug_pub.add('Check_Hdr_Acct: p_qte_rec.invoice_to_cust_party_id: '|| p_qte_rec.invoice_to_cust_party_id, 1, 'N');
489: aso_debug_pub.add('Check_Hdr_Acct: p_qte_rec.invoice_to_party_site_id: '|| p_qte_rec.invoice_to_party_site_id, 1, 'N');
490: END IF;
491:
492: IF p_qte_rec.sold_to_party_site_id is not NULL
485: aso_debug_pub.add('Check_Hdr_Acct: begin ', 1, 'Y');
486: aso_debug_pub.add('Check_Hdr_Acct: before sold to party site id '|| p_qte_rec.sold_to_party_site_id, 1, 'N');
487: aso_debug_pub.add('Check_Hdr_Acct: p_qte_rec.invoice_to_cust_account_id: '|| p_qte_rec.invoice_to_cust_account_id, 1, 'N');
488: aso_debug_pub.add('Check_Hdr_Acct: p_qte_rec.invoice_to_cust_party_id: '|| p_qte_rec.invoice_to_cust_party_id, 1, 'N');
489: aso_debug_pub.add('Check_Hdr_Acct: p_qte_rec.invoice_to_party_site_id: '|| p_qte_rec.invoice_to_party_site_id, 1, 'N');
490: END IF;
491:
492: IF p_qte_rec.sold_to_party_site_id is not NULL
493: AND p_qte_rec.sold_to_party_site_id <> FND_API.G_MISS_NUM THEN
493: AND p_qte_rec.sold_to_party_site_id <> FND_API.G_MISS_NUM THEN
494:
495: OPEN C_Site_Use(p_qte_rec.sold_to_party_site_id);
496: FETCH C_Site_Use INTO l_party_site_use_id;
497: IF aso_debug_pub.g_debug_flag = 'Y' THEN
498: aso_debug_pub.add('chk_hdr:party_site_use_id = ' || l_party_site_use_id,1,'N');
499: END IF;
500: IF C_Site_Use%NOTFOUND THEN
501: ASO_PARTY_INT.Create_Party_Site_Use(
494:
495: OPEN C_Site_Use(p_qte_rec.sold_to_party_site_id);
496: FETCH C_Site_Use INTO l_party_site_use_id;
497: IF aso_debug_pub.g_debug_flag = 'Y' THEN
498: aso_debug_pub.add('chk_hdr:party_site_use_id = ' || l_party_site_use_id,1,'N');
499: END IF;
500: IF C_Site_Use%NOTFOUND THEN
501: ASO_PARTY_INT.Create_Party_Site_Use(
502: p_api_version => 1.0,
506: x_return_status => x_return_status,
507: x_msg_count => x_msg_count,
508: x_msg_data => x_msg_data);
509:
510: IF aso_debug_pub.g_debug_flag = 'Y' THEN
511: aso_debug_pub.add('chk_hdr:party_site_use_id after sold_to = ' || l_party_site_use_id,1,'N');
512: END IF;
513: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
514: raise FND_API.G_EXC_ERROR;
507: x_msg_count => x_msg_count,
508: x_msg_data => x_msg_data);
509:
510: IF aso_debug_pub.g_debug_flag = 'Y' THEN
511: aso_debug_pub.add('chk_hdr:party_site_use_id after sold_to = ' || l_party_site_use_id,1,'N');
512: END IF;
513: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
514: raise FND_API.G_EXC_ERROR;
515: END IF;
527: x_return_status => x_return_status,
528: x_msg_count => x_msg_count,
529: x_msg_data => x_msg_data );
530:
531: IF aso_debug_pub.g_debug_flag = 'Y' THEN
532: aso_debug_pub.add('chk_hdr:after populate_acct_party: ' || x_return_status,1,'N');
533: END IF;
534: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
535: raise FND_API.G_EXC_ERROR;
528: x_msg_count => x_msg_count,
529: x_msg_data => x_msg_data );
530:
531: IF aso_debug_pub.g_debug_flag = 'Y' THEN
532: aso_debug_pub.add('chk_hdr:after populate_acct_party: ' || x_return_status,1,'N');
533: END IF;
534: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
535: raise FND_API.G_EXC_ERROR;
536: END IF;
540: (p_qte_rec.invoice_to_cust_account_id IS NULL OR
541: p_qte_rec.invoice_to_cust_account_id = FND_API.G_MISS_NUM) THEN
542:
543:
544: IF aso_debug_pub.g_debug_flag = 'Y' THEN
545: aso_debug_pub.add('Check_Tca: before customer account:p_qte_rec.invoice_to_cust_party_id '
546: ||p_qte_rec.invoice_to_cust_party_id, 1, 'N');
547: END IF;
548: Customer_Account(
541: p_qte_rec.invoice_to_cust_account_id = FND_API.G_MISS_NUM) THEN
542:
543:
544: IF aso_debug_pub.g_debug_flag = 'Y' THEN
545: aso_debug_pub.add('Check_Tca: before customer account:p_qte_rec.invoice_to_cust_party_id '
546: ||p_qte_rec.invoice_to_cust_party_id, 1, 'N');
547: END IF;
548: Customer_Account(
549: p_api_version => 1.0,
553: x_return_status => x_return_status,
554: x_msg_count => x_msg_count,
555: x_msg_data => x_msg_data);
556:
557: IF aso_debug_pub.g_debug_flag = 'Y' THEN
558: aso_debug_pub.add('Check_Tca: after customer account:x_Return_Status '
559: ||x_Return_Status, 1, 'N');
560: END IF;
561: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
554: x_msg_count => x_msg_count,
555: x_msg_data => x_msg_data);
556:
557: IF aso_debug_pub.g_debug_flag = 'Y' THEN
558: aso_debug_pub.add('Check_Tca: after customer account:x_Return_Status '
559: ||x_Return_Status, 1, 'N');
560: END IF;
561: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
562: raise FND_API.G_EXC_ERROR;
563: END IF;
564:
565: END IF; -- invoice_to_cust_account_id
566:
567: IF aso_debug_pub.g_debug_flag = 'Y' THEN
568: aso_debug_pub.add('Check_Tca: p_qte_rec.invoice_to_cust_account_id: '
569: ||p_qte_rec.invoice_to_cust_account_id, 1, 'N');
570: END IF;
571:
564:
565: END IF; -- invoice_to_cust_account_id
566:
567: IF aso_debug_pub.g_debug_flag = 'Y' THEN
568: aso_debug_pub.add('Check_Tca: p_qte_rec.invoice_to_cust_account_id: '
569: ||p_qte_rec.invoice_to_cust_account_id, 1, 'N');
570: END IF;
571:
572:
579: FETCH c_get_cust_account_id INTO l_invoice_cust_account_id;
580: CLOSE c_get_cust_account_id;
581: END IF;
582: END IF;
583: IF aso_debug_pub.g_debug_flag = 'Y' THEN
584: aso_debug_pub.add('chk_hdr:l_invoice_cust_acccount_id = ' || l_invoice_cust_account_id,1,'N' );
585: aso_debug_pub.add('chk_hdr:before invoice to party site id '|| p_qte_rec.invoice_to_party_site_id, 1, 'Y');
586: aso_debug_pub.add('chk_hdr:invoice_to_cust_account = ' || p_qte_rec.invoice_to_cust_account_id,1,'N');
587: END IF;
580: CLOSE c_get_cust_account_id;
581: END IF;
582: END IF;
583: IF aso_debug_pub.g_debug_flag = 'Y' THEN
584: aso_debug_pub.add('chk_hdr:l_invoice_cust_acccount_id = ' || l_invoice_cust_account_id,1,'N' );
585: aso_debug_pub.add('chk_hdr:before invoice to party site id '|| p_qte_rec.invoice_to_party_site_id, 1, 'Y');
586: aso_debug_pub.add('chk_hdr:invoice_to_cust_account = ' || p_qte_rec.invoice_to_cust_account_id,1,'N');
587: END IF;
588: IF l_invoice_cust_account_id IS NOT NULL AND l_invoice_cust_account_id <> FND_API.G_MISS_NUM THEN
581: END IF;
582: END IF;
583: IF aso_debug_pub.g_debug_flag = 'Y' THEN
584: aso_debug_pub.add('chk_hdr:l_invoice_cust_acccount_id = ' || l_invoice_cust_account_id,1,'N' );
585: aso_debug_pub.add('chk_hdr:before invoice to party site id '|| p_qte_rec.invoice_to_party_site_id, 1, 'Y');
586: aso_debug_pub.add('chk_hdr:invoice_to_cust_account = ' || p_qte_rec.invoice_to_cust_account_id,1,'N');
587: END IF;
588: IF l_invoice_cust_account_id IS NOT NULL AND l_invoice_cust_account_id <> FND_API.G_MISS_NUM THEN
589:
582: END IF;
583: IF aso_debug_pub.g_debug_flag = 'Y' THEN
584: aso_debug_pub.add('chk_hdr:l_invoice_cust_acccount_id = ' || l_invoice_cust_account_id,1,'N' );
585: aso_debug_pub.add('chk_hdr:before invoice to party site id '|| p_qte_rec.invoice_to_party_site_id, 1, 'Y');
586: aso_debug_pub.add('chk_hdr:invoice_to_cust_account = ' || p_qte_rec.invoice_to_cust_account_id,1,'N');
587: END IF;
588: IF l_invoice_cust_account_id IS NOT NULL AND l_invoice_cust_account_id <> FND_API.G_MISS_NUM THEN
589:
590: IF p_qte_rec.invoice_to_party_site_id is not NULL
600: ,x_msg_count => x_msg_count
601: ,x_msg_data => x_msg_data
602: ,x_site_use_id => l_invoice_to_org_id);
603:
604: IF aso_debug_pub.g_debug_flag = 'Y' THEN
605: aso_debug_pub.add('chk_hdr:site_use_id after deriving invoice = ' || l_invoice_to_org_id,1,'N');
606: aso_debug_pub.add('chk_hdr:cust_acct_site_id after deriving invoice = ' || l_inv_cust_acct_site_id,1,'N');
607: END IF;
608: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
601: ,x_msg_data => x_msg_data
602: ,x_site_use_id => l_invoice_to_org_id);
603:
604: IF aso_debug_pub.g_debug_flag = 'Y' THEN
605: aso_debug_pub.add('chk_hdr:site_use_id after deriving invoice = ' || l_invoice_to_org_id,1,'N');
606: aso_debug_pub.add('chk_hdr:cust_acct_site_id after deriving invoice = ' || l_inv_cust_acct_site_id,1,'N');
607: END IF;
608: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
609: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
602: ,x_site_use_id => l_invoice_to_org_id);
603:
604: IF aso_debug_pub.g_debug_flag = 'Y' THEN
605: aso_debug_pub.add('chk_hdr:site_use_id after deriving invoice = ' || l_invoice_to_org_id,1,'N');
606: aso_debug_pub.add('chk_hdr:cust_acct_site_id after deriving invoice = ' || l_inv_cust_acct_site_id,1,'N');
607: END IF;
608: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
609: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
610: FND_MESSAGE.Set_Name('ASO', 'ASO_VALIDATE_INV_SITE_AC_CRS');
613: raise FND_API.G_EXC_ERROR;
614: END IF;
615:
616: END IF;
617: IF aso_debug_pub.g_debug_flag = 'Y' THEN
618: aso_debug_pub.add('chk_hdr: invoice_to_party = ' || p_qte_rec.invoice_to_party_id,1, 'N' );
619: aso_debug_pub.add('chk_hdr: invoice_to_party_site = ' || p_qte_rec.invoice_to_party_site_id,1, 'N' );
620: aso_debug_pub.add('chk_hdr: before Cust_Acct_Contact_Addr:l_invoice_cust_account_id: '||l_invoice_cust_account_id,1,'N');
621: END IF;
614: END IF;
615:
616: END IF;
617: IF aso_debug_pub.g_debug_flag = 'Y' THEN
618: aso_debug_pub.add('chk_hdr: invoice_to_party = ' || p_qte_rec.invoice_to_party_id,1, 'N' );
619: aso_debug_pub.add('chk_hdr: invoice_to_party_site = ' || p_qte_rec.invoice_to_party_site_id,1, 'N' );
620: aso_debug_pub.add('chk_hdr: before Cust_Acct_Contact_Addr:l_invoice_cust_account_id: '||l_invoice_cust_account_id,1,'N');
621: END IF;
622:
615:
616: END IF;
617: IF aso_debug_pub.g_debug_flag = 'Y' THEN
618: aso_debug_pub.add('chk_hdr: invoice_to_party = ' || p_qte_rec.invoice_to_party_id,1, 'N' );
619: aso_debug_pub.add('chk_hdr: invoice_to_party_site = ' || p_qte_rec.invoice_to_party_site_id,1, 'N' );
620: aso_debug_pub.add('chk_hdr: before Cust_Acct_Contact_Addr:l_invoice_cust_account_id: '||l_invoice_cust_account_id,1,'N');
621: END IF;
622:
623: ASO_CHECK_TCA_PVT.Cust_Acct_Contact_Addr(
616: END IF;
617: IF aso_debug_pub.g_debug_flag = 'Y' THEN
618: aso_debug_pub.add('chk_hdr: invoice_to_party = ' || p_qte_rec.invoice_to_party_id,1, 'N' );
619: aso_debug_pub.add('chk_hdr: invoice_to_party_site = ' || p_qte_rec.invoice_to_party_site_id,1, 'N' );
620: aso_debug_pub.add('chk_hdr: before Cust_Acct_Contact_Addr:l_invoice_cust_account_id: '||l_invoice_cust_account_id,1,'N');
621: END IF;
622:
623: ASO_CHECK_TCA_PVT.Cust_Acct_Contact_Addr(
624: p_api_version => 1.0,
631: x_msg_count => x_msg_count,
632: x_msg_data => x_msg_data,
633: x_cust_account_role_id => l_invoice_to_contact_id);
634:
635: IF aso_debug_pub.g_debug_flag = 'Y' THEN
636: aso_debug_pub.add('mapq line: after Cust_Acct_Contact_Addr:l_invoice_to_contact_id: '||l_invoice_to_contact_id,1,'N');
637: END IF;
638:
639: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
632: x_msg_data => x_msg_data,
633: x_cust_account_role_id => l_invoice_to_contact_id);
634:
635: IF aso_debug_pub.g_debug_flag = 'Y' THEN
636: aso_debug_pub.add('mapq line: after Cust_Acct_Contact_Addr:l_invoice_to_contact_id: '||l_invoice_to_contact_id,1,'N');
637: END IF;
638:
639: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
640: raise FND_API.G_EXC_ERROR;
641: END IF;
642:
643: END IF; -- l_invoice_cust_account_id not null
644:
645: IF aso_debug_pub.g_debug_flag = 'Y' THEN
646: aso_debug_pub.add('chk_hdr:beginning of mapping for header end user ', 1, 'N' );
647: END IF;
648:
649: ASO_CHECK_TCA_PVT.Populate_Acct_Party (
642:
643: END IF; -- l_invoice_cust_account_id not null
644:
645: IF aso_debug_pub.g_debug_flag = 'Y' THEN
646: aso_debug_pub.add('chk_hdr:beginning of mapping for header end user ', 1, 'N' );
647: END IF;
648:
649: ASO_CHECK_TCA_PVT.Populate_Acct_Party (
650: p_hdr_cust_acct_id => p_qte_rec.cust_account_id,
655: x_return_status => x_return_status,
656: x_msg_count => x_msg_count,
657: x_msg_data => x_msg_data );
658:
659: IF aso_debug_pub.g_debug_flag = 'Y' THEN
660: aso_debug_pub.add('chk_hdr:after populate_acct_party: ' || x_return_status,1,'N');
661: END IF;
662: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
663: raise FND_API.G_EXC_ERROR;
656: x_msg_count => x_msg_count,
657: x_msg_data => x_msg_data );
658:
659: IF aso_debug_pub.g_debug_flag = 'Y' THEN
660: aso_debug_pub.add('chk_hdr:after populate_acct_party: ' || x_return_status,1,'N');
661: END IF;
662: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
663: raise FND_API.G_EXC_ERROR;
664: END IF;
668: (p_qte_rec.End_Customer_cust_account_id IS NULL OR
669: p_qte_rec.End_Customer_cust_account_id = FND_API.G_MISS_NUM) THEN
670:
671:
672: IF aso_debug_pub.g_debug_flag = 'Y' THEN
673: aso_debug_pub.add('Check_Tca: before customer account:p_qte_rec.End_Customer_cust_party_id '
674: ||p_qte_rec.End_Customer_cust_party_id, 1, 'N');
675: END IF;
676: Customer_Account(
669: p_qte_rec.End_Customer_cust_account_id = FND_API.G_MISS_NUM) THEN
670:
671:
672: IF aso_debug_pub.g_debug_flag = 'Y' THEN
673: aso_debug_pub.add('Check_Tca: before customer account:p_qte_rec.End_Customer_cust_party_id '
674: ||p_qte_rec.End_Customer_cust_party_id, 1, 'N');
675: END IF;
676: Customer_Account(
677: p_api_version => 1.0,
681: x_return_status => x_return_status,
682: x_msg_count => x_msg_count,
683: x_msg_data => x_msg_data);
684:
685: IF aso_debug_pub.g_debug_flag = 'Y' THEN
686: aso_debug_pub.add('Check_Tca: after customer account:x_Return_Status '
687: ||x_Return_Status, 1, 'N');
688: END IF;
689: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
682: x_msg_count => x_msg_count,
683: x_msg_data => x_msg_data);
684:
685: IF aso_debug_pub.g_debug_flag = 'Y' THEN
686: aso_debug_pub.add('Check_Tca: after customer account:x_Return_Status '
687: ||x_Return_Status, 1, 'N');
688: END IF;
689: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
690: raise FND_API.G_EXC_ERROR;
691: END IF;
692:
693: END IF; -- End_Customer_cust_account_id
694:
695: IF aso_debug_pub.g_debug_flag = 'Y' THEN
696: aso_debug_pub.add('Check_Tca: p_qte_rec.End_Customer_cust_account_id: '
697: ||p_qte_rec.End_Customer_cust_account_id, 1, 'N');
698: END IF;
699:
692:
693: END IF; -- End_Customer_cust_account_id
694:
695: IF aso_debug_pub.g_debug_flag = 'Y' THEN
696: aso_debug_pub.add('Check_Tca: p_qte_rec.End_Customer_cust_account_id: '
697: ||p_qte_rec.End_Customer_cust_account_id, 1, 'N');
698: END IF;
699:
700:
707: FETCH c_get_cust_account_id INTO l_End_cust_account_id;
708: CLOSE c_get_cust_account_id;
709: END IF;
710: END IF;
711: IF aso_debug_pub.g_debug_flag = 'Y' THEN
712: aso_debug_pub.add('chk_hdr:l_End_Customer_cust_acccount_id = ' || l_End_cust_account_id,1,'N' );
713: aso_debug_pub.add('chk_hdr:before End_Customer party site id '|| p_qte_rec.End_Customer_party_site_id, 1, 'Y');
714: aso_debug_pub.add('chk_hdr:End_Customer_cust_account = ' || p_qte_rec.End_Customer_cust_account_id,1,'N');
715: END IF;
708: CLOSE c_get_cust_account_id;
709: END IF;
710: END IF;
711: IF aso_debug_pub.g_debug_flag = 'Y' THEN
712: aso_debug_pub.add('chk_hdr:l_End_Customer_cust_acccount_id = ' || l_End_cust_account_id,1,'N' );
713: aso_debug_pub.add('chk_hdr:before End_Customer party site id '|| p_qte_rec.End_Customer_party_site_id, 1, 'Y');
714: aso_debug_pub.add('chk_hdr:End_Customer_cust_account = ' || p_qte_rec.End_Customer_cust_account_id,1,'N');
715: END IF;
716: IF l_End_cust_account_id IS NOT NULL AND l_End_cust_account_id <> FND_API.G_MISS_NUM THEN
709: END IF;
710: END IF;
711: IF aso_debug_pub.g_debug_flag = 'Y' THEN
712: aso_debug_pub.add('chk_hdr:l_End_Customer_cust_acccount_id = ' || l_End_cust_account_id,1,'N' );
713: aso_debug_pub.add('chk_hdr:before End_Customer party site id '|| p_qte_rec.End_Customer_party_site_id, 1, 'Y');
714: aso_debug_pub.add('chk_hdr:End_Customer_cust_account = ' || p_qte_rec.End_Customer_cust_account_id,1,'N');
715: END IF;
716: IF l_End_cust_account_id IS NOT NULL AND l_End_cust_account_id <> FND_API.G_MISS_NUM THEN
717:
710: END IF;
711: IF aso_debug_pub.g_debug_flag = 'Y' THEN
712: aso_debug_pub.add('chk_hdr:l_End_Customer_cust_acccount_id = ' || l_End_cust_account_id,1,'N' );
713: aso_debug_pub.add('chk_hdr:before End_Customer party site id '|| p_qte_rec.End_Customer_party_site_id, 1, 'Y');
714: aso_debug_pub.add('chk_hdr:End_Customer_cust_account = ' || p_qte_rec.End_Customer_cust_account_id,1,'N');
715: END IF;
716: IF l_End_cust_account_id IS NOT NULL AND l_End_cust_account_id <> FND_API.G_MISS_NUM THEN
717:
718: IF p_qte_rec.End_Customer_party_site_id is not NULL
728: ,x_msg_count => x_msg_count
729: ,x_msg_data => x_msg_data
730: ,x_site_use_id => l_End_Customer_org_id);
731:
732: IF aso_debug_pub.g_debug_flag = 'Y' THEN
733: aso_debug_pub.add('chk_hdr:site_use_id after deriving End_Customer = ' || l_End_Customer_org_id,1,'N');
734: aso_debug_pub.add('chk_hdr:cust_acct_site_id after deriving End_Customer = ' || l_end_cust_acct_site_id,1,'N');
735: END IF;
736: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
729: ,x_msg_data => x_msg_data
730: ,x_site_use_id => l_End_Customer_org_id);
731:
732: IF aso_debug_pub.g_debug_flag = 'Y' THEN
733: aso_debug_pub.add('chk_hdr:site_use_id after deriving End_Customer = ' || l_End_Customer_org_id,1,'N');
734: aso_debug_pub.add('chk_hdr:cust_acct_site_id after deriving End_Customer = ' || l_end_cust_acct_site_id,1,'N');
735: END IF;
736: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
737: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
730: ,x_site_use_id => l_End_Customer_org_id);
731:
732: IF aso_debug_pub.g_debug_flag = 'Y' THEN
733: aso_debug_pub.add('chk_hdr:site_use_id after deriving End_Customer = ' || l_End_Customer_org_id,1,'N');
734: aso_debug_pub.add('chk_hdr:cust_acct_site_id after deriving End_Customer = ' || l_end_cust_acct_site_id,1,'N');
735: END IF;
736: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
737: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
738: FND_MESSAGE.Set_Name('ASO', 'ASO_VALIDATE_END_SITE_AC_CRS');
741: raise FND_API.G_EXC_ERROR;
742: END IF;
743:
744: END IF;
745: IF aso_debug_pub.g_debug_flag = 'Y' THEN
746: aso_debug_pub.add('chk_hdr: End_Customer_to_party = ' || p_qte_rec.End_Customer_party_id,1, 'N' );
747: aso_debug_pub.add('chk_hdr: End_Customer_party_site = ' || p_qte_rec.End_Customer_party_site_id,1, 'N' );
748: aso_debug_pub.add('chk_hdr: before Cust_Acct_Contact_Addr:l_End_cust_account_id: '||l_End_cust_account_id,1,'N');
749: END IF;
742: END IF;
743:
744: END IF;
745: IF aso_debug_pub.g_debug_flag = 'Y' THEN
746: aso_debug_pub.add('chk_hdr: End_Customer_to_party = ' || p_qte_rec.End_Customer_party_id,1, 'N' );
747: aso_debug_pub.add('chk_hdr: End_Customer_party_site = ' || p_qte_rec.End_Customer_party_site_id,1, 'N' );
748: aso_debug_pub.add('chk_hdr: before Cust_Acct_Contact_Addr:l_End_cust_account_id: '||l_End_cust_account_id,1,'N');
749: END IF;
750:
743:
744: END IF;
745: IF aso_debug_pub.g_debug_flag = 'Y' THEN
746: aso_debug_pub.add('chk_hdr: End_Customer_to_party = ' || p_qte_rec.End_Customer_party_id,1, 'N' );
747: aso_debug_pub.add('chk_hdr: End_Customer_party_site = ' || p_qte_rec.End_Customer_party_site_id,1, 'N' );
748: aso_debug_pub.add('chk_hdr: before Cust_Acct_Contact_Addr:l_End_cust_account_id: '||l_End_cust_account_id,1,'N');
749: END IF;
750:
751: ASO_CHECK_TCA_PVT.Cust_Acct_Contact_Addr(
744: END IF;
745: IF aso_debug_pub.g_debug_flag = 'Y' THEN
746: aso_debug_pub.add('chk_hdr: End_Customer_to_party = ' || p_qte_rec.End_Customer_party_id,1, 'N' );
747: aso_debug_pub.add('chk_hdr: End_Customer_party_site = ' || p_qte_rec.End_Customer_party_site_id,1, 'N' );
748: aso_debug_pub.add('chk_hdr: before Cust_Acct_Contact_Addr:l_End_cust_account_id: '||l_End_cust_account_id,1,'N');
749: END IF;
750:
751: ASO_CHECK_TCA_PVT.Cust_Acct_Contact_Addr(
752: p_api_version => 1.0,
759: x_msg_count => x_msg_count,
760: x_msg_data => x_msg_data,
761: x_cust_account_role_id => l_End_Customer_contact_id);
762:
763: IF aso_debug_pub.g_debug_flag = 'Y' THEN
764: aso_debug_pub.add('mapq line: after Cust_Acct_Contact_Addr:l_End_Customer_contact_id: '||l_End_Customer_contact_id,1,'N');
765: END IF;
766:
767: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
760: x_msg_data => x_msg_data,
761: x_cust_account_role_id => l_End_Customer_contact_id);
762:
763: IF aso_debug_pub.g_debug_flag = 'Y' THEN
764: aso_debug_pub.add('mapq line: after Cust_Acct_Contact_Addr:l_End_Customer_contact_id: '||l_End_Customer_contact_id,1,'N');
765: END IF;
766:
767: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
768: raise FND_API.G_EXC_ERROR;
769: END IF;
770:
771: END IF; -- l_End_cust_account_id not null
772:
773: IF aso_debug_pub.g_debug_flag = 'Y' THEN
774: aso_debug_pub.add('chk_hdr:beginning of mapping for header shipping ', 1, 'N' );
775: END IF;
776:
777: IF p_header_shipment_tbl.count > 0 THEN
770:
771: END IF; -- l_End_cust_account_id not null
772:
773: IF aso_debug_pub.g_debug_flag = 'Y' THEN
774: aso_debug_pub.add('chk_hdr:beginning of mapping for header shipping ', 1, 'N' );
775: END IF;
776:
777: IF p_header_shipment_tbl.count > 0 THEN
778: -- OM takes in only one shipment at the header level
776:
777: IF p_header_shipment_tbl.count > 0 THEN
778: -- OM takes in only one shipment at the header level
779:
780: IF aso_debug_pub.g_debug_flag = 'Y' THEN
781: aso_debug_pub.add('Check_Hdr_Acct: p_header_shipment_tbl(1).ship_to_cust_account_id: '
782: || p_header_shipment_tbl(1).ship_to_cust_account_id, 1, 'N');
783: aso_debug_pub.add('Check_Hdr_Acct: p_header_shipment_tbl(1).ship_to_cust_party_id: '
784: || p_header_shipment_tbl(1).ship_to_cust_party_id, 1, 'N');
777: IF p_header_shipment_tbl.count > 0 THEN
778: -- OM takes in only one shipment at the header level
779:
780: IF aso_debug_pub.g_debug_flag = 'Y' THEN
781: aso_debug_pub.add('Check_Hdr_Acct: p_header_shipment_tbl(1).ship_to_cust_account_id: '
782: || p_header_shipment_tbl(1).ship_to_cust_account_id, 1, 'N');
783: aso_debug_pub.add('Check_Hdr_Acct: p_header_shipment_tbl(1).ship_to_cust_party_id: '
784: || p_header_shipment_tbl(1).ship_to_cust_party_id, 1, 'N');
785: aso_debug_pub.add('Check_Hdr_Acct: p_header_shipment_tbl(1).ship_to_party_site_id: '
779:
780: IF aso_debug_pub.g_debug_flag = 'Y' THEN
781: aso_debug_pub.add('Check_Hdr_Acct: p_header_shipment_tbl(1).ship_to_cust_account_id: '
782: || p_header_shipment_tbl(1).ship_to_cust_account_id, 1, 'N');
783: aso_debug_pub.add('Check_Hdr_Acct: p_header_shipment_tbl(1).ship_to_cust_party_id: '
784: || p_header_shipment_tbl(1).ship_to_cust_party_id, 1, 'N');
785: aso_debug_pub.add('Check_Hdr_Acct: p_header_shipment_tbl(1).ship_to_party_site_id: '
786: || p_header_shipment_tbl(1).ship_to_party_site_id, 1, 'N');
787: END IF;
781: aso_debug_pub.add('Check_Hdr_Acct: p_header_shipment_tbl(1).ship_to_cust_account_id: '
782: || p_header_shipment_tbl(1).ship_to_cust_account_id, 1, 'N');
783: aso_debug_pub.add('Check_Hdr_Acct: p_header_shipment_tbl(1).ship_to_cust_party_id: '
784: || p_header_shipment_tbl(1).ship_to_cust_party_id, 1, 'N');
785: aso_debug_pub.add('Check_Hdr_Acct: p_header_shipment_tbl(1).ship_to_party_site_id: '
786: || p_header_shipment_tbl(1).ship_to_party_site_id, 1, 'N');
787: END IF;
788:
789: ASO_CHECK_TCA_PVT.Populate_Acct_Party (
795: x_return_status => x_return_status,
796: x_msg_count => x_msg_count,
797: x_msg_data => x_msg_data );
798:
799: IF aso_debug_pub.g_debug_flag = 'Y' THEN
800: aso_debug_pub.add('chk_hdr:(ship)after populate_acct_party: ' || x_return_status,1,'N');
801: END IF;
802: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
803: raise FND_API.G_EXC_ERROR;
796: x_msg_count => x_msg_count,
797: x_msg_data => x_msg_data );
798:
799: IF aso_debug_pub.g_debug_flag = 'Y' THEN
800: aso_debug_pub.add('chk_hdr:(ship)after populate_acct_party: ' || x_return_status,1,'N');
801: END IF;
802: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
803: raise FND_API.G_EXC_ERROR;
804: END IF;
808: (p_header_shipment_tbl(1).ship_to_cust_account_id IS NULL OR
809: p_header_shipment_tbl(1).ship_to_cust_account_id = FND_API.G_MISS_NUM) THEN
810:
811:
812: IF aso_debug_pub.g_debug_flag = 'Y' THEN
813: aso_debug_pub.add('Check_Tca: before customer account:p_header_shipment_tbl(1).
814: ship_to_cust_party_id '||p_header_shipment_tbl(1).ship_to_cust_party_id
815: , 1, 'N');
816: END IF;
809: p_header_shipment_tbl(1).ship_to_cust_account_id = FND_API.G_MISS_NUM) THEN
810:
811:
812: IF aso_debug_pub.g_debug_flag = 'Y' THEN
813: aso_debug_pub.add('Check_Tca: before customer account:p_header_shipment_tbl(1).
814: ship_to_cust_party_id '||p_header_shipment_tbl(1).ship_to_cust_party_id
815: , 1, 'N');
816: END IF;
817: Customer_Account(
822: x_return_status => x_return_status,
823: x_msg_count => x_msg_count,
824: x_msg_data => x_msg_data);
825:
826: IF aso_debug_pub.g_debug_flag = 'Y' THEN
827: aso_debug_pub.add('Check_Tca: after customer account:x_Return_Status '
828: ||x_Return_Status, 1, 'N');
829: END IF;
830: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
823: x_msg_count => x_msg_count,
824: x_msg_data => x_msg_data);
825:
826: IF aso_debug_pub.g_debug_flag = 'Y' THEN
827: aso_debug_pub.add('Check_Tca: after customer account:x_Return_Status '
828: ||x_Return_Status, 1, 'N');
829: END IF;
830: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
831: raise FND_API.G_EXC_ERROR;
832: END IF;
833:
834: END IF; -- cust_account_id
835:
836: IF aso_debug_pub.g_debug_flag = 'Y' THEN
837: aso_debug_pub.add('Check_Tca: p_header_shipment_tbl(1).ship_to_cust_account_id: '||
838: p_header_shipment_tbl(1).ship_to_cust_account_id, 1, 'N');
839: END IF;
840:
833:
834: END IF; -- cust_account_id
835:
836: IF aso_debug_pub.g_debug_flag = 'Y' THEN
837: aso_debug_pub.add('Check_Tca: p_header_shipment_tbl(1).ship_to_cust_account_id: '||
838: p_header_shipment_tbl(1).ship_to_cust_account_id, 1, 'N');
839: END IF;
840:
841:
849: CLOSE c_get_cust_account_id;
850: END IF;
851: END IF;
852:
853: IF aso_debug_pub.g_debug_flag = 'Y' THEN
854: aso_debug_pub.add('chk_hdr:ship cust acccount = ' || l_ship_cust_account_id ,1, 'N');
855: aso_debug_pub.add('chk_hdr:ship to party site = ' || p_header_shipment_tbl(1).ship_to_party_site_id, 1, 'N');
856: END IF;
857: IF l_ship_cust_account_id IS NOT NULL AND l_ship_cust_account_id <> FND_API.G_MISS_NUM THEN
850: END IF;
851: END IF;
852:
853: IF aso_debug_pub.g_debug_flag = 'Y' THEN
854: aso_debug_pub.add('chk_hdr:ship cust acccount = ' || l_ship_cust_account_id ,1, 'N');
855: aso_debug_pub.add('chk_hdr:ship to party site = ' || p_header_shipment_tbl(1).ship_to_party_site_id, 1, 'N');
856: END IF;
857: IF l_ship_cust_account_id IS NOT NULL AND l_ship_cust_account_id <> FND_API.G_MISS_NUM THEN
858:
851: END IF;
852:
853: IF aso_debug_pub.g_debug_flag = 'Y' THEN
854: aso_debug_pub.add('chk_hdr:ship cust acccount = ' || l_ship_cust_account_id ,1, 'N');
855: aso_debug_pub.add('chk_hdr:ship to party site = ' || p_header_shipment_tbl(1).ship_to_party_site_id, 1, 'N');
856: END IF;
857: IF l_ship_cust_account_id IS NOT NULL AND l_ship_cust_account_id <> FND_API.G_MISS_NUM THEN
858:
859: IF p_header_shipment_tbl(1).ship_to_party_site_id is not NULL
869: ,x_msg_count => x_msg_count
870: ,x_msg_data => x_msg_data
871: ,x_site_use_id => l_ship_to_org_id);
872:
873: IF aso_debug_pub.g_debug_flag = 'Y' THEN
874: aso_debug_pub.add('chk_hdr:ship to org after deriving = ' || l_ship_to_org_id, 1, 'Y');
875: aso_debug_pub.add('chk_hdr:ship cust acct site after deriving = ' || l_shp_cust_acct_site_id, 1, 'Y');
876: END IF;
877: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
870: ,x_msg_data => x_msg_data
871: ,x_site_use_id => l_ship_to_org_id);
872:
873: IF aso_debug_pub.g_debug_flag = 'Y' THEN
874: aso_debug_pub.add('chk_hdr:ship to org after deriving = ' || l_ship_to_org_id, 1, 'Y');
875: aso_debug_pub.add('chk_hdr:ship cust acct site after deriving = ' || l_shp_cust_acct_site_id, 1, 'Y');
876: END IF;
877: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
878: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
871: ,x_site_use_id => l_ship_to_org_id);
872:
873: IF aso_debug_pub.g_debug_flag = 'Y' THEN
874: aso_debug_pub.add('chk_hdr:ship to org after deriving = ' || l_ship_to_org_id, 1, 'Y');
875: aso_debug_pub.add('chk_hdr:ship cust acct site after deriving = ' || l_shp_cust_acct_site_id, 1, 'Y');
876: END IF;
877: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
878: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
879: FND_MESSAGE.Set_Name('ASO', 'ASO_VALIDATE_SHP_SITE_AC_CRS');
884: END IF;
885:
886: END IF;
887:
888: IF aso_debug_pub.g_debug_flag = 'Y' THEN
889: aso_debug_pub.add('chk_hdr:beginning of map 2:ship_party_id:' || p_header_shipment_tbl(1).ship_to_party_id,1,'N');
890: aso_debug_pub.add('chk_hdr: before Cust_Acct_Contact_Addr:l_ship_cust_account_id: '||l_ship_cust_account_id,1,'N');
891: END IF;
892:
885:
886: END IF;
887:
888: IF aso_debug_pub.g_debug_flag = 'Y' THEN
889: aso_debug_pub.add('chk_hdr:beginning of map 2:ship_party_id:' || p_header_shipment_tbl(1).ship_to_party_id,1,'N');
890: aso_debug_pub.add('chk_hdr: before Cust_Acct_Contact_Addr:l_ship_cust_account_id: '||l_ship_cust_account_id,1,'N');
891: END IF;
892:
893: ASO_CHECK_TCA_PVT.Cust_Acct_Contact_Addr(
886: END IF;
887:
888: IF aso_debug_pub.g_debug_flag = 'Y' THEN
889: aso_debug_pub.add('chk_hdr:beginning of map 2:ship_party_id:' || p_header_shipment_tbl(1).ship_to_party_id,1,'N');
890: aso_debug_pub.add('chk_hdr: before Cust_Acct_Contact_Addr:l_ship_cust_account_id: '||l_ship_cust_account_id,1,'N');
891: END IF;
892:
893: ASO_CHECK_TCA_PVT.Cust_Acct_Contact_Addr(
894: p_api_version => 1.0,
901: x_msg_count => x_msg_count,
902: x_msg_data => x_msg_data,
903: x_cust_account_role_id => l_ship_to_contact_id);
904:
905: IF aso_debug_pub.g_debug_flag = 'Y' THEN
906: aso_debug_pub.add('chk_hdr: after Cust_Acct_Contact_Addr:l_ship_to_contact_id: '||l_ship_to_contact_id,1,'N');
907: aso_debug_pub.add('chk_hdr: after Cust_Acct_Contact_Addr:l_shp_cust_acct_site_id: '||l_shp_cust_acct_site_id,1,'N');
908: END IF;
909: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
902: x_msg_data => x_msg_data,
903: x_cust_account_role_id => l_ship_to_contact_id);
904:
905: IF aso_debug_pub.g_debug_flag = 'Y' THEN
906: aso_debug_pub.add('chk_hdr: after Cust_Acct_Contact_Addr:l_ship_to_contact_id: '||l_ship_to_contact_id,1,'N');
907: aso_debug_pub.add('chk_hdr: after Cust_Acct_Contact_Addr:l_shp_cust_acct_site_id: '||l_shp_cust_acct_site_id,1,'N');
908: END IF;
909: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
910: raise FND_API.G_EXC_ERROR;
903: x_cust_account_role_id => l_ship_to_contact_id);
904:
905: IF aso_debug_pub.g_debug_flag = 'Y' THEN
906: aso_debug_pub.add('chk_hdr: after Cust_Acct_Contact_Addr:l_ship_to_contact_id: '||l_ship_to_contact_id,1,'N');
907: aso_debug_pub.add('chk_hdr: after Cust_Acct_Contact_Addr:l_shp_cust_acct_site_id: '||l_shp_cust_acct_site_id,1,'N');
908: END IF;
909: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
910: raise FND_API.G_EXC_ERROR;
911: END IF;
913: END IF; -- l_ship_cust_account_id is not null
914:
915: END IF; -- shipment tbl count
916:
917: IF aso_debug_pub.g_debug_flag = 'Y' THEN
918: aso_debug_pub.add('end chk_hdr:after map 2 for header',1,'N');
919: END IF;
920:
921: FND_MSG_PUB.Count_And_Get
914:
915: END IF; -- shipment tbl count
916:
917: IF aso_debug_pub.g_debug_flag = 'Y' THEN
918: aso_debug_pub.add('end chk_hdr:after map 2 for header',1,'N');
919: END IF;
920:
921: FND_MSG_PUB.Count_And_Get
922: ( p_count => x_msg_count,
1048: END IF;
1049:
1050: x_return_status := FND_API.g_ret_sts_success;
1051:
1052: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1053: aso_debug_pub.add('line account info:begin ',1,'Y');
1054: aso_debug_pub.add('line account info:P_line_Shipment_Tbl.count: '||P_line_Shipment_Tbl.count,1,'N');
1055: END IF;
1056:
1049:
1050: x_return_status := FND_API.g_ret_sts_success;
1051:
1052: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1053: aso_debug_pub.add('line account info:begin ',1,'Y');
1054: aso_debug_pub.add('line account info:P_line_Shipment_Tbl.count: '||P_line_Shipment_Tbl.count,1,'N');
1055: END IF;
1056:
1057: FOR j in 1..P_line_Shipment_Tbl.count LOOP
1050: x_return_status := FND_API.g_ret_sts_success;
1051:
1052: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1053: aso_debug_pub.add('line account info:begin ',1,'Y');
1054: aso_debug_pub.add('line account info:P_line_Shipment_Tbl.count: '||P_line_Shipment_Tbl.count,1,'N');
1055: END IF;
1056:
1057: FOR j in 1..P_line_Shipment_Tbl.count LOOP
1058:
1055: END IF;
1056:
1057: FOR j in 1..P_line_Shipment_Tbl.count LOOP
1058:
1059: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1060: aso_debug_pub.add('line account info:p_qte_line_rec.invoice_to_cust_account_id: '||p_qte_line_rec.invoice_to_cust_account_id,1,'N');
1061: aso_debug_pub.add('line account info:p_qte_line_rec.invoice_to_cust_party_id: '||p_qte_line_rec.invoice_to_cust_party_id,1,'N');
1062: aso_debug_pub.add('line account info:p_qte_line_rec.invoice_to_party_site_id: '||p_qte_line_rec.invoice_to_party_site_id,1,'N');
1063: END IF;
1056:
1057: FOR j in 1..P_line_Shipment_Tbl.count LOOP
1058:
1059: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1060: aso_debug_pub.add('line account info:p_qte_line_rec.invoice_to_cust_account_id: '||p_qte_line_rec.invoice_to_cust_account_id,1,'N');
1061: aso_debug_pub.add('line account info:p_qte_line_rec.invoice_to_cust_party_id: '||p_qte_line_rec.invoice_to_cust_party_id,1,'N');
1062: aso_debug_pub.add('line account info:p_qte_line_rec.invoice_to_party_site_id: '||p_qte_line_rec.invoice_to_party_site_id,1,'N');
1063: END IF;
1064:
1057: FOR j in 1..P_line_Shipment_Tbl.count LOOP
1058:
1059: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1060: aso_debug_pub.add('line account info:p_qte_line_rec.invoice_to_cust_account_id: '||p_qte_line_rec.invoice_to_cust_account_id,1,'N');
1061: aso_debug_pub.add('line account info:p_qte_line_rec.invoice_to_cust_party_id: '||p_qte_line_rec.invoice_to_cust_party_id,1,'N');
1062: aso_debug_pub.add('line account info:p_qte_line_rec.invoice_to_party_site_id: '||p_qte_line_rec.invoice_to_party_site_id,1,'N');
1063: END IF;
1064:
1065: IF (P_Qte_Line_Rec.operation_code = 'UPDATE' AND P_Application_Type_Code = 'QUOTING HTML') THEN
1058:
1059: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1060: aso_debug_pub.add('line account info:p_qte_line_rec.invoice_to_cust_account_id: '||p_qte_line_rec.invoice_to_cust_account_id,1,'N');
1061: aso_debug_pub.add('line account info:p_qte_line_rec.invoice_to_cust_party_id: '||p_qte_line_rec.invoice_to_cust_party_id,1,'N');
1062: aso_debug_pub.add('line account info:p_qte_line_rec.invoice_to_party_site_id: '||p_qte_line_rec.invoice_to_party_site_id,1,'N');
1063: END IF;
1064:
1065: IF (P_Qte_Line_Rec.operation_code = 'UPDATE' AND P_Application_Type_Code = 'QUOTING HTML') THEN
1066: l_qte_line_rec := ASO_UTILITY_PVT.query_qte_line_row (P_Qte_Line_Rec.quote_line_id);
1151: x_return_status => x_return_status,
1152: x_msg_count => x_msg_count,
1153: x_msg_data => x_msg_data );
1154:
1155: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1156: aso_debug_pub.add('chk_lin:after populate_acct_party: ' || x_return_status,1,'N');
1157: END IF;
1158: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1159: raise FND_API.G_EXC_ERROR;
1152: x_msg_count => x_msg_count,
1153: x_msg_data => x_msg_data );
1154:
1155: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1156: aso_debug_pub.add('chk_lin:after populate_acct_party: ' || x_return_status,1,'N');
1157: END IF;
1158: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1159: raise FND_API.G_EXC_ERROR;
1160: END IF;
1165: (p_qte_line_rec.invoice_to_cust_account_id IS NULL OR
1166: p_qte_line_rec.invoice_to_cust_account_id = FND_API.G_MISS_NUM) THEN
1167:
1168:
1169: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1170: aso_debug_pub.add('Check_Tca: before customer account: p_qte_line_rec.invoice_to_cust_party_id '
1171: || p_qte_line_rec.invoice_to_cust_party_id, 1, 'N')
1172: ;
1173: END IF;
1166: p_qte_line_rec.invoice_to_cust_account_id = FND_API.G_MISS_NUM) THEN
1167:
1168:
1169: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1170: aso_debug_pub.add('Check_Tca: before customer account: p_qte_line_rec.invoice_to_cust_party_id '
1171: || p_qte_line_rec.invoice_to_cust_party_id, 1, 'N')
1172: ;
1173: END IF;
1174: Customer_Account(
1179: x_return_status => x_return_status,
1180: x_msg_count => x_msg_count,
1181: x_msg_data => x_msg_data);
1182:
1183: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1184: aso_debug_pub.add('Check_Tca: after customer account:x_Return_Status '
1185: ||x_Return_Status, 1, 'N');
1186: END IF;
1187: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
1180: x_msg_count => x_msg_count,
1181: x_msg_data => x_msg_data);
1182:
1183: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1184: aso_debug_pub.add('Check_Tca: after customer account:x_Return_Status '
1185: ||x_Return_Status, 1, 'N');
1186: END IF;
1187: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
1188: raise FND_API.G_EXC_ERROR;
1188: raise FND_API.G_EXC_ERROR;
1189: END IF;
1190:
1191: END IF; -- invoice_to_cust_account_id
1192: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1193: aso_debug_pub.add('Check_Tca: p_qte_line_rec.invoice_to_cust_account_id: '
1194: ||p_qte_line_rec.invoice_to_cust_account_id, 1, 'N');
1195: END IF;
1196:
1189: END IF;
1190:
1191: END IF; -- invoice_to_cust_account_id
1192: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1193: aso_debug_pub.add('Check_Tca: p_qte_line_rec.invoice_to_cust_account_id: '
1194: ||p_qte_line_rec.invoice_to_cust_account_id, 1, 'N');
1195: END IF;
1196:
1197:
1205: CLOSE C_line_cust;
1206: END IF;
1207: END IF;
1208:
1209: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1210: aso_debug_pub.add('chk_ln: l_invoice_cust_account_id: '||l_invoice_cust_account_id,1,'N');
1211: aso_debug_pub.add('chk_ln: l_End_cust_account_id: '||l_End_cust_account_id,1,'N');
1212: aso_debug_pub.add('line account info: inside shipment loop:party_site: '||p_qte_line_rec.invoice_to_party_site_id,1,'N');
1213: END IF;
1206: END IF;
1207: END IF;
1208:
1209: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1210: aso_debug_pub.add('chk_ln: l_invoice_cust_account_id: '||l_invoice_cust_account_id,1,'N');
1211: aso_debug_pub.add('chk_ln: l_End_cust_account_id: '||l_End_cust_account_id,1,'N');
1212: aso_debug_pub.add('line account info: inside shipment loop:party_site: '||p_qte_line_rec.invoice_to_party_site_id,1,'N');
1213: END IF;
1214:
1207: END IF;
1208:
1209: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1210: aso_debug_pub.add('chk_ln: l_invoice_cust_account_id: '||l_invoice_cust_account_id,1,'N');
1211: aso_debug_pub.add('chk_ln: l_End_cust_account_id: '||l_End_cust_account_id,1,'N');
1212: aso_debug_pub.add('line account info: inside shipment loop:party_site: '||p_qte_line_rec.invoice_to_party_site_id,1,'N');
1213: END IF;
1214:
1215: IF l_invoice_cust_account_id IS NOT NULL AND l_invoice_cust_account_id <> FND_API.G_MISS_NUM THEN
1208:
1209: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1210: aso_debug_pub.add('chk_ln: l_invoice_cust_account_id: '||l_invoice_cust_account_id,1,'N');
1211: aso_debug_pub.add('chk_ln: l_End_cust_account_id: '||l_End_cust_account_id,1,'N');
1212: aso_debug_pub.add('line account info: inside shipment loop:party_site: '||p_qte_line_rec.invoice_to_party_site_id,1,'N');
1213: END IF;
1214:
1215: IF l_invoice_cust_account_id IS NOT NULL AND l_invoice_cust_account_id <> FND_API.G_MISS_NUM THEN
1216:
1234: FND_MSG_PUB.ADD;
1235: END IF;
1236: raise FND_API.G_EXC_ERROR;
1237: END IF;
1238: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1239: aso_debug_pub.add('line account info: site use after cust account site: '||l_site_use_id,1,'N');
1240: aso_debug_pub.add('line account info: cust_acct_site after cust account site: '||l_inv_cust_acct_site_id,1,'N');
1241: END IF;
1242: END IF;
1235: END IF;
1236: raise FND_API.G_EXC_ERROR;
1237: END IF;
1238: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1239: aso_debug_pub.add('line account info: site use after cust account site: '||l_site_use_id,1,'N');
1240: aso_debug_pub.add('line account info: cust_acct_site after cust account site: '||l_inv_cust_acct_site_id,1,'N');
1241: END IF;
1242: END IF;
1243:
1236: raise FND_API.G_EXC_ERROR;
1237: END IF;
1238: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1239: aso_debug_pub.add('line account info: site use after cust account site: '||l_site_use_id,1,'N');
1240: aso_debug_pub.add('line account info: cust_acct_site after cust account site: '||l_inv_cust_acct_site_id,1,'N');
1241: END IF;
1242: END IF;
1243:
1244: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1240: aso_debug_pub.add('line account info: cust_acct_site after cust account site: '||l_inv_cust_acct_site_id,1,'N');
1241: END IF;
1242: END IF;
1243:
1244: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1245: aso_debug_pub.add('chk_ln: before Cust_Acct_Contact_Addr:l_invoice_cust_account_id: '||l_invoice_cust_account_id,1,'N');
1246: END IF;
1247:
1248: ASO_CHECK_TCA_PVT.Cust_Acct_Contact_Addr(
1241: END IF;
1242: END IF;
1243:
1244: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1245: aso_debug_pub.add('chk_ln: before Cust_Acct_Contact_Addr:l_invoice_cust_account_id: '||l_invoice_cust_account_id,1,'N');
1246: END IF;
1247:
1248: ASO_CHECK_TCA_PVT.Cust_Acct_Contact_Addr(
1249: p_api_version => 1.0,
1256: x_msg_count => x_msg_count,
1257: x_msg_data => x_msg_data,
1258: x_cust_account_role_id => l_invoice_to_contact_id);
1259:
1260: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1261: aso_debug_pub.add('chk_ln: after Cust_Acct_Contact_Addr:l_invoice_to_contact_id: '||l_invoice_to_contact_id,1,'N');
1262: aso_debug_pub.add('chk_ln: after Cust_Acct_Contact_Addr:l_inv_cust_acct_site_id: '||l_inv_cust_acct_site_id,1,'N');
1263: END IF;
1264:
1257: x_msg_data => x_msg_data,
1258: x_cust_account_role_id => l_invoice_to_contact_id);
1259:
1260: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1261: aso_debug_pub.add('chk_ln: after Cust_Acct_Contact_Addr:l_invoice_to_contact_id: '||l_invoice_to_contact_id,1,'N');
1262: aso_debug_pub.add('chk_ln: after Cust_Acct_Contact_Addr:l_inv_cust_acct_site_id: '||l_inv_cust_acct_site_id,1,'N');
1263: END IF;
1264:
1265: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1258: x_cust_account_role_id => l_invoice_to_contact_id);
1259:
1260: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1261: aso_debug_pub.add('chk_ln: after Cust_Acct_Contact_Addr:l_invoice_to_contact_id: '||l_invoice_to_contact_id,1,'N');
1262: aso_debug_pub.add('chk_ln: after Cust_Acct_Contact_Addr:l_inv_cust_acct_site_id: '||l_inv_cust_acct_site_id,1,'N');
1263: END IF;
1264:
1265: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1266: raise FND_API.G_EXC_ERROR;
1268:
1269: END IF; -- l_invoice_cust_account_id is not null
1270:
1271:
1272: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1273: aso_debug_pub.add('line account info:p_qte_line_rec.End_Customer_cust_account_id: '||p_qte_line_rec.End_Customer_cust_account_id,1,'N');
1274: aso_debug_pub.add('line account info:p_qte_line_rec.End_Customer_cust_party_id: '||p_qte_line_rec.End_Customer_cust_party_id,1,'N');
1275: aso_debug_pub.add('line account info:p_qte_line_rec.End_Customer_party_site_id: '||p_qte_line_rec.End_Customer_party_site_id,1,'N');
1276: END IF;
1269: END IF; -- l_invoice_cust_account_id is not null
1270:
1271:
1272: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1273: aso_debug_pub.add('line account info:p_qte_line_rec.End_Customer_cust_account_id: '||p_qte_line_rec.End_Customer_cust_account_id,1,'N');
1274: aso_debug_pub.add('line account info:p_qte_line_rec.End_Customer_cust_party_id: '||p_qte_line_rec.End_Customer_cust_party_id,1,'N');
1275: aso_debug_pub.add('line account info:p_qte_line_rec.End_Customer_party_site_id: '||p_qte_line_rec.End_Customer_party_site_id,1,'N');
1276: END IF;
1277:
1270:
1271:
1272: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1273: aso_debug_pub.add('line account info:p_qte_line_rec.End_Customer_cust_account_id: '||p_qte_line_rec.End_Customer_cust_account_id,1,'N');
1274: aso_debug_pub.add('line account info:p_qte_line_rec.End_Customer_cust_party_id: '||p_qte_line_rec.End_Customer_cust_party_id,1,'N');
1275: aso_debug_pub.add('line account info:p_qte_line_rec.End_Customer_party_site_id: '||p_qte_line_rec.End_Customer_party_site_id,1,'N');
1276: END IF;
1277:
1278: /*--bug 5132989
1271:
1272: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1273: aso_debug_pub.add('line account info:p_qte_line_rec.End_Customer_cust_account_id: '||p_qte_line_rec.End_Customer_cust_account_id,1,'N');
1274: aso_debug_pub.add('line account info:p_qte_line_rec.End_Customer_cust_party_id: '||p_qte_line_rec.End_Customer_cust_party_id,1,'N');
1275: aso_debug_pub.add('line account info:p_qte_line_rec.End_Customer_party_site_id: '||p_qte_line_rec.End_Customer_party_site_id,1,'N');
1276: END IF;
1277:
1278: /*--bug 5132989
1279: l_cust_acct_id := p_qte_line_rec.End_Customer_cust_account_id;
1296: x_msg_count => x_msg_count,
1297: x_msg_data => x_msg_data );
1298:
1299: END IF;
1300: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1301: aso_debug_pub.add('chk_lin:after populate_acct_party: ' || x_return_status,1,'N');
1302: END IF;
1303: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1304: raise FND_API.G_EXC_ERROR;
1297: x_msg_data => x_msg_data );
1298:
1299: END IF;
1300: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1301: aso_debug_pub.add('chk_lin:after populate_acct_party: ' || x_return_status,1,'N');
1302: END IF;
1303: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1304: raise FND_API.G_EXC_ERROR;
1305: END IF;
1310: (p_qte_line_rec.End_Customer_cust_account_id IS NULL OR
1311: p_qte_line_rec.End_Customer_cust_account_id = FND_API.G_MISS_NUM) THEN
1312:
1313:
1314: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1315: aso_debug_pub.add('Check_Tca: before customer account: p_qte_line_rec.End_Customer_cust_party_id '
1316: || p_qte_line_rec.End_Customer_cust_party_id, 1, 'N')
1317: ;
1318: END IF;
1311: p_qte_line_rec.End_Customer_cust_account_id = FND_API.G_MISS_NUM) THEN
1312:
1313:
1314: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1315: aso_debug_pub.add('Check_Tca: before customer account: p_qte_line_rec.End_Customer_cust_party_id '
1316: || p_qte_line_rec.End_Customer_cust_party_id, 1, 'N')
1317: ;
1318: END IF;
1319: Customer_Account(
1324: x_return_status => x_return_status,
1325: x_msg_count => x_msg_count,
1326: x_msg_data => x_msg_data);
1327:
1328: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1329: aso_debug_pub.add('Check_Tca: after customer account:x_Return_Status '
1330: ||x_Return_Status, 1, 'N');
1331: END IF;
1332: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
1325: x_msg_count => x_msg_count,
1326: x_msg_data => x_msg_data);
1327:
1328: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1329: aso_debug_pub.add('Check_Tca: after customer account:x_Return_Status '
1330: ||x_Return_Status, 1, 'N');
1331: END IF;
1332: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
1333: raise FND_API.G_EXC_ERROR;
1333: raise FND_API.G_EXC_ERROR;
1334: END IF;
1335:
1336: END IF; -- End_Customer_cust_account_id
1337: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1338: aso_debug_pub.add('Check_Tca: p_qte_line_rec.End_Customer_cust_account_id: '
1339: ||p_qte_line_rec.End_Customer_cust_account_id, 1, 'N');
1340: END IF;
1341:
1334: END IF;
1335:
1336: END IF; -- End_Customer_cust_account_id
1337: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1338: aso_debug_pub.add('Check_Tca: p_qte_line_rec.End_Customer_cust_account_id: '
1339: ||p_qte_line_rec.End_Customer_cust_account_id, 1, 'N');
1340: END IF;
1341:
1342:
1350: CLOSE C_line_cust;
1351: END IF;
1352: END IF;
1353:
1354: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1355: aso_debug_pub.add('chk_ln: l_End_cust_account_id: '||l_End_cust_account_id,1,'N');
1356: aso_debug_pub.add('line account info: inside shipment loop:party_site: '||p_qte_line_rec.End_Customer_party_site_id,1,'N');
1357: END IF;
1358:
1351: END IF;
1352: END IF;
1353:
1354: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1355: aso_debug_pub.add('chk_ln: l_End_cust_account_id: '||l_End_cust_account_id,1,'N');
1356: aso_debug_pub.add('line account info: inside shipment loop:party_site: '||p_qte_line_rec.End_Customer_party_site_id,1,'N');
1357: END IF;
1358:
1359: IF l_End_cust_account_id IS NOT NULL AND l_End_cust_account_id <> FND_API.G_MISS_NUM THEN
1352: END IF;
1353:
1354: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1355: aso_debug_pub.add('chk_ln: l_End_cust_account_id: '||l_End_cust_account_id,1,'N');
1356: aso_debug_pub.add('line account info: inside shipment loop:party_site: '||p_qte_line_rec.End_Customer_party_site_id,1,'N');
1357: END IF;
1358:
1359: IF l_End_cust_account_id IS NOT NULL AND l_End_cust_account_id <> FND_API.G_MISS_NUM THEN
1360:
1378: FND_MSG_PUB.ADD;
1379: END IF;
1380: raise FND_API.G_EXC_ERROR;
1381: END IF;
1382: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1383: aso_debug_pub.add('line account info: site use after cust account site: '||l_site_use_id,1,'N');
1384: aso_debug_pub.add('line account info: cust_acct_site after cust account site: '||l_end_cust_acct_site_id,1,'N');
1385: END IF;
1386: END IF;
1379: END IF;
1380: raise FND_API.G_EXC_ERROR;
1381: END IF;
1382: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1383: aso_debug_pub.add('line account info: site use after cust account site: '||l_site_use_id,1,'N');
1384: aso_debug_pub.add('line account info: cust_acct_site after cust account site: '||l_end_cust_acct_site_id,1,'N');
1385: END IF;
1386: END IF;
1387:
1380: raise FND_API.G_EXC_ERROR;
1381: END IF;
1382: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1383: aso_debug_pub.add('line account info: site use after cust account site: '||l_site_use_id,1,'N');
1384: aso_debug_pub.add('line account info: cust_acct_site after cust account site: '||l_end_cust_acct_site_id,1,'N');
1385: END IF;
1386: END IF;
1387:
1388: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1384: aso_debug_pub.add('line account info: cust_acct_site after cust account site: '||l_end_cust_acct_site_id,1,'N');
1385: END IF;
1386: END IF;
1387:
1388: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1389: aso_debug_pub.add('chk_ln: before Cust_Acct_Contact_Addr:l_End_cust_account_id: '||l_End_cust_account_id,1,'N');
1390: END IF;
1391:
1392: ASO_CHECK_TCA_PVT.Cust_Acct_Contact_Addr(
1385: END IF;
1386: END IF;
1387:
1388: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1389: aso_debug_pub.add('chk_ln: before Cust_Acct_Contact_Addr:l_End_cust_account_id: '||l_End_cust_account_id,1,'N');
1390: END IF;
1391:
1392: ASO_CHECK_TCA_PVT.Cust_Acct_Contact_Addr(
1393: p_api_version => 1.0,
1400: x_msg_count => x_msg_count,
1401: x_msg_data => x_msg_data,
1402: x_cust_account_role_id => l_End_Customer_contact_id);
1403:
1404: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1405: aso_debug_pub.add('chk_ln: after Cust_Acct_Contact_Addr:l_End_Customer_contact_id: '||l_End_Customer_contact_id,1,'N');
1406: aso_debug_pub.add('chk_ln: after Cust_Acct_Contact_Addr:l_end_cust_acct_site_id: '||l_end_cust_acct_site_id,1,'N');
1407: END IF;
1408:
1401: x_msg_data => x_msg_data,
1402: x_cust_account_role_id => l_End_Customer_contact_id);
1403:
1404: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1405: aso_debug_pub.add('chk_ln: after Cust_Acct_Contact_Addr:l_End_Customer_contact_id: '||l_End_Customer_contact_id,1,'N');
1406: aso_debug_pub.add('chk_ln: after Cust_Acct_Contact_Addr:l_end_cust_acct_site_id: '||l_end_cust_acct_site_id,1,'N');
1407: END IF;
1408:
1409: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1402: x_cust_account_role_id => l_End_Customer_contact_id);
1403:
1404: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1405: aso_debug_pub.add('chk_ln: after Cust_Acct_Contact_Addr:l_End_Customer_contact_id: '||l_End_Customer_contact_id,1,'N');
1406: aso_debug_pub.add('chk_ln: after Cust_Acct_Contact_Addr:l_end_cust_acct_site_id: '||l_end_cust_acct_site_id,1,'N');
1407: END IF;
1408:
1409: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1410: raise FND_API.G_EXC_ERROR;
1411: END IF;
1412:
1413: END IF; -- l_End_cust_account_id is not null
1414:
1415: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1416: aso_debug_pub.add('chk_ln: p_line_shipment_tbl(j).ship_to_cust_account_id: '
1417: ||p_line_shipment_tbl(j).ship_to_cust_account_id,1,'N');
1418: aso_debug_pub.add('chk_ln: p_line_shipment_tbl(j).ship_to_cust_party_id: '
1419: ||p_line_shipment_tbl(j).ship_to_cust_party_id,1,'N');
1412:
1413: END IF; -- l_End_cust_account_id is not null
1414:
1415: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1416: aso_debug_pub.add('chk_ln: p_line_shipment_tbl(j).ship_to_cust_account_id: '
1417: ||p_line_shipment_tbl(j).ship_to_cust_account_id,1,'N');
1418: aso_debug_pub.add('chk_ln: p_line_shipment_tbl(j).ship_to_cust_party_id: '
1419: ||p_line_shipment_tbl(j).ship_to_cust_party_id,1,'N');
1420: aso_debug_pub.add('chk_ln: p_line_shipment_tbl(j).ship_to_party_site_id: '
1414:
1415: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1416: aso_debug_pub.add('chk_ln: p_line_shipment_tbl(j).ship_to_cust_account_id: '
1417: ||p_line_shipment_tbl(j).ship_to_cust_account_id,1,'N');
1418: aso_debug_pub.add('chk_ln: p_line_shipment_tbl(j).ship_to_cust_party_id: '
1419: ||p_line_shipment_tbl(j).ship_to_cust_party_id,1,'N');
1420: aso_debug_pub.add('chk_ln: p_line_shipment_tbl(j).ship_to_party_site_id: '
1421: ||p_line_shipment_tbl(j).ship_to_party_site_id,1,'N');
1422: END IF;
1416: aso_debug_pub.add('chk_ln: p_line_shipment_tbl(j).ship_to_cust_account_id: '
1417: ||p_line_shipment_tbl(j).ship_to_cust_account_id,1,'N');
1418: aso_debug_pub.add('chk_ln: p_line_shipment_tbl(j).ship_to_cust_party_id: '
1419: ||p_line_shipment_tbl(j).ship_to_cust_party_id,1,'N');
1420: aso_debug_pub.add('chk_ln: p_line_shipment_tbl(j).ship_to_party_site_id: '
1421: ||p_line_shipment_tbl(j).ship_to_party_site_id,1,'N');
1422: END IF;
1423: -- bug 5132989
1424: /*
1431: x_return_status => x_return_status,
1432: x_msg_count => x_msg_count,
1433: x_msg_data => x_msg_data );
1434:
1435: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1436: aso_debug_pub.add('chk_lin:(ship)after populate_acct_party: ' || x_return_status,1,'N');
1437: END IF;
1438: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1439: raise FND_API.G_EXC_ERROR;
1432: x_msg_count => x_msg_count,
1433: x_msg_data => x_msg_data );
1434:
1435: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1436: aso_debug_pub.add('chk_lin:(ship)after populate_acct_party: ' || x_return_status,1,'N');
1437: END IF;
1438: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1439: raise FND_API.G_EXC_ERROR;
1440: END IF;
1444: (p_line_shipment_tbl(j).ship_to_cust_account_id IS NULL OR
1445: p_line_shipment_tbl(j).ship_to_cust_account_id = FND_API.G_MISS_NUM) THEN
1446:
1447:
1448: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1449: aso_debug_pub.add('Check_Tca: before customer account:p_header_shipment_tbl(j).
1450: ship_to_cust_party_id '||p_line_shipment_tbl(j).ship_to_cust_party_id,
1451: 1, 'N');
1452: END IF;
1445: p_line_shipment_tbl(j).ship_to_cust_account_id = FND_API.G_MISS_NUM) THEN
1446:
1447:
1448: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1449: aso_debug_pub.add('Check_Tca: before customer account:p_header_shipment_tbl(j).
1450: ship_to_cust_party_id '||p_line_shipment_tbl(j).ship_to_cust_party_id,
1451: 1, 'N');
1452: END IF;
1453: Customer_Account(
1458: x_return_status => x_return_status,
1459: x_msg_count => x_msg_count,
1460: x_msg_data => x_msg_data);
1461:
1462: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1463: aso_debug_pub.add('Check_Tca: after customer account:x_Return_Status '
1464: ||x_Return_Status, 1, 'N');
1465: END IF;
1466: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
1459: x_msg_count => x_msg_count,
1460: x_msg_data => x_msg_data);
1461:
1462: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1463: aso_debug_pub.add('Check_Tca: after customer account:x_Return_Status '
1464: ||x_Return_Status, 1, 'N');
1465: END IF;
1466: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
1467: raise FND_API.G_EXC_ERROR;
1468: END IF;
1469:
1470: END IF; -- ship cust_account_id
1471:
1472: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1473: aso_debug_pub.add('Check_Tca: p_line_shipment_tbl(j).ship_to_cust_account_id: '||
1474: p_line_shipment_tbl(j).ship_to_cust_account_id, 1, 'N');
1475: END IF;
1476:
1469:
1470: END IF; -- ship cust_account_id
1471:
1472: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1473: aso_debug_pub.add('Check_Tca: p_line_shipment_tbl(j).ship_to_cust_account_id: '||
1474: p_line_shipment_tbl(j).ship_to_cust_account_id, 1, 'N');
1475: END IF;
1476:
1477: IF p_line_shipment_tbl(j).ship_to_cust_account_id is not NULL AND
1484: CLOSE C_ship_cust;
1485: END IF;
1486: END IF;
1487:
1488: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1489: aso_debug_pub.add('line acct info: before cust_acct_site:l_ship_cust_account_id: '||l_ship_cust_account_id,1,'N');
1490: END IF;
1491:
1492: IF l_ship_cust_account_id IS NOT NULL AND l_ship_cust_account_id <> FND_API.G_MISS_NUM THEN
1485: END IF;
1486: END IF;
1487:
1488: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1489: aso_debug_pub.add('line acct info: before cust_acct_site:l_ship_cust_account_id: '||l_ship_cust_account_id,1,'N');
1490: END IF;
1491:
1492: IF l_ship_cust_account_id IS NOT NULL AND l_ship_cust_account_id <> FND_API.G_MISS_NUM THEN
1493: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1489: aso_debug_pub.add('line acct info: before cust_acct_site:l_ship_cust_account_id: '||l_ship_cust_account_id,1,'N');
1490: END IF;
1491:
1492: IF l_ship_cust_account_id IS NOT NULL AND l_ship_cust_account_id <> FND_API.G_MISS_NUM THEN
1493: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1494: aso_debug_pub.add('line acct info: before cust_acct_site:p_line_shipment_tbl(j).ship_to_party_site_id: '||p_line_shipment_tbl(j).ship_to_party_site_id,1,'N');
1495: END IF;
1496: IF p_line_shipment_tbl(j).ship_to_party_site_id is not NULL AND
1497: p_line_shipment_tbl(j).ship_to_party_site_id <> FND_API.G_MISS_NUM THEN
1490: END IF;
1491:
1492: IF l_ship_cust_account_id IS NOT NULL AND l_ship_cust_account_id <> FND_API.G_MISS_NUM THEN
1493: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1494: aso_debug_pub.add('line acct info: before cust_acct_site:p_line_shipment_tbl(j).ship_to_party_site_id: '||p_line_shipment_tbl(j).ship_to_party_site_id,1,'N');
1495: END IF;
1496: IF p_line_shipment_tbl(j).ship_to_party_site_id is not NULL AND
1497: p_line_shipment_tbl(j).ship_to_party_site_id <> FND_API.G_MISS_NUM THEN
1498:
1506: ,x_msg_count => x_msg_count
1507: ,x_msg_data => x_msg_data
1508: ,x_site_use_id => l_site_use_id);
1509:
1510: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1511: aso_debug_pub.add('line acct info: after cust_acct_site:l_site_use_id: '||l_site_use_id,1,'N');
1512: aso_debug_pub.add('line acct info: after cust_acct_site:l_shp_cust_acct_site_id: '||l_shp_cust_acct_site_id,1,'N');
1513: END IF;
1514: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1507: ,x_msg_data => x_msg_data
1508: ,x_site_use_id => l_site_use_id);
1509:
1510: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1511: aso_debug_pub.add('line acct info: after cust_acct_site:l_site_use_id: '||l_site_use_id,1,'N');
1512: aso_debug_pub.add('line acct info: after cust_acct_site:l_shp_cust_acct_site_id: '||l_shp_cust_acct_site_id,1,'N');
1513: END IF;
1514: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1515: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1508: ,x_site_use_id => l_site_use_id);
1509:
1510: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1511: aso_debug_pub.add('line acct info: after cust_acct_site:l_site_use_id: '||l_site_use_id,1,'N');
1512: aso_debug_pub.add('line acct info: after cust_acct_site:l_shp_cust_acct_site_id: '||l_shp_cust_acct_site_id,1,'N');
1513: END IF;
1514: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1515: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1516: FND_MESSAGE.Set_Name('ASO', 'ASO_VALIDATE_INV_SITE_AC_CRS');
1521: END IF;
1522:
1523: END IF;
1524:
1525: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1526: aso_debug_pub.add('chk_ln: before Cust_Acct_Contact_Addr:l_ship_cust_account_id: '||l_ship_cust_account_id,1,'N');
1527: END IF;
1528:
1529: ASO_CHECK_TCA_PVT.Cust_Acct_Contact_Addr(
1522:
1523: END IF;
1524:
1525: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1526: aso_debug_pub.add('chk_ln: before Cust_Acct_Contact_Addr:l_ship_cust_account_id: '||l_ship_cust_account_id,1,'N');
1527: END IF;
1528:
1529: ASO_CHECK_TCA_PVT.Cust_Acct_Contact_Addr(
1530: p_api_version => 1.0,
1537: x_msg_count => x_msg_count,
1538: x_msg_data => x_msg_data,
1539: x_cust_account_role_id => l_ship_to_contact_id);
1540:
1541: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1542: aso_debug_pub.add('chk_ln: after Cust_Acct_Contact_Addr:l_ship_to_contact_id: '||l_ship_to_contact_id,1,'N');
1543: aso_debug_pub.add('chk_ln: after Cust_Acct_Contact_Addr:l_shp_cust_acct_site_id: '||l_shp_cust_acct_site_id,1,'N');
1544: END IF;
1545:
1538: x_msg_data => x_msg_data,
1539: x_cust_account_role_id => l_ship_to_contact_id);
1540:
1541: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1542: aso_debug_pub.add('chk_ln: after Cust_Acct_Contact_Addr:l_ship_to_contact_id: '||l_ship_to_contact_id,1,'N');
1543: aso_debug_pub.add('chk_ln: after Cust_Acct_Contact_Addr:l_shp_cust_acct_site_id: '||l_shp_cust_acct_site_id,1,'N');
1544: END IF;
1545:
1546: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1539: x_cust_account_role_id => l_ship_to_contact_id);
1540:
1541: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1542: aso_debug_pub.add('chk_ln: after Cust_Acct_Contact_Addr:l_ship_to_contact_id: '||l_ship_to_contact_id,1,'N');
1543: aso_debug_pub.add('chk_ln: after Cust_Acct_Contact_Addr:l_shp_cust_acct_site_id: '||l_shp_cust_acct_site_id,1,'N');
1544: END IF;
1545:
1546: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1547: raise FND_API.G_EXC_ERROR;
1689: END IF;
1690:
1691: x_return_status := FND_API.G_RET_STS_SUCCESS;
1692:
1693: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1694: aso_debug_pub.add('Chk_TCA.Customer_Account Begin ',1,'N');
1695: aso_debug_pub.add('Customer_Account: p_party_id '||p_party_id,1,'N');
1696: aso_debug_pub.add('Customer_Account: p_error_ret '||p_error_ret,1,'N');
1697: aso_debug_pub.add('Customer_Account: p_calling_api_flag '||p_calling_api_flag,1,'N');
1690:
1691: x_return_status := FND_API.G_RET_STS_SUCCESS;
1692:
1693: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1694: aso_debug_pub.add('Chk_TCA.Customer_Account Begin ',1,'N');
1695: aso_debug_pub.add('Customer_Account: p_party_id '||p_party_id,1,'N');
1696: aso_debug_pub.add('Customer_Account: p_error_ret '||p_error_ret,1,'N');
1697: aso_debug_pub.add('Customer_Account: p_calling_api_flag '||p_calling_api_flag,1,'N');
1698: END IF;
1691: x_return_status := FND_API.G_RET_STS_SUCCESS;
1692:
1693: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1694: aso_debug_pub.add('Chk_TCA.Customer_Account Begin ',1,'N');
1695: aso_debug_pub.add('Customer_Account: p_party_id '||p_party_id,1,'N');
1696: aso_debug_pub.add('Customer_Account: p_error_ret '||p_error_ret,1,'N');
1697: aso_debug_pub.add('Customer_Account: p_calling_api_flag '||p_calling_api_flag,1,'N');
1698: END IF;
1699:
1692:
1693: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1694: aso_debug_pub.add('Chk_TCA.Customer_Account Begin ',1,'N');
1695: aso_debug_pub.add('Customer_Account: p_party_id '||p_party_id,1,'N');
1696: aso_debug_pub.add('Customer_Account: p_error_ret '||p_error_ret,1,'N');
1697: aso_debug_pub.add('Customer_Account: p_calling_api_flag '||p_calling_api_flag,1,'N');
1698: END IF;
1699:
1700: OPEN party_rec(p_party_id);
1693: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1694: aso_debug_pub.add('Chk_TCA.Customer_Account Begin ',1,'N');
1695: aso_debug_pub.add('Customer_Account: p_party_id '||p_party_id,1,'N');
1696: aso_debug_pub.add('Customer_Account: p_error_ret '||p_error_ret,1,'N');
1697: aso_debug_pub.add('Customer_Account: p_calling_api_flag '||p_calling_api_flag,1,'N');
1698: END IF;
1699:
1700: OPEN party_rec(p_party_id);
1701: FETCH party_rec INTO l_party_type;
1700: OPEN party_rec(p_party_id);
1701: FETCH party_rec INTO l_party_type;
1702: CLOSE party_rec;
1703:
1704: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1705: aso_debug_pub.add('Cust_Acct:party type for sold_to = '|| l_party_type,1,'N');
1706: END IF;
1707: IF l_party_type = 'PERSON' OR l_party_type ='ORGANIZATION' THEN
1708:
1701: FETCH party_rec INTO l_party_type;
1702: CLOSE party_rec;
1703:
1704: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1705: aso_debug_pub.add('Cust_Acct:party type for sold_to = '|| l_party_type,1,'N');
1706: END IF;
1707: IF l_party_type = 'PERSON' OR l_party_type ='ORGANIZATION' THEN
1708:
1709: IF p_error_ret = FND_API.G_TRUE AND p_calling_api_flag NOT IN (1,2) THEN
1710: OPEN C_Get_Account_Count(p_party_id);
1711: FETCH C_Get_Account_Count INTO l_acct_count;
1712: CLOSE C_Get_Account_Count;
1713:
1714: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1715: aso_debug_pub.add('Cust_Acct:l_acct_count: '|| l_acct_count,1,'N');
1716: END IF;
1717: IF l_acct_count > 1 THEN
1718: x_return_status := FND_API.G_RET_STS_ERROR;
1711: FETCH C_Get_Account_Count INTO l_acct_count;
1712: CLOSE C_Get_Account_Count;
1713:
1714: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1715: aso_debug_pub.add('Cust_Acct:l_acct_count: '|| l_acct_count,1,'N');
1716: END IF;
1717: IF l_acct_count > 1 THEN
1718: x_return_status := FND_API.G_RET_STS_ERROR;
1719: FND_MESSAGE.Set_Name('ASO', 'ASO_MULTIPLE_CUST_ACCOUNT');
1727: OPEN C_get_cust_id_from_party_id(p_Party_Id);
1728: FETCH C_get_cust_id_from_party_id INTO lx_cust_id;
1729: CLOSE C_get_cust_id_from_party_id;
1730:
1731: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1732: aso_debug_pub.add('Cust_Acct:cust acct id for sold_to = '|| lx_cust_id,1,'N');
1733: END IF;
1734:
1735: ELSIF l_party_type = 'PARTY_RELATIONSHIP' THEN -- party_type
1728: FETCH C_get_cust_id_from_party_id INTO lx_cust_id;
1729: CLOSE C_get_cust_id_from_party_id;
1730:
1731: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1732: aso_debug_pub.add('Cust_Acct:cust acct id for sold_to = '|| lx_cust_id,1,'N');
1733: END IF;
1734:
1735: ELSIF l_party_type = 'PARTY_RELATIONSHIP' THEN -- party_type
1736:
1738: OPEN C_Get_Account_User_Count(p_party_id);
1739: FETCH C_Get_Account_User_Count INTO l_acct_count;
1740: CLOSE C_Get_Account_User_Count;
1741:
1742: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1743: aso_debug_pub.add('Cust_Acct:l_acct_count: '|| l_acct_count,1,'N');
1744: END IF;
1745: IF l_acct_count > 1 THEN
1746: x_return_status := FND_API.G_RET_STS_ERROR;
1739: FETCH C_Get_Account_User_Count INTO l_acct_count;
1740: CLOSE C_Get_Account_User_Count;
1741:
1742: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1743: aso_debug_pub.add('Cust_Acct:l_acct_count: '|| l_acct_count,1,'N');
1744: END IF;
1745: IF l_acct_count > 1 THEN
1746: x_return_status := FND_API.G_RET_STS_ERROR;
1747: FND_MESSAGE.Set_Name('ASO', 'ASO_MULTIPLE_CUST_ACCOUNT');
1754: OPEN account_user_cur(p_party_id);
1755: FETCH account_user_cur INTO lx_cust_id;
1756: CLOSE account_user_cur;
1757:
1758: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1759: aso_debug_pub.add('cust acct id for sold_to = '|| lx_cust_id,1,'N');
1760: END IF;
1761: END IF; -- party_type
1762:
1755: FETCH account_user_cur INTO lx_cust_id;
1756: CLOSE account_user_cur;
1757:
1758: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1759: aso_debug_pub.add('cust acct id for sold_to = '|| lx_cust_id,1,'N');
1760: END IF;
1761: END IF; -- party_type
1762:
1763: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1759: aso_debug_pub.add('cust acct id for sold_to = '|| lx_cust_id,1,'N');
1760: END IF;
1761: END IF; -- party_type
1762:
1763: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1764: aso_debug_pub.add('checking for object id of relationship',1,'N');
1765: aso_debug_pub.add('lx_cust_id in rel = ' || lx_cust_id,1,'N');
1766: END IF;
1767:
1760: END IF;
1761: END IF; -- party_type
1762:
1763: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1764: aso_debug_pub.add('checking for object id of relationship',1,'N');
1765: aso_debug_pub.add('lx_cust_id in rel = ' || lx_cust_id,1,'N');
1766: END IF;
1767:
1768: IF lx_cust_id is NULL OR lx_cust_id = FND_API.G_MISS_NUM THEN
1761: END IF; -- party_type
1762:
1763: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1764: aso_debug_pub.add('checking for object id of relationship',1,'N');
1765: aso_debug_pub.add('lx_cust_id in rel = ' || lx_cust_id,1,'N');
1766: END IF;
1767:
1768: IF lx_cust_id is NULL OR lx_cust_id = FND_API.G_MISS_NUM THEN
1769:
1768: IF lx_cust_id is NULL OR lx_cust_id = FND_API.G_MISS_NUM THEN
1769:
1770: OPEN party_rel_cur(p_party_id);
1771: FETCH party_rel_cur INTO l_object_party_id;
1772: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1773: aso_debug_pub.add('object_id = ' || l_object_party_id,1,'N');
1774: END IF;
1775: IF party_rel_cur%NOTFOUND THEN
1776: -- x_return_status := FND_API.G_RET_STS_ERROR;
1769:
1770: OPEN party_rel_cur(p_party_id);
1771: FETCH party_rel_cur INTO l_object_party_id;
1772: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1773: aso_debug_pub.add('object_id = ' || l_object_party_id,1,'N');
1774: END IF;
1775: IF party_rel_cur%NOTFOUND THEN
1776: -- x_return_status := FND_API.G_RET_STS_ERROR;
1777: CLOSE party_rel_cur;
1779: IF p_error_ret = FND_API.G_TRUE AND p_calling_api_flag NOT IN (1,2) THEN
1780: OPEN C_Get_Account_Count(l_object_party_id);
1781: FETCH C_Get_Account_Count INTO l_acct_count;
1782: CLOSE C_Get_Account_Count;
1783: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1784: aso_debug_pub.add('Cust_Acct:l_acct_count: '|| l_acct_count,1,'N');
1785: END IF;
1786:
1787: IF l_acct_count > 1 THEN
1780: OPEN C_Get_Account_Count(l_object_party_id);
1781: FETCH C_Get_Account_Count INTO l_acct_count;
1782: CLOSE C_Get_Account_Count;
1783: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1784: aso_debug_pub.add('Cust_Acct:l_acct_count: '|| l_acct_count,1,'N');
1785: END IF;
1786:
1787: IF l_acct_count > 1 THEN
1788: x_return_status := FND_API.G_RET_STS_ERROR;
1795:
1796: OPEN account_user_cur(l_object_party_id);
1797: FETCH account_user_cur INTO lx_cust_id;
1798: CLOSE account_user_cur;
1799: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1800: aso_debug_pub.add('cust acct id for sold_to = '|| lx_cust_id,1,'N');
1801: END IF;
1802:
1803: END IF; -- party_rel_cur
1796: OPEN account_user_cur(l_object_party_id);
1797: FETCH account_user_cur INTO lx_cust_id;
1798: CLOSE account_user_cur;
1799: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1800: aso_debug_pub.add('cust acct id for sold_to = '|| lx_cust_id,1,'N');
1801: END IF;
1802:
1803: END IF; -- party_rel_cur
1804:
1803: END IF; -- party_rel_cur
1804:
1805: END IF; -- lx_cust_id
1806: -- create customer account
1807: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1808: aso_debug_pub.add('creating customer account',1,'N');
1809: END IF;
1810: IF lx_cust_id IS NULL OR lx_cust_id = FND_API.G_MISS_NUM THEN
1811: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1804:
1805: END IF; -- lx_cust_id
1806: -- create customer account
1807: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1808: aso_debug_pub.add('creating customer account',1,'N');
1809: END IF;
1810: IF lx_cust_id IS NULL OR lx_cust_id = FND_API.G_MISS_NUM THEN
1811: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1812: aso_debug_pub.add('Cust_Acct:l_create_acct_prof: '|| l_create_acct_prof,1,'N');
1807: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1808: aso_debug_pub.add('creating customer account',1,'N');
1809: END IF;
1810: IF lx_cust_id IS NULL OR lx_cust_id = FND_API.G_MISS_NUM THEN
1811: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1812: aso_debug_pub.add('Cust_Acct:l_create_acct_prof: '|| l_create_acct_prof,1,'N');
1813: END IF;
1814: IF p_calling_api_flag = 1 AND (l_create_acct_prof = 'PLACE_ORDER') THEN
1815: x_return_status := FND_API.G_RET_STS_ERROR;
1808: aso_debug_pub.add('creating customer account',1,'N');
1809: END IF;
1810: IF lx_cust_id IS NULL OR lx_cust_id = FND_API.G_MISS_NUM THEN
1811: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1812: aso_debug_pub.add('Cust_Acct:l_create_acct_prof: '|| l_create_acct_prof,1,'N');
1813: END IF;
1814: IF p_calling_api_flag = 1 AND (l_create_acct_prof = 'PLACE_ORDER') THEN
1815: x_return_status := FND_API.G_RET_STS_ERROR;
1816: FND_MESSAGE.Set_Name('ASO', 'ASO_CANNOT_CREATE_ACCOUNT');
1828:
1829: IF (l_create_acct_prof = 'ALWAYS') OR
1830: (l_create_acct_prof = 'AS_REQUIRED' AND p_calling_api_flag = 1) OR
1831: (p_calling_api_flag = 2) THEN -- ER 5484749
1832: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1833: aso_debug_pub.add('creating customer account: create_acct_prof: '||l_create_acct_prof,1,'N');
1834: END IF;
1835: IF p_Party_Id is not NULL
1836: AND p_Party_Id <> FND_API.G_MISS_NUM THEN
1829: IF (l_create_acct_prof = 'ALWAYS') OR
1830: (l_create_acct_prof = 'AS_REQUIRED' AND p_calling_api_flag = 1) OR
1831: (p_calling_api_flag = 2) THEN -- ER 5484749
1832: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1833: aso_debug_pub.add('creating customer account: create_acct_prof: '||l_create_acct_prof,1,'N');
1834: END IF;
1835: IF p_Party_Id is not NULL
1836: AND p_Party_Id <> FND_API.G_MISS_NUM THEN
1837: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1833: aso_debug_pub.add('creating customer account: create_acct_prof: '||l_create_acct_prof,1,'N');
1834: END IF;
1835: IF p_Party_Id is not NULL
1836: AND p_Party_Id <> FND_API.G_MISS_NUM THEN
1837: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1838: aso_debug_pub.add('creating cust account',1,'N');
1839: END IF;
1840: ASO_PARTY_INT.Create_Customer_Account(
1841: p_api_version => 1.0,
1834: END IF;
1835: IF p_Party_Id is not NULL
1836: AND p_Party_Id <> FND_API.G_MISS_NUM THEN
1837: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1838: aso_debug_pub.add('creating cust account',1,'N');
1839: END IF;
1840: ASO_PARTY_INT.Create_Customer_Account(
1841: p_api_version => 1.0,
1842: P_Party_id => p_Party_Id,
1869: x_Cust_Acct_Id := lx_cust_id;
1870:
1871: END IF; -- lx_cust_id
1872:
1873: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1874: aso_debug_pub.add('x_cust_acct_id = '|| x_cust_acct_id,1,'N');
1875: END IF;
1876: FND_MSG_PUB.Count_And_Get
1877: ( p_count => x_msg_count,
1870:
1871: END IF; -- lx_cust_id
1872:
1873: IF aso_debug_pub.g_debug_flag = 'Y' THEN
1874: aso_debug_pub.add('x_cust_acct_id = '|| x_cust_acct_id,1,'N');
1875: END IF;
1876: FND_MSG_PUB.Count_And_Get
1877: ( p_count => x_msg_count,
1878: p_data => x_msg_data
2035: END IF;
2036:
2037: x_return_status := FND_API.G_RET_STS_SUCCESS;
2038:
2039: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2040: aso_debug_pub.add('site type in Customer_Account_Site = ' || p_acct_site_type,1,'N');
2041: END IF;
2042:
2043: IF p_acct_site_type = 'END_USER' THEN
2036:
2037: x_return_status := FND_API.G_RET_STS_SUCCESS;
2038:
2039: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2040: aso_debug_pub.add('site type in Customer_Account_Site = ' || p_acct_site_type,1,'N');
2041: END IF;
2042:
2043: IF p_acct_site_type = 'END_USER' THEN
2044: l_acct_site_type := 'SHIP_TO';
2057: FND_MSG_PUB.ADD;
2058: END IF;
2059: raise FND_API.G_EXC_ERROR;
2060: END IF;
2061: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2062: aso_debug_pub.add('party_type in Customer_Account_Site = ' || l_party_type,1,'N');
2063: END IF;
2064: CLOSE party_cur;
2065:
2058: END IF;
2059: raise FND_API.G_EXC_ERROR;
2060: END IF;
2061: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2062: aso_debug_pub.add('party_type in Customer_Account_Site = ' || l_party_type,1,'N');
2063: END IF;
2064: CLOSE party_cur;
2065:
2066: IF l_party_type = 'PARTY_RELATIONSHIP' THEN
2079: ELSE
2080: cur_party_id := l_party_id;
2081: END IF;
2082:
2083: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2084: aso_debug_pub.add('cur_party_id = ' || cur_party_id,1,'N');
2085: END IF;
2086:
2087: -- bug 4947772
2080: cur_party_id := l_party_id;
2081: END IF;
2082:
2083: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2084: aso_debug_pub.add('cur_party_id = ' || cur_party_id,1,'N');
2085: END IF;
2086:
2087: -- bug 4947772
2088: OPEN active_site_cur;
2086:
2087: -- bug 4947772
2088: OPEN active_site_cur;
2089: FETCH active_site_cur INTO x_cust_acct_site_id, cust_acct_site_status;
2090: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2091: aso_debug_pub.add('x_cust_acct_site_id in Customer_Account_Site = ' || x_cust_acct_site_id,1,'N');
2092: aso_debug_pub.add('Customer_Account_Site: cust_acct_site_status: ' || cust_acct_site_status,1,'N');
2093: END IF;
2094:
2087: -- bug 4947772
2088: OPEN active_site_cur;
2089: FETCH active_site_cur INTO x_cust_acct_site_id, cust_acct_site_status;
2090: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2091: aso_debug_pub.add('x_cust_acct_site_id in Customer_Account_Site = ' || x_cust_acct_site_id,1,'N');
2092: aso_debug_pub.add('Customer_Account_Site: cust_acct_site_status: ' || cust_acct_site_status,1,'N');
2093: END IF;
2094:
2095: IF active_site_cur%NOTFOUND THEN
2088: OPEN active_site_cur;
2089: FETCH active_site_cur INTO x_cust_acct_site_id, cust_acct_site_status;
2090: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2091: aso_debug_pub.add('x_cust_acct_site_id in Customer_Account_Site = ' || x_cust_acct_site_id,1,'N');
2092: aso_debug_pub.add('Customer_Account_Site: cust_acct_site_status: ' || cust_acct_site_status,1,'N');
2093: END IF;
2094:
2095: IF active_site_cur%NOTFOUND THEN
2096:
2124:
2125:
2126: OPEN active_site_use_cur(x_cust_acct_site_id, l_acct_site_type);
2127: FETCH active_site_use_cur INTO x_site_use_id, cust_site_use_status;
2128: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2129: aso_debug_pub.add('Customer_Account_Site: cust_site_use_status: ' || cust_site_use_status,1,'N');
2130: aso_debug_pub.add('Customer_Account_Site: x_site_use_id: ' || x_site_use_id,1,'N');
2131: END IF;
2132: IF (active_site_use_cur%NOTFOUND) THEN
2125:
2126: OPEN active_site_use_cur(x_cust_acct_site_id, l_acct_site_type);
2127: FETCH active_site_use_cur INTO x_site_use_id, cust_site_use_status;
2128: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2129: aso_debug_pub.add('Customer_Account_Site: cust_site_use_status: ' || cust_site_use_status,1,'N');
2130: aso_debug_pub.add('Customer_Account_Site: x_site_use_id: ' || x_site_use_id,1,'N');
2131: END IF;
2132: IF (active_site_use_cur%NOTFOUND) THEN
2133: -- this means there are no active site uses
2126: OPEN active_site_use_cur(x_cust_acct_site_id, l_acct_site_type);
2127: FETCH active_site_use_cur INTO x_site_use_id, cust_site_use_status;
2128: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2129: aso_debug_pub.add('Customer_Account_Site: cust_site_use_status: ' || cust_site_use_status,1,'N');
2130: aso_debug_pub.add('Customer_Account_Site: x_site_use_id: ' || x_site_use_id,1,'N');
2131: END IF;
2132: IF (active_site_use_cur%NOTFOUND) THEN
2133: -- this means there are no active site uses
2134: OPEN inactive_site_use_cur(x_cust_acct_site_id, l_acct_site_type);
2152: CLOSE inactive_site_use_cur;
2153: END IF;
2154: CLOSE active_site_use_cur;
2155:
2156: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2157: aso_debug_pub.add('site_use_id in Customer_Account_Site = ' || x_site_use_id,1,'N');
2158: END IF;
2159:
2160: END IF;
2153: END IF;
2154: CLOSE active_site_use_cur;
2155:
2156: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2157: aso_debug_pub.add('site_use_id in Customer_Account_Site = ' || x_site_use_id,1,'N');
2158: END IF;
2159:
2160: END IF;
2161:
2158: END IF;
2159:
2160: END IF;
2161:
2162: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2163: aso_debug_pub.add('Customer_Account_Site: x_site_use_id: ' || x_site_use_id,1,'N');
2164: END IF;
2165: IF x_site_use_id is NULL OR
2166: x_site_use_id = FND_API.G_MISS_NUM THEN
2159:
2160: END IF;
2161:
2162: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2163: aso_debug_pub.add('Customer_Account_Site: x_site_use_id: ' || x_site_use_id,1,'N');
2164: END IF;
2165: IF x_site_use_id is NULL OR
2166: x_site_use_id = FND_API.G_MISS_NUM THEN
2167:
2164: END IF;
2165: IF x_site_use_id is NULL OR
2166: x_site_use_id = FND_API.G_MISS_NUM THEN
2167:
2168: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2169: aso_debug_pub.add('calling create accsite uses ',1, 'N');
2170: END IF;
2171: ASO_PARTY_INT.Create_ACCT_SITE_USES (
2172: p_api_version => 1.0
2165: IF x_site_use_id is NULL OR
2166: x_site_use_id = FND_API.G_MISS_NUM THEN
2167:
2168: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2169: aso_debug_pub.add('calling create accsite uses ',1, 'N');
2170: END IF;
2171: ASO_PARTY_INT.Create_ACCT_SITE_USES (
2172: p_api_version => 1.0
2173: ,P_Cust_Account_Id => p_cust_account_id
2182: );
2183:
2184: x_cust_acct_site_id := lx_cust_acct_site_id;
2185:
2186: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2187: aso_debug_pub.add('site_use_id after deriving invoice = ' || x_site_use_id,1, 'Y');
2188: END IF;
2189: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
2190: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
2183:
2184: x_cust_acct_site_id := lx_cust_acct_site_id;
2185:
2186: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2187: aso_debug_pub.add('site_use_id after deriving invoice = ' || x_site_use_id,1, 'Y');
2188: END IF;
2189: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
2190: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
2191: FND_MESSAGE.Set_Name('ASO', 'ASO_ACCT_SITE_USE');
2290: RAISE FND_API.g_exc_unexpected_error;
2291: END IF;
2292:
2293: x_return_status := FND_API.g_ret_sts_success;
2294: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2295: aso_debug_pub.add('Entering cust acct relationship ',1, 'Y');
2296: END IF;
2297:
2298: OPEN c_cust_acct_relate;
2291: END IF;
2292:
2293: x_return_status := FND_API.g_ret_sts_success;
2294: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2295: aso_debug_pub.add('Entering cust acct relationship ',1, 'Y');
2296: END IF;
2297:
2298: OPEN c_cust_acct_relate;
2299: FETCH c_cust_acct_relate
2310: l_cust_acct_flag_match := FND_API.G_TRUE;
2311: END IF;
2312: END IF;
2313:
2314: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2315: aso_debug_pub.add('cust acct relationship: l_cust_acct_match is ' || l_cust_acct_match,1, 'N');
2316: END IF;
2317: IF NOT FND_API.TO_Boolean(l_cust_acct_flag_match) THEN
2318: -- no matching rows
2311: END IF;
2312: END IF;
2313:
2314: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2315: aso_debug_pub.add('cust acct relationship: l_cust_acct_match is ' || l_cust_acct_match,1, 'N');
2316: END IF;
2317: IF NOT FND_API.TO_Boolean(l_cust_acct_flag_match) THEN
2318: -- no matching rows
2319: IF NOT FND_API.TO_Boolean(l_cust_acct_match) THEN
2334: ELSE
2335: /*bug 8239850*/
2336: IF FND_API.TO_Boolean(l_cust_acct_match) THEN
2337: IF NOT FND_API.TO_Boolean(l_cust_acct_flag_match) THEN
2338: aso_debug_pub.add('before update_Cust_Acct_Relationship: l_cust_acct_match is ' || l_cust_acct_match,1, 'N');
2339: ASO_PARTY_INT.update_Cust_Acct_Relationship(
2340: p_api_version => 1.0,
2341: p_sold_to_cust_account => p_sold_to_cust_account,
2342: p_related_cust_account => p_related_cust_account,
2458: END IF;
2459:
2460: x_return_status := FND_API.G_RET_STS_SUCCESS;
2461:
2462: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2463: aso_debug_pub.add('Cust_acct_contact_Addr: p_role_type: '||p_role_type,1,'N');
2464: END IF;
2465:
2466: IF p_role_type = 'END_USER' THEN
2459:
2460: x_return_status := FND_API.G_RET_STS_SUCCESS;
2461:
2462: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2463: aso_debug_pub.add('Cust_acct_contact_Addr: p_role_type: '||p_role_type,1,'N');
2464: END IF;
2465:
2466: IF p_role_type = 'END_USER' THEN
2467: l_role_type := 'SHIP_TO';
2474:
2475: IF p_party_site_id is not NULL AND
2476: p_party_site_id <> FND_API.G_MISS_NUM THEN
2477:
2478: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2479: aso_debug_pub.add('deriving cust acct role for party id ',1,'N');
2480: END IF;
2481:
2482: ASO_MAP_QUOTE_ORDER_INT.get_cust_acct_roles(
2475: IF p_party_site_id is not NULL AND
2476: p_party_site_id <> FND_API.G_MISS_NUM THEN
2477:
2478: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2479: aso_debug_pub.add('deriving cust acct role for party id ',1,'N');
2480: END IF;
2481:
2482: ASO_MAP_QUOTE_ORDER_INT.get_cust_acct_roles(
2483: p_party_id =>p_party_id
2486: ,p_cust_account_id => p_cust_account_id
2487: ,x_return_status => x_return_status
2488: ,x_party_id => l_contact_party_id
2489: ,x_cust_account_role_id => l_contact_id);
2490: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2491: aso_debug_pub.add('status after get cust acct roles in Cust_Acct_Contact_Addr = ' || x_return_status,1,'N');
2492: END IF;
2493: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2494: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
2487: ,x_return_status => x_return_status
2488: ,x_party_id => l_contact_party_id
2489: ,x_cust_account_role_id => l_contact_id);
2490: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2491: aso_debug_pub.add('status after get cust acct roles in Cust_Acct_Contact_Addr = ' || x_return_status,1,'N');
2492: END IF;
2493: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2494: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
2495: IF p_role_type = 'BILL_TO' THEN
2504: raise FND_API.G_EXC_ERROR;
2505:
2506: ELSE -- x_ret_status = success
2507: IF l_contact_party_id <> FND_API.G_MISS_NUM THEN
2508: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2509: aso_debug_pub.add('cust account site = ' ||p_cust_account_site,1,'N');
2510: END IF;
2511: ASO_PARTY_INT.Create_Contact_Role (
2512: p_api_version => 1.0
2505:
2506: ELSE -- x_ret_status = success
2507: IF l_contact_party_id <> FND_API.G_MISS_NUM THEN
2508: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2509: aso_debug_pub.add('cust account site = ' ||p_cust_account_site,1,'N');
2510: END IF;
2511: ASO_PARTY_INT.Create_Contact_Role (
2512: p_api_version => 1.0
2513: ,p_party_id => l_contact_party_id
2519: ,x_msg_count => x_msg_count
2520: ,x_msg_data => x_msg_data
2521: ,x_cust_account_role_id => x_cust_account_role_id);
2522:
2523: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2524: aso_debug_pub.add('status after create contact role ship = '|| x_return_status,1,'N');
2525: END IF;
2526:
2527: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
2520: ,x_msg_data => x_msg_data
2521: ,x_cust_account_role_id => x_cust_account_role_id);
2522:
2523: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2524: aso_debug_pub.add('status after create contact role ship = '|| x_return_status,1,'N');
2525: END IF;
2526:
2527: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
2528: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
2665:
2666: -- Initialize API return status to success
2667: x_return_status := FND_API.G_RET_STS_SUCCESS;
2668:
2669: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2670: aso_debug_pub.add('Assign_Customer_Accounts - Begin p_qte_header_id:'|| p_qte_header_id, 1, 'Y');
2671: END IF;
2672:
2673: OPEN C_Validate_Quote (p_qte_header_id);
2666: -- Initialize API return status to success
2667: x_return_status := FND_API.G_RET_STS_SUCCESS;
2668:
2669: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2670: aso_debug_pub.add('Assign_Customer_Accounts - Begin p_qte_header_id:'|| p_qte_header_id, 1, 'Y');
2671: END IF;
2672:
2673: OPEN C_Validate_Quote (p_qte_header_id);
2674: FETCH C_Validate_Quote into l_dummy;
2679: FND_MESSAGE.Set_Token('VALUE', TO_CHAR(p_qte_header_id), FALSE);
2680: FND_MSG_PUB.ADD;
2681: END IF;
2682:
2683: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2684: aso_debug_pub.add('Assign_Customer_Accounts - Invalid qte_hdr_id', 1, 'Y');
2685: END IF;
2686:
2687: CLOSE C_Validate_Quote;
2680: FND_MSG_PUB.ADD;
2681: END IF;
2682:
2683: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2684: aso_debug_pub.add('Assign_Customer_Accounts - Invalid qte_hdr_id', 1, 'Y');
2685: END IF;
2686:
2687: CLOSE C_Validate_Quote;
2688: x_return_status := FND_API.G_RET_STS_ERROR;
2689: RAISE FND_API.G_EXC_ERROR;
2690: END IF;
2691: CLOSE C_Validate_Quote;
2692:
2693: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2694: aso_debug_pub.add('Assign_Customer_Accounts - After qte_hdr_id check', 1, 'Y');
2695: END IF;
2696:
2697: OPEN C_Get_Hdr_Acct(p_qte_header_id);
2690: END IF;
2691: CLOSE C_Validate_Quote;
2692:
2693: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2694: aso_debug_pub.add('Assign_Customer_Accounts - After qte_hdr_id check', 1, 'Y');
2695: END IF;
2696:
2697: OPEN C_Get_Hdr_Acct(p_qte_header_id);
2698: FETCH C_Get_Hdr_Acct INTO
2722: l_cust_party := l_qte_header_rec.cust_party_id;
2723: l_inv_cust_party := l_qte_header_rec.invoice_to_cust_party_id;
2724:
2725:
2726: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2727: aso_debug_pub.add('Assign_Customer_Accounts: p_qte_header_id: '||p_qte_header_id, 1, 'N');
2728: aso_debug_pub.add('Assign_Customer_Accounts: p_calling_api_flag: '||p_calling_api_flag, 1, 'N');
2729: aso_debug_pub.add('Assign_Customer_Accounts: l_cust_acct: '||l_cust_acct, 1, 'N');
2730: aso_debug_pub.add('Assign_Customer_Accounts: l_inv_cust_acct: '||l_inv_cust_acct, 1, 'N');
2723: l_inv_cust_party := l_qte_header_rec.invoice_to_cust_party_id;
2724:
2725:
2726: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2727: aso_debug_pub.add('Assign_Customer_Accounts: p_qte_header_id: '||p_qte_header_id, 1, 'N');
2728: aso_debug_pub.add('Assign_Customer_Accounts: p_calling_api_flag: '||p_calling_api_flag, 1, 'N');
2729: aso_debug_pub.add('Assign_Customer_Accounts: l_cust_acct: '||l_cust_acct, 1, 'N');
2730: aso_debug_pub.add('Assign_Customer_Accounts: l_inv_cust_acct: '||l_inv_cust_acct, 1, 'N');
2731: aso_debug_pub.add('Assign_Customer_Accounts: l_cust_party: '||l_cust_party, 1, 'N');
2724:
2725:
2726: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2727: aso_debug_pub.add('Assign_Customer_Accounts: p_qte_header_id: '||p_qte_header_id, 1, 'N');
2728: aso_debug_pub.add('Assign_Customer_Accounts: p_calling_api_flag: '||p_calling_api_flag, 1, 'N');
2729: aso_debug_pub.add('Assign_Customer_Accounts: l_cust_acct: '||l_cust_acct, 1, 'N');
2730: aso_debug_pub.add('Assign_Customer_Accounts: l_inv_cust_acct: '||l_inv_cust_acct, 1, 'N');
2731: aso_debug_pub.add('Assign_Customer_Accounts: l_cust_party: '||l_cust_party, 1, 'N');
2732: aso_debug_pub.add('Assign_Customer_Accounts: l_inv_cust_party: '||l_inv_cust_party, 1, 'N');
2725:
2726: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2727: aso_debug_pub.add('Assign_Customer_Accounts: p_qte_header_id: '||p_qte_header_id, 1, 'N');
2728: aso_debug_pub.add('Assign_Customer_Accounts: p_calling_api_flag: '||p_calling_api_flag, 1, 'N');
2729: aso_debug_pub.add('Assign_Customer_Accounts: l_cust_acct: '||l_cust_acct, 1, 'N');
2730: aso_debug_pub.add('Assign_Customer_Accounts: l_inv_cust_acct: '||l_inv_cust_acct, 1, 'N');
2731: aso_debug_pub.add('Assign_Customer_Accounts: l_cust_party: '||l_cust_party, 1, 'N');
2732: aso_debug_pub.add('Assign_Customer_Accounts: l_inv_cust_party: '||l_inv_cust_party, 1, 'N');
2733: aso_debug_pub.add('Assign_Customer_Accounts: l_end_cust_acct: '||l_end_cust_acct, 1, 'N');
2726: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2727: aso_debug_pub.add('Assign_Customer_Accounts: p_qte_header_id: '||p_qte_header_id, 1, 'N');
2728: aso_debug_pub.add('Assign_Customer_Accounts: p_calling_api_flag: '||p_calling_api_flag, 1, 'N');
2729: aso_debug_pub.add('Assign_Customer_Accounts: l_cust_acct: '||l_cust_acct, 1, 'N');
2730: aso_debug_pub.add('Assign_Customer_Accounts: l_inv_cust_acct: '||l_inv_cust_acct, 1, 'N');
2731: aso_debug_pub.add('Assign_Customer_Accounts: l_cust_party: '||l_cust_party, 1, 'N');
2732: aso_debug_pub.add('Assign_Customer_Accounts: l_inv_cust_party: '||l_inv_cust_party, 1, 'N');
2733: aso_debug_pub.add('Assign_Customer_Accounts: l_end_cust_acct: '||l_end_cust_acct, 1, 'N');
2734: aso_debug_pub.add('Assign_Customer_Accounts: l_end_cust_party: '||l_end_cust_party, 1, 'N');
2727: aso_debug_pub.add('Assign_Customer_Accounts: p_qte_header_id: '||p_qte_header_id, 1, 'N');
2728: aso_debug_pub.add('Assign_Customer_Accounts: p_calling_api_flag: '||p_calling_api_flag, 1, 'N');
2729: aso_debug_pub.add('Assign_Customer_Accounts: l_cust_acct: '||l_cust_acct, 1, 'N');
2730: aso_debug_pub.add('Assign_Customer_Accounts: l_inv_cust_acct: '||l_inv_cust_acct, 1, 'N');
2731: aso_debug_pub.add('Assign_Customer_Accounts: l_cust_party: '||l_cust_party, 1, 'N');
2732: aso_debug_pub.add('Assign_Customer_Accounts: l_inv_cust_party: '||l_inv_cust_party, 1, 'N');
2733: aso_debug_pub.add('Assign_Customer_Accounts: l_end_cust_acct: '||l_end_cust_acct, 1, 'N');
2734: aso_debug_pub.add('Assign_Customer_Accounts: l_end_cust_party: '||l_end_cust_party, 1, 'N');
2735: aso_debug_pub.add('l_qte_header_rec.party_id = ' || l_qte_header_rec.party_id,1,'N');
2728: aso_debug_pub.add('Assign_Customer_Accounts: p_calling_api_flag: '||p_calling_api_flag, 1, 'N');
2729: aso_debug_pub.add('Assign_Customer_Accounts: l_cust_acct: '||l_cust_acct, 1, 'N');
2730: aso_debug_pub.add('Assign_Customer_Accounts: l_inv_cust_acct: '||l_inv_cust_acct, 1, 'N');
2731: aso_debug_pub.add('Assign_Customer_Accounts: l_cust_party: '||l_cust_party, 1, 'N');
2732: aso_debug_pub.add('Assign_Customer_Accounts: l_inv_cust_party: '||l_inv_cust_party, 1, 'N');
2733: aso_debug_pub.add('Assign_Customer_Accounts: l_end_cust_acct: '||l_end_cust_acct, 1, 'N');
2734: aso_debug_pub.add('Assign_Customer_Accounts: l_end_cust_party: '||l_end_cust_party, 1, 'N');
2735: aso_debug_pub.add('l_qte_header_rec.party_id = ' || l_qte_header_rec.party_id,1,'N');
2736: aso_debug_pub.add('l_qte_header_rec.sold_to_party_site_id = '||l_qte_header_rec.sold_to_party_site_id,1,'N');
2729: aso_debug_pub.add('Assign_Customer_Accounts: l_cust_acct: '||l_cust_acct, 1, 'N');
2730: aso_debug_pub.add('Assign_Customer_Accounts: l_inv_cust_acct: '||l_inv_cust_acct, 1, 'N');
2731: aso_debug_pub.add('Assign_Customer_Accounts: l_cust_party: '||l_cust_party, 1, 'N');
2732: aso_debug_pub.add('Assign_Customer_Accounts: l_inv_cust_party: '||l_inv_cust_party, 1, 'N');
2733: aso_debug_pub.add('Assign_Customer_Accounts: l_end_cust_acct: '||l_end_cust_acct, 1, 'N');
2734: aso_debug_pub.add('Assign_Customer_Accounts: l_end_cust_party: '||l_end_cust_party, 1, 'N');
2735: aso_debug_pub.add('l_qte_header_rec.party_id = ' || l_qte_header_rec.party_id,1,'N');
2736: aso_debug_pub.add('l_qte_header_rec.sold_to_party_site_id = '||l_qte_header_rec.sold_to_party_site_id,1,'N');
2737: aso_debug_pub.add('l_qte_header_rec.invoice_to_party_id = ' || l_qte_header_rec.invoice_to_party_id,1,'N');
2730: aso_debug_pub.add('Assign_Customer_Accounts: l_inv_cust_acct: '||l_inv_cust_acct, 1, 'N');
2731: aso_debug_pub.add('Assign_Customer_Accounts: l_cust_party: '||l_cust_party, 1, 'N');
2732: aso_debug_pub.add('Assign_Customer_Accounts: l_inv_cust_party: '||l_inv_cust_party, 1, 'N');
2733: aso_debug_pub.add('Assign_Customer_Accounts: l_end_cust_acct: '||l_end_cust_acct, 1, 'N');
2734: aso_debug_pub.add('Assign_Customer_Accounts: l_end_cust_party: '||l_end_cust_party, 1, 'N');
2735: aso_debug_pub.add('l_qte_header_rec.party_id = ' || l_qte_header_rec.party_id,1,'N');
2736: aso_debug_pub.add('l_qte_header_rec.sold_to_party_site_id = '||l_qte_header_rec.sold_to_party_site_id,1,'N');
2737: aso_debug_pub.add('l_qte_header_rec.invoice_to_party_id = ' || l_qte_header_rec.invoice_to_party_id,1,'N');
2738: aso_debug_pub.add('l_qte_header_rec.invoice_to_party_site_id = '|| l_qte_header_rec.invoice_to_party_site_id,1,'N');
2731: aso_debug_pub.add('Assign_Customer_Accounts: l_cust_party: '||l_cust_party, 1, 'N');
2732: aso_debug_pub.add('Assign_Customer_Accounts: l_inv_cust_party: '||l_inv_cust_party, 1, 'N');
2733: aso_debug_pub.add('Assign_Customer_Accounts: l_end_cust_acct: '||l_end_cust_acct, 1, 'N');
2734: aso_debug_pub.add('Assign_Customer_Accounts: l_end_cust_party: '||l_end_cust_party, 1, 'N');
2735: aso_debug_pub.add('l_qte_header_rec.party_id = ' || l_qte_header_rec.party_id,1,'N');
2736: aso_debug_pub.add('l_qte_header_rec.sold_to_party_site_id = '||l_qte_header_rec.sold_to_party_site_id,1,'N');
2737: aso_debug_pub.add('l_qte_header_rec.invoice_to_party_id = ' || l_qte_header_rec.invoice_to_party_id,1,'N');
2738: aso_debug_pub.add('l_qte_header_rec.invoice_to_party_site_id = '|| l_qte_header_rec.invoice_to_party_site_id,1,'N');
2739: aso_debug_pub.add('l_qte_header_rec.End_Customer_party_id = ' || l_qte_header_rec.End_Customer_party_id,1,'N');
2732: aso_debug_pub.add('Assign_Customer_Accounts: l_inv_cust_party: '||l_inv_cust_party, 1, 'N');
2733: aso_debug_pub.add('Assign_Customer_Accounts: l_end_cust_acct: '||l_end_cust_acct, 1, 'N');
2734: aso_debug_pub.add('Assign_Customer_Accounts: l_end_cust_party: '||l_end_cust_party, 1, 'N');
2735: aso_debug_pub.add('l_qte_header_rec.party_id = ' || l_qte_header_rec.party_id,1,'N');
2736: aso_debug_pub.add('l_qte_header_rec.sold_to_party_site_id = '||l_qte_header_rec.sold_to_party_site_id,1,'N');
2737: aso_debug_pub.add('l_qte_header_rec.invoice_to_party_id = ' || l_qte_header_rec.invoice_to_party_id,1,'N');
2738: aso_debug_pub.add('l_qte_header_rec.invoice_to_party_site_id = '|| l_qte_header_rec.invoice_to_party_site_id,1,'N');
2739: aso_debug_pub.add('l_qte_header_rec.End_Customer_party_id = ' || l_qte_header_rec.End_Customer_party_id,1,'N');
2740: aso_debug_pub.add('l_qte_header_rec.End_Customer_party_site_id = '|| l_qte_header_rec.End_Customer_party_site_id,1,'N');
2733: aso_debug_pub.add('Assign_Customer_Accounts: l_end_cust_acct: '||l_end_cust_acct, 1, 'N');
2734: aso_debug_pub.add('Assign_Customer_Accounts: l_end_cust_party: '||l_end_cust_party, 1, 'N');
2735: aso_debug_pub.add('l_qte_header_rec.party_id = ' || l_qte_header_rec.party_id,1,'N');
2736: aso_debug_pub.add('l_qte_header_rec.sold_to_party_site_id = '||l_qte_header_rec.sold_to_party_site_id,1,'N');
2737: aso_debug_pub.add('l_qte_header_rec.invoice_to_party_id = ' || l_qte_header_rec.invoice_to_party_id,1,'N');
2738: aso_debug_pub.add('l_qte_header_rec.invoice_to_party_site_id = '|| l_qte_header_rec.invoice_to_party_site_id,1,'N');
2739: aso_debug_pub.add('l_qte_header_rec.End_Customer_party_id = ' || l_qte_header_rec.End_Customer_party_id,1,'N');
2740: aso_debug_pub.add('l_qte_header_rec.End_Customer_party_site_id = '|| l_qte_header_rec.End_Customer_party_site_id,1,'N');
2741: aso_debug_pub.add('l_header_shipment_tbl.count '|| l_header_shipment_tbl.count,1,'N');
2734: aso_debug_pub.add('Assign_Customer_Accounts: l_end_cust_party: '||l_end_cust_party, 1, 'N');
2735: aso_debug_pub.add('l_qte_header_rec.party_id = ' || l_qte_header_rec.party_id,1,'N');
2736: aso_debug_pub.add('l_qte_header_rec.sold_to_party_site_id = '||l_qte_header_rec.sold_to_party_site_id,1,'N');
2737: aso_debug_pub.add('l_qte_header_rec.invoice_to_party_id = ' || l_qte_header_rec.invoice_to_party_id,1,'N');
2738: aso_debug_pub.add('l_qte_header_rec.invoice_to_party_site_id = '|| l_qte_header_rec.invoice_to_party_site_id,1,'N');
2739: aso_debug_pub.add('l_qte_header_rec.End_Customer_party_id = ' || l_qte_header_rec.End_Customer_party_id,1,'N');
2740: aso_debug_pub.add('l_qte_header_rec.End_Customer_party_site_id = '|| l_qte_header_rec.End_Customer_party_site_id,1,'N');
2741: aso_debug_pub.add('l_header_shipment_tbl.count '|| l_header_shipment_tbl.count,1,'N');
2742: IF l_header_shipment_tbl.count > 0 THEN
2735: aso_debug_pub.add('l_qte_header_rec.party_id = ' || l_qte_header_rec.party_id,1,'N');
2736: aso_debug_pub.add('l_qte_header_rec.sold_to_party_site_id = '||l_qte_header_rec.sold_to_party_site_id,1,'N');
2737: aso_debug_pub.add('l_qte_header_rec.invoice_to_party_id = ' || l_qte_header_rec.invoice_to_party_id,1,'N');
2738: aso_debug_pub.add('l_qte_header_rec.invoice_to_party_site_id = '|| l_qte_header_rec.invoice_to_party_site_id,1,'N');
2739: aso_debug_pub.add('l_qte_header_rec.End_Customer_party_id = ' || l_qte_header_rec.End_Customer_party_id,1,'N');
2740: aso_debug_pub.add('l_qte_header_rec.End_Customer_party_site_id = '|| l_qte_header_rec.End_Customer_party_site_id,1,'N');
2741: aso_debug_pub.add('l_header_shipment_tbl.count '|| l_header_shipment_tbl.count,1,'N');
2742: IF l_header_shipment_tbl.count > 0 THEN
2743: aso_debug_pub.add('l_header_shipment_tbl(1).shipment_id = '|| l_header_shipment_tbl(1).shipment_id,1,'N');
2736: aso_debug_pub.add('l_qte_header_rec.sold_to_party_site_id = '||l_qte_header_rec.sold_to_party_site_id,1,'N');
2737: aso_debug_pub.add('l_qte_header_rec.invoice_to_party_id = ' || l_qte_header_rec.invoice_to_party_id,1,'N');
2738: aso_debug_pub.add('l_qte_header_rec.invoice_to_party_site_id = '|| l_qte_header_rec.invoice_to_party_site_id,1,'N');
2739: aso_debug_pub.add('l_qte_header_rec.End_Customer_party_id = ' || l_qte_header_rec.End_Customer_party_id,1,'N');
2740: aso_debug_pub.add('l_qte_header_rec.End_Customer_party_site_id = '|| l_qte_header_rec.End_Customer_party_site_id,1,'N');
2741: aso_debug_pub.add('l_header_shipment_tbl.count '|| l_header_shipment_tbl.count,1,'N');
2742: IF l_header_shipment_tbl.count > 0 THEN
2743: aso_debug_pub.add('l_header_shipment_tbl(1).shipment_id = '|| l_header_shipment_tbl(1).shipment_id,1,'N');
2744: aso_debug_pub.add('l_header_shipment_tbl(1).ship_to_party_id = '|| l_header_shipment_tbl(1).ship_to_party_id,1,'N');
2737: aso_debug_pub.add('l_qte_header_rec.invoice_to_party_id = ' || l_qte_header_rec.invoice_to_party_id,1,'N');
2738: aso_debug_pub.add('l_qte_header_rec.invoice_to_party_site_id = '|| l_qte_header_rec.invoice_to_party_site_id,1,'N');
2739: aso_debug_pub.add('l_qte_header_rec.End_Customer_party_id = ' || l_qte_header_rec.End_Customer_party_id,1,'N');
2740: aso_debug_pub.add('l_qte_header_rec.End_Customer_party_site_id = '|| l_qte_header_rec.End_Customer_party_site_id,1,'N');
2741: aso_debug_pub.add('l_header_shipment_tbl.count '|| l_header_shipment_tbl.count,1,'N');
2742: IF l_header_shipment_tbl.count > 0 THEN
2743: aso_debug_pub.add('l_header_shipment_tbl(1).shipment_id = '|| l_header_shipment_tbl(1).shipment_id,1,'N');
2744: aso_debug_pub.add('l_header_shipment_tbl(1).ship_to_party_id = '|| l_header_shipment_tbl(1).ship_to_party_id,1,'N');
2745: aso_debug_pub.add('l_header_shipment_tbl(1).ship_to_party_site_id = '|| l_header_shipment_tbl(1).ship_to_party_site_id,1,'N');
2739: aso_debug_pub.add('l_qte_header_rec.End_Customer_party_id = ' || l_qte_header_rec.End_Customer_party_id,1,'N');
2740: aso_debug_pub.add('l_qte_header_rec.End_Customer_party_site_id = '|| l_qte_header_rec.End_Customer_party_site_id,1,'N');
2741: aso_debug_pub.add('l_header_shipment_tbl.count '|| l_header_shipment_tbl.count,1,'N');
2742: IF l_header_shipment_tbl.count > 0 THEN
2743: aso_debug_pub.add('l_header_shipment_tbl(1).shipment_id = '|| l_header_shipment_tbl(1).shipment_id,1,'N');
2744: aso_debug_pub.add('l_header_shipment_tbl(1).ship_to_party_id = '|| l_header_shipment_tbl(1).ship_to_party_id,1,'N');
2745: aso_debug_pub.add('l_header_shipment_tbl(1).ship_to_party_site_id = '|| l_header_shipment_tbl(1).ship_to_party_site_id,1,'N');
2746: aso_debug_pub.add('l_header_shipment_tbl(1).ship_to_cust_party_id = '||l_header_shipment_tbl(1).ship_to_cust_party_id,1,'N');
2747: aso_debug_pub.add('l_header_shipment_tbl(1).ship_to_cust_account_id = '|| l_header_shipment_tbl(1).ship_to_cust_account_id,1,'N');
2740: aso_debug_pub.add('l_qte_header_rec.End_Customer_party_site_id = '|| l_qte_header_rec.End_Customer_party_site_id,1,'N');
2741: aso_debug_pub.add('l_header_shipment_tbl.count '|| l_header_shipment_tbl.count,1,'N');
2742: IF l_header_shipment_tbl.count > 0 THEN
2743: aso_debug_pub.add('l_header_shipment_tbl(1).shipment_id = '|| l_header_shipment_tbl(1).shipment_id,1,'N');
2744: aso_debug_pub.add('l_header_shipment_tbl(1).ship_to_party_id = '|| l_header_shipment_tbl(1).ship_to_party_id,1,'N');
2745: aso_debug_pub.add('l_header_shipment_tbl(1).ship_to_party_site_id = '|| l_header_shipment_tbl(1).ship_to_party_site_id,1,'N');
2746: aso_debug_pub.add('l_header_shipment_tbl(1).ship_to_cust_party_id = '||l_header_shipment_tbl(1).ship_to_cust_party_id,1,'N');
2747: aso_debug_pub.add('l_header_shipment_tbl(1).ship_to_cust_account_id = '|| l_header_shipment_tbl(1).ship_to_cust_account_id,1,'N');
2748: END IF;
2741: aso_debug_pub.add('l_header_shipment_tbl.count '|| l_header_shipment_tbl.count,1,'N');
2742: IF l_header_shipment_tbl.count > 0 THEN
2743: aso_debug_pub.add('l_header_shipment_tbl(1).shipment_id = '|| l_header_shipment_tbl(1).shipment_id,1,'N');
2744: aso_debug_pub.add('l_header_shipment_tbl(1).ship_to_party_id = '|| l_header_shipment_tbl(1).ship_to_party_id,1,'N');
2745: aso_debug_pub.add('l_header_shipment_tbl(1).ship_to_party_site_id = '|| l_header_shipment_tbl(1).ship_to_party_site_id,1,'N');
2746: aso_debug_pub.add('l_header_shipment_tbl(1).ship_to_cust_party_id = '||l_header_shipment_tbl(1).ship_to_cust_party_id,1,'N');
2747: aso_debug_pub.add('l_header_shipment_tbl(1).ship_to_cust_account_id = '|| l_header_shipment_tbl(1).ship_to_cust_account_id,1,'N');
2748: END IF;
2749: END IF;
2742: IF l_header_shipment_tbl.count > 0 THEN
2743: aso_debug_pub.add('l_header_shipment_tbl(1).shipment_id = '|| l_header_shipment_tbl(1).shipment_id,1,'N');
2744: aso_debug_pub.add('l_header_shipment_tbl(1).ship_to_party_id = '|| l_header_shipment_tbl(1).ship_to_party_id,1,'N');
2745: aso_debug_pub.add('l_header_shipment_tbl(1).ship_to_party_site_id = '|| l_header_shipment_tbl(1).ship_to_party_site_id,1,'N');
2746: aso_debug_pub.add('l_header_shipment_tbl(1).ship_to_cust_party_id = '||l_header_shipment_tbl(1).ship_to_cust_party_id,1,'N');
2747: aso_debug_pub.add('l_header_shipment_tbl(1).ship_to_cust_account_id = '|| l_header_shipment_tbl(1).ship_to_cust_account_id,1,'N');
2748: END IF;
2749: END IF;
2750:
2743: aso_debug_pub.add('l_header_shipment_tbl(1).shipment_id = '|| l_header_shipment_tbl(1).shipment_id,1,'N');
2744: aso_debug_pub.add('l_header_shipment_tbl(1).ship_to_party_id = '|| l_header_shipment_tbl(1).ship_to_party_id,1,'N');
2745: aso_debug_pub.add('l_header_shipment_tbl(1).ship_to_party_site_id = '|| l_header_shipment_tbl(1).ship_to_party_site_id,1,'N');
2746: aso_debug_pub.add('l_header_shipment_tbl(1).ship_to_cust_party_id = '||l_header_shipment_tbl(1).ship_to_cust_party_id,1,'N');
2747: aso_debug_pub.add('l_header_shipment_tbl(1).ship_to_cust_account_id = '|| l_header_shipment_tbl(1).ship_to_cust_account_id,1,'N');
2748: END IF;
2749: END IF;
2750:
2751: IF l_cust_acct IS NULL THEN
2761: x_return_status => x_return_status,
2762: x_msg_count => x_msg_count,
2763: x_msg_data => x_msg_data);
2764:
2765: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2766: aso_debug_pub.add('Assign_Customer_Accounts 1: x_return_status: '||x_return_status, 1, 'N');
2767: aso_debug_pub.add('header sold to customer = ' || l_account_id);
2768: END IF;
2769:
2762: x_msg_count => x_msg_count,
2763: x_msg_data => x_msg_data);
2764:
2765: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2766: aso_debug_pub.add('Assign_Customer_Accounts 1: x_return_status: '||x_return_status, 1, 'N');
2767: aso_debug_pub.add('header sold to customer = ' || l_account_id);
2768: END IF;
2769:
2770:
2763: x_msg_data => x_msg_data);
2764:
2765: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2766: aso_debug_pub.add('Assign_Customer_Accounts 1: x_return_status: '||x_return_status, 1, 'N');
2767: aso_debug_pub.add('header sold to customer = ' || l_account_id);
2768: END IF;
2769:
2770:
2771: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
2793:
2794: END IF;
2795:
2796: END IF;
2797: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2798: aso_debug_pub.add('after header sold_to, l_header_check = ' || l_header_check_tca_flag,1,'N');
2799: END IF;
2800:
2801:
2794: END IF;
2795:
2796: END IF;
2797: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2798: aso_debug_pub.add('after header sold_to, l_header_check = ' || l_header_check_tca_flag,1,'N');
2799: END IF;
2800:
2801:
2802: IF l_inv_cust_acct IS NULL THEN
2812: x_return_status => x_return_status,
2813: x_msg_count => x_msg_count,
2814: x_msg_data => x_msg_data);
2815:
2816: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2817: aso_debug_pub.add('Assign_Customer_Accounts 2: x_return_status: '||x_return_status, 1, 'N');
2818: aso_debug_pub.add('header invoice to account = ' || l_account_id,1,'N');
2819: END IF;
2820:
2813: x_msg_count => x_msg_count,
2814: x_msg_data => x_msg_data);
2815:
2816: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2817: aso_debug_pub.add('Assign_Customer_Accounts 2: x_return_status: '||x_return_status, 1, 'N');
2818: aso_debug_pub.add('header invoice to account = ' || l_account_id,1,'N');
2819: END IF;
2820:
2821:
2814: x_msg_data => x_msg_data);
2815:
2816: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2817: aso_debug_pub.add('Assign_Customer_Accounts 2: x_return_status: '||x_return_status, 1, 'N');
2818: aso_debug_pub.add('header invoice to account = ' || l_account_id,1,'N');
2819: END IF;
2820:
2821:
2822: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
2845:
2846: END IF;
2847:
2848: END IF;
2849: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2850: aso_debug_pub.add('after header sold_to, l_header_check = ' || l_header_check_tca_flag,1,'N');
2851: END IF;
2852:
2853: IF l_end_cust_acct IS NULL THEN
2846: END IF;
2847:
2848: END IF;
2849: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2850: aso_debug_pub.add('after header sold_to, l_header_check = ' || l_header_check_tca_flag,1,'N');
2851: END IF;
2852:
2853: IF l_end_cust_acct IS NULL THEN
2854: l_header_check_tca_flag := 'Y';
2863: x_return_status => x_return_status,
2864: x_msg_count => x_msg_count,
2865: x_msg_data => x_msg_data);
2866:
2867: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2868: aso_debug_pub.add('Assign_Customer_Accounts 2: x_return_status: '||x_return_status, 1, 'N');
2869: aso_debug_pub.add('header end customer account = ' || l_account_id,1,'N');
2870: END IF;
2871:
2864: x_msg_count => x_msg_count,
2865: x_msg_data => x_msg_data);
2866:
2867: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2868: aso_debug_pub.add('Assign_Customer_Accounts 2: x_return_status: '||x_return_status, 1, 'N');
2869: aso_debug_pub.add('header end customer account = ' || l_account_id,1,'N');
2870: END IF;
2871:
2872:
2865: x_msg_data => x_msg_data);
2866:
2867: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2868: aso_debug_pub.add('Assign_Customer_Accounts 2: x_return_status: '||x_return_status, 1, 'N');
2869: aso_debug_pub.add('header end customer account = ' || l_account_id,1,'N');
2870: END IF;
2871:
2872:
2873: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
2896:
2897: END IF;
2898:
2899: END IF;
2900: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2901: aso_debug_pub.add('after header sold_to, l_header_check = ' || l_header_check_tca_flag,1,'N');
2902: END IF;
2903:
2904: IF l_header_shipment_tbl.count > 0 THEN
2897: END IF;
2898:
2899: END IF;
2900: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2901: aso_debug_pub.add('after header sold_to, l_header_check = ' || l_header_check_tca_flag,1,'N');
2902: END IF;
2903:
2904: IF l_header_shipment_tbl.count > 0 THEN
2905:
2915: x_return_status => x_return_status,
2916: x_msg_count => x_msg_count,
2917: x_msg_data => x_msg_data);
2918:
2919: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2920: aso_debug_pub.add('Assign_Customer_Accounts 4: x_return_status: '||x_return_status, 1, 'N');
2921: aso_debug_pub.add('header ship to cust party = '||l_header_shipment_tbl(1).ship_to_cust_party_id,1,'N');
2922: aso_debug_pub.add('header ship to account = ' || l_account_id,1,'N');
2923: END IF;
2916: x_msg_count => x_msg_count,
2917: x_msg_data => x_msg_data);
2918:
2919: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2920: aso_debug_pub.add('Assign_Customer_Accounts 4: x_return_status: '||x_return_status, 1, 'N');
2921: aso_debug_pub.add('header ship to cust party = '||l_header_shipment_tbl(1).ship_to_cust_party_id,1,'N');
2922: aso_debug_pub.add('header ship to account = ' || l_account_id,1,'N');
2923: END IF;
2924:
2917: x_msg_data => x_msg_data);
2918:
2919: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2920: aso_debug_pub.add('Assign_Customer_Accounts 4: x_return_status: '||x_return_status, 1, 'N');
2921: aso_debug_pub.add('header ship to cust party = '||l_header_shipment_tbl(1).ship_to_cust_party_id,1,'N');
2922: aso_debug_pub.add('header ship to account = ' || l_account_id,1,'N');
2923: END IF;
2924:
2925: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
2918:
2919: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2920: aso_debug_pub.add('Assign_Customer_Accounts 4: x_return_status: '||x_return_status, 1, 'N');
2921: aso_debug_pub.add('header ship to cust party = '||l_header_shipment_tbl(1).ship_to_cust_party_id,1,'N');
2922: aso_debug_pub.add('header ship to account = ' || l_account_id,1,'N');
2923: END IF;
2924:
2925: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
2926: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
2949: END IF;
2950:
2951: END IF; --l_header_shipment_tbl.count
2952:
2953: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2954: aso_debug_pub.add('after header sold_to, l_header_check = ' || l_header_check_tca_flag,1,'N');
2955: END IF;
2956:
2957:
2950:
2951: END IF; --l_header_shipment_tbl.count
2952:
2953: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2954: aso_debug_pub.add('after header sold_to, l_header_check = ' || l_header_check_tca_flag,1,'N');
2955: END IF;
2956:
2957:
2958:
2964: p_Header_Shipment_Tbl => l_header_Shipment_Tbl,
2965: x_return_status => x_return_status,
2966: x_msg_count => x_msg_count,
2967: x_msg_data => x_msg_data);
2968: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2969: aso_debug_pub.add('after check tca '||x_return_status, 1, 'N');
2970: END IF;
2971: IF x_return_status<>FND_API.G_RET_STS_SUCCESS THEN
2972: RAISE FND_API.G_EXC_ERROR;
2965: x_return_status => x_return_status,
2966: x_msg_count => x_msg_count,
2967: x_msg_data => x_msg_data);
2968: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2969: aso_debug_pub.add('after check tca '||x_return_status, 1, 'N');
2970: END IF;
2971: IF x_return_status<>FND_API.G_RET_STS_SUCCESS THEN
2972: RAISE FND_API.G_EXC_ERROR;
2973: END IF;
2972: RAISE FND_API.G_EXC_ERROR;
2973: END IF;
2974: END IF;
2975:
2976: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2977: aso_debug_pub.add('Assign_Customer_Accounts : checking for lines ', 1, 'N');
2978: end if;
2979:
2980: FOR Line_Acct IN C_Get_Line_Acct(p_qte_header_id) LOOP
2973: END IF;
2974: END IF;
2975:
2976: IF aso_debug_pub.g_debug_flag = 'Y' THEN
2977: aso_debug_pub.add('Assign_Customer_Accounts : checking for lines ', 1, 'N');
2978: end if;
2979:
2980: FOR Line_Acct IN C_Get_Line_Acct(p_qte_header_id) LOOP
2981:
2999: l_line_shipment_tbl(1).ship_to_party_id := Line_Acct.ship_to_party_id;
3000: l_line_shipment_tbl(1).ship_to_party_site_id := Line_Acct.ship_to_party_site_id;
3001: l_line_shipment_tbl(1).shipment_id := Line_Acct.shipment_id;
3002:
3003: IF aso_debug_pub.g_debug_flag = 'Y' THEN
3004: aso_debug_pub.add('l_qte_line_rec.quote_line_id = '|| l_qte_line_rec.quote_line_id,1,'N');
3005: aso_debug_pub.add('l_qte_line_rec.invoice_to_cust_account_id = '|| l_qte_line_rec.invoice_to_cust_account_id,1,'N');
3006: aso_debug_pub.add('l_qte_line_rec.invoice_to_party_site_id = '|| l_qte_line_rec.invoice_to_party_site_id,1,'N');
3007: aso_debug_pub.add('l_qte_line_rec.invoice_to_cust_party_id = ' || l_qte_line_rec.invoice_to_cust_party_id,1,'N');
3000: l_line_shipment_tbl(1).ship_to_party_site_id := Line_Acct.ship_to_party_site_id;
3001: l_line_shipment_tbl(1).shipment_id := Line_Acct.shipment_id;
3002:
3003: IF aso_debug_pub.g_debug_flag = 'Y' THEN
3004: aso_debug_pub.add('l_qte_line_rec.quote_line_id = '|| l_qte_line_rec.quote_line_id,1,'N');
3005: aso_debug_pub.add('l_qte_line_rec.invoice_to_cust_account_id = '|| l_qte_line_rec.invoice_to_cust_account_id,1,'N');
3006: aso_debug_pub.add('l_qte_line_rec.invoice_to_party_site_id = '|| l_qte_line_rec.invoice_to_party_site_id,1,'N');
3007: aso_debug_pub.add('l_qte_line_rec.invoice_to_cust_party_id = ' || l_qte_line_rec.invoice_to_cust_party_id,1,'N');
3008: aso_debug_pub.add('l_qte_line_rec.invoice_to_party_id = ' || l_qte_line_rec.invoice_to_party_id,1,'N');
3001: l_line_shipment_tbl(1).shipment_id := Line_Acct.shipment_id;
3002:
3003: IF aso_debug_pub.g_debug_flag = 'Y' THEN
3004: aso_debug_pub.add('l_qte_line_rec.quote_line_id = '|| l_qte_line_rec.quote_line_id,1,'N');
3005: aso_debug_pub.add('l_qte_line_rec.invoice_to_cust_account_id = '|| l_qte_line_rec.invoice_to_cust_account_id,1,'N');
3006: aso_debug_pub.add('l_qte_line_rec.invoice_to_party_site_id = '|| l_qte_line_rec.invoice_to_party_site_id,1,'N');
3007: aso_debug_pub.add('l_qte_line_rec.invoice_to_cust_party_id = ' || l_qte_line_rec.invoice_to_cust_party_id,1,'N');
3008: aso_debug_pub.add('l_qte_line_rec.invoice_to_party_id = ' || l_qte_line_rec.invoice_to_party_id,1,'N');
3009: aso_debug_pub.add('l_qte_line_rec.End_Customer_cust_account_id = '|| l_qte_line_rec.End_Customer_cust_account_id,1,'N');
3002:
3003: IF aso_debug_pub.g_debug_flag = 'Y' THEN
3004: aso_debug_pub.add('l_qte_line_rec.quote_line_id = '|| l_qte_line_rec.quote_line_id,1,'N');
3005: aso_debug_pub.add('l_qte_line_rec.invoice_to_cust_account_id = '|| l_qte_line_rec.invoice_to_cust_account_id,1,'N');
3006: aso_debug_pub.add('l_qte_line_rec.invoice_to_party_site_id = '|| l_qte_line_rec.invoice_to_party_site_id,1,'N');
3007: aso_debug_pub.add('l_qte_line_rec.invoice_to_cust_party_id = ' || l_qte_line_rec.invoice_to_cust_party_id,1,'N');
3008: aso_debug_pub.add('l_qte_line_rec.invoice_to_party_id = ' || l_qte_line_rec.invoice_to_party_id,1,'N');
3009: aso_debug_pub.add('l_qte_line_rec.End_Customer_cust_account_id = '|| l_qte_line_rec.End_Customer_cust_account_id,1,'N');
3010: aso_debug_pub.add('l_qte_line_rec.End_Customer_party_site_id = '|| l_qte_line_rec.End_Customer_party_site_id,1,'N');
3003: IF aso_debug_pub.g_debug_flag = 'Y' THEN
3004: aso_debug_pub.add('l_qte_line_rec.quote_line_id = '|| l_qte_line_rec.quote_line_id,1,'N');
3005: aso_debug_pub.add('l_qte_line_rec.invoice_to_cust_account_id = '|| l_qte_line_rec.invoice_to_cust_account_id,1,'N');
3006: aso_debug_pub.add('l_qte_line_rec.invoice_to_party_site_id = '|| l_qte_line_rec.invoice_to_party_site_id,1,'N');
3007: aso_debug_pub.add('l_qte_line_rec.invoice_to_cust_party_id = ' || l_qte_line_rec.invoice_to_cust_party_id,1,'N');
3008: aso_debug_pub.add('l_qte_line_rec.invoice_to_party_id = ' || l_qte_line_rec.invoice_to_party_id,1,'N');
3009: aso_debug_pub.add('l_qte_line_rec.End_Customer_cust_account_id = '|| l_qte_line_rec.End_Customer_cust_account_id,1,'N');
3010: aso_debug_pub.add('l_qte_line_rec.End_Customer_party_site_id = '|| l_qte_line_rec.End_Customer_party_site_id,1,'N');
3011: aso_debug_pub.add('l_qte_line_rec.End_Customer_cust_party_id = ' || l_qte_line_rec.End_Customer_cust_party_id,1,'N');
3004: aso_debug_pub.add('l_qte_line_rec.quote_line_id = '|| l_qte_line_rec.quote_line_id,1,'N');
3005: aso_debug_pub.add('l_qte_line_rec.invoice_to_cust_account_id = '|| l_qte_line_rec.invoice_to_cust_account_id,1,'N');
3006: aso_debug_pub.add('l_qte_line_rec.invoice_to_party_site_id = '|| l_qte_line_rec.invoice_to_party_site_id,1,'N');
3007: aso_debug_pub.add('l_qte_line_rec.invoice_to_cust_party_id = ' || l_qte_line_rec.invoice_to_cust_party_id,1,'N');
3008: aso_debug_pub.add('l_qte_line_rec.invoice_to_party_id = ' || l_qte_line_rec.invoice_to_party_id,1,'N');
3009: aso_debug_pub.add('l_qte_line_rec.End_Customer_cust_account_id = '|| l_qte_line_rec.End_Customer_cust_account_id,1,'N');
3010: aso_debug_pub.add('l_qte_line_rec.End_Customer_party_site_id = '|| l_qte_line_rec.End_Customer_party_site_id,1,'N');
3011: aso_debug_pub.add('l_qte_line_rec.End_Customer_cust_party_id = ' || l_qte_line_rec.End_Customer_cust_party_id,1,'N');
3012: aso_debug_pub.add('l_qte_line_rec.End_Customer_party_id = ' || l_qte_line_rec.End_Customer_party_id,1,'N');
3005: aso_debug_pub.add('l_qte_line_rec.invoice_to_cust_account_id = '|| l_qte_line_rec.invoice_to_cust_account_id,1,'N');
3006: aso_debug_pub.add('l_qte_line_rec.invoice_to_party_site_id = '|| l_qte_line_rec.invoice_to_party_site_id,1,'N');
3007: aso_debug_pub.add('l_qte_line_rec.invoice_to_cust_party_id = ' || l_qte_line_rec.invoice_to_cust_party_id,1,'N');
3008: aso_debug_pub.add('l_qte_line_rec.invoice_to_party_id = ' || l_qte_line_rec.invoice_to_party_id,1,'N');
3009: aso_debug_pub.add('l_qte_line_rec.End_Customer_cust_account_id = '|| l_qte_line_rec.End_Customer_cust_account_id,1,'N');
3010: aso_debug_pub.add('l_qte_line_rec.End_Customer_party_site_id = '|| l_qte_line_rec.End_Customer_party_site_id,1,'N');
3011: aso_debug_pub.add('l_qte_line_rec.End_Customer_cust_party_id = ' || l_qte_line_rec.End_Customer_cust_party_id,1,'N');
3012: aso_debug_pub.add('l_qte_line_rec.End_Customer_party_id = ' || l_qte_line_rec.End_Customer_party_id,1,'N');
3013: aso_debug_pub.add('l_line_shipment_tbl(1).shipment_id = ' || l_line_shipment_tbl(1).shipment_id,1,'N');
3006: aso_debug_pub.add('l_qte_line_rec.invoice_to_party_site_id = '|| l_qte_line_rec.invoice_to_party_site_id,1,'N');
3007: aso_debug_pub.add('l_qte_line_rec.invoice_to_cust_party_id = ' || l_qte_line_rec.invoice_to_cust_party_id,1,'N');
3008: aso_debug_pub.add('l_qte_line_rec.invoice_to_party_id = ' || l_qte_line_rec.invoice_to_party_id,1,'N');
3009: aso_debug_pub.add('l_qte_line_rec.End_Customer_cust_account_id = '|| l_qte_line_rec.End_Customer_cust_account_id,1,'N');
3010: aso_debug_pub.add('l_qte_line_rec.End_Customer_party_site_id = '|| l_qte_line_rec.End_Customer_party_site_id,1,'N');
3011: aso_debug_pub.add('l_qte_line_rec.End_Customer_cust_party_id = ' || l_qte_line_rec.End_Customer_cust_party_id,1,'N');
3012: aso_debug_pub.add('l_qte_line_rec.End_Customer_party_id = ' || l_qte_line_rec.End_Customer_party_id,1,'N');
3013: aso_debug_pub.add('l_line_shipment_tbl(1).shipment_id = ' || l_line_shipment_tbl(1).shipment_id,1,'N');
3014: aso_debug_pub.add('l_line_shipment_tbl(1).ship_to_cust_account_id = '|| l_line_shipment_tbl(1).ship_to_cust_account_id,1,'N');
3007: aso_debug_pub.add('l_qte_line_rec.invoice_to_cust_party_id = ' || l_qte_line_rec.invoice_to_cust_party_id,1,'N');
3008: aso_debug_pub.add('l_qte_line_rec.invoice_to_party_id = ' || l_qte_line_rec.invoice_to_party_id,1,'N');
3009: aso_debug_pub.add('l_qte_line_rec.End_Customer_cust_account_id = '|| l_qte_line_rec.End_Customer_cust_account_id,1,'N');
3010: aso_debug_pub.add('l_qte_line_rec.End_Customer_party_site_id = '|| l_qte_line_rec.End_Customer_party_site_id,1,'N');
3011: aso_debug_pub.add('l_qte_line_rec.End_Customer_cust_party_id = ' || l_qte_line_rec.End_Customer_cust_party_id,1,'N');
3012: aso_debug_pub.add('l_qte_line_rec.End_Customer_party_id = ' || l_qte_line_rec.End_Customer_party_id,1,'N');
3013: aso_debug_pub.add('l_line_shipment_tbl(1).shipment_id = ' || l_line_shipment_tbl(1).shipment_id,1,'N');
3014: aso_debug_pub.add('l_line_shipment_tbl(1).ship_to_cust_account_id = '|| l_line_shipment_tbl(1).ship_to_cust_account_id,1,'N');
3015: aso_debug_pub.add('l_line_shipment_tbl(1).ship_to_cust_party_id = '|| l_line_shipment_tbl(1).ship_to_cust_party_id,1,'N');
3008: aso_debug_pub.add('l_qte_line_rec.invoice_to_party_id = ' || l_qte_line_rec.invoice_to_party_id,1,'N');
3009: aso_debug_pub.add('l_qte_line_rec.End_Customer_cust_account_id = '|| l_qte_line_rec.End_Customer_cust_account_id,1,'N');
3010: aso_debug_pub.add('l_qte_line_rec.End_Customer_party_site_id = '|| l_qte_line_rec.End_Customer_party_site_id,1,'N');
3011: aso_debug_pub.add('l_qte_line_rec.End_Customer_cust_party_id = ' || l_qte_line_rec.End_Customer_cust_party_id,1,'N');
3012: aso_debug_pub.add('l_qte_line_rec.End_Customer_party_id = ' || l_qte_line_rec.End_Customer_party_id,1,'N');
3013: aso_debug_pub.add('l_line_shipment_tbl(1).shipment_id = ' || l_line_shipment_tbl(1).shipment_id,1,'N');
3014: aso_debug_pub.add('l_line_shipment_tbl(1).ship_to_cust_account_id = '|| l_line_shipment_tbl(1).ship_to_cust_account_id,1,'N');
3015: aso_debug_pub.add('l_line_shipment_tbl(1).ship_to_cust_party_id = '|| l_line_shipment_tbl(1).ship_to_cust_party_id,1,'N');
3016: aso_debug_pub.add('l_line_shipment_tbl(1).ship_to_party_id = '|| l_line_shipment_tbl(1).ship_to_party_id,1,'N');
3009: aso_debug_pub.add('l_qte_line_rec.End_Customer_cust_account_id = '|| l_qte_line_rec.End_Customer_cust_account_id,1,'N');
3010: aso_debug_pub.add('l_qte_line_rec.End_Customer_party_site_id = '|| l_qte_line_rec.End_Customer_party_site_id,1,'N');
3011: aso_debug_pub.add('l_qte_line_rec.End_Customer_cust_party_id = ' || l_qte_line_rec.End_Customer_cust_party_id,1,'N');
3012: aso_debug_pub.add('l_qte_line_rec.End_Customer_party_id = ' || l_qte_line_rec.End_Customer_party_id,1,'N');
3013: aso_debug_pub.add('l_line_shipment_tbl(1).shipment_id = ' || l_line_shipment_tbl(1).shipment_id,1,'N');
3014: aso_debug_pub.add('l_line_shipment_tbl(1).ship_to_cust_account_id = '|| l_line_shipment_tbl(1).ship_to_cust_account_id,1,'N');
3015: aso_debug_pub.add('l_line_shipment_tbl(1).ship_to_cust_party_id = '|| l_line_shipment_tbl(1).ship_to_cust_party_id,1,'N');
3016: aso_debug_pub.add('l_line_shipment_tbl(1).ship_to_party_id = '|| l_line_shipment_tbl(1).ship_to_party_id,1,'N');
3017: aso_debug_pub.add('l_line_shipment_tbl(1).ship_to_party_site_id = '|| l_line_shipment_tbl(1).ship_to_party_site_id,1,'N');
3010: aso_debug_pub.add('l_qte_line_rec.End_Customer_party_site_id = '|| l_qte_line_rec.End_Customer_party_site_id,1,'N');
3011: aso_debug_pub.add('l_qte_line_rec.End_Customer_cust_party_id = ' || l_qte_line_rec.End_Customer_cust_party_id,1,'N');
3012: aso_debug_pub.add('l_qte_line_rec.End_Customer_party_id = ' || l_qte_line_rec.End_Customer_party_id,1,'N');
3013: aso_debug_pub.add('l_line_shipment_tbl(1).shipment_id = ' || l_line_shipment_tbl(1).shipment_id,1,'N');
3014: aso_debug_pub.add('l_line_shipment_tbl(1).ship_to_cust_account_id = '|| l_line_shipment_tbl(1).ship_to_cust_account_id,1,'N');
3015: aso_debug_pub.add('l_line_shipment_tbl(1).ship_to_cust_party_id = '|| l_line_shipment_tbl(1).ship_to_cust_party_id,1,'N');
3016: aso_debug_pub.add('l_line_shipment_tbl(1).ship_to_party_id = '|| l_line_shipment_tbl(1).ship_to_party_id,1,'N');
3017: aso_debug_pub.add('l_line_shipment_tbl(1).ship_to_party_site_id = '|| l_line_shipment_tbl(1).ship_to_party_site_id,1,'N');
3018: end if;
3011: aso_debug_pub.add('l_qte_line_rec.End_Customer_cust_party_id = ' || l_qte_line_rec.End_Customer_cust_party_id,1,'N');
3012: aso_debug_pub.add('l_qte_line_rec.End_Customer_party_id = ' || l_qte_line_rec.End_Customer_party_id,1,'N');
3013: aso_debug_pub.add('l_line_shipment_tbl(1).shipment_id = ' || l_line_shipment_tbl(1).shipment_id,1,'N');
3014: aso_debug_pub.add('l_line_shipment_tbl(1).ship_to_cust_account_id = '|| l_line_shipment_tbl(1).ship_to_cust_account_id,1,'N');
3015: aso_debug_pub.add('l_line_shipment_tbl(1).ship_to_cust_party_id = '|| l_line_shipment_tbl(1).ship_to_cust_party_id,1,'N');
3016: aso_debug_pub.add('l_line_shipment_tbl(1).ship_to_party_id = '|| l_line_shipment_tbl(1).ship_to_party_id,1,'N');
3017: aso_debug_pub.add('l_line_shipment_tbl(1).ship_to_party_site_id = '|| l_line_shipment_tbl(1).ship_to_party_site_id,1,'N');
3018: end if;
3019:
3012: aso_debug_pub.add('l_qte_line_rec.End_Customer_party_id = ' || l_qte_line_rec.End_Customer_party_id,1,'N');
3013: aso_debug_pub.add('l_line_shipment_tbl(1).shipment_id = ' || l_line_shipment_tbl(1).shipment_id,1,'N');
3014: aso_debug_pub.add('l_line_shipment_tbl(1).ship_to_cust_account_id = '|| l_line_shipment_tbl(1).ship_to_cust_account_id,1,'N');
3015: aso_debug_pub.add('l_line_shipment_tbl(1).ship_to_cust_party_id = '|| l_line_shipment_tbl(1).ship_to_cust_party_id,1,'N');
3016: aso_debug_pub.add('l_line_shipment_tbl(1).ship_to_party_id = '|| l_line_shipment_tbl(1).ship_to_party_id,1,'N');
3017: aso_debug_pub.add('l_line_shipment_tbl(1).ship_to_party_site_id = '|| l_line_shipment_tbl(1).ship_to_party_site_id,1,'N');
3018: end if;
3019:
3020:
3013: aso_debug_pub.add('l_line_shipment_tbl(1).shipment_id = ' || l_line_shipment_tbl(1).shipment_id,1,'N');
3014: aso_debug_pub.add('l_line_shipment_tbl(1).ship_to_cust_account_id = '|| l_line_shipment_tbl(1).ship_to_cust_account_id,1,'N');
3015: aso_debug_pub.add('l_line_shipment_tbl(1).ship_to_cust_party_id = '|| l_line_shipment_tbl(1).ship_to_cust_party_id,1,'N');
3016: aso_debug_pub.add('l_line_shipment_tbl(1).ship_to_party_id = '|| l_line_shipment_tbl(1).ship_to_party_id,1,'N');
3017: aso_debug_pub.add('l_line_shipment_tbl(1).ship_to_party_site_id = '|| l_line_shipment_tbl(1).ship_to_party_site_id,1,'N');
3018: end if;
3019:
3020:
3021: IF l_qte_line_rec.invoice_to_cust_account_id IS NULL THEN
3029: x_return_status => x_return_status,
3030: x_msg_count => x_msg_count,
3031: x_msg_data => x_msg_data);
3032:
3033: IF aso_debug_pub.g_debug_flag = 'Y' THEN
3034: aso_debug_pub.add('Assign_Customer_Accounts 3: x_return_status: '||x_return_status, 1, 'N');
3035: aso_debug_pub.add('line invoice to customer party = ' ||
3036: l_qte_line_rec.invoice_to_cust_party_id,1,'N');
3037:
3030: x_msg_count => x_msg_count,
3031: x_msg_data => x_msg_data);
3032:
3033: IF aso_debug_pub.g_debug_flag = 'Y' THEN
3034: aso_debug_pub.add('Assign_Customer_Accounts 3: x_return_status: '||x_return_status, 1, 'N');
3035: aso_debug_pub.add('line invoice to customer party = ' ||
3036: l_qte_line_rec.invoice_to_cust_party_id,1,'N');
3037:
3038: aso_debug_pub.add('line invoice to customer account = ' ||
3031: x_msg_data => x_msg_data);
3032:
3033: IF aso_debug_pub.g_debug_flag = 'Y' THEN
3034: aso_debug_pub.add('Assign_Customer_Accounts 3: x_return_status: '||x_return_status, 1, 'N');
3035: aso_debug_pub.add('line invoice to customer party = ' ||
3036: l_qte_line_rec.invoice_to_cust_party_id,1,'N');
3037:
3038: aso_debug_pub.add('line invoice to customer account = ' ||
3039: l_account_id,1,'N');
3034: aso_debug_pub.add('Assign_Customer_Accounts 3: x_return_status: '||x_return_status, 1, 'N');
3035: aso_debug_pub.add('line invoice to customer party = ' ||
3036: l_qte_line_rec.invoice_to_cust_party_id,1,'N');
3037:
3038: aso_debug_pub.add('line invoice to customer account = ' ||
3039: l_account_id,1,'N');
3040: END IF;
3041:
3042: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
3078: x_return_status => x_return_status,
3079: x_msg_count => x_msg_count,
3080: x_msg_data => x_msg_data);
3081:
3082: IF aso_debug_pub.g_debug_flag = 'Y' THEN
3083: aso_debug_pub.add('Assign_Customer_Accounts 3: x_return_status: '||x_return_status, 1, 'N');
3084: aso_debug_pub.add('line End_Customer customer party = ' ||
3085: l_qte_line_rec.End_Customer_cust_party_id,1,'N');
3086:
3079: x_msg_count => x_msg_count,
3080: x_msg_data => x_msg_data);
3081:
3082: IF aso_debug_pub.g_debug_flag = 'Y' THEN
3083: aso_debug_pub.add('Assign_Customer_Accounts 3: x_return_status: '||x_return_status, 1, 'N');
3084: aso_debug_pub.add('line End_Customer customer party = ' ||
3085: l_qte_line_rec.End_Customer_cust_party_id,1,'N');
3086:
3087: aso_debug_pub.add('line End_Customer customer account = ' ||
3080: x_msg_data => x_msg_data);
3081:
3082: IF aso_debug_pub.g_debug_flag = 'Y' THEN
3083: aso_debug_pub.add('Assign_Customer_Accounts 3: x_return_status: '||x_return_status, 1, 'N');
3084: aso_debug_pub.add('line End_Customer customer party = ' ||
3085: l_qte_line_rec.End_Customer_cust_party_id,1,'N');
3086:
3087: aso_debug_pub.add('line End_Customer customer account = ' ||
3088: l_account_id,1,'N');
3083: aso_debug_pub.add('Assign_Customer_Accounts 3: x_return_status: '||x_return_status, 1, 'N');
3084: aso_debug_pub.add('line End_Customer customer party = ' ||
3085: l_qte_line_rec.End_Customer_cust_party_id,1,'N');
3086:
3087: aso_debug_pub.add('line End_Customer customer account = ' ||
3088: l_account_id,1,'N');
3089: END IF;
3090:
3091: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
3127: x_return_status => x_return_status,
3128: x_msg_count => x_msg_count,
3129: x_msg_data => x_msg_data);
3130:
3131: IF aso_debug_pub.g_debug_flag = 'Y' THEN
3132: aso_debug_pub.add('Assign_Customer_Accounts 4: x_return_status: '||x_return_status, 1, 'N');
3133: aso_debug_pub.add('line ship to customer party = ' ||
3134: Line_Acct.ship_to_cust_party_id,1,'N');
3135:
3128: x_msg_count => x_msg_count,
3129: x_msg_data => x_msg_data);
3130:
3131: IF aso_debug_pub.g_debug_flag = 'Y' THEN
3132: aso_debug_pub.add('Assign_Customer_Accounts 4: x_return_status: '||x_return_status, 1, 'N');
3133: aso_debug_pub.add('line ship to customer party = ' ||
3134: Line_Acct.ship_to_cust_party_id,1,'N');
3135:
3136: aso_debug_pub.add('line ship to customer account = ' ||
3129: x_msg_data => x_msg_data);
3130:
3131: IF aso_debug_pub.g_debug_flag = 'Y' THEN
3132: aso_debug_pub.add('Assign_Customer_Accounts 4: x_return_status: '||x_return_status, 1, 'N');
3133: aso_debug_pub.add('line ship to customer party = ' ||
3134: Line_Acct.ship_to_cust_party_id,1,'N');
3135:
3136: aso_debug_pub.add('line ship to customer account = ' ||
3137: l_account_id,1,'N');
3132: aso_debug_pub.add('Assign_Customer_Accounts 4: x_return_status: '||x_return_status, 1, 'N');
3133: aso_debug_pub.add('line ship to customer party = ' ||
3134: Line_Acct.ship_to_cust_party_id,1,'N');
3135:
3136: aso_debug_pub.add('line ship to customer account = ' ||
3137: l_account_id,1,'N');
3138: END IF;
3139:
3140: IF x_Return_Status <> FND_API.G_RET_STS_SUCCESS THEN
3173: x_return_status => x_return_status,
3174: x_msg_count => x_msg_count,
3175: x_msg_data => x_msg_data);
3176:
3177: IF aso_debug_pub.g_debug_flag = 'Y' THEN
3178: aso_debug_pub.add('after check line account info '||x_return_status, 1, 'N
3179: ');
3180: END IF;
3181: IF x_return_status<>FND_API.G_RET_STS_SUCCESS THEN
3174: x_msg_count => x_msg_count,
3175: x_msg_data => x_msg_data);
3176:
3177: IF aso_debug_pub.g_debug_flag = 'Y' THEN
3178: aso_debug_pub.add('after check line account info '||x_return_status, 1, 'N
3179: ');
3180: END IF;
3181: IF x_return_status<>FND_API.G_RET_STS_SUCCESS THEN
3182: RAISE FND_API.G_EXC_ERROR;
3189:
3190:
3191:
3192:
3193: IF aso_debug_pub.g_debug_flag = 'Y' THEN
3194: aso_debug_pub.add('Assign_Customer_Accounts: End ', 1, 'N');
3195: END IF;
3196:
3197: FND_MSG_PUB.Count_And_Get
3190:
3191:
3192:
3193: IF aso_debug_pub.g_debug_flag = 'Y' THEN
3194: aso_debug_pub.add('Assign_Customer_Accounts: End ', 1, 'N');
3195: END IF;
3196:
3197: FND_MSG_PUB.Count_And_Get
3198: ( p_count => x_msg_count,
3279: OPEN C_Get_Party_From_Acct(p_cust_account_id);
3280: FETCH C_Get_Party_From_Acct INTO l_inv_cust_id;
3281: CLOSE C_Get_Party_From_Acct;
3282:
3283: IF aso_debug_pub.g_debug_flag = 'Y' THEN
3284: aso_debug_pub.add('Check_Hdr_Acct: l_inv_cust_id: '|| l_inv_cust_id, 1, 'N');
3285: END IF;
3286: IF l_inv_cust_id <> p_cust_party_id THEN
3287: x_return_status := FND_API.G_RET_STS_ERROR;
3280: FETCH C_Get_Party_From_Acct INTO l_inv_cust_id;
3281: CLOSE C_Get_Party_From_Acct;
3282:
3283: IF aso_debug_pub.g_debug_flag = 'Y' THEN
3284: aso_debug_pub.add('Check_Hdr_Acct: l_inv_cust_id: '|| l_inv_cust_id, 1, 'N');
3285: END IF;
3286: IF l_inv_cust_id <> p_cust_party_id THEN
3287: x_return_status := FND_API.G_RET_STS_ERROR;
3288: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
3295: END IF;
3296:
3297: END IF;
3298:
3299: IF aso_debug_pub.g_debug_flag = 'Y' THEN
3300: aso_debug_pub.add('Check_Hdr_Acct: p_cust_party_id:1: '|| p_cust_party_id, 1, 'N');
3301: END IF;
3302:
3303: ELSE -- inv_to_cust_acct_id is null
3296:
3297: END IF;
3298:
3299: IF aso_debug_pub.g_debug_flag = 'Y' THEN
3300: aso_debug_pub.add('Check_Hdr_Acct: p_cust_party_id:1: '|| p_cust_party_id, 1, 'N');
3301: END IF;
3302:
3303: ELSE -- inv_to_cust_acct_id is null
3304:
3309:
3310: p_cust_account_id := p_hdr_cust_acct_id;
3311: p_cust_party_id := p_hdr_party_id;
3312:
3313: IF aso_debug_pub.g_debug_flag = 'Y' THEN
3314: aso_debug_pub.add('Check_Hdr_Acct: p_cust_account_id: '|| p_cust_account_id, 1, 'N');
3315: aso_debug_pub.add('Check_Hdr_Acct: p_cust_party_id:2: '|| p_cust_party_id, 1, 'N');
3316: END IF;
3317:
3310: p_cust_account_id := p_hdr_cust_acct_id;
3311: p_cust_party_id := p_hdr_party_id;
3312:
3313: IF aso_debug_pub.g_debug_flag = 'Y' THEN
3314: aso_debug_pub.add('Check_Hdr_Acct: p_cust_account_id: '|| p_cust_account_id, 1, 'N');
3315: aso_debug_pub.add('Check_Hdr_Acct: p_cust_party_id:2: '|| p_cust_party_id, 1, 'N');
3316: END IF;
3317:
3318: END IF;
3311: p_cust_party_id := p_hdr_party_id;
3312:
3313: IF aso_debug_pub.g_debug_flag = 'Y' THEN
3314: aso_debug_pub.add('Check_Hdr_Acct: p_cust_account_id: '|| p_cust_account_id, 1, 'N');
3315: aso_debug_pub.add('Check_Hdr_Acct: p_cust_party_id:2: '|| p_cust_party_id, 1, 'N');
3316: END IF;
3317:
3318: END IF;
3319: END IF;
3406:
3407: -- Initialize API return status to success
3408: x_return_status := FND_API.G_RET_STS_SUCCESS;
3409:
3410: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3411: aso_debug_pub.add('Check_Customer_Accounts - Begin', 1, 'Y');
3412: END IF;
3413:
3414: OPEN C_Validate_Quote (p_qte_header_id);
3407: -- Initialize API return status to success
3408: x_return_status := FND_API.G_RET_STS_SUCCESS;
3409:
3410: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3411: aso_debug_pub.add('Check_Customer_Accounts - Begin', 1, 'Y');
3412: END IF;
3413:
3414: OPEN C_Validate_Quote (p_qte_header_id);
3415: FETCH C_Validate_Quote into l_dummy;
3420: FND_MESSAGE.Set_Token('VALUE', TO_CHAR(p_qte_header_id), FALSE);
3421: FND_MSG_PUB.ADD;
3422: END IF;
3423:
3424: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3425: aso_debug_pub.add('Check_Customer_Accounts - Invalid qte_hdr_id', 1, 'Y');
3426: END IF;
3427:
3428: CLOSE C_Validate_Quote;
3421: FND_MSG_PUB.ADD;
3422: END IF;
3423:
3424: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3425: aso_debug_pub.add('Check_Customer_Accounts - Invalid qte_hdr_id', 1, 'Y');
3426: END IF;
3427:
3428: CLOSE C_Validate_Quote;
3429: x_return_status := FND_API.G_RET_STS_ERROR;
3430: RAISE FND_API.G_EXC_ERROR;
3431: END IF;
3432: CLOSE C_Validate_Quote;
3433:
3434: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3435: aso_debug_pub.add('Check_Customer_Accounts - After qte_hdr_id check', 1, 'Y');
3436: aso_debug_pub.add('Check_Customer_Accounts - l_create_acct_prof: '||l_create_acct_prof, 1, 'N');
3437: END IF;
3438:
3431: END IF;
3432: CLOSE C_Validate_Quote;
3433:
3434: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3435: aso_debug_pub.add('Check_Customer_Accounts - After qte_hdr_id check', 1, 'Y');
3436: aso_debug_pub.add('Check_Customer_Accounts - l_create_acct_prof: '||l_create_acct_prof, 1, 'N');
3437: END IF;
3438:
3439: l_party := NULL;
3432: CLOSE C_Validate_Quote;
3433:
3434: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3435: aso_debug_pub.add('Check_Customer_Accounts - After qte_hdr_id check', 1, 'Y');
3436: aso_debug_pub.add('Check_Customer_Accounts - l_create_acct_prof: '||l_create_acct_prof, 1, 'N');
3437: END IF;
3438:
3439: l_party := NULL;
3440: l_cust_acct := NULL;
3444: OPEN C_Get_Hdr_CustAcct(p_qte_header_id);
3445: FETCH C_Get_Hdr_CustAcct INTO l_party;
3446: CLOSE C_Get_Hdr_CustAcct;
3447:
3448: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3449: aso_debug_pub.add('Check_Customer_Accounts:hdr_CustAcct - l_party: '||l_party, 1, 'N');
3450: END IF;
3451:
3452: IF l_party IS NOT NULL AND l_party <> FND_API.G_MISS_NUM THEN
3445: FETCH C_Get_Hdr_CustAcct INTO l_party;
3446: CLOSE C_Get_Hdr_CustAcct;
3447:
3448: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3449: aso_debug_pub.add('Check_Customer_Accounts:hdr_CustAcct - l_party: '||l_party, 1, 'N');
3450: END IF;
3451:
3452: IF l_party IS NOT NULL AND l_party <> FND_API.G_MISS_NUM THEN
3453:
3454: OPEN C_Chk_Party_Acct (l_party);
3455: FETCH C_Chk_Party_Acct INTO l_cust_acct;
3456: CLOSE C_Chk_Party_Acct;
3457:
3458: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3459: aso_debug_pub.add('Check_Customer_Accounts:hdr_CustAcct - l_cust_acct: '||l_cust_acct, 1, 'N');
3460: END IF;
3461:
3462: IF l_cust_acct IS NULL OR l_cust_acct = FND_API.G_MISS_NUM THEN
3455: FETCH C_Chk_Party_Acct INTO l_cust_acct;
3456: CLOSE C_Chk_Party_Acct;
3457:
3458: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3459: aso_debug_pub.add('Check_Customer_Accounts:hdr_CustAcct - l_cust_acct: '||l_cust_acct, 1, 'N');
3460: END IF;
3461:
3462: IF l_cust_acct IS NULL OR l_cust_acct = FND_API.G_MISS_NUM THEN
3463: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
3476: OPEN C_Get_Hdr_InvCustAcct(p_qte_header_id);
3477: FETCH C_Get_Hdr_InvCustAcct INTO l_party;
3478: CLOSE C_Get_Hdr_InvCustAcct;
3479:
3480: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3481: aso_debug_pub.add('Check_Customer_Accounts:hdr_InvCustAcct - l_party: '||l_party, 1, 'N');
3482: END IF;
3483:
3484: IF l_party IS NOT NULL AND l_party <> FND_API.G_MISS_NUM THEN
3477: FETCH C_Get_Hdr_InvCustAcct INTO l_party;
3478: CLOSE C_Get_Hdr_InvCustAcct;
3479:
3480: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3481: aso_debug_pub.add('Check_Customer_Accounts:hdr_InvCustAcct - l_party: '||l_party, 1, 'N');
3482: END IF;
3483:
3484: IF l_party IS NOT NULL AND l_party <> FND_API.G_MISS_NUM THEN
3485:
3486: OPEN C_Chk_Party_Acct (l_party);
3487: FETCH C_Chk_Party_Acct INTO l_cust_acct;
3488: CLOSE C_Chk_Party_Acct;
3489:
3490: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3491: aso_debug_pub.add('Check_Customer_Accounts:hdr_InvCustAcct - l_cust_acct: '||l_cust_acct, 1, 'N');
3492: END IF;
3493:
3494: IF l_cust_acct IS NULL OR l_cust_acct = FND_API.G_MISS_NUM THEN
3487: FETCH C_Chk_Party_Acct INTO l_cust_acct;
3488: CLOSE C_Chk_Party_Acct;
3489:
3490: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3491: aso_debug_pub.add('Check_Customer_Accounts:hdr_InvCustAcct - l_cust_acct: '||l_cust_acct, 1, 'N');
3492: END IF;
3493:
3494: IF l_cust_acct IS NULL OR l_cust_acct = FND_API.G_MISS_NUM THEN
3495: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
3508: OPEN C_Get_Hdr_EndCustAcct(p_qte_header_id);
3509: FETCH C_Get_Hdr_EndCustAcct INTO l_party;
3510: CLOSE C_Get_Hdr_EndCustAcct;
3511:
3512: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3513: aso_debug_pub.add('Check_Customer_Accounts:hdr_EndCustAcct - l_party: '||l_party, 1, 'N');
3514: END IF;
3515:
3516: IF l_party IS NOT NULL AND l_party <> FND_API.G_MISS_NUM THEN
3509: FETCH C_Get_Hdr_EndCustAcct INTO l_party;
3510: CLOSE C_Get_Hdr_EndCustAcct;
3511:
3512: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3513: aso_debug_pub.add('Check_Customer_Accounts:hdr_EndCustAcct - l_party: '||l_party, 1, 'N');
3514: END IF;
3515:
3516: IF l_party IS NOT NULL AND l_party <> FND_API.G_MISS_NUM THEN
3517:
3518: OPEN C_Chk_Party_Acct (l_party);
3519: FETCH C_Chk_Party_Acct INTO l_cust_acct;
3520: CLOSE C_Chk_Party_Acct;
3521:
3522: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3523: aso_debug_pub.add('Check_Customer_Accounts:hdr_EndCustAcct - l_cust_acct: '||l_cust_acct, 1, 'N');
3524: END IF;
3525:
3526: IF l_cust_acct IS NULL OR l_cust_acct = FND_API.G_MISS_NUM THEN
3519: FETCH C_Chk_Party_Acct INTO l_cust_acct;
3520: CLOSE C_Chk_Party_Acct;
3521:
3522: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3523: aso_debug_pub.add('Check_Customer_Accounts:hdr_EndCustAcct - l_cust_acct: '||l_cust_acct, 1, 'N');
3524: END IF;
3525:
3526: IF l_cust_acct IS NULL OR l_cust_acct = FND_API.G_MISS_NUM THEN
3527: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
3540: l_party := NULL;
3541: l_cust_acct := NULL;
3542: l_party := Line_Acct.invoice_to_cust_party_id;
3543:
3544: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3545: aso_debug_pub.add('Check_Customer_Accounts:line_Acct - l_party: '||l_party, 1, 'N');
3546: END IF;
3547:
3548: IF l_party IS NOT NULL AND l_party <> FND_API.G_MISS_NUM THEN
3541: l_cust_acct := NULL;
3542: l_party := Line_Acct.invoice_to_cust_party_id;
3543:
3544: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3545: aso_debug_pub.add('Check_Customer_Accounts:line_Acct - l_party: '||l_party, 1, 'N');
3546: END IF;
3547:
3548: IF l_party IS NOT NULL AND l_party <> FND_API.G_MISS_NUM THEN
3549:
3550: OPEN C_Chk_Party_Acct (l_party);
3551: FETCH C_Chk_Party_Acct INTO l_cust_acct;
3552: CLOSE C_Chk_Party_Acct;
3553:
3554: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3555: aso_debug_pub.add('Check_Customer_Accounts:lin_Acct - l_cust_acct: '||l_cust_acct, 1, 'N');
3556: END IF;
3557:
3558: IF l_cust_acct IS NULL OR l_cust_acct = FND_API.G_MISS_NUM THEN
3551: FETCH C_Chk_Party_Acct INTO l_cust_acct;
3552: CLOSE C_Chk_Party_Acct;
3553:
3554: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3555: aso_debug_pub.add('Check_Customer_Accounts:lin_Acct - l_cust_acct: '||l_cust_acct, 1, 'N');
3556: END IF;
3557:
3558: IF l_cust_acct IS NULL OR l_cust_acct = FND_API.G_MISS_NUM THEN
3559: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
3574: l_party := NULL;
3575: l_cust_acct := NULL;
3576: l_party := Line_EndCustAcct.End_Customer_cust_party_id;
3577:
3578: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3579: aso_debug_pub.add('Check_Customer_Accounts:line_EndCustAcct - l_party: '||l_party, 1, 'N');
3580: END IF;
3581:
3582: IF l_party IS NOT NULL AND l_party <> FND_API.G_MISS_NUM THEN
3575: l_cust_acct := NULL;
3576: l_party := Line_EndCustAcct.End_Customer_cust_party_id;
3577:
3578: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3579: aso_debug_pub.add('Check_Customer_Accounts:line_EndCustAcct - l_party: '||l_party, 1, 'N');
3580: END IF;
3581:
3582: IF l_party IS NOT NULL AND l_party <> FND_API.G_MISS_NUM THEN
3583:
3584: OPEN C_Chk_Party_Acct (l_party);
3585: FETCH C_Chk_Party_Acct INTO l_cust_acct;
3586: CLOSE C_Chk_Party_Acct;
3587:
3588: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3589: aso_debug_pub.add('Check_Customer_Accounts:lin_EndCustAcct - l_cust_acct: '||l_cust_acct, 1, 'N');
3590: END IF;
3591:
3592: IF l_cust_acct IS NULL OR l_cust_acct = FND_API.G_MISS_NUM THEN
3585: FETCH C_Chk_Party_Acct INTO l_cust_acct;
3586: CLOSE C_Chk_Party_Acct;
3587:
3588: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3589: aso_debug_pub.add('Check_Customer_Accounts:lin_EndCustAcct - l_cust_acct: '||l_cust_acct, 1, 'N');
3590: END IF;
3591:
3592: IF l_cust_acct IS NULL OR l_cust_acct = FND_API.G_MISS_NUM THEN
3593: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
3608: l_party := NULL;
3609: l_cust_acct := NULL;
3610: l_party := Ship_Acct.ship_to_cust_party_id;
3611:
3612: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3613: aso_debug_pub.add('Check_Customer_Accounts:shp_Acct - l_party: '||l_party, 1, 'N');
3614: END IF;
3615:
3616: IF l_party IS NOT NULL AND l_party <> FND_API.G_MISS_NUM THEN
3609: l_cust_acct := NULL;
3610: l_party := Ship_Acct.ship_to_cust_party_id;
3611:
3612: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3613: aso_debug_pub.add('Check_Customer_Accounts:shp_Acct - l_party: '||l_party, 1, 'N');
3614: END IF;
3615:
3616: IF l_party IS NOT NULL AND l_party <> FND_API.G_MISS_NUM THEN
3617:
3618: OPEN C_Chk_Party_Acct (l_party);
3619: FETCH C_Chk_Party_Acct INTO l_cust_acct;
3620: CLOSE C_Chk_Party_Acct;
3621:
3622: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3623: aso_debug_pub.add('Check_Customer_Accounts:shp_Acct - l_cust_acct: '||l_cust_acct, 1, 'N');
3624: END IF;
3625:
3626: IF l_cust_acct IS NULL OR l_cust_acct = FND_API.G_MISS_NUM THEN
3619: FETCH C_Chk_Party_Acct INTO l_cust_acct;
3620: CLOSE C_Chk_Party_Acct;
3621:
3622: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3623: aso_debug_pub.add('Check_Customer_Accounts:shp_Acct - l_cust_acct: '||l_cust_acct, 1, 'N');
3624: END IF;
3625:
3626: IF l_cust_acct IS NULL OR l_cust_acct = FND_API.G_MISS_NUM THEN
3627: IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
3637: END LOOP;
3638:
3639: END IF; -- 'Place Order'
3640:
3641: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3642: aso_debug_pub.add('Check_Customer_Accounts: End ', 1, 'N');
3643: END IF;
3644:
3645: FND_MSG_PUB.Count_And_Get
3638:
3639: END IF; -- 'Place Order'
3640:
3641: IF ASO_DEBUG_PUB.G_Debug_Flag = 'Y' THEN
3642: aso_debug_pub.add('Check_Customer_Accounts: End ', 1, 'N');
3643: END IF;
3644:
3645: FND_MSG_PUB.Count_And_Get
3646: ( p_count => x_msg_count,