Infolinks

Friday, 20 July 2012

Oracle Apps Change PO API Training

Oracle Apps Change PO API Training


Following are the steps required in order to use the Change PO API to update a Standard Purchase order?
Login to the application

Navigate to the Purchase Order form and create a PO with a single line with quantity = 10, price = 1 and promised date = 31-MAR-2012 (use any date in the future as long as it is in an open period).


The first run of the API will demonstrate updating the Quantity of Line 1 of the PO to 25. Submit the cancel API using sqlplus as follows:

After the API completes, Re query the PO screen to check the changes


DECLARE
   l_result       NUMBER;
   l_api_errors   PO_API_ERRORS_REC_TYPE;
BEGIN
   -- This needs to be changed according to your environment setup.
   fnd_global.apps_initialize (1318, 50578, 201);
   -- mo_global.init('PO'); -- need for R12
   l_result :=
      PO_CHANGE_API1_S.update_po (x_po_number             => 23998,
                                  x_release_number        => NULL,
                                  x_revision_number       => 0,
                                  x_line_number           => 1,
                                  x_shipment_number       => 1,
                                  new_quantity            => 25,
                                  new_price               => NULL,
                                  new_promised_date       => NULL,
                                  launch_approvals_flag   => 'N',
                                  update_source           => NULL,
                                  version                 => '1.0',
                                  x_override_date         => NULL,
                                  x_api_errors            => l_api_errors,
                                  p_buyer_name            => NULL);

   IF (l_result <> 1)
   THEN
      -- Display the errors
      FOR i IN 1 .. l_api_errors.MESSAGE_TEXT.COUNT
      LOOP
         DBMS_OUTPUT.put_line (l_api_errors.MESSAGE_TEXT (i));
      END LOOP;
   END IF;
END;

COMMIT;

The second run of the API will demonstrate updating the Price of Line 1 of the PO to 0.9. Submit the cancel API using sqlplus as follows :
After the API completes, Re query the PO screen to check the changes


DECLARE
   l_result       NUMBER;
   l_api_errors   PO_API_ERRORS_REC_TYPE;
BEGIN
   -- This needs to be changed according to your environment setup.
   fnd_global.apps_initialize (1318, 50578, 201);
   -- mo_global.init('PO'); -- need for R12
   l_result :=
      PO_CHANGE_API1_S.update_po (x_po_number             => 23998,
                                  x_release_number        => NULL,
                                  x_revision_number       => 0,
                                  x_line_number           => 1,
                                  x_shipment_number       => 1,
                                  new_quantity            => NULL,
                                  new_price               => 0.9,
                                  new_promised_date       => NULL,
                                  launch_approvals_flag   => 'N',
                                  update_source           => NULL,
                                  version                 => '1.0',
                                  x_override_date         => NULL,
                                  x_api_errors            => l_api_errors,
                                  p_buyer_name            => NULL);

   IF (l_result <> 1)
   THEN
      -- Display the errors
      FOR i IN 1 .. l_api_errors.MESSAGE_TEXT.COUNT
      LOOP
         DBMS_OUTPUT.put_line (l_api_errors.MESSAGE_TEXT (i));
      END LOOP;
   END IF;
END;

COMMIT;

The third run of the API will demonstrate updating the Promised Date of Shipment 1 (of Line 1) of the PO to 30-Mar-2010. Submit the cancel API using sqlplus as follows :

After the API completes, Re query the PO screen to check the changes


DECLARE
   l_result       NUMBER;
   l_api_errors   PO_API_ERRORS_REC_TYPE;
BEGIN
   -- This needs to be changed according to your environment setup.
   fnd_global.apps_initialize (1318, 50578, 201);
   -- mo_global.init('PO'); -- need for R12
   l_result :=
      PO_CHANGE_API1_S.update_po (x_po_number             => 23998,
                                  x_release_number        => NULL,
                                  x_revision_number       => 0,
                                  x_line_number           => 1,
                                  x_shipment_number       => 1,
                                  new_quantity            => NULL,
                                  new_price               => NULL,
                                  new_promised_date       => '30-MAR-2010',
                                  launch_approvals_flag   => 'N',
                                  update_source           => NULL,
                                  version                 => '1.0',
                                  x_override_date         => NULL,
                                  x_api_errors            => l_api_errors,
                                  p_buyer_name            => NULL);

   IF (l_result <> 1)
   THEN
      -- Display the errors
      FOR i IN 1 .. l_api_errors.MESSAGE_TEXT.COUNT
      LOOP
         DBMS_OUTPUT.put_line (l_api_errors.MESSAGE_TEXT (i));
      END LOOP;
   END IF;
END;

COMMIT;

No comments:

Post a Comment