DECLARE
vApiVersionNumber NUMBER;
vInitMsgList VARCHAR2(200);
xReturnValues VARCHAR2(200);
xReturnStatus VARCHAR2(1);
xMsgCount NUMBER;
xMsgData VARCHAR2(200);
vHeaderId NUMBER;
vOrgId NUMBER;
xHeaderRec apps.oe_order_pub.header_rec_type;
xHeaderValRec apps.oe_order_pub.header_val_rec_type;
xHeaderAdjTbl apps.oe_order_pub.header_adj_tbl_type;
xHeaderAdjValTbl apps.oe_order_pub.header_adj_val_tbl_type;
xHeaderPriceAttTbl apps.oe_order_pub.header_price_att_tbl_type;
xHeaderAdjAttTbl apps.oe_order_pub.header_adj_att_tbl_type;
xHeaderAdjAssocTbl apps.oe_order_pub.header_adj_assoc_tbl_type;
xHeaderScreditTbl apps.oe_order_pub.header_scredit_tbl_type;
xHeaderScreditValTbl apps.oe_order_pub.header_scredit_val_tbl_type;
xHeaderPaymentTbl apps.oe_order_pub.header_payment_tbl_type;
xHeaderPaymentValTbl apps.oe_order_pub.header_payment_val_tbl_type;
xLineTbl apps.oe_order_pub.line_tbl_type;
xLineValTbl apps.oe_order_pub.line_val_tbl_type;
xLineAdjTbl apps.oe_order_pub.line_adj_tbl_type;
xLineAdjValTbl apps.oe_order_pub.line_adj_val_tbl_type;
xLinePriceAttTbl apps.oe_order_pub.line_price_att_tbl_type;
xLineAdjAttTbl apps.oe_order_pub.line_adj_att_tbl_type;
xLineAdjAssocTbl apps.oe_order_pub.line_adj_assoc_tbl_type;
xLineScreditTbl apps.oe_order_pub.line_scredit_tbl_type;
xLineScreditValTbl apps.oe_order_pub.line_scredit_val_tbl_type;
xLinePaymentTbl apps.oe_order_pub.line_payment_tbl_type;
xLinePaymentValTbl apps.oe_order_pub.line_payment_val_tbl_type;
XLotSerialTbl apps.oe_order_pub.lot_serial_tbl_type;
xLotSerialValTbl apps.oe_order_pub.lot_serial_val_tbl_type;
BEGIN
vApiVersionNumber := 1;
vInitMsgList := FND_API.G_FALSE;
xReturnValues := NULL;
vHeaderId := 00;
vOrgId := 00;
fnd_global.apps_initialize(user_id => 00, resp_id => 00,
resp_appl_id => 660);
mo_global.set_policy_context('S', vOrgId);
mo_global.init('ONT');
oe_order_pub.get_order(p_api_version_number => vApiVersionNumber,
p_init_msg_list => vInitMsgList,
p_return_values => xReturnValues,
x_return_status => xReturnStatus,
x_msg_count => xMsgCount, x_msg_data => xMsgData,
p_header_id => vHeaderId, p_org_id => vOrgId,
--p_operating_unit => p_operating_unit,
x_header_rec => xHeaderRec,
x_header_val_rec => xHeaderValRec,
x_header_adj_tbl => xHeaderAdjTbl,
x_header_adj_val_tbl => xHeaderAdjValTbl,
x_header_price_att_tbl => xHeaderPriceAttTbl,
x_header_adj_att_tbl => xHeaderAdjAttTbl,
x_header_adj_assoc_tbl => xHeaderAdjAssocTbl,
x_header_scredit_tbl => xHeaderScreditTbl,
x_header_scredit_val_tbl => xHeaderScreditValTbl,
x_header_payment_tbl => xHeaderPaymentTbl,
x_header_payment_val_tbl => xHeaderPaymentValTbl,
x_line_tbl => xLineTbl,
x_line_val_tbl => xLineValTbl,
x_line_adj_tbl => xLineAdjTbl,
x_line_adj_val_tbl => xLineAdjValTbl,
x_line_price_att_tbl => xLinePriceAttTbl,
x_line_adj_att_tbl => xLineAdjAttTbl,
x_line_adj_assoc_tbl => xLineAdjAssocTbl,
x_line_scredit_tbl => xLineScreditTbl,
x_line_scredit_val_tbl => xLineScreditValTbl,
x_line_payment_tbl => xLinePaymentTbl,
x_line_payment_val_tbl => xLinePaymentValTbl,
x_lot_serial_tbl => xLotSerialTbl,
x_lot_serial_val_tbl => xLotSerialValTbl);
DBMS_OUTPUT.PUT_LINE('Retrun Status : ' || xReturnStatus);
DBMS_OUTPUT.PUT_LINE('Message Count : ' || xMsgCount);
DBMS_OUTPUT.PUT_LINE('Message Data : ' || xMsgData);
DBMS_OUTPUT.PUT_LINE('Order number : ' || xHeaderRec.order_number);
FOR i IN xLineTbl.first .. xLineTbl.last LOOP
DBMS_OUTPUT.PUT_LINE('Line Number : ' || xLineTbl(i).line_number);
DBMS_OUTPUT.PUT_LINE('Ordered Item : ' || xLineTbl(i).ordered_item);
DBMS_OUTPUT.PUT_LINE('Ordered Quantity = ' || xLineTbl(i).ordered_quantity);
DBMS_OUTPUT.PUT_LINE('Shipped Quantity = ' || xLineTbl(i).shipped_quantity);
END LOOP;
IF xReturnStatus = fnd_api.g_ret_sts_success THEN
--COMMIT;
DBMS_OUTPUT.put_line('Sucessfull');
ELSE
DBMS_OUTPUT.put_line('Failed with the error :');
--ROLLBACK;
FOR i IN 1 .. xMsgCount
LOOP
xMsgData := oe_msg_pub.get(p_msg_index => i, p_encoded => 'F');
dbms_output.put_line(i || ') ' || xMsgData);
END LOOP;
END IF;
END;
沒有留言:
張貼留言