Saturday, November 17, 2012

Oracle Pricing API


Example 1: Line level discount of 8% discount on all products File Path : $QP_TOP/patch/115/sql/QPXEXDS1.sql

/* Discount Creation - Get 8% discount on all products */
REM FILETYPE : NOEXEC
REM Added for ARU db drv auto generation
REM dbdrv: none
SET VERIFY OFF
WHENEVER SQLERROR EXIT FAILURE ROLLBACK;
--set serveroutput on
declare
/* $Header: QPXEXDS1.sql 115.6 2006/08/24 04:51:05 nirmkuma ship $ */
l_control_rec QP_GLOBALS.Control_Rec_Type;
l_return_status VARCHAR2(1);
x_msg_count number;
x_msg_data Varchar2(2000);
x_msg_index number;
l_MODIFIER_LIST_rec QP_Modifiers_PUB.Modifier_List_Rec_Type;
l_MODIFIER_LIST_val_rec QP_Modifiers_PUB.Modifier_List_Val_Rec_Type;
l_MODIFIERS_tbl QP_Modifiers_PUB.Modifiers_Tbl_Type;
l_MODIFIERS_val_tbl QP_Modifiers_PUB.Modifiers_Val_Tbl_Type;
l_QUALIFIERS_tbl QP_Qualifier_Rules_PUB.Qualifiers_Tbl_Type;
l_QUALIFIERS_val_tbl QP_Qualifier_Rules_PUB.Qualifiers_Val_Tbl_Type;
l_PRICING_ATTR_tbl QP_Modifiers_PUB.Pricing_Attr_Tbl_Type;
l_PRICING_ATTR_val_tbl QP_Modifiers_PUB.Pricing_Attr_Val_Tbl_Type;
l_x_MODIFIER_LIST_rec QP_Modifiers_PUB.Modifier_List_Rec_Type;
l_x_MODIFIER_LIST_val_rec QP_Modifiers_PUB.Modifier_List_Val_Rec_Type;
l_x_MODIFIERS_tbl QP_Modifiers_PUB.Modifiers_Tbl_Type;
l_x_MODIFIERS_val_tbl QP_Modifiers_PUB.Modifiers_Val_Tbl_Type;
l_x_QUALIFIERS_tbl QP_Qualifier_Rules_PUB.Qualifiers_Tbl_Type;
l_x_QUALIFIERS_val_tbl QP_Qualifier_Rules_PUB.Qualifiers_Val_Tbl_Type;
l_x_PRICING_ATTR_tbl QP_Modifiers_PUB.Pricing_Attr_Tbl_Type;
l_x_PRICING_ATTR_val_tbl QP_Modifiers_PUB.Pricing_Attr_Val_Tbl_Type;
mll_rec qp_list_lines%ROWTYPE;
pra_rec qp_pricing_attributes%ROWTYPE;
Begin
/* Create a Modifier header of type 'PRO' (Promotion) */
l_MODIFIER_LIST_rec.currency_code := 'USD';
l_MODIFIER_LIST_rec.list_type_code := 'PRO';
l_MODIFIER_LIST_rec.start_date_active := sysdate;
l_MODIFIER_LIST_rec.end_date_active := sysdate+12;
l_MODIFIER_LIST_rec.source_system_code := 'QP';
l_MODIFIER_LIST_rec.active_flag := 'Y';
l_MODIFIER_LIST_rec.name := 'New HALLOWEAN 2000 Deal';
l_MODIFIER_LIST_rec.description := 'Latest New Description of HALLOWEAN 2000';
l_MODIFIER_LIST_rec.version_no := '9.4';
l_MODIFIER_LIST_rec.pte_code := 'ORDFUL';
l_MODIFIER_LIST_rec.operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a Modifier line to specify 'Get 8% discount' condition */
l_MODIFIERS_tbl(1).list_line_type_code := 'DIS';
l_MODIFIERS_tbl(1).automatic_flag:= 'Y';
l_MODIFIERS_tbl(1).modifier_level_code := 'LINE';
l_MODIFIERS_tbl(1).accrual_flag := 'N';
l_MODIFIERS_tbl(1).start_date_active := sysdate;
l_MODIFIERS_tbl(1).end_date_active := sysdate+10;
l_MODIFIERS_tbl(1).arithmetic_operator := '%';
l_MODIFIERS_tbl(1).pricing_group_sequence := 1;
l_MODIFIERS_tbl(1).pricing_phase_id := 2;
l_MODIFIERS_tbl(1).price_break_type_code := 'POINT';
l_MODIFIERS_tbl(1).product_precedence := 1;
l_MODIFIERS_tbl(1).operand := 8;
l_MODIFIERS_tbl(1).modifier_parent_index := 1;
l_MODIFIERS_tbl(1).operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a Pricing Attribute record to specify the 'ALL products' condition */
l_PRICING_ATTR_tbl(1).product_attribute_context:= 'ITEM';
l_PRICING_ATTR_tbl(1).product_attribute:= 'PRICING_ATTRIBUTE3';
l_PRICING_ATTR_tbl(1).product_attr_value:= 'ALL';
l_PRICING_ATTR_tbl(1).pricing_attribute_context:= 'VOLUME';
l_PRICING_ATTR_tbl(2).pricing_attribute:= 'PRICING_ATTRIBUTE10';
l_PRICING_ATTR_tbl(1).pricing_attr_value_from:= 1;
l_PRICING_ATTR_tbl(1).pricing_attr_value_to := 9999999;
l_PRICING_ATTR_tbl(1).comparison_operator_code:= 'BETWEEN';
l_PRICING_ATTR_tbl(1).product_uom_code:= 'Ea';
l_PRICING_ATTR_tbl(1).excluder_flag:= 'N';
l_PRICING_ATTR_tbl(1).accumulate_flag:= 'N';
l_PRICING_ATTR_tbl(1).MODIFIERS_index:=1;
l_PRICING_ATTR_tbl(1).operation := QP_GLOBALS.G_OPR_CREATE;
/* Call the Modifiers Public API to create the modifier header and a modifier line */
QP_Modifiers_PUB.Process_Modifiers
( p_api_version_number => 1.0
, p_init_msg_list => FND_API.G_FALSE
, p_return_values => FND_API.G_FALSE
, p_commit => FND_API.G_FALSE
, x_return_status => l_return_status
, x_msg_count => x_msg_count
, x_msg_data => x_msg_data
, p_MODIFIER_LIST_rec => l_MODIFIER_LIST_rec
, p_MODIFIERS_tbl => l_MODIFIERS_tbl
--, p_QUALIFIERS_tbl => l_QUALIFIERS_tbl
, p_PRICING_ATTR_tbl => l_PRICING_ATTR_tbl
, x_MODIFIER_LIST_rec => l_MODIFIER_LIST_rec
, x_MODIFIER_LIST_val_rec => l_MODIFIER_LIST_val_rec
, x_MODIFIERS_tbl => l_MODIFIERS_tbl
, x_MODIFIERS_val_tbl => l_MODIFIERS_val_tbl
, x_QUALIFIERS_tbl => l_QUALIFIERS_tbl
, x_QUALIFIERS_val_tbl => l_QUALIFIERS_val_tbl
, x_PRICING_ATTR_tbl => l_PRICING_ATTR_tbl
, x_PRICING_ATTR_val_tbl => l_PRICING_ATTR_val_tbl
);
IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
END IF;
EXCEPTION
WHEN FND_API.G_EXC_ERROR THEN
rollback;
l_return_status := FND_API.G_RET_STS_ERROR;
-- Get message count and data
--dbms_output.put_line('err msg is : ' || x_msg_data);
WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
l_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
rollback;
for k in 1 .. x_msg_count loop
x_msg_data := oe_msg_pub.get( p_msg_index => k,
p_encoded => 'F'
-- Get message count and data
--dbms_output.put_line('err msg ' || k ||'is: ' || x_msg_data);
end loop;
WHEN OTHERS THEN
l_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
rollback;
for k in 1 .. x_msg_count loop
x_msg_data := oe_msg_pub.get( p_msg_index => k,
p_encoded => 'F'
-- Get message count and data
--dbms_output.put_line('err msg ' || k ||'is: ' || x_msg_data);
end loop;
END;
/
COMMIT;
EXIT;

======================================================================
======================================================================

Example 2: Buy more than 5 quantities of item 62081 , Get 8% discount
File Path : $QP_TOP/patch/115/sql/QPXEXDS2.sql

/* Discount Creation - Buy 5 of item 62081, Get 8% discount */
REM FILETYPE : NOEXEC
REM Added for ARU db drv auto generation
REM dbdrv: none
SET VERIFY OFF
WHENEVER SQLERROR EXIT FAILURE ROLLBACK;
--set serveroutput on
declare
/* $Header: QPXEXDS2.sql 115.3 2002/06/03 10:34:23 pkm ship $ */
l_control_rec QP_GLOBALS.Control_Rec_Type;
l_return_status VARCHAR2(1);
x_msg_count number;
x_msg_data Varchar2(2000);
x_msg_index number;
l_MODIFIER_LIST_rec QP_Modifiers_PUB.Modifier_List_Rec_Type;
l_MODIFIER_LIST_val_rec QP_Modifiers_PUB.Modifier_List_Val_Rec_Type;
l_MODIFIERS_tbl QP_Modifiers_PUB.Modifiers_Tbl_Type;
l_MODIFIERS_val_tbl QP_Modifiers_PUB.Modifiers_Val_Tbl_Type;
l_QUALIFIERS_tbl QP_Qualifier_Rules_PUB.Qualifiers_Tbl_Type;
l_QUALIFIERS_val_tbl QP_Qualifier_Rules_PUB.Qualifiers_Val_Tbl_Type;
l_PRICING_ATTR_tbl QP_Modifiers_PUB.Pricing_Attr_Tbl_Type;
l_PRICING_ATTR_val_tbl QP_Modifiers_PUB.Pricing_Attr_Val_Tbl_Type;
l_x_MODIFIER_LIST_rec QP_Modifiers_PUB.Modifier_List_Rec_Type;
l_x_MODIFIER_LIST_val_rec QP_Modifiers_PUB.Modifier_List_Val_Rec_Type;
l_x_MODIFIERS_tbl QP_Modifiers_PUB.Modifiers_Tbl_Type;
l_x_MODIFIERS_val_tbl QP_Modifiers_PUB.Modifiers_Val_Tbl_Type;
l_x_QUALIFIERS_tbl QP_Qualifier_Rules_PUB.Qualifiers_Tbl_Type;
l_x_QUALIFIERS_val_tbl QP_Qualifier_Rules_PUB.Qualifiers_Val_Tbl_Type;
l_x_PRICING_ATTR_tbl QP_Modifiers_PUB.Pricing_Attr_Tbl_Type;
l_x_PRICING_ATTR_val_tbl QP_Modifiers_PUB.Pricing_Attr_Val_Tbl_Type;
mll_rec qp_list_lines%ROWTYPE;
pra_rec qp_pricing_attributes%ROWTYPE;
Begin
/* Create a Modifier header of type 'PRO' (Promotion) */
l_MODIFIER_LIST_rec.currency_code := 'USD';
l_MODIFIER_LIST_rec.list_type_code := 'PRO';
l_MODIFIER_LIST_rec.start_date_active := sysdate;
l_MODIFIER_LIST_rec.end_date_active := sysdate+10;
l_MODIFIER_LIST_rec.source_system_code := 'QP';
l_MODIFIER_LIST_rec.active_flag := 'Y';
l_MODIFIER_LIST_rec.name := 'New HALLOWEAN 2000 Deal';
l_MODIFIER_LIST_rec.description := 'New Description of HALLOWEAN 2000';
l_MODIFIER_LIST_rec.version_no := '5.7';
l_MODIFIER_LIST_rec.pte_code := 'ORDFUL';
l_MODIFIER_LIST_rec.operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a Modifier line to specify 'Get 8% discount' condition */
l_MODIFIERS_tbl(1).list_line_type_code := 'DIS';
l_MODIFIERS_tbl(1).automatic_flag:= 'Y';
l_MODIFIERS_tbl(1).modifier_level_code := 'LINE';
l_MODIFIERS_tbl(1).accrual_flag := 'N';
l_MODIFIERS_tbl(1).start_date_active := sysdate;
l_MODIFIERS_tbl(1).end_date_active := sysdate+10;
l_MODIFIERS_tbl(1).operand := 8;
l_MODIFIERS_tbl(1).arithmetic_operator := '%';
l_MODIFIERS_tbl(1).pricing_group_sequence := 1;
l_MODIFIERS_tbl(1).pricing_phase_id := 3;
l_MODIFIERS_tbl(1).price_break_type_code := 'POINT';
l_MODIFIERS_tbl(1).operation := QP_GLOBALS.G_OPR_CREATE;
l_MODIFIERS_tbl(1).product_precedence:= 220;
/* Create a Pricing Attribute record to specify the 'Buy 5 of item 62081' condition */
l_PRICING_ATTR_tbl(1).product_attribute_context:= 'ITEM';
l_PRICING_ATTR_tbl(1).product_attribute:= 'PRICING_ATTRIBUTE1';
l_PRICING_ATTR_tbl(1).product_attr_value:= '62081';
l_PRICING_ATTR_tbl(1).pricing_attribute_context:= 'VOLUME';
l_PRICING_ATTR_tbl(1).pricing_attribute:= 'PRICING_ATTRIBUTE3';
l_PRICING_ATTR_tbl(1).pricing_attr_value_from:= '5';
l_PRICING_ATTR_tbl(1).comparison_operator_code:= 'BETWEEN';
l_PRICING_ATTR_tbl(1).product_uom_code:= 'Ea';
l_PRICING_ATTR_tbl(1).excluder_flag:= 'N';
l_PRICING_ATTR_tbl(1).MODIFIERS_index:=1;
l_PRICING_ATTR_tbl(1).operation := QP_GLOBALS.G_OPR_CREATE;
/* Call the Modifiers Public API to create the modifier, modifier line and a pricing attribute record */
QP_Modifiers_PUB.Process_Modifiers
( p_api_version_number => 1.0
, p_init_msg_list => FND_API.G_FALSE
, p_return_values => FND_API.G_FALSE
, p_commit => FND_API.G_FALSE
, x_return_status => l_return_status
, x_msg_count =>x_msg_count
, x_msg_data =>x_msg_data
,p_MODIFIER_LIST_rec => l_MODIFIER_LIST_rec
,p_MODIFIERS_tbl => l_MODIFIERS_tbl
--,p_QUALIFIERS_tbl => l_QUALIFIERS_tbl
,p_PRICING_ATTR_tbl => l_PRICING_ATTR_tbl
,x_MODIFIER_LIST_rec => l_MODIFIER_LIST_rec
,x_MODIFIER_LIST_val_rec => l_MODIFIER_LIST_val_rec
,x_MODIFIERS_tbl => l_MODIFIERS_tbl
,x_MODIFIERS_val_tbl => l_MODIFIERS_val_tbl
,x_QUALIFIERS_tbl => l_QUALIFIERS_tbl
,x_QUALIFIERS_val_tbl => l_QUALIFIERS_val_tbl
,x_PRICING_ATTR_tbl => l_PRICING_ATTR_tbl
,x_PRICING_ATTR_val_tbl => l_PRICING_ATTR_val_tbl
);
IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
END IF;
EXCEPTION
WHEN FND_API.G_EXC_ERROR THEN
l_return_status := FND_API.G_RET_STS_ERROR;
-- Get message count and data
--dbms_output.put_line('err msg is : ' || x_msg_data);
WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
l_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
for k in 1 .. x_msg_count loop
x_msg_data := oe_msg_pub.get( p_msg_index => k,
p_encoded => 'F'
-- Get message count and data
--dbms_output.put_line('err msg ' || k ||'is: ' || x_msg_data);
end loop;
WHEN OTHERS THEN
l_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
for k in 1 .. x_msg_count loop
x_msg_data := oe_msg_pub.get( p_msg_index => k,
p_encoded => 'F'
-- Get message count and data
--dbms_output.put_line('err msg ' || k ||'is: ' || x_msg_data);
end loop;
END;
/
COMMIT;
EXIT;

======================================================================
======================================================================

Example 3: For customer 1000, Buy more than 2 Units of item 62081, Get 10% discount
File Path : $QP_TOP/patch/115/sql/QPXEXDS3.sql


/* Discount Creation - For customer 1000, Buy 2 of item 62081, Get 10% discount */
REM FILETYPE : NOEXEC
REM Added for ARU db drv auto generation
REM dbdrv: none
SET VERIFY OFF
WHENEVER SQLERROR EXIT FAILURE ROLLBACK;
--set serveroutput on
declare
/* $Header: QPXEXDS3.sql 115.3 2002/06/03 10:34:25 pkm ship $ */
l_control_rec QP_GLOBALS.Control_Rec_Type;
l_return_status VARCHAR2(1);
x_msg_count number;
x_msg_data Varchar2(2000);
x_msg_index number;
l_MODIFIER_LIST_rec QP_Modifiers_PUB.Modifier_List_Rec_Type;
l_MODIFIER_LIST_val_rec QP_Modifiers_PUB.Modifier_List_Val_Rec_Type;
l_MODIFIERS_tbl QP_Modifiers_PUB.Modifiers_Tbl_Type;
l_MODIFIERS_val_tbl QP_Modifiers_PUB.Modifiers_Val_Tbl_Type;
l_QUALIFIERS_tbl QP_Qualifier_Rules_PUB.Qualifiers_Tbl_Type;
l_QUALIFIERS_val_tbl QP_Qualifier_Rules_PUB.Qualifiers_Val_Tbl_Type;
l_PRICING_ATTR_tbl QP_Modifiers_PUB.Pricing_Attr_Tbl_Type;
l_PRICING_ATTR_val_tbl QP_Modifiers_PUB.Pricing_Attr_Val_Tbl_Type;
l_x_MODIFIER_LIST_rec QP_Modifiers_PUB.Modifier_List_Rec_Type;
l_x_MODIFIER_LIST_val_rec QP_Modifiers_PUB.Modifier_List_Val_Rec_Type;
l_x_MODIFIERS_tbl QP_Modifiers_PUB.Modifiers_Tbl_Type;
l_x_MODIFIERS_val_tbl QP_Modifiers_PUB.Modifiers_Val_Tbl_Type;
l_x_QUALIFIERS_tbl QP_Qualifier_Rules_PUB.Qualifiers_Tbl_Type;
l_x_QUALIFIERS_val_tbl QP_Qualifier_Rules_PUB.Qualifiers_Val_Tbl_Type;
l_x_PRICING_ATTR_tbl QP_Modifiers_PUB.Pricing_Attr_Tbl_Type;
l_x_PRICING_ATTR_val_tbl QP_Modifiers_PUB.Pricing_Attr_Val_Tbl_Type;
mll_rec qp_list_lines%ROWTYPE;
pra_rec qp_pricing_attributes%ROWTYPE;
Begin
/* Create a Modifier header of type 'PRO' (Promotion) */
l_MODIFIER_LIST_rec.currency_code := 'USD';
l_MODIFIER_LIST_rec.list_type_code := 'PRO';
l_MODIFIER_LIST_rec.start_date_active := sysdate;
l_MODIFIER_LIST_rec.end_date_active := sysdate+10;
l_MODIFIER_LIST_rec.source_system_code := 'QP';
l_MODIFIER_LIST_rec.active_flag := 'Y';
l_MODIFIER_LIST_rec.name := 'New Year 2001 Promotion';
l_MODIFIER_LIST_rec.description := 'New Year 2001 Promotion';
l_MODIFIER_LIST_rec.version_no := '6.7';
l_MODIFIER_LIST_rec.pte_code := 'ORDFUL';
l_MODIFIER_LIST_rec.operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a Modifier line to specify 'Get 10% discount' condition */
l_MODIFIERS_tbl(1).list_line_type_code := 'DIS';
l_MODIFIERS_tbl(1).automatic_flag:= 'Y';
l_MODIFIERS_tbl(1).modifier_level_code := 'LINE';
l_MODIFIERS_tbl(1).accrual_flag := 'N';
l_MODIFIERS_tbl(1).start_date_active := sysdate;
l_MODIFIERS_tbl(1).end_date_active := sysdate+10;
l_MODIFIERS_tbl(1).operand := 10;
l_MODIFIERS_tbl(1).arithmetic_operator := '%';
l_MODIFIERS_tbl(1).pricing_group_sequence := 1;
l_MODIFIERS_tbl(1).pricing_phase_id := 3;
l_MODIFIERS_tbl(1).price_break_type_code := 'POINT';
l_MODIFIERS_tbl(1).operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a Pricing Attribute record to specify the 'Buy 2 of item 62081' condition */
l_PRICING_ATTR_tbl(1).product_attribute_context:= 'ITEM';
l_PRICING_ATTR_tbl(1).product_attribute:= 'PRICING_ATTRIBUTE1';
l_PRICING_ATTR_tbl(1).product_attr_value:= '62081';
l_PRICING_ATTR_tbl(1).pricing_attribute_context:= 'VOLUME';
l_PRICING_ATTR_tbl(1).pricing_attribute:= 'PRICING_ATTRIBUTE3';
l_PRICING_ATTR_tbl(1).pricing_attr_value_from:= '2';
l_PRICING_ATTR_tbl(1).comparison_operator_code:= 'BETWEEN';
l_PRICING_ATTR_tbl(1).product_uom_code:= 'Ea';
l_PRICING_ATTR_tbl(1).excluder_flag:= 'N';
l_PRICING_ATTR_tbl(1).MODIFIERS_index:=1;
l_PRICING_ATTR_tbl(1).operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a Qualifier Record to specify 'For Customer 1000' condition */
l_QUALIFIERS_tbl(1).excluder_flag := 'N';
l_QUALIFIERS_tbl(1).comparison_operator_code := '=';
l_QUALIFIERS_tbl(1).qualifier_context := 'CUSTOMER';
l_QUALIFIERS_tbl(1).qualifier_attribute := 'QUALIFIER_ATTRIBUTE2';
l_QUALIFIERS_tbl(1).qualifier_attr_value := '1000';
l_QUALIFIERS_tbl(1).qualifier_grouping_no := 5467;
l_QUALIFIERS_tbl(1).qualifier_precedence := 1;
l_QUALIFIERS_tbl(1).start_date_active := sysdate;
l_QUALIFIERS_tbl(1).end_date_active := sysdate+10;
l_QUALIFIERS_tbl(1).operation := QP_GLOBALS.G_OPR_CREATE;
/* Call the Modifiers Public API to create the modifier header, modifier line, qualifier and a pricing attributes record */
QP_Modifiers_PUB.Process_Modifiers
( p_api_version_number => 1.0
, p_init_msg_list => FND_API.G_FALSE
, p_return_values => FND_API.G_FALSE
, p_commit => FND_API.G_FALSE
, x_return_status => l_return_status
, x_msg_count =>x_msg_count
, x_msg_data =>x_msg_data
,p_MODIFIER_LIST_rec => l_MODIFIER_LIST_rec
,p_MODIFIERS_tbl => l_MODIFIERS_tbl
,p_QUALIFIERS_tbl => l_QUALIFIERS_tbl
,p_PRICING_ATTR_tbl => l_PRICING_ATTR_tbl
,x_MODIFIER_LIST_rec => l_MODIFIER_LIST_rec
,x_MODIFIER_LIST_val_rec => l_MODIFIER_LIST_val_rec
,x_MODIFIERS_tbl => l_MODIFIERS_tbl
,x_MODIFIERS_val_tbl => l_MODIFIERS_val_tbl
,x_QUALIFIERS_tbl => l_QUALIFIERS_tbl
,x_QUALIFIERS_val_tbl => l_QUALIFIERS_val_tbl
,x_PRICING_ATTR_tbl => l_PRICING_ATTR_tbl
,x_PRICING_ATTR_val_tbl => l_PRICING_ATTR_val_tbl
);
IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
END IF;
EXCEPTION
WHEN FND_API.G_EXC_ERROR THEN
l_return_status := FND_API.G_RET_STS_ERROR;
-- Get message count and data
--dbms_output.put_line('err msg is : ' || x_msg_data);
WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
l_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
for k in 1 .. x_msg_count loop
x_msg_data := oe_msg_pub.get( p_msg_index => k,
p_encoded => 'F'
-- Get message count and data
--dbms_output.put_line('err msg ' || k ||'is: ' || x_msg_data);
end loop;
WHEN OTHERS THEN
l_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
for k in 1 .. x_msg_count loop
x_msg_data := oe_msg_pub.get( p_msg_index => k,
p_encoded => 'F'
-- Get message count and data
--dbms_output.put_line('err msg ' || k ||'is: ' || x_msg_data);
end loop;
END;
/
COMMIT;
EXIT;

======================================================================
======================================================================

 Example 4: Charge 2% surcharge on all products File Path : /nfs/group/qpdev/qp/11.5/patch/115/sql/QPXEXSUR4.sql

/* Surcharge Creation - Charge 2% surcharge on all products */
REM FILETYPE : NOEXEC
REM Added for ARU db drv auto generation
REM dbdrv: none
SET VERIFY OFF
WHENEVER SQLERROR EXIT FAILURE ROLLBACK;
--set serveroutput on
declare
/* $Header: QPXEXSUR.sql 115.4 2002/06/03 10:34:30 pkm ship $ */
l_control_rec QP_GLOBALS.Control_Rec_Type;
l_return_status VARCHAR2(1);
x_msg_count number;
x_msg_data Varchar2(2000);
x_msg_index number;
l_MODIFIER_LIST_rec QP_Modifiers_PUB.Modifier_List_Rec_Type;
l_MODIFIER_LIST_val_rec QP_Modifiers_PUB.Modifier_List_Val_Rec_Type;
l_MODIFIERS_tbl QP_Modifiers_PUB.Modifiers_Tbl_Type;
l_MODIFIERS_val_tbl QP_Modifiers_PUB.Modifiers_Val_Tbl_Type;
l_QUALIFIERS_tbl QP_Qualifier_Rules_PUB.Qualifiers_Tbl_Type;
l_QUALIFIERS_val_tbl QP_Qualifier_Rules_PUB.Qualifiers_Val_Tbl_Type;
l_PRICING_ATTR_tbl QP_Modifiers_PUB.Pricing_Attr_Tbl_Type;
l_PRICING_ATTR_val_tbl QP_Modifiers_PUB.Pricing_Attr_Val_Tbl_Type;
l_x_MODIFIER_LIST_rec QP_Modifiers_PUB.Modifier_List_Rec_Type;
l_x_MODIFIER_LIST_val_rec QP_Modifiers_PUB.Modifier_List_Val_Rec_Type;
l_x_MODIFIERS_tbl QP_Modifiers_PUB.Modifiers_Tbl_Type;
l_x_MODIFIERS_val_tbl QP_Modifiers_PUB.Modifiers_Val_Tbl_Type;
l_x_QUALIFIERS_tbl QP_Qualifier_Rules_PUB.Qualifiers_Tbl_Type;
l_x_QUALIFIERS_val_tbl QP_Qualifier_Rules_PUB.Qualifiers_Val_Tbl_Type;
l_x_PRICING_ATTR_tbl QP_Modifiers_PUB.Pricing_Attr_Tbl_Type;
l_x_PRICING_ATTR_val_tbl QP_Modifiers_PUB.Pricing_Attr_Val_Tbl_Type;
mll_rec qp_list_lines%ROWTYPE;
pra_rec qp_pricing_attributes%ROWTYPE;
Begin
/* Create a Modifier header of type 'SLT' (Surcharge List) */
l_MODIFIER_LIST_rec.currency_code := 'USD';
l_MODIFIER_LIST_rec.list_type_code := 'SLT';
l_MODIFIER_LIST_rec.start_date_active := sysdate;
l_MODIFIER_LIST_rec.end_date_active := sysdate+10;
l_MODIFIER_LIST_rec.source_system_code := 'QP';
l_MODIFIER_LIST_rec.active_flag := 'Y';
l_MODIFIER_LIST_rec.name := 'Surcharge';
l_MODIFIER_LIST_rec.description := '2% Surcharge';
l_MODIFIER_LIST_rec.version_no := '1.9';
l_MODIFIER_LIST_rec.pte_code := 'ORDFUL';
l_MODIFIER_LIST_rec.operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a Modifier line to specify 'Charge 2% Surcharge' condition */
l_MODIFIERS_tbl(1).list_line_type_code := 'SUR';
l_MODIFIERS_tbl(1).automatic_flag:= 'Y';
l_MODIFIERS_tbl(1).modifier_level_code := 'LINE';
l_MODIFIERS_tbl(1).accrual_flag := 'N';
l_MODIFIERS_tbl(1).start_date_active := sysdate;
l_MODIFIERS_tbl(1).end_date_active := sysdate+10;
l_MODIFIERS_tbl(1).operand := 2;
l_MODIFIERS_tbl(1).arithmetic_operator := '%';
l_MODIFIERS_tbl(1).pricing_group_sequence := 1;
l_MODIFIERS_tbl(1).pricing_phase_id := 2;
l_MODIFIERS_tbl(1).operation := QP_GLOBALS.G_OPR_CREATE;
/* Call the Modifiers Public API to create the modifier header and a modifier line */
QP_Modifiers_PUB.Process_Modifiers
( p_api_version_number => 1.0
, p_init_msg_list => FND_API.G_FALSE
, p_return_values => FND_API.G_FALSE
, p_commit => FND_API.G_FALSE
, x_return_status => l_return_status
, x_msg_count =>x_msg_count
, x_msg_data =>x_msg_data
,p_MODIFIER_LIST_rec => l_MODIFIER_LIST_rec
,p_MODIFIERS_tbl => l_MODIFIERS_tbl
--,p_QUALIFIERS_tbl => l_QUALIFIERS_tbl
--,p_PRICING_ATTR_tbl => l_PRICING_ATTR_tbl
,x_MODIFIER_LIST_rec => l_MODIFIER_LIST_rec
,x_MODIFIER_LIST_val_rec => l_MODIFIER_LIST_val_rec
,x_MODIFIERS_tbl => l_MODIFIERS_tbl
,x_MODIFIERS_val_tbl => l_MODIFIERS_val_tbl
,x_QUALIFIERS_tbl => l_QUALIFIERS_tbl
,x_QUALIFIERS_val_tbl => l_QUALIFIERS_val_tbl
,x_PRICING_ATTR_tbl => l_PRICING_ATTR_tbl
,x_PRICING_ATTR_val_tbl => l_PRICING_ATTR_val_tbl
);
IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
END IF;
EXCEPTION
WHEN FND_API.G_EXC_ERROR THEN
l_return_status := FND_API.G_RET_STS_ERROR;
-- Get message count and data
--dbms_output.put_line('err msg is : ' || x_msg_data);
WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
l_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
for k in 1 .. x_msg_count loop
x_msg_data := oe_msg_pub.get( p_msg_index => k,
p_encoded => 'F'
-- Get message count and data
--dbms_output.put_line('err msg ' || k ||'is: ' || x_msg_data);
end loop;
WHEN OTHERS THEN
l_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
for k in 1 .. x_msg_count loop
x_msg_data := oe_msg_pub.get( p_msg_index => k,
p_encoded => 'F'
-- Get message count and data
--dbms_output.put_line('err msg ' || k ||'is: ' || x_msg_data);
end loop;
END;
/
COMMIT;
EXIT;

======================================================================
======================================================================

 Example 5: For customer 1000, Buy more than 2 units of item 62081, Get a Payment Term 2/10 NET 30
File Path : $QP_TOP/patch/115/sql/QPXEXTSN.sql


/* Terms Substitution Creation - For customer 1000, Buy 2 of item 62081,
Get a Payment Term 2/10 NET 30 */
REM FILETYPE : NOEXEC
REM Added for ARU db drv auto generation
REM dbdrv: none
SET VERIFY OFF
WHENEVER SQLERROR EXIT FAILURE ROLLBACK;
--set serveroutput on
declare
/* $Header: QPXEXTSN.sql 115.3 2002/06/03 10:34:33 pkm ship $ */
l_control_rec QP_GLOBALS.Control_Rec_Type;
l_return_status VARCHAR2(1);
x_msg_count number;
x_msg_data Varchar2(2000);
x_msg_index number;
l_MODIFIER_LIST_rec QP_Modifiers_PUB.Modifier_List_Rec_Type;
l_MODIFIER_LIST_val_rec QP_Modifiers_PUB.Modifier_List_Val_Rec_Type;
l_MODIFIERS_tbl QP_Modifiers_PUB.Modifiers_Tbl_Type;
l_MODIFIERS_val_tbl QP_Modifiers_PUB.Modifiers_Val_Tbl_Type;
l_QUALIFIERS_tbl QP_Qualifier_Rules_PUB.Qualifiers_Tbl_Type;
l_QUALIFIERS_val_tbl QP_Qualifier_Rules_PUB.Qualifiers_Val_Tbl_Type;
l_PRICING_ATTR_tbl QP_Modifiers_PUB.Pricing_Attr_Tbl_Type;
l_PRICING_ATTR_val_tbl QP_Modifiers_PUB.Pricing_Attr_Val_Tbl_Type;
l_x_MODIFIER_LIST_rec QP_Modifiers_PUB.Modifier_List_Rec_Type;
l_x_MODIFIER_LIST_val_rec QP_Modifiers_PUB.Modifier_List_Val_Rec_Type;
l_x_MODIFIERS_tbl QP_Modifiers_PUB.Modifiers_Tbl_Type;
l_x_MODIFIERS_val_tbl QP_Modifiers_PUB.Modifiers_Val_Tbl_Type;
l_x_QUALIFIERS_tbl QP_Qualifier_Rules_PUB.Qualifiers_Tbl_Type;
l_x_QUALIFIERS_val_tbl QP_Qualifier_Rules_PUB.Qualifiers_Val_Tbl_Type;
l_x_PRICING_ATTR_tbl QP_Modifiers_PUB.Pricing_Attr_Tbl_Type;
l_x_PRICING_ATTR_val_tbl QP_Modifiers_PUB.Pricing_Attr_Val_Tbl_Type;
mll_rec qp_list_lines%ROWTYPE;
pra_rec qp_pricing_attributes%ROWTYPE;
Begin
/* Create a Modifier header of type 'PRO' (Promotion) */
l_MODIFIER_LIST_rec.currency_code := 'USD';
l_MODIFIER_LIST_rec.list_type_code := 'PRO';
l_MODIFIER_LIST_rec.start_date_active := sysdate;
l_MODIFIER_LIST_rec.end_date_active := sysdate+10;
l_MODIFIER_LIST_rec.source_system_code := 'QP';
l_MODIFIER_LIST_rec.active_flag := 'Y';
l_MODIFIER_LIST_rec.name := 'Terms Substitution';
l_MODIFIER_LIST_rec.description := 'New Year 2001 Promotion';
l_MODIFIER_LIST_rec.version_no := '1.7';
l_MODIFIER_LIST_rec.pte_code := 'ORDFUL';
l_MODIFIER_LIST_rec.operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a Modifier line to specify 'Get Payment Term 2/10 NET 30 ( Tems id=1000) ' condition */
l_MODIFIERS_tbl(1).list_line_type_code := 'TSN';
l_MODIFIERS_tbl(1).automatic_flag:= 'Y';
l_MODIFIERS_tbl(1).modifier_level_code := 'LINE';
l_MODIFIERS_tbl(1).accrual_flag := 'N';
l_MODIFIERS_tbl(1).start_date_active := sysdate;
l_MODIFIERS_tbl(1).end_date_active := sysdate+10;
--l_MODIFIERS_tbl(1).pricing_group_sequence := 1;
l_MODIFIERS_tbl(1).pricing_phase_id := 3;
l_MODIFIERS_tbl(1).price_break_type_code := 'POINT';
l_MODIFIERS_tbl(1).substitution_context := 'TERMS';
l_MODIFIERS_tbl(1).substitution_attribute := 'QUALIFIER_ATTRIBUTE1';
l_MODIFIERS_tbl(1).substitution_value := '1000';
l_MODIFIERS_tbl(1).operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a Pricing Attribute record to specify the 'Buy 2 of item 62081' condition */
l_PRICING_ATTR_tbl(1).product_attribute_context:= 'ITEM';
l_PRICING_ATTR_tbl(1).product_attribute:= 'PRICING_ATTRIBUTE1';
l_PRICING_ATTR_tbl(1).product_attr_value:= '62081';
l_PRICING_ATTR_tbl(1).pricing_attribute_context:= 'VOLUME';
l_PRICING_ATTR_tbl(1).pricing_attribute:= 'PRICING_ATTRIBUTE3';
l_PRICING_ATTR_tbl(1).pricing_attr_value_from:= '2';
l_PRICING_ATTR_tbl(1).comparison_operator_code:= 'BETWEEN';
l_PRICING_ATTR_tbl(1).product_uom_code:= 'Ea';
l_PRICING_ATTR_tbl(1).excluder_flag:= 'N';
l_PRICING_ATTR_tbl(1).MODIFIERS_index:=1;
l_PRICING_ATTR_tbl(1).operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a Qualifier Record to specify 'For Customer 1000' condition */
l_QUALIFIERS_tbl(1).excluder_flag := 'N';
l_QUALIFIERS_tbl(1).comparison_operator_code := '=';
l_QUALIFIERS_tbl(1).qualifier_context := 'CUSTOMER';
l_QUALIFIERS_tbl(1).qualifier_attribute := 'QUALIFIER_ATTRIBUTE2';
l_QUALIFIERS_tbl(1).qualifier_attr_value := '1000';
l_QUALIFIERS_tbl(1).qualifier_grouping_no := 5467;
l_QUALIFIERS_tbl(1).qualifier_precedence := 1;
l_QUALIFIERS_tbl(1).start_date_active := sysdate;
l_QUALIFIERS_tbl(1).end_date_active := sysdate+10;
l_QUALIFIERS_tbl(1).operation := QP_GLOBALS.G_OPR_CREATE;
/* Call the Modifiers Public API to create the modifier header, modifier line, qualifier and a pricing attributes record */
QP_Modifiers_PUB.Process_Modifiers
( p_api_version_number => 1.0
, p_init_msg_list => FND_API.G_FALSE
, p_return_values => FND_API.G_FALSE
, p_commit => FND_API.G_FALSE
, x_return_status => l_return_status
, x_msg_count =>x_msg_count
, x_msg_data =>x_msg_data
,p_MODIFIER_LIST_rec => l_MODIFIER_LIST_rec
,p_MODIFIERS_tbl => l_MODIFIERS_tbl
,p_QUALIFIERS_tbl => l_QUALIFIERS_tbl
,p_PRICING_ATTR_tbl => l_PRICING_ATTR_tbl
,x_MODIFIER_LIST_rec => l_MODIFIER_LIST_rec
,x_MODIFIER_LIST_val_rec => l_MODIFIER_LIST_val_rec
,x_MODIFIERS_tbl => l_MODIFIERS_tbl
,x_MODIFIERS_val_tbl => l_MODIFIERS_val_tbl
,x_QUALIFIERS_tbl => l_QUALIFIERS_tbl
,x_QUALIFIERS_val_tbl => l_QUALIFIERS_val_tbl
,x_PRICING_ATTR_tbl => l_PRICING_ATTR_tbl
,x_PRICING_ATTR_val_tbl => l_PRICING_ATTR_val_tbl
);
IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
END IF;
EXCEPTION
WHEN FND_API.G_EXC_ERROR THEN
l_return_status := FND_API.G_RET_STS_ERROR;
-- Get message count and data
--dbms_output.put_line('err msg is : ' || x_msg_data);
WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
l_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
for k in 1 .. x_msg_count loop
x_msg_data := oe_msg_pub.get( p_msg_index => k,
p_encoded => 'F'
-- Get message count and data
--dbms_output.put_line('err msg ' || k ||'is: ' || x_msg_data);
end loop;
WHEN OTHERS THEN
l_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
for k in 1 .. x_msg_count loop
x_msg_data := oe_msg_pub.get( p_msg_index => k,
p_encoded => 'F'
-- Get message count and data
--dbms_output.put_line('err msg ' || k ||'is: ' || x_msg_data);
end loop;
END;
/
COMMIT;
EXIT;

======================================================================
======================================================================

Example 6: Other Item Discount Creation - Buy 1 of item 62081, Get 1 free
File Path: $QP_TOP/patch/115/sql/QPXEXOID.sql


/* Other Item Discount Creation - Buy 1 of item 62081, Get 1 free */
REM FILETYPE : NOEXEC
REM Added for ARU db drv auto generation
REM dbdrv: none
SET VERIFY OFF
WHENEVER SQLERROR EXIT FAILURE ROLLBACK;
--set serveroutput on
declare
/* $Header: QPXEXOID.sql 115.2 2002/06/03 10:34:26 pkm ship $ */
l_control_rec QP_GLOBALS.Control_Rec_Type;
l_return_status VARCHAR2(1);
x_msg_count number;
x_msg_data Varchar2(2000);
x_msg_index number;
l_MODIFIER_LIST_rec QP_Modifiers_PUB.Modifier_List_Rec_Type;
l_MODIFIER_LIST_val_rec QP_Modifiers_PUB.Modifier_List_Val_Rec_Type;
l_MODIFIERS_tbl QP_Modifiers_PUB.Modifiers_Tbl_Type;
l_MODIFIERS_val_tbl QP_Modifiers_PUB.Modifiers_Val_Tbl_Type;
l_QUALIFIERS_tbl QP_Qualifier_Rules_PUB.Qualifiers_Tbl_Type;
l_QUALIFIERS_val_tbl QP_Qualifier_Rules_PUB.Qualifiers_Val_Tbl_Type;
l_PRICING_ATTR_tbl QP_Modifiers_PUB.Pricing_Attr_Tbl_Type;
l_PRICING_ATTR_val_tbl QP_Modifiers_PUB.Pricing_Attr_Val_Tbl_Type;
l_x_MODIFIER_LIST_rec QP_Modifiers_PUB.Modifier_List_Rec_Type;
l_x_MODIFIER_LIST_val_rec QP_Modifiers_PUB.Modifier_List_Val_Rec_Type;
l_x_MODIFIERS_tbl QP_Modifiers_PUB.Modifiers_Tbl_Type;
l_x_MODIFIERS_val_tbl QP_Modifiers_PUB.Modifiers_Val_Tbl_Type;
l_x_QUALIFIERS_tbl QP_Qualifier_Rules_PUB.Qualifiers_Tbl_Type;
l_x_QUALIFIERS_val_tbl QP_Qualifier_Rules_PUB.Qualifiers_Val_Tbl_Type;
l_x_PRICING_ATTR_tbl QP_Modifiers_PUB.Pricing_Attr_Tbl_Type;
l_x_PRICING_ATTR_val_tbl QP_Modifiers_PUB.Pricing_Attr_Val_Tbl_Type;
mll_rec qp_list_lines%ROWTYPE;
pra_rec qp_pricing_attributes%ROWTYPE;
Begin
/* Create a Modifier header of type 'PRO' (Promotion) */
l_MODIFIER_LIST_rec.currency_code := 'USD';
l_MODIFIER_LIST_rec.list_type_code := 'PRO';
l_MODIFIER_LIST_rec.start_date_active := sysdate;
l_MODIFIER_LIST_rec.end_date_active := sysdate+10;
l_MODIFIER_LIST_rec.source_system_code := 'QP';
l_MODIFIER_LIST_rec.active_flag := 'Y';
l_MODIFIER_LIST_rec.name := 'latest 3.7 OID 2001 Promotion';
l_MODIFIER_LIST_rec.description := 'latest OID 2001 Promotion';
l_MODIFIER_LIST_rec.version_no := '3.7';
l_MODIFIER_LIST_rec.pte_code := 'ORDFUL';
l_MODIFIER_LIST_rec.operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a Modifier line to specify Other Item Discount (OID) */
l_MODIFIERS_tbl(1).list_line_type_code := 'OID';
l_MODIFIERS_tbl(1).automatic_flag:= 'Y';
l_MODIFIERS_tbl(1).modifier_level_code := 'LINE';
l_MODIFIERS_tbl(1).accrual_flag := 'N';
l_MODIFIERS_tbl(1).start_date_active := sysdate;
l_MODIFIERS_tbl(1).end_date_active := sysdate+10;
l_MODIFIERS_tbl(1).pricing_group_sequence := 1;
l_MODIFIERS_tbl(1).pricing_phase_id := 3;
l_MODIFIERS_tbl(1).product_precedence := 12;
l_MODIFIERS_tbl(1).price_break_type_code := 'POINT';
l_MODIFIERS_tbl(1).modifier_parent_index := 1;
l_MODIFIERS_tbl(1).operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a Modifier line to specify the free (100% discount) condition */
l_MODIFIERS_tbl(2).list_line_type_code := 'DIS';
l_MODIFIERS_tbl(2).automatic_flag:= 'Y';
l_MODIFIERS_tbl(2).modifier_level_code := 'LINE';
l_MODIFIERS_tbl(2).accrual_flag := 'N';
l_MODIFIERS_tbl(2).start_date_active := sysdate;
l_MODIFIERS_tbl(2).end_date_active := sysdate+10;
l_MODIFIERS_tbl(2).operand := 100;
l_MODIFIERS_tbl(2).arithmetic_operator := '%';
l_MODIFIERS_tbl(2).pricing_group_sequence := 1;
l_MODIFIERS_tbl(2).pricing_phase_id := 3;
l_MODIFIERS_tbl(2).product_precedence := 12;
l_MODIFIERS_tbl(2).price_break_type_code := 'POINT';
l_MODIFIERS_tbl(2).modifier_parent_index := 1;
l_MODIFIERS_tbl(2).rltd_modifier_grp_no := 12;
l_MODIFIERS_tbl(2).rltd_modifier_grp_type := 'BENEFIT';
l_MODIFIERS_tbl(2).operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a Pricing Attribute record to specify the 'Buy 1 of item 62081' condition. It is linked to the OID modifier record by specifying modifiers_index=1 */
l_PRICING_ATTR_tbl(1).product_attribute_context:= 'ITEM';
l_PRICING_ATTR_tbl(1).product_attribute:= 'PRICING_ATTRIBUTE1';
l_PRICING_ATTR_tbl(1).product_attr_value:= '62081';
l_PRICING_ATTR_tbl(1).pricing_attribute_context:= 'VOLUME';
l_PRICING_ATTR_tbl(1).pricing_attribute:= 'PRICING_ATTRIBUTE3';
l_PRICING_ATTR_tbl(1).pricing_attr_value_from:= '1';
l_PRICING_ATTR_tbl(1).comparison_operator_code:= 'BETWEEN';
l_PRICING_ATTR_tbl(1).product_uom_code:= 'Ea';
l_PRICING_ATTR_tbl(1).excluder_flag:= 'N';
l_PRICING_ATTR_tbl(1).MODIFIERS_index:=1;
l_PRICING_ATTR_tbl(1).operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a Pricing Attribute record to specify the 'Get 1 of item 62081' condition. It is linked to the DIS modifier record by specifying modifiers_index=2 */
l_PRICING_ATTR_tbl(2).product_attribute_context:= 'ITEM';
l_PRICING_ATTR_tbl(2).product_attribute:= 'PRICING_ATTRIBUTE1';
l_PRICING_ATTR_tbl(2).product_attr_value:= '62081';
l_PRICING_ATTR_tbl(2).pricing_attribute_context:= 'VOLUME';
l_PRICING_ATTR_tbl(2).pricing_attribute:= 'PRICING_ATTRIBUTE3';
l_PRICING_ATTR_tbl(2).pricing_attr_value_from:= '1';
l_PRICING_ATTR_tbl(2).comparison_operator_code:= 'BETWEEN';
l_PRICING_ATTR_tbl(2).product_uom_code:= 'Ea';
l_PRICING_ATTR_tbl(2).excluder_flag:= 'N';
l_PRICING_ATTR_tbl(2).MODIFIERS_index:=2;
l_PRICING_ATTR_tbl(2).operation := QP_GLOBALS.G_OPR_CREATE;
QP_Modifiers_PUB.Process_Modifiers
( p_api_version_number => 1.0
, p_init_msg_list => FND_API.G_FALSE
, p_return_values => FND_API.G_FALSE
, p_commit => FND_API.G_FALSE
, x_return_status => l_return_status
, x_msg_count =>x_msg_count
, x_msg_data =>x_msg_data
,p_MODIFIER_LIST_rec => l_MODIFIER_LIST_rec
,p_MODIFIERS_tbl => l_MODIFIERS_tbl
,p_PRICING_ATTR_tbl => l_PRICING_ATTR_tbl
,x_MODIFIER_LIST_rec => l_x_MODIFIER_LIST_rec
,x_MODIFIER_LIST_val_rec => l_x_MODIFIER_LIST_val_rec
,x_MODIFIERS_tbl => l_x_MODIFIERS_tbl
,x_MODIFIERS_val_tbl => l_x_MODIFIERS_val_tbl
,x_QUALIFIERS_tbl => l_x_QUALIFIERS_tbl
,x_QUALIFIERS_val_tbl => l_x_QUALIFIERS_val_tbl
,x_PRICING_ATTR_tbl => l_x_PRICING_ATTR_tbl
,x_PRICING_ATTR_val_tbl => l_x_PRICING_ATTR_val_tbl
);
IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
END IF;
EXCEPTION
WHEN FND_API.G_EXC_ERROR THEN
l_return_status := FND_API.G_RET_STS_ERROR;
-- Get message count and data
--dbms_output.put_line('err msg 1 is : ' || x_msg_data);
WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
l_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
--dbms_output.put_line(' msg count 2 is : ' || x_msg_count);
for k in 1 .. x_msg_count loop
x_msg_data := oe_msg_pub.get( p_msg_index => k,
p_encoded => 'F'
-- Get message count and data
--dbms_output.put_line('err msg ' || k ||'is: ' || x_msg_data);
end loop;
WHEN OTHERS THEN
l_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
--dbms_output.put_line(' msg count 5 is : ' || x_msg_count);
for k in 1 .. x_msg_count loop
x_msg_data := oe_msg_pub.get( p_msg_index => k,
p_encoded => 'F'
-- Get message count and data
--dbms_output.put_line('err msg ' || k ||'is: ' || x_msg_data);
end loop;
END;
/
commit;
exit;


======================================================================
======================================================================

 Example 7: Promotional Goods - Buy 1 of item 45 and 1 item 63, Get 1 item 62081 at 20% discount
File Path : $QP_TOP/patch/115/sql/QPXEXPRG.sql


/* Promotional Goods - Buy 1 of item 45 and 1 item 63, Get 1 item 62081 at 20% discount */
REM FILETYPE : NOEXEC
REM Added for ARU db drv auto generation
REM dbdrv: none
SET VERIFY OFF
WHENEVER SQLERROR EXIT FAILURE ROLLBACK;
--set serveroutput on
declare
/* $Header: QPXEXPRG.sql 115.2 2002/06/03 10:34:29 pkm ship $ */
l_control_rec QP_GLOBALS.Control_Rec_Type;
l_return_status VARCHAR2(1);
x_msg_count number;
x_msg_data Varchar2(2000);
x_msg_index number;
l_MODIFIER_LIST_rec QP_Modifiers_PUB.Modifier_List_Rec_Type;
l_MODIFIER_LIST_val_rec QP_Modifiers_PUB.Modifier_List_Val_Rec_Type;
l_MODIFIERS_tbl QP_Modifiers_PUB.Modifiers_Tbl_Type;
l_MODIFIERS_val_tbl QP_Modifiers_PUB.Modifiers_Val_Tbl_Type;
l_QUALIFIERS_tbl QP_Qualifier_Rules_PUB.Qualifiers_Tbl_Type;
l_QUALIFIERS_val_tbl QP_Qualifier_Rules_PUB.Qualifiers_Val_Tbl_Type;
l_PRICING_ATTR_tbl QP_Modifiers_PUB.Pricing_Attr_Tbl_Type;
l_PRICING_ATTR_val_tbl QP_Modifiers_PUB.Pricing_Attr_Val_Tbl_Type;
l_x_MODIFIER_LIST_rec QP_Modifiers_PUB.Modifier_List_Rec_Type;
l_x_MODIFIER_LIST_val_rec QP_Modifiers_PUB.Modifier_List_Val_Rec_Type;
l_x_MODIFIERS_tbl QP_Modifiers_PUB.Modifiers_Tbl_Type;
l_x_MODIFIERS_val_tbl QP_Modifiers_PUB.Modifiers_Val_Tbl_Type;
l_x_QUALIFIERS_tbl QP_Qualifier_Rules_PUB.Qualifiers_Tbl_Type;
l_x_QUALIFIERS_val_tbl QP_Qualifier_Rules_PUB.Qualifiers_Val_Tbl_Type;
l_x_PRICING_ATTR_tbl QP_Modifiers_PUB.Pricing_Attr_Tbl_Type;
l_x_PRICING_ATTR_val_tbl QP_Modifiers_PUB.Pricing_Attr_Val_Tbl_Type;
mll_rec qp_list_lines%ROWTYPE;
pra_rec qp_pricing_attributes%ROWTYPE;
Begin
/* Create a Modifier header of type 'PRO' (Promotion)- linked to item 45 */
l_MODIFIER_LIST_rec.currency_code := 'USD';
l_MODIFIER_LIST_rec.list_type_code := 'PRO';
l_MODIFIER_LIST_rec.start_date_active := sysdate;
l_MODIFIER_LIST_rec.end_date_active := sysdate+10;
l_MODIFIER_LIST_rec.source_system_code := 'QP';
l_MODIFIER_LIST_rec.active_flag := 'Y';
l_MODIFIER_LIST_rec.name := 'latest 1.8 PRG 2001 Promotion';
l_MODIFIER_LIST_rec.description := 'latest PRG 2001 Promotion';
l_MODIFIER_LIST_rec.version_no := '1.8';
l_MODIFIER_LIST_rec.pte_code := 'ORDFUL';
l_MODIFIER_LIST_rec.operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a Modifier line to specify Promotional Goods (PRG) - linked to item 45 */
l_MODIFIERS_tbl(1).list_line_type_code := 'PRG';
l_MODIFIERS_tbl(1).automatic_flag:= 'Y';
l_MODIFIERS_tbl(1).modifier_level_code := 'LINE';
l_MODIFIERS_tbl(1).accrual_flag := 'N';
l_MODIFIERS_tbl(1).start_date_active := sysdate;
l_MODIFIERS_tbl(1).end_date_active := sysdate+10;
l_MODIFIERS_tbl(1).pricing_group_sequence := 1;
l_MODIFIERS_tbl(1).pricing_phase_id := 3;
l_MODIFIERS_tbl(1).product_precedence := 12;
l_MODIFIERS_tbl(1).price_break_type_code := 'POINT';
l_MODIFIERS_tbl(1).modifier_parent_index := 1;
l_MODIFIERS_tbl(1).operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a Modifier line to specify related item (RLTD) - linked to item 63 */
l_MODIFIERS_tbl(2).list_line_type_code := 'RLTD';
l_MODIFIERS_tbl(2).automatic_flag:= 'Y';
l_MODIFIERS_tbl(2).modifier_level_code := 'LINE';
l_MODIFIERS_tbl(2).accrual_flag := 'N';
l_MODIFIERS_tbl(2).start_date_active := sysdate;
l_MODIFIERS_tbl(2).end_date_active := sysdate+10;
l_MODIFIERS_tbl(2).pricing_group_sequence := 1;
l_MODIFIERS_tbl(2).pricing_phase_id := 3;
l_MODIFIERS_tbl(2).product_precedence := 12;
l_MODIFIERS_tbl(2).price_break_type_code := 'POINT';
l_MODIFIERS_tbl(2).modifier_parent_index := 1;
l_MODIFIERS_tbl(2).rltd_modifier_grp_no := 12;
l_MODIFIERS_tbl(2).rltd_modifier_grp_type := 'QUALIFIER';
l_MODIFIERS_tbl(2).operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a Modifier line to specify 20% discount on item 62081 */
l_MODIFIERS_tbl(3).list_line_type_code := 'DIS';
l_MODIFIERS_tbl(3).automatic_flag:= 'Y';
l_MODIFIERS_tbl(3).modifier_level_code := 'LINE';
l_MODIFIERS_tbl(3).accrual_flag := 'N';
l_MODIFIERS_tbl(3).start_date_active := sysdate;
l_MODIFIERS_tbl(3).end_date_active := sysdate+10;
l_MODIFIERS_tbl(3).operand := 20;
l_MODIFIERS_tbl(3).arithmetic_operator := '%';
l_MODIFIERS_tbl(3).pricing_group_sequence := 1;
l_MODIFIERS_tbl(3).pricing_phase_id := 3;
l_MODIFIERS_tbl(3).product_precedence := 12;
l_MODIFIERS_tbl(3).price_break_type_code := 'POINT';
l_MODIFIERS_tbl(3).modifier_parent_index := 1;
l_MODIFIERS_tbl(3).rltd_modifier_grp_no := 10;
l_MODIFIERS_tbl(3).rltd_modifier_grp_type := 'BENEFIT';
l_MODIFIERS_tbl(3).benefit_price_list_line_id := 41187;
l_MODIFIERS_tbl(3).benefit_qty := 1;
l_MODIFIERS_tbl(3).benefit_uom_code := 'Ea';
l_MODIFIERS_tbl(3).operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a Pricing Attribute record to specify the 'Buy 1 of item 45' condition. It is linked to the PRG modifier record by specifying modifiers_index=1 */
l_PRICING_ATTR_tbl(1).product_attribute_context:= 'ITEM';
l_PRICING_ATTR_tbl(1).product_attribute:= 'PRICING_ATTRIBUTE1';
l_PRICING_ATTR_tbl(1).product_attr_value:= '45';
l_PRICING_ATTR_tbl(1).pricing_attribute_context:= 'VOLUME';
l_PRICING_ATTR_tbl(1).pricing_attribute:= 'PRICING_ATTRIBUTE3';
l_PRICING_ATTR_tbl(1).pricing_attr_value_from:= '1';
l_PRICING_ATTR_tbl(1).comparison_operator_code:= 'BETWEEN';
l_PRICING_ATTR_tbl(1).product_uom_code:= 'Ea';
l_PRICING_ATTR_tbl(1).excluder_flag:= 'N';
l_PRICING_ATTR_tbl(1).MODIFIERS_index:=1;
l_PRICING_ATTR_tbl(1).operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a Pricing Attribute record to specify the 'Buy 1 of item 63' condition. It is linked to the RLTD modifier record by specifying modifiers_index=2 */
l_PRICING_ATTR_tbl(2).product_attribute_context:= 'ITEM';
l_PRICING_ATTR_tbl(2).product_attribute:= 'PRICING_ATTRIBUTE1';
l_PRICING_ATTR_tbl(2).product_attr_value:= '63';
l_PRICING_ATTR_tbl(2).pricing_attribute_context:= 'VOLUME';
l_PRICING_ATTR_tbl(2).pricing_attribute:= 'PRICING_ATTRIBUTE3';
l_PRICING_ATTR_tbl(2).pricing_attr_value_from:= '1';
l_PRICING_ATTR_tbl(2).comparison_operator_code:= 'BETWEEN';
l_PRICING_ATTR_tbl(2).product_uom_code:= 'Ea';
l_PRICING_ATTR_tbl(2).excluder_flag:= 'N';
l_PRICING_ATTR_tbl(2).MODIFIERS_index:=2;
l_PRICING_ATTR_tbl(2).operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a Pricing Attribute record to specify the 'Get 1 of item 62081' condition. It is linked to the DIS modifier record by specifying modifiers_index=3 */
l_PRICING_ATTR_tbl(3).product_attribute_context:= 'ITEM';
l_PRICING_ATTR_tbl(3).product_attribute:= 'PRICING_ATTRIBUTE1';
l_PRICING_ATTR_tbl(3).product_attr_value:= '62081';
l_PRICING_ATTR_tbl(3).pricing_attribute_context:= 'VOLUME';
l_PRICING_ATTR_tbl(3).pricing_attribute:= 'PRICING_ATTRIBUTE3';
l_PRICING_ATTR_tbl(3).pricing_attr_value_from:= '1';
l_PRICING_ATTR_tbl(3).comparison_operator_code:= 'BETWEEN';
l_PRICING_ATTR_tbl(3).product_uom_code:= 'Ea';
l_PRICING_ATTR_tbl(3).excluder_flag:= 'N';
l_PRICING_ATTR_tbl(3).MODIFIERS_index:=3;
l_PRICING_ATTR_tbl(3).operation := QP_GLOBALS.G_OPR_CREATE;
QP_Modifiers_PUB.Process_Modifiers
( p_api_version_number => 1.0
, p_init_msg_list => FND_API.G_FALSE
, p_return_values => FND_API.G_FALSE
, p_commit => FND_API.G_FALSE
, x_return_status => l_return_status
, x_msg_count =>x_msg_count
, x_msg_data =>x_msg_data
,p_MODIFIER_LIST_rec => l_MODIFIER_LIST_rec
,p_MODIFIERS_tbl => l_MODIFIERS_tbl
,p_PRICING_ATTR_tbl => l_PRICING_ATTR_tbl
,x_MODIFIER_LIST_rec => l_x_MODIFIER_LIST_rec
,x_MODIFIER_LIST_val_rec => l_x_MODIFIER_LIST_val_rec
,x_MODIFIERS_tbl => l_x_MODIFIERS_tbl
,x_MODIFIERS_val_tbl => l_x_MODIFIERS_val_tbl
,x_QUALIFIERS_tbl => l_x_QUALIFIERS_tbl
,x_QUALIFIERS_val_tbl => l_x_QUALIFIERS_val_tbl
,x_PRICING_ATTR_tbl => l_x_PRICING_ATTR_tbl
,x_PRICING_ATTR_val_tbl => l_x_PRICING_ATTR_val_tbl
);
IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
END IF;
EXCEPTION
WHEN FND_API.G_EXC_ERROR THEN
l_return_status := FND_API.G_RET_STS_ERROR;
-- Get message count and data
--dbms_output.put_line('err msg 1 is : ' || x_msg_data);
WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
l_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
--dbms_output.put_line(' msg count 2 is : ' || x_msg_count);
for k in 1 .. x_msg_count loop
x_msg_data := oe_msg_pub.get( p_msg_index => k,
p_encoded => 'F'
-- Get message count and data
--dbms_output.put_line('err msg ' || k ||'is: ' || x_msg_data);
end loop;
WHEN OTHERS THEN
l_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
--dbms_output.put_line(' msg count 5 is : ' || x_msg_count);
for k in 1 .. x_msg_count loop
x_msg_data := oe_msg_pub.get( p_msg_index => k,
p_encoded => 'F'
-- Get message count and data
--dbms_output.put_line('err msg ' || k ||'is: ' || x_msg_data);
end loop;
END;
/
commit;
exit;

======================================================================
======================================================================

 Example 8: Coupon Issue - Buy 2 of item 45, Get Coupon for 20% discount
File Path : $QP_TOP/patch/115/sql/QPXEXCIE.sql


-- Coupon Issue - Buy 2 of item 45, Get Coupon for 20% discount
REM FILETYPE : NOEXEC
REM Added for ARU db drv auto generation
REM dbdrv: none
SET VERIFY OFF
WHENEVER SQLERROR EXIT FAILURE ROLLBACK;
--set serveroutput on
declare
/* $Header: QPXEXCIE.sql 115.2 2002/06/03 10:34:19 pkm ship $ */
l_control_rec QP_GLOBALS.Control_Rec_Type;
l_return_status VARCHAR2(1);
x_msg_count number;
x_msg_data Varchar2(2000);
x_msg_index number;
l_MODIFIER_LIST_rec QP_Modifiers_PUB.Modifier_List_Rec_Type;
l_MODIFIER_LIST_val_rec QP_Modifiers_PUB.Modifier_List_Val_Rec_Type;
l_MODIFIERS_tbl QP_Modifiers_PUB.Modifiers_Tbl_Type;
l_MODIFIERS_val_tbl QP_Modifiers_PUB.Modifiers_Val_Tbl_Type;
l_QUALIFIERS_tbl QP_Qualifier_Rules_PUB.Qualifiers_Tbl_Type;
l_QUALIFIERS_val_tbl QP_Qualifier_Rules_PUB.Qualifiers_Val_Tbl_Type;
l_PRICING_ATTR_tbl QP_Modifiers_PUB.Pricing_Attr_Tbl_Type;
l_PRICING_ATTR_val_tbl QP_Modifiers_PUB.Pricing_Attr_Val_Tbl_Type;
l_x_MODIFIER_LIST_rec QP_Modifiers_PUB.Modifier_List_Rec_Type;
l_x_MODIFIER_LIST_val_rec QP_Modifiers_PUB.Modifier_List_Val_Rec_Type;
l_x_MODIFIERS_tbl QP_Modifiers_PUB.Modifiers_Tbl_Type;
l_x_MODIFIERS_val_tbl QP_Modifiers_PUB.Modifiers_Val_Tbl_Type;
l_x_QUALIFIERS_tbl QP_Qualifier_Rules_PUB.Qualifiers_Tbl_Type;
l_x_QUALIFIERS_val_tbl QP_Qualifier_Rules_PUB.Qualifiers_Val_Tbl_Type;
l_x_PRICING_ATTR_tbl QP_Modifiers_PUB.Pricing_Attr_Tbl_Type;
l_x_PRICING_ATTR_val_tbl QP_Modifiers_PUB.Pricing_Attr_Val_Tbl_Type;
mll_rec qp_list_lines%ROWTYPE;
pra_rec qp_pricing_attributes%ROWTYPE;
Begin
/* Create a Modifier header of type 'PRO' (Promotion) */
l_MODIFIER_LIST_rec.currency_code := 'USD';
l_MODIFIER_LIST_rec.list_type_code := 'PRO';
l_MODIFIER_LIST_rec.start_date_active := sysdate;
l_MODIFIER_LIST_rec.end_date_active := sysdate+10;
l_MODIFIER_LIST_rec.source_system_code := 'QP';
l_MODIFIER_LIST_rec.active_flag := 'Y';
l_MODIFIER_LIST_rec.name := 'latest 2.1 CIE 2001 Promotion';
l_MODIFIER_LIST_rec.description := 'latest CIE 2001 Promotion';
l_MODIFIER_LIST_rec.version_no := '2.1';
l_MODIFIER_LIST_rec.pte_code := 'ORDFUL';
l_MODIFIER_LIST_rec.operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a modifier of type Coupon Issue (CIE). The from_rltd_modifier_id is the list_line_id
of anathor modifier which specifies the 'Get 20% discount' condition of the Coupon. So, this
modifier needs to be created prior to creating this Coupun Issue */
l_MODIFIERS_tbl(1).list_line_type_code := 'CIE';
l_MODIFIERS_tbl(1).automatic_flag:= 'Y';
l_MODIFIERS_tbl(1).modifier_level_code := 'LINE';
l_MODIFIERS_tbl(1).accrual_flag := 'Y';
l_MODIFIERS_tbl(1).start_date_active := sysdate;
l_MODIFIERS_tbl(1).end_date_active := sysdate+10;
l_MODIFIERS_tbl(1).pricing_group_sequence := 1;
l_MODIFIERS_tbl(1).pricing_phase_id := 3;
l_MODIFIERS_tbl(1).product_precedence := 12;
l_MODIFIERS_tbl(1).price_break_type_code := 'POINT';
l_MODIFIERS_tbl(1).modifier_parent_index := 1;
l_MODIFIERS_tbl(1).to_rltd_modifier_id := 306693;
l_MODIFIERS_tbl(1).rltd_modifier_grp_no := 10;
l_MODIFIERS_tbl(1).rltd_modifier_grp_type := 'COUPON';
l_MODIFIERS_tbl(1).operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a Pricing Attribute record to specify the 'Buy 2 of item 45' condition. It is linked to the CIE modifier record by specifying modifiers_index=1 */
l_PRICING_ATTR_tbl(1).product_attribute_context:= 'ITEM';
l_PRICING_ATTR_tbl(1).product_attribute:= 'PRICING_ATTRIBUTE1';
l_PRICING_ATTR_tbl(1).product_attr_value:= '45';
l_PRICING_ATTR_tbl(1).pricing_attribute_context:= 'VOLUME';
l_PRICING_ATTR_tbl(1).pricing_attribute:= 'PRICING_ATTRIBUTE10';
l_PRICING_ATTR_tbl(1).pricing_attr_value_from := 2;
l_PRICING_ATTR_tbl(1).comparison_operator_code:= 'BETWEEN';
l_PRICING_ATTR_tbl(1).product_uom_code:= 'Ea';
l_PRICING_ATTR_tbl(1).excluder_flag:= 'N';
l_PRICING_ATTR_tbl(1).MODIFIERS_index:=1;
l_PRICING_ATTR_tbl(1).operation := QP_GLOBALS.G_OPR_CREATE;
QP_Modifiers_PUB.Process_Modifiers
( p_api_version_number => 1.0
, p_init_msg_list => FND_API.G_FALSE
, p_return_values => FND_API.G_FALSE
, p_commit => FND_API.G_FALSE
, x_return_status => l_return_status
, x_msg_count =>x_msg_count
, x_msg_data =>x_msg_data
,p_MODIFIER_LIST_rec => l_MODIFIER_LIST_rec
,p_MODIFIERS_tbl => l_MODIFIERS_tbl
,p_QUALIFIERS_tbl => l_QUALIFIERS_tbl
,p_PRICING_ATTR_tbl => l_PRICING_ATTR_tbl
,x_MODIFIER_LIST_rec => l_x_MODIFIER_LIST_rec
,x_MODIFIER_LIST_val_rec => l_x_MODIFIER_LIST_val_rec
,x_MODIFIERS_tbl => l_x_MODIFIERS_tbl
,x_MODIFIERS_val_tbl => l_x_MODIFIERS_val_tbl
,x_QUALIFIERS_tbl => l_x_QUALIFIERS_tbl
,x_QUALIFIERS_val_tbl => l_x_QUALIFIERS_val_tbl
,x_PRICING_ATTR_tbl => l_x_PRICING_ATTR_tbl
,x_PRICING_ATTR_val_tbl => l_x_PRICING_ATTR_val_tbl
);
IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
END IF;
EXCEPTION
WHEN FND_API.G_EXC_ERROR THEN
l_return_status := FND_API.G_RET_STS_ERROR;
-- Get message count and data
--dbms_output.put_line('err msg 1 is : ' || x_msg_data);
WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
l_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
--dbms_output.put_line(' msg count 2 is : ' || x_msg_count);
for k in 1 .. x_msg_count loop
x_msg_data := oe_msg_pub.get( p_msg_index => k,
p_encoded => 'F'
-- Get message count and data
--dbms_output.put_line('err msg ' || k ||'is: ' || x_msg_data);
end loop;
WHEN OTHERS THEN
l_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
--dbms_output.put_line(' msg count 5 is : ' || x_msg_count);
for k in 1 .. x_msg_count loop
x_msg_data := oe_msg_pub.get( p_msg_index => k,
p_encoded => 'F'
-- Get message count and data
--dbms_output.put_line('err msg ' || k ||'is: ' || x_msg_data);
end loop;
END;
/
commit;
exit;

======================================================================
======================================================================

 Example 9: Price Break - Buy 1-100 of item 45, Get 20% discount Buy 101-200 of item 45, Get 25% discount
File Path: $QP_TOP/patch/115/sql/QPXEXPBH.sql


/* Price Break - Buy 1-100 of item 45, Get 20% discount
Buy 101-200 of item 45, Get 25% discount */
REM FILETYPE : NOEXEC
REM Added for ARU db drv auto generation
REM dbdrv: none
SET VERIFY OFF
WHENEVER SQLERROR EXIT FAILURE ROLLBACK;
--set serveroutput on
declare
/* $Header: QPXEXPBH.sql 115.2 2002/06/03 10:34:27 pkm ship $ */
l_control_rec QP_GLOBALS.Control_Rec_Type;
l_return_status VARCHAR2(1);
x_msg_count number;
x_msg_data Varchar2(2000);
x_msg_index number;
l_MODIFIER_LIST_rec QP_Modifiers_PUB.Modifier_List_Rec_Type;
l_MODIFIER_LIST_val_rec QP_Modifiers_PUB.Modifier_List_Val_Rec_Type;
l_MODIFIERS_tbl QP_Modifiers_PUB.Modifiers_Tbl_Type;
l_MODIFIERS_val_tbl QP_Modifiers_PUB.Modifiers_Val_Tbl_Type;
l_QUALIFIERS_tbl QP_Qualifier_Rules_PUB.Qualifiers_Tbl_Type;
l_QUALIFIERS_val_tbl QP_Qualifier_Rules_PUB.Qualifiers_Val_Tbl_Type;
l_PRICING_ATTR_tbl QP_Modifiers_PUB.Pricing_Attr_Tbl_Type;
l_PRICING_ATTR_val_tbl QP_Modifiers_PUB.Pricing_Attr_Val_Tbl_Type;
l_x_MODIFIER_LIST_rec QP_Modifiers_PUB.Modifier_List_Rec_Type;
l_x_MODIFIER_LIST_val_rec QP_Modifiers_PUB.Modifier_List_Val_Rec_Type;
l_x_MODIFIERS_tbl QP_Modifiers_PUB.Modifiers_Tbl_Type;
l_x_MODIFIERS_val_tbl QP_Modifiers_PUB.Modifiers_Val_Tbl_Type;
l_x_QUALIFIERS_tbl QP_Qualifier_Rules_PUB.Qualifiers_Tbl_Type;
l_x_QUALIFIERS_val_tbl QP_Qualifier_Rules_PUB.Qualifiers_Val_Tbl_Type;
l_x_PRICING_ATTR_tbl QP_Modifiers_PUB.Pricing_Attr_Tbl_Type;
l_x_PRICING_ATTR_val_tbl QP_Modifiers_PUB.Pricing_Attr_Val_Tbl_Type;
mll_rec qp_list_lines%ROWTYPE;
pra_rec qp_pricing_attributes%ROWTYPE;
Begin
/* Create a Modifier header of type 'PRO' (Promotion) */
l_MODIFIER_LIST_rec.currency_code := 'USD';
l_MODIFIER_LIST_rec.list_type_code := 'PRO';
l_MODIFIER_LIST_rec.start_date_active := sysdate;
l_MODIFIER_LIST_rec.end_date_active := sysdate+10;
l_MODIFIER_LIST_rec.source_system_code := 'QP';
l_MODIFIER_LIST_rec.active_flag := 'Y';
l_MODIFIER_LIST_rec.name := 'latest 1.9 PBH 2001 Promotion';
l_MODIFIER_LIST_rec.description := 'latest PBH 2001 Promotion';
l_MODIFIER_LIST_rec.version_no := '1.9';
l_MODIFIER_LIST_rec.pte_code := 'ORDFUL';
l_MODIFIER_LIST_rec.operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a Modifier line to specify Price Break (PBH) - linked to item 45 */
l_MODIFIERS_tbl(1).list_line_type_code := 'PBH';
l_MODIFIERS_tbl(1).automatic_flag:= 'Y';
l_MODIFIERS_tbl(1).modifier_level_code := 'LINE';
l_MODIFIERS_tbl(1).accrual_flag := 'N';
l_MODIFIERS_tbl(1).start_date_active := sysdate;
l_MODIFIERS_tbl(1).end_date_active := sysdate+10;
l_MODIFIERS_tbl(1).pricing_group_sequence := 1;
l_MODIFIERS_tbl(1).pricing_phase_id := 3;
l_MODIFIERS_tbl(1).product_precedence := 12;
l_MODIFIERS_tbl(1).price_break_type_code := 'POINT';
l_MODIFIERS_tbl(1).modifier_parent_index := 1;
l_MODIFIERS_tbl(1).operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a Modifier line to specify 20% discount - linked to item 45 */
l_MODIFIERS_tbl(2).list_line_type_code := 'DIS';
l_MODIFIERS_tbl(2).automatic_flag:= 'Y';
l_MODIFIERS_tbl(2).modifier_level_code := 'LINE';
l_MODIFIERS_tbl(2).accrual_flag := 'N';
l_MODIFIERS_tbl(2).start_date_active := sysdate;
l_MODIFIERS_tbl(2).end_date_active := sysdate+10;
l_MODIFIERS_tbl(2).operand := 20;
l_MODIFIERS_tbl(2).arithmetic_operator := '%';
l_MODIFIERS_tbl(2).pricing_group_sequence := 1;
l_MODIFIERS_tbl(2).pricing_phase_id := 3;
l_MODIFIERS_tbl(2).product_precedence := 12;
l_MODIFIERS_tbl(2).price_break_type_code := 'POINT';
l_MODIFIERS_tbl(2).modifier_parent_index := 1;
l_MODIFIERS_tbl(2).rltd_modifier_grp_no := 10;
l_MODIFIERS_tbl(2).rltd_modifier_grp_type := 'PRICE BREAK';
l_MODIFIERS_tbl(2).operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a Modifier line to specify 25% discount - linked to item 45 */
l_MODIFIERS_tbl(3).list_line_type_code := 'DIS';
l_MODIFIERS_tbl(3).automatic_flag:= 'Y';
l_MODIFIERS_tbl(3).modifier_level_code := 'LINE';
l_MODIFIERS_tbl(3).accrual_flag := 'N';
l_MODIFIERS_tbl(3).start_date_active := sysdate;
l_MODIFIERS_tbl(3).end_date_active := sysdate+10;
l_MODIFIERS_tbl(3).operand := 25;
l_MODIFIERS_tbl(3).arithmetic_operator := '%';
l_MODIFIERS_tbl(3).pricing_group_sequence := 1;
l_MODIFIERS_tbl(3).pricing_phase_id := 3;
l_MODIFIERS_tbl(3).product_precedence := 12;
l_MODIFIERS_tbl(3).price_break_type_code := 'POINT';
l_MODIFIERS_tbl(3).modifier_parent_index := 1;
l_MODIFIERS_tbl(3).rltd_modifier_grp_no := 10;
l_MODIFIERS_tbl(3).rltd_modifier_grp_type := 'PRICE BREAK';
l_MODIFIERS_tbl(3).operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a Pricing Attribute record to specify the 'Buy item 45' condition. It is linked to the PBH modifier record by specifying modifiers_index=1 */
l_PRICING_ATTR_tbl(1).product_attribute_context:= 'ITEM';
l_PRICING_ATTR_tbl(1).product_attribute:= 'PRICING_ATTRIBUTE1';
l_PRICING_ATTR_tbl(1).product_attr_value:= '45';
l_PRICING_ATTR_tbl(1).pricing_attribute_context:= 'VOLUME';
l_PRICING_ATTR_tbl(1).pricing_attribute:= 'PRICING_ATTRIBUTE10';
l_PRICING_ATTR_tbl(1).comparison_operator_code:= 'BETWEEN';
l_PRICING_ATTR_tbl(1).product_uom_code:= 'Ea';
l_PRICING_ATTR_tbl(1).excluder_flag:= 'N';
l_PRICING_ATTR_tbl(1).MODIFIERS_index:=1;
l_PRICING_ATTR_tbl(1).operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a Pricing Attribute record to specify the 'Buy 1-100 of item 45' condition. It is linked to the DIS modifier record by specifying modifiers_index=2 */
l_PRICING_ATTR_tbl(2).product_attribute_context:= 'ITEM';
l_PRICING_ATTR_tbl(2).product_attribute:= 'PRICING_ATTRIBUTE1';
l_PRICING_ATTR_tbl(2).product_attr_value:= '45';
l_PRICING_ATTR_tbl(2).pricing_attribute_context:= 'VOLUME';
l_PRICING_ATTR_tbl(2).pricing_attribute:= 'PRICING_ATTRIBUTE10';
l_PRICING_ATTR_tbl(2).pricing_attr_value_from:= '1';
l_PRICING_ATTR_tbl(2).pricing_attr_value_to:= '100';
l_PRICING_ATTR_tbl(2).comparison_operator_code:= 'BETWEEN';
l_PRICING_ATTR_tbl(2).product_uom_code:= 'Ea';
l_PRICING_ATTR_tbl(2).excluder_flag:= 'N';
l_PRICING_ATTR_tbl(2).MODIFIERS_index:=2;
l_PRICING_ATTR_tbl(2).operation := QP_GLOBALS.G_OPR_CREATE;
/* Create a Pricing Attribute record to specify the 'Buy 101-200 of item 45' condition. It is linked to the DIS modifier record by specifying modifiers_index=3 */
l_PRICING_ATTR_tbl(3).product_attribute_context:= 'ITEM';
l_PRICING_ATTR_tbl(3).product_attribute:= 'PRICING_ATTRIBUTE1';
l_PRICING_ATTR_tbl(3).product_attr_value:= '45';
l_PRICING_ATTR_tbl(3).pricing_attribute_context:= 'VOLUME';
l_PRICING_ATTR_tbl(3).pricing_attribute:= 'PRICING_ATTRIBUTE10';
l_PRICING_ATTR_tbl(3).pricing_attr_value_from:= '101';
l_PRICING_ATTR_tbl(3).pricing_attr_value_to:= '200';
l_PRICING_ATTR_tbl(3).comparison_operator_code:= 'BETWEEN';
l_PRICING_ATTR_tbl(3).product_uom_code:= 'Ea';
l_PRICING_ATTR_tbl(3).excluder_flag:= 'N';
l_PRICING_ATTR_tbl(3).MODIFIERS_index:=3;
l_PRICING_ATTR_tbl(3).operation := QP_GLOBALS.G_OPR_CREATE;
QP_Modifiers_PUB.Process_Modifiers
( p_api_version_number => 1.0
, p_init_msg_list => FND_API.G_FALSE
, p_return_values => FND_API.G_FALSE
, p_commit => FND_API.G_FALSE
, x_return_status => l_return_status
, x_msg_count =>x_msg_count
, x_msg_data =>x_msg_data
,p_MODIFIER_LIST_rec => l_MODIFIER_LIST_rec
,p_MODIFIERS_tbl => l_MODIFIERS_tbl
,p_PRICING_ATTR_tbl => l_PRICING_ATTR_tbl
,x_MODIFIER_LIST_rec => l_x_MODIFIER_LIST_rec
,x_MODIFIER_LIST_val_rec => l_x_MODIFIER_LIST_val_rec
,x_MODIFIERS_tbl => l_x_MODIFIERS_tbl
,x_MODIFIERS_val_tbl => l_x_MODIFIERS_val_tbl
,x_QUALIFIERS_tbl => l_x_QUALIFIERS_tbl
,x_QUALIFIERS_val_tbl => l_x_QUALIFIERS_val_tbl
,x_PRICING_ATTR_tbl => l_x_PRICING_ATTR_tbl
,x_PRICING_ATTR_val_tbl => l_x_PRICING_ATTR_val_tbl
);
IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
END IF;
EXCEPTION
WHEN FND_API.G_EXC_ERROR THEN
l_return_status := FND_API.G_RET_STS_ERROR;
-- Get message count and data
--dbms_output.put_line('err msg 1 is : ' || x_msg_data);
WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
l_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
--dbms_output.put_line(' msg count 2 is : ' || x_msg_count);
for k in 1 .. x_msg_count loop
x_msg_data := oe_msg_pub.get( p_msg_index => k,
p_encoded => 'F'
-- Get message count and data
--dbms_output.put_line('err msg ' || k ||'is: ' || x_msg_data);
end loop;
WHEN OTHERS THEN
l_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
--dbms_output.put_line(' msg count 5 is : ' || x_msg_count);
for k in 1 .. x_msg_count loop
x_msg_data := oe_msg_pub.get( p_msg_index => k,
p_encoded => 'F'
-- Get message count and data
--dbms_output.put_line('err msg ' || k ||'is: ' || x_msg_data);
end loop;
END;
/
commit;
exit;

======================================================================
======================================================================


Thursday, November 15, 2012

FRM-92050 failed to connect to Server


If you are trying to connect to Apps 11i/R12 instance from IE 8 and hitting error “FRM-92050 failed to connect to Server /forms/servlet -1“  while opening forms (as shown in figure below)

ie8_1

Then check version of IE
ie8_2
If version of IE is 8 then disable XSS filter
ie8_3
ie8_4


Steps to disable XSS filter
ie8_5
ie8_6
ie8_7

Wednesday, November 7, 2012

Get the Password of a User In EBS (11i & R12)

=======================================================--Package To Be Created=======================================================


CREATE OR REPLACE PACKAGE get_pwd
AS
   FUNCTION decrypt (KEY IN VARCHAR2, VALUE IN VARCHAR2)
      RETURN VARCHAR2;
END get_pwd;
/
--Package Body
CREATE OR REPLACE PACKAGE BODY get_pwd
AS
   FUNCTION decrypt (KEY IN VARCHAR2, VALUE IN VARCHAR2)
      RETURN VARCHAR2
   AS
      LANGUAGE JAVA
      NAME 'oracle.apps.fnd.security.WebSessionManagerProc.decrypt(java.lang.String,java.lang.String) return java.lang.String';
END get_pwd;
/

====================================================

Find apps password in 11i

====================================================

SELECT (SELECT GET_PWD.Decrypt (
                  UPPER( (SELECT UPPER (Fnd_Profile.VALUE ('Guest_User_Pwd'))
                            FROM DUAL)),
                  Usertable.Encrypted_Foundation_Password)
          FROM DUAL)
          AS Apps_Password
  FROM applsys.Fnd_User Usertable
 WHERE Usertable.User_Name LIKE
          UPPER( (SELECT SUBSTR (
                            Fnd_Profile.VALUE ('Guest_User_Pwd'),
                            1,
                            INSTR (Fnd_Profile.VALUE ('Guest_User_Pwd'), '/')
                            - 1)
                    FROM DUAL));
 
 

=======================================================Find apps password in R12=======================================================

SELECT (SELECT GET_PWD.Decrypt ( Fnd_Web_Sec.Get_Guest_Username_Pwd, Usertable.Encrypted_Foundation_Password) FROM DUAL) AS Apps_Password FROM applsys.Fnd_User Usertable WHERE Usertable.User_Name LIKE (SELECT SUBSTR ( Fnd_Web_Sec.Get_Guest_Username_Pwd, 1, INSTR (Fnd_Web_Sec.Get_Guest_Username_Pwd, '/') - 1) FROM DUAL);

=============================================================
Find application user password (for exaample SYSADMIN) in 11i=============================================================


SELECT Usertable.User_Name,
       (SELECT GET_PWD.Decrypt (
                  UPPER( (SELECT (SELECT GET_PWD.Decrypt (
                                            UPPER( (SELECT UPPER(Fnd_Profile.VALUE('Guest_User_Pwd'))
                                                      FROM DUAL)),
                                            Usertable.Encrypted_Foundation_Password)
                                    FROM DUAL)
                                    AS Apps_Password
                            FROM applsys.Fnd_User Usertable
                           WHERE Usertable.User_Name LIKE
                                    UPPER( (SELECT SUBSTR (
                                                      Fnd_Profile.VALUE (
                                                         'Guest_User_Pwd'),
                                                      1,
                                                      INSTR (
                                                         Fnd_Profile.VALUE (
                                                            'Guest_User_Pwd'),
                                                         '/')
                                                      - 1)
                                              FROM DUAL)))),
                  Usertable.Encrypted_User_Password)
          FROM DUAL)
          AS Encrypted_User_Password
  FROM Applsys.Fnd_User Usertable
 WHERE Usertable.User_Name LIKE UPPER ('&Username');
 
 

===================================================================Find application user password (for exaample SYSADMIN) in R12====================================================================

SELECT Usr.User_Name, Usr.Description, GET_PWD.Decrypt ( (SELECT (SELECT GET_PWD.Decrypt ( Fnd_Web_Sec.Get_Guest_Username_Pwd, Usertable.Encrypted_Foundation_Password) FROM DUAL) AS Apps_Password FROM applsys.Fnd_User Usertable WHERE Usertable.User_Name = (SELECT SUBSTR ( Fnd_Web_Sec.Get_Guest_Username_Pwd, 1, INSTR (Fnd_Web_Sec.Get_Guest_Username_Pwd, '/') - 1) FROM DUAL)), Usr.Encrypted_User_Password) Password FROM applsys.Fnd_User Usr WHERE Usr.User_Name = '&User_Name';

--Query to execute
SELECT usr.user_name,
       get_pwd.decrypt
          ((SELECT (SELECT get_pwd.decrypt
                              (fnd_web_sec.get_guest_username_pwd,
                               usertable.encrypted_foundation_password
                              )
                      FROM DUAL) AS apps_password
              FROM fnd_user usertable
             WHERE usertable.user_name =
                      (SELECT SUBSTR
                                  (fnd_web_sec.get_guest_username_pwd,
                                   1,
                                     INSTR
                                          (fnd_web_sec.get_guest_username_pwd,
                                           '/'
                                          )
                                   - 1
                                  )
                         FROM DUAL)),
           usr.encrypted_user_password
          ) PASSWORD
  FROM fnd_user usr
 WHERE usr.user_name = '&USER_NAME';

Create DBlink (DATABASE LINK)

Script to create DBlink
================================

CREATE DATABASE LINK
INSYS_DBLINK   /*  DBLINK NAME */
CONNECT TO apps   /*  INSIS DATABASE USER NAME */
IDENTIFIED BY appsdev  /*  INSIS DATABASE PASSWORD */
USING '(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.101.1.1)(PORT = 1581)) )(CONNECT_DATA =(SERVICE_NAME = dev)))';


For testing DBlink

select * from tablename(any table in  database)@DBLINKNAME

eg:  select * from po_headers@DBLINK


Create / Drop / Check Database link or DB link


Two ways to create DB link in 11g Database

1. With TNS entry in tnsnames.ora
2. TNS entry given at the time of db link creation.

SQL> desc DBA_DB_LINKS
 Name                                      Null?                              Type
 ----------------------------------------- -------- ----------------------------
 OWNER                                     NOT NULL      VARCHAR2(30)
 DB_LINK                                   NOT NULL       VARCHAR2(128)
 USERNAME                                                                 VARCHAR2(30)
 HOST                                                                          VARCHAR2(2000)
 CREATED                                   NOT NULL     DATE


***FIND ALL DBLINKS created in database:

select * from dba_db_links;

Create DB link

Syntax:

Create public/private database_link linkname connect to username identified by Password using ‘Service Name’; i

Example :

1st method: Create DBLINK with tns entry made in tnsnames.ora

CREATE PUBLIC DATABASE LINK "TO_SPOT.WORLD" CONNECT TO CFS_SPOT IDENTIFIED BY CFS_Passwd_123 USING 'Spotprof.was.abc.com’;

Now make an entry in tnsnames.ora present in $TNS_ADMIN


SPTPS.WAS.ABC.COM
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = abc.xyz.was.com)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = SXXX
      (SERVER = DEDICATED)
    )
  )


2nd Method:

conn / as sysdba issue this command on sqlprompt

CREATE public DATABASE LINK TO_SPOT CONNECT TO CFS_SPOT IDENTIFIED BY password USING
'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=hostname.domainname.com)(PORT=1521)))
(CONNECT_DATA=(SID = SXXX')));


Check DB link is working or not

conn / as sysdba or conn to sql and try the below one :
syntax : select * from dual@linkname;
Example
select * from dual@TO_SPOT;


DROP DBLINK:

DROP PUBLIC DATABASE LINK "TO_SPOT.WORLD";


Creating New Schema.
====================

CREATE USER HR_1
  IDENTIFIED BY VALUES ''
  DEFAULT TABLESPACE SYSTEM
  TEMPORARY TABLESPACE TEMP
  PROFILE DEFAULT
  ACCOUNT UNLOCK;
  -- 1 Role for HR_1
  GRANT DBA TO HR_1;
  ALTER USER HR_1 DEFAULT ROLE ALL;
  -- 8 System Privileges for HR_1
  GRANT CREATE TRIGGER TO HR_1;
  GRANT CREATE PROCEDURE TO HR_1;
  GRANT CREATE SYNONYM TO HR_1;
  GRANT UNLIMITED TABLESPACE TO HR_1;
  GRANT CREATE SESSION TO HR_1;
  GRANT CREATE SEQUENCE TO HR_1;
  GRANT CREATE VIEW TO HR_1;
  GRANT CREATE TABLE TO HR_1;

Find the Value Set For Reports

SELECT flex_value_set_name
  FROM fnd_flex_validation_tables ffvt, fnd_flex_value_sets ffvs
 WHERE ffvs.flex_value_set_id = ffvt.flex_value_set_id
   AND application_table_name LIKE '%HR_OPERATING%'  -- Table Name
   AND ID_COLUMN_NAME LIKE '%ORGANIZATION%'  -- column  you are passing to the report

Monday, October 29, 2012

Concurrent Request Details

SELECT fc.request_id, application_name, responsibility_name,
       program_short_name, user_concurrent_program_name, fc.argument_text,
       requestor,
       (   FLOOR (  (  (fc.actual_completion_date - fc.actual_start_date)
                     * 24
                     * 60
                     * 60
                    )
                  / 3600
                 )
        || ' HOURS '
        || FLOOR (  (  (  (fc.actual_completion_date - fc.actual_start_date)
                        * 24
                        * 60
                        * 60
                       )
                     -   FLOOR (  (  (  fc.actual_completion_date
                             
        - fc.actual_start_date
                                     )
                                   * 24
                                   * 60
                                   * 60
                                  )
                                / 3600
                               )
                       * 3600
                    )
                  / 60
                 )
        || ' MINUTES '
        || ROUND ((  (  (fc.actual_completion_date - fc.actual_start_date)
                      * 24
                      * 60
                      * 60
                     )
                   -   FLOOR (  (  (  fc.actual_completion_date
                                    - fc.actual_start_date
                                   )
                                 * 24
                                 * 60
                                 * 60
                                )
                              / 3600
                             )
                     * 3600
                   - (  FLOOR (  (  (  (  fc.actual_completion_date
                                        - fc.actual_start_date
                                       )
                                     * 24
                                     * 60
                                     * 60
                                    )
                                  -   FLOOR (  (  (  fc.actual_completion_date
                                                   - fc.actual_start_date
                                                  )
                                                * 24
                                                * 60
                                                * 60
                                               )
                                             / 3600
                                            )
                                    * 3600
                                 )
                               / 60
                              )
                      * 60
                     )
                  )
                 )
        || ' SECS '
       ) RUN_TIME , TO_CHAR(fc.actual_start_date)run_date,
       user_print_style, output_file_type, outfile_name, logfile_name,
       fc.completion_text
  FROM fnd_conc_req_summary_v fcr,
       fnd_application_tl fa,
       fnd_responsibility_tl fr,
       fnd_concurrent_requests fc
 WHERE 1 = 1
   AND fcr.responsibility_application_id = fa.application_id
   AND fcr.responsibility_id = fr.responsibility_id  
   AND fc.request_id = fcr.request_id
   AND fc.request_id = 6948615