Creating Employee As Supplier

The prerequisite is to have Create/Update Employee Supplier Details (POS_HT_SP_EMP_SUPPLIER) with the grant flag checked in the menu of the responsibility for full access to employee suppliers.

Setting mo_global.init(‘SQLAP’) is a must if running standalone script.

If submitting from concurrent program from custom responsibility, make sure the function the function Create/Update Employee Supplier Details is attached to Menu of the custom responsibility.

 
DECLARE
l_vendor_rec ap_vendor_pub_pkg.r_vendor_rec_type;
l_return_status VARCHAR2 (10);
l_msg_count NUMBER;
l_msg_data VARCHAR2 (1000);
l_vendor_id NUMBER;
l_party_id NUMBER;
p_count NUMBER;

BEGIN
mo_global.init(‘SQLAP’); –A must if running standalone script.
_vendor_rec.vendor_name := ’07MAR2′;
l_vendor_rec.employee_id := 20158; –not mandatory
l_vendor_rec.vendor_type_lookup_code := ‘EMPLOYEE’;
ap_vendor_pub_pkg.create_vendor (p_api_version => 1,
p_init_msg_list => fnd_api.g_false,
p_commit => fnd_api.g_false,
p_vendor_rec => l_vendor_rec,
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data,
x_vendor_id => l_vendor_id,
x_party_id => l_party_id
);

IF (l_return_status <> ‘S’)
THEN
DBMS_OUTPUT.put_line (‘ Error in Creating Employee Type Supplier..’);

IF (l_msg_count = 1)
THEN
DBMS_OUTPUT.put_line (‘x_msg_data ‘ || l_msg_data);
ELSIF (l_msg_count > 1)
THEN
LOOP
p_count := p_count + 1;
l_msg_data :=
fnd_msg_pub.get (fnd_msg_pub.g_next, fnd_api.g_false);

IF (l_msg_data IS NULL)
THEN
EXIT;
END IF;

DBMS_OUTPUT.put_line ( ‘ Error Message’
|| p_count
|| ‘ —‘
|| l_msg_data
);
END LOOP;
END IF;
ELSE
DBMS_OUTPUT.put_line (‘Vendor_id:’ || l_vendor_id);
END IF;

COMMIT;
EXCEPTION
WHEN OTHERS
THEN
ROLLBACK;
DBMS_OUTPUT.put_line (‘Exception:’ || SQLERRM);
END;

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s