declarex_return_statusVARCHAR2(150);
x_msg_countNUMBER;
x_msg_dataVARCHAR2(2000);
x_profile_idNUMBER;
l_location_idNUMBER;
l_object_version_numberNUMBER;
l_party_rec hz_cust_account_v2pub.cust_account_rec_type;cursor cur_DT is
SELECTloc.location_id,
loc.object_version_number,
addr.PARTY_SITE_ID,
hc.ACCOUNT_NUMBER,
hc.CUST_ACCOUNT_ID,
party_site.PARTY_SITE_NAME,
hcp.CUST_ACCOUNT_PROFILE_ID,
hcp.CREDIT_HOLD,
hc.CREATION_DATE,
hc.CREATED_BY,
hc.ORIG_SYSTEM_REFERENCE,
hc.PARTY_ID,
hc.STATUSFROMhz_cust_acct_sites_all addr,
hz_party_sites party_site,
hz_locations loc,
HZ_CUSTOMER_PROFILES hcp,
HZ_CUST_ACCOUNTS hcWHERE 1 = 1
AND addr.party_site_id =party_site.party_site_idAND loc.location_id =party_site.location_idand hc.PARTY_ID =party_site.PARTY_IDand hc.CUST_ACCOUNT_ID =hcp.CUST_ACCOUNT_IDand party_site.PARTY_ID =(selecthz.PARTY_IDfromhz_parties hzwhere hz.PARTY_ID =party_site.PARTY_IDand hz.PARTY_NUMBER = ‘10984‘);beginfnd_global.apps_initialize(0, 50738, 20003);
mo_global.init(‘AR‘);FOR rec INCUR_DT LOOPbegin
selecthc.OBJECT_VERSION_NUMBERintol_object_version_numberfromHZ_CUST_ACCOUNTS hcwhere hc.CUST_ACCOUNT_ID =rec.CUST_ACCOUNT_ID;end;
l_party_rec.CUST_ACCOUNT_ID :=rec.CUST_ACCOUNT_ID;
l_party_rec.ACCOUNT_NUMBER :=rec.ACCOUNT_NUMBER;
l_party_rec.status := ‘I‘;
l_party_rec.orig_system_reference :=rec.orig_system_reference;
hz_cust_account_v2pub.update_cust_account(p_init_msg_list=>fnd_api.g_false,
p_cust_account_rec=>l_party_rec,
p_object_version_number=>l_object_version_number,
x_return_status=>x_return_status,
x_msg_count=>x_msg_count,
x_msg_data=>x_msg_data);IF x_return_status = fnd_api.g_ret_sts_error THENx_msg_count :=fnd_msg_pub.count_msg;
x_msg_data :=substr(fnd_msg_pub.get(fnd_msg_pub.g_first,
fnd_api.g_false),1,512);
dbms_output.put_line(x_msg_data);
fnd_msg_pub.delete_msg();
RAISE fnd_api.g_exc_error;
ELSIF x_return_status= fnd_api.g_ret_sts_unexp_error THENx_msg_count :=fnd_msg_pub.count_msg;
x_msg_data :=substr(fnd_msg_pub.get(fnd_msg_pub.g_first,
fnd_api.g_false),1,512);
dbms_output.put_line(x_msg_data);
fnd_msg_pub.delete_msg();
RAISE fnd_api.g_exc_unexpected_error;END IF;IF x_return_status = fnd_api.g_ret_sts_success THENdbms_output.put_line(‘------------------Update Success-------------------‘);END IF;ENDLOOP;END;