DECLARE
p_party_site_rec hz_party_site_v2pub.party_site_rec_type;
x_party_site_id NUMBER;
x_party_site_number VARCHAR2 (2000);
x_return_status VARCHAR2 (2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2 (2000);
l_created_by_module VARCHAR2 (240);
l_error_message VARCHAR2 (2000);
l_msg_index_out NUMBER;
BEGIN
DBMS_APPLICATION_INFO.set_client_info ('&ORG_ID');
SELECT lookup_code
INTO l_created_by_module
FROM fnd_lookup_values
WHERE lookup_type = 'HZ_CREATED_BY_MODULES'
AND ROWNUM = 1
AND enabled_flag = 'Y'
AND NVL (end_date_active, SYSDATE) >= SYSDATE;
p_party_site_rec.party_id := '<party_id>';
p_party_site_rec.location_id := '<Location Id>';
p_party_site_rec.identifying_address_flag := 'Y';
p_party_site_rec.created_by_module := l_created_by_module;
hz_party_site_v2pub.create_party_site (p_init_msg_list => 'T'
, p_party_site_rec => p_party_site_rec
, x_party_site_id => x_party_site_id
, x_party_site_number => x_party_site_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
FOR i IN 1 .. x_msg_count
LOOP
apps.fnd_msg_pub.get (p_msg_index => i
, p_encoded => fnd_api.g_false
, p_data => x_msg_data
, p_msg_index_out => l_msg_index_out
);
IF l_error_message IS NULL
THEN
l_error_message := SUBSTR (x_msg_data, 1, 250);
ELSE
l_error_message :=
l_error_message || ' /' || SUBSTR (x_msg_data, 1, 250);
END IF;
END LOOP;
DBMS_OUTPUT.put_line ('*****************************************');
DBMS_OUTPUT.put_line ('API Error : ' || l_error_message);
DBMS_OUTPUT.put_line ('*****************************************');
ROLLBACK;
ELSE
DBMS_OUTPUT.put_line ('*****************************************');
DBMS_OUTPUT.put_line ('Party Site Created Successfully ');
DBMS_OUTPUT.put_line ('Party Site id: ' || x_party_site_id);
DBMS_OUTPUT.put_line ('Party Site Number: ' || x_party_site_number);
DBMS_OUTPUT.put_line ('*****************************************');
COMMIT;
END IF;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('Unexpected Error ' || SUBSTR (SQLERRM, 1, 250));
END;
p_party_site_rec hz_party_site_v2pub.party_site_rec_type;
x_party_site_id NUMBER;
x_party_site_number VARCHAR2 (2000);
x_return_status VARCHAR2 (2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2 (2000);
l_created_by_module VARCHAR2 (240);
l_error_message VARCHAR2 (2000);
l_msg_index_out NUMBER;
BEGIN
DBMS_APPLICATION_INFO.set_client_info ('&ORG_ID');
SELECT lookup_code
INTO l_created_by_module
FROM fnd_lookup_values
WHERE lookup_type = 'HZ_CREATED_BY_MODULES'
AND ROWNUM = 1
AND enabled_flag = 'Y'
AND NVL (end_date_active, SYSDATE) >= SYSDATE;
p_party_site_rec.party_id := '<party_id>';
p_party_site_rec.location_id := '<Location Id>';
p_party_site_rec.identifying_address_flag := 'Y';
p_party_site_rec.created_by_module := l_created_by_module;
hz_party_site_v2pub.create_party_site (p_init_msg_list => 'T'
, p_party_site_rec => p_party_site_rec
, x_party_site_id => x_party_site_id
, x_party_site_number => x_party_site_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
FOR i IN 1 .. x_msg_count
LOOP
apps.fnd_msg_pub.get (p_msg_index => i
, p_encoded => fnd_api.g_false
, p_data => x_msg_data
, p_msg_index_out => l_msg_index_out
);
IF l_error_message IS NULL
THEN
l_error_message := SUBSTR (x_msg_data, 1, 250);
ELSE
l_error_message :=
l_error_message || ' /' || SUBSTR (x_msg_data, 1, 250);
END IF;
END LOOP;
DBMS_OUTPUT.put_line ('*****************************************');
DBMS_OUTPUT.put_line ('API Error : ' || l_error_message);
DBMS_OUTPUT.put_line ('*****************************************');
ROLLBACK;
ELSE
DBMS_OUTPUT.put_line ('*****************************************');
DBMS_OUTPUT.put_line ('Party Site Created Successfully ');
DBMS_OUTPUT.put_line ('Party Site id: ' || x_party_site_id);
DBMS_OUTPUT.put_line ('Party Site Number: ' || x_party_site_number);
DBMS_OUTPUT.put_line ('*****************************************');
COMMIT;
END IF;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('Unexpected Error ' || SUBSTR (SQLERRM, 1, 250));
END;
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.