Join the OracleApps88 Telegram group @OracleApps88to get more information on Oracle EBS R12/Oracle Fusion applications.

If you are facing any issues while copying the Code/Script or any issues with Posts, Please send a mail to OracleApp88@Yahoo.com or message me at @apps88 or +91 905 957 4321 in telegram.

Thursday, December 24, 2015

Create Deliver Through API script in Order Management

As a next step to booking, a new delivery needs to be created. In order to create a new delivery we need to call the shipping API “WSH_DELIVERIES_PUB.Create_update_delivery” by passing the required and optional parameter values.

Specific parameters:
·         P_api_version_number          => 1.0
·         p_action_code                 => CREATE --  for creating new delivery
·         p_delivery_info                      => Attributes of the delivery entity of type Delivery_Pub_Rec_Type

The sample script attached here can be used to create a new delivery.
DECLARE
   -- Standard Parameters.  
   p_api_version            NUMBER;  
   init_msg_list            VARCHAR2(30);
   p_commit                 VARCHAR2(30);

   -- Sepcific Parameters for WSH_DELIVERIES_PUB.create_update_delivery
   p_action_code            VARCHAR2(15);                            
   delivery_id              NUMBER;
   delivery_info            WSH_DELIVERIES_PUB.DELIVERY_PUB_REC_TYPE;
   delivery_name            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);
  
   -- Create a new delivery for the following  
   delivery_info.name                            := 'XXAA_OEDL_001'; -- Pass delivery name
   delivery_info.organization_id                 := 207;      -- Pass Organization ID
   delivery_info.initial_pickup_location_id      := 207;      -- Pass the Pick up location ID
   delivery_info.ultimate_dropoff_location_id    := 1091;     -- pass the Drop off location ID
   delivery_info.ship_method_code                := 'DHL';    -- pass Ship Method
   p_action_code                                 := 'CREATE'; -- Action Code
  
   -- Call to WSH_DELIVERIES_PUB.create_update_delivery
   WSH_DELIVERIES_PUB.create_update_delivery(
      p_api_version_number  => 1.0,
      p_init_msg_list       => init_msg_list,
      x_return_status       => x_return_status,
      x_msg_count           => x_msg_count,
      x_msg_data            => x_msg_data,
      p_action_code         => p_action_code,
      p_delivery_info       => delivery_info,
      p_delivery_name       => delivery_name,
      x_delivery_id         => delivery_id,
      x_name                => delivery_name );
  
   -- If the return status is not success(S) then raise exception  
   if (x_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS) then
      raise fail_api;
   else
      dbms_output.put_line('New Delivery ID  : '||delivery_id);
      dbms_output.put_line('New Delivery Name: '||delivery_name);
   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;
/


COMMIT;

No comments:

Post a Comment

If you are facing any issues while copying the Code/Script or any issues with Posts, Please send a mail to OracleApp88@Yahoo.com or message me at @apps88 or +91 905 957 4321 in telegram.
Best Blogger TipsGet Flower Effect