EBS: Customer SITE USE API : How to update Customer Site Use using API
DECLARE
lv_cust_site_use_rec hz_cust_account_site_v2pub.cust_site_use_rec_type;
p_customer_profile_rec hz_customer_profile_v2pub.customer_profile_rec_type;
x_site_use_id NUMBER;
x_return_status VARCHAR2 (2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2 (2000);
l_salesrep_id NUMBER;
l_bill_site_use_id NUMBER;
l_p_object_version_number NUMBER;
l_site_use_id NUMBER;
l_cust_account_id NUMBER;
v_org_id NUMBER := null;
v_price_list VARCHAR2 (30) DEFAULT NULL;
CURSOR cur_contr
IS
SELECT DISTINCT hca.account_number, hca.account_name,
hps.party_site_number, hcas.attribute1 duns_number,
hcas.cust_acct_site_id, hcas.status, hcas.org_id,
hcsu.site_use_code, hcsu.site_use_id,
hcsu.object_version_number, rt.NAME, rt.description,
hcsu.fob_point, hl.country
FROM hz_cust_accounts_all hca,
hz_cust_acct_sites_all hcas,
hz_party_sites hps,
hz_cust_site_uses_all hcsu,
ra_terms rt,
hz_locations hl
WHERE hca.cust_account_id = hcas.cust_account_id
AND hcas.party_site_id = hps.party_site_id
AND hca.account_number = hca.account_number
AND hcas.org_id IN (103)
AND hcsu.cust_acct_site_id = hcas.cust_acct_site_id
AND hcsu.payment_term_id = rt.term_id
AND hps.location_id = hl.location_id
AND hca.account_number IN
(
'5175852'
);
BEGIN
FOR rec_cur IN cur_contr
LOOP
mo_global.init ('AR');
mo_global.set_policy_context ('S', rec_cur.org_id);
--
lv_cust_site_use_rec.cust_acct_site_id := rec_cur.cust_acct_site_id;
lv_cust_site_use_rec.site_use_id := rec_cur.site_use_id;
lv_cust_site_use_rec.payment_term_id := 100;
---
hz_cust_account_site_v2pub.update_cust_site_use
(p_init_msg_list => 'T',
lv_cust_site_use_rec => lv_cust_site_use_rec,
p_object_version_number => rec_cur.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_success
THEN
COMMIT;
DBMS_OUTPUT.put_line ( 'Status : '
|| x_return_status
|| ' Error Msg : '
|| x_msg_data
);
DBMS_OUTPUT.put_line ( 'Updated Customer Site '
|| rec_cur.cust_acct_site_id
|| '- '
|| rec_cur.site_use_id
);
ELSE
DBMS_OUTPUT.put_line ( 'Updation of Customer Account got failed:'
|| x_msg_data
);
ROLLBACK;
FOR i IN 1 .. x_msg_count
LOOP
x_msg_data :=
fnd_msg_pub.get (p_msg_index => i,
p_encoded => 'F');
DBMS_OUTPUT.put_line (i || ') ' || x_msg_data);
END LOOP;
END IF;
END LOOP;
END;
No comments:
Post a Comment