1 Reply Latest reply on Mar 29, 2013 5:56 PM by 999362

    Approved Revenue Budget API Error

    user436660 - oracle
      Hi,

      I am having trouble creating an Approved Revenue Budget (AR) using the create_draft_budget api. I could create Approved Cost (AC) budget, but not AR budget. I have checked the setups and everything looks fine.

      I am including my script, please let me know if I need to pass any other values into the API. The api returns the following error message : "Budget Entry Method does not allow Burden Cost to be passed".

      Thanks,
      Srikanth

      set serveroutput on size 20000

      DECLARE

      -- variables needed for API standard parameters
      l_api_version_number NUMBER := 1.0;
      l_commit VARCHAR2(1) := 'F';
      l_return_status VARCHAR2(1);
      l_init_msg_list VARCHAR2(1) := 'T';
      l_msg_count NUMBER;
      l_msg_data VARCHAR2(2000);
      l_data VARCHAR2(2000);
      l_msg_index NUMBER;
      l_msg_index_out NUMBER;
      l_encouded VARCHAR2(1);
      i NUMBER;
      a NUMBER;

      -- Variables needed for the user_id and responsibility_id
      l_user_id NUMBER;
      l_responsibility_id NUMBER;

      -- Variables needed for Oracle Project specific parameters
      l_pm_product_code VARCHAR2(10);
      l_pa_project_id NUMBER;
      l_pm_project_reference VARCHAR2(25);
      l_budget_type_code VARCHAR2(30);
      l_change_reason_code VARCHAR2(30);
      l_description VARCHAR2(255);
      l_entry_method_code VARCHAR2(30);
      l_resource_list_name VARCHAR2(60);
      l_resource_list_id NUMBER;
      l_budget_lines_in PA_BUDGET_PUB.BUDGET_LINE_IN_TBL_TYPE;
      l_budget_lines_in_rec PA_BUDGET_PUB.BUDGET_LINE_IN_REC_TYPE;
      l_budget_lines_out PA_BUDGET_PUB.BUDGET_LINE_OUT_TBL_TYPE;
      l_budget_version_name VARCHAR2(20) := 'Version 1';

      l_line_index NUMBER;
      l_line_return_status VARCHAR2(1);
      API_ERROR EXCEPTION;
      l_bud_end_date VARCHAR2(10);
      l_workflow_started VARCHAR2 (1) := 'Y';

      BEGIN

      -- PRODUCT RELATED DATA
      l_pm_product_code := 'ABC'; -- please set your custom product code

      -- BUDGET DATA
      l_pa_project_id := 12345; --project id for budget, please adapt
      l_pm_project_reference := NULL;
      l_budget_type_code := 'AR'; -- Approved cost budget form budget type
      l_change_reason_code := 'PA';
      l_description := 'New Description -> 2';
      l_entry_method_code := 'TEST_BUDGET_ENTRY_CODE';

      -- BUDGET LINES DATA
      a := 1;
      for i in 1..a loop

      l_budget_lines_in_rec.budget_start_date := '01-JAN-13';
      l_budget_lines_in_rec.budget_end_date := '31-JAN-13';
      l_budget_lines_in_rec.burdened_cost := 500; -- raw cost


      l_budget_lines_in(i) := l_budget_lines_in_rec;

      end loop;

      -- SET GLOBAL INFO
      pa_interface_utils_pub.set_global_info (
      p_api_version_number => 1.0,
      p_responsibility_id => resp_id,
      p_operating_unit_id => 81,
      p_user_id => user_id,
      p_msg_count => l_msg_count,
      p_msg_data => l_msg_data,
      p_return_status => l_return_status);

      dbms_output.put_line ('Set Global status ->' || l_return_status);
      apps.mo_global.init('PA');
      mo_global.set_policy_context('S',81);


      -- INIT_BUDGET
      pa_budget_pub.init_budget;
      pa_budget_pub.create_draft_budget (p_api_version_number => l_api_version_number, -- required
      p_commit => l_commit,
      p_init_msg_list => l_init_msg_list,
      p_msg_count => l_msg_count,
      p_msg_data => l_msg_data,
      p_return_status => l_return_status,
      p_pm_product_code => l_pm_product_code, -- required
      p_pm_project_reference => l_pm_project_reference,
      p_budget_version_name => VER2_NAME',
      p_pa_project_id => l_pa_project_id,
      p_budget_type_code => l_budget_type_code, -- required
      p_description => l_description,
      p_entry_method_code => l_entry_method_code, -- required
      p_resource_list_name => l_resource_list_name,
      p_budget_lines_in => l_budget_lines_in,
      p_budget_lines_out => l_budget_lines_out,
      p_create_new_curr_working_flag => 'Y',
      p_using_resource_lists_flag => 'N',
      p_burdened_cost_flag => 'Y'
      );

      commit;

      for i in 1..l_budget_lines_out.count loop
      dbms_output.put_line('create draft budget was successful for line ' || i);
      dbms_output.put_line('Return Code = ' || l_budget_lines_out(i).return_status);
      end loop;

      if l_return_status != 'S'
      then
      FOR i IN 1 .. l_msg_count
      LOOP
      pa_interface_utils_pub.get_messages(p_msg_count => l_msg_count
      ,p_msg_index => i
      ,p_encoded => 'F'
      ,p_msg_data => l_msg_data
      ,p_data => l_data
      ,p_msg_index_out => l_msg_index_out);

      dbms_output.put_line('Budget Validation Error ->' ||substr(l_data,1,250)||l_msg_data);
      END LOOP;
      else
      dbms_output.put_line('Budget created successfully - '||l_return_status);
      end if;

      -- CLEAR_BUDGET
      pa_budget_pub.clear_budget;

      end;
      /