DBA Data[Home] [Help]

PACKAGE BODY: APPS.OKL_DRILLDOWN_PUB_PKG

Source


1 PACKAGE BODY OKL_DRILLDOWN_PUB_PKG AS
2 /* $Header: OKLPDRDB.pls 120.3 2007/06/13 13:42:55 abhsaxen noship $ */
3 
4   L_MODULE                   FND_LOG_MESSAGES.MODULE%TYPE;
5   L_DEBUG_ENABLED            VARCHAR2(10);
6   IS_DEBUG_PROCEDURE_ON      BOOLEAN;
7   IS_DEBUG_STATEMENT_ON      BOOLEAN;
8 
9  /*============================================================================+
10  | PROCEDURE:  DRILLDOWN
11  | COMMENT:    DRILLDOWN procedure provides a public API for SLA to return
12  |             the appropriate information via OUT parameters to open the
13  |             appropriate transaction form.
14  | PARAMETERS:
15  |   p_application_id     : Subledger application internal identifier
16  |   p_ledger_id          : Event ledger identifier
17  |   p_legal_entity_id    : Legal entity identifier
18  |   p_entity_code        : Event entity internal code
19  |   p_event_class_code   : Event class internal code
20  |   p_event_type_code    : Event type internal code
21  |   p_source_id_int_1    : Generic system transaction identifiers
22  |   p_source_id_int_2    : Generic system transaction identifiers
23  |   p_source_id_int_3    : Generic system transaction identifiers
24  |   p_source_id_int_4    : Generic system transaction identifiers
25  |   p_source_id_char_1   : Generic system transaction identifiers
26  |   p_source_id_char_2   : Generic system transaction identifiers
27  |   p_source_id_char_3   : Generic system transaction identifiers
28  |   p_source_id_char_4   : Generic system transaction identifiers
29  |   p_security_id_int_1  : Generic system transaction identifiers
30  |   p_security_id_int_2  : Generic system transaction identifiers
31  |   p_security_id_int_3  : Generic system transaction identifiers
32  |   p_security_id_char_1 : Generic system transaction identifiers
33  |   p_security_id_char_2 : Generic system transaction identifiers
34  |   p_security_id_char_3 : Generic system transaction identifiers
35  |   p_valuation_method   : Valuation Method internal identifier
36  |   p_user_interface_type: This parameter determines the user interface type.
37  |                          The possible values are FORM, HTML, or NONE.
38  |   p_function_name      : The name of the Oracle Application Object
39  |                          Library function defined to open the transaction
40  |                          form. This parameter is used only if the page
41  |                          is a FORM page.
42  |   p_parameters         : An Oracle Application Object Library Function
43  |                          can have its own arguments/parameters. SLA
44  |                          expects developers to return these arguments via
45  |                          p_parameters.
46  |
47  +==========================================================================*/
48 
49 PROCEDURE DRILLDOWN
50 (p_application_id      IN            INTEGER DEFAULT NULL
51 ,p_ledger_id           IN            INTEGER DEFAULT NULL
52 ,p_legal_entity_id     IN            INTEGER DEFAULT NULL
53 ,p_entity_code         IN            VARCHAR2 DEFAULT NULL
54 ,p_event_class_code    IN            VARCHAR2 DEFAULT NULL
55 ,p_event_type_code     IN            VARCHAR2 DEFAULT NULL
56 ,p_source_id_int_1     IN            INTEGER DEFAULT NULL
57 ,p_source_id_int_2     IN            INTEGER DEFAULT NULL
58 ,p_source_id_int_3     IN            INTEGER DEFAULT NULL
59 ,p_source_id_int_4     IN            INTEGER DEFAULT NULL
60 ,p_source_id_char_1    IN            VARCHAR2 DEFAULT NULL
61 ,p_source_id_char_2    IN            VARCHAR2 DEFAULT NULL
62 ,p_source_id_char_3    IN            VARCHAR2 DEFAULT NULL
63 ,p_source_id_char_4    IN            VARCHAR2 DEFAULT NULL
64 ,p_security_id_int_1   IN            INTEGER DEFAULT NULL
65 ,p_security_id_int_2   IN            INTEGER DEFAULT NULL
66 ,p_security_id_int_3   IN            INTEGER DEFAULT NULL
67 ,p_security_id_char_1  IN            VARCHAR2 DEFAULT NULL
68 ,p_security_id_char_2  IN            VARCHAR2 DEFAULT NULL
69 ,p_security_id_char_3  IN            VARCHAR2 DEFAULT NULL
70 ,p_valuation_method    IN            VARCHAR2 DEFAULT NULL
71 ,p_user_interface_type IN OUT NOCOPY VARCHAR2
72 ,p_function_name       IN OUT NOCOPY VARCHAR2
73 ,p_parameters          IN OUT NOCOPY VARCHAR2)
74 
75 IS
76 
77   l_api_name         varchar2(15);
78   l_trx_id              varchar2(100);
79   l_org_id              varchar2(100);
80   l_ledger_id         varchar2(100);
81   l_dummy             number;
82   l_scs_found        boolean;
83   l_func_name       varchar2(50);
84 
85   CURSOR c_investor_scs_code (p_trx_id INTEGER)
86   IS
87   SELECT 1
88   FROM OKL_TRX_CONTRACTS TRX, OKC_K_HEADERS_B CHR
89   WHERE TRX.ID = p_trx_id
90        AND TRX.KHR_ID = CHR.ID
91        AND CHR.SCS_CODE = 'INVESTOR';
92 
93 BEGIN
94   l_api_name           := 'DRILLDOWN';
95   L_MODULE := 'OKL.PLSQL.OKL_DRILLDOWN_PUB_PKG.DRILLDOWN';
96   -- check for logging on PROCEDURE level
97   L_DEBUG_ENABLED := NVL(OKL_DEBUG_PUB.CHECK_LOG_ENABLED, 'N');
98   IS_DEBUG_PROCEDURE_ON := NVL(OKL_DEBUG_PUB.CHECK_LOG_ON(L_MODULE, FND_LOG.LEVEL_PROCEDURE), FALSE);
99   -- check for logging on STATEMENT level
100   IS_DEBUG_STATEMENT_ON := NVL(OKL_DEBUG_PUB.CHECK_LOG_ON(L_MODULE, FND_LOG.LEVEL_STATEMENT), FALSE);
101 
102   --write to log
103   IF(L_DEBUG_ENABLED = 'Y' AND IS_DEBUG_PROCEDURE_ON) THEN
104     OKL_DEBUG_PUB.LOG_DEBUG(FND_LOG.LEVEL_PROCEDURE, L_MODULE, 'begin debug call DRILLDOWN');
105   END IF;
106   IF(L_DEBUG_ENABLED = 'Y' AND IS_DEBUG_STATEMENT_ON) THEN
107       OKL_DEBUG_PUB.LOG_DEBUG(FND_LOG.LEVEL_STATEMENT, L_MODULE || ' Value of API Name', 'l_api_name: ' || l_api_name);
108       OKL_DEBUG_PUB.LOG_DEBUG(FND_LOG.LEVEL_STATEMENT, L_MODULE || ' Value of Transaction ID', 'l_trx_id: ' || l_trx_id);
109       OKL_DEBUG_PUB.LOG_DEBUG(FND_LOG.LEVEL_STATEMENT, L_MODULE || ' Value of event class code', 'p_event_class_code: ' || p_event_class_code);
110       OKL_DEBUG_PUB.LOG_DEBUG(FND_LOG.LEVEL_STATEMENT, L_MODULE || ' Value of event type code', 'p_event_type_code: ' || p_event_type_code);
111       OKL_DEBUG_PUB.LOG_DEBUG(FND_LOG.LEVEL_STATEMENT, L_MODULE || ' Value of entity code', 'p_entity_code: ' || p_entity_code);
112   END IF;
113 
114   --Check whether application is OKL
115   IF (p_application_id = 540) THEN
116     l_trx_id := TO_CHAR(p_source_id_int_1);
117     p_user_interface_type := 'HTML';
118     l_ledger_id := TO_CHAR(p_ledger_id);
119     l_org_id := TO_CHAR(p_security_id_int_1);
120     --Set the parameters and form the URL for entity code CONTRACTS, TRANSACTIONS AND ASSETS
121     IF  (p_entity_code IN ('CONTRACTS', 'TRANSACTIONS')) THEN
122       --If event class in GLP or SLP then check the scs_code for that transaction
123       --If scs_code is INVESTOR then form the URL pointing to Investor Agreement
124       IF (p_event_class_code IN ('GENERAL_LOSS_PROVISION','SPECIFIC_LOSS_PROVISION')) THEN
125         OPEN c_investor_scs_code(l_trx_id);
126         FETCH c_investor_scs_code INTO l_dummy;
127         l_scs_found := c_investor_scs_code%FOUND;
128         CLOSE c_investor_scs_code;
129         IF l_scs_found THEN
130           l_func_name := 'OKL_IA_ACCT_TRANS';
131         ELSE
132           l_func_name := 'OKL_OP_ACCT_TRANS';
133         END IF;
134       ELSE
135         l_func_name := 'OKL_OP_ACCT_TRANS';
136       END IF;
137       p_parameters := '/OA_HTML/OA.jsp?OAFunc=' || l_func_name || '&' || 'TRANSACTION_ID=' || l_trx_id
138 							|| '&' || 'LEDGER_ID=' || l_ledger_id
139 							|| '&' || 'OKL_ORGANIZATION_ID=' || l_org_id;
140     --Set the parameters and form the URL for entity code INVESTOR
141     ELSIF (p_entity_code = 'INVESTOR_AGREEMENTS')  THEN
142       p_parameters := '/OA_HTML/OA.jsp?OAFunc=OKL_IA_ACCT_TRANS' || '&' || 'TRANSACTION_ID=' || l_trx_id
143 							|| '&' || 'LEDGER_ID=' || l_ledger_id
144 							|| '&' || 'OKL_ORGANIZATION_ID=' || l_org_id;
145     ELSE
146       p_user_interface_type := 'NONE';
147     END IF;
148   END IF;
149 
150   --write to log
151   IF(L_DEBUG_ENABLED = 'Y' AND IS_DEBUG_STATEMENT_ON) THEN
152       OKL_DEBUG_PUB.LOG_DEBUG(FND_LOG.LEVEL_STATEMENT, L_MODULE || ' Value of API Name', 'l_api_name: ' || l_api_name);
153       OKL_DEBUG_PUB.LOG_DEBUG(FND_LOG.LEVEL_STATEMENT, L_MODULE || ' Value of parameters', 'p_parameters: ' || p_parameters);
154   END IF;
155   IF(L_DEBUG_ENABLED = 'Y' AND IS_DEBUG_PROCEDURE_ON) THEN
156     OKL_DEBUG_PUB.LOG_DEBUG(FND_LOG.LEVEL_PROCEDURE, L_MODULE, 'end debug call DRILLDOWN');
157   END IF;
158 
159 END DRILLDOWN;
160 
161 END OKL_DRILLDOWN_PUB_PKG;