1 PACKAGE BODY PO_CUSTOM_MULTIMOD_VAL_PUB AS
2 /* $Header: PO_CUSTOM_MULTIMOD_VAL_PUB.plb 120.1 2011/09/17 02:40:19 sautrive noship $ */
3
4 ---------------------------------------------------------------------------
5 -- Modules for debugging.
6 ---------------------------------------------------------------------------
7
8 -- The module base for this package.
9 D_PACKAGE_BASE CONSTANT VARCHAR2(50) :=
10 PO_LOG.get_package_base('PO_CUSTOM_MULTIMOD_VAL_PVT');
11
12 -- The module base for the subprogram.
13 D_generate_custom_exceptions CONSTANT VARCHAR2(100) :=
14 PO_LOG.get_subprogram_base(D_PACKAGE_BASE,'generate_custom_exceptions');
15
16 -------------------------------------------------------------------------------
17 --Start of Comments
18 --Name: generate_custom_exceptions
19 --Pre-reqs: None.
20 --Function:
21 -- Based on the validation type and the request type the validation set is created and passed on to validate_set
22 -- procedure to perform the validations and store the results in the object type po_multi_mod_val_results.
23 --Parameters:
24 --IN:
25 --p_multi_mod_requests
26 -- po_multi_mod_requests table data for validation
27 --p_multi_mod_docs
28 -- po_multi_mod_docs table data for validation
29 --p_multi_mod_changes
30 -- po_multi_mod_changes table data for validation
31 --p_validation_type
32 -- Parameter to identify if the validations are 'pre-submit' or 'concurrent'
33 --OUT:
34 --x_result_type
35 -- Identifies if the validation was a success or failure
36 --x_results
37 -- Out variable that holds the validation results
38 --End of Comments
39 -------------------------------------------------------------------------------
40 PROCEDURE generate_custom_exceptions( p_request_id IN NUMBER
41 ,p_name_value_pair IN PO_NAME_VALUE_PAIR_TAB
42 ,x_result_type OUT NOCOPY VARCHAR2
43 ,x_results OUT NOCOPY PO_MULTI_MOD_VAL_RESULTS_TYPE
44 )
45 IS
46 l_results_count NUMBER;
47 d_mod CONSTANT VARCHAR2(100) := D_generate_custom_exceptions;
48 d_position NUMBER := 0;
49 d_stmt CONSTANT BOOLEAN := PO_LOG.d_stmt;
50
51 BEGIN
52
53 IF PO_LOG.d_proc THEN
54 -- PO_LOG.proc_begin(d_mod,'p_name_value_pair',p_name_value_pair);
55 PO_LOG.proc_begin(d_mod,'x_result_type',x_result_type);
56 END IF;
57
58 IF (x_results IS NULL) THEN
59 x_results := PO_MULTI_MOD_VAL_RESULTS_TYPE.new_instance();
60 END IF;
61
62 l_results_count := x_results.result_type.COUNT;
63 IF d_stmt THEN
64 PO_LOG.stmt(d_mod,d_position,'l_results_count',l_results_count);
65 END IF;
66
67 d_position := 10;
68
69 /* Add custom validations here.
70 For every validation failure, the error/warning message has to be added to x_results. Sample below.
71 x_results.add_result(
72 p_multi_mod_val_result_id
73 , p_multi_mod_request_id
74 , p_multi_mod_doc_id
75 , p_validation_type
76 , p_exception_type
77 , p_result_type
78 , p_document_id
79 , p_document_number
80 , p_related_document_id
81 , p_related_document_number
82 , p_related_document_date
83 , p_related_document_amount
84 , p_message_application
85 , p_message_name
86 , p_token1_name
87 , p_token1_value
88 , p_token2_name
89 , p_token2_value
90 , p_token3_name
91 , p_token3_value
92 , p_token4_name
93 , p_token4_value
94 , p_token5_name
95 , p_token5_value
96 , p_token6_name
97 , p_token6_value
98 );*/
99
100 d_position := 20;
101 IF l_results_count < x_results.result_type.COUNT THEN
102 x_result_type := c_result_type_FAILURE;
103 ELSE
104 x_result_type := c_result_type_SUCCESS;
105 END IF;
106
107 IF PO_LOG.d_proc THEN
108 PO_LOG.proc_end(d_mod,'x_result_type',x_result_type);
109 END IF;
110
111 EXCEPTION
112 WHEN OTHERS THEN
113 IF PO_LOG.d_exc THEN
114 PO_LOG.exc(d_mod,d_position,NULL);
115 END IF;
116 RAISE;
117
118 END generate_custom_exceptions;
119
120 END PO_CUSTOM_MULTIMOD_VAL_PUB;