现在的位置: 首页 > 综合 > 正文

Order Management APIs — Oe_Order_Pub

2012年07月07日 ⁄ 综合 ⁄ 共 5347字 ⁄ 字号 评论关闭
调用Oe_Order_Pub.process_order Update及Insert记录的方法

 

1、使用范围
Process Order可以对以下销售订单实体做Update,Insert及Delete处理

 

 

Entity

Table Name

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的实例:

create or replace 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;

    l_line_tbl oe_order_pub.line_tbl_type;

    l_action_request_tbl oe_order_pub.request_tbl_type;

    l_return_status varchar2(1000);

    l_msg_count number;

    l_msg_data varchar2(1000);

    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;

    oe_debug_pub.initialize;

    oe_debug_pub.debug_on;

    oe_debug_pub.setdebuglevel(5);

    dbms_application_info.set_client_info(p_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).promise_date := p_ssd;

    l_line_tbl(1).operation := oe_globals.g_opr_update;

    oe_order_pub.process_order
    
    (p_api_version_number => 1.0,
     
     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
     
     );

    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;

    if l_return_status = fnd_api.g_ret_sts_success
    
     
then
    
        dbms_output.put_line(
'Update is Sucess');
    
    
else
    
        dbms_output.put_line(
'Update is False');
    
    
end if;

exception

    when others then
    
        
null;
    
end;

 

 

 

 

抱歉!评论已关闭.