[Home] [Help]
PACKAGE BODY: APPS.PV_EXT_ENTY_ATTR_VALUE_PVT
Source
1 PACKAGE BODY PV_Ext_Enty_Attr_Value_PVT AS
2 /* $Header: pvxveaxb.pls 115.3 2003/01/08 20:17:15 amaram ship $ */
3 -- ===============================================================
4 -- Start of Comments
5 -- Package name
6 -- PV_Ext_Enty_Attr_Value_PVT
7 -- Purpose
8 --
9 -- History
10 --
11 -- NOTE
12 --
13 -- End of Comments
14 -- ===============================================================
15
16
17 G_PKG_NAME CONSTANT VARCHAR2(30) := 'PV_Ext_Enty_Attr_Value_PVT';
18 G_FILE_NAME CONSTANT VARCHAR2(12) := 'pvxveaxb.pls';
19
20 G_USER_ID NUMBER := NVL(FND_GLOBAL.USER_ID,-1);
21 G_LOGIN_ID NUMBER := NVL(FND_GLOBAL.CONC_LOGIN_ID,-1);
22
23
24
25 -- Hint: Primary key needs to be returned.
26 PROCEDURE Update_Customer_Anual_Revenue(
27 p_api_version_number IN NUMBER
28 ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
29 ,p_commit IN VARCHAR2 := FND_API.G_FALSE
30 ,p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL
31
32 ,x_return_status OUT NOCOPY VARCHAR2
33 ,x_msg_count OUT NOCOPY NUMBER
34 ,x_msg_data OUT NOCOPY VARCHAR2
35
36 ,p_entity IN VARCHAR2
37 ,p_entity_id IN NUMBER
38 ,p_attr_value IN VARCHAR2
39 )
40
41
42 IS
43 l_api_name CONSTANT VARCHAR2(30) := 'Update_Customer_Anual_Revenue';
44 l_full_name CONSTANT VARCHAR2(60) := g_pkg_name ||'.'|| l_api_name;
45 l_api_version_number CONSTANT NUMBER := 1.0;
46 l_return_status_full VARCHAR2(1);
47 l_object_version_number NUMBER := 1;
48 l_partner_update_text VARCHAR2(2000) :=
49 ' update hz_organization_profiles org set org.curr_fy_potential_revenue= :attr_value where ' ||
50 ' org.party_id = :party_id'
51 ;
52
53
54 l_oppty_update_text VARCHAR2(2000) := '';
55 l_lead_update_text VARCHAR2(2000) := '';
56 l_value NUMBER;
57 l_party_id NUMBER;
58
59 x_profile_id NUMBER;
60 l_org_rec HZ_PARTY_V2PUB.organization_rec_type;
61 CURSOR c_get_party_ids (pc_entity_id IN NUMBER) IS
62 select orgp.party_id from hz_organization_profiles orgp, hz_relationships hz,
63 hz_organization_profiles orgp2 where hz.party_id = pc_entity_id and
64 hz.subject_id = orgp.party_id and hz.object_id = orgp2.party_id and orgp2.internal_flag = 'Y'
65 and orgp2.effective_end_date is null and nvl(orgp.effective_end_date, sysdate+1) > sysdate
66 ;
67
68 CURSOR c_get_obj_ver_num (pc_party_id IN NUMBER) IS
69 select object_version_number from hz_parties where party_id = pc_party_id
70 ;
71
72
73 BEGIN
74 -- Standard Start of API savepoint
75 SAVEPOINT Update_Customer_Anual_Revenue;
76
77 -- Standard call to check for call compatibility.
78 IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
79 p_api_version_number,
80 l_api_name,
81 G_PKG_NAME)
82 THEN
83 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
84 END IF;
85
86 -- Initialize message list if p_init_msg_list is set to TRUE.
87 IF FND_API.to_Boolean( p_init_msg_list )
88 THEN
89 FND_MSG_PUB.initialize;
90 END IF;
91
92 -- Debug Message
93 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
94 PVX_Utility_PVT.debug_message('Private API: '||l_full_name||' - start');
95 END IF;
96
97 -- Initialize API return status to SUCCESS
98 x_return_status := FND_API.G_RET_STS_SUCCESS;
99
100
101
102
103 IF(p_entity = 'PARTNER') THEN
104
105 for x in c_get_party_ids(pc_entity_id => p_entity_id )
106 loop
107 l_party_id := x.party_id;
108
109
110
111 l_org_rec.curr_fy_potential_revenue := TO_NUMBER(PV_CHECK_MATCH_PUB.Retrieve_Token(':::',p_attr_value,'IN TOKEN',1));
112
113 if (l_org_rec.curr_fy_potential_revenue is null) then
114 l_org_rec.curr_fy_potential_revenue := fnd_api.g_miss_num;
115 end if;
116
117 --l_org_rec.curr_fy_potential_revenue := TO_NUMBER(p_attr_value);
118 l_org_rec.pref_functional_currency :=PV_CHECK_MATCH_PUB.Retrieve_Token(':::',p_attr_value,'IN TOKEN',2);
119 l_org_rec.party_rec.party_id :=l_party_id;
120
121 if (l_org_rec.pref_functional_currency is null) then
122 l_org_rec.pref_functional_currency := fnd_api.g_miss_char;
123 end if;
124
125
126 for x in c_get_obj_ver_num (pc_party_id =>l_party_id)
127 loop
128 l_object_version_number := x.object_version_number;
129
130 end loop;
131
132 HZ_PARTY_V2PUB.update_organization (
133 p_init_msg_list => FND_API.G_FALSE
134 ,p_organization_rec => l_org_rec
135 ,p_party_object_version_number => l_object_version_number
136 ,x_profile_id => x_profile_id
137 ,x_return_status => x_return_status
138 ,x_msg_count => x_msg_count
139 ,x_msg_data => x_msg_data
140 );
141
142
143
144 IF x_return_status<>FND_API.G_RET_STS_SUCCESS THEN
145 RAISE FND_API.G_EXC_ERROR;
146 END IF;
147 end loop;
148 END IF; -- en of IF(p_entity = 'PARTNER') THEN
149
150
151
152 --
153 -- End of API body
154 --
155
156 -- Standard check for p_commit
157 IF FND_API.to_Boolean( p_commit )
158 THEN
159 COMMIT WORK;
160 END IF;
161
162
163 -- Debug Message
164 IF (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)) THEN
165 PVX_Utility_PVT.debug_message('Private API: '||l_full_name||' - end');
166 END IF;
167
168 -- Standard call to get message count and if count is 1, get message info.
169 FND_MSG_PUB.Count_And_Get (
170 p_count => x_msg_count
171 ,p_data => x_msg_data
172 );
173
174 EXCEPTION
175 /*
176 WHEN PVX_Utility_PVT.resource_locked THEN
177 x_return_status := FND_API.g_ret_sts_error;
178 PVX_Utility_PVT.Error_Message(p_message_name => 'PV_API_RESOURCE_LOCKED');
179 */
180 WHEN FND_API.G_EXC_ERROR THEN
181 ROLLBACK TO Update_Customer_Anual_Revenue;
182 x_return_status := FND_API.G_RET_STS_ERROR;
183 -- Standard call to get message count and if count=1, get the message
184 FND_MSG_PUB.Count_And_Get (
185 p_encoded => FND_API.G_FALSE
186 ,p_count => x_msg_count
187 ,p_data => x_msg_data
188 );
189
190 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
191 ROLLBACK TO Update_Customer_Anual_Revenue;
192 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
193 -- Standard call to get message count and if count=1, get the message
194 FND_MSG_PUB.Count_And_Get (
195 p_encoded => FND_API.G_FALSE
196 ,p_count => x_msg_count
197 ,p_data => x_msg_data
198 );
199
200 WHEN OTHERS THEN
201 ROLLBACK TO Update_Customer_Anual_Revenue;
202 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
203 IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
204 THEN
205 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
206 END IF;
207 -- Standard call to get message count and if count=1, get the message
208 FND_MSG_PUB.Count_And_Get (
209 p_encoded => FND_API.G_FALSE
210 ,p_count => x_msg_count
211 ,p_data => x_msg_data
212 );
213 End Update_Customer_Anual_Revenue;
214
215
216
217
218 END PV_Ext_Enty_Attr_Value_PVT;