Oe_Order_Pub的使用方法

/*
调用Oe_Order_Pub.process_order Update及Insert记录的方法
1、使用范围
Process Order可以对以下销售订单实体做Update,Insert及Delete处理
Order Header :

OE_ORDER_HEADERS_ALL
Order Price Adjustments
OE_PRICE_ADJUSTMENTS
Order Sales Credits
OE_SALES_CREDITS

Order Line:

OE_ORDER_LINES_ALL
Order Pricing Attributes
OE_ORDER_PRICE_ATTRIBS
Order Adjustment Attributes
OE_PRICE_ADJ_ATTRIBS
Order Adjustment Associations
OE_PRICE_ADJ_ASSOCS
Line Sales Credits
OE_SALES_CREDITS
Line Price Adjustments
OE_PRICE_ADJUSTMENTS
Line Pricing Attributes
OE_ORDER_PRICE_ATTRIBS
Line Adjustment Attributes
OE_PRICE_ADJ_ATTRIBS
Line Adjustment Associations
OE_PRICE_ADJ_ASSOCS
Lot Serial Numbers
OE_LOT_SERIAL_NUMBERS
2、设置初始化参数
API版本初始化,消息列表初始化;调用API的时候所有的输出参数必须赋值,必要的输入参数也需赋值;每调用一次API只能处理同一张订单。
3、调用Oe_Order_Pub.process_order更新记录
Update的情况,必须使用Oe_Globals.g_opr_update操作,需传入该订单项目的主键参数,比如更新订单行的时候要传入该行的line_id,再传入需更新的项的值。
4、调用Oe_Order_Pub.process_order插入新记录
Insert的情况,必须使用Oe_Globals.g_opr_create操作。传入必需项的值,其它项API会自动赋予缺损值。
注意,不必需项当传入NULL值的时候,则API将NULL值赋予指定项而不再赋予缺损值。
5、返回值处理及消息列表获取
API通过 l_return_status返回值告诉程序员API是否处理成功。还可以通过调用Oe_Msg_Pub.get来获取错误消息列表,后面例子中有详细说明。
6、实例说明
以下是通过一个Procedure调用API来更新oe_order_lines_all的SSD的实例:
--Procedure头,定义传入参数
*/
PROCEDURE update_line_ssd(p_line_id IN NUMBER,
                          p_org_id  IN NUMBER,
                          p_ssd     IN Date) IS
  --必须的输入参数和全部的输出参数定义
  l_header_rec         Oe_Order_Pub.header_rec_type; -- pl/sql记录类型,订单头记录类型
  l_line_tbl           Oe_Order_Pub.line_tbl_type; --pl/sql记录类型,订单行记录类型
  l_action_request_tbl Oe_Order_Pub.request_tbl_type; --pl/sql记录类型
  l_return_status      VARCHAR2(1); --返回状态值,表明请求是否执行成功,成功则返回FND_API.G_RET_STS_SUCCESS,返回值S出错则返回FND_API.G_RET_STS_ERROR,返回值E意外错误则返回FND_API.G_RET_STS_UNEXP_ERROR,返回值U
  l_msg_count          NUMBER; --返回错误消息值,如果大于等于1,则通过调用OE_MSG_PUB.GET返回错误消息列表
  --调用方法:
  --Oe_Msg_Pub.get(p_msg_index => l_index, p_encoded => 'F');
  l_msg_data     VARCHAR2(1000); --显示错误消息内容,若l_msg_count等于1,则该参数将包含实际的消息内容

  --以下是必须的输入参数的定义
  x_header_val_rec         Oe_Order_Pub.header_val_rec_type;
  x_header_adj_tbl         Oe_Order_Pub.header_adj_tbl_type;
  x_header_adj_val_tbl     Oe_Order_Pub.header_adj_val_tbl_type;
  x_header_price_att_tbl   Oe_Order_Pub.header_price_att_tbl_type;
  x_header_adj_att_tbl     Oe_Order_Pub.header_adj_att_tbl_type;
  x_header_adj_assoc_tbl   Oe_Order_Pub.header_adj_assoc_tbl_type;
  x_header_scredit_tbl     Oe_Order_Pub.header_scredit_tbl_type;
  x_header_scredit_val_tbl Oe_Order_Pub.header_scredit_val_tbl_type;

  x_line_val_tbl         Oe_Order_Pub.line_val_tbl_type;
  x_line_adj_tbl         Oe_Order_Pub.line_adj_tbl_type;
  x_line_adj_val_tbl     Oe_Order_Pub.line_adj_val_tbl_type;
  x_line_price_att_tbl   Oe_Order_Pub.line_price_att_tbl_type;
  x_line_adj_att_tbl     Oe_Order_Pub.line_adj_att_tbl_type;
  x_line_adj_assoc_tbl   Oe_Order_Pub.line_adj_assoc_tbl_type;
  x_line_scredit_tbl     Oe_Order_Pub.line_scredit_tbl_type;
  x_line_scredit_val_tbl Oe_Order_Pub.line_scredit_val_tbl_type;
  x_lot_serial_tbl       Oe_Order_Pub.lot_serial_tbl_type;
  x_lot_serial_val_tbl   Oe_Order_Pub.lot_serial_val_tbl_type;
