0 Replies Latest reply: Jan 10, 2012 4:36 PM by user275751 RSS

    Not able to update ship to and bill to address of a customer through IB API

    user275751
      Hello

      I am working on 11.5.10.2, can anybody please let me know how to update ship to and bill to address of an customer on existing item instance through install base update API? I am passing the new party and customer acct id, ship to and bill to address of a customer but new party is getting updated but not account and ship to and bill to address (infact my old customer account, bill to and ship to address are removed when I ran update API but it is not updating with the new customer account and bill to and ship to). I am using the below code for reference.



      X_INSTANCE_REC.INSTANCE_ID               := l_num_avail_instance_id;
      X_INSTANCE_REC.SERIAL_NUMBER               := rec_cur_active_rec.serial_number;
      X_INSTANCE_REC.ACCOUNTING_CLASS_CODE          := 'INV';-- 'CUST_PROD';
      X_INSTANCE_REC.INSTANCE_STATUS_ID          := 1119;--10004;--3; --KI Return for Repair/Cal
      X_INSTANCE_REC.LOCATION_TYPE_CODE := 'HZ_PARTY_SITES';--'HZ_LOCATIONS';
      X_INSTANCE_REC.LOCATION_ID := 10789;--SHIP_TO_PARTY_SITE_ID
      X_INSTANCE_REC.OBJECT_VERSION_NUMBER          := l_num_obj_version_no;--1;

      X_INSTANCE_REC.INSTANCE_USAGE_CODE := 'IN_INVENTORY';
      X_INSTANCE_REC.LAST_OE_RMA_LINE_ID := rec_cur_active_rec.rma_line_id;
      X_INSTANCE_REC.ACTUAL_RETURN_DATE := rec_cur_active_rec.RETURN_DATE;

      X_INSTANCE_REC.INSTALL_LOCATION_TYPE_CODE := NULL;
           X_INSTANCE_REC.INSTALL_LOCATION_ID := NULL;
           X_INSTANCE_REC.INSTALL_DATE := NULL;

      -- ************* FOR PARTIES **********************************************************
      --


      l_num_instance_party_id := NULL;
      l_num_ip_object_version_number := NULL;

      SELECT instance_party_id, object_version_number
      INTO l_num_instance_party_id,
      l_num_ip_object_version_number
      FROM csi_I_parties
      WHERE instance_id = l_num_avail_instance_id
      AND relationship_type_code = 'OWNER';


           X_PARTY_TBL(1).INSTANCE_PARTY_ID          := l_num_instance_party_id;
           X_PARTY_TBL(1).INSTANCE_ID               := l_num_avail_instance_id;
           X_PARTY_TBL(1).PARTY_SOURCE_TABLE          := 'HZ_PARTIES';
           X_PARTY_TBL(1).PARTY_ID                    := 3341; --from hz_parties table
           X_PARTY_TBL(1).RELATIONSHIP_TYPE_CODE          := 'OWNER';
           X_PARTY_TBL(1).CONTACT_FLAG               := 'N';
           X_PARTY_TBL(1).OBJECT_VERSION_NUMBER          := l_num_ip_object_version_number;
           X_PARTY_TBL(1).contact_ip_id := NULL;
      --
      --
      -- *********** FOR PARTY ACCOUNT *****************************************************
      SELECT CSI_IP_ACCOUNTS_S.NEXTVAL
      INTO V_IP_ACCOUNT_ID
      FROM sys.dual;


      X_ACCOUNT_TBL(1).IP_ACCOUNT_ID          :=V_IP_ACCOUNT_ID ;
      X_ACCOUNT_TBL(1).INSTANCE_PARTY_ID          := l_num_instance_party_id;
      X_ACCOUNT_TBL(1).PARTY_ACCOUNT_ID          := 2679; --from cust_acct_id from hz_cust_accounts table
      X_ACCOUNT_TBL(1).RELATIONSHIP_TYPE_CODE          := 'OWNER';
      X_ACCOUNT_TBL(1).BILL_TO_ADDRESS          := 13170; --site_use_id (bill_to) from HZ_CUST_SITE_USES_ALL table
      X_ACCOUNT_TBL(1).SHIP_TO_ADDRESS          := 15377; --site_use_id (ship_to) from HZ_CUST_SITE_USES_ALL table
      X_ACCOUNT_TBL(1).ACTIVE_START_DATE          := SYSDATE;
      X_ACCOUNT_TBL(1).OBJECT_VERSION_NUMBER          := l_num_ip_object_version_number;

      -- ************************** TRANSACTION REC *****************************************
      X_TXN_REC.TRANSACTION_DATE          := SYSDATE;
      X_TXN_REC.SOURCE_TRANSACTION_DATE     := rec_cur_active_rec.trans_date;
      X_TXN_REC.TRANSACTION_TYPE_ID     :=53; --RMA_RECEIPT 
      -- X_TXN_REC.OBJECT_VERSION_NUMBER     :=2;
      X_TXN_REC.TXN_SUB_TYPE_ID :=10020;--10020; --OM Return for Credit 
      --
      X_TXN_REC.INV_MATERIAL_TRANSACTION_ID :=rec_cur_active_rec.TRANS_INV_MTL_TRANS_ID;-- 73512237;
      X_TXN_REC.SOURCE_LINE_REF_ID := rec_cur_active_rec.TRANS_SOURCE_LINE_REF_ID; --6;
      X_TXN_REC.SOURCE_LINE_REF := rec_cur_active_rec.TRANS_SOURCE_LINE_REF; --'2';
      X_TXN_REC.SOURCE_HEADER_REF_ID := rec_cur_active_rec.trans_source_header_ref_id; -
      X_TXN_REC.SOURCE_HEADER_REF := rec_cur_active_rec.trans_source_header_ref ;
      --
      -- *************** API CALL *******************************************************



      fnd_file.put_line (fnd_file.LOG,
      'Calling Update API...');


           CSI_ITEM_INSTANCE_PUB.UPDATE_ITEM_INSTANCE
           (
      p_api_version => 1.0
      ,p_commit => l_chr_COMMIT
      ,p_init_msg_list => l_chr_INIT_MSG_LST
      ,p_validation_level => l_num_VALIDATION_LEVEL
      ,p_instance_rec => X_INSTANCE_REC
      ,p_ext_attrib_values_tbl => X_EXT_ATTRIB_VALUES
      ,p_party_tbl => X_PARTY_TBL
      ,p_account_tbl => X_ACCOUNT_TBL
      ,p_pricing_attrib_tbl => X_PRICING_ATTRIB_TBL
      ,p_org_assignments_tbl => X_ORG_ASSIGNMENTS_TBL
      ,p_asset_assignment_tbl => X_ASSET_ASSIGNMENT_TBL
      ,p_txn_rec => X_TXN_REC
      ,x_instance_id_lst => X_tabtype_instance_id
      ,x_return_status => l_chr_RETURN_STATUS
      ,x_msg_count => l_num_MSG_COUNT
      ,x_msg_data => l_chr_MSG_DATA
      );



      Thanks..