4 Replies Latest reply on Oct 26, 2011 10:22 AM by Kashif Manzoor

    Can not update PO via update_po api and getting error in Budgetary Control

    693109
      Hi all,
      I am trying to update PO by calling update_PO API. I am trying to follow the manual but am getting an error and can't update the PO. Here is the code:



      declare
      l_result NUMBER;
      l_api_errors apps.po_api_errors_rec_type;
      l_version_no NUMBER := 0;
      l_po_header_id po_headers_all.po_header_id%TYPE;
      l_po_original_amount NUMBER;
      v_po_updated_price NUMBER;
      l_oracle_promised_date DATE;
      v_vendor_site_id po_headers_all.vendor_site_id%TYPE;
      l_vendor_site_code po_vendor_sites_all.vendor_site_code%TYPE;
      l_return_status VARCHAR2 (2000);

           v_error_message VARCHAR2(2000);
      BEGIN
      l_version_no := 0;
      l_po_header_id := 0;
      v_po_updated_price := 0;
      v_error_message := NULL;

      BEGIN
      SELECT revision_num, po_header_id, vendor_site_id
      INTO l_version_no, l_po_header_id, v_vendor_site_id
      FROM po_headers_all
      WHERE segment1 = '*****' --<PO#>
      AND type_lookup_code = 'STANDARD';
      END;
      dbms_output.put_line('l_version_no is ' ||l_version_no);
      --Getting 0 here          
      BEGIN
                l_result := PO_CHANGE_API1_S.record_acceptance(
                          x_po_number => '****', --PO#
                          x_release_number => null,
                          x_revision_number =>l_version_no,
                          x_action => 'NEW',
                          x_action_date => null,
                          x_employee_id => 1359,
                          x_accepted_flag => 'Y',
                          x_acceptance_lookup_code => 'ACCEPT WITH CHANGES',
                          x_note => 'All valid',
                          x_interface_type => 'APITEST',
                          x_transaction_id => null,
                          version => '1.0');

                dbms_output.put_line('Record Acceptance l_result is '||l_result);
      --Getting 1 here. Success.

      l_result :=
      po_change_api1_s.update_po
      (x_po_number => '****', --PO#
      x_release_number => NULL,
      x_revision_number => l_version_no,
      x_line_number => 1,
      x_shipment_number => NULL,
      new_quantity => 10,
      new_price => NULL,
      new_promised_date => NULL,
      launch_approvals_flag => 'Y',
      update_source => NULL,
      VERSION => '1.0',
      x_override_date => NULL,
      x_api_errors => l_api_errors,
      p_buyer_name => NULL
      );
      EXCEPTION
      WHEN OTHERS
      THEN
      dbms_output.put_line('error is ' ||SQLERRM);
      END;

      dbms_output.put_line('l_result is '||l_result);
      --Getting 0 here.... Failure

      IF (l_result <> 1)
      THEN
      FOR i IN 1 .. l_api_errors.MESSAGE_TEXT.COUNT
      LOOP
      v_error_message :=
      v_error_message
      || ' '
      || l_api_errors.MESSAGE_TEXT (i);
      END LOOP;
      END IF;
      COMMIT;
      END;

      Final error message is:
      Supplier site is either exempt from CCR registration or has not been added to agency vendor. Procedure PSA_FUNDS_CHECKER_PKG.glxfck returns an error without any details to the calling procedure PO_ENCUMBRANCE_POSTPROCESSING.execute_gl_call. Please contact your support representative. Your Budgetary Control action completed with exceptions. DO_UNRESERVE-100: User-Defined Exception

      Cause: A SQL error has occurred in DO_UNRESERVE. The SQL error is User-Defined Exception.

      Action: Take note of both this error number and the actions you were trying to perform. Contact your system administrator for further assistance.
      Your Budgetary Control action completed with exceptions.


      Please let me know what can be the croblem here. I can not find anything here on this issue. Please help.

      Thanks.