DBA Data[Home] [Help]

PACKAGE: APPS.OKS_RENEW_CONTRACT_PUB

Source


1 PACKAGE OKS_RENEW_CONTRACT_PUB AUTHID CURRENT_USER AS
2 /* $Header: OKSPRENKS.pls 120.1 2005/09/27 14:31 anjkumar noship $*/
3 
4     SUBTYPE validation_rec_type IS OKS_RENEW_CONTRACT_PVT.validation_rec_type;
5     SUBTYPE validation_tbl_type IS OKS_RENEW_CONTRACT_PVT.validation_tbl_type;
6 
7     G_PKG_NAME CONSTANT VARCHAR2(30) := 'OKS_RENEW_CONTRACT_PUB';
8     G_OKS_APP_NAME CONSTANT VARCHAR2(3) := 'OKS'; --all new nessages should use this
9 
10     G_VALIDATE_ALL CONSTANT VARCHAR2(1) := OKS_RENEW_CONTRACT_PVT.G_VALIDATE_ALL; --A
11     G_VALIDATE_ERRORS CONSTANT VARCHAR2(1) := OKS_RENEW_CONTRACT_PVT.G_VALIDATE_ERRORS; --E
12 
13     G_VALID_STS_SUCCESS CONSTANT VARCHAR2(1) := OKS_RENEW_CONTRACT_PVT.G_VALID_STS_SUCCESS; --S
14     G_VALID_STS_WARNING CONSTANT VARCHAR2(1) := OKS_RENEW_CONTRACT_PVT.G_VALID_STS_WARNING; --W
15     G_VALID_STS_ERROR CONSTANT VARCHAR2(1) := OKS_RENEW_CONTRACT_PVT.G_VALID_STS_ERROR; --E
16 
17 
18     /*
19 	From R12 onwards, this procedure should be used to renew service contracts.
20     It will be redesigned to do the following
21         1.	Improve performance
22         2.	Reduce dependence on OKC code
23         3.	Incorporate functional design changes for R12
24         4.	Comply with current Oracle Applications coding and logging standards
25         5.	Ease of maintenance
26 
27     Parameters
28         p_chr_id                :   id of the contract being renewed, mandatory
29         p_new_contract_number   :   contract number for the renewed contract, optional
30         p_new_contract_modifier :   contract modifier for the renewed contract, optional
31         p_new_start_date        :   start date for the renewed contract, optional
32         p_new_end_date          :   end date for the renewed contract, optional
33         p_new_duration          :   duration for renewed contract, optional
34         p_new_uom_code          :   period for the renewed contract, optional
35         p_renewal_called_from_ui :  'Y' - called from UI, N - called from Events
36         x_chr_id            :   id of the renewed contract
37 
38     Defaulting rules
39         1. If p_new_contract_number is not passed, uses the source contract_number
40         2. If p_new_contract_modifier is not passed, generated this as
41             fnd_profile.VALUE('OKC_CONTRACT_IDENTIFIER') || to_char(SYSDATE, 'DD-MON-YYYY HH24:MI:SS')
42         3. If p_new_start_date is not passed, defaults to source contract end_date +1
43         4. If p_new_end_date is not passed, derived from p_new_duration/p_new_uom_code
44             and p_new_start_date. If p_new_duration/p_new_uom_code are also not passed
45             used the source contract duration/period
46     */
47 
48     PROCEDURE RENEW_CONTRACT
49     (
50      p_api_version IN NUMBER,
51      p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
52      p_commit   IN VARCHAR2 DEFAULT FND_API.G_FALSE,
53      p_chr_id IN NUMBER,
54      p_new_contract_number IN okc_k_headers_b.contract_number%TYPE,
55      p_new_contract_modifier IN okc_k_headers_b.contract_number_modifier%TYPE,
56      p_new_start_date IN DATE,
57      p_new_end_date IN DATE,
58      p_new_duration IN NUMBER,
59      p_new_uom_code IN MTL_UNITS_OF_MEASURE_TL.uom_code%TYPE,
60      p_renewal_called_from_ui IN VARCHAR2 DEFAULT 'Y',
61      x_chr_id OUT NOCOPY NUMBER,
62      x_msg_count OUT NOCOPY NUMBER,
63      x_msg_data OUT NOCOPY VARCHAR2,
64      x_return_status OUT NOCOPY VARCHAR2
65      );
66 
67 
68     /* R12 procedure that validates if a contract can be renewed
69         p_chr_id : contract id of the contract being renewed
70         p_date : start date of the renewal, if not passed defaults to end date + 1 of the source contract
71         p_validation_level : A - do all checks including warnings, E - do only error checks
72         x_rnrl_rec : returns the effective renewal rules for the contract
73         x_validation_status : S - Success (OK for renewal), W - Warnings (Ok for renewal)
74                              E - Erros (Cannot be renewed)
75         x_validation_tbl : Validation error and warning messages
76     */
77     PROCEDURE VALIDATE_RENEWAL
78     (
79      p_api_version IN NUMBER DEFAULT 1,
80      p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
81      x_return_status OUT NOCOPY VARCHAR2,
82      x_msg_count OUT NOCOPY NUMBER,
83      x_msg_data OUT NOCOPY VARCHAR2,
84      p_chr_id IN NUMBER,
85      p_date IN DATE,
86      p_validation_level IN VARCHAR2 DEFAULT G_VALIDATE_ALL,
87      x_rnrl_rec OUT NOCOPY OKS_RENEW_UTIL_PVT.rnrl_rec_type,
88      x_validation_status OUT NOCOPY VARCHAR2,
89      x_validation_tbl OUT NOCOPY validation_tbl_type
90     );
91 
92     /*
93     Utility function that returns
94         FND_API.G_TRUE = T,  if a contract is valid for renewal,
95         FND_API.G_FALSE = F, if contract cannot be renewed because of warnings (for e.g., all the
96         lines in the contract have terminated) or errors (for e.g., the contract is in ENTERED status)
97     In case of other errors, logs the error message and returns F.
98 
99     This function should be used when setting up independent conditions (events) for contract
100     renewal. It will filter out contracts that are not eligible for renewal. Internally calls the
101     validate_renewal procedure and returns T only if x_validation_status = S, returns F otherwise.
102     */
103     FUNCTION VALID_FOR_RENEWAL
104     (
105      p_chr_id IN NUMBER
106     ) RETURN VARCHAR2;
107 
108 
109     /*
110     Procedure for updating  invoice_text col in table OKC_K_LINES_TL
111     with the current line start date and end date. Called during renewal,
112     after line dates are adjusted. Uses bulk calls to get and set the invoice text
113     Parameters
114         p_chr_id    : id of the contract whose lines need to be updated
115     */
116     PROCEDURE UPDATE_INVOICE_TEXT
117     (
118      p_api_version IN NUMBER DEFAULT 1,
119      p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
120      p_commit   IN VARCHAR2 DEFAULT FND_API.G_FALSE,
121      x_return_status OUT NOCOPY VARCHAR2,
122      x_msg_count OUT NOCOPY NUMBER,
123      x_msg_data OUT NOCOPY VARCHAR2,
124      p_chr_id IN NUMBER
125      );
126 
127     /*
128     Procedure for getting the user id and name of the contact on whose behalf the
129     contract workflow is launched during renewal
130     Parameters
131         p_chr_id            : id of the contract for which the workflow is launched
132         p_hdesk_user_id     : fnd user id of the help desk user id setup in GCD. Optional,
133                               if not passed will be derived from GCD.
134 
135     If no vendor/merchant contact bases on jtf object 'OKX_SALEPERS' can be found for the contract
136     header, the help desk user is used. This behaviour is from R12 onwards, prior to this if a
137     salesrep was not found, contract admin and then contract approver would be used.
138     */
139     PROCEDURE GET_USER_NAME
140     (
141      p_api_version IN NUMBER DEFAULT 1,
142      p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
143      x_return_status OUT NOCOPY VARCHAR2,
144      x_msg_count OUT NOCOPY NUMBER,
145      x_msg_data OUT NOCOPY VARCHAR2,
146      p_chr_id IN NUMBER,
147      p_hdesk_user_id IN NUMBER,
148      x_user_id OUT NOCOPY NUMBER,
149      x_user_name OUT NOCOPY VARCHAR2
150     );
151 
152 
153 END OKS_RENEW_CONTRACT_PUB;