Thursday, November 7, 2013

Auto-create Deliveries API

Your Ad Here



CREATE OR REPLACE PROCEDURE create_deliveries (
   p_delivery_detail_ids   IN     wsh_util_core.id_tab_type,
   x_delivery_id              OUT NUMBER,
   x_return_status            OUT VARCHAR2,
   x_error_message            OUT VARCHAR2)
IS
   v_api_version_number   NUMBER := 1;
   v_init_msg_list        VARCHAR2 (30);
   v_commit               VARCHAR2 (30);
   v_msg_count            NUMBER;
   v_msg_data             VARCHAR2 (2000);
   v_msg_summary          VARCHAR2 (3000);
   v_msg_details          VARCHAR2 (3000);
   v_line_rows            wsh_util_core.id_tab_type;
   v_del_rows             wsh_util_core.id_tab_type;
BEGIN
   --Delivery_detail_ids
   DBMS_OUTPUT.put_line ('in create_deliveries--------');
   v_line_rows := p_delivery_detail_ids;
   --Autocreate Deliveries
   wsh_delivery_details_pub.autocreate_deliveries (
      p_api_version_number   => v_api_version_number,
      p_init_msg_list        => v_init_msg_list,
      p_commit               => v_commit,
      x_return_status        => x_return_status,
      x_msg_count            => v_msg_count,
      x_msg_data             => v_msg_data,
      p_line_rows            => v_line_rows,
      x_del_rows             => v_del_rows);
   DBMS_OUTPUT.put_line (
      'Auto create deliveries x_return_status  : ' || x_return_status);

   IF (x_return_status <> fnd_api.g_ret_sts_success)
   THEN
      wsh_util_core.get_messages ('Y',
                                  v_msg_summary,
                                  v_msg_details,
                                  v_msg_count);

      IF v_msg_count > 1
      THEN
         v_msg_data := v_msg_summary || v_msg_details;
      ELSE
         v_msg_data := v_msg_summary;
      END IF;

      x_error_message := v_msg_data;
      x_return_status := 'E';
      DBMS_OUTPUT.put_line (
            'After call to wsh_delivery_details_pub.autocreate_deliveries: Error message v_msg_data '
         || v_msg_data);
   ELSE
      DBMS_OUTPUT.put_line ('Delivery_id=' || v_del_rows (1));
      x_delivery_id := v_del_rows (1);
      x_return_status := 'S';
   END IF;
EXCEPTION
   WHEN OTHERS
   THEN
      x_return_status := 'E';
      x_error_message := SQLCODE || ':' || SQLERRM;
      DBMS_OUTPUT.put_line ('Error :' || x_error_message);
      RETURN;
END;
Your Ad Here

1 comment:

  1. Thank you for your nice post. It is really useful. Shop for organic products Fuzzy International.

    ReplyDelete