DBA Data[Home] [Help]

PACKAGE BODY: APPS.JTF_CUSTOMER_ACCOUNTS_PVT

Source


1 PACKAGE BODY JTF_CUSTOMER_ACCOUNTS_PVT as
2 /* $Header: JTFVACTB.pls 120.7 2006/06/09 11:01:31 vimohan ship $ */
3 
4   procedure create_account(
5     p_api_version  NUMBER,
6     p_init_msg_list  VARCHAR2,
7     p_commit  VARCHAR2,
8     p_party_id NUMBER,
9     p_account_number VARCHAR2,
10     p_create_amt VARCHAR2,
11     p_party_type VARCHAR2,
12     x_return_status out NOCOPY VARCHAR2,
13     x_msg_count out NOCOPY NUMBER,
14     x_msg_data out  NOCOPY VARCHAR2,
15     x_cust_account_id out NOCOPY  NUMBER,
16     x_cust_account_number out NOCOPY  VARCHAR2,
17     x_party_id out NOCOPY  NUMBER,
18     x_party_number out  NOCOPY VARCHAR2,
19     x_profile_id out  NOCOPY NUMBER,
20     p_account_name IN  VARCHAR2:=FND_API.G_MISS_CHAR)
21   is
22 
23     /*ddp_account_rec      hz_customer_accounts_pub.account_rec_type;
24     ddp_person_rec       hz_party_pub.person_rec_type;
25     ddp_organization_rec hz_party_pub.organization_rec_type;
26     ddp_cust_profile_rec hz_customer_accounts_pub.cust_profile_rec_type;
27     */
28     ddp_account_rec      hz_cust_account_v2pub.cust_account_rec_type;
29     ddp_person_rec       hz_party_v2pub.person_rec_type;
30     ddp_organization_rec hz_party_v2pub.organization_rec_type;
31     ddp_cust_profile_rec hz_customer_profile_v2pub.customer_profile_rec_type;
32     l_gen_cust_num       VARCHAR2(1);
33     profile_class_value        VARCHAR2(15);
34  begin
35     -- pass the account_number if auto generation is off
36     --dbms_application_info.set_client_info(204);
37     /*begin
38       SELECT generate_customer_number INTO l_gen_cust_num
39         FROM ar_system_parameters;
40     exception when no_data_found then
41       l_gen_cust_num := 'Y';
42     end;*/
43 
44  l_gen_cust_num :=  HZ_MO_GLOBAL_CACHE.get_generate_customer_number();
45 
46  -- modified to handle the case where l_gen_cust_num is 'D' or 'N' and we have to pass the account_number.
47  -- We fetch the next value from the sequence each time and hence multiple accounts can be created for same user.
48     IF l_gen_cust_num <> 'Y' THEN
49       select HZ_ACCOUNT_NUM_S.nextval into ddp_account_rec.account_number from dual;
50     END IF;
51       ddp_account_rec.account_name := p_account_name;
52       ddp_account_rec.created_by_module := 'JTA_USER_MANAGEMENT';
53 
54 fnd_profile.get(
55       name   => 'JTA_UM_CUST_PROFILE_CLASS',
56       val    =>   profile_class_value   );
57 
58 if profile_class_value IS NOT NULL then
59  ddp_cust_profile_rec.profile_class_id := to_number(profile_class_value);
60 end if;
61 
62     if p_party_type = 'P' then
63       ddp_person_rec.party_rec.party_id := p_party_id;
64       HZ_CUST_ACCOUNT_V2PUB.create_cust_account(
65         p_init_msg_list,  ddp_account_rec,   ddp_person_rec,
66         ddp_cust_profile_rec, p_create_amt,  x_cust_account_id,
67         x_cust_account_number, x_party_id, x_party_number,
68         x_profile_id, x_return_status, x_msg_count,
69         x_msg_data);
70         if(x_return_status <> fnd_api.g_ret_sts_success)
71         then
72         raise_application_error(-20101,'Failed to create person accountin jtf_cust_account:'||x_msg_data);
73         end if;
74     else
75       ddp_organization_rec.party_rec.party_id := p_party_id;
76         HZ_CUST_ACCOUNT_V2PUB.create_cust_account(
77         p_init_msg_list, ddp_account_rec, ddp_organization_rec,
78         ddp_cust_profile_rec, p_create_amt,    x_cust_account_id,
79         x_cust_account_number,x_party_id,x_party_number,
80         x_profile_id, x_return_status, x_msg_count,
81         x_msg_data);
82     if(x_return_status <> fnd_api.g_ret_sts_success)
83     then
84     raise_application_error(-20101,'Failed to create org accountin jtf_cust_account:'||x_msg_data);
85     end if;
86     end if;
87   end;
88 
89 
90 END jtf_customer_accounts_pvt;