2292: FOR UPDATE of c.order_line_id NOWAIT;
2293:
2294: BEGIN
2295:
2296: if(FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
2297: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT,
2298: 'csp.plsql.CSP_PARTS_REQUIREMENT.create_order',
2299: 'Begin');
2300: end if;
2293:
2294: BEGIN
2295:
2296: if(FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
2297: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT,
2298: 'csp.plsql.CSP_PARTS_REQUIREMENT.create_order',
2299: 'Begin');
2300: end if;
2301:
2322: SELECT Sysdate INTO l_today FROM dual;
2323: l_user_id := fnd_global.user_id;
2324: l_login_id := fnd_global.login_id;
2325:
2326: if(FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
2327: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT,
2328: 'csp.plsql.CSP_PARTS_REQUIREMENT.create_order',
2329: 'l_user_id = ' || l_user_id
2330: || ', l_login_id = ' || l_login_id);
2323: l_user_id := fnd_global.user_id;
2324: l_login_id := fnd_global.login_id;
2325:
2326: if(FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
2327: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT,
2328: 'csp.plsql.CSP_PARTS_REQUIREMENT.create_order',
2329: 'l_user_id = ' || l_user_id
2330: || ', l_login_id = ' || l_login_id);
2331: end if;
2338: where crld.requirement_line_id(+) = crl.requirement_line_id
2339: and crl.requirement_header_id = p_header_id
2340: and crld.source_id is null;
2341:
2342: if(FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
2343: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT,
2344: 'csp.plsql.CSP_PARTS_REQUIREMENT.create_order',
2345: 'p_header_id is NOT NULL and number of lines for this requirement is = ' || l_count);
2346: end if;
2339: and crl.requirement_header_id = p_header_id
2340: and crld.source_id is null;
2341:
2342: if(FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
2343: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT,
2344: 'csp.plsql.CSP_PARTS_REQUIREMENT.create_order',
2345: 'p_header_id is NOT NULL and number of lines for this requirement is = ' || l_count);
2346: end if;
2347:
2365: WHERE requirement_header_id = p_header_id;
2366:
2367: l_header_Rec.operation := G_OPR_CREATE;
2368:
2369: if(FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
2370: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT,
2371: 'csp.plsql.CSP_PARTS_REQUIREMENT.create_order',
2372: 'Part Req Header Data... '
2373: || 'l_header_rec.requirement_header_id = ' || l_header_rec.requirement_header_id
2366:
2367: l_header_Rec.operation := G_OPR_CREATE;
2368:
2369: if(FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
2370: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT,
2371: 'csp.plsql.CSP_PARTS_REQUIREMENT.create_order',
2372: 'Part Req Header Data... '
2373: || 'l_header_rec.requirement_header_id = ' || l_header_rec.requirement_header_id
2374: || ', l_header_rec.order_type_id = ' || l_header_rec.order_type_id
2402: l_line_rec.source_subinventory,
2403: l_line_rec.shipping_method_code,
2404: l_line_rec.arrival_Date ;
2405:
2406: if(FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
2407: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT,
2408: 'csp.plsql.CSP_PARTS_REQUIREMENT.create_order',
2409: 'Part Req Line Data... '
2410: || 'l_line_rec.requirement_line_id = ' || l_line_rec.requirement_line_id
2403: l_line_rec.shipping_method_code,
2404: l_line_rec.arrival_Date ;
2405:
2406: if(FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
2407: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT,
2408: 'csp.plsql.CSP_PARTS_REQUIREMENT.create_order',
2409: 'Part Req Line Data... '
2410: || 'l_line_rec.requirement_line_id = ' || l_line_rec.requirement_line_id
2411: || ', l_line_rec.inventory_item_id = ' || l_line_rec.inventory_item_id
2437: END IF;
2438: END LOOP;
2439:
2440: IF (l_oe_line_tbl.COUNT > 0) THEN
2441: if(FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
2442: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT,
2443: 'csp.plsql.CSP_PARTS_REQUIREMENT.create_order',
2444: 'Calling csp_parts_order.process_order...');
2445: end if;
2438: END LOOP;
2439:
2440: IF (l_oe_line_tbl.COUNT > 0) THEN
2441: if(FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
2442: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT,
2443: 'csp.plsql.CSP_PARTS_REQUIREMENT.create_order',
2444: 'Calling csp_parts_order.process_order...');
2445: end if;
2446: csp_parts_order.process_order(
2452: ,x_return_status => l_return_status
2453: ,x_msg_count => l_msg_count
2454: ,x_msg_data => l_msg_data
2455: );
2456: if(FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
2457: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT,
2458: 'csp.plsql.CSP_PARTS_REQUIREMENT.create_order',
2459: 'csp_parts_order.process_order return status = ' || l_return_status);
2460: end if;
2453: ,x_msg_count => l_msg_count
2454: ,x_msg_data => l_msg_data
2455: );
2456: if(FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
2457: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT,
2458: 'csp.plsql.CSP_PARTS_REQUIREMENT.create_order',
2459: 'csp_parts_order.process_order return status = ' || l_return_status);
2460: end if;
2461:
2478: INTO l_order_number
2479: FROM OE_ORDER_HEADERS_ALL
2480: WHERE header_id = l_header_Rec.order_header_id;
2481:
2482: if(FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
2483: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT,
2484: 'csp.plsql.CSP_PARTS_REQUIREMENT.create_order',
2485: 'l_order_number = ' || l_order_number);
2486: end if;
2479: FROM OE_ORDER_HEADERS_ALL
2480: WHERE header_id = l_header_Rec.order_header_id;
2481:
2482: if(FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
2483: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT,
2484: 'csp.plsql.CSP_PARTS_REQUIREMENT.create_order',
2485: 'l_order_number = ' || l_order_number);
2486: end if;
2487: EXCEPTION
2485: 'l_order_number = ' || l_order_number);
2486: end if;
2487: EXCEPTION
2488: when no_data_found then
2489: if(FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
2490: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT,
2491: 'csp.plsql.CSP_PARTS_REQUIREMENT.create_order',
2492: 'No Data Found for l_header_rec.order_header_id = '
2493: || l_header_rec.order_header_id || ' in OE_ORDER_HEADERS_ALL');
2486: end if;
2487: EXCEPTION
2488: when no_data_found then
2489: if(FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
2490: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT,
2491: 'csp.plsql.CSP_PARTS_REQUIREMENT.create_order',
2492: 'No Data Found for l_header_rec.order_header_id = '
2493: || l_header_rec.order_header_id || ' in OE_ORDER_HEADERS_ALL');
2494: end if;
2579: IF fnd_api.to_boolean(p_commit) THEN
2580: commit work;
2581: END IF;
2582: END If;
2583: if(FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
2584: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT,
2585: 'csp.plsql.CSP_PARTS_REQUIREMENT.create_order',
2586: 'Returning from csp.plsql.CSP_PARTS_REQUIREMENT.create_order with return status = '
2587: || x_return_status);
2580: commit work;
2581: END IF;
2582: END If;
2583: if(FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
2584: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT,
2585: 'csp.plsql.CSP_PARTS_REQUIREMENT.create_order',
2586: 'Returning from csp.plsql.CSP_PARTS_REQUIREMENT.create_order with return status = '
2587: || x_return_status);
2588: end if;