Oracle EBS OPM convert dtl reservation

	
--convert_dtl_reservation
--created by jenrry 
DECLARE
   l_reservation_rec   mtl_reservations%ROWTYPE;
   l_qty_convert       NUMBER;
   x_message_count     NUMBER;
   x_message_list      VARCHAR2 (2000);
   x_return_status     VARCHAR2 (2000); 
   l_user_name         VARCHAR2 (80);
   l_user_id           NUMBER;

   CURSOR get_user_id (v_user_name IN VARCHAR2)
   IS
      SELECT user_id
        FROM fnd_user
       WHERE user_name = v_user_name;

   PROCEDURE display_messages (p_msg_count IN NUMBER)
   IS
      MESSAGE               VARCHAR2 (2000);
      dummy                 NUMBER;
      l_api_name   CONSTANT VARCHAR2 (30)   := 'DISPLAY_MESSAGES';
   BEGIN
      FOR i IN 1 .. p_msg_count
      LOOP
         fnd_msg_pub.get (p_msg_index          => i,
                          p_data               => MESSAGE,
                          p_encoded            => 'F',
                          p_msg_index_out      => dummy
                         );
         DBMS_OUTPUT.put_line ('Message ' || TO_CHAR (i) || ' ' || MESSAGE);
      END LOOP;
   EXCEPTION
      WHEN OTHERS
      THEN
         fnd_msg_pub.add_exc_msg ('wrapper for convert dtl reservation ',
                                  l_api_name
                                 );
   END display_messages;
BEGIN
   DBMS_OUTPUT.ENABLE (20000); 
   fnd_profile.initialize (2330); 
   fnd_global.apps_initialize (user_id           => 2330,
                               resp_id           => NULL,
                               resp_appl_id      => NULL
                              );   
   l_reservation_rec.reservation_id := 2594411;
   l_reservation_rec.demand_source_line_id := 48960;
   l_qty_convert := 200;
    
   gme_api_pub.convert_dtl_reservation
                                     (p_api_version          => 2.0,
                                      p_init_msg_list        => fnd_api.g_false,
                                      p_commit               => fnd_api.g_false,
                                      x_message_count        => x_message_count,
                                      x_message_list         => x_message_list,
                                      x_return_status        => x_return_status,
                                      p_reservation_rec      => l_reservation_rec,
                                      p_qty_convert          => l_qty_convert
                                     ); 
   DBMS_OUTPUT.put_line ('x_message_count = ' || TO_CHAR (x_message_count));
   DBMS_OUTPUT.put_line (SUBSTR ('x_message_list = ' || x_message_list, 1,
                                 255)
                        );
   DBMS_OUTPUT.put_line (SUBSTR ('x_return_status = ' || x_return_status,
                                 1,
                                 255
                                )
                        );

   IF x_message_count > 0
   THEN
      display_messages (x_message_count);
   END IF;
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line ('Error ' || TO_CHAR (SQLCODE) || ': ' || SQLERRM);
      RAISE;
END;
/

  

posted on 2018-11-26 16:36  Jenrry  阅读(325)  评论(0编辑  收藏  举报