Create Customer Through API
DECLARE
p_cust_account_rec HZ_CUST_ACCOUNT_V2PUB.CUST_ACCOUNT_REC_TYPE;
p_person_rec HZ_PARTY_V2PUB.PERSON_REC_TYPE;
p_customer_profile_rec HZ_CUSTOMER_PROFILE_V2PUB.CUSTOMER_PROFILE_REC_TYPE;
p_organization_rec HZ_PARTY_V2PUB.ORGANIZATION_REC_TYPE ;
x_cust_account_id NUMBER;
x_account_number VARCHAR2 ( 2000 ) ;
x_party_id NUMBER;
x_party_number VARCHAR2 ( 2000 ) ;
x_profile_id NUMBER;
x_return_status VARCHAR2 ( 2000 ) ;
x_msg_count NUMBER;
x_msg_data VARCHAR2 ( 2000 ) ;
BEGIN
p_cust_account_rec.account_name := 'ABCXYZ';
p_cust_account_rec.created_by_module := 'TCA_V2_API';
p_person_rec.person_first_name := 'ABC';
p_person_rec.person_last_name := 'XYZ';
mo_global.init ( 'AR' ) ;
mo_global.set_org_context ( 204, NULL, 'AR' ) ;
fnd_global.set_nls_context ( 'AMERICAN' ) ;
mo_global.set_policy_context ( 'S', 204 ) ;
hz_cust_account_v2pub.create_cust_account ( p_init_msg_list => 'T' ,
p_cust_account_rec => p_cust_account_rec ,
p_person_rec => p_person_rec ,
p_customer_profile_rec => p_customer_profile_rec ,
p_create_profile_amt => 'F' ,
x_cust_account_id => x_cust_account_id ,
x_account_number => x_account_number ,
x_party_id => x_party_id ,
x_party_number => x_party_number ,
x_profile_id => x_profile_id ,
x_return_status => x_return_status ,
x_msg_count => x_msg_count ,
x_msg_data => x_msg_data
);
dbms_output.put_line ( 'x_return_status = '||SUBSTR ( x_return_status, 1, 255 ) ) ;
dbms_output.put_line ( 'x_msg_count = '||TO_CHAR ( x_msg_count ) ) ;
dbms_output.put_line ( 'Party Id = '||TO_CHAR ( x_party_id ) ) ;
dbms_output.put_line ( 'Party Number = '||x_party_number ) ;
dbms_output.put_line ( 'Profile Id = '||TO_CHAR ( x_profile_id ) ) ;
dbms_output.put_line ( 'x_msg_data = '|| SUBSTR ( x_msg_data, 1, 255 ) ) ;
IF x_msg_count >1 THEN
FOR I IN 1..x_msg_count
LOOP
dbms_output.put_line ( I||'.'||SUBSTR ( FND_MSG_PUB.Get ( p_encoded=> FND_API.G_FALSE ), 1, 255 ) ) ;
END LOOP;
END IF;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE ( 'Error: '||SQLERRM ) ;
END;
/
COMMIT;
No comments:
Post a Comment