Professional Documents
Culture Documents
XXCG_SOS_ORDER_LINE_UPDATE_API(l_header_id IN n
umber,
l_line_id IN number
,
l_quantity in varch
ar2,
l_wearer_code in va
rchar2,
l_new_price in n
umber,
l_request_date in d
ate,
l_ceremony_date in
date,
l_unit_set
in v
archar2,
l_inventory_item_id
in number,
l_uom
in v
archar2,
-- l_orig_system_lin
e_reference in varchar2,
-- l_last_updated_by
in number,
l_sos_line_id
v
archar2,
l_price_changed_fla
g varchar2,
l_dis_price_adjustm
ent_id number,
-- l_tax_price_adjus
tment_id number,
l_sell_price_adjust
ment number,
l_lock_control
number,
l_results
OUT v
archar2) AS
-- l_field_name IN v
archar,
-- l_field_value IN
number) as
l_api_version_number
NUMBER := 1;
l_return_status
VARCHAR2(2000);
l_msg_count
NUMBER;
l_msg_data
VARCHAR2(2000);
l_msg_index
NUMBER;
l_data
VARCHAR2(2000);
app_user_id
NUMBER := 0;
v_user_id
number ;
v_resp_id
number;
v_resp_appl_id
number;
v_results
varchar2(50) ;
-- v_last_updated_by
number := l_last_updated_by;
v_sos_line_id
varchar2(50) := l_sos_line_id;
v_price_changed_flag
varchar2(10) := l_price_changed_
flag;
l_list_header_id
number;
l_list_line_id
number;
l_list_line_type_code
varchar2(100);
l_modifier_level_code
varchar2(100);
-/*****************INPUT VARIABLES FOR PROCESS_ORDER API*************************
************/
l_header_rec
l_line_tbl
l_action_request_tbl
l_line_adj_tbl
oe_order_pub.header_rec_type;
oe_order_pub.line_tbl_type;
oe_order_pub.Request_Tbl_Type;
OE_ORDER_PUB.line_adj_tbl_type;
oe_order_pub.header_rec_type;
oe_order_pub.header_val_rec_type;
oe_order_pub.header_adj_tbl_type;
oe_order_pub.header_adj_val_tbl_t
l_header_price_att_tbl_out
oe_order_pub.header_price_att_tbl
l_header_adj_att_tbl_out
oe_order_pub.header_adj_att_tbl_t
l_header_adj_assoc_tbl_out
oe_order_pub.header_adj_assoc_tbl
l_header_scredit_tbl_out
oe_order_pub.header_scredit_tbl_t
l_header_scredit_val_tbl_out
oe_order_pub.header_scredit_val_t
ype;
_type;
ype;
_type;
ype;
bl_type;
l_line_tbl_out
l_line_val_tbl_out
l_line_adj_tbl_out
l_line_adj_val_tbl_out
oe_order_pub.line_tbl_type;
oe_order_pub.line_val_tbl_type;
oe_order_pub.line_adj_tbl_type;
oe_order_pub.line_adj_val_tbl_typ
l_line_price_att_tbl_out
oe_order_pub.line_price_att_tbl_t
l_line_adj_att_tbl_out
oe_order_pub.line_adj_att_tbl_typ
l_line_adj_assoc_tbl_out
oe_order_pub.line_adj_assoc_tbl_t
l_line_scredit_tbl_out
oe_order_pub.line_scredit_tbl_typ
l_line_scredit_val_tbl_out
oe_order_pub.line_scredit_val_tbl
l_lot_serial_tbl_out
l_lot_serial_val_tbl_out
oe_order_pub.lot_serial_tbl_type;
oe_order_pub.lot_serial_val_tbl_t
l_action_request_tbl_out
oe_order_pub.request_tbl_type;
e;
ype;
e;
ype;
e;
_type;
ype;
BEGIN
BEGIN
SELECT list_header_id,list_line_id,
list_line_type_code,modifier_level_code
INTO l_list_header_id,l_list_line_id,
l_list_line_type_code,l_modifier_level_code
FROM qp_lines_summary_v
WHERE name = 'Manual'
AND
NVL(end_date_active,SYSDATE+1) > SYSDATE
AND
ROWNUM <2;
BEGIN
IF nvl(v_price_changed_flag,'N') = 'Y' THEN
dbms_output.put_line('processing price change');
l_line_tbl(1).header_id
:= l_header_id;
l_line_tbl(1).line_id
:= l_line_id;
l_line_tbl(1).ordered_quantity
:= l_quantity;
l_line_tbl(1).attribute15
:= l_wearer_code;
l_line_tbl(1).request_date
:= l_request_date;
l_line_tbl(1).promise_date
:= l_ceremony_date;
l_line_tbl(1).attribute1
:= l_unit_set;
l_line_tbl(1).inventory_item_id
:= l_inventory_item_id;
l_line_tbl(1).order_quantity_uom := l_uom;
l_line_tbl(1).pricing_quantity_uom := l_uom;
-- l_line_tbl(1).orig_sys_document_ref := l_orig_system_line_referenc
e;
l_line_tbl(1).unit_selling_price
:= l_new_price;
dbms_output.put_line('value for l line tbl unit sell price is: '||l_
line_tbl(1).unit_selling_price);
l_line_tbl(1).calculate_price_flag := 'N';
-- l_line_tbl(1).last_updated_by
:= v_last_updated_by;
l_line_tbl(1).ORIG_SYS_LINE_REF
:= v_sos_line_id;
l_line_tbl(1).operation
:= OE_GLOBALS.G_OPR_UPDATE;
/*****************
*/
END IF;
/****************************************************************************/
/*****************CALLTO PROCESS ORDER API*************************************/
OE_Order_Pub.Process_Order(
p_api_version_number
=> l_api_version_numb
er,
p_line_tbl
x_header_rec
x_header_val_rec
=> l_line_tbl,
=> l_header_rec_out,
=> l_header_val_rec_o
x_header_adj_tbl
=> l_header_adj_tbl_o
x_header_adj_val_tbl
=> l_header_adj_val_t
x_header_price_att_tbl
=> l_header_price_att
x_header_adj_att_tbl
=> l_header_adj_att_t
x_header_adj_assoc_tbl
=> l_header_adj_assoc
x_header_scredit_tbl
=> l_header_scredit_t
x_header_scredit_val_tbl
=> l_header_scredit_v
x_line_tbl
x_line_val_tbl
=> l_line_tbl_out,
=> l_line_val_tbl_out
x_line_adj_tbl
=> l_line_adj_tbl_out
x_line_adj_val_tbl
=> l_line_adj_val_tbl
x_line_price_att_tbl
=> l_line_price_att_t
x_line_adj_att_tbl
=> l_line_adj_att_tbl
x_line_adj_assoc_tbl
=> l_line_adj_assoc_t
x_line_scredit_tbl
=> l_line_scredit_tbl
x_line_scredit_val_tbl
=> l_line_scredit_val
x_lot_serial_tbl
=> l_lot_serial_tbl_o
x_lot_serial_val_tbl
=> l_lot_serial_val_t
x_action_request_tbl
=> l_action_request_t
x_return_status
x_msg_count
x_msg_data
=> l_return_status,
=> l_msg_count,
=> l_msg_data);
ut,
ut,
bl_out,
_tbl_out,
bl_out,
_tbl_out,
bl_out,
al_tbl_out,
,
,
_out,
bl_out,
_out,
bl_out,
_out,
_tbl_out,
ut,
bl_out,
bl_out,
ELSE
dbms_output.put_line('processing NO price change');
l_line_tbl(1).header_id
:= l_header_id;
l_line_tbl(1).line_id
:= l_line_id;
l_line_tbl(1).ordered_quantity
:= l_quantity;
l_line_tbl(1).attribute15
:= l_wearer_code;
l_line_tbl(1).request_date
:= l_request_date;
l_line_tbl(1).promise_date
:= l_ceremony_date;
l_line_tbl(1).attribute1
:= l_unit_set;
l_line_tbl(1).inventory_item_id
:= l_inventory_item_id;
l_line_tbl(1).order_quantity_uom := l_uom;
l_line_tbl(1).pricing_quantity_uom := l_uom;
-- l_line_tbl(1).orig_sys_document_ref := l_orig_system_line_r
eference;
-- l_line_tbl(1).unit_selling_price
-- l_line_tbl(1).last_updated_by
l_line_tbl(1).ORIG_SYS_LINE_REF
:=
l_line_tbl(1).operation
:=
/*****************CALLTO PROCESS ORDER
:= l_new_price;
:= v_last_updated_by;
v_sos_line_id;
OE_GLOBALS.G_OPR_UPDATE;
API**********************
***************/
OE_Order_Pub.Process_Order(
p_api_version_number
=> l_api_version_numb
er,
p_line_tbl
x_header_rec
x_header_val_rec
=> l_line_tbl,
=> l_header_rec_out,
=> l_header_val_rec_o
x_header_adj_tbl
=> l_header_adj_tbl_o
x_header_adj_val_tbl
=> l_header_adj_val_t
x_header_price_att_tbl
=> l_header_price_att
x_header_adj_att_tbl
=> l_header_adj_att_t
x_header_adj_assoc_tbl
=> l_header_adj_assoc
x_header_scredit_tbl
=> l_header_scredit_t
x_header_scredit_val_tbl
=> l_header_scredit_v
x_line_tbl
x_line_val_tbl
=> l_line_tbl_out,
=> l_line_val_tbl_out
x_line_adj_tbl
=> l_line_adj_tbl_out
x_line_adj_val_tbl
=> l_line_adj_val_tbl
x_line_price_att_tbl
=> l_line_price_att_t
x_line_adj_att_tbl
=> l_line_adj_att_tbl
x_line_adj_assoc_tbl
=> l_line_adj_assoc_t
x_line_scredit_tbl
=> l_line_scredit_tbl
x_line_scredit_val_tbl
=> l_line_scredit_val
x_lot_serial_tbl
=> l_lot_serial_tbl_o
x_lot_serial_val_tbl
=> l_lot_serial_val_t
x_action_request_tbl
=> l_action_request_t
ut,
ut,
bl_out,
_tbl_out,
bl_out,
_tbl_out,
bl_out,
al_tbl_out,
,
,
_out,
bl_out,
_out,
bl_out,
_out,
_tbl_out,
ut,
bl_out,
bl_out,
x_return_status
x_msg_count
x_msg_data
=> l_return_status,
=> l_msg_count,
=> l_msg_data);
END IF;
EXCEPTION
when others then
dbms_output.put_line('Problem updating LINE ID: '||l_line_id);
END;
/*****************CHECK RETURN STATUS*************************************/
if l_return_status = FND_API.G_RET_STS_SUCCESS then
dbms_output.put_line('success');
l_results := 'S';
--commit;
else
dbms_output.put_line('failure');
l_results := 'F';
--rollback;
end if;
/*****************DISPLAY RETURN STATUS FLAGS***********************************
**/
DBMS_OUTPUT.PUT_LINE('process ORDER ret status IS: ' || l_return_status)
;
DBMS_OUTPUT.PUT_LINE('process ORDER msg data IS: ' || l_msg_data);
-- DBMS_OUTPUT.PUT_LINE('process ORDER msg COUNT IS: ' || l_msg_count);
-- DBMS_OUTPUT.PUT_LINE('header.order_number IS: '
|| to_char(l_head
er_rec_out.order_number));
-DBMS_OUTPUT.PUT_LINE('header.return_status IS: '
|| l_header_rec_ou
t.return_status);
-- DBMS_OUTPUT.PUT_LINE('header.booked_flag IS: '
|| l_header_rec_ou
t.booked_flag);
-- DBMS_OUTPUT.PUT_LINE('header.header_id IS: '
|| l_header_rec_o
ut.header_id);
-DBMS_OUTPUT.PUT_LINE('header.order_source_id IS: ' || l_header_rec_o
ut.order_source_id);
-DBMS_OUTPUT.PUT_LINE('header.flow_status_code IS: ' || l_header_rec_o
ut.flow_status_code);
/*****************DISPLAY ERROR MSGS*************************************/
FOR i IN 1 .. l_msg_count LOOP
Oe_Msg_Pub.get(
p_msg_index => i
,p_encoded => Fnd_Api.G_FALSE
,p_data => l_data
,p_msg_index_out => l_msg_index);
DBMS_OUTPUT.PUT_LINE('message is: ' || l_data);
DBMS_OUTPUT.PUT_LINE('message index is: ' || l_msg_index);
END LOOP;