Friday, 30 January 2015

API to Update the List price of PO

API to Update the List price of PO

Declare  
   v_result           NUMBER;
   v_api_errors       po_api_errors_rec_type;
   v_revision_num     po_headers_all.revision_num%TYPE :=0;
   v_price            po_lines_all.unit_price%TYPE:=200;
   v_quantity         po_line_locations_all.quantity%TYPE :=10;
   v_po_number        po_headers_all.segment1%TYPE :='145';
   v_line_num         po_lines_all.line_num%TYPE :=1;
   v_shipment_num     po_line_locations_all.shipment_num%TYPE:=1;
   v_promised_date    DATE :='20-JUL-11';
   v_need_by_date     DATE :=' ';--:='11-JUL-2011';
   v_org_id           NUMBER :=85;
   v_context          VARCHAR2 (10);
   v_user_id          NUMBER :=1118;
   v_resp_id          NUMBER;
BEGIN
  
   SELECT level_value
     INTO v_resp_id
     FROM fnd_profile_option_values
    WHERE profile_option_id = 1991
      AND level_value_application_id = 201
      AND profile_option_value = v_org_id;
   fnd_global.apps_initialize (v_user_id, v_resp_id,201);
   mo_global.init ('PO');
  
   v_result :=
      po_change_api1_s.update_po (x_po_number                => v_po_number,
                                  x_release_number           => NULL,
                                  x_revision_number          => v_revision_num,
                                  x_line_number              => v_line_num,
                                  x_shipment_number          => v_shipment_num,
                                  new_quantity               => v_quantity,
                                  new_price                  => v_price,
                                  new_promised_date          => v_promised_date,
                                  new_need_by_date           => v_need_by_date,
                                  launch_approvals_flag      => 'N',
                                  update_source              => NULL,
                                  VERSION                    => '1.0',
                                  x_override_date            => NULL,
                                  x_api_errors               => v_api_errors,
                                  p_buyer_name               => NULL,
                                  p_secondary_quantity       => NULL,
                                  p_preferred_grade          => NULL,
                                  p_org_id                   => v_org_id
                                 );
   DBMS_OUTPUT.put_line ('RESULT :' || v_result);
   Commit;
   IF (v_result = 1)
   THEN
      DBMS_OUTPUT.put_line ('Updating PO is Successful ');
   ELSE
      DBMS_OUTPUT.put_line ('Updating PO failed');
      FOR j in 1 .. v_api_errors.MESSAGE_TEXT.COUNT
      LOOP
         DBMS_OUTPUT.put_line (v_api_errors.MESSAGE_TEXT (j));
      END LOOP;
   END IF;
  
END;

No comments:

Post a Comment