DBA Data[Home] [Help]

APPS.WSM_RESERVATIONS_PVT SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 70

	l_wsm_rsv_v_tbl.delete;
Line: 88

	If  p_txn_header.transaction_type_id = WSMPCNST.UPDATE_ASSEMBLY then
		--Write to WIE  'Note: Starting job is reserved against sales order(s). Update Assembly transaction
		--will result in deletion of the starting job reservations
		--Write warning into concurrent log
		fnd_message.set_name('WSM','WSM_RSV_UPD_ASSY');
Line: 102

		--MP Delete Changes Start
		BEGIN
			select *
			bulk collect into l_wsm_rsv_v_tbl
			from wsm_reservations_v
			where wip_entity_id = p_starting_jobs_tbl(p_rep_job_index).wip_entity_id;
Line: 112

		--MP Delete Changes End
		If l_wsm_rsv_v_tbl.count > 0 then --MP Delete Changes
		For i in l_wsm_rsv_v_tbl.first .. l_wsm_rsv_v_tbl.last loop --MP Delete Changes
		l_rsv_old.reservation_id := l_wsm_rsv_v_tbl(i).reservation_id;
Line: 117

		inv_reservation_pub.delete_reservation
		   (
		      p_api_version_number        => 1.0
		    , p_init_msg_lst              => fnd_api.g_true
		    , x_return_status             => l_return_status
		    , x_msg_count                 => l_msg_count
		    , x_msg_data                  => l_msg_data
		    , p_rsv_rec                   => l_rsv_old
		    , p_serial_number             => l_dummy_sn
		    );
Line: 131

			WSM_log_PVT.update_errtbl(l_msg_index,l_msg_count);
Line: 134

				l_msg_tokens.delete;
Line: 136

							p_msg_text	    => 'inv_reservation_pub.delete_reservation failed',
							p_stmt_num	    => l_stmt_num		,
							p_msg_tokens	    => l_msg_tokens		,
							p_fnd_log_level     => G_LOG_LEVEL_STATEMENT	,
							p_run_log_level	    => l_log_level
							);
Line: 150

		end loop; --MP Delete Changes
Line: 151

		end if; --MP Delete Changes :End of check on l_wsm_rsv_v_tbl.count > 0
Line: 155

		--If yes, then check if there is update of assembly.
		--If yes, then write to WIE  'Note: Starting job is reserved against sales order(s).Update Assembly transaction will result in deletion of the starting job reservations'
		--and call inv_reservation_pub.delete_reservation
		--Else, compare starting job's net qty with net qty of same job in resulting jobs.
		--Write to WIE 'Note: New net quantity is less than the starting job's reserved quantity.This transaction will result in reduction in reserved quantity' and Call reduce_reservations( );
Line: 162

		--if parent job is not a resulting job, then write to WIE  'Note: Starting job isnot a resulting job.The reservations against sales order(s) for this job will be deleted..

		If (p_sj_also_rj_index is not null) then

			If p_resulting_jobs_tbl(p_sj_also_rj_index).split_has_update_assy = 1 then
				--Write warning into concurrent log
				fnd_message.set_name('WSM','WSM_RSV_UPD_ASSY');
Line: 179

				--MP Delete Changes Start
				BEGIN
					select *
					bulk collect into l_wsm_rsv_v_tbl
					from wsm_reservations_v
					where wip_entity_id = p_starting_jobs_tbl(p_rep_job_index).wip_entity_id;
Line: 189

				--MP Delete Changes End
		             --MP Delete Changes
			     If l_wsm_rsv_v_tbl.count > 0 then --MP Delete Changes
		              For i in l_wsm_rsv_v_tbl.first .. l_wsm_rsv_v_tbl.last loop
		              l_rsv_old.reservation_id := l_wsm_rsv_v_tbl(i).reservation_id;
Line: 194

				inv_reservation_pub.delete_reservation
				   (
				      p_api_version_number        => 1.0
				    , p_init_msg_lst              => fnd_api.g_true
				    , x_return_status             => l_return_status
				    , x_msg_count                 => l_msg_count
				    , x_msg_data                  => l_msg_data
				    , p_rsv_rec                   => l_rsv_old
				    , p_serial_number             => l_dummy_sn
				    );
Line: 207

					WSM_log_PVT.update_errtbl(l_msg_index,l_msg_count);
Line: 210

						l_msg_tokens.delete;
