DBA Data[Home] [Help]

PACKAGE BODY: APPS.POS_SUPPLIER_BO_PKG

Source


1 PACKAGE BODY pos_supplier_bo_pkg AS
2 /* $Header: POSSPBOB.pls 120.2.12020000.3 2013/04/08 21:15:30 riren ship $ */
3 PROCEDURE assign_organization(p_hz_organization_bo  IN hz_organization_bo,
4                               p_pos_organization_bo OUT NOCOPY pos_organization_bo) AS
5 
6     l_contact_objs      pos_org_contact_bo_tbl := pos_org_contact_bo_tbl();
7     l_contact_objs_temp hz_org_contact_bo_tbl  := hz_org_contact_bo_tbl();
8     l_party_site_temp   hz_party_site_bo_tbl   := hz_party_site_bo_tbl();
9     l_party_site_objs_1 pos_party_site_bo_tbl  := pos_party_site_bo_tbl();
10     l_party_site_objs_2 pos_party_site_bo_tbl  := pos_party_site_bo_tbl();
11     l_organization      pos_organization_bo;
12 
13    BEGIN
14 
15      l_contact_objs_temp := p_hz_organization_bo.contact_objs;
16      IF l_contact_objs_temp.count > 0 THEN        -- Bug 14162504: Check if the collection is empty.
17         FOR i IN l_contact_objs_temp.first .. l_contact_objs_temp.last LOOP
18             l_contact_objs.extend(1);
19             l_party_site_temp :=l_contact_objs_temp(i).party_site_objs;
20 
21           IF l_party_site_temp.count >0 THEN
22             FOR j IN l_party_site_temp.first..l_party_site_temp.last LOOP
23                 l_party_site_objs_1.extend(1);
24                 l_party_site_objs_1(j) := pos_party_site_bo(l_party_site_temp(j).action_type,
25                                                             l_party_site_temp(j).common_obj_id,
26                                                             l_party_site_temp(j).party_site_id,
27                                                             l_party_site_temp(j).orig_system,
28                                                             l_party_site_temp(j).orig_system_reference,
29                                                             l_party_site_temp(j).parent_object_type,
30                                                             l_party_site_temp(j).parent_object_id,
31                                                             l_party_site_temp(j).party_site_number,
32                                                             l_party_site_temp(j).mailstop,
33                                                             l_party_site_temp(j).identifying_address_flag,
34                                                             l_party_site_temp(j).status,
35                                                             l_party_site_temp(j).party_site_name,
36                                                             l_party_site_temp(j).attribute_category,
37                                                             l_party_site_temp(j).attribute1,
38                                                             l_party_site_temp(j).attribute2,
39                                                             l_party_site_temp(j).attribute3,
40                                                             l_party_site_temp(j).attribute4,
41                                                             l_party_site_temp(j).attribute5,
42                                                             l_party_site_temp(j).attribute6,
43                                                             l_party_site_temp(j).attribute7,
44                                                             l_party_site_temp(j).attribute8,
45                                                             l_party_site_temp(j).attribute9,
46                                                             l_party_site_temp(j).attribute10,
47                                                             l_party_site_temp(j).attribute11,
48                                                             l_party_site_temp(j).attribute12,
49                                                             l_party_site_temp(j).attribute13,
50                                                             l_party_site_temp(j).attribute14,
51                                                             l_party_site_temp(j).attribute15,
52                                                             l_party_site_temp(j).attribute16,
53                                                             l_party_site_temp(j).attribute17,
54                                                             l_party_site_temp(j).attribute18,
55                                                             l_party_site_temp(j).attribute19,
56                                                             l_party_site_temp(j).attribute20,
57                                                             l_party_site_temp(j).language,
58                                                             l_party_site_temp(j).addressee,
59                                                             l_party_site_temp(j).program_update_date,
60                                                             l_party_site_temp(j).created_by_module,
61                                                             l_party_site_temp(j).created_by_name,
62                                                             l_party_site_temp(j).creation_date,
63                                                             l_party_site_temp(j).last_update_date,
64                                                             l_party_site_temp(j).last_updated_by_name,
65                                                             l_party_site_temp(j).actual_content_source,
66                                                             l_party_site_temp(j).global_location_number,
67                                                             l_party_site_temp(j).orig_sys_objs,
68                                                             l_party_site_temp(j).ext_attributes_objs,
69                                                             l_party_site_temp(j).location_obj,
70                                                             l_party_site_temp(j).party_site_use_objs,
71                                                             l_party_site_temp(j).phone_objs,
72                                                             l_party_site_temp(j).telex_objs,
73                                                             l_party_site_temp(j).email_objs,
74                                                             l_party_site_temp(j).web_objs,
75                                                             l_party_site_temp(j).contact_pref_objs);
76 
77             END LOOP;
78         END IF;
79             l_contact_objs(i) := pos_org_contact_bo(l_contact_objs_temp(i).action_type,
80                                                    l_contact_objs_temp(i).common_obj_id,
81                                                    l_contact_objs_temp(i).org_contact_id,
82                                                    l_contact_objs_temp(i).organization_id,
83                                                    l_contact_objs_temp(i).orig_system,
84                                                    l_contact_objs_temp(i).orig_system_reference,
85                                                    l_contact_objs_temp(i).comments,
86                                                    l_contact_objs_temp(i).contact_number,
87                                                    l_contact_objs_temp(i).department_code,
88                                                    l_contact_objs_temp(i).department,
89                                                    l_contact_objs_temp(i).title,
90                                                    l_contact_objs_temp(i).job_title,
91                                                    l_contact_objs_temp(i).decision_maker_flag,
92                                                    l_contact_objs_temp(i).job_title_code,
93                                                    l_contact_objs_temp(i).reference_use_flag,
94                                                    l_contact_objs_temp(i).rank,
95                                                    l_contact_objs_temp(i).party_site_id,
96                                                    l_contact_objs_temp(i).attribute_category,
97                                                    l_contact_objs_temp(i).attribute1,
98                                                    l_contact_objs_temp(i).attribute2,
99                                                    l_contact_objs_temp(i).attribute3,
100                                                    l_contact_objs_temp(i).attribute4,
101                                                    l_contact_objs_temp(i).attribute5,
102                                                    l_contact_objs_temp(i).attribute6,
103                                                    l_contact_objs_temp(i).attribute7,
104                                                    l_contact_objs_temp(i).attribute8,
105                                                    l_contact_objs_temp(i).attribute9,
106                                                    l_contact_objs_temp(i).attribute10,
107                                                    l_contact_objs_temp(i).attribute11,
108                                                    l_contact_objs_temp(i).attribute12,
109                                                    l_contact_objs_temp(i).attribute13,
110                                                    l_contact_objs_temp(i).attribute14,
111                                                    l_contact_objs_temp(i).attribute15,
112                                                    l_contact_objs_temp(i).attribute16,
113                                                    l_contact_objs_temp(i).attribute17,
114                                                    l_contact_objs_temp(i).attribute18,
115                                                    l_contact_objs_temp(i).attribute19,
116                                                    l_contact_objs_temp(i).attribute20,
117                                                    l_contact_objs_temp(i).attribute21,
118                                                    l_contact_objs_temp(i).attribute22,
119                                                    l_contact_objs_temp(i).attribute23,
120                                                    l_contact_objs_temp(i).attribute24,
121                                                    l_contact_objs_temp(i).program_update_date,
122                                                    l_contact_objs_temp(i).created_by_module,
123                                                    l_contact_objs_temp(i).created_by_name,
124                                                    l_contact_objs_temp(i).creation_date,
125                                                    l_contact_objs_temp(i).last_update_date,
126                                                    l_contact_objs_temp(i).last_updated_by_name,
127                                                    l_contact_objs_temp(i).relationship_code,
128                                                    l_contact_objs_temp(i).relationship_type,
129                                                    l_contact_objs_temp(i).relationship_comments,
130                                                    l_contact_objs_temp(i).start_date,
131                                                    l_contact_objs_temp(i).end_date,
132                                                    l_contact_objs_temp(i).status,
133                                                    l_contact_objs_temp(i).orig_sys_objs,
134                                                    l_contact_objs_temp(i).person_profile_obj,
135                                                    l_contact_objs_temp(i).org_contact_role_objs,
136                                                    l_party_site_objs_1,
137                                                    l_contact_objs_temp(i).phone_objs,
138                                                    l_contact_objs_temp(i).telex_objs,
139                                                    l_contact_objs_temp(i).email_objs,
140                                                    l_contact_objs_temp(i).web_objs,
141                                                    l_contact_objs_temp(i).sms_objs,
142                                                    l_contact_objs_temp(i).contact_pref_objs);
143          l_party_site_objs_1.delete;
144         END LOOP;
145      END IF;
146 
147      IF p_hz_organization_bo.party_site_objs.count > 0 THEN        -- Bug 14699689: Check if the collection is empty.
148           FOR j IN p_hz_organization_bo.party_site_objs.first..p_hz_organization_bo.party_site_objs.last LOOP
149             l_party_site_objs_2.extend(1);
150             l_party_site_objs_2(j) := pos_party_site_bo(p_hz_organization_bo.party_site_objs(j).action_type,
151                                                         p_hz_organization_bo.party_site_objs(j).common_obj_id,
152                                                         p_hz_organization_bo.party_site_objs(j).party_site_id,
153                                                         p_hz_organization_bo.party_site_objs(j).orig_system,
154                                                         p_hz_organization_bo.party_site_objs(j).orig_system_reference,
155                                                         p_hz_organization_bo.party_site_objs(j).parent_object_type,
156                                                         p_hz_organization_bo.party_site_objs(j).parent_object_id,
157                                                         p_hz_organization_bo.party_site_objs(j).party_site_number,
158                                                         p_hz_organization_bo.party_site_objs(j).mailstop,
159                                                         p_hz_organization_bo.party_site_objs(j).identifying_address_flag,
160                                                         p_hz_organization_bo.party_site_objs(j).status,
161                                                         p_hz_organization_bo.party_site_objs(j).party_site_name,
162                                                         p_hz_organization_bo.party_site_objs(j).attribute_category,
163                                                         p_hz_organization_bo.party_site_objs(j).attribute1,
164                                                         p_hz_organization_bo.party_site_objs(j).attribute2,
165                                                         p_hz_organization_bo.party_site_objs(j).attribute3,
166                                                         p_hz_organization_bo.party_site_objs(j).attribute4,
167                                                         p_hz_organization_bo.party_site_objs(j).attribute5,
168                                                         p_hz_organization_bo.party_site_objs(j).attribute6,
169                                                         p_hz_organization_bo.party_site_objs(j).attribute7,
170                                                         p_hz_organization_bo.party_site_objs(j).attribute8,
171                                                         p_hz_organization_bo.party_site_objs(j).attribute9,
172                                                         p_hz_organization_bo.party_site_objs(j).attribute10,
173                                                         p_hz_organization_bo.party_site_objs(j).attribute11,
174                                                         p_hz_organization_bo.party_site_objs(j).attribute12,
175                                                         p_hz_organization_bo.party_site_objs(j).attribute13,
176                                                         p_hz_organization_bo.party_site_objs(j).attribute14,
177                                                         p_hz_organization_bo.party_site_objs(j).attribute15,
178                                                         p_hz_organization_bo.party_site_objs(j).attribute16,
179                                                         p_hz_organization_bo.party_site_objs(j).attribute17,
180                                                         p_hz_organization_bo.party_site_objs(j).attribute18,
181                                                         p_hz_organization_bo.party_site_objs(j).attribute19,
182                                                         p_hz_organization_bo.party_site_objs(j).attribute20,
183                                                         p_hz_organization_bo.party_site_objs(j).language,
184                                                         p_hz_organization_bo.party_site_objs(j).addressee,
185                                                         p_hz_organization_bo.party_site_objs(j).program_update_date,
186                                                         p_hz_organization_bo.party_site_objs(j).created_by_module,
187                                                         p_hz_organization_bo.party_site_objs(j).created_by_name,
188                                                         p_hz_organization_bo.party_site_objs(j).creation_date,
189                                                         p_hz_organization_bo.party_site_objs(j).last_update_date,
190                                                         p_hz_organization_bo.party_site_objs(j).last_updated_by_name,
191                                                         p_hz_organization_bo.party_site_objs(j).actual_content_source,
192                                                         p_hz_organization_bo.party_site_objs(j).global_location_number,
193                                                         p_hz_organization_bo.party_site_objs(j).orig_sys_objs,
194                                                         p_hz_organization_bo.party_site_objs(j).ext_attributes_objs,
195                                                         p_hz_organization_bo.party_site_objs(j).location_obj,
196                                                         p_hz_organization_bo.party_site_objs(j).party_site_use_objs,
197                                                         p_hz_organization_bo.party_site_objs(j).phone_objs,
198                                                         p_hz_organization_bo.party_site_objs(j).telex_objs,
199                                                         p_hz_organization_bo.party_site_objs(j).email_objs,
200                                                         p_hz_organization_bo.party_site_objs(j).web_objs,
201                                                         p_hz_organization_bo.party_site_objs(j).contact_pref_objs);
202 
203         END LOOP;
204     END IF;
205         p_pos_organization_bo := pos_organization_bo(p_hz_organization_bo.action_type,
206                                                  p_hz_organization_bo.common_obj_id,
207                                                  p_hz_organization_bo.organization_id,
208                                                  p_hz_organization_bo.orig_system,
209                                                  p_hz_organization_bo.orig_system_reference,
210                                                  p_hz_organization_bo.party_number,
211                                                  p_hz_organization_bo.validated_flag,
212                                                  p_hz_organization_bo.status,
213                                                  p_hz_organization_bo.category_code,
214                                                  p_hz_organization_bo.salutation,
215                                                  p_hz_organization_bo.attribute_category,
216                                                  p_hz_organization_bo.attribute1,
217                                                  p_hz_organization_bo.attribute2,
218                                                  p_hz_organization_bo.attribute3,
219                                                  p_hz_organization_bo.attribute4,
220                                                  p_hz_organization_bo.attribute5,
221                                                  p_hz_organization_bo.attribute6,
222                                                  p_hz_organization_bo.attribute7,
223                                                  p_hz_organization_bo.attribute8,
224                                                  p_hz_organization_bo.attribute9,
225                                                  p_hz_organization_bo.attribute10,
226                                                  p_hz_organization_bo.attribute11,
227                                                  p_hz_organization_bo.attribute12,
228                                                  p_hz_organization_bo.attribute13,
229                                                  p_hz_organization_bo.attribute14,
230                                                  p_hz_organization_bo.attribute15,
231                                                  p_hz_organization_bo.attribute16,
232                                                  p_hz_organization_bo.attribute17,
233                                                  p_hz_organization_bo.attribute18,
234                                                  p_hz_organization_bo.attribute19,
235                                                  p_hz_organization_bo.attribute20,
236                                                  p_hz_organization_bo.attribute21,
237                                                  p_hz_organization_bo.attribute22,
238                                                  p_hz_organization_bo.attribute23,
239                                                  p_hz_organization_bo.attribute24,
240                                                  p_hz_organization_bo.organization_name,
241                                                  p_hz_organization_bo.duns_number_c,
242                                                  p_hz_organization_bo.enquiry_duns,
243                                                  p_hz_organization_bo.ceo_name,
244                                                  p_hz_organization_bo.ceo_title,
245                                                  p_hz_organization_bo.principal_name,
246                                                  p_hz_organization_bo.principal_title,
247                                                  p_hz_organization_bo.legal_status,
248                                                  p_hz_organization_bo.control_yr,
249                                                  p_hz_organization_bo.employees_total,
250                                                  p_hz_organization_bo.hq_branch_ind,
251                                                  p_hz_organization_bo.branch_flag,
252                                                  p_hz_organization_bo.oob_ind,
253                                                  p_hz_organization_bo.line_of_business,
254                                                  p_hz_organization_bo.cong_dist_code,
255                                                  p_hz_organization_bo.sic_code,
256                                                  p_hz_organization_bo.import_ind,
257                                                  p_hz_organization_bo.export_ind,
258                                                  p_hz_organization_bo.labor_surplus_ind,
259                                                  p_hz_organization_bo.debarment_ind,
260                                                  p_hz_organization_bo.minority_owned_ind,
261                                                  p_hz_organization_bo.minority_owned_type,
262                                                  p_hz_organization_bo.woman_owned_ind,
263                                                  p_hz_organization_bo.disadv_8a_ind,
264                                                  p_hz_organization_bo.small_bus_ind,
265                                                  p_hz_organization_bo.rent_own_ind,
266                                                  p_hz_organization_bo.debarments_count,
267                                                  p_hz_organization_bo.debarments_date,
268                                                  p_hz_organization_bo.failure_score,
269                                                  p_hz_organization_bo.failure_score_natnl_per,
270                                                  p_hz_organization_bo.failure_score_override_code,
271                                                  p_hz_organization_bo.failure_score_commentary,
272                                                  p_hz_organization_bo.global_failure_score,
273                                                  p_hz_organization_bo.db_rating,
274                                                  p_hz_organization_bo.credit_score,
275                                                  p_hz_organization_bo.credit_score_commentary,
276                                                  p_hz_organization_bo.paydex_score,
277                                                  p_hz_organization_bo.paydex_three_months_ago,
278                                                  p_hz_organization_bo.paydex_norm,
279                                                  p_hz_organization_bo.best_time_contact_begin,
280                                                  p_hz_organization_bo.best_time_contact_end,
281                                                  p_hz_organization_bo.organization_name_phonetic,
282                                                  p_hz_organization_bo.tax_reference,
283                                                  p_hz_organization_bo.gsa_indicator_flag,
284                                                  p_hz_organization_bo.jgzz_fiscal_code,
285                                                  p_hz_organization_bo.analysis_fy,
286                                                  p_hz_organization_bo.fiscal_yearend_month,
287                                                  p_hz_organization_bo.curr_fy_potential_revenue,
288                                                  p_hz_organization_bo.next_fy_potential_revenue,
289                                                  p_hz_organization_bo.year_established,
290                                                  p_hz_organization_bo.mission_statement,
291                                                  p_hz_organization_bo.organization_type,
292                                                  p_hz_organization_bo.business_scope,
293                                                  p_hz_organization_bo.corporation_class,
294                                                  p_hz_organization_bo.known_as,
295                                                  p_hz_organization_bo.known_as2,
296                                                  p_hz_organization_bo.known_as3,
297                                                  p_hz_organization_bo.known_as4,
298                                                  p_hz_organization_bo.known_as5,
299                                                  p_hz_organization_bo.local_bus_iden_type,
300                                                  p_hz_organization_bo.local_bus_identifier,
301                                                  p_hz_organization_bo.pref_functional_currency,
302                                                  p_hz_organization_bo.registration_type,
303                                                  p_hz_organization_bo.total_employees_text,
304                                                  p_hz_organization_bo.total_employees_ind,
305                                                  p_hz_organization_bo.total_emp_est_ind,
306                                                  p_hz_organization_bo.total_emp_min_ind,
307                                                  p_hz_organization_bo.parent_sub_ind,
308                                                  p_hz_organization_bo.incorp_year,
309                                                  p_hz_organization_bo.sic_code_type,
310                                                  p_hz_organization_bo.public_private_owner_flag,
311                                                  p_hz_organization_bo.internal_flag,
312                                                  p_hz_organization_bo.local_activity_code_type,
313                                                  p_hz_organization_bo.local_activity_code,
314                                                  p_hz_organization_bo.emp_at_primary_adr,
315                                                  p_hz_organization_bo.emp_at_primary_adr_text,
316                                                  p_hz_organization_bo.emp_at_primary_adr_est_ind,
317                                                  p_hz_organization_bo.emp_at_primary_adr_min_ind,
318                                                  p_hz_organization_bo.high_credit,
319                                                  p_hz_organization_bo.avg_high_credit,
320                                                  p_hz_organization_bo.total_payments,
321                                                  p_hz_organization_bo.credit_score_class,
322                                                  p_hz_organization_bo.credit_score_natl_percentile,
323                                                  p_hz_organization_bo.credit_score_incd_default,
324                                                  p_hz_organization_bo.credit_score_age,
325                                                  p_hz_organization_bo.credit_score_date,
326                                                  p_hz_organization_bo.credit_score_commentary2,
327                                                  p_hz_organization_bo.credit_score_commentary3,
328                                                  p_hz_organization_bo.credit_score_commentary4,
329                                                  p_hz_organization_bo.credit_score_commentary5,
330                                                  p_hz_organization_bo.credit_score_commentary6,
331                                                  p_hz_organization_bo.credit_score_commentary7,
332                                                  p_hz_organization_bo.credit_score_commentary8,
333                                                  p_hz_organization_bo.credit_score_commentary9,
334                                                  p_hz_organization_bo.credit_score_commentary10,
335                                                  p_hz_organization_bo.failure_score_class,
336                                                  p_hz_organization_bo.failure_score_incd_default,
337                                                  p_hz_organization_bo.failure_score_age,
338                                                  p_hz_organization_bo.failure_score_date,
339                                                  p_hz_organization_bo.failure_score_commentary2,
340                                                  p_hz_organization_bo.failure_score_commentary3,
341                                                  p_hz_organization_bo.failure_score_commentary4,
342                                                  p_hz_organization_bo.failure_score_commentary5,
343                                                  p_hz_organization_bo.failure_score_commentary6,
344                                                  p_hz_organization_bo.failure_score_commentary7,
345                                                  p_hz_organization_bo.failure_score_commentary8,
346                                                  p_hz_organization_bo.failure_score_commentary9,
347                                                  p_hz_organization_bo.failure_score_commentary10,
348                                                  p_hz_organization_bo.maximum_credit_recommend,
349                                                  p_hz_organization_bo.maximum_credit_currency_code,
350                                                  p_hz_organization_bo.displayed_duns_party_id,
351                                                  p_hz_organization_bo.program_update_date,
352                                                  p_hz_organization_bo.created_by_module,
353                                                  p_hz_organization_bo.created_by_name,
354                                                  p_hz_organization_bo.creation_date,
355                                                  p_hz_organization_bo.last_update_date,
356                                                  p_hz_organization_bo.last_updated_by_name,
357                                                  p_hz_organization_bo.do_not_confuse_with,
358                                                  p_hz_organization_bo.actual_content_source,
359                                                  p_hz_organization_bo.orig_sys_objs,
360                                                  p_hz_organization_bo.ext_attributes_objs,
361                                                  l_contact_objs,
362                                                  l_party_site_objs_2,
363                                                  p_hz_organization_bo.preference_objs,
364                                                  p_hz_organization_bo.phone_objs,
365                                                  p_hz_organization_bo.telex_objs,
366                                                  p_hz_organization_bo.email_objs,
367                                                  p_hz_organization_bo.web_objs,
368                                                  p_hz_organization_bo.edi_objs,
369                                                  p_hz_organization_bo.eft_objs,
370                                                  p_hz_organization_bo.relationship_objs,
371                                                  p_hz_organization_bo.class_objs,
372                                                  p_hz_organization_bo.financial_report_objs,
373                                                  p_hz_organization_bo.credit_rating_objs,
374                                                  p_hz_organization_bo.certification_objs,
375                                                  p_hz_organization_bo.financial_prof_objs,
376                                                  p_hz_organization_bo.contact_pref_objs,
377                                                  p_hz_organization_bo.party_usage_objs);
378 
379     EXCEPTION
380         WHEN OTHERS THEN
381         fnd_file.put_line(fnd_file.log,'exception detected in assign_organization.');
382           RAISE;
383 
384     END assign_organization;
385 
386     /*#
387     * Use this routine to get supplier BO
388     * @param p_api_version The api version
389     * @param p_init_msg_list The Initialization message list
390     * @param p_party_id The party_id
391     * @param p_orig_system The Orig System
392     * @param p_orig_system_reference The Orig System Reference
393     * @param x_pos_supplier_bo The supplier bo
394     * @param x_return_status The return status
395     * @param x_msg_count The message count
396     * @param x_msg_data The message data
397     * @rep:scope public
398     * @rep:lifecycle active
399     * @rep:displayname Get Supplier All BO
400     * @rep:catagory BUSSINESS_ENTITY AP_SUPPLIER
401     */
402     PROCEDURE pos_get_supplier_bo(p_api_version           IN NUMBER DEFAULT NULL,
403                                   p_init_msg_list         IN VARCHAR2 DEFAULT NULL,
404                                   p_party_id              IN NUMBER,
405                                   p_orig_system           IN VARCHAR2,
406                                   p_orig_system_reference IN VARCHAR2,
407                                   x_pos_supplier_bo       OUT NOCOPY pos_supplier_bo,
408                                   x_return_status         OUT NOCOPY VARCHAR2,
409                                   x_msg_count             OUT NOCOPY NUMBER,
410                                   x_msg_data              OUT NOCOPY VARCHAR2) IS
411 
412         l_api_version   NUMBER;
413         l_init_msg_list VARCHAR2(1000);
414         l_return_status VARCHAR2(20);
415         l_msg_count     NUMBER;
416         l_msg_data      VARCHAR2(1000);
417         x_ap_supplier_bo             pos_ap_supplier_bo;
418         x_pos_supplier_site_bo       pos_supplier_sites_all_bo_tbl;
419         x_pos_supplier_contact_bo    pos_supplier_contact_bo_tbl;
420         x_pos_business_class_bo_tbl  pos_business_class_bo_tbl;
421         x_pos_tax_profile_bo_tbl     pos_tax_profile_bo_tbl;
422         x_pos_product_service_bo_tbl pos_product_service_bo_tbl;
423         x_pos_bank_payment_bo_tbl    pos_bank_payment_bo_tbl;
424         x_pos_bank_account_bo_tbl    pos_bank_account_bo_tbl;
425         x_pos_bank_payee_bo_tbl      pos_bank_payee_bo_tbl;
426         x_pos_tax_report_bo_tbl      pos_tax_report_bo_tbl;
427         x_hz_organization_bo         hz_organization_bo;
428         x_pos_organization_bo        pos_organization_bo;
429         x_hz_org_contact_bo_tbl      hz_org_contact_bo_tbl;
430         x_hz_locations_bo_tbl        pos_hz_location_bo_tbl;
431         x_hz_party_bo                pos_hz_party_bo;
432         x_pos_supplier_uda           pos_supp_uda_obj_tbl;
433         x_pos_hz_party_site_bo_tbl   pos_hz_party_site_bo_tbl;
434         l_party_id                   NUMBER;
435     BEGIN
436 
437         x_pos_supplier_bo := pos_supplier_bo(NULL,
438                                              NULL,
439                                              NULL,
440                                              pos_supplier_sites_all_bo_tbl(),
441                                              pos_hz_party_site_bo_tbl(),
442                                              pos_supplier_contact_bo_tbl(),
443                                              pos_business_class_bo_tbl(),
444                                              pos_tax_profile_bo_tbl(),
445                                              pos_product_service_bo_tbl(),
446                                              pos_bank_account_bo_tbl(),
447                                              pos_bank_payee_bo_tbl(),
448                                              pos_tax_report_bo_tbl(),
449                                              NULL,
450                                              NULL);
451         IF p_party_id IS NULL THEN
452             l_party_id := pos_supplier_bo_dep_pkg.get_party_id(p_orig_system,
453                                                                p_orig_system_reference);
454             IF l_party_id IS NULL OR l_party_id = 0 THEN
455                 x_return_status := fnd_api.g_ret_sts_unexp_error;
456                 x_msg_data      := 'Unable to retrieve Party ID';
457                 RETURN;
458             END IF;
459 
460         ELSE
461 
462             l_party_id := p_party_id;
463         END IF;
464 
465         --populating ap_supplier data;
466        pos_ap_supplier_bo_pkg.get_ap_supplier_bo(p_api_version,
467                                                   p_init_msg_list,
468                                                   l_party_id,
469                                                   p_orig_system,
470                                                   p_orig_system_reference,
471                                                   x_ap_supplier_bo,
472                                                   x_return_status,
473                                                   x_msg_count,
474                                                   x_msg_data);
475        IF x_msg_data IS NULL THEN
476           fnd_file.put_line(fnd_file.log,'Extracted the Supplier Data');
477        ELSE
478           fnd_file.put_line(fnd_file.log,'Extracting the Supplier Data: Exception: '||x_msg_data);
479        END IF;
480 
481         /*pos_supplier_uda_bo_pkg.get_uda_data(p_api_version      ,
482         NULL    ,
483          NULL,
484          'SUPP_LEVEL',
485          x_pos_supplier_uda ,
486          x_return_status    ,
487          x_msg_count        ,
488          x_msg_data         );*/
489 
490 	--populating ap_supplier_site data;
491         pos_ap_supplier_site_bo_pkg.get_pos_supplier_sites_bo_tbl(p_api_version,
492                                                                   p_init_msg_list,
493                                                                   l_party_id,
494                                                                   p_orig_system,
495                                                                   p_orig_system_reference,
496                                                                   x_pos_supplier_site_bo,
497                                                                   x_return_status,
498                                                                   x_msg_count,
499                                                                   x_msg_data);
500        IF x_msg_data IS NULL THEN
501           fnd_file.put_line(fnd_file.log,'Extracted the Supplier Site Data');
502        ELSE
503           fnd_file.put_line(fnd_file.log,'Extracting the Supplier Site Data: Exception: '||x_msg_data);
504        END IF;
505 
506 
507         pos_hz_party_site_bo_tbl_pkg.get_party_site_bos(l_party_id,
508                                                         x_pos_hz_party_site_bo_tbl,
509                                                         x_return_status,
510                                                         x_msg_count,
511                                                         x_msg_data);
512 
513         IF x_msg_data IS NULL THEN
514           fnd_file.put_line(fnd_file.log,'Extracted the Party Site Data');
515         ELSE
516           fnd_file.put_line(fnd_file.log,'Extracting the Party Site Data: Exception: '||x_msg_data);
517         END IF;
518 
519         -- Bug 12795884: Populating bank account data
520 
521         pos_bank_account_bo_pkg.get_pos_bank_account_bo_tbl(p_api_version,
522         p_init_msg_list,
523         p_party_id,
524         p_orig_system,
525         p_orig_system_reference,
526         x_pos_bank_account_bo_tbl,
527         x_return_status,
528         x_msg_count,
529         x_msg_data);
530 
531         IF x_msg_data IS NULL THEN
532           fnd_file.put_line(fnd_file.log,'Extracted the Bank Account Data');
533         ELSE
534           fnd_file.put_line(fnd_file.log,'Extracting the Bank Account Data: Exception: '||x_msg_data);
535         END IF;
536 
537         -- End Bug 12795884
538 
539         --organization
540         hz_organization_bo_pub.get_organization_bo(p_init_msg_list,
541                                                    l_party_id,
542                                                    p_orig_system,
543                                                    p_orig_system_reference,
544                                                    x_hz_organization_bo,
545                                                    x_return_status,
546                                                    x_msg_count,
547                                                    x_msg_data);
548 
549         IF x_msg_data IS NULL THEN
550           fnd_file.put_line(fnd_file.log,'Extracted the Supplier Organization Data');
551         ELSE
552           fnd_file.put_line(fnd_file.log,'Extracting the Supplier Organization Data: Exception: '||x_msg_data);
553         END IF;
554 
555         --populating business class  data;
556         pos_business_class_bo_pkg.get_pos_business_class_bo_tbl(p_api_version,
557                                                                 p_init_msg_list,
558                                                                 p_party_id,
559                                                                 p_orig_system,
560                                                                 p_orig_system_reference,
561                                                                 x_pos_business_class_bo_tbl,
562                                                                 x_return_status,
563                                                                 x_msg_count,
564                                                                 x_msg_data);
565         IF x_msg_data IS NULL THEN
566           fnd_file.put_line(fnd_file.log,'Extracted the Supplier Business Class Data');
567         ELSE
568           fnd_file.put_line(fnd_file.log,'Extracting the Supplier Business Class Data: Exception: '||x_msg_data);
569         END IF;
570 
571         --populating bank payee  data;
572         pos_bank_payee_bo_pkg.get_pos_bank_payee_bo_tbl(p_api_version,
573                                                         p_init_msg_list,
574                                                         p_party_id,
575                                                         p_orig_system,
576                                                         p_orig_system_reference,
577                                                         x_pos_bank_payee_bo_tbl,
578                                                         x_return_status,
579                                                         x_msg_count,
580                                                         x_msg_data);
581         IF x_msg_data IS NULL THEN
582           fnd_file.put_line(fnd_file.log,'Extracted the Bank Payee Data');
583         ELSE
584           fnd_file.put_line(fnd_file.log,'Extracting the Bank Payee Data: Exception: '||x_msg_data);
585         END IF;
586 
587 
588         --Populating Party Data
589         pos_hz_party_bo_pkg.get_hz_party_bo(p_api_version,
590                                             p_init_msg_list,
591                                             p_party_id,
592 
593                                             x_hz_party_bo,
594                                             x_return_status,
595                                             x_msg_count,
596                                             x_msg_data);
597         IF x_msg_data IS NULL THEN
598           fnd_file.put_line(fnd_file.log,'Extracted the Party Data');
599         ELSE
600           fnd_file.put_line(fnd_file.log,'Extracting the Party Data: Exception: '||x_msg_data);
601         END IF;
602 
603         --populating product services data
604         pos_product_service_bo_pkg.get_pos_product_service_bo_tbl(p_api_version,
605                                                                   p_init_msg_list,
606                                                                   p_party_id,
607                                                                   p_orig_system,
608                                                                   p_orig_system_reference,
609                                                                   x_pos_product_service_bo_tbl,
610                                                                   x_return_status,
611                                                                   x_msg_count,
612                                                                   x_msg_data);
613         IF (x_msg_data IS NULL or x_msg_data='SUCCESS' )THEN
614           fnd_file.put_line(fnd_file.log,'Extracted the Supplier Product Services Data');
615         ELSE
616           fnd_file.put_line(fnd_file.log,'Extracting the Supplier Product Services Data: Exception: '||x_msg_data);
617         END IF;
618 
619         --Populating supplier contacts data
620         pos_supplier_contact_bo_pkg.get_pos_supp_contact_bo_tbl(p_api_version,
621                                                                 p_init_msg_list,
622                                                                 p_party_id,
623                                                                 p_orig_system,
624                                                                 p_orig_system_reference,
625                                                                 x_pos_supplier_contact_bo,
626                                                                 x_return_status,
627                                                                 x_msg_count,
628                                                                 x_msg_data);
629         IF x_msg_data IS NULL THEN
630           fnd_file.put_line(fnd_file.log,'Extracted the Supplier Contact Data');
631         ELSE
632           fnd_file.put_line(fnd_file.log,'Extracting the Supplier Contact Data: Exception: '||x_msg_data);
633         END IF;
634 
635         --populating tax profile data
636         pos_supplier_tax_prof_bo_pkg.get_pos_sup_tax_prof_bo_tbl(p_api_version,
637                                                                  p_init_msg_list,
638                                                                  p_party_id,
639                                                                  p_orig_system,
640                                                                  p_orig_system_reference,
641                                                                  x_pos_tax_profile_bo_tbl,
642                                                                  x_return_status,
643                                                                  x_msg_count,
644                                                                  x_msg_data);
645         IF x_msg_data IS NULL THEN
646           fnd_file.put_line(fnd_file.log,'Extracted the Supplier Tax Profile Data');
647         ELSE
648           fnd_file.put_line(fnd_file.log,'Extracting the Supplier Tax Profile Data: Exception: '||x_msg_data);
649         END IF;
650 
651         --Populating tax reporting data
652         pos_tax_report_bo_pkg.get_pos_tax_report_bo_tbl(p_api_version,
653                                                         p_init_msg_list,
654                                                         p_party_id,
655                                                         p_orig_system,
656                                                         p_orig_system_reference,
657                                                         x_pos_tax_report_bo_tbl,
658                                                         x_return_status,
659                                                         x_msg_count,
660                                                         x_msg_data);
661         IF x_msg_data IS NULL THEN
662           fnd_file.put_line(fnd_file.log,'Extracted the Supplier Tax Report Data');
663         ELSE
664           fnd_file.put_line(fnd_file.log,'Extracting the Supplier Tax Report Data: Exception: '||x_msg_data);
665         END IF;
666 
667        --Populating Location data
668         pos_hz_location_bo_pkg.get_hz_location_bo(p_api_version,
669                                                   p_init_msg_list,
670                                                   p_party_id,
671                                                   p_orig_system,
672                                                   p_orig_system_reference,
673                                                   x_hz_locations_bo_tbl,
674                                                   x_return_status,
675                                                   x_msg_count,
676                                                   x_msg_data);
677 
678         IF x_msg_data IS NULL THEN
679           fnd_file.put_line(fnd_file.log,'Extracted the Supplier Location Data');
680         ELSE
681           fnd_file.put_line(fnd_file.log,'Extracting the Supplier Location Data: Exception: '||x_msg_data);
682         END IF;
683 
684         x_pos_supplier_bo.p_pos_ap_supplier_bo := x_ap_supplier_bo;
685         x_pos_supplier_bo.p_pos_supplier_sites_all_tbl  := x_pos_supplier_site_bo;
686         x_pos_supplier_bo.p_pos_supplier_contact_bo_tbl := x_pos_supplier_contact_bo;
687         x_pos_supplier_bo.p_pos_business_class_bo_tbl   := x_pos_business_class_bo_tbl;
688         x_pos_supplier_bo.p_pos_tax_profile_bo_tbl      := x_pos_tax_profile_bo_tbl;
689         x_pos_supplier_bo.p_pos_product_service_bo_tbl  := x_pos_product_service_bo_tbl;
690 
691         x_pos_supplier_bo.p_pos_bank_account_bo_tbl    := x_pos_bank_account_bo_tbl;
692         x_pos_supplier_bo.p_pos_bank_payee_bo_tbl    := x_pos_bank_payee_bo_tbl;
693         x_pos_supplier_bo.p_pos_tax_report_bo_tbl    := x_pos_tax_report_bo_tbl;
694         x_pos_supplier_bo.p_pos_hz_party_bo          := x_hz_party_bo;
695         x_pos_supplier_bo.p_pos_hz_party_site_bo_tbl := x_pos_hz_party_site_bo_tbl;
696 
697         assign_organization(x_hz_organization_bo,x_pos_supplier_bo.p_hz_organization_bo);
698 
699         x_pos_supplier_bo.p_hz_locations_bo    := x_hz_locations_bo_tbl;
700         x_pos_supplier_bo.party_id             := l_party_id;
701 
702     EXCEPTION
703         WHEN fnd_api.g_exc_error THEN
704             x_return_status := fnd_api.g_ret_sts_error;
705             x_msg_count     := 1;
706             x_msg_data      := SQLCODE || SQLERRM;
707         WHEN fnd_api.g_exc_unexpected_error THEN
708             x_return_status := fnd_api.g_ret_sts_unexp_error;
709             x_msg_count     := 1;
710             x_msg_data      := SQLCODE || SQLERRM;
711         WHEN OTHERS THEN
712             x_return_status := fnd_api.g_ret_sts_unexp_error;
713             x_msg_count := 1;
714             x_msg_data  := SQLCODE || SQLERRM;
715     END pos_get_supplier_bo;
716 
717     PROCEDURE pos_create_update_supplier_bo(p_api_version           IN NUMBER DEFAULT NULL,
718                                             p_init_msg_list         IN VARCHAR2 DEFAULT NULL,
719                                             p_party_id              IN NUMBER,
720                                             p_orig_system           IN VARCHAR2,
721                                             p_orig_system_reference IN VARCHAR2,
722                                             p_create_update_flag    IN VARCHAR2,
723                                             p_pos_supplier_bo       IN pos_supplier_bo,
724                                             x_return_status         OUT NOCOPY VARCHAR2,
725                                             x_msg_count             OUT NOCOPY NUMBER,
726                                             x_msg_data              OUT NOCOPY VARCHAR2) IS
727         l_party_id          NUMBER;
728         p_request_status    VARCHAR2(20);
729         x_vendor_contact_id NUMBER;
730         x_per_party_id      NUMBER;
731         x_rel_party_id      NUMBER;
732         x_rel_id            NUMBER;
733         x_org_contact_id    NUMBER;
734         x_party_site_id     NUMBER;
735         x_tax_profile_id    NUMBER;
736         x_vendor_id         NUMBER;
737         x_party_id          NUMBER;
738         x_vendor_site_id    NUMBER;
739         x_location_id       NUMBER;
740     BEGIN
741 
742         IF p_party_id IS NULL THEN
743             l_party_id := pos_supplier_bo_dep_pkg.get_party_id(p_orig_system,
744                                                                p_orig_system_reference);
745         ELSE
746             l_party_id := p_party_id;
747         END IF;
748 
749         pos_ap_supplier_bo_pkg.create_pos_ap_supplier(p_api_version,
750                                                       p_init_msg_list,
751                                                       p_pos_supplier_bo.p_pos_ap_supplier_bo,
752                                                       l_party_id,
753                                                       p_orig_system,
754                                                       p_orig_system_reference,
755                                                       p_create_update_flag,
756                                                       x_vendor_id,
757                                                       x_party_id,
758                                                       x_return_status,
759                                                       x_msg_count,
760                                                       x_msg_data);
761 
762         pos_ap_supplier_site_bo_pkg.create_pos_supplier_site_bo(p_api_version,
763                                                                 p_init_msg_list,
764                                                                 p_pos_supplier_bo.p_pos_supplier_sites_all_tbl,
765                                                                 p_party_id,
766                                                                 p_orig_system,
767                                                                 p_orig_system_reference,
768                                                                 p_create_update_flag,
769                                                                 x_vendor_site_id,
770                                                                 x_party_site_id,
771                                                                 x_location_id,
772                                                                 x_return_status,
773                                                                 x_msg_count,
774                                                                 x_msg_data);
775 
776         pos_business_class_bo_pkg.create_bus_class_attr(p_api_version,
777                                                         p_init_msg_list,
778                                                         p_pos_supplier_bo.p_pos_business_class_bo_tbl,
779                                                         p_party_id,
780                                                         p_orig_system,
781                                                         p_orig_system_reference,
782                                                         p_create_update_flag,
783                                                         x_return_status,
784                                                         x_msg_count,
785                                                         x_msg_data);
786 
787         pos_bank_payee_bo_pkg.create_pos_bank_payee_bo_tbl(p_api_version,
788                                                            p_init_msg_list,
789                                                            p_pos_supplier_bo.p_pos_bank_payee_bo_tbl,
790                                                            p_party_id,
791                                                            p_orig_system,
792                                                            p_orig_system_reference,
793                                                            p_create_update_flag,
794                                                            x_return_status,
795                                                            x_msg_count,
796                                                            x_msg_data);
797 
798         --populating product services data
799         pos_product_service_bo_pkg.create_pos_product_service(p_api_version,
800                                                               p_init_msg_list,
801                                                               p_pos_supplier_bo.p_pos_product_service_bo_tbl,
802                                                               p_request_status,
803                                                               p_party_id,
804                                                               p_orig_system,
805                                                               p_orig_system_reference,
806                                                               x_return_status,
807                                                               x_msg_count,
808                                                               x_msg_data);
809 
810         --Populating supplier contacts data
811         pos_supplier_contact_bo_pkg.create_pos_supp_contact_bo(p_api_version,
812                                                                p_init_msg_list,
813                                                                p_pos_supplier_bo.p_pos_supplier_contact_bo_tbl,
814                                                                p_party_id,
815                                                                p_orig_system,
816                                                                p_orig_system_reference,
817                                                                p_create_update_flag,
818                                                                x_vendor_contact_id,
819                                                                x_per_party_id,
820                                                                x_rel_party_id,
821                                                                x_rel_id,
822                                                                x_org_contact_id,
823                                                                x_party_site_id,
824                                                                x_return_status,
825                                                                x_msg_count,
826                                                                x_msg_data);
827         --populating tax profile data
828 
829         pos_supplier_tax_prof_bo_pkg.create_supp_tax_profile(p_api_version,
830                                                              p_init_msg_list,
831                                                              p_pos_supplier_bo.p_pos_tax_profile_bo_tbl,
832                                                              p_party_id,
833                                                              p_orig_system,
834                                                              p_orig_system_reference,
835                                                              p_create_update_flag,
836                                                              x_return_status,
837                                                              x_msg_count,
838                                                              x_msg_data,
839                                                              x_tax_profile_id);
840 
841         --Populating tax reporting data
842         pos_tax_report_bo_pkg.create_pos_tax_report_bo_row(p_api_version,
843                                                            p_init_msg_list,
844                                                            p_party_id,
845                                                            p_orig_system,
846                                                            p_orig_system_reference,
847                                                            p_create_update_flag,
848                                                            p_pos_supplier_bo.p_pos_tax_report_bo_tbl,
849                                                            x_return_status,
850                                                            x_msg_count,
851                                                            x_msg_data);
852 
853         /*--Populating relationship data
854         pos_supplier_bo_dep_pkg.get_relationship_bos(p_init_msg_list,
855 
856                                                      p_party_id,
857                                                      NULL,
858                                                      x_hz_relationship_obj_tbl,
859                                                      x_return_status,
860                                                      x_msg_count,
861                                                      x_msg_data);*/
862 
863         --Populate organization data
864         /* pos_supplier_bo_dep_pkg.get_organization_bo(p_init_msg_list,
865         p_party_id,
866         NULL,
867         x_hz_organization_bo,
868         x_return_status,
869         x_msg_count,
870         x_msg_data);*/
871 
872     EXCEPTION
873         WHEN fnd_api.g_exc_error THEN
874 
875             x_return_status := fnd_api.g_ret_sts_error;
876             x_msg_count     := 1;
877             x_msg_data      := SQLCODE || SQLERRM;
878         WHEN fnd_api.g_exc_unexpected_error THEN
879 
880             x_return_status := fnd_api.g_ret_sts_unexp_error;
881             x_msg_count     := 1;
882             x_msg_data      := SQLCODE || SQLERRM;
883         WHEN OTHERS THEN
884 
885             x_return_status := fnd_api.g_ret_sts_unexp_error;
886 
887             x_msg_count := 1;
888             x_msg_data  := SQLCODE || SQLERRM;
889     END pos_create_update_supplier_bo;
890 
891 END pos_supplier_bo_pkg;