Create a qualifier on price list at API

This post I will show how to create a qualifier on price list

DECLARE
v_return_status VARCHAR2 (1) := NULL;
v_msg_count NUMBER := 0;
v_msg_data VARCHAR2 (2000);
v_price_list_rec qp_price_list_pub.price_list_rec_type;
v_price_list_val_rec qp_price_list_pub.price_list_val_rec_type;
v_price_list_line_tbl qp_price_list_pub.price_list_line_tbl_type;
v_price_list_line_val_tbl qp_price_list_pub.price_list_line_val_tbl_type;
v_qualifiers_tbl qp_qualifier_rules_pub.qualifiers_tbl_type;
v_qualifiers_val_tbl qp_qualifier_rules_pub.qualifiers_val_tbl_type;
v_pricing_attr_tbl qp_price_list_pub.pricing_attr_tbl_type;
v_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;
--apps initilization variables
x_user_id NUMBER := Fnd_Profile.VALUE ('USER_ID');
x_resp_id NUMBER := fnd_global.resp_id;
x_appl_id NUMBER := fnd_global.resp_appl_id;
x_org_id NUMBER := fnd_global.org_id;
x_login_id NUMBER := Fnd_Profile.VALUE ('LOGIN_ID');
i NUMBER := 1;
BEGIN
fnd_global.apps_initialize (1139, 21623, 660);
mo_global.set_policy_context ('S', 81);
mo_global.init('ONT');
DBMS_OUTPUT.PUT_LINE ('API Execution Started');

FND_MSG_PUB.initialize;

FOR C IN (SELECT comparision_operator_code, qualifier_context, qualifier_attribute, qualifier_grouping_no, qualifier_attr_value, list_header_id, list_line_id,
qualifier_datatype, qualifier_precedence
FROM qp_qualifiers_v
WHERE list_header_id = 17061)

LOOP 

v_qualifiers_tbl(i).comparison_operator_code := c.comparision_operator_code;
v_qualifiers_tbl(i).qualifier_context := c.qualifier_context;
v_qualifiers_tbl(i).qualifier_attribute := c.qualifier_attribute;
v_qualifiers_tbl(i).qualifier_grouping_no := c.qualifier_grouping_no;
v_qualifiers_tbl(i).qualifier_attr_value := c.qualifier_attr_value;
v_qualifiers_tbl(i).list_header_id := 7018; --01_LISTA_COOPERADOS
v_qualifiers_tbl(i).list_line_id := c.list_line_id;
v_qualifiers_tbl(i).qualifier_datatype := c.qualifier_datatype;
v_qualifiers_tbl(i).qualifier_precedence := c.qualifier_precedence;
v_qualifiers_tbl(i).operation := QP_GLOBALS.g_opr_create;
i := i + 1;

END LOOP;

DBMS_OUTPUT.put_line ('Calling API to Enter Item Into Price List');

QP_PRICE_LIST_PUB.process_price_list ( p_api_version_number => 1,
p_init_msg_list => FND_API.g_true,
p_return_values => FND_API.g_false,
p_commit => FND_API.g_false,
x_return_status => v_return_status,
x_msg_count => v_msg_count,
x_msg_data => v_msg_data,
p_price_list_rec => v_price_list_rec,
p_price_list_line_tbl => v_price_list_line_tbl,
p_pricing_attr_tbl => v_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_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,
x_price_list_line_val_tbl => ppr_price_list_line_val_tbl);

COMMIT;

IF (v_return_Status = 'S')
THEN
DBMS_OUTPUT.PUT_LINE ('API Executed Successfully');
DBMS_OUTPUT.PUT_LINE (v_return_status);
DBMS_OUTPUT.PUT_LINE (v_msg_count);
DBMS_OUTPUT.PUT_LINE (v_msg_data);
ELSE
IF v_msg_count = 0
THEN
FOR l_index IN 1 .. v_msg_count
LOOP
dbms_output.put_line(l_index || '.' || SUBSTR(v_msg_data, 1, 255));
END LOOP;
END IF;

DBMS_OUTPUT.PUT_LINE ('API Not Executed Successfully ');
END IF;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.PUT_LINE ('ERROR=' || SQLERRM);
END;

Sem título

Deixe uma resposta

Powered by WordPress.com. Tema: Baskerville 2 por Anders Noren

Acima ↑

%d blogueiros gostam disto: