DBA Data[Home] [Help]

PACKAGE BODY: APPS.OZF_ASSIGNMENT_QUALIFIER_PUB

Source


1 PACKAGE BODY OZF_ASSIGNMENT_QUALIFIER_PUB as
2 /* $Header: ozfpasqb.pls 115.0 2003/06/26 05:05:53 mchang noship $ */
3 -- Start of Comments
4 -- Package name     : OZF_ASSIGNMENT_QUALIFIER_PUB
5 -- Purpose          :
6 -- History          :
7 -- NOTE             :
8 -- End of Comments
9 
10 G_PKG_NAME             CONSTANT  VARCHAR2(30) := 'OZF_ASSIGNMENT_QUALIFIER_PUB';
11 G_FILE_NAME            CONSTANT VARCHAR2(15) := 'ozfpasqb.pls';
12 
13 OZF_DEBUG_LOW_ON BOOLEAN := FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_debug_low);
14 
15 ---------------------------------------------------------------------
16 -- PROCEDURE
17 --    get_claim_type
18 --
19 -- PURPOSE
20 --    This procedure gets the claim type id
21 --
22 -- PARAMETERS
23 --    p_rec   IN DEDUCTION_REC_TYPE,
24 --    x_claim_type_id  OUT number
25 --    x_return_status  OUT VARCHAR2
26 --
27 -- NOTES
28 ---------------------------------------------------------------------
29 PROCEDURE get_claim_type(p_rec            IN DEDUCTION_REC_TYPE,
30                          x_claim_type_id  OUT NOCOPY number,
31 			 x_return_status  OUT NOCOPY VARCHAR2)
32 IS
33 BEGIN
34 
35    -- Initialize API return status to sucess
36    x_return_status := FND_API.G_RET_STS_SUCCESS;
37 
38    x_claim_type_id := p_rec.claim_type_id;
39 EXCEPTION
40    WHEN FND_API.G_EXC_ERROR THEN
41      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
42    WHEN OTHERS THEN
43      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
44 END get_claim_type;
45 
46 ---------------------------------------------------------------------
47 -- PROCEDURE
48 --    get_reason
49 --
50 -- PURPOSE
51 --    This procedure gets the reason
52 --
53 -- PARAMETERS
54 --    p_rec   IN DEDUCTION_REC_TYPE,
55 --    x_reason_code_id  OUT number
56 --    x_return_status  OUT VARCHAR2
57 --
58 -- NOTES
59 ---------------------------------------------------------------------
60 PROCEDURE get_reason(p_rec            IN DEDUCTION_REC_TYPE,
61                      x_reason_code_id OUT NOCOPY number,
62 		     x_return_status  OUT NOCOPY VARCHAR2)
63 IS
64 BEGIN
65 
66    -- Initialize API return status to sucess
67    x_return_status := FND_API.G_RET_STS_SUCCESS;
68 
69    x_reason_code_id := p_rec.reason_code_id;
70 EXCEPTION
71    WHEN FND_API.G_EXC_ERROR THEN
72      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
73    WHEN OTHERS THEN
74      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
75 END get_reason;
76 
77 
78 ---------------------------------------------------------------------
79 -- PROCEDURE
80 --    get_cust_ref_number
81 --
82 -- PURPOSE
83 --    This procedure gets the customer_ref_number
84 --
85 -- PARAMETERS
86 --    p_rec                  IN DEDUCTION_REC_TYPE,
87 --    x_cust_ref_number      OUT VARCHAR2
88 --    x_return_status        OUT VARCHAR2
89 --
90 -- NOTES
91 ---------------------------------------------------------------------
92 PROCEDURE get_cust_ref_number(p_rec             IN DEDUCTION_REC_TYPE,
93                               x_cust_ref_number OUT NOCOPY VARCHAR2,
94 		              x_return_status   OUT NOCOPY VARCHAR2)
95 IS
96 BEGIN
97 
98    -- Initialize API return status to sucess
99    x_return_status := FND_API.G_RET_STS_SUCCESS;
100 
101    x_cust_ref_number := p_rec.customer_ref_number;
102 EXCEPTION
103    WHEN FND_API.G_EXC_ERROR THEN
104      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
105    WHEN OTHERS THEN
106      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
107 END get_cust_ref_number;
108 
109 ---------------------------------------------------------------------
110 -- PROCEDURE
111 --    get_cust_ref_date
112 --
113 -- PURPOSE
114 --    This procedure gets the customer_ref_date
115 --
116 -- PARAMETERS
117 --    p_rec                  IN  DEDUCTION_REC_TYPE,
118 --    x_cust_ref_date        OUT DATE
119 --    x_return_status        OUT VARCHAR2
120 --
121 -- NOTES
122 ---------------------------------------------------------------------
123 PROCEDURE get_cust_ref_date(p_rec             IN DEDUCTION_REC_TYPE,
124                             x_cust_ref_date   OUT NOCOPY DATE,
125 		            x_return_status   OUT NOCOPY VARCHAR2)
126 IS
127 BEGIN
128 
129    -- Initialize API return status to sucess
130    x_return_status := FND_API.G_RET_STS_SUCCESS;
131 
132    x_cust_ref_date := p_rec.customer_ref_date;
133 EXCEPTION
134    WHEN FND_API.G_EXC_ERROR THEN
135      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
136    WHEN OTHERS THEN
137      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
138 END get_cust_ref_date;
139 
140 ---------------------------------------------------------------------
141 --   PROCEDURE:  Get_Deduction_Value
142 --
143 --   PURPOSE:
144 --   This procedure modifies the values of a deduction record.
145 --
146 --   PARAMETERS:
147 --   IN
148 --       p_api_version_number      IN   NUMBER     Required
149 --       p_init_msg_list           IN   VARCHAR2   Optional  Default = FND_API_G_FALSE
150 --       p_validation_level        IN   NUMBER     Optional  Default = FND_API.G_VALID_LEVEL_FULL
151 --       p_commit                  IN   VARCHAR2   Optional  Default = FND_API.G_FALSE
152 --       P_deduction               IN   DEDUCTION_REC_TYPE  Required
153 --
154 --   OUT:
155 --       x_return_status           OUT  VARCHAR2
156 --       x_msg_count               OUT  NUMBER
157 --       x_msg_data                OUT  VARCHAR2
158 --       X_qualifier              OUT  DEDUCTION_REC_TYPE
159 --   NOTES:
160 --
161 ---------------------------------------------------------------------
162 PROCEDURE Get_Deduction_Value(
163     P_Api_Version_Number         IN   NUMBER,
164     P_Init_Msg_List              IN   VARCHAR2     := FND_API.G_FALSE,
165     p_validation_level           IN   NUMBER       := FND_API.G_VALID_LEVEL_FULL,
166     P_Commit                     IN   VARCHAR2     := FND_API.G_FALSE,
167 
168     X_Return_Status              OUT NOCOPY  VARCHAR2,
169     X_Msg_Count                  OUT NOCOPY  NUMBER,
170     X_Msg_Data                   OUT NOCOPY  VARCHAR2,
171 
172     P_deduction                  IN   DEDUCTION_REC_TYPE,
173     X_qualifier                  OUT NOCOPY  Qualifier_Rec_Type
174     )
175 IS
176 l_api_name                CONSTANT VARCHAR2(30) := 'Get_Deduction_Value';
177 l_api_version_number      CONSTANT NUMBER   := 1.0;
178 l_full_name               CONSTANT VARCHAR2(60) := G_PKG_NAME ||'.'|| l_api_name;
179 --
180 l_return_status varchar2(30);
181 l_qualifier     OZF_ASSIGNMENT_QUALIFIER_PUB.Qualifier_Rec_Type;
182 BEGIN
183    -- Standard Start of API savepoint
184    SAVEPOINT GET_DED_VAL_PUB;
185    -- Standard call to check for call compatibility.
186    IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
187                                         p_api_version_number,
188                                         l_api_name,
189                                         G_PKG_NAME)
190    THEN
191       RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
192    END IF;
193 
194    -- Initialize message list if p_init_msg_list is set to TRUE.
195    IF FND_API.to_Boolean( p_init_msg_list ) THEN
196       FND_MSG_PUB.initialize;
197    END IF;
198 
199    -- Debug Message
200    IF OZF_DEBUG_LOW_ON THEN
201       FND_MESSAGE.Set_Name('OZF','OZF_API_DEBUG_MESSAGE');
202       FND_MESSAGE.Set_Token('TEXT',l_full_name||': Start');
203       FND_MSG_PUB.Add;
204    END IF;
205 
206    -- Initialize API return status to SUCCESS
207    x_return_status := FND_API.G_RET_STS_SUCCESS;
208 
209   get_claim_type(p_rec           => p_deduction,
210                  x_claim_type_id => l_qualifier.claim_type_id,
211 	         x_return_status => l_return_status);
212   IF l_return_status = FND_API.G_RET_STS_ERROR THEN
213      RAISE FND_API.G_EXC_ERROR;
214   ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
215      RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
216   END IF;
217 
218   get_reason(p_rec           => p_deduction,
219              x_reason_code_id=> l_qualifier.reason_code_id,
220 	     x_return_status => l_return_status);
221   IF l_return_status = FND_API.G_RET_STS_ERROR THEN
222      RAISE FND_API.G_EXC_ERROR;
223   ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
224      RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
225   END IF;
226 
227   get_cust_ref_number(p_rec             => p_deduction,
228                       x_cust_ref_number => l_qualifier.customer_ref_number,
229 	              x_return_status   => l_return_status);
230   IF l_return_status = FND_API.G_RET_STS_ERROR THEN
231      RAISE FND_API.G_EXC_ERROR;
232   ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
233      RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
234   END IF;
235 
236   get_cust_ref_date(p_rec           => p_deduction,
237                     x_cust_ref_date => l_qualifier.customer_ref_date,
238 	            x_return_status => l_return_status);
239   IF l_return_status = FND_API.G_RET_STS_ERROR THEN
240      RAISE FND_API.G_EXC_ERROR;
241   ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
242      RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
243   END IF;
244 
245   -- assign the rest of the values
246 
247   l_qualifier.CLAIM_DATE := p_deduction.CLAIM_DATE;
248   l_qualifier.DUE_DATE   := p_deduction.DUE_DATE;
249   l_qualifier.OWNER_ID   := p_deduction.OWNER_ID;
250   l_qualifier.CUST_BILLTO_ACCT_SITE_ID := p_deduction.CUST_BILLTO_ACCT_SITE_ID;
251   l_qualifier.CUST_SHIPTO_ACCT_SITE_ID:= p_deduction.CUST_SHIPTO_ACCT_SITE_ID;
252   l_qualifier.SALES_REP_ID:= p_deduction.SALES_REP_ID;
253   l_qualifier.CONTACT_ID := p_deduction.CONTACT_ID;
254   l_qualifier.BROKER_ID  := p_deduction.BROKER_ID;
255   l_qualifier.GL_DATE    := p_deduction.GL_DATE;
256   l_qualifier.COMMENTS   := p_deduction.COMMENTS;
257 
258   x_qualifier := l_qualifier;
259 
260   -- Standard check for p_commit
261   IF FND_API.to_Boolean( p_commit )
262   THEN
263      COMMIT WORK;
264   END IF;
265 
266   -- Debug Message
267   IF OZF_DEBUG_LOW_ON THEN
268      FND_MESSAGE.Set_Name('OZF','OZF_API_DEBUG_MESSAGE');
269      FND_MESSAGE.Set_Token('TEXT',l_full_name||': End');
270      FND_MSG_PUB.Add;
271   END IF;
272 
273   -- Standard call to get message count and if count is 1, get message info.
274   FND_MSG_PUB.Count_And_Get(
275      p_count          =>   x_msg_count,
276      p_data           =>   x_msg_data
277   );
278 
279 EXCEPTION
280    WHEN FND_API.G_EXC_ERROR THEN
281       ROLLBACK TO GET_DED_VAL_PUB;
282       x_return_status := FND_API.G_RET_STS_ERROR;
283       -- Standard call to get message count and if count=1, get the message
284       FND_MSG_PUB.Count_And_Get (
285          p_encoded => FND_API.G_FALSE,
286          p_count => x_msg_count,
287          p_data  => x_msg_data
288       );
289    WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
290       ROLLBACK TO GET_DED_VAL_PUB;
291       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
292       -- Standard call to get message count and if count=1, get the message
293       FND_MSG_PUB.Count_And_Get (
294          p_encoded => FND_API.G_FALSE,
295          p_count => x_msg_count,
296          p_data  => x_msg_data
297       );
298    WHEN OTHERS THEN
299       ROLLBACK TO GET_DED_VAL_PUBP;
300       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
301       IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
302          FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_ASS_QUA_ERR');
303          FND_MSG_PUB.add;
304       END IF;
305 
306       -- Standard call to get message count and if count=1, get the message
307       FND_MSG_PUB.Count_And_Get (
308          p_encoded => FND_API.G_FALSE,
309          p_count => x_msg_count,
310          p_data  => x_msg_data
311       );
312 End get_deduction_value;
313 
314 End OZF_ASSIGNMENT_QUALIFIER_PUB;