146: Local variables
147: */
148:
149: l_status VARCHAR2(1);
150: l_return_status VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
151: l_count NUMBER ;
152: l_loop_cnt NUMBER ;
153: l_no_of_lots NUMBER := p_no_of_lots;
154: l_no_of_sublots NUMBER := p_no_of_sublots;
181: From ic_item_mst
182: Where item_id = p_item_id;
183:
184: BEGIN
185: x_return_status := FND_API.G_RET_STS_SUCCESS;
186:
187: --Get item attributes required to create lots.
188: Open Cr_item;
189: Fetch Cr_item Into l_item_no,l_qc_grade;
191: Close Cr_item;
192: FND_MESSAGE.SET_NAME('GML','GML_OPM_ITEM_NOT_EXIST');
193: FND_MSG_PUB.ADD;
194: x_msg_count := 1;
195: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
196: RETURN FND_API.G_RET_STS_UNEXP_ERROR;
197: End If;
198: If Cr_item%ISOPEN Then
199: Close Cr_item;
192: FND_MESSAGE.SET_NAME('GML','GML_OPM_ITEM_NOT_EXIST');
193: FND_MSG_PUB.ADD;
194: x_msg_count := 1;
195: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
196: RETURN FND_API.G_RET_STS_UNEXP_ERROR;
197: End If;
198: If Cr_item%ISOPEN Then
199: Close Cr_item;
200: End If;
275:
276: IF (GMIGUTL.SETUP(lot_rec.user_name)) THEN
277: GMIPAPI.Create_Lot
278: ( p_api_version => 3
279: , p_init_msg_list => FND_API.G_TRUE
280: , p_commit => FND_API.G_FALSE
281: , p_validation_level => FND_API.G_VALID_LEVEL_FULL
282: , p_lot_rec =>lot_rec
283: , x_ic_lots_mst_row => l_ic_lots_mst_row
276: IF (GMIGUTL.SETUP(lot_rec.user_name)) THEN
277: GMIPAPI.Create_Lot
278: ( p_api_version => 3
279: , p_init_msg_list => FND_API.G_TRUE
280: , p_commit => FND_API.G_FALSE
281: , p_validation_level => FND_API.G_VALID_LEVEL_FULL
282: , p_lot_rec =>lot_rec
283: , x_ic_lots_mst_row => l_ic_lots_mst_row
284: , x_ic_lots_cpg_row => l_ic_lots_cpg_row
277: GMIPAPI.Create_Lot
278: ( p_api_version => 3
279: , p_init_msg_list => FND_API.G_TRUE
280: , p_commit => FND_API.G_FALSE
281: , p_validation_level => FND_API.G_VALID_LEVEL_FULL
282: , p_lot_rec =>lot_rec
283: , x_ic_lots_mst_row => l_ic_lots_mst_row
284: , x_ic_lots_cpg_row => l_ic_lots_cpg_row
285: , x_return_status => l_status
287: , x_msg_data => l_data
288: );
289:
290: IF (l_status = 'S') THEN
291: x_return_status := FND_API.G_RET_STS_SUCCESS;
292: ELSE
293: x_return_status := l_status;
294: x_msg_count := l_count;
295: x_msg_data := l_data;
385: IF nvl(p_no_of_sublots,0) = 0 THEN
386: IF (GMIGUTL.SETUP(lot_rec.user_name)) THEN
387: GMIPAPI.Create_Lot
388: ( p_api_version => 3
389: , p_init_msg_list => FND_API.G_TRUE
390: , p_commit => FND_API.G_FALSE
391: , p_validation_level => FND_API.G_VALID_LEVEL_FULL
392: , p_lot_rec =>lot_rec
393: , x_ic_lots_mst_row => l_ic_lots_mst_row
386: IF (GMIGUTL.SETUP(lot_rec.user_name)) THEN
387: GMIPAPI.Create_Lot
388: ( p_api_version => 3
389: , p_init_msg_list => FND_API.G_TRUE
390: , p_commit => FND_API.G_FALSE
391: , p_validation_level => FND_API.G_VALID_LEVEL_FULL
392: , p_lot_rec =>lot_rec
393: , x_ic_lots_mst_row => l_ic_lots_mst_row
394: , x_ic_lots_cpg_row => l_ic_lots_cpg_row
387: GMIPAPI.Create_Lot
388: ( p_api_version => 3
389: , p_init_msg_list => FND_API.G_TRUE
390: , p_commit => FND_API.G_FALSE
391: , p_validation_level => FND_API.G_VALID_LEVEL_FULL
392: , p_lot_rec =>lot_rec
393: , x_ic_lots_mst_row => l_ic_lots_mst_row
394: , x_ic_lots_cpg_row => l_ic_lots_cpg_row
395: , x_return_status => l_status
396: , x_msg_count => l_count
397: , x_msg_data => l_data
398: );
399: IF (l_status = 'S') THEN
400: x_return_status := FND_API.G_RET_STS_SUCCESS;
401: ELSE
402: x_return_status := l_status;
403: x_msg_count := l_count;
404: x_msg_data := l_data;
495:
496: IF (GMIGUTL.SETUP(lot_rec.user_name)) THEN
497: GMIPAPI.Create_Lot
498: ( p_api_version => 3
499: , p_init_msg_list => FND_API.G_TRUE
500: , p_commit => FND_API.G_FALSE
501: , p_validation_level => FND_API.G_VALID_LEVEL_FULL
502: , p_lot_rec =>lot_rec
503: , x_ic_lots_mst_row => l_ic_lots_mst_row
496: IF (GMIGUTL.SETUP(lot_rec.user_name)) THEN
497: GMIPAPI.Create_Lot
498: ( p_api_version => 3
499: , p_init_msg_list => FND_API.G_TRUE
500: , p_commit => FND_API.G_FALSE
501: , p_validation_level => FND_API.G_VALID_LEVEL_FULL
502: , p_lot_rec =>lot_rec
503: , x_ic_lots_mst_row => l_ic_lots_mst_row
504: , x_ic_lots_cpg_row => l_ic_lots_cpg_row
497: GMIPAPI.Create_Lot
498: ( p_api_version => 3
499: , p_init_msg_list => FND_API.G_TRUE
500: , p_commit => FND_API.G_FALSE
501: , p_validation_level => FND_API.G_VALID_LEVEL_FULL
502: , p_lot_rec =>lot_rec
503: , x_ic_lots_mst_row => l_ic_lots_mst_row
504: , x_ic_lots_cpg_row => l_ic_lots_cpg_row
505: , x_return_status => l_status
506: , x_msg_count => l_count
507: , x_msg_data => l_data
508: );
509: IF (l_status = 'S') THEN
510: x_return_status := FND_API.G_RET_STS_SUCCESS;
511: ELSE
512: x_return_status := l_status;
513: x_msg_count := l_count;
514: x_msg_data := l_data;
560: RETURN l_return_status;
561:
562: EXCEPTION
563: WHEN e_auto_lot_create THEN
564: x_return_status := FND_API.G_RET_STS_ERROR;
565: RETURN x_return_status;
566: WHEN e_create_lot THEN
567: x_return_status := FND_API.G_RET_STS_ERROR;
568: RETURN x_return_status;
563: WHEN e_auto_lot_create THEN
564: x_return_status := FND_API.G_RET_STS_ERROR;
565: RETURN x_return_status;
566: WHEN e_create_lot THEN
567: x_return_status := FND_API.G_RET_STS_ERROR;
568: RETURN x_return_status;
569: WHEN e_lot_conv_err THEN
570: x_return_status := FND_API.G_RET_STS_ERROR;
571: RETURN x_return_status;
566: WHEN e_create_lot THEN
567: x_return_status := FND_API.G_RET_STS_ERROR;
568: RETURN x_return_status;
569: WHEN e_lot_conv_err THEN
570: x_return_status := FND_API.G_RET_STS_ERROR;
571: RETURN x_return_status;
572: WHEN OTHERS THEN
573: /* dbms_output.put_line('Other Error'); */
574: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
570: x_return_status := FND_API.G_RET_STS_ERROR;
571: RETURN x_return_status;
572: WHEN OTHERS THEN
573: /* dbms_output.put_line('Other Error'); */
574: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
575: x_msg_count := 1;
576: FND_MESSAGE.SET_NAME('GMI', 'GMI_UNEXPECTED_ERROR');
577: FND_MESSAGE.SET_TOKEN('ERROR', sqlerrm);
578: FND_MSG_PUB.ADD;