CREATE OR REPLACE PROCEDURE XXX_INACTIVE_PRICE_LIST(I_ORG_ID IN NUMBER,
I_LIST_HEADER_ID IN NUMBER,
I_PURGE_LINE IN VARCHAR2 DEFAULT 'N')
IS
/*L_USER_ID NUMBER;
L_RESP_ID NUMBER;
L_APPL_ID NUMBER;*/
gpr_return_status varchar2(1) := NULL;
gpr_msg_count number := 0;
gpr_msg_data varchar2(2000);
gpr_price_list_rec QP_PRICE_LIST_PUB.Price_List_Rec_Type;
gpr_price_list_val_rec QP_PRICE_LIST_PUB.Price_List_Val_Rec_Type;
gpr_price_list_line_tbl QP_PRICE_LIST_PUB.Price_List_Line_Tbl_Type;
gpr_price_list_line_val_tbl QP_PRICE_LIST_PUB.Price_List_Line_Val_Tbl_Type;
gpr_qualifiers_tbl QP_Qualifier_Rules_Pub.Qualifiers_Tbl_Type;
gpr_qualifiers_val_tbl QP_Qualifier_Rules_Pub.Qualifiers_Val_Tbl_Type;
gpr_pricing_attr_tbl QP_PRICE_LIST_PUB.Pricing_Attr_Tbl_Type;
gpr_pricing_attr_val_tbl QP_PRICE_LIST_PUB.Pricing_Attr_Val_Tbl_Type;
ppr_price_list_rec QP_PRICE_LIST_PUB.Price_List_Rec_Type;
ppr_price_list_val_rec QP_PRICE_LIST_PUB.Price_List_Val_Rec_Type;
ppr_price_list_line_tbl QP_PRICE_LIST_PUB.Price_List_Line_Tbl_Type;
ppr_price_list_line_val_tbl QP_PRICE_LIST_PUB.Price_List_Line_Val_Tbl_Type;
ppr_qualifiers_tbl QP_Qualifier_Rules_Pub.Qualifiers_Tbl_Type;
ppr_qualifiers_val_tbl QP_Qualifier_Rules_Pub.Qualifiers_Val_Tbl_Type;
ppr_pricing_attr_tbl QP_PRICE_LIST_PUB.Pricing_Attr_Tbl_Type;
ppr_pricing_attr_val_tbl QP_PRICE_LIST_PUB.Pricing_Attr_Val_Tbl_Type;
--
CURSOR C_LINES IS
SELECT DISTINCT QLL.LIST_LINE_ID
FROM QP_LIST_LINES QLL
WHERE QLL.LIST_HEADER_ID = I_LIST_HEADER_ID;
BEGIN
/*SELECT USER_ID
INTO L_USER_ID
FROM FND_USER WHERE USER_NAME = 'A0964';
--
SELECT RESPONSIBILITY_ID, APPLICATION_ID
INTO L_RESP_ID, L_APPL_ID
FROM FND_RESPONSIBILITY_VL
WHERE UPPER(RESPONSIBILITY_NAME) LIKE 'OM FOR SUPERUSER(TSN)';
--
FND_GLOBAL.APPS_INITIALIZE(L_USER_ID, L_RESP_ID, L_APPL_ID);*/
gpr_price_list_rec.list_type_code := 'PRL';
gpr_price_list_rec.operation := QP_GLOBALS.G_OPR_UPDATE;
gpr_price_list_rec.active_flag := 'N';
gpr_price_list_rec.list_header_id := I_LIST_HEADER_ID;
gpr_price_list_rec.comments := 'Inactive by SYSADMIN';
--
QP_PRICE_LIST_PUB.Process_Price_List(p_api_version_number => 1,
p_init_msg_list => FND_API.G_FALSE,
p_return_values => FND_API.G_FALSE,
p_commit => FND_API.G_FALSE,
x_return_status => gpr_return_status,
x_msg_count => gpr_msg_count,
x_msg_data => gpr_msg_data,
p_PRICE_LIST_rec => gpr_price_list_rec,
p_PRICE_LIST_LINE_tbl => gpr_price_list_line_tbl,
p_PRICING_ATTR_tbl => gpr_pricing_attr_tbl,
x_PRICE_LIST_rec => ppr_price_list_rec,
x_PRICE_LIST_val_rec => ppr_price_list_val_rec,
x_PRICE_LIST_LINE_tbl => ppr_price_list_line_tbl,
x_PRICE_LIST_LINE_val_tbl => ppr_price_list_line_val_tbl,
x_QUALIFIERS_tbl => ppr_qualifiers_tbl,
x_QUALIFIERS_val_tbl => ppr_qualifiers_val_tbl,
x_PRICING_ATTR_tbl => ppr_pricing_attr_tbl,
x_PRICING_ATTR_val_tbl => ppr_pricing_attr_val_tbl);
--
COMMIT;
--
IF I_PURGE_LINE = 'Y' THEN
FOR C1 IN C_LINES LOOP
gpr_price_list_line_tbl(1).list_line_id := C1.LIST_LINE_ID;
gpr_price_list_line_tbl(1).list_line_type_code := 'PLL';
gpr_price_list_line_tbl(1).operation := QP_GLOBALS.G_OPR_DELETE;
QP_PRICE_LIST_PUB.Process_Price_List(p_api_version_number => 1,
p_init_msg_list => FND_API.G_FALSE,
p_return_values => FND_API.G_FALSE,
p_commit => FND_API.G_FALSE,
x_return_status => gpr_return_status,
x_msg_count => gpr_msg_count,
x_msg_data => gpr_msg_data,
p_PRICE_LIST_rec => gpr_price_list_rec,
p_PRICE_LIST_LINE_tbl => gpr_price_list_line_tbl,
p_PRICING_ATTR_tbl => gpr_pricing_attr_tbl,
x_PRICE_LIST_rec => ppr_price_list_rec,
x_PRICE_LIST_val_rec => ppr_price_list_val_rec,
x_PRICE_LIST_LINE_tbl => ppr_price_list_line_tbl,
x_PRICE_LIST_LINE_val_tbl => ppr_price_list_line_val_tbl,
x_QUALIFIERS_tbl => ppr_qualifiers_tbl,
x_QUALIFIERS_val_tbl => ppr_qualifiers_val_tbl,
x_PRICING_ATTR_tbl => ppr_pricing_attr_tbl,
x_PRICING_ATTR_val_tbl => ppr_pricing_attr_val_tbl);
COMMIT;
END LOOP;
END IF;
END;
沒有留言:
張貼留言