[Home] [Help]
PACKAGE BODY: APPS.JE_GR_TRNOVR_RULES_UPGRADE
Source
1 PACKAGE BODY je_gr_trnovr_rules_upgrade AS
2 /* $Header: jegrupgb.pls 120.2 2006/11/03 08:24:43 anvijaya ship $ */
3
4 PROCEDURE upgrade_main (errbuf OUT NOCOPY varchar2,
5 retcode OUT NOCOPY number) IS
6
7 l_message VARCHAR2(1000);
8 l_row_count NUMBER := 0;
9
10 l_org_id NUMBER(15);
11 l_return_status VARCHAR2(10);
12 l_msg_count NUMBER;
13 l_msg_data VARCHAR2(1000);
14 l_legal_entity_id NUMBER;
15
16 BEGIN
17
18 retcode := 0;
19 errbuf := NULL;
20
21 -- Get the profile org id.
22 l_org_id := FND_PROFILE.VALUE('ORG_ID');
23
24 IF l_org_id IS NOT NULL THEN
25
26 fnd_file.put_line(fnd_file.log, 'Org id: '||l_org_id);
27
28 l_legal_entity_id := XLE_UTILITIES_GRP.Get_DefaultLegalContext_OU(l_org_id);
29 /* xle_upgrade_utils.get_default_legal_context(x_return_status => l_return_status,
30 x_msg_count => l_msg_count,
31 x_msg_data => l_msg_data,
32 p_org_id => l_org_id,
33 x_dlc => l_legal_entity_id);
34 */
35 fnd_file.put_line(fnd_file.log, 'Ret Status: '||l_return_status);
36 fnd_file.put_line(fnd_file.log, 'Msg Data: '||l_msg_data);
37
38 -- If the return status is not error, then continue with the process
39 IF l_return_status IS NULL THEN
40
41 IF (l_legal_entity_id IS NOT NULL) THEN
42
43 UPDATE je_gr_trnovr_rules
44 SET legal_entity_id = l_legal_entity_id
45 WHERE legal_entity_id IS NULL;
46
47 l_message := 'Updated '||SQL%ROWCOUNT||' rows in table JE_GR_TRNOVR_RULES with legal entity id: '||l_legal_entity_id;
48 fnd_file.put_line(fnd_file.log,l_message);
49
50 ELSE
51 -- IF legal entity id is null.
52 l_message := 'Unable to Update Legal Entities for the table je_gr_trnovr_rules
53 because no Legal Entity was found.';
54 fnd_file.put_line(fnd_file.log,l_message);
55
56 ROLLBACK;
57 retcode := 2;
58 errbuf := l_message;
59
60 END IF;
61
62 ELSE
63
64 l_message := 'Error - Upgrade process could not complete: '||l_msg_data;
65 FND_FILE.PUT_LINE(FND_FILE.LOG, l_message);
66 retcode := 2;
67 errbuf := l_message;
68 RETURN;
69
70 END IF;
71
72 END IF;
73
74 l_message := 'Upgrade completed successfully.';
75 fnd_file.put_line(fnd_file.log,l_message);
76 COMMIT;
77
78 EXCEPTION WHEN OTHERS THEN
79 ROLLBACK;
80 l_message := 'Error - Upgrade process could not complete: '||sqlcode||': '||sqlerrm;
81 retcode := 2;
82 errbuf := l_message;
83 fnd_file.put_line(fnd_file.log, l_message);
84
85 END upgrade_main;
86
87 END je_gr_trnovr_rules_upgrade;
88