Oracle EBS OM Drop Ship Orders (direct delivery business) technology-API and core table association relationship introduction

Create Sales Order API
creates an instance of Drop Ship Orders API as follows:

DECLARE
  Ln_Org_Id NUMBER := 81;

  Lt_Header_Rec     Oe_Order_Pub.Header_Rec_Type;
  Ln_User_Id        NUMBER := 1230;
  Lt_Line_Tbl       Oe_Order_Pub.Line_Tbl_Type;
  i                 NUMBER := 0;
  Lt_Ret_Header_Rec Oe_Order_Pub.Header_Rec_Type;
  Xt_Ret_Line_Tbl   Oe_Order_Pub.Line_Tbl_Type;
  Xv_Ret_Status     VARCHAR2(1);
  Lv_Ret_Message    VARCHAR2(2000);

  Lt_Action_Qeq_Tbl Oe_Order_Pub.Request_Tbl_Type;

  Lt_Header_Val_Rec         Oe_Order_Pub.Header_Val_Rec_Type;
  Lt_Header_Adj_Tbl         Oe_Order_Pub.Header_Adj_Tbl_Type;
  Lt_Header_Adj_Val_Tbl     Oe_Order_Pub.Header_Adj_Val_Tbl_Type;
  Lt_Header_Price_Att_Tbl   Oe_Order_Pub.Header_Price_Att_Tbl_Type;
  Lt_Header_Adj_Att_Tbl     Oe_Order_Pub.Header_Adj_Att_Tbl_Type;
  Lt_Header_Adj_Assoc_Tbl   Oe_Order_Pub.Header_Adj_Assoc_Tbl_Type;
  Lt_Header_Scredit_Tbl     Oe_Order_Pub.Header_Scredit_Tbl_Type;
  Lt_Header_Scredit_Val_Tbl Oe_Order_Pub.Header_Scredit_Val_Tbl_Type;

  Lt_Line_Adj_Tbl         Oe_Order_Pub.Line_Adj_Tbl_Type;
  Lt_Line_Price_Att_Tbl   Oe_Order_Pub.Line_Price_Att_Tbl_Type;
  Lt_Line_Adj_Att_Tbl     Oe_Order_Pub.Line_Adj_Att_Tbl_Type;
  Lt_Line_Adj_Assoc_Tbl   Oe_Order_Pub.Line_Adj_Assoc_Tbl_Type;
  Lt_Line_Scredit_Tbl     Oe_Order_Pub.Line_Scredit_Tbl_Type;
  Lt_Lot_Serial_Tbl       Oe_Order_Pub.Lot_Serial_Tbl_Type;
  Lt_Line_Val_Tbl         Oe_Order_Pub.Line_Val_Tbl_Type;
  Lt_Line_Adj_Val_Tbl     Oe_Order_Pub.Line_Adj_Val_Tbl_Type;
  Lt_Line_Scredit_Val_Tbl Oe_Order_Pub.Line_Scredit_Val_Tbl_Type;

  Lt_Lot_Serial_Val_Tbl Oe_Order_Pub.Lot_Serial_Val_Tbl_Type;
  Xt_Action_Qeq_Tbl     Oe_Order_Pub.Request_Tbl_Type;

  Ln_Api_Version_Number NUMBER := 1;
  Ln_Msg_Count          NUMBER;
  Lv_Msg_Data           VARCHAR2(8000);
  Lv_Msg_Index_Out      VARCHAR2(2000);
