Code sample:
declare
record_hold_source oe_holds_pvt.hold_source_rec_type;
v_msg_data VARCHAR2 (2000) := NULL;
v_return_status VARCHAR2 (30);
v_msg_count NUMBER := 0;
i NUMBER;
v_num_msg_out NUMBER;
rec_hold_source.line_id := line_id;
rec_hold_source.hold_entity_code := 'O';
rec_hold_source.hold_entity_id := header_id;
rec_hold_source.header_id := header_id;
rec_hold_source.hold_comment := 'Testing';
rec_hold_source.hold_id := ihold_id;
-- standard who
rec_hold_source.request_id := request_id;
rec_hold_source.program_id := program_id;
rec_hold_source.program_application_id := prog_appl_id;
rec_hold_source.last_updated_by := user_id;
rec_hold_source.last_update_date := sysdate;
rec_hold_source.last_update_login := login_id;
Begin
oe_msg_pub.RESET;
oe_holds_pub.apply_holds (p_api_version => 1.0,
p_commit => fnd_api.g_false,
p_hold_source_rec => record_hold_source,
x_msg_count => v_msg_count,
x_msg_data => v_msg_data,
x_return_status => v_return_status);
IF v_msg_count > 0
THEN
i := 1;
WHILE i <= v_msg_count
LOOP
oe_msg_pub.get (p_msg_index => i,
p_encoded => fnd_api.g_false,
p_data => v_msg_data,
p_msg_index_out => v_num_msg_out);
i := i + 1;
fnd_file.put_line (fnd_file.LOG,
v_msg_data);
END LOOP;
END IF;
-------------------------
release hold
fnd_msg_pub.RESET;
-- calling API to release hold on the order line
oe_holds_pub.release_holds (
p_api_version => 1.0,
p_commit => i_chr_action_commit,
p_validation_level => fnd_api.g_valid_level_full,
-- Fnd_Api.G_VALID_LEVEL_NONE,
p_hold_source_rec => rec_hold_source,
p_hold_release_rec => rec_hold_release,
x_return_status => v_chr_hold_ret_status,
x_msg_count => v_num_hold_msg_cnt,
x_msg_data => v_chr_msg_data);
oe_order_pub.process_order
这个会check 权限。
p_action_request_tbl oe_order_pub.request_tbl_type;
p_action_request_tbl(1).request_type := oe_globals.g_apply_hold;
p_action_request_tbl(1).entity_code := oe_globals.g_entity_line;
p_action_request_tbl(1).entity_id := v_line_id;
p_action_request_tbl(1).param1 := v_hold_id;
p_action_request_tbl(1).param2 := v_hold_entity_code;
p_action_request_tbl(1).param3 := v_header_id;
p_action_request_tbl(1).param4 := 'Hold Applied By EMR Bill Only VLVS Workflow';
p_action_request_tbl(1).date_param1 := NULL;
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 => x_return_status,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data,
p_action_request_tbl => p_action_request_tbl, --only inputting this record if we want to apply hold
x_header_rec => p_header_rec,
x_header_val_rec => p_header_val_rec,
x_header_adj_tbl => p_header_adj_tbl,
x_header_adj_val_tbl => p_header_adj_val_tbl,
x_header_price_att_tbl => p_header_price_att_tbl,
x_header_adj_att_tbl => p_header_adj_att_tbl,
x_header_adj_assoc_tbl => p_header_adj_assoc_tbl,
x_header_scredit_tbl => p_header_scredit_tbl,
x_header_scredit_val_tbl => p_header_scredit_val_tbl,
x_line_tbl => p_line_tbl,
x_line_val_tbl => p_line_val_tbl,
x_line_adj_tbl => p_line_adj_tbl,
x_line_adj_val_tbl => p_line_adj_val_tbl,
x_line_price_att_tbl => p_line_price_att_tbl,
x_line_adj_att_tbl => p_line_adj_att_tbl,
x_line_adj_assoc_tbl => p_line_adj_assoc_tbl,
x_line_scredit_tbl => p_line_scredit_tbl,
x_line_scredit_val_tbl => p_line_scredit_val_tbl,
x_lot_serial_tbl => p_lot_serial_tbl,
x_lot_serial_val_tbl => p_lot_serial_val_tbl,
x_action_request_tbl => p_action_request_tbl);
declare
record_hold_source oe_holds_pvt.hold_source_rec_type;
v_msg_data VARCHAR2 (2000) := NULL;
v_return_status VARCHAR2 (30);
v_msg_count NUMBER := 0;
i NUMBER;
v_num_msg_out NUMBER;
rec_hold_source.line_id := line_id;
rec_hold_source.hold_entity_code := 'O';
rec_hold_source.hold_entity_id := header_id;
rec_hold_source.header_id := header_id;
rec_hold_source.hold_comment := 'Testing';
rec_hold_source.hold_id := ihold_id;
-- standard who
rec_hold_source.request_id := request_id;
rec_hold_source.program_id := program_id;
rec_hold_source.program_application_id := prog_appl_id;
rec_hold_source.last_updated_by := user_id;
rec_hold_source.last_update_date := sysdate;
rec_hold_source.last_update_login := login_id;
Begin
oe_msg_pub.RESET;
oe_holds_pub.apply_holds (p_api_version => 1.0,
p_commit => fnd_api.g_false,
p_hold_source_rec => record_hold_source,
x_msg_count => v_msg_count,
x_msg_data => v_msg_data,
x_return_status => v_return_status);
IF v_msg_count > 0
THEN
i := 1;
WHILE i <= v_msg_count
LOOP
oe_msg_pub.get (p_msg_index => i,
p_encoded => fnd_api.g_false,
p_data => v_msg_data,
p_msg_index_out => v_num_msg_out);
i := i + 1;
fnd_file.put_line (fnd_file.LOG,
v_msg_data);
END LOOP;
END IF;
-------------------------
release hold
fnd_msg_pub.RESET;
-- calling API to release hold on the order line
oe_holds_pub.release_holds (
p_api_version => 1.0,
p_commit => i_chr_action_commit,
p_validation_level => fnd_api.g_valid_level_full,
-- Fnd_Api.G_VALID_LEVEL_NONE,
p_hold_source_rec => rec_hold_source,
p_hold_release_rec => rec_hold_release,
x_return_status => v_chr_hold_ret_status,
x_msg_count => v_num_hold_msg_cnt,
x_msg_data => v_chr_msg_data);
oe_order_pub.process_order
这个会check 权限。
p_action_request_tbl oe_order_pub.request_tbl_type;
p_action_request_tbl(1).request_type := oe_globals.g_apply_hold;
p_action_request_tbl(1).entity_code := oe_globals.g_entity_line;
p_action_request_tbl(1).entity_id := v_line_id;
p_action_request_tbl(1).param1 := v_hold_id;
p_action_request_tbl(1).param2 := v_hold_entity_code;
p_action_request_tbl(1).param3 := v_header_id;
p_action_request_tbl(1).param4 := 'Hold Applied By EMR Bill Only VLVS Workflow';
p_action_request_tbl(1).date_param1 := NULL;
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 => x_return_status,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data,
p_action_request_tbl => p_action_request_tbl, --only inputting this record if we want to apply hold
x_header_rec => p_header_rec,
x_header_val_rec => p_header_val_rec,
x_header_adj_tbl => p_header_adj_tbl,
x_header_adj_val_tbl => p_header_adj_val_tbl,
x_header_price_att_tbl => p_header_price_att_tbl,
x_header_adj_att_tbl => p_header_adj_att_tbl,
x_header_adj_assoc_tbl => p_header_adj_assoc_tbl,
x_header_scredit_tbl => p_header_scredit_tbl,
x_header_scredit_val_tbl => p_header_scredit_val_tbl,
x_line_tbl => p_line_tbl,
x_line_val_tbl => p_line_val_tbl,
x_line_adj_tbl => p_line_adj_tbl,
x_line_adj_val_tbl => p_line_adj_val_tbl,
x_line_price_att_tbl => p_line_price_att_tbl,
x_line_adj_att_tbl => p_line_adj_att_tbl,
x_line_adj_assoc_tbl => p_line_adj_assoc_tbl,
x_line_scredit_tbl => p_line_scredit_tbl,
x_line_scredit_val_tbl => p_line_scredit_val_tbl,
x_lot_serial_tbl => p_lot_serial_tbl,
x_lot_serial_val_tbl => p_lot_serial_val_tbl,
x_action_request_tbl => p_action_request_tbl);
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/13975809/viewspace-1764814/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/13975809/viewspace-1764814/