210: | gl product line based on the item.And modified call to |
211: | gmf_get_mappings.get_account_mappings to send category ids of the two |
212: | new item attributes GL Business Class and GL Product Line. |
213: | Archana Mundhe 23-Mar-2009 Bug 8359386 |
214: | Modified code to validate against ic_loct_inv instead of in_loct_mst |
215: | for validated location controlled item and warehouse. |
216:
217: +==========================================================================+ */
218: PROCEDURE Validate_transfer
234: x_ic_item_mst_row ic_item_mst%ROWTYPE;
235: x_ic_whse_mst_row ic_whse_mst%ROWTYPE;
236: x_sy_reas_cds_row sy_reas_cds%ROWTYPE;
237: x_ic_lots_mst_row ic_lots_mst%ROWTYPE;
238: x_ic_loct_inv_row ic_loct_inv%ROWTYPE;
239: l_check_qty NUMBER;
240: l_org INV_Validate.org;
241: l_item INV_Validate.item;
242: l_sub INV_Validate.sub;
899: ELSIF ( (x_ic_whse_mst_row.loct_ctl = 1)
900: AND (x_ic_item_mst_row.loct_ctl = 1)
901: ) THEN
902: SELECT count(1) INTO l_count
903: FROM ic_loct_inv -- Bug 8359386
904: WHERE whse_code = p_line_rec_tbl(i).opm_whse_code
905: AND location = p_line_rec_tbl(i).opm_location
906: AND location <> GMIGUTL.IC$DEFAULT_LOCT;
907:
919: ELSIF ( (x_ic_whse_mst_row.loct_ctl = 2)
920: OR (x_ic_item_mst_row.loct_ctl = 2)
921: ) THEN
922: SELECT count(1) INTO l_count
923: FROM ic_loct_inv
924: WHERE whse_code = p_line_rec_tbl(i).opm_whse_code
925: AND location = p_line_rec_tbl(i).opm_location
926: AND location <> GMIGUTL.IC$DEFAULT_LOCT;
927:
1081: p_lot_rec_tbl(j).opm_lot_expiration_date := x_ic_lots_mst_row.expire_date;
1082: p_lot_rec_tbl(j).opm_grade := x_ic_lots_mst_row.qc_grade;
1083:
1084: --now lets check whether there is inventory to transfer from OPM to ODM
1085: x_ic_loct_inv_row.whse_code := p_line_rec_tbl(i).opm_whse_code;
1086: x_ic_loct_inv_row.location := p_line_rec_tbl(i).opm_location;
1087: x_ic_loct_inv_row.item_id := p_line_rec_tbl(i).opm_item_id;
1088: x_ic_loct_inv_row.lot_id := p_lot_rec_tbl(j).opm_lot_id;
1089:
1082: p_lot_rec_tbl(j).opm_grade := x_ic_lots_mst_row.qc_grade;
1083:
1084: --now lets check whether there is inventory to transfer from OPM to ODM
1085: x_ic_loct_inv_row.whse_code := p_line_rec_tbl(i).opm_whse_code;
1086: x_ic_loct_inv_row.location := p_line_rec_tbl(i).opm_location;
1087: x_ic_loct_inv_row.item_id := p_line_rec_tbl(i).opm_item_id;
1088: x_ic_loct_inv_row.lot_id := p_lot_rec_tbl(j).opm_lot_id;
1089:
1090:
1083:
1084: --now lets check whether there is inventory to transfer from OPM to ODM
1085: x_ic_loct_inv_row.whse_code := p_line_rec_tbl(i).opm_whse_code;
1086: x_ic_loct_inv_row.location := p_line_rec_tbl(i).opm_location;
1087: x_ic_loct_inv_row.item_id := p_line_rec_tbl(i).opm_item_id;
1088: x_ic_loct_inv_row.lot_id := p_lot_rec_tbl(j).opm_lot_id;
1089:
1090:
1091:
1084: --now lets check whether there is inventory to transfer from OPM to ODM
1085: x_ic_loct_inv_row.whse_code := p_line_rec_tbl(i).opm_whse_code;
1086: x_ic_loct_inv_row.location := p_line_rec_tbl(i).opm_location;
1087: x_ic_loct_inv_row.item_id := p_line_rec_tbl(i).opm_item_id;
1088: x_ic_loct_inv_row.lot_id := p_lot_rec_tbl(j).opm_lot_id;
1089:
1090:
1091:
1092: --{
1089:
1090:
1091:
1092: --{
1093: IF GMIVDBL.ic_loct_inv_select(x_ic_loct_inv_row, x_ic_loct_inv_row) THEN
1094: --store quantities in opm item UOM and ODM item UOM
1095:
1096: p_lot_rec_tbl(j).opm_lot_status := x_ic_loct_inv_row.lot_status;
1097: l_return_val := GMICUOM.uom_conversion
1092: --{
1093: IF GMIVDBL.ic_loct_inv_select(x_ic_loct_inv_row, x_ic_loct_inv_row) THEN
1094: --store quantities in opm item UOM and ODM item UOM
1095:
1096: p_lot_rec_tbl(j).opm_lot_status := x_ic_loct_inv_row.lot_status;
1097: l_return_val := GMICUOM.uom_conversion
1098: (
1099: x_ic_item_mst_row.item_id,
1100: nvl(x_ic_lots_mst_row.lot_id,0),
1138: RAISE FND_API.G_EXC_ERROR;
1139: END IF;
1140:
1141: IF ( (x_ic_item_mst_row.lot_indivisible = 1)
1142: AND (x_ic_loct_inv_row.loct_onhand <> p_lot_rec_tbl(j).opm_primary_quantity)
1143: ) THEN
1144: FND_MESSAGE.SET_NAME('GMI','GMI_DXFR_INDIVISIBLE_LOT');
1145: FND_MESSAGE.SET_TOKEN('LINE_NO',p_line_rec_tbl(i).line_no);
1146: FND_MESSAGE.SET_TOKEN('LOT_ID',p_lot_rec_tbl(j).opm_lot_id);
1157:
1158: --lets check the deviation between OPM primary and secondary if secondary is passed
1159: --if it is not passed we calculate the secondary qty.
1160: IF (x_ic_item_mst_row.dualum_ind > 0) THEN
1161: IF (x_ic_loct_inv_row.loct_onhand = p_lot_rec_tbl(j).opm_primary_quantity) THEN
1162: p_lot_rec_tbl(j).quantity2 := x_ic_loct_inv_row.loct_onhand2;
1163: ELSE
1164: IF (p_lot_rec_tbl(j).quantity2 IS NULL) THEN
1165:
1158: --lets check the deviation between OPM primary and secondary if secondary is passed
1159: --if it is not passed we calculate the secondary qty.
1160: IF (x_ic_item_mst_row.dualum_ind > 0) THEN
1161: IF (x_ic_loct_inv_row.loct_onhand = p_lot_rec_tbl(j).opm_primary_quantity) THEN
1162: p_lot_rec_tbl(j).quantity2 := x_ic_loct_inv_row.loct_onhand2;
1163: ELSE
1164: IF (p_lot_rec_tbl(j).quantity2 IS NULL) THEN
1165:
1166: IF (x_ic_item_mst_row.dualum_ind = 3) THEN
1316: p_lot_rec_tbl(j).opm_grade := x_ic_lots_mst_row.qc_grade;
1317: p_lot_rec_tbl(j).opm_lot_expiration_date := x_ic_lots_mst_row.expire_date;
1318:
1319: --We need this get the lot_status of the OPM lot.
1320: x_ic_loct_inv_row.whse_code := p_line_rec_tbl(i).opm_whse_code;
1321: x_ic_loct_inv_row.location := p_line_rec_tbl(i).opm_location;
1322: x_ic_loct_inv_row.item_id := p_line_rec_tbl(i).opm_item_id;
1323: x_ic_loct_inv_row.lot_id := p_lot_rec_tbl(j).opm_lot_id;
1324:
1317: p_lot_rec_tbl(j).opm_lot_expiration_date := x_ic_lots_mst_row.expire_date;
1318:
1319: --We need this get the lot_status of the OPM lot.
1320: x_ic_loct_inv_row.whse_code := p_line_rec_tbl(i).opm_whse_code;
1321: x_ic_loct_inv_row.location := p_line_rec_tbl(i).opm_location;
1322: x_ic_loct_inv_row.item_id := p_line_rec_tbl(i).opm_item_id;
1323: x_ic_loct_inv_row.lot_id := p_lot_rec_tbl(j).opm_lot_id;
1324:
1325: IF GMIVDBL.ic_loct_inv_select(x_ic_loct_inv_row, x_ic_loct_inv_row) THEN
1318:
1319: --We need this get the lot_status of the OPM lot.
1320: x_ic_loct_inv_row.whse_code := p_line_rec_tbl(i).opm_whse_code;
1321: x_ic_loct_inv_row.location := p_line_rec_tbl(i).opm_location;
1322: x_ic_loct_inv_row.item_id := p_line_rec_tbl(i).opm_item_id;
1323: x_ic_loct_inv_row.lot_id := p_lot_rec_tbl(j).opm_lot_id;
1324:
1325: IF GMIVDBL.ic_loct_inv_select(x_ic_loct_inv_row, x_ic_loct_inv_row) THEN
1326: p_lot_rec_tbl(j).opm_lot_status := x_ic_loct_inv_row.lot_status;
1319: --We need this get the lot_status of the OPM lot.
1320: x_ic_loct_inv_row.whse_code := p_line_rec_tbl(i).opm_whse_code;
1321: x_ic_loct_inv_row.location := p_line_rec_tbl(i).opm_location;
1322: x_ic_loct_inv_row.item_id := p_line_rec_tbl(i).opm_item_id;
1323: x_ic_loct_inv_row.lot_id := p_lot_rec_tbl(j).opm_lot_id;
1324:
1325: IF GMIVDBL.ic_loct_inv_select(x_ic_loct_inv_row, x_ic_loct_inv_row) THEN
1326: p_lot_rec_tbl(j).opm_lot_status := x_ic_loct_inv_row.lot_status;
1327: ELSE
1321: x_ic_loct_inv_row.location := p_line_rec_tbl(i).opm_location;
1322: x_ic_loct_inv_row.item_id := p_line_rec_tbl(i).opm_item_id;
1323: x_ic_loct_inv_row.lot_id := p_lot_rec_tbl(j).opm_lot_id;
1324:
1325: IF GMIVDBL.ic_loct_inv_select(x_ic_loct_inv_row, x_ic_loct_inv_row) THEN
1326: p_lot_rec_tbl(j).opm_lot_status := x_ic_loct_inv_row.lot_status;
1327: ELSE
1328: IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN
1329: log_msg('Failed call to GMIVDBL.ic_loct_inv_select when transfer type is 1. Not an error.');
1322: x_ic_loct_inv_row.item_id := p_line_rec_tbl(i).opm_item_id;
1323: x_ic_loct_inv_row.lot_id := p_lot_rec_tbl(j).opm_lot_id;
1324:
1325: IF GMIVDBL.ic_loct_inv_select(x_ic_loct_inv_row, x_ic_loct_inv_row) THEN
1326: p_lot_rec_tbl(j).opm_lot_status := x_ic_loct_inv_row.lot_status;
1327: ELSE
1328: IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN
1329: log_msg('Failed call to GMIVDBL.ic_loct_inv_select when transfer type is 1. Not an error.');
1330: END IF;
1325: IF GMIVDBL.ic_loct_inv_select(x_ic_loct_inv_row, x_ic_loct_inv_row) THEN
1326: p_lot_rec_tbl(j).opm_lot_status := x_ic_loct_inv_row.lot_status;
1327: ELSE
1328: IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN
1329: log_msg('Failed call to GMIVDBL.ic_loct_inv_select when transfer type is 1. Not an error.');
1330: END IF;
1331: END IF;
1332:
1333: END IF;