Begin
  Oe_Msg_Pub.initialize; --Message初始化
  Oe_Debug_Pub.initialize; --Debug初始化,清除debug cache
  Oe_Debug_Pub.debug_on; --Debug打开
  Oe_Debug_Pub.setdebuglevel(5); --设置Debug级别
  DBMS_APPLICATION_INFO.set_client_info(p_org_id); --设置org_id
  --查询数据
  l_line_tbl(1) := Oe_Order_Pub.g_miss_line_rec; --指明是订单行记录
  l_line_tbl(1).line_id := p_line_id; --指明该订单行的主键
  l_line_tbl(1).operation := Oe_Globals.g_opr_update; --指明是对行做更新操作
  l_line_tbl(1).schedule_ship_date := p_ssd; --用传入的p_ssd的值更新记录

 -- action request订单登记

  l_action_request_tbl(1) := NULL;
  /*
  l_action_request_tbl(l_line_tbl_index) := oe_order_pub.g_miss_request_rec;
  l_action_request_tbl(l_line_tbl_index).request_type := oe_globals.g_book_order;
  l_action_request_tbl(l_line_tbl_index).entity_code := oe_globals.g_entity_header;
  l_action_request_tbl(l_line_tbl_index).entity_id := l_header_rec.header_id;
  */
  --调用API
  Oe_Order_Pub.process_order(p_api_version_number => 1.0, --API版本初始化
                             --给必须的输入参数和全部输出参数赋值
                             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      => l_return_status,
                             x_msg_count          => l_msg_count,
                             x_msg_data           => l_msg_data,
                             p_header_rec         => l_header_rec,
                             p_line_tbl           => l_line_tbl,
                             p_action_request_tbl => l_action_request_tbl,
                            
                             x_header_rec             => l_header_rec,
                             x_header_val_rec         => x_header_val_rec,
                             x_header_adj_tbl         => x_header_adj_tbl,
                             x_header_adj_val_tbl     => x_header_adj_val_tbl,
                             x_header_price_att_tbl   => x_header_price_att_tbl,
                             x_header_adj_att_tbl     => x_header_adj_att_tbl,
                             x_header_adj_assoc_tbl   => x_header_adj_assoc_tbl,
                             x_header_scredit_tbl     => x_header_scredit_tbl,
                             x_header_scredit_val_tbl => x_header_scredit_val_tbl,
                            
                             x_line_tbl             => l_line_tbl,
                             x_line_val_tbl         => x_line_val_tbl,
                             x_line_adj_tbl         => x_line_adj_tbl,
                             x_line_adj_val_tbl     => x_line_adj_val_tbl,
                             x_line_price_att_tbl   => x_line_price_att_tbl,
                             x_line_adj_att_tbl     => x_line_adj_att_tbl,
                             x_line_adj_assoc_tbl   => x_line_adj_assoc_tbl,
                             x_line_scredit_tbl     => x_line_scredit_tbl,
                             x_line_scredit_val_tbl => x_line_scredit_val_tbl,
                             x_lot_serial_tbl       => x_lot_serial_tbl,
                             x_lot_serial_val_tbl   => x_lot_serial_val_tbl,
                             x_action_request_tbl   => l_action_request_tbl);
  --调用Oe_Msg_Pub.get得到错误消息内容
  IF l_msg_count > 0 THEN
    FOR l_index IN 1 .. l_msg_count LOOP
      l_msg_data := Oe_Msg_Pub.get(p_msg_index => l_index, p_encoded => 'F');
    END LOOP;
  END IF;
  --判断API是否执行成功
  IF l_return_status = Fnd_Api.g_ret_sts_success THEN
    --API执行成功,返回值S
    Reuturn(‘success’);
    COMMIT;
  Else
    --API执行不成功,返回值E或者U
    Reuturn(‘false’);
    ROLLBACK;
  End if;
  --异常处理
Exception
  When others then
    ROLLBACK;
End;

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15725751/viewspace-614812/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/15725751/viewspace-614812/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值