DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGW_BUDGET_PERIODS_PUB

Source


1 PACKAGE BODY Igw_Budget_Periods_Pub AS
2 --$Header: igwpbprb.pls 115.0 2002/12/19 22:43:43 ashkumar noship $
3 
4    ---------------------------------------------------------------------------
5 
6    G_PKG_NAME  VARCHAR2(30) := 'IGW_BUDGET_PERIODS_PUB';
7 
8    ---------------------------------------------------------------------------
9 
10    PROCEDURE Create_Budget_Period
11    (
12       p_validate_only         IN VARCHAR2,
13       p_commit                IN VARCHAR2,
14       p_proposal_number       IN VARCHAR2,
15       p_version_id            IN NUMBER,
16       p_budget_period_id      IN NUMBER,
17       p_start_date            IN DATE,
18       p_end_date              IN DATE,
19       p_total_cost_limit      IN NUMBER,
20       p_total_cost            IN NUMBER,
21       p_total_direct_cost     IN NUMBER,
22       p_total_indirect_cost   IN NUMBER,
23       p_cost_sharing_amount   IN NUMBER,
24       p_underrecovery_amount  IN NUMBER,
25       p_program_income        IN VARCHAR2,
26       p_program_income_source IN VARCHAR2,
27       x_return_status         OUT NOCOPY VARCHAR2,
28       x_msg_count             OUT NOCOPY NUMBER,
29       x_msg_data              OUT NOCOPY VARCHAR2
30    ) IS
31 
32       l_api_name  CONSTANT  VARCHAR2(30) := 'Create_Budget_Period';
33       l_rowid               VARCHAR2(60);
34       l_proposal_id         IGW_PROPOSALS_ALL.PROPOSAL_ID%TYPE;
35 
36    BEGIN
37 
38       /*
39       **   Establish Savepoint for Rollback
40       */
41 
42       SAVEPOINT Create_Budget_Period_Pub;
43 
44       /*
45       **   Initialize Processing
46       */
47 
48       x_return_status := Fnd_Api.G_Ret_Sts_Success;
49 
50       Fnd_Msg_Pub.Initialize;
51 
52       /*
53       **   Verify Mandatory Inputs. Value-Id Conversions.
54       */
55 
56       IF p_proposal_number IS NULL THEN
57 
58          Fnd_Message.Set_Name('IGW','IGW_UPLD_MISSING_PARAMETER');
59          Fnd_Message.Set_Token('PARAM_NAME','P_PROPOSAL_NUMBER');
60          Fnd_Msg_Pub.Add;
61 
62       ELSE
63 
64          Igw_Utils.Get_Proposal_Id
65          (
66             p_context_field    => 'PROPOSAL_ID',
67             p_check_id_flag    => 'N',
68             p_proposal_number  => p_proposal_number,
69             p_proposal_id      => l_proposal_id,
70             x_proposal_id      => l_proposal_id,
71             x_return_status    => x_return_status
72          );
73 
74       END IF;
75 
76       IF p_version_id IS NULL THEN
77 
78          Fnd_Message.Set_Name('IGW','IGW_UPLD_MISSING_PARAMETER');
79          Fnd_Message.Set_Token('PARAM_NAME','P_VERSION_ID');
80          Fnd_Msg_Pub.Add;
81 
82       END IF;
83 
84       IF p_budget_period_id IS NULL THEN
85 
86          Fnd_Message.Set_Name('IGW','IGW_UPLD_MISSING_PARAMETER');
87          Fnd_Message.Set_Token('PARAM_NAME','P_BUDGET_PERIOD_ID');
88          Fnd_Msg_Pub.Add;
89 
90       END IF;
91 
92       IF p_start_date IS NULL THEN
93 
94          Fnd_Message.Set_Name('IGW','IGW_UPLD_MISSING_PARAMETER');
95          Fnd_Message.Set_Token('PARAM_NAME','P_START_DATE');
96          Fnd_Msg_Pub.Add;
97 
98       END IF;
99 
100       IF p_end_date IS NULL THEN
101 
102          Fnd_Message.Set_Name('IGW','IGW_UPLD_MISSING_PARAMETER');
103          Fnd_Message.Set_Token('PARAM_NAME','P_END_DATE');
104          Fnd_Msg_Pub.Add;
105 
106       END IF;
107 
108 
109       /*
110       **   Discontinue processing if any error has been encountered during
111       **   the earlier stages
112       */
113 
114       IF Fnd_Msg_Pub.Count_Msg > 0 THEN
115 
116          RAISE Fnd_Api.G_Exc_Error;
117 
118       END IF;
119 
120       Igw_Budget_Periods_Pvt.Create_Budget_Period
121       (
122          p_init_msg_list         => Fnd_Api.G_True,
123          p_commit                => Fnd_Api.G_False,
124          p_validate_only         => p_validate_only,
125          p_proposal_id           => l_proposal_id,
126          p_version_id            => p_version_id,
127          p_budget_period_id      => p_budget_period_id,
128          p_start_date            => p_start_date,
129          p_end_date              => p_end_date,
130          p_total_cost            => p_total_cost,
131          p_total_direct_cost     => p_total_direct_cost,
132          p_total_indirect_cost   => p_total_indirect_cost,
133          p_cost_sharing_amount   => p_cost_sharing_amount,
134          p_underrecovery_amount  => p_underrecovery_amount,
135          p_total_cost_limit      => p_total_cost_limit,
136          p_program_income        => p_program_income,
137          p_program_income_source => p_program_income_source,
138          x_rowid                 => l_rowid,
139          x_return_status         => x_return_status,
140          x_msg_count             => x_msg_count,
141          x_msg_data              => x_msg_data
142       );
143 
144       IF Fnd_Msg_Pub.Count_Msg > 0 THEN
145 
146          RAISE Fnd_Api.G_Exc_Error;
147 
148       END IF;
149 
150       /*
151       **   Commit data if API invoked in commit mode
152       */
153 
154       IF Fnd_Api.To_Boolean(p_commit) THEN
155 
156          COMMIT;
157 
158       END IF;
159 
160    EXCEPTION
161 
162       WHEN Fnd_Api.G_Exc_Error THEN
163 
164          ROLLBACK TO Create_Budget_Period_Pub;
165 
166          x_return_status := Fnd_Api.G_Ret_Sts_Error;
167 
168          Fnd_Msg_Pub.Count_And_Get
169          (
170             p_encoded => Fnd_Api.G_False,
171             p_count   => x_msg_count,
172             p_data    => x_msg_data
173          );
174 
175       WHEN others THEN
176 
177          ROLLBACK TO Create_Budget_Period_Pub;
178 
179          x_return_status := Fnd_Api.G_Ret_Sts_Unexp_Error;
180 
181          Fnd_Msg_Pub.Add_Exc_Msg
182          (
183             p_pkg_name       => G_PKG_NAME,
184             p_procedure_name => l_api_name
185          );
186 
187          Fnd_Msg_Pub.Count_And_Get
188          (
189             p_encoded => Fnd_Api.G_False,
190             p_count   => x_msg_count,
191             p_data    => x_msg_data
192          );
193 
194    END Create_Budget_Period;
195 
196    ---------------------------------------------------------------------------
197 
198 END Igw_Budget_Periods_Pub;