Line: 212

									p_msg_text	    => 'inv_reservation_pub.delete_reservation failed',
									p_stmt_num	    => l_stmt_num		,
									p_msg_tokens	    => l_msg_tokens		,
									p_fnd_log_level     => G_LOG_LEVEL_STATEMENT	,
									p_run_log_level	    => l_log_level
									);
Line: 226

				end loop; --MP delete reservations loop
Line: 227

			        end if; --MP Delete Changes :End of check on l_wsm_rsv_v_tbl.count > 0
Line: 249

				select primary_uom_code
				into l_expected_quantity_uom --l_mtl_rsv_rec.expected_quantity_uom
				from mtl_system_items
				where inventory_item_id =l_mtl_rsv_rec.inventory_item_id-- p_starting_jobs_tbl(p_starting_jobs_tbl.first).primary_item_id
				and organization_id = l_mtl_rsv_rec.organization_id; --p_starting_jobs_tbl(p_starting_jobs_tbl.first).organization_id;
Line: 273

					 , p_delete_flag		=> 'N'
					 , p_sort_by_criteria		=> null
				 );
Line: 279

					WSM_log_PVT.update_errtbl(l_msg_index,l_msg_count);
Line: 282

						l_msg_tokens.delete;
Line: 311

				--MP Delete Changes Start
			BEGIN
				select *
				bulk collect into l_wsm_rsv_v_tbl
				from wsm_reservations_v
				where wip_entity_id = p_starting_jobs_tbl(p_rep_job_index).wip_entity_id;
Line: 321

			--MP Delete Changes End
		        --MP Delete Changes
		       If l_wsm_rsv_v_tbl.count > 0 then --MP Delete Changes
		          For i in l_wsm_rsv_v_tbl.first .. l_wsm_rsv_v_tbl.last loop
		          l_rsv_old.reservation_id := l_wsm_rsv_v_tbl(i).reservation_id;
Line: 327

			inv_reservation_pub.delete_reservation
			   (
			      p_api_version_number        => 1.0
			    , p_init_msg_lst              => fnd_api.g_true
			    , x_return_status             => l_return_status
			    , x_msg_count                 => l_msg_count
			    , x_msg_data                  => l_msg_data
			    , p_rsv_rec                   => l_rsv_old
			    , p_serial_number             => l_dummy_sn
			    );
Line: 341

				WSM_log_PVT.update_errtbl(l_msg_index,l_msg_count);
Line: 344

					l_msg_tokens.delete;
Line: 346

								p_msg_text	    => 'inv_reservation_pub.delete_reservation failed',
								p_stmt_num	    => l_stmt_num		,
								p_msg_tokens	    => l_msg_tokens		,
								p_fnd_log_level     => G_LOG_LEVEL_STATEMENT	,
								p_run_log_level	    => l_log_level
								);
Line: 359

			end loop; --MP delete reservations loop
Line: 360

			end if; --MP Delete Changes :End of check on l_wsm_rsv_v_tbl.count > 0
Line: 371

		update wip_discrete_jobs
		set    net_quantity = start_quantity
		where  wip_entity_id = p_resulting_jobs_tbl(l_rj_index).wip_entity_id;
Line: 393

							select *
							bulk collect into l_wsm_rsv_v_tbl
							from wsm_reservations_v
							where wip_entity_id = p_starting_jobs_tbl(l_counter).wip_entity_id;
Line: 443

									WSM_log_PVT.update_errtbl(l_msg_index,l_msg_count);
Line: 446

										l_msg_tokens.delete;
Line: 481

				--MP Delete Changes Start
				                BEGIN
				                	select *
				                	bulk collect into l_wsm_rsv_v_tbl
				                	from wsm_reservations_v
				                	where wip_entity_id = p_starting_jobs_tbl(l_counter).wip_entity_id;
Line: 491

				                --MP Delete Changes End
					--MP Delete Changes
				                If l_wsm_rsv_v_tbl.count > 0 then --MP Delete Changes
					        For i in l_wsm_rsv_v_tbl.first .. l_wsm_rsv_v_tbl.last loop
					        l_rsv_old.reservation_id := l_wsm_rsv_v_tbl(i).reservation_id;
Line: 496

						inv_reservation_pub.Delete_reservation    (
						      p_api_version_number        => 1.0
						    , p_init_msg_lst              => fnd_api.g_true
						    , x_return_status             => l_return_status
						    , x_msg_count                 => l_msg_count
						    , x_msg_data                  => l_msg_data
						    , p_rsv_rec                   => l_rsv_old
						    , p_serial_number             => l_dummy_sn
						    );