BEGIN
  Mo_Global.Init('ONT');
  Mo_Global.Set_Policy_Context('S', Ln_Org_Id);
  Fnd_Global.Apps_Initialize(User_Id      => Ln_User_Id
                            ,Resp_Id      => 50747 -- Order Management Super User
                            ,Resp_Appl_Id => 50201 -- Oracle Order Management
                             );
  Oe_Msg_Pub.Initialize;
  Oe_Debug_Pub.Initialize;

  Lt_Header_Rec                         := Oe_Order_Pub.g_Miss_Header_Rec;
  Lt_Header_Rec.Operation               := Oe_Globals.g_Opr_Create;
  Lt_Header_Rec.Sold_To_Org_Id          := 1593; --
  Lt_Header_Rec.Org_Id                  := Ln_Org_Id;
  Lt_Header_Rec.Ship_From_Org_Id        := 84;
  Lt_Header_Rec.Orig_Sys_Document_Ref   := '测试直发业务201904300821';
  Lt_Header_Rec.Source_Document_Id      := 20190603;
  Lt_Header_Rec.Order_Type_Id           := 1014;
  Lt_Header_Rec.Order_Source_Id         := 0;
  Lt_Header_Rec.Transactional_Curr_Code := 'CNY';
  Lt_Header_Rec.Attribute1              := '10'; --安状类型
  Lt_Header_Rec.Attribute2              := '12000'; --合同号
  Lt_Header_Rec.Attribute3              := 'NO'; --是否WMS处理
  Lt_Header_Rec.Payment_Term_Id         := 5;
  Lt_Header_Rec.Price_List_Id           := 6017;
  Lt_Header_Rec.Conversion_Type_Code    := 'Corporate';
  Lt_Header_Rec.Salesrep_Id             := -3;
  Lt_Header_Rec.Ordered_Date            := SYSDATE;
  Lt_Header_Rec.Order_Category_Code     := 'ORDER';
  Lt_Header_Rec.Flow_Status_Code        := 'BOOKED';
  --Who Column
  Lt_Header_Rec.Creation_Date     := SYSDATE;
  Lt_Header_Rec.Created_By        := Ln_User_Id;
  Lt_Header_Rec.Last_Updated_By   := Ln_User_Id;
  Lt_Header_Rec.Last_Update_Date  := SYSDATE;
  Lt_Header_Rec.Last_Update_Login := Fnd_Global.Login_Id;

  i := i + 1;
  Lt_Line_Tbl(i) := Oe_Order_Pub.g_Miss_Line_Rec;
  Lt_Line_Tbl(i).Operation := Oe_Globals.g_Opr_Create;
  --与header相同的字段
  Lt_Line_Tbl(i).Order_Source_Id := Lt_Header_Rec.Order_Source_Id;
  Lt_Line_Tbl(i).Org_Id := Lt_Header_Rec.Org_Id;
  Lt_Line_Tbl(i).Sold_To_Org_Id := Lt_Header_Rec.Sold_To_Org_Id;
  Lt_Line_Tbl(i).Ship_From_Org_Id := Lt_Header_Rec.Ship_From_Org_Id;
  Lt_Line_Tbl(i).Price_List_Id := Lt_Header_Rec.Price_List_Id;
  Lt_Line_Tbl(i).Salesrep_Id := Lt_Header_Rec.Salesrep_Id;
  Lt_Line_Tbl(i).Invoice_To_Org_Id := Lt_Header_Rec.Invoice_To_Org_Id;
  Lt_Line_Tbl(i).Ship_To_Org_Id := Lt_Header_Rec.Ship_To_Org_Id;
  --Who Column
  Lt_Line_Tbl(i).Created_By := Lt_Header_Rec.Created_By;
  Lt_Line_Tbl(i).Creation_Date := Lt_Header_Rec.Creation_Date;
  Lt_Line_Tbl(i).Last_Updated_By := Lt_Header_Rec.Last_Updated_By;
  Lt_Line_Tbl(i).Last_Update_Date := Lt_Header_Rec.Last_Update_Date;
  Lt_Line_Tbl(i).Last_Update_Login := Lt_Header_Rec.Last_Update_Login;
  --Om Line
  Lt_Line_Tbl(i).Orig_Sys_Line_Ref := '测试直发业务201904300821';
  Lt_Line_Tbl(i).Item_Type_Code := 'STANDARD';
  Lt_Line_Tbl(i).Inventory_Item_Id := 34;
  Lt_Line_Tbl(i).Schedule_Ship_Date := SYSDATE + 10;
  Lt_Line_Tbl(i).Schedule_Arrival_Date := SYSDATE + 10;
  Lt_Line_Tbl(i).Promise_Date := Trunc(SYSDATE);
  Lt_Line_Tbl(i).Ordered_Quantity := 1000;
  Lt_Line_Tbl(i).Order_Quantity_Uom := 'EA';
  Lt_Line_Tbl(i).Unit_List_Price := 10;
  Lt_Line_Tbl(i).Unit_Selling_Price := 3000;
  Lt_Line_Tbl(i).Tax_Code := NULL;
  Lt_Line_Tbl(i).Tax_Date := SYSDATE;
  Lt_Line_Tbl(i).Calculate_Price_Flag := 'N';
  Lt_Line_Tbl(i).Orig_Sys_Document_Ref := '测试直发业务201904300821';
  Lt_Line_Tbl(i).Orig_Sys_Line_Ref := '1';
  Lt_Line_Tbl(i).Orig_Sys_Document_Ref := 'fasf';
  Lt_Line_Tbl(i).Orig_Sys_Line_Ref := '1';
  Lt_Line_Tbl(i).Source_Document_Id := 1;
  Lt_Line_Tbl(i).Source_Document_Line_Id := 2;
  Lt_Line_Tbl(i).SOURCE_TYPE_CODE := 'EXTERNAL';  --Drop Ship的来源类型“外部”

  Lt_Action_Qeq_Tbl(1).Request_Type := Oe_Globals.g_Book_Order;
  Lt_Action_Qeq_Tbl(1).Entity_Code := Oe_Globals.g_Entity_Header;
  Lt_Action_Qeq_Tbl(1).Entity_Id := Lt_Header_Rec.Header_Id; -- SO's Header_Id

  Oe_Order_Pub.Process_Order(p_Org_Id                 => Lt_Header_Rec.Org_Id
                            ,p_Api_Version_Number     => Ln_Api_Version_Number
                            ,p_Init_Msg_List          => Fnd_Api.g_False
                            ,p_Return_Values          => Fnd_Api.g_False
                            ,p_Action_Commit          => Fnd_Api.g_False
                            ,x_Return_Status          => Xv_Ret_Status
                            ,x_Msg_Count              => Ln_Msg_Count
                            ,x_Msg_Data               => Lv_Msg_Data
                            ,p_Header_Rec             => Lt_Header_Rec
                            ,p_Line_Tbl               => Lt_Line_Tbl
                            ,p_Line_Adj_Tbl           => Lt_Line_Adj_Tbl
                            ,p_Action_Request_Tbl     => Lt_Action_Qeq_Tbl
                            ,p_Header_Scredit_Tbl     => Lt_Header_Scredit_Tbl
                            ,x_Header_Rec             => Lt_Ret_Header_Rec
                            ,x_Header_Val_Rec         => Lt_Header_Val_Rec
                            ,x_Header_Adj_Tbl         => Lt_Header_Adj_Tbl
                            ,x_Header_Adj_Val_Tbl     => Lt_Header_Adj_Val_Tbl
                            ,x_Header_Price_Att_Tbl   => Lt_Header_Price_Att_Tbl
                            ,x_Header_Adj_Att_Tbl     => Lt_Header_Adj_Att_Tbl
                            ,x_Header_Adj_Assoc_Tbl   => Lt_Header_Adj_Assoc_Tbl
                            ,x_Header_Scredit_Tbl     => Lt_Header_Scredit_Tbl
                            ,x_Header_Scredit_Val_Tbl => Lt_Header_Scredit_Val_Tbl
                            ,x_Line_Tbl               => Xt_Ret_Line_Tbl
                            ,x_Line_Val_Tbl           => Lt_Line_Val_Tbl
                            ,x_Line_Adj_Tbl           => Lt_Line_Adj_Tbl
                            ,x_Line_Adj_Val_Tbl       => Lt_Line_Adj_Val_Tbl
                            ,x_Line_Price_Att_Tbl     => Lt_Line_Price_Att_Tbl
                            ,x_Line_Adj_Att_Tbl       => Lt_Line_Adj_Att_Tbl
                            ,x_Line_Adj_Assoc_Tbl     => Lt_Line_Adj_Assoc_Tbl
                            ,x_Line_Scredit_Tbl       => Lt_Line_Scredit_Tbl
                            ,x_Line_Scredit_Val_Tbl   => Lt_Line_Scredit_Val_Tbl
                            ,x_Lot_Serial_Tbl         => Lt_Lot_Serial_Tbl
                            ,x_Lot_Serial_Val_Tbl     => Lt_Lot_Serial_Val_Tbl
                            ,x_Action_Request_Tbl     => Xt_Action_Qeq_Tbl);

  IF (Xv_Ret_Status = Fnd_Api.g_Ret_Sts_Success) THEN
    Dbms_Output.Put_Line('创建销售订单:' || Lt_Ret_Header_Rec.Order_Number);
    Dbms_Output.Put_Line('销售订单创建成功:' || Lt_Ret_Header_Rec.Order_Number);
    Dbms_Output.Put_Line('销售订单题头标识:' || Lt_Ret_Header_Rec.Header_Id);
    FOR i IN 1 .. Xt_Ret_Line_Tbl.Count LOOP
      Dbms_Output.Put_Line('销售订单行:' || Xt_Ret_Line_Tbl(i).Line_Number);
      Dbms_Output.Put_Line('销售订单行标识:' || Xt_Ret_Line_Tbl(i).Line_Id);
    END LOOP;
    COMMIT;
  ELSE
    FOR i IN 1 .. Ln_Msg_Count LOOP
      Oe_Msg_Pub.Get(p_Msg_Index     => i
                    ,p_Encoded       => Fnd_Api.g_False
                    ,p_Data          => Lv_Msg_Data
                    ,p_Msg_Index_Out => Lv_Msg_Index_Out);
    
      Lv_Ret_Message := Lv_Ret_Message || ';' ||
                        Substr(Lv_Msg_Data, 1, 1500);
    END LOOP;
    Dbms_Output.Put_Line('销售订单创建失败! 状态:' || Xv_Ret_Status || ',信息:' ||
                         Lv_Ret_Message);
    ROLLBACK;
  END IF;
