使用API进行销售订单的Pick Release和Pick Confirm

DECLARE

  x_return_status      VARCHAR2(2);
  x_msg_count          NUMBER;
  x_msg_data           VARCHAR2(2000);
  p_api_version_number NUMBER := 1.0;
  init_msg_list        VARCHAR2(200);
  x_msg_details        VARCHAR2(3000);
  x_msg_summary        VARCHAR2(3000);
  p_line_rows          wsh_util_core.id_tab_type;
  x_del_rows           wsh_util_core.id_tab_type;
  l_ship_method_code   VARCHAR2(100);
  i                    NUMBER;
  l_commit             VARCHAR2(30);
  p_delivery_id        NUMBER;
  p_delivery_name      VARCHAR2(30);
  x_trip_id            VARCHAR2(30);
  x_trip_name          VARCHAR2(30);
  exep_api EXCEPTION;
  l_picked_flag   VARCHAR2(10);
  l_return_status VARCHAR2(1000);
  l_msg_count     NUMBER;
  l_msg_data      VARCHAR2(1000);
  l_user_id       NUMBER;
  l_resp_id       NUMBER;
  l_appl_id       NUMBER;

  CURSOR c_ord_details IS

    SELECT oha.order_number sales_order
          ,oha.org_id
          ,ola.line_number
          ,ola.shipment_number
          ,ola.flow_status_code
          ,wdd.delivery_detail_id
          ,wdd.inv_interfaced_flag
          ,wdd.oe_interfaced_flag
          ,wdd.released_status
      FROM apps.oe_order_headers_all oha
          ,apps.oe_order_lines_all   ola
          ,apps.wsh_delivery_details wdd
     WHERE oha.header_id = ola.header_id
       AND oha.org_id = ola.org_id
       AND oha.header_id = wdd.source_header_id
       AND ola.line_id = wdd.source_line_id
       AND oha.booked_flag = 'Y'
       AND nvl(ola.cancelled_flag, 'N') <> 'Y'
       AND wdd.released_status IN ('R', 'B')
       AND ola.flow_status_code = 'AWAITING_SHIPPING'
       AND oha.order_number = 1506764261
       AND oha.org_id = 121;
  --
  v_user_id      NUMBER;
  v_resp_id      NUMBER;
  v_resp_appl_id NUMBER;
  --    

