Friday, December 12, 2008

R12 Location Creation

DECLARE
l_location_rec hz_location_v2pub.location_rec_type;
l_location_id NUMBER;
l_addr_val_status VARCHAR2 (240);
l_addr_warn_msg VARCHAR2 (1000);
l_return_status VARCHAR2 (1);
l_msg_count NUMBER;
l_msg_data VARCHAR2 (1000);
l_output VARCHAR2 (1000);
l_msg_dummy VARCHAR2 (1000);
BEGIN
fnd_global.apps_initialize(user_id in number,resp_id in number,resp_appl_id in number);
l_location_rec.country := 'US';
l_location_rec.address1 := 'Line 1';
l_location_rec.city := 'New Jersey';
l_location_rec.postal_code := 08830;
l_location_rec.state := 'NJ';
l_location_rec.created_by_module := 'HR API';
l_location_rec.county := 'Middlesex';
hz_location_v2pub.create_location
(p_init_msg_list => 'T',
p_location_rec => l_location_rec,
p_do_addr_val => 'Y',
x_location_id => l_location_id,
x_addr_val_status => l_addr_val_status,
x_addr_warn_msg => l_addr_warn_msg,
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data
);

IF l_return_status <> 'S'
THEN
FOR i IN 1 .. l_msg_count
LOOP
fnd_msg_pub.get (i, fnd_api.g_false, l_msg_data, l_msg_dummy);
l_output := (TO_CHAR (i) || ': ' || l_msg_data);
END LOOP;

DBMS_OUTPUT.put_line ('Error mesg' || l_output);
ELSE
DBMS_OUTPUT.put_line ('l_addr_val_status ' || l_addr_val_status);
DBMS_OUTPUT.put_line ('l_addr_warn_msg ' || l_addr_warn_msg);
DBMS_OUTPUT.put_line ('l_location_id ' || l_location_id);
END IF;
END;

No comments: