DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_ABM_SHD

Source


1 Package Body hr_abm_shd as
2 /* $Header: hrabmrhi.pkb 115.4 99/10/12 07:03:51 porting ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hr_abm_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15   l_proc 	varchar2(72) := g_package||'return_api_dml_status';
16 --
17 Begin
18   hr_utility.set_location('Entering:'||l_proc, 5);
19   --
20   Return (nvl(g_api_dml, false));
21   --
22   hr_utility.set_location(' Leaving:'||l_proc, 10);
23 End return_api_dml_status;
24 --
25 -- ----------------------------------------------------------------------------
26 -- |---------------------------< constraint_error >---------------------------|
27 -- ----------------------------------------------------------------------------
28 Procedure constraint_error
29             (p_constraint_name in all_constraints.constraint_name%TYPE) Is
30 --
31   l_proc 	varchar2(72) := g_package||'constraint_error';
32 --
33 Begin
34   hr_utility.set_location('Entering:'||l_proc, 5);
35   --
36   If (p_constraint_name = 'HR_ABM_STATUS_CHECK') Then
37 
38     hr_utility.set_message(801, 'HR_7297_API_ARG_ONLY');
39     hr_utility.set_message_token('ARG_NAME', 'status');
40     hr_utility.set_message_token('ARG_ONLY','(F,S)');
41     hr_utility.raise_error;
42   ElsIf (p_constraint_name = 'HR_API_BATCH_MESSAGE_LINES_PK') Then
43     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
44     hr_utility.raise_error;
45   Else
46     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
47     hr_utility.set_message_token('PROCEDURE', l_proc);
48     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
49     hr_utility.raise_error;
50   End If;
51   --
52   hr_utility.set_location(' Leaving:'||l_proc, 10);
53 End constraint_error;
54 --
55 -- ----------------------------------------------------------------------------
56 -- |---------------------------------< lck >----------------------------------|
57 -- ----------------------------------------------------------------------------
58 Procedure lck(p_line_id in number) is
59 --
60 -- Cursor selects the 'current' row from the HR Schema
61 --
62   Cursor C_Sel1 is
63     select 	line_id,
64 	        batch_run_number,
65 	        api_name,
66 	        status,
67 	        error_number,
68 	        error_message,
69 	        extended_error_message,
70 	        source_row_information
71     from	hr_api_batch_message_lines
72     where	line_id = p_line_id
73     for	update nowait;
74 --
75   l_proc	varchar2(72) := g_package||'lck';
76 --
77 Begin
78   hr_utility.set_location('Entering:'||l_proc, 5);
79   --
80   hr_api.mandatory_arg_error
81     (p_api_name       => l_proc,
82      p_argument       => 'line_id',
83      p_argument_value => p_line_id);
84    --
85   Open  C_Sel1;
86   Fetch C_Sel1 Into g_old_rec;
87   If C_Sel1%notfound then
88     Close C_Sel1;
89     --
90     -- The primary key is invalid therefore we must error
91     --
92     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
93     hr_utility.raise_error;
94   End If;
95   Close C_Sel1;
96   --
97 --
98   hr_utility.set_location(' Leaving:'||l_proc, 10);
99 --
100 -- We need to trap the ORA LOCK exception
101 --
102 Exception
103   When HR_Api.Object_Locked then
104     --
105     -- The object is locked therefore we need to supply a meaningful
106     -- error message.
107     --
108     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
109     hr_utility.set_message_token('TABLE_NAME', 'hr_api_batch_message_lines');
110     hr_utility.raise_error;
111 End lck;
112 --
113 -- ----------------------------------------------------------------------------
114 -- |-----------------------------< convert_args >-----------------------------|
115 -- ----------------------------------------------------------------------------
116 Function convert_args
117 	(
118 	p_line_id                       in number,
119 	p_batch_run_number              in number,
120 	p_api_name                      in varchar2,
121 	p_status                        in varchar2,
122 	p_error_number                  in number,
123 	p_error_message                 in varchar2,
124 	p_extended_error_message        in varchar2,
125 	p_source_row_information        in varchar2
126 	)
127 	Return g_rec_type is
128 --
129   l_rec	  g_rec_type;
130   l_proc  varchar2(72) := g_package||'convert_args';
131 --
132 Begin
133   --
134   hr_utility.set_location('Entering:'||l_proc, 5);
135   --
136   -- Convert arguments into local l_rec structure.
137   --
138   l_rec.line_id                          := p_line_id;
139   l_rec.batch_run_number                 := p_batch_run_number;
140   l_rec.api_name                         := p_api_name;
141   l_rec.status                           := p_status;
142   l_rec.error_number                     := p_error_number;
143   l_rec.error_message                    := p_error_message;
144   l_rec.extended_error_message           := p_extended_error_message;
145   l_rec.source_row_information           := p_source_row_information;
146   --
147   -- Return the plsql record structure.
148   --
149   hr_utility.set_location(' Leaving:'||l_proc, 10);
150   Return(l_rec);
151 --
152 End convert_args;
153 --
154 end hr_abm_shd;