3:
4:
5:
6: Procedure start_approval_process (
7: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
8: p_commit IN VARCHAR2 := FND_API.G_FALSE,
9: p_validate_only IN VARCHAR2 := FND_API.G_FALSE,
10: p_proposal_id IN NUMBER,
11: x_return_status OUT NOCOPY VARCHAR2,
4:
5:
6: Procedure start_approval_process (
7: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
8: p_commit IN VARCHAR2 := FND_API.G_FALSE,
9: p_validate_only IN VARCHAR2 := FND_API.G_FALSE,
10: p_proposal_id IN NUMBER,
11: x_return_status OUT NOCOPY VARCHAR2,
12: x_msg_count OUT NOCOPY NUMBER,
5:
6: Procedure start_approval_process (
7: p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
8: p_commit IN VARCHAR2 := FND_API.G_FALSE,
9: p_validate_only IN VARCHAR2 := FND_API.G_FALSE,
10: p_proposal_id IN NUMBER,
11: x_return_status OUT NOCOPY VARCHAR2,
12: x_msg_count OUT NOCOPY NUMBER,
13: x_msg_data OUT NOCOPY VARCHAR2) is
24: l_message_name VARCHAR2(200);
25:
26: BEGIN
27: -- create savepoint if p_commit is true
28: IF p_commit = FND_API.G_TRUE THEN
29: SAVEPOINT start_approval;
30: END IF;
31:
32: -- initialize message list if p_init_msg_list is true
29: SAVEPOINT start_approval;
30: END IF;
31:
32: -- initialize message list if p_init_msg_list is true
33: if FND_API.to_boolean(nvl(p_init_msg_list, FND_API.G_FALSE)) then
34: fnd_msg_pub.initialize;
35: end if;
36:
37: -- initialize return_status to success
34: fnd_msg_pub.initialize;
35: end if;
36:
37: -- initialize return_status to success
38: x_return_status := fnd_api.g_ret_sts_success;
39:
40: /*
41: -- first validate user rights
42:
50: ------------------------------------- value_id conversion ---------------------------------
51:
52: -------------------------------------------- validations -----------------------------------------------------
53: -- dbms_output.put_line('before call to start approval');
54: if (NOT FND_API.TO_BOOLEAN (p_validate_only)) then
55: start_approval (
56: p_proposal_id => p_proposal_id
57: ,p_error_message => l_msg_data
58: ,p_return_status => l_return_status);
71: -- dbms_output.put_line(l_message_name);
72:
73: fnd_message.set_name(l_short_name, l_message_name);
74: fnd_msg_pub.add;
75: raise fnd_api.g_exc_error;
76: elsif (l_return_status = 'U') then
77: fnd_msg_pub.initialize;
78: fnd_message.parse_encoded(encoded_message => l_msg_data,
79: app_short_name => l_short_name,
82: -- dbms_output.put_line(l_message_name);
83:
84: fnd_message.set_name('l_short_name', l_message_name);
85: fnd_msg_pub.add;
86: raise fnd_api.g_exc_unexpected_error;
87: elsif (l_return_status = 'S') then
88: update igw_proposals_all set proposal_status = 'I' where proposal_id = p_proposal_id;
89: end if;
90:
89: end if;
90:
91:
92: -- standard check of p_commit
93: if fnd_api.to_boolean(p_commit) then
94: commit work;
95: end if;
96:
97: -- set x_msg_count and x_msg_data
101:
102:
103:
104: EXCEPTION
105: WHEN FND_API.G_EXC_ERROR THEN
106: IF p_commit = FND_API.G_TRUE THEN
107: ROLLBACK TO start_approval;
108: END IF;
109:
102:
103:
104: EXCEPTION
105: WHEN FND_API.G_EXC_ERROR THEN
106: IF p_commit = FND_API.G_TRUE THEN
107: ROLLBACK TO start_approval;
108: END IF;
109:
110: x_return_status := FND_API.G_RET_STS_ERROR;
106: IF p_commit = FND_API.G_TRUE THEN
107: ROLLBACK TO start_approval;
108: END IF;
109:
110: x_return_status := FND_API.G_RET_STS_ERROR;
111:
112: x_msg_count := 1;
113: x_msg_data := l_message_name;
114:
116:
117:
118:
119: WHEN OTHERS THEN
120: IF p_commit = FND_API.G_TRUE THEN
121: ROLLBACK TO start_approval;
122: END IF;
123:
124: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
120: IF p_commit = FND_API.G_TRUE THEN
121: ROLLBACK TO start_approval;
122: END IF;
123:
124: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
125:
126: x_msg_count := 1;
127: x_msg_data := l_message_name;
128:
146: x VARCHAR2(1);
147: y VARCHAR2(1);
148:
149: BEGIN
150: x_return_status:= FND_API.G_RET_STS_SUCCESS;
151:
152: select x into y
153: from igw_prop_user_roles ppr,
154: igw_prop_users ppu
162:
163: EXCEPTION
164:
165: WHEN NO_DATA_FOUND THEN
166: x_return_status:= FND_API.G_RET_STS_ERROR;
167: fnd_message.set_name('IGW', 'IGW_NO_RIGHTS');
168: fnd_msg_pub.add;
169:
170: WHEN too_many_rows THEN
170: WHEN too_many_rows THEN
171: NULL;
172:
173: WHEN OTHERS THEN
174: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
175: fnd_msg_pub.add_exc_msg(p_pkg_name => 'IGW_PROP_APPROVALS_PVT',
176: p_procedure_name => 'VALIDATE_LOGGED_USER_RIGHTS',
177: p_error_text => SUBSTRB(SQLERRM,1,240));
178: raise fnd_api.g_exc_unexpected_error;
174: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
175: fnd_msg_pub.add_exc_msg(p_pkg_name => 'IGW_PROP_APPROVALS_PVT',
176: p_procedure_name => 'VALIDATE_LOGGED_USER_RIGHTS',
177: p_error_text => SUBSTRB(SQLERRM,1,240));
178: raise fnd_api.g_exc_unexpected_error;
179: END VALIDATE_LOGGED_USER_RIGHTS;
180:
181: --------------------------------------------------------------------------------------------------------------
182: procedure start_approval(p_proposal_id in number,
351: -- dbms_output.put_line('Inside when other exception');
352: fnd_msg_pub.add_exc_msg('IGW_PROPOSAL_APPROVAL','START_APPROVAL');
353:
354: p_error_message := fnd_msg_pub.get(p_msg_index => FND_MSG_PUB.G_FIRST,
355: p_encoded => FND_API.G_TRUE);
356:
357: p_return_status := 'U';
358: -- dbms_output.put_line('p_error_message --> ' || p_error_message);
359: -- dbms_output.put_line('p_return_status --> ' || p_return_status );