90:
91: IF FND_API.TO_BOOLEAN(p_init_msg_list)
92: THEN
93:
94: FND_MSG_PUB.initialize;
95:
96: END IF;
97:
98: -- Initialize API return status to success
143:
144: if p_serial_number is null or p_inventory_item_id is null or p_organization_id is null then
145: -- if serial_number is null, then quit processing
146: FND_MESSAGE.SET_NAME('WIP', 'WIP_EAM_ITEM_DOES_NOT_EXIST');
147: FND_MSG_PUB.ADD;
148: RAISE FND_API.G_EXC_ERROR;
149: else
150: l_serial_number := p_serial_number;
151: l_inventory_item_id := p_inventory_item_id;
165: where gen_object_id = p_object_id;
166: exception
167: when others then
168: FND_MESSAGE.SET_NAME('WIP', 'WIP_EAM_ITEM_DOES_NOT_EXIST');
169: FND_MSG_PUB.ADD;
170: RAISE FND_API.G_EXC_ERROR;
171: end;
172: else
173: l_serial_number := p_serial_number;
184: if p_parent_object_id is null then
185: if p_parent_serial_number is null or p_parent_inventory_item_id is null or p_parent_organization_id is null then
186: -- if there is no parent information, then quit processing
187: FND_MESSAGE.SET_NAME('WIP', 'WIP_EAM_INVALID_PARENT_ITEM');
188: FND_MSG_PUB.ADD;
189: RAISE FND_API.G_EXC_ERROR;
190:
191: else
192: begin
201: and inventory_item_id = p_parent_inventory_item_id;
202: exception
203: when others then
204: FND_MESSAGE.SET_NAME('WIP', 'WIP_EAM_INVALID_PARENT_ITEM');
205: FND_MSG_PUB.ADD;
206: RAISE FND_API.G_EXC_ERROR;
207: end;
208: end if;
209:
235: and wdj.status_type in (1,3,6);
236:
237: if l_charge_object_id <> l_parent_object_id then
238: FND_MESSAGE.SET_NAME('WIP', 'WIP_EAM_WO_WITH_CHARGE_ASSET');
239: FND_MSG_PUB.ADD;
240: RAISE FND_API.G_EXC_ERROR;
241: end if;
242:
243: exception
246: end;
247:
248: -- perform genealogy creation
249:
250: FND_MSG_PUB.initialize;
251:
252: inv_genealogy_pub.insert_genealogy(
253: p_api_version => l_api_version,
254: p_object_type => 2,
343: ROLLBACK TO eam_rebuild_genealogy;
344:
345: x_return_status := FND_API.G_RET_STS_ERROR;
346:
347: FND_MSG_PUB.Count_And_Get
348: ( p_encoded => FND_API.G_FALSE,
349: p_count => x_msg_count,
350: p_data => x_msg_data
351: );
354: ROLLBACK TO eam_rebuild_genealogy;
355:
356: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
357:
358: FND_MSG_PUB.Count_And_Get
359: ( p_encoded => FND_API.G_FALSE,
360: p_count => x_msg_count,
361: p_data => x_msg_data
362: );
451:
452: IF FND_API.TO_BOOLEAN(p_init_msg_list)
453: THEN
454:
455: FND_MSG_PUB.initialize;
456:
457: END IF;
458:
459: -- Initialize API return status to success
492: or p_organization_id is null then
493:
494: -- if serial_number is null, then quit processing
495: FND_MESSAGE.SET_NAME('WIP', 'WIP_EAM_ITEM_DOES_NOT_EXIST');
496: FND_MSG_PUB.ADD;
497: RAISE FND_API.G_EXC_ERROR;
498: else
499: l_serial_number := p_serial_number;
500: l_inventory_item_id := p_inventory_item_id;
509:
510: exception
511: when others then
512: FND_MESSAGE.SET_NAME('WIP', 'WIP_EAM_ITEM_DOES_NOT_EXIST');
513: FND_MSG_PUB.ADD;
514: RAISE FND_API.G_EXC_ERROR;
515: end;
516: end if;
517:
529:
530: exception
531: when others then
532: FND_MESSAGE.SET_NAME('WIP', 'WIP_EAM_ITEM_DOES_NOT_EXIST');
533: FND_MSG_PUB.ADD;
534: RAISE FND_API.G_EXC_ERROR;
535: end;
536:
537: else
574: NULL,
575: NULL,
576: 'Z') <> 'Y' then
577: FND_MESSAGE.SET_NAME('WIP', 'WIP_EAM_INVALID_SUBINVENTORY');
578: FND_MSG_PUB.ADD;
579: RAISE FND_API.G_EXC_ERROR;
580: end if;
581:
582: select restrict_subinventories_code
599: and secondary_inventory = l_subinventory);
600: exception
601: when others then
602: FND_MESSAGE.SET_NAME('WIP', 'WIP_EAM_INVALID_SUBINVENTORY');
603: FND_MSG_PUB.ADD;
604: RAISE FND_API.G_EXC_ERROR;
605: end;
606:
607: if l_dummy <> 10 then
605: end;
606:
607: if l_dummy <> 10 then
608: FND_MESSAGE.SET_NAME('WIP', 'WIP_EAM_INVALID_SUBINVENTORY');
609: FND_MSG_PUB.ADD;
610: RAISE FND_API.G_EXC_ERROR;
611: end if;
612:
613: end if;
635: -- of transaction is future, the status of the item is changed immediately
636:
637: if p_end_date_active is not null and p_end_date_active > sysdate then
638: FND_MESSAGE.SET_NAME('WIP', 'WIP_EAM_REBUILD_FUTURE_TXN');
639: FND_MSG_PUB.ADD;
640: RAISE FND_API.G_EXC_ERROR;
641: else
642:
643: -- obtain the offset account id from user-defined EAM parameters
646: where organization_id = l_organization_id;
647:
648: if l_dist_acct_id is null then
649: FND_MESSAGE.SET_NAME('WIP', 'WIP_EAM_NO_OFFSET_ACCOUNT');
650: FND_MSG_PUB.ADD;
651: RAISE FND_API.G_EXC_ERROR;
652: end if;
653:
654: --obtain the revision of the object from MSN
705: AND object_id = l_object_id
706: AND end_date_active IS NULL;
707: /* R12 Hook for Asset Log #4141712 To get Parent Object Id End*/
708:
709: FND_MSG_PUB.initialize;
710:
711: inv_genealogy_pub.update_genealogy(
712: p_api_version => l_api_version,
713: p_object_type => 2,
767: ( application => 'EAM'
768: , name => 'EAM_INSTANCE_ID_INVALID'
769: );
770:
771: fnd_msg_pub.add;
772: x_return_status:= fnd_api.g_ret_sts_error;
773: fnd_msg_pub.Count_And_Get
774: ( p_count => x_msg_count,
775: p_data => x_msg_data
769: );
770:
771: fnd_msg_pub.add;
772: x_return_status:= fnd_api.g_ret_sts_error;
773: fnd_msg_pub.Count_And_Get
774: ( p_count => x_msg_count,
775: p_data => x_msg_data
776: );
777: RETURN;
812: ( application => 'EAM'
813: , name => 'EAM_INSTANCE_ID_INVALID'
814: );
815:
816: fnd_msg_pub.add;
817: x_return_status:= fnd_api.g_ret_sts_error;
818: fnd_msg_pub.Count_And_Get
819: ( p_count => x_msg_count,
820: p_data => x_msg_data
814: );
815:
816: fnd_msg_pub.add;
817: x_return_status:= fnd_api.g_ret_sts_error;
818: fnd_msg_pub.Count_And_Get
819: ( p_count => x_msg_count,
820: p_data => x_msg_data
821: );
822: RETURN;
838: ROLLBACK TO eam_rebuild_genealogy;
839:
840: x_return_status := FND_API.G_RET_STS_ERROR;
841:
842: FND_MSG_PUB.Count_And_Get
843: ( p_encoded => FND_API.G_FALSE,
844: p_count => x_msg_count,
845: p_data => x_msg_data
846: );
850: ROLLBACK TO eam_rebuild_genealogy;
851:
852: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
853:
854: FND_MSG_PUB.Count_And_Get
855: ( p_encoded => FND_API.G_FALSE,
856: p_count => x_msg_count,
857: p_data => x_msg_data
858: );