Thursday, 22 August 2013

Auto Invoice Error : The supplied unit of measure and the primary unit of measure of your system item must share the same unit of

When importing invoice from ra_interface_lines_All table the user can be faced with an error : The supplied unit of measure and the primary unit of measure of your system item must share the same unit of.
This error message is generally reported because of either of the below reason:

  1. The Unit of Measure specified for the item in ra_interface_lines_all is different from what is specified in the item setup
  2. The item is not assigned to the warehouse for which the invoice line is being tried to be imported


Monday, 8 April 2013

API to Update External Bank Account Details

When an external bank is created in Oracle the user can access the bank details from the view : iby_ext_banks_v.

For each bank records created in the system Oracle will create a party and a party profile too in the tbale hz_oprganization_profiles. Depending on the business the users may be needed to update the bank details in the system , Oracle has provided us with an API which helps us to update banks in Oracle.

IBY_EXT_BANKACCT_PUB.update_ext_bank

   IBY_EXT_BANKACCT_PUB.update_ext_bank (
                          p_api_version     => 1.0,
                          p_init_msg_list   => FND_API.G_TRUE,
                          p_ext_bank_rec    => l_bank_rec,
                          x_return_status   => l_chr_return_status,
                          x_msg_count       => l_num_count,
                          x_msg_data        => l_msg_data,
                          x_response        => x_response_rec);

When calling the API to update the bank the important parameters to be passed are bank_id and object_Version number.

Bank Id is the Id of the bank which the user can get from iby_ext_banks_v.
Object_version_number : Query the table hz_organization_profiles from with the bank_id:

SELECT max(object_version_number)
     INTO l_num_version_number
     FROM apps.hz_organization_profiles
   WHERE party_id = l_num_bank_id;

Pass the object version number to Oracle , In case this value is not passed to the API , you will get an error message, Cannot lock the record in the table HZ_PARTIES , the record is being updated by another user.

In addition to the above values pass the varibales that you wish to update and the API will take care of it :

Sample code Snippet:

IBY_EXT_BANKACCT_PUB.update_ext_bank (
                          p_api_version     => 1.0,
                          p_init_msg_list   => FND_API.G_TRUE,
                          p_ext_bank_rec    => l_bank_rec,
                          x_return_status   => l_chr_return_status,
                          x_msg_count       => l_num_count,
                          x_msg_data        => l_msg_data,
                          x_response        => x_response_rec);   
             
                         --Check for Sucess API
            fnd_file.put_line(fnd_file.LOG,'x_response_rec.result_message '||        x_response_rec.result_message);    
            IF (l_chr_return_status <> 'S')
            THEN
               FOR i IN 1 .. l_num_count
               LOOP
                  fnd_msg_pub.get (
                                  p_msg_index       => -1,
                                  p_encoded         => 'F',
                                  p_data            => l_msg_data,
                                  p_msg_index_out   => l_msg_index_out);
                  fnd_file.put_line (
                                  fnd_file.LOG,
                                  'Error in Bank  Update  ' || l_msg_data);
                            END LOOP;
                ELSE
                   fnd_file.put_line (fnd_file.LOG,
                                               'Bank Updated Sucessfully  ');
              COMMIT;
              END IF;

Sunday, 10 March 2013

Supplier Payment Methods in Oracle

In Oracle, whenever a  supplier or supplier site is Created in oracle , Oracle will automatically create a payee in the system and depending on the data provided a payment method.

Each payee will define the different attributes which are related to all the aspects of payments for that supplier or supplier site.

For each supplier or supplier site the business might want to define the payment methods i.e. mechanism in which the payment will be made, this might the EFT,WIRE,CHECK etc.

When creating a supplier the API will automatically create the payee and payment method for the supplier will be created, provided a payment method is passed to the API . If we pass NULL to the API in the payment method then no payment method will be created.

Even if the payment method is created in the system but if the PRIMARY_FLAG = 'N' then this payment method will not be visible in the front end.