Thursday, December 24, 2015

Assign delivery detail to delivery Through API Script in Order Mangement

The delivery detail can be assigned to the newly created delivery by using the public API “WSH_DELIVERY_DETAILS_PUB. Detail_to_Delivery”.


Specific Parameters:
·         p_TabOfDelDets                => Table of Delivery Detail id’s
·         p_action                              => ASSIGN
·         p_delivery_id                     => Delivery id
·         delivery_name                   => Delivery name to which the detail lines will be assigned

The sample script attached here can be used to assign the delivery detail to the newly created delivery.
DECLARE
   -- Standard Parameters.  
   p_api_version            NUMBER;
   p_init_msg_list            VARCHAR2(30);
   p_commit                 VARCHAR2(30);

   -- Parameters for WSH_DELIVERY_DETAILS_PUB.Detail_to_Delivery  
   p_delivery_id            NUMBER;
   p_delivery_name          VARCHAR2(30);
   p_TabOfDelDet            WSH_DELIVERY_DETAILS_PUB.id_tab_type;
   p_action                 VARCHAR2(30);

   -- out parameters  
   x_return_status          VARCHAR2(10);
   x_msg_count              NUMBER;
   x_msg_data               VARCHAR2(2000);
   x_msg_details            VARCHAR2(3000);
   x_msg_summary            VARCHAR2(3000);

   -- Handle exceptions  
   fail_api                 EXCEPTION;
BEGIN
   -- Initialize return status  
   x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
  
   -- Call this procedure to initialize applications parameters.      
   FND_GLOBAL.APPS_INITIALIZE(1318, 21623, 660);
  
   -- Values for WSH_DELIVERY_DETAILS_PUB.Detail_to_Delivery  
   p_delivery_id         := 1997596;
   p_delivery_name       :='TEST-001';
   p_TabOfDelDet(1)      := 2295572;
   p_action              := 'ASSIGN';

   -- Call to WSH_DELIVERY_DETAILS_PUB.Detail_to_Delivery.
   WSH_DELIVERY_DETAILS_PUB.Detail_to_Delivery(
      p_api_version      => 1.0,
      p_init_msg_list    => p_init_msg_list,
      p_commit           => p_commit,
      x_return_status    => x_return_status,
      x_msg_count        => x_msg_count,
      x_msg_data         => x_msg_data,
      p_TabOfDelDets     => p_TabOfDelDet,
      p_action           => p_action,
      p_delivery_id      => p_delivery_id,
      p_delivery_name    => p_delivery_name);
     
   if (x_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS) then
      raise fail_api;
   else
      dbms_output.put_line('Detail '||p_TabOfDelDet(1)|| ' assignment to the delivery '|| p_delivery_name ||' is successful');
   end if;
EXCEPTION
   when fail_api then
      WSH_UTIL_CORE.get_messages('Y', x_msg_summary, x_msg_details,x_msg_count);
      if x_msg_count > 1 then
         x_msg_data := x_msg_summary || x_msg_details;
         Dbms_output.put_line('Message Data : '||x_msg_data);
      else
         x_msg_data := x_msg_summary;
         Dbms_output.put_line('Message Data : '||x_msg_data);
      end if;
END;

/

No comments:

Post a Comment

Best Blogger TipsGet Flower Effect