Line: 509

							WSM_log_PVT.update_errtbl(l_msg_index,l_msg_count);
Line: 512

								l_msg_tokens.delete;
Line: 527

						end loop; --MP delete reservations loop
Line: 528

			                        end if; --MP Delete Changes :End of check on l_wsm_rsv_v_tbl.count > 0
Line: 535

		update wip_discrete_jobs
		set    net_quantity = p_resulting_jobs_tbl(l_rj_index).net_quantity
		where  wip_entity_id = p_resulting_jobs_tbl(l_rj_index).wip_entity_id;
Line: 548

                 WSM_RESERVATIONS_PVT.Modify_reservations_jobupdate(
                                                 p_wip_entity_id         => p_resulting_jobs_tbl(l_rj_index).wip_entity_id,
                                                 P_old_net_qty           => l_rsvd_qty, --p_resulting_jobs_tbl(l_rj_index).net_quantity,
                                                 P_new_net_qty           => p_resulting_jobs_tbl(l_rj_index).net_quantity,
                                                 P_inventory_item_id     => p_resulting_jobs_tbl(l_rj_index).primary_item_id,
                                                 P_org_id                => p_txn_header.organization_id,
                                                 P_status_type           => p_resulting_jobs_tbl(l_rj_index).status_type,
                                                 x_return_status         => l_return_status,
                                                 x_msg_count             => l_msg_count,
                                                 x_msg_data              => l_msg_data
                                                 ); --this is to handle the change in net qty if any.
Line: 564

                                         l_msg_tokens.delete;
Line: 566

                                                                p_msg_text           => 'WSM_RESERVATIONS_PVT.Modify_reservations_jobupdate failed:'||l_msg_data,
                                                                p_stmt_num           => l_stmt_num               ,
                                                                p_msg_tokens         => l_msg_tokens,
                                                                p_fnd_msg_level      => G_MSG_LVL_ERROR          ,
                                                                p_fnd_log_level      => G_LOG_LEVEL_ERROR        ,
                                                                p_run_log_level      => l_log_level
                                                               );
Line: 670

	l_wsm_rsvn_tbl.delete;
Line: 688

		--Insert the reservations for this job in the WSM_RESERVATIONS table.Before that check if the reserved qty against the job is more than what exactly the job has at completion.If that is the case,reduce reservations associated with the job.

		l_rsvd_qty := check_reservation_quantity(p_wip_entity_id 	=> p_wip_entity_id,
							P_org_id 		=> p_org_id,
							P_inventory_item_id 	=> p_inventory_item_id
							) ;
Line: 707

			select primary_uom_code
		        into l_mtl_rsv_rec.expected_quantity_uom
		        from mtl_system_items
		        where inventory_item_id =l_mtl_rsv_rec.inventory_item_id
		        and organization_id = l_mtl_rsv_rec.organization_id;
Line: 727

			--					, delete_flag			=>'N'
			--					);
Line: 740

					 , p_delete_flag		=> 'N'
					 , p_sort_by_criteria		=> null
				 );
Line: 745

				WSM_log_PVT.update_errtbl(l_msg_index,l_msg_count);
Line: 748

					l_msg_tokens.delete;
Line: 766

		INSERT INTO wsm_reservations (
				Wip_entity_id,
				Reservation_id,
				Demand_source_header_id,
				Demand_source_line_id,
				Reserved_qty)
		(select wip_entity_id,
			reservation_id,
			demand_source_header_id,
			demand_source_line_id,
			primary_quantity
		from wsm_reservations_v
		where wip_entity_id= p_wip_entity_id
		and organization_id = p_org_id
		and inventory_item_id = p_inventory_item_id
		);
Line: 787

			select *
			bulk collect into l_wsm_rsvn_tbl
			from wsm_reservations
			where wip_entity_id = p_wip_entity_id;
Line: 805

			select status_type
			into l_status_type
			from wip_discrete_jobs
			where wip_entity_id = p_wip_entity_id
			and organization_id = p_org_id;
Line: 811

			update wip_discrete_jobs
			set status_type = 3
			where wip_entity_id = p_wip_entity_id
			and organization_id = p_org_id;
Line: 824

					select primary_reservation_quantity
					into l_reservation_quantity
					from mtl_reservations
					where reservation_id = l_wsm_rsvn_tbl(j).reservation_id;
Line: 874

						WSM_log_PVT.update_errtbl(l_msg_index,l_msg_count);
Line: 877

							l_msg_tokens.delete;
Line: 897

			-- status before it was updated to Released for trf the reservation.

			update wip_discrete_jobs
			set status_type = l_status_type
			where wip_entity_id = p_wip_entity_id
			and organization_id = p_org_id;
Line: 905

			/*now delete the rows corresponding to this job in wsm_reservations*/
			delete from wsm_reservations
			where wip_entity_id = p_wip_entity_id;
Line: 958

Procedure modify_reservations_jobupdate (p_wip_entity_id 	IN         NUMBER,
					P_old_net_qty 		IN 	   NUMBER ,
					P_new_net_qty 		IN 	   NUMBER,
					P_inventory_item_id 	IN 	   NUMBER,
					P_org_id 		IN 	   NUMBER,
					P_status_type 		IN         NUMBER,
					x_return_status 	OUT NOCOPY VARCHAR2,
					x_msg_count 		OUT NOCOPY NUMBER,
					x_msg_data 		OUT NOCOPY VARCHAR2)
is
l_rsv  			inv_reservation_global.mtl_reservation_rec_type;
Line: 987

l_module            CONSTANT VARCHAR2(100)  := 'wsm.plsql.WSM_RESERVATIONS_PVT.modify_reservations_jobupdate';
Line: 998

	savepoint start_modify_rsv_jobupdate;
Line: 1040

		--					, delete_flag			=> 'N'
		--					);
Line: 1052

		select primary_uom_code
		into l_expected_quantity_uom --l_mtl_rsv_rec.expected_quantity_uom
		from mtl_system_items
		where inventory_item_id =l_mtl_rsv_rec.inventory_item_id
		and organization_id = l_mtl_rsv_rec.organization_id;
Line: 1075

				 , p_delete_flag		=> 'N'
				 , p_sort_by_criteria		=> null
				 );
Line: 1080

			WSM_log_PVT.update_errtbl(l_msg_index,l_msg_count);
Line: 1083

				l_msg_tokens.delete;
Line: 1113

		-- For deleting reservations we need to use reduce reservation with p_delete_flag = 'Y'

		l_mtl_rsv_rec.action := 0;
Line: 1132

				 , p_delete_flag		        => 'Y'
				 , p_sort_by_criteria		    => null
				 );
Line: 1136

		-- Commenting call to delete_reservation API for bug 5347562.
	/*	inv_reservation_pub.delete_reservation
		   (
		      p_api_version_number        => 1.0
		    , p_init_msg_lst              => fnd_api.g_true
		    , x_return_status             => l_return_status
		    , x_msg_count                 => l_msg_count
		    , x_msg_data                  => l_msg_data
		    , p_rsv_rec                   => l_rsv
		    , p_serial_number             => l_dummy_sn
		    );  */
Line: 1151

			WSM_log_PVT.update_errtbl(l_msg_index,l_msg_count);
Line: 1154

				l_msg_tokens.delete;
Line: 1179

		-- Commenting call to delete_reservation API for bug 5347562.
		/*
		inv_reservation_pub.delete_reservation
		   (
		      p_api_version_number        => 1.0
		    , p_init_msg_lst              => fnd_api.g_true
		    , x_return_status             => l_return_status
		    , x_msg_count                 => l_msg_count
		    , x_msg_data                  => l_msg_data
		    , p_rsv_rec                   => l_rsv
		    , p_serial_number             => l_dummy_sn
		    );  */
Line: 1193

		-- For deleting reservations we need to use reduce reservation with p_delete_flag = 'Y'

        l_mtl_rsv_rec.action := 0;
Line: 1212

				 , p_delete_flag		        => 'Y'
				 , p_sort_by_criteria		    => null
				 );
Line: 1217

			WSM_log_PVT.update_errtbl(l_msg_index,l_msg_count);
Line: 1220

				l_msg_tokens.delete;
Line: 1250

		ROLLBACK TO start_modify_rsv_jobupdate;
Line: 1259

		ROLLBACK TO start_modify_rsv_jobupdate;
Line: 1268

		 ROLLBACK TO start_modify_rsv_jobupdate;
Line: 1301

		Select sum (primary_quantity)
		into l_rsvd_qty
		from wsm_reservations_v
		where wip_entity_id = p_wip_entity_id
		and organization_id = p_org_id
		and inventory_item_id = p_inventory_item_id;
Line: 1329

		select 1 into l_rsv_exists
		from wsm_reservations_v
		where wip_entity_id = p_wip_entity_id
		and organization_id = p_org_id
		and inventory_item_id = p_inventory_item_id
		and rownum = 1;