EBS 查询物料保留并释放

查询物料保留并释放(可查看具体错误信息)

--查询物料保留并释放
DECLARE
  l_Rsv_Rec       Inv_Reservation_Global.Mtl_Reservation_Rec_Type;
  l_Serial_Number Inv_Reservation_Global.Serial_Number_Tbl_Type;

  l_Api_Version   NUMBER := 1.0;
  l_Init_Msg_List VARCHAR2(2) := Fnd_Api.g_True;

  l_Primary_Relieved_Quantity NUMBER;
  x_Return_Status             VARCHAR2(2);
  x_Err_Msg                   VARCHAR2(4000);
  x_Status                    VARCHAR2(2);
  x_Msg_Count                 NUMBER := 0;
  x_Msg_Data                  VARCHAR2(255);
  x_Error_Code                NUMBER := 0;
  x_Mtl_Reservation_Tbl       Inv_Reservation_Global.Mtl_Reservation_Tbl_Type;
  x_Mtl_Reservation_Tbl_Count NUMBER := 0;
  x_Primary_Relieved_Qty      NUMBER := 0;
  x_Primary_Remain_Qty        NUMBER := 0;
  x_Qty                       NUMBER := 0;
BEGIN
  l_Rsv_Rec.Organization_Id              := '92';
  l_Rsv_Rec.Inventory_Item_Id            := 111;
  l_Rsv_Rec.Primary_Reservation_Quantity := p_Qty;
  l_Rsv_Rec.Demand_Source_Name           := 'xxxxxxxxx';
  l_Rsv_Rec.Demand_Source_Type_Id        := 13;
  l_Rsv_Rec.Subinventory_Code            := 'xxxx';
  l_Rsv_Rec.Reservation_Id               := 11111;
  Inv_Reservation_Pub.Query_Reservation(p_Api_Version_Number        => l_Api_Version
                                       ,p_Init_Msg_Lst              => l_Init_Msg_List
                                       ,x_Return_Status             => x_Status
                                       ,x_Msg_Count                 => x_Msg_Count
                                       ,x_Msg_Data                  => x_Msg_Data
                                       ,p_Query_Input               => l_Rsv_Rec
                                       ,p_Lock_Records              => Fnd_Api.g_False
                                       ,p_Sort_By_Req_Date          => Inv_Reservation_Global.g_Query_No_Sort
                                       ,p_Cancel_Order_Mode         => Inv_Reservation_Global.g_Cancel_Order_No
                                       ,x_Mtl_Reservation_Tbl       => x_Mtl_Reservation_Tbl
                                       ,x_Mtl_Reservation_Tbl_Count => x_Mtl_Reservation_Tbl_Count
                                       ,x_Error_Code                => x_Error_Code);
  Dbms_Output.Put_Line(x_Status);
  Dbms_Output.Put_Line(x_Error_Code);
  Dbms_Output.Put_Line('x_Mtl_Reservation_Tbl_Count:' ||
                       x_Mtl_Reservation_Tbl_Count);
  IF (x_Status = Fnd_Api.g_Ret_Sts_Success AND
     x_Mtl_Reservation_Tbl_Count > 0) THEN
    x_Qty := 0;
    FOR i IN 1 .. x_Mtl_Reservation_Tbl_Count LOOP
      x_Qty := x_Qty + x_Mtl_Reservation_Tbl(i)
              .Primary_Reservation_Quantity;
    
      Dbms_Output.Put_Line('保留idreservation_id: ' ||
                           To_Char(x_Mtl_Reservation_Tbl(i).Reservation_Id));
    END LOOP;
    Dbms_Output.Put_Line('保留数量x_Qty:' || x_Qty);
  END IF;
  Inv_Reservation_Pub.Relieve_Reservation(p_Api_Version_Number        => l_Api_Version
                                         ,p_Init_Msg_Lst              => l_Init_Msg_List
                                         ,x_Return_Status             => x_Status
                                         ,x_Msg_Count                 => x_Msg_Count
                                         ,x_Msg_Data                  => x_Msg_Data
                                         ,p_Rsv_Rec                   => x_Mtl_Reservation_Tbl(1)
                                         ,p_Primary_Relieved_Quantity => l_Primary_Relieved_Quantity
                                         ,p_Relieve_All               => Fnd_Api.g_False
                                         ,p_Original_Serial_Number    => l_Serial_Number
                                         ,p_Validation_Flag           => Fnd_Api.g_True
                                         ,x_Primary_Relieved_Quantity => x_Primary_Relieved_Qty
                                         ,x_Primary_Remain_Quantity   => x_Primary_Remain_Qty);
  IF (x_Status <> Fnd_Api.g_Ret_Sts_Success) THEN
    Dbms_Output.Put_Line('释放物料保留调用API出错:' || x_Msg_Data);  
    Fnd_Msg_Pub.Count_And_Get(p_Encoded => Fnd_Api.g_False
                             ,p_Count   => x_Msg_Count
                             ,p_Data    => x_Msg_Data);
    IF x_Msg_Count > 1 THEN
      x_Msg_Data := Fnd_Msg_Pub.Get_Detail(p_Msg_Index => Fnd_Msg_Pub.g_First
                                          ,p_Encoded   => Fnd_Api.g_False);
    END IF;
    Dbms_Output.Put_Line(x_Msg_Data);
  END IF;
END;

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值