, , , , , , , ,

Oracle R12 Transact Order using APIs

DECLARE
   x_return_status   VARCHAR2 (1);

   PROCEDURE transact_move_order (p_move_order_id IN NUMBER, x_return_status OUT VARCHAR2)
   IS
      l_header_id        NUMBER;
      l_program          VARCHAR2 (100);
      l_func             VARCHAR2 (100);
      l_args             VARCHAR2 (100);
      p_timeout          NUMBER;
      l_old_tm_success   BOOLEAN;
      l_rc_field         NUMBER;

      CURSOR c1 (p_header_id IN NUMBER)
      IS
         SELECT transaction_header_id
           FROM mtl_material_transactions_temp
          WHERE transaction_source_id = p_header_id;
   BEGIN
      mo_global.set_policy_context (‘S’, 204);
      inv_globals.set_org_id (207);
      fnd_global.apps_initialize (1005902, 50583, 401);

      FOR i IN c1 (p_move_order_id)
      LOOP
         l_program := ‘INXTPU’;
         l_func := l_program;
         l_args := l_program || ‘ ‘ || ‘TRANS_HEADER_ID=’ || TO_CHAR (i.transaction_header_id);
         p_timeout := 500;
         COMMIT;
         l_old_tm_success :=
            inv_pick_wave_pick_confirm_pub.inv_tm_launch (program      => l_program
                                                        , args         => l_args
                                                        , TIMEOUT      => p_timeout
                                                        , rtval        => l_rc_field
                                                         );

         IF l_old_tm_success
         THEN
            x_return_status := ‘S’;
            DBMS_OUTPUT.put_line (‘Result is :’ || ‘Success’);
         ELSE
            x_return_status := ‘E’;
            DBMS_OUTPUT.put_line (‘Result is :’ || ‘Failed’);
         END IF;

         IF x_return_status = ‘S’
         THEN
            COMMIT;
         ELSE
            ROLLBACK;
         END IF;
      END LOOP;
   END;
BEGIN
   transact_move_order (2055447, x_return_status);
   COMMIT;
END;

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply