使用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_order_pub.request_tbl_type;
  v_line_adj_tbl       oe_order_pub.line_adj_tbl_type;
  -- OUT Variables --
  v_header_rec_out             oe_order_pub.header_rec_type;
  v_header_val_rec_out         oe_order_pub.header_val_rec_type;
  v_header_adj_tbl_out         oe_order_pub.header_adj_tbl_type;
  v_header_adj_val_tbl_out     oe_order_pub.header_adj_val_tbl_type;
  v_header_price_att_tbl_out   oe_order_pub.header_price_att_tbl_type;
  v_header_adj_att_tbl_out     oe_order_pub.header_adj_att_tbl_type;
  v_header_adj_assoc_tbl_out   oe_order_pub.header_adj_assoc_tbl_type;
  v_header_scredit_tbl_out     oe_order_pub.header_scredit_tbl_type;
  v_header_scredit_val_tbl_out oe_order_pub.header_scredit_val_tbl_type;
  v_line_tbl_out               oe_order_pub.line_tbl_type;
  v_line_val_tbl_out           oe_order_pub.line_val_tbl_type;
  v_line_adj_tbl_out           oe_order_pub.line_adj_tbl_type;
  v_line_adj_val_tbl_out       oe_order_pub.line_adj_val_tbl_type;
  v_line_price_att_tbl_out     oe_order_pub.line_price_att_tbl_type;
  v_line_adj_att_tbl_out       oe_order_pub.line_adj_att_tbl_type;
  v_line_adj_assoc_tbl_out     oe_order_pub.line_adj_assoc_tbl_type;
  v_line_scredit_tbl_out       oe_order_pub.line_scredit_tbl_type;
  v_line_scredit_val_tbl_out   oe_order_pub.line_scredit_val_tbl_type;
  v_lot_serial_tbl_out         oe_order_pub.lot_serial_tbl_type;
  v_lot_serial_val_tbl_out     oe_order_pub.lot_serial_val_tbl_type;
  v_action_request_tbl_out     oe_order_pub.request_tbl_type;
  --
  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 --
  mo_global.init('ONT');
  fnd_global.apps_initialize(user_id      => v_user_id,
                             resp_id      => v_resp_id,
                             resp_appl_id => v_resp_appl_id);

  mo_global.set_policy_context('S', fnd_global.org_id);
  -- Header Record --
  v_header_rec := oe_order_pub.g_miss_header_rec;
  v_header_rec.operation := oe_globals.g_opr_create;
  v_header_rec.order_number := 1111111;
  v_header_rec.order_type_id := 1001;        --OE_TRANSACTION_TYPES_ALL.TRANSACTION_TYPE_ID
  v_header_rec.sold_to_org_id := 70802;      --HZ_CUST_SITE_USES_ALL.SITE_USE_ID(INV)
  v_header_rec.ship_to_org_id := 5859039;    --HZ_CUST_SITE_USES_ALL.SITE_USE_ID(SHIP_TO)
  v_header_rec.invoice_to_org_id := 1154;    --HZ_CUST_SITE_USES_ALL.SITE_USE_ID(BILL_TO)
  v_header_rec.order_source_id := 1001;      --OE_ORDER_SOURCES.ORDER_SOURCE_ID
  v_header_rec.booked_flag := 'N';
  v_header_rec.price_list_id := 7023;        --QP_LIST_HEADERS_ALL_B.LIST_HEADER_ID
  v_header_rec.pricing_date := SYSDATE;
  v_header_rec.flow_status_code := 'ENTERED';
  --v_header_rec.cust_po_number := '';
  v_header_rec.sold_from_org_id := 121;      --OU
  v_header_rec.salesrep_id := 100001013;     --JTF_RS_RESOURCE_EXTNS.RESOURCE_ID
  v_header_rec.transactional_curr_code := 'JPY'; --Currency
  v_action_request_tbl(1) := oe_order_pub.g_miss_request_rec;
  -- Line Record --
  v_line_tbl(1) := oe_order_pub.g_miss_line_rec;
  v_line_tbl(1).operation := oe_globals.g_opr_create;
  v_line_tbl(1).inventory_item_id := 362133;  --MTL_SYSTEM_ITEMS_B.INVENTORY_ITEM_ID
  v_line_tbl(1).ordered_quantity := 1;
  v_line_tbl(1).unit_selling_price := 235;
  v_line_tbl(1).calculate_price_flag := 'N';
  v_line_tbl(1).line_type_id := 1013;         --OE_TRANSACTION_TYPES_ALL.TRANSACTION_TYPE_ID
  dbms_output.put_line('Starting of API');
  -- Calling the API to create an Order --
  oe_order_pub.process_order(p_api_version_number => v_api_version_number,
                             p_header_rec         => v_header_rec,
                             p_line_tbl           => v_line_tbl,
                             p_action_request_tbl => v_action_request_tbl,
                             p_line_adj_tbl       => v_line_adj_tbl
                             -- OUT variables
                            ,
                             x_header_rec             => v_header_rec_out,
                             x_header_val_rec         => v_header_val_rec_out,
                             x_header_adj_tbl         => v_header_adj_tbl_out,
                             x_header_adj_val_tbl     => v_header_adj_val_tbl_out,
                             x_header_price_att_tbl   => v_header_price_att_tbl_out,
                             x_header_adj_att_tbl     => v_header_adj_att_tbl_out,
                             x_header_adj_assoc_tbl   => v_header_adj_assoc_tbl_out,
                             x_header_scredit_tbl     => v_header_scredit_tbl_out,
                             x_header_scredit_val_tbl => v_header_scredit_val_tbl_out,
                             x_line_tbl               => v_line_tbl_out,
                             x_line_val_tbl           => v_line_val_tbl_out,
                             x_line_adj_tbl           => v_line_adj_tbl_out,
                             x_line_adj_val_tbl       => v_line_adj_val_tbl_out,
                             x_line_price_att_tbl     => v_line_price_att_tbl_out,
                             x_line_adj_att_tbl       => v_line_adj_att_tbl_out,
                             x_line_adj_assoc_tbl     => v_line_adj_assoc_tbl_out,
                             x_line_scredit_tbl       => v_line_scredit_tbl_out,
                             x_line_scredit_val_tbl   => v_line_scredit_val_tbl_out,
                             x_lot_serial_tbl         => v_lot_serial_tbl_out,
                             x_lot_serial_val_tbl     => v_lot_serial_val_tbl_out,
                             x_action_request_tbl     => v_action_request_tbl_out,
                             x_return_status          => v_return_status,
                             x_msg_count              => v_msg_count,
                             x_msg_data               => v_msg_data);
  dbms_output.put_line('Completion of API');
  IF v_return_status = fnd_api.g_ret_sts_success THEN
    --COMMIT;
    dbms_output.put_line('Order Import Success : ' ||
                         v_header_rec_out.header_id);
  ELSE
    dbms_output.put_line('Order Import failed:' || v_msg_data);
    --ROLLBACK;
    FOR i IN 1 .. v_msg_count LOOP
      v_msg_data := oe_msg_pub.get(p_msg_index => i, p_encoded => 'F');
      dbms_output.put_line(i || ') ' || v_msg_data);
    END LOOP;
  END IF;
END;

时间: 2024-10-31 20:12:52

使用API创建销售订单的相关文章

使用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_

创建销售订单提示:配置文件选项不允许自动编号

crm操作销售订单实体

using System; using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Query; using Microsoft.Crm.Sdk.Messages; /// <summary> /// 销售订单 /// </summary> public class SoleOrderHelper { public static readonly string entityName = "salesorder"; pub

OEOIMP-创建销售订单(R12.2.3)

 创建销售订单(R12.2.3) --US Program:Order Import Short Name:OEOIMP Application:Order Management Executable:Order Import --ZHS 程序:订单导入 简称:OEOIMP 应用产品:订单管理 可执行名称:Order Import PLSQL调用 l_request_id := fnd_request.submit_request( 'ONT', 'OEOIMP', 'Order Impor

[SAP ABAP开发技术总结]SD销售订单定价过程

目录导航 声明:原创作品,转载时请注明文章来自SAP师太博客,并以超链接形式标明文章原始出处,否则将追究法律责任!原文出自: 16.3.2.     定价过程... 141 16.3.2.1.           条件技术七要素... 141 16.3.2.2.           条件表V/03.V/04.V/05. 142 16.3.2.3.           存取顺序 V/07. 142 16.3.2.4.           条件类型 V/06. 142 16.3.2.5.      

为什么S/4HANA的销售订单创建会触发生产订单的创建

调用S/4HANA销售订单创建函数SD_SALES_DOCU_MAINTAIN创建一个销售订单时,会触发生产订单的创建. 销售订单的每个行项目对应一个独立的生产订单,SD_SALES_DOCU_MAINTAIN相当于CRM里的CRM_ORDER_MAINTAIN,在LOOP里处理每一个行项目: 观察这个函数内部的调用栈,发现一个subroutine EIGENFERTIGUNG_BEARBEITEN.: EIGENFERTIGUNG的意思是Own production: BEARBEITEN的意

SAP SD如何将销售订单其它ITEM加入到一个已创建好的交货单里

如下的销售订单,有多个ITEM, 为其中的第一个ITEM创建了DN 80016362, 如果业务发现需要修改该交货单,将销售订单里的其它ITEM也加入到该DN里. 如下方式, VL02N,进入到该交货单的修改界面,如下菜单, 弹出如下界面, 回车, 系统就将销售订单的20/30 行项目带入交货单了. 此时可以根据需要修改交货数量,保存即可. 2019-06-10 写于苏州市. 原文地址:https://www.cnblogs.com/DicksonJYL/p/11023610.html

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

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