Tuesday, December 27, 2011

How Create Customers in R12 API



CREATE CUSTOMER:
 r_cust_account_rec_type.account_name := cv_party_data.party_name; r_cust_account_rec_type.account_number := cv_party_data.account_number; r_cust_account_rec_type.tax_header_level_flag := 'Y'; r_cust_account_rec_type.status := NVL (cv_party_data.account_status, 'A'); r_cust_account_rec_type.created_by_module := 'HZ_CPUI'; r_cust_account_rec_type.orig_system_reference := cv_party_data.acct_orig_sys_ref; r_customer_profile_rec_type.profile_class_id := cv_party_data.profile_class_id; r_cust_account_rec_type.Customer_class_code := 'PUBLIC SECTOR COMPANIES'; r_customer_profile_rec_type.dunning_letters := cv_party_data.dunning_letters; r_customer_profile_rec_type.override_terms := cv_party_data.override_terms; r_organization_rec_type.organization_name := cv_party_data.party_name; r_organization_rec_type.party_rec.orig_system_reference := cv_party_data.orig_system_reference; r_organization_rec_type.party_rec.category_code := cv_party_data.category_code; r_organization_rec_type.tax_reference := cv_party_data.tax_reg_number; r_organization_rec_type.jgzz_fiscal_code := cv_party_data.taxpayer_id; r_organization_rec_type.party_rec.status := NVL (cv_party_data.status, 'A'); r_customer_profile_rec_type.credit_balance_statements := cv_party_data.credit_balance_statements; r_customer_profile_rec_type.send_statements := cv_party_data.statements; r_customer_profile_rec_type.collector_id := cv_party_data.collector_id; r_customer_profile_rec_type.statement_cycle_id := cv_party_data.statement_cycle_id; r_cust_account_rec_type.global_attribute3 := cv_party_data.attribute2;

 r_organization_rec_type.party_rec.party_id := ln_party_id;


               fnd_msg_pub.initialize;
               hz_cust_account_v2pub.create_cust_account
                      (p_init_msg_list             => fnd_api.g_false,
                       p_cust_account_rec          => r_cust_account_rec_type,
                       p_organization_rec          => r_organization_rec_type,
                       p_customer_profile_rec      => r_customer_profile_rec_type,
                       p_create_profile_amt        => fnd_api.g_true,
                       x_cust_account_id           => ln_cust_account_id,
                       x_account_number            => lc_account_number,
                       x_party_id                  => ln_party_id,
                       x_party_number              => lc_party_number,
                       x_profile_id                => ln_acct_profile_id,
                       x_return_status             => gc_api_return_status,
                       x_msg_count                 => gn_msg_count,
                       x_msg_data                  => gc_msg_data
                      );

CUSTOMER SITES:


1.CREATE LOCATION:-
         r_location_rec_type.country := cv_address_data.country;
         r_location_rec_type.address1 := cv_address_data.address1;

         r_location_rec_type.address2 := cv_address_data.address2;

         r_location_rec_type.address3 := cv_address_data.address3;
         r_location_rec_type.address4 := cv_address_data.address4;
         r_location_rec_type.city := cv_address_data.city;
         r_location_rec_type.postal_code := cv_address_data.postal_code;
         r_location_rec_type.state := cv_address_data.state;
         r_location_rec_type.province := cv_address_data.province;
         r_location_rec_type.county := cv_address_data.county;
         r_location_rec_type.created_by_module := 'HZ_CPUI';
         r_location_rec_type.orig_system_reference := NULL;



         hz_location_v2pub.create_location
                                    (p_init_msg_list      => fnd_api.g_false,
                                     p_location_rec       => r_location_rec_type,
                                     x_location_id        => ln_location_id,
                                     x_return_status      => gc_api_return_status,
                                     x_msg_count          => gn_msg_count,
                                     x_msg_data           => gc_msg_data




2.CREATE PARTY SITE:-





            r_party_site_rec_type.identifying_address_flag :=cv_address_data.identifying_address_flag;
   r_party_site_rec_type.created_by_module := 'HZ_CPUI'; --HZ_CPUI
   r_party_site_rec_type.party_id := p_party_id;
   r_party_site_rec_type.party_site_number:= cv_address_data.party_site_number;
   r_party_site_rec_type.location_id := ln_location_id;
   r_party_site_rec_type.status := 'A';
            r_party_site_rec_type.orig_system_reference :=cv_address_data.orig_system_reference;



            hz_party_site_v2pub.create_party_site
                                (p_init_msg_list          => fnd_api.g_false,
                                 p_party_site_rec         => r_party_site_rec_type,
                                 x_party_site_id          => ln_party_site_id,
                                 x_party_site_number      => lc_party_site_number,
                                 x_return_status          => gc_api_return_status,
                                 x_msg_count              => gn_msg_count,
                                 x_msg_data               => gc_msg_data
                                );




3.CREATE CUSTOMER ACCOUNT SITE:-



            r_cust_acct_site_rec_type.cust_account_id := p_cust_account_id;
            r_cust_acct_site_rec_type.party_site_id := ln_party_site_id;
            r_cust_acct_site_rec_type.created_by_module := 'HZ_CPUI';
            r_cust_acct_site_rec_type.orig_system_reference :=cv_address_data.site_orig_system_reference;
            r_cust_acct_site_rec_type.status := NVL (cv_address_data.status, 'A');
            r_cust_acct_site_rec_type.org_id := cv_address_data.org_id;



            hz_cust_account_site_v2pub.create_cust_acct_site
                          (p_init_msg_list           => fnd_api.g_false,
                           p_cust_acct_site_rec      => r_cust_acct_site_rec_type,
                           x_cust_acct_site_id       => ln_cust_acct_site_id,
                           x_return_status           => gc_api_return_status,
                           x_msg_count               => gn_msg_count,
                           x_msg_data                => gc_msg_data
                          );
4.CREATE CUSTOMER SITE USE:-



  r_cust_site_use_rec_type.gl_id_rec :=cv_cust_site_use.receivable;--l_site_receivable_cc_id;
r_cust_site_use_rec_type.gl_id_rev :=cv_cust_site_use.revenue;--l_site_revenue_cc_id;
r_cust_site_use_rec_type.gl_id_tax :=cv_cust_site_use.tax;--l_site_tax_cc_id;
r_cust_site_use_rec_type.territory_id:= cv_cust_site_use.territory_id;
r_cust_site_use_rec_type.payment_term_id:=cv_cust_site_use.term_id;
r_cust_site_use_rec_type.primary_salesrep_id:=cv_cust_site_use.salesrep_id;
         r_cust_site_use_rec_type.tax_reference := cv_cust_site_use.tax_reference;
         r_cust_site_use_rec_type.LOCATION := cv_cust_site_use.LOCATION;
         r_cust_site_use_rec_type.created_by_module := 'HZ_CPUI';
         r_cust_site_use_rec_type.status := 'A';
         r_cust_site_use_rec_type.org_id := cv_cust_site_use.org_id;
         r_cust_site_use_rec_type.primary_flag :=cv_cust_site_use.primary_flag;
         r_customer_profile_rec_type.profile_class_id := cv_cust_site_use.profile_class_id;
         r_customer_profile_rec_type.dunning_letters :=  cv_cust_site_use.dunning_letters;
         r_customer_profile_rec_type.override_terms :=   cv_cust_site_use.override_terms;


         hz_cust_account_site_v2pub.create_cust_site_use
                      (p_init_msg_list             => fnd_api.g_false,
                       p_cust_site_use_rec         => r_cust_site_use_rec_type,
                       p_customer_profile_rec      => r_customer_profile_rec_type,
                       -- Modified by YerraS on 19-Sep-09
                       p_create_profile            => FND_API.G_TRUE,
                       p_create_profile_amt        => FND_API.G_TRUE,
                       x_site_use_id               => ln_site_use_id,
                       x_return_status             => gc_api_return_status,
                       x_msg_count                 => gn_msg_count,
                       x_msg_data                  => gc_msg_data
                      );











2 comments:

  1. Hi,,

    Please do have any example?

    ReplyDelete
  2. Please dont put your advertisement in all posts...

    ReplyDelete