Error Message: You are not setup as a buyer. To access this form you need to be a buyer.
Note: Check and add in Sysadmin ‘Security > User > Define’,Query for the user & enter ‘person’ field with employee name created in HRMS. Save the record.
PLSQL Script to create Buyer using API:
SET SERVEROUTPUT ON;
DECLARE
ln_agent_id NUMBER;
lc_employee_number VARCHAR2 (20) := 'XX007'; -- Use valid Employee Number
lc_buyer_rowid VARCHAR2 (100);
BEGIN
-- Get person_id using Employee Number
BEGIN
SELECT person_id, rowid
INTO ln_agent_id, lc_buyer_rowid
FROM apps.per_all_people_f f
WHERE employee_number = lc_employee_number;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Unable to find Agent ID for: '
|| lc_employee_number|| SQLERRM);
END;
--
apps.po_agents_pkg.insert_row (x_rowid => lc_buyer_rowid,
x_agent_id => ln_agent_id,
x_last_update_date => SYSDATE,
x_last_updated_by => 0,
x_last_update_login => 0,
x_creation_date => SYSDATE,
x_created_by => 0,
x_location_id => NULL,
x_category_id => NULL,
x_authorization_limit => NULL,
x_start_date_active => SYSDATE,
x_end_date_active => NULL,
x_attribute_category => NULL,
x_attribute1 => NULL,
x_attribute2 => NULL,
x_attribute3 => NULL,
x_attribute4 => NULL,
x_attribute5 => NULL,
x_attribute6 => NULL,
x_attribute7 => NULL,
x_attribute8 => NULL,
x_attribute9 => NULL,
x_attribute10 => NULL,
x_attribute11 => NULL,
x_attribute12 => NULL,
x_attribute13 => NULL,
x_attribute14 => NULL,
x_attribute15 => NULL
);
COMMIT;
dbms_output.put_line ('Setup as a Buyer: '||lc_employee_number);
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line ('Error in creating as a Buyer:'||SQLERRM);
END;
/
Once above PLSQL block completed successfully then check PO Buyer created or not in Base table.
Get Agent_ID from apps.per_all_people_f table using Employee Number and check in Base table of Buyer:
SELECT person_id
FROM apps.per_all_people_f f
WHERE employee_number = 'XX007';
SELECT * FROM apps.PO_AGENTS WHERE agent_id = 234527; -- Agent_ID of XX007
And try to open Purchase Order application form:
Thanks..
No comments:
Post a Comment