END;

The code to focus on is as follows:
Lt_Line_Tbl(i).SOURCE_TYPE_CODE := 'EXTERNAL' --Drop Ship 's source type " external "
core business table relationship.

Customers using this business test may need us to develop a report
1. From sales How much data is received for the PR and PO of the order? How many quantities are confirmed for sales and shipment? How many POs are in transit? How many have not been confirmed for shipment?
2. The statement with the customer and the statement with the supplier.
Instance relationships between related nuclear business tables are as follows:
 

SELECT Oh.Header_Id
      ,Oh.Order_Number
      ,Ol.Line_Id
      ,Ol.Line_Number || '.' || Ol.Shipment_Number Line_Number
      ,Prh.Requisition_Header_Id
      ,Prh.Segment1 Req_Number
      ,Prl.Requisition_Line_Id
      ,Pla.Po_Line_Id
      ,Poh.Po_Header_Id
      ,Poh.Segment1 Po_Number
  FROM Oe_Order_Headers_All       Oh
      ,Oe_Order_Lines_All         Ol
      ,Oe_Drop_Ship_Sources       Odss
      ,Po_Headers_All             Poh
      ,Po_Lines_All               Pla
      ,Po_Line_Locations_All      Pol
      ,Po_Requisition_Headers_All Prh
      ,Po_Requisition_Lines_All   Prl
 WHERE Oh.Header_Id = Ol.Header_Id
   AND Ol.Header_Id = Odss.Header_Id(+)
   AND Ol.Line_Id = Odss.Line_Id(+)
   AND Odss.Po_Header_Id = Poh.Po_Header_Id(+)
   AND Odss.Po_Header_Id = Poh.Po_Header_Id(+)
   AND Odss.Po_Line_Id = Pla.Po_Line_Id(+)
   AND Odss.Line_Location_Id = Pol.Line_Location_Id(+)
   AND Odss.Requisition_Header_Id = Prh.Requisition_Header_Id(+)
   AND Odss.Requisition_Line_Id = Prl.Requisition_Line_Id(+)
   AND Oh.Order_Number = '10012000006'



 

Guess you like

Origin blog.csdn.net/chenxianping/article/details/98482204