BEGIN

  --
  /* To get the user id details */
  SELECT user_id INTO v_user_id FROM fnd_user WHERE user_name = 'SETUP01';

  /* To get the responsibility and responsibility application id */
  SELECT f.responsibility_id, f.application_id
    INTO v_resp_id, v_resp_appl_id
    FROM fnd_responsibility_tl f
   WHERE f.responsibility_name = '受注管理スーパーユーザー(SC)'
     AND f.language = 'JA';

  dbms_output.put_line(v_user_id || ' ' || v_resp_id || ' ' ||
                       v_resp_appl_id);
  --
  dbms_output.put_line('Starting of script');
  -- Setting the Enviroment --
  fnd_global.apps_initialize(user_id      => v_user_id,
                             resp_id      => v_resp_id,
                             resp_appl_id => v_resp_appl_id);
  --

  x_return_status := wsh_util_core.g_ret_sts_success;
  i               := 0;

  FOR i IN c_ord_details

   LOOP

    -- Mandatory initialization for R12
    mo_global.set_policy_context('S', i.org_id);
    mo_global.init('ONT');

    p_line_rows(1) := i.delivery_detail_id;

    -- API Call for Auto Create Deliveries

    dbms_output.put_line('Calling WSH_DELIVERY_DETAILS_PUB to Perform AutoCreate Delivery');
    dbms_output.put_line('====================================================');

    wsh_delivery_details_pub.autocreate_deliveries(p_api_version_number => 1.0,
                                                   p_init_msg_list      => apps.fnd_api.g_true,
                                                   p_commit             => l_commit,
                                                   x_return_status      => x_return_status,
                                                   x_msg_count          => x_msg_count,
                                                   x_msg_data           => x_msg_data,
                                                   p_line_rows          => p_line_rows,
                                                   x_del_rows           => x_del_rows);

    dbms_output.put_line(x_return_status);
    dbms_output.put_line(x_msg_count);
    dbms_output.put_line(x_msg_data);

    IF (x_return_status <> wsh_util_core.g_ret_sts_success) THEN

      dbms_output.put_line('Failed to Auto create delivery for Sales Order');
      RAISE exep_api;

    ELSE

      dbms_output.put_line('Auto Create Delivery Action has successfully completed for SO');
      dbms_output.put_line('=============================================');
    END IF;

    -- Pick release.
    p_delivery_id   := x_del_rows(1);
    p_delivery_name := to_char(x_del_rows(1));

    dbms_output.put_line('Calling WSH_DELIVERIS_PUB to Perform Pick Release of SO');
    dbms_output.put_line('=============================================');
    -- API Call for Pick Release

    wsh_deliveries_pub.delivery_action(p_api_version_number      => 1.0,
                                       p_init_msg_list           => NULL,
                                       x_return_status           => x_return_status,
                                       x_msg_count               => x_msg_count,
                                       x_msg_data                => x_msg_data,
                                       p_action_code             => 'PICK-RELEASE',
                                       p_delivery_id             => p_delivery_id,
                                       p_delivery_name           => p_delivery_name,
                                       p_asg_trip_id             => NULL,
                                       p_asg_trip_name           => NULL,
                                       p_asg_pickup_stop_id      => NULL,
                                       p_asg_pickup_loc_id       => NULL,
                                       p_asg_pickup_stop_seq     => NULL,
                                       p_asg_pickup_loc_code     => NULL,
                                       p_asg_pickup_arr_date     => NULL,
                                       p_asg_pickup_dep_date     => NULL,
                                       p_asg_dropoff_stop_id     => NULL,
                                       p_asg_dropoff_loc_id      => NULL,
                                       p_asg_dropoff_stop_seq    => NULL,
                                       p_asg_dropoff_loc_code    => NULL,
                                       p_asg_dropoff_arr_date    => NULL,
                                       p_asg_dropoff_dep_date    => NULL,
                                       p_sc_action_flag          => 'S',
                                       p_sc_intransit_flag       => 'N',
                                       p_sc_close_trip_flag      => 'N',
                                       p_sc_create_bol_flag      => 'N',
                                       p_sc_stage_del_flag       => 'Y',
                                       p_sc_trip_ship_method     => NULL,
                                       p_sc_actual_dep_date      => NULL,
                                       p_sc_report_set_id        => NULL,
                                       p_sc_report_set_name      => NULL,
                                       p_sc_defer_interface_flag => 'Y',
                                       p_sc_send_945_flag        => NULL,
                                       p_sc_rule_id              => NULL,
                                       p_sc_rule_name            => NULL,
                                       p_wv_override_flag        => 'N',
                                       x_trip_id                 => x_trip_id,
                                       x_trip_name               => x_trip_name);

    dbms_output.put_line(x_return_status);
    dbms_output.put_line(x_msg_count);
    dbms_output.put_line(x_msg_data);

    IF (x_return_status <> wsh_util_core.g_ret_sts_success) THEN

      dbms_output.put_line('Failed to Pick Release the sales order');
      RAISE exep_api;

    ELSE

      dbms_output.put_line('Sales Order has successfully Pick Released');
      dbms_output.put_line('==============================');

    END IF;

    --for pick confirm
    --COMMIT;

  END LOOP;

EXCEPTION

  WHEN exep_api THEN

    dbms_output.put_line('==============');
    dbms_output.put_line('Error Details If Any');
    dbms_output.put_line('==============');

    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(x_msg_data);

    ELSE

      x_msg_data := x_msg_summary || '---' || x_msg_details;
      dbms_output.put_line(x_msg_data);

    END IF;

END;

时间: 2024-10-08 20:32:37

使用API进行销售订单的Pick Release和Pick Confirm的相关文章

使用API创建销售订单

DECLARE v_api_version_number NUMBER := 1; v_return_status VARCHAR2(2000); v_msg_count NUMBER; v_msg_data VARCHAR2(2000); -- IN Variables -- v_header_rec oe_order_pub.header_rec_type; v_line_tbl oe_order_pub.line_tbl_type; v_action_request_tbl oe_orde

Oracle EBS更新销售订单行信息API

 更新销售订单行信息 DECLARE l_header_rec             oe_order_pub.header_rec_type; l_line_tbl               oe_order_pub.line_tbl_type; l_line_tb2               oe_order_pub.line_tbl_type; l_action_request_tbl     oe_order_pub.request_tbl_type; l_return_sta

AR_销售订单收款基本操作(流程)

2014-06-04 BaoXinjian 一.步骤 1. 输入销售订单,输入(Enter)-->预定(Book)-->计划(Schedule)-->保留(Reserve) 2. 进行挑库操作, 挑库(Pick Release)-->挑库确认(Pick Confirm) 3. 制作发运单,制作发运单(Create Delivery)-->发运确认(Ship Confirm) 4. 程式停靠接口(Interface Trip Stop) 5. 关闭订单, 启动workflow处

已存在销售订单上插入销售订单行

 在已存在销售订单上插入销售订单行 --This is to add a line to an existing order DECLARE l_api_version_number NUMBER := 1 ; l_return_status      VARCHAR2(2000 ); l_msg_count          NUMBER; l_msg_data           VARCHAR2(2000 ); /*****************INPUT VARIABLES FOR

EBS OM销售订单接口相关

OM接口相关表: 1. OE_HEADERS_IFACE_ALL 此表为多组织表,用于将销售订单头插入开放接口.    该表存储来自于其他子系统需要导入OM模块的订单头信息,    该表导入时必须输入的字段/条件:    ORDER_SOURCE_ID : Order source id 可选    ORIG_SYS_DOCUMENT_REF: Original system document reference 必须    ORDER_SOURCE : Order source 可选    O

Amzon MWS API开发之订单接口

Amzon MWS API开发之订单接口 Amazon订单接口是Amazon MWS 开发接口中的一大块,我们可以通过接口调用来获得订单数据. 在调用接口之前,首先我们要获得相关店铺商家的店铺密钥等信息.如下: 在此我将所有信息定义在一个类中,采用序列化的方式,方便存取值. 1 /// <summary> 2 /// 账户信息 3 /// </summary> 4 [Serializable] 5 public class AccountConfig : BaseConfig<

销售订单、外向交货单、交货 bapi

转自[http://www.cnblogs.com/elegantok/archive/2009/10/18/1585398.html]***********SALES ORDER INPUT CREATION. REPORT soi. PARAMETERS: p_auart TYPE auart OBLIGATORY.PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.PARAM

BAPI 修改销售订单的方法 ‘BAPI_SALESORDER_CHANGE’

(原创)BAPI 修改销售订单的方法 ‘BAPI_SALESORDER_CHANGE’ 2009-08-21 16:22:55 分类: Linux sap 标准程序中可以使用VA02来修改销售订单 change sales order,也可以在程序中调用BAPI来更改订单(如物料编号material,订购数量 order quantity等),用到的函数是 BAPI_SALESORDER_CHANGE.sap bapi Explorer中的文档.   Method SalesOrder.Chan

销售订单-修改量-高级定价关联sql

修改量消耗明细 --修改量消耗明细 SELECT t.name, t.comments, t.version_no, cux_rebate_pub.get_hou_name(p_organization_id => t.orig_org_id) org_name, ac.customer_name, --ql.amount "限额", -- qlb.limit_balance_id, qlb.consumed_amount "总消耗", qlb.availab