DECLARE
   l_cust_account_rec       hz_cust_account_v2pub.cust_account_rec_type;
   l_organization_rec       hz_party_v2pub.organization_rec_type;
   l_customer_profile_rec   hz_customer_profile_v2pub.customer_profile_rec_type;
   l_party_id               NUMBER;
   l_party_number           VARCHAR2 (240);
   l_profile_id             NUMBER;
   l_cust_account_id        NUMBER;
   l_account_number         VARCHAR2 (240);
   l_return_status          VARCHAR2 (1);
   l_msg_count              NUMBER;
   l_msg_data               VARCHAR2 (1000);
   l_output                 VARCHAR2 (1000);
   l_msg_dummy              VARCHAR2 (1000);
BEGIN
   fnd_global.apps_initialize(user_id in number,resp_id in number,resp_appl_id in number);
   l_cust_account_rec.created_by_module := 'TCA_MIGRATION';
   l_organization_rec.organization_name := 'Test 2';
   hz_cust_account_v2pub.create_cust_account
                   (p_init_msg_list             => 'T',
                    p_cust_account_rec          => l_cust_account_rec,
                    p_organization_rec          => l_organization_rec,
                    p_customer_profile_rec      => l_customer_profile_rec,
                    p_create_profile_amt        => 'T',
                    x_cust_account_id           => l_cust_account_id,
                    x_account_number            => l_account_number,
                    x_party_id                  => l_party_id,
                    x_party_number              => l_party_number,
                    x_profile_id                => l_profile_id,
                    x_return_status             => l_return_status,
                    x_msg_count                 => l_msg_count,
                    x_msg_data                  => l_msg_data
                           );
   IF l_return_status <> 'S'
   THEN
      FOR i IN 1 .. l_msg_count
      LOOP
         fnd_msg_pub.get (i, fnd_api.g_false, l_msg_data, l_msg_dummy);
         l_output := (TO_CHAR (i) || ': ' || l_msg_data);
      END LOOP;
      DBMS_OUTPUT.put_line ('Error mesg' || l_output);
   ELSE
      DBMS_OUTPUT.put_line ('l_party_id ' || l_party_id);
      DBMS_OUTPUT.put_line ('l_cust_account_id ' || l_cust_account_id);
      DBMS_OUTPUT.put_line ('l_profile_id ' || l_profile_id);
   END IF;
END;
 
No comments:
Post a Comment