Thursday, July 3, 2014

Create a Salesrep in Oracle R12 from API

set serveroutput on;            
DECLARE
v_api_version            varchar2(100) := '1.0';
v_sales_credit_type_id   number        := 1;
v_salesrep_num             number        := '10129';
v_resource_id             varchar2(100) := '1006433';
v_return_status             varchar2(100);
v_msg_count                 varchar2(100);
v_msg_data                 varchar2(100);
v_salesrep_id            number;
BEGIN
    mo_global.set_policy_context('S',80);    --Always set if running from backend otherwise Salesrep wont be created
   
    jtf_rs_salesreps_pub.create_salesrep       (p_api_version            =>     v_api_version
                                              ,p_resource_id           =>      v_resource_id
                                              ,p_sales_credit_type_id  =>      v_sales_credit_type_id
                                              ,p_salesrep_number       =>      v_salesrep_num
                                              ,x_return_status         =>      v_return_status
                                              ,x_msg_count             =>      v_msg_count
                                              ,x_msg_data              =>      v_msg_data
                                              ,x_salesrep_id           =>      v_salesrep_id
                                              );
                                             
    dbms_output.put_line('Salesrep ID : '||v_salesrep_id);                                         
    dbms_output.put_line(SubStr('x_return_status = '||v_return_status,1,255));
    dbms_output.put_line('x_msg_count = '||TO_CHAR(v_msg_count));
    dbms_output.put_line(SubStr('x_msg_data = '||v_msg_data,1,255));
   
    IF v_msg_count >1 THEN
    FOR I IN 1..v_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(sqlerrm);
END;
Reactions:

0 comments:

Post a Comment