DBA Data[Home] [Help]

PACKAGE BODY: APPS.EAM_RES_INST_DEFAULT_PVT

Source


1 PACKAGE BODY EAM_RES_INST_DEFAULT_PVT AS
2 /* $Header: EAMVRIDB.pls 120.1 2006/07/10 08:32:34 smrsharm noship $ */
3 /***************************************************************************
4 --
5 --  Copyright (c) 2002 Oracle Corporation, Redwood Shores, CA, USA
6 --  All rights reserved.
7 --
8 --  FILENAME
9 --
10 --      EAMVRIDB.pls
11 --
12 --  DESCRIPTION
13 --
14 --      Spec of package EAM_RES_INST_DEFAULT_PVT
15 --
16 --  NOTES
17 --
18 --  HISTORY
19 --
20 --  30-JUN-2002    Kenichi Nagumo     Initial Creation
21 ***************************************************************************/
22 G_PKG_NAME      CONSTANT VARCHAR2(30) := 'EAM_RES_INST_DEFAULT_PVT';
23 
24 
25         /*********************************************************************
26         * Procedure     : Attribute_Defaulting
27         * Parameters IN : Resource Instance exposed record
28         * Parameters OUT NOCOPY: Resource Instance record after defaulting
29         *                 Mesg_Token_Table
30         *                 Return_Status
31         * Purpose       : Attribute Defaulting will default the necessary null
32         *                 attribute with appropriate values.
33         **********************************************************************/
34 
35         PROCEDURE Attribute_Defaulting
36         (  p_eam_res_inst_rec        IN  EAM_PROCESS_WO_PUB.eam_res_inst_rec_type
37          , x_eam_res_inst_rec        OUT NOCOPY EAM_PROCESS_WO_PUB.eam_res_inst_rec_type
38          , x_mesg_token_tbl          OUT NOCOPY EAM_ERROR_MESSAGE_PVT.Mesg_Token_Tbl_Type
39          , x_return_status           OUT NOCOPY VARCHAR2
40          )
41         IS
42         BEGIN
43 
44                 x_eam_res_inst_rec := p_eam_res_inst_rec;
45 --                x_eam_res_inst_rec := p_eam_res_inst_rec;
46                 x_return_status := FND_API.G_RET_STS_SUCCESS;
47 
48                 -- Defaulting start_date
49                 IF (p_eam_res_inst_rec.start_date IS NULL OR
50                     p_eam_res_inst_rec.start_date = FND_API.G_MISS_DATE) AND
51                    p_eam_res_inst_rec.wip_entity_id is not null AND
52                    p_eam_res_inst_rec.organization_id is not null AND
53                    p_eam_res_inst_rec.operation_seq_num is not null AND
54                    p_eam_res_inst_rec.resource_seq_num is not null
55                 THEN
56                    select start_date into x_eam_res_inst_rec.start_date
57                      from wip_operation_resources where
58                      wip_entity_id = p_eam_res_inst_rec.wip_entity_id
59                      and organization_id = p_eam_res_inst_rec.organization_id
60                      and operation_seq_num = p_eam_res_inst_rec.operation_seq_num
61                      and resource_seq_num = p_eam_res_inst_rec.resource_seq_num;
62                 END IF;
63 
64                 -- Defaulting completion_date
65                 IF (p_eam_res_inst_rec.completion_date IS NULL OR
66                     p_eam_res_inst_rec.completion_date = FND_API.G_MISS_DATE) AND
67                    p_eam_res_inst_rec.wip_entity_id is not null AND
68                    p_eam_res_inst_rec.organization_id is not null AND
69                    p_eam_res_inst_rec.operation_seq_num is not null AND
70                    p_eam_res_inst_rec.resource_seq_num is not null
71                 THEN
72                    select completion_date into x_eam_res_inst_rec.completion_date
73                      from wip_operation_resources where
74                      wip_entity_id = p_eam_res_inst_rec.wip_entity_id
75                      and organization_id = p_eam_res_inst_rec.organization_id
76                      and operation_seq_num = p_eam_res_inst_rec.operation_seq_num
77                      and resource_seq_num = p_eam_res_inst_rec.resource_seq_num;
78                 END IF;
79 
80              EXCEPTION
81                 WHEN OTHERS THEN
82                      EAM_ERROR_MESSAGE_PVT.Add_Error_Token
83                      (  p_message_name       => NULL
84                       , p_message_text       => G_PKG_NAME || SQLERRM
85                       , x_mesg_token_Tbl     => x_mesg_token_tbl
86                      );
87 
88                     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
89 
90         END Attribute_Defaulting;
91 
92 
93         /******************************************************************
94         * Procedure     : Populate_Null_Columns
95         * Parameters IN : Resource Instance column record
96         *                 Old Resource Instance Column Record
97         * Parameters OUT NOCOPY: Resource Instance column record after populating
98         * Purpose       : This procedure will look at the columns that the user
99         *                 has not filled in and will assign those columns a
100         *                 value from the old record.
101         *                 This procedure is not called for CREATE
102         ********************************************************************/
103         PROCEDURE Populate_Null_Columns
104         (  p_eam_res_inst_rec        IN  EAM_PROCESS_WO_PUB.eam_res_inst_rec_type
105          , p_old_eam_res_inst_rec    IN  EAM_PROCESS_WO_PUB.eam_res_inst_rec_type
106          , x_eam_res_inst_rec        OUT NOCOPY EAM_PROCESS_WO_PUB.eam_res_inst_rec_type
107         )
108         IS
109         BEGIN
110                 x_eam_res_inst_rec := p_eam_res_inst_rec;
111                 x_eam_res_inst_rec := p_eam_res_inst_rec;
112 
113 IF EAM_PROCESS_WO_PVT.Get_Debug = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Processing null columns prior update'); END IF;
114 
115                 IF p_eam_res_inst_rec.serial_number IS NULL OR
116                    p_eam_res_inst_rec.serial_number = FND_API.G_MISS_CHAR
117                 THEN
118                     x_eam_res_inst_rec.serial_number := p_old_eam_res_inst_rec.serial_number;
119                 END IF;
120 
121                 IF p_eam_res_inst_rec.start_date IS NULL OR
122                    p_eam_res_inst_rec.start_date = FND_API.G_MISS_DATE
123                 THEN
124                     x_eam_res_inst_rec.start_date := p_old_eam_res_inst_rec.start_date;
125                 END IF;
126 
127                 IF p_eam_res_inst_rec.completion_date IS NULL OR
128                    p_eam_res_inst_rec.completion_date = FND_API.G_MISS_DATE
129                 THEN
130                     x_eam_res_inst_rec.completion_date := p_old_eam_res_inst_rec.completion_date;
131                 END IF;
132 
133                 IF p_eam_res_inst_rec.top_level_batch_id IS NULL OR
134                    p_eam_res_inst_rec.top_level_batch_id = FND_API.G_MISS_NUM
135                 THEN
136                     x_eam_res_inst_rec.top_level_batch_id := p_old_eam_res_inst_rec.top_level_batch_id;
137                 END IF;
138 
139 
140 
141 IF EAM_PROCESS_WO_PVT.Get_Debug = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Done processing null columns prior update'); END IF;
142 
143         END Populate_Null_Columns;
144 
145 END EAM_RES_INST_DEFAULT_PVT;