DBA Data[Home] [Help]

PACKAGE BODY: APPS.OKC_REP_NUM_HOOK

Source


1 PACKAGE BODY okc_rep_num_hook AS
2 /* $Header: OKCREPNHKB.pls 120.0.12020000.2 2013/02/02 04:03:05 harchand noship $ */
3 
4    /* Global constants*/
5    g_pkg_name              CONSTANT VARCHAR2 (200) := 'okc_rep_num_hook';
6    g_app_name              CONSTANT VARCHAR2 (3)   := okc_api.g_app_name;
7    g_module                CONSTANT VARCHAR2 (250)
8                                          := 'okc.plsql.' || g_pkg_name || '.';
9    g_false                 CONSTANT VARCHAR2 (1)   := fnd_api.g_false;
10    g_true                  CONSTANT VARCHAR2 (1)   := fnd_api.g_true;
11    g_okc                   CONSTANT VARCHAR2 (3)   := 'OKC';
12    g_ret_sts_success       CONSTANT VARCHAR2 (1) := fnd_api.g_ret_sts_success;
13    g_ret_sts_error         CONSTANT VARCHAR2 (1)   := fnd_api.g_ret_sts_error;
14    g_ret_sts_unexp_error   CONSTANT VARCHAR2 (1)
15                                              := fnd_api.g_ret_sts_unexp_error;
16    g_unexpected_error      CONSTANT VARCHAR2 (200) := 'OKC_UNEXPECTED_ERROR';
17    g_sqlerrm_token         CONSTANT VARCHAR2 (200) := 'ERROR_MESSAGE';
18    g_sqlcode_token         CONSTANT VARCHAR2 (200) := 'ERROR_CODE';
19 
20 
21   G_DBG_LEVEL							  NUMBER 		:= FND_LOG.G_CURRENT_RUNTIME_LEVEL;
22   G_PROC_LEVEL							NUMBER		:= FND_LOG.LEVEL_PROCEDURE;
23   G_EXCP_LEVEL							NUMBER		:= FND_LOG.LEVEL_EXCEPTION;
24 
25 
26 
27 
28 /* FUNCTION get_rep_contract_number
29 
30 USAGE
31 This function is used to derive custom contract numbers for repository contract documents.
32 
33 With this method implementation in place, Autonumbering logic per contract type can be implemented
34     - Typical choice is to have different custom sequences per/required contract type and/or OU
35     - Any custom string can be prepended to the above derived sequence eg: 'FY01-001'
36     - Always ensure that the generated contract number is unique for a given combination of OU and contract type.
37 
38 Existing behaviour:
39     Profile Contract Repository Auto-Numbering Enabled(site level) decides whether the contract number is system defined or manual.
40         Profile value is Yes
41             - Sequence OKC_REP_CONTRACTS_ALL_S2 is used for generating sequences for the contract number.
42             - Contract number will be unique across contract type, operating unit i.e. same contract number will not repeat across OU/contract types
43 
44         Profile value is No
45             - User has the choice for manual entry and user needs to ensure that contract number is unique.
46 
47 How this method and Contract Repository Auto-Numbering Enabled Profile work together:
48     Profile Contract Repository Auto-Numbering Enabled is Yes
49         - the value returned by this method for a given contract type, OU will be treated as the autogenerated sequence number
50         - the logic is used during manual authoring and contract import
51 
52     Profile Contract Repository Auto-Numbering Enabled is No
53         - The value returned by this method for a given contract type, OU will be treated as a default and user can manually override it.
54         - Manual authoring user can override the default value.
55         - During Contract import user provided values are taken and this method is not used.
56 
57 Exception handling
58     Ascertain the required behaviour and handle exceptions accordingly
59         - When the profile value is set to No, you can choose to return an empty/null value for the contract number since user can always enter value
60         - When the profile value is set to Yes, if you choose to return empty value then auto generated sequence will take effect.
61 
62 INPUT PARAMETERS
63 
64 p_doc_type   Document Type of Contract
65 p_org_id     Organization id
66 
67 RETURN VALUE
68 
69 contract number that is generated by this method.
70 
71 */
72 
73 
74 
75    FUNCTION get_rep_contract_number (
76      p_doc_type IN VARCHAR2,
77      p_org_id   IN number
78    )  RETURN VARCHAR2
79    IS
80 
81    l_contract_number VARCHAR2(150) ;
82 
83    BEGIN
84     /*
85      The customer has to write their own logic to derive the contract number according to
86      their business needs. Ensure that the contract number is unique for a given combination of OU and contract type .
87      */
88      NULL;
89 
90      RETURN l_contract_number;
91 
92    END GET_REP_CONTRACT_NUMBER;
93 
94 END OKC_REP_NUM_HOOK;