2 Replies Latest reply: May 15, 2013 3:41 AM by 984327 RSS

    Unable to create Salesperson Using API

    933351
      Hi All,
      I am creating Resources using API packages.
      I have created Resource using " jtf_rs_resource_pub.create_resource '" API ,is created successfully.
      while i am going to assign Salesperson using " jtf_rs_salesreps_pub.create_salesrep " it's showing error

      Error Message is :
      return status is E
      API Error Message : ORG ID is invalid.
      msg data is ORG ID is invalid.
      Sales Rep id is
      --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      My code is :

      declare

      l_api_version number := 1.0;
      l_init_msg_list varchar2(250) default fnd_api.g_false;
      l_commit varchar2(250) default fnd_api.g_false;
      l_resource_id jtf_rs_salesreps.resource_id%type := 100018060;
      l_sales_credit_type_id jtf_rs_salesreps.sales_credit_type_id%type := 1;
      l_name jtf_rs_salesreps.name%type default null;
      l_status jtf_rs_salesreps.status%type := 'A';
      l_start_date_active jtf_rs_salesreps.start_date_active%type := sysdate;
      l_end_date_active jtf_rs_salesreps.end_date_active%type := null;
      l_org_id jtf_rs_salesreps.org_id%type := 82;
      l_gl_id_rev jtf_rs_salesreps.gl_id_rev%type default null;
      l_gl_id_freight jtf_rs_salesreps.gl_id_freight%type default null;
      l_gl_id_rec jtf_rs_salesreps.gl_id_rec%type default null;
      l_set_of_books_id jtf_rs_salesreps.set_of_books_id%type default null;
      l_salesrep_number jtf_rs_salesreps.salesrep_number%type := '123456';
      l_email_address jtf_rs_salesreps.email_address%type default null;
      l_wh_update_date jtf_rs_salesreps.wh_update_date%type := sysdate;
      l_sales_tax_geocode jtf_rs_salesreps.sales_tax_geocode%type := null;
      l_sales_tax_inside_city_limits jtf_rs_salesreps.sales_tax_inside_city_limits%type := null;
      -- added for NOCOPY
      l_resource_id_out jtf_rs_salesreps.resource_id%type;
      l_salesrep_id jtf_rs_salesreps.salesrep_id%type;
      l_return_status VARCHAR2(200);
      l_msg_count NUMBER;
      l_msg_data VARCHAR2(200);
      l_msg_data1 varchar2(2000);
      l_msg_index_out number;

      begin

      dbms_application_info.set_client_info('82');
      -- mo_global.set_org_context('82','S',NULL);


      jtf_rs_salesreps_pub.create_salesrep
      (P_API_VERSION => l_api_version,
      P_INIT_MSG_LIST => l_init_msg_list,
      P_COMMIT => l_commit,
      P_RESOURCE_ID => l_resource_id,
      P_SALES_CREDIT_TYPE_ID => l_sales_credit_type_id,
      P_NAME => l_name,
      P_STATUS => l_status,
      P_START_DATE_ACTIVE => l_start_date_active,
      P_END_DATE_ACTIVE => l_end_date_active,
      P_ORG_ID => l_org_id,
      P_GL_ID_REV => l_gl_id_rev,
      P_GL_ID_FREIGHT => l_gl_id_freight,
      P_GL_ID_REC => l_gl_id_rec,
      P_SET_OF_BOOKS_ID => l_set_of_books_id,
      P_SALESREP_NUMBER => l_salesrep_number,
      P_EMAIL_ADDRESS => l_email_address,
      P_WH_UPDATE_DATE => l_wh_update_date,
      P_SALES_TAX_GEOCODE => l_sales_tax_geocode,
      P_SALES_TAX_INSIDE_CITY_LIMITS => l_sales_tax_inside_city_limits,
      X_RETURN_STATUS => l_return_status,
      X_MSG_COUNT => l_msg_count,
      X_MSG_DATA => l_msg_data,
      X_SALESREP_ID => l_salesrep_id
      );


      dbms_output.put_line('return status is ' || l_return_Status);

      FND_MSG_PUB.GET(p_msg_index => 1,
      p_encoded => 'F',
      p_data => l_msg_data,
      p_msg_index_out => l_msg_index_out);

      DBMS_OUTPUT.put_line('API Error Message : '||l_msg_data);

      dbms_output.put_line('msg data is ' || l_msg_data);
      dbms_output.put_line('Sales Rep id is ' || l_salesrep_id);

      end;

      ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
      I am waiting for your positive reply guys.

      Thanks

      Regard
      Suheeb