135: End;
136:
137: procedure Adj_Debug (p_text IN VARCHAR2, p_level IN NUMBER:=5) As
138: --
139: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
140: --
141: Begin
142: If G_DEBUG Then
143: IF l_debug_level > 0 THEN
140: --
141: Begin
142: If G_DEBUG Then
143: IF l_debug_level > 0 THEN
144: oe_debug_pub.add( P_TEXT , P_LEVEL ) ;
145: END IF;
146: End If;
147: End Adj_Debug;
148:
172: instr(l_event_code1,',',1,rownum)-1 - instr(l_event_code1,',',1,rownum-1)))
173: FROM qp_event_phases
174: WHERE rownum < 7);
175: --
176: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
177: --
178: Begin
179:
180: For i in get_phases(p_pricing_event||',') Loop
179:
180: For i in get_phases(p_pricing_event||',') Loop
181:
182: IF l_debug_level > 0 THEN
183: oe_debug_pub.add( 'PRICING PHASE:'||I.PRICING_PHASE_ID ) ;
184: END IF;
185: IF l_debug_level > 0 THEN
186: oe_debug_pub.add( 'FREEZE OVERRIDE-NEW:'||I.POF ) ;
187: END IF;
182: IF l_debug_level > 0 THEN
183: oe_debug_pub.add( 'PRICING PHASE:'||I.PRICING_PHASE_ID ) ;
184: END IF;
185: IF l_debug_level > 0 THEN
186: oe_debug_pub.add( 'FREEZE OVERRIDE-NEW:'||I.POF ) ;
187: END IF;
188:
189: If (i.pof = 'Y' and i.pricing_phase_id <> 1) Then
190: IF l_debug_level > 0 THEN
187: END IF;
188:
189: If (i.pof = 'Y' and i.pricing_phase_id <> 1) Then
190: IF l_debug_level > 0 THEN
191: oe_debug_pub.add( 'FREEZE OVERRIDE IS Y' ) ;
192: END IF;
193: Return True;
194: End If;
195: End Loop;
216:
217: l_list_line_nos Varchar2(2000):=null;
218: l_separator Varchar2(1):='';
219: --
220: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
221: --
222: Begin
223: For i in List_Lines_no Loop
224: l_list_line_nos := i.name||':'||i.list_line_no||l_separator||l_list_line_nos;
237: IS
238: l_org_id NUMBER;
239: l_x_header_rec_oper VARCHAR2(30);
240: --
241: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
242: --
243: BEGIN
244:
245: l_org_id := OE_GLOBALS.G_ORG_ID;
264: RETURN;
265: END IF;
266:
267: IF l_debug_level > 0 THEN
268: oe_debug_pub.add( 'QUERYING HEADER'||P_HEADER_ID , 3 ) ;
269: END IF;
270: SELECT AGREEMENT_ID
271: , CUST_PO_NUMBER
272: , FREIGHT_TERMS_CODE
457: --AND ORDERED_QUANTITY <> 0 (--bug 3018537) commented for the FP bug 3335024
458: AND HEADER_ID = p_header_id;
459:
460: --
461: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
462: --
463: BEGIN
464:
465: IF l_debug_level > 0 THEN
462: --
463: BEGIN
464:
465: IF l_debug_level > 0 THEN
466: oe_debug_pub.add( 'IN QUERY LINES. GET_QP_STATUS:'||QP_UTIL.GET_QP_STATUS ) ;
467: END IF;
468: IF l_debug_level > 0 THEN
469: oe_debug_pub.add( 'G_RECURSION_MODE:'||OE_GLOBALS.G_RECURSION_MODE ) ;
470: END IF;
465: IF l_debug_level > 0 THEN
466: oe_debug_pub.add( 'IN QUERY LINES. GET_QP_STATUS:'||QP_UTIL.GET_QP_STATUS ) ;
467: END IF;
468: IF l_debug_level > 0 THEN
469: oe_debug_pub.add( 'G_RECURSION_MODE:'||OE_GLOBALS.G_RECURSION_MODE ) ;
470: END IF;
471: IF (QP_UTIL.GET_QP_STATUS = 'I' OR OE_GLOBALS.G_RECURSION_MODE <> FND_API.G_TRUE) THEN
472: OE_LINE_UTIL.query_rows(p_line_id=>p_line_id
473: , p_header_id => p_header_id
473: , p_header_id => p_header_id
474: , x_line_tbl => x_line_tbl
475: );
476: IF l_debug_level > 0 THEN
477: oe_debug_pub.add( ' X_LINE_TBL COUNT FROM OE_LINE_UTIL.QUERY_ROWS:'||X_LINE_TBL.COUNT ) ;
478: END IF;
479: --commented for the FP bug 3335024
480: /*
481: --bug 3289322, pl/sql error when count is zero
482: if (x_line_tbl.count > 0) then
483: --bug 3018537 begin
484: for i in x_line_tbl.first..x_line_tbl.last loop
485: if x_line_tbl(i).ordered_quantity = 0 then
486: oe_debug_pub.add(' Not passing line id:'||x_line_tbl(i).line_id||' to pricing engine -- 0 ord qty ');
487: x_line_tbl.delete(i);
488: end if;
489: end loop;
490: oe_debug_pub.add(' New x_line_tbl count:'||x_line_tbl.count);
486: oe_debug_pub.add(' Not passing line id:'||x_line_tbl(i).line_id||' to pricing engine -- 0 ord qty ');
487: x_line_tbl.delete(i);
488: end if;
489: end loop;
490: oe_debug_pub.add(' New x_line_tbl count:'||x_line_tbl.count);
491: end if;
492: --bug 3018537 end
493: */
494: RETURN;
499: l_entity := 'L';
500:
501: ELSIF nvl(p_header_id,FND_API.G_MISS_NUM) <> FND_API.G_MISS_NUM THEN
502: IF l_debug_level > 0 THEN
503: oe_debug_pub.add( 'SETTING ENTITY TO H' ) ;
504: END IF;
505: l_entity := 'H';
506:
507: END IF;
512: l_org_id := OE_GLOBALS.G_ORG_ID;
513: end if;
514:
515: IF l_debug_level > 0 THEN
516: oe_debug_pub.add( 'ENTERING OE_ORDER_PRICE_PVT.QUERY_LINES '||TO_CHAR ( L_ORG_ID ) , 1 ) ;
517: END IF;
518: IF l_debug_level > 0 THEN
519: oe_debug_pub.add( 'HEADER_ID:'||P_HEADER_ID||' LINE_ID:'||P_LINE_ID , 3 ) ;
520: END IF;
515: IF l_debug_level > 0 THEN
516: oe_debug_pub.add( 'ENTERING OE_ORDER_PRICE_PVT.QUERY_LINES '||TO_CHAR ( L_ORG_ID ) , 1 ) ;
517: END IF;
518: IF l_debug_level > 0 THEN
519: oe_debug_pub.add( 'HEADER_ID:'||P_HEADER_ID||' LINE_ID:'||P_LINE_ID , 3 ) ;
520: END IF;
521:
522:
523: -- Loop over fetched records
598:
599:
600: -- Return fetched table
601: IF l_debug_level > 0 THEN
602: oe_debug_pub.add( 'EXITING OE_ORDER_PRICE_PVT.QUERY_LINES' , 1 ) ;
603: END IF;
604:
605: EXCEPTION
606:
634: )
635: IS
636: l_line_tbl OE_Order_PUB.Line_Tbl_Type;
637: --
638: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
639: --
640: BEGIN
641: IF l_debug_level > 0 THEN
642: oe_debug_pub.add( ' QUERY_LINE' ) ;
638: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
639: --
640: BEGIN
641: IF l_debug_level > 0 THEN
642: oe_debug_pub.add( ' QUERY_LINE' ) ;
643: END IF;
644: Query_Lines
645: ( p_line_id => p_line_id
646: , p_header_id => Null
648: );
649:
650: x_line_rec := l_line_tbl(1);
651: IF l_debug_level > 0 THEN
652: oe_debug_pub.add( ' LEAVING QUERY_LINE' ) ;
653: END IF;
654: END Query_Line;
655:
656: Function Enforce_list_Price
657: return varchar2
658: is
659: l_enforce_price_flag varchar2(1);
660: --
661: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
662: --
663: begin
664: IF l_debug_level > 0 THEN
665: oe_debug_pub.add( 'ENTERING OE_ORDER_PRICE_PVT.ENFORCE_PRICE_LISTS_FLAG' , 1 ) ;
661: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
662: --
663: begin
664: IF l_debug_level > 0 THEN
665: oe_debug_pub.add( 'ENTERING OE_ORDER_PRICE_PVT.ENFORCE_PRICE_LISTS_FLAG' , 1 ) ;
666: END IF;
667: begin
668:
669: G_STMT_NO := 'Enforce_Price_lists_Flag#10';
715: end ;
716: end if;
717:
718: IF l_debug_level > 0 THEN
719: oe_debug_pub.add( 'EXITING OE_ORDER_PRICE_PVT.ENFORCE_PRICE_LISTS_FLAG' , 1 ) ;
720: END IF;
721:
722: Return l_enforce_price_flag;
723:
726: Function Get_Rounding_factor(p_list_header_id number)
727: return number
728: is
729: --
730: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
731: --
732: begin
733: IF l_debug_level > 0 THEN
734: oe_debug_pub.add( 'ENTERING GET_ROUNDING_FACTOR'||G_ROUNDING_FACTOR_REC.ROUNDING_FACTOR , 3 ) ;
730: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
731: --
732: begin
733: IF l_debug_level > 0 THEN
734: oe_debug_pub.add( 'ENTERING GET_ROUNDING_FACTOR'||G_ROUNDING_FACTOR_REC.ROUNDING_FACTOR , 3 ) ;
735: END IF;
736: If g_rounding_factor_rec.list_header_id = p_list_header_id then
737: Return g_rounding_factor_rec.rounding_factor;
738: Else
744: g_rounding_factor_rec.rounding_factor:= Null;
745: End If;
746:
747: IF l_debug_level > 0 THEN
748: oe_debug_pub.add( 'ROUNDING FACTOR'||G_ROUNDING_FACTOR_REC.ROUNDING_FACTOR , 3 ) ;
749: END IF;
750: Return g_rounding_factor_rec.rounding_factor;
751:
752: End if;
828: px_Req_line_attr_tbl QP_PREQ_GRP.LINE_ATTR_TBL_TYPE;
829: k NUMBER := px_line_attr_index;
830: l_attribute_type varchar2(30);
831: --
832: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
833: --
834: begin
835: G_STMT_NO := 'Append_asked_for#10';
836: IF l_debug_level > 0 THEN
833: --
834: begin
835: G_STMT_NO := 'Append_asked_for#10';
836: IF l_debug_level > 0 THEN
837: oe_debug_pub.add( 'ENTERING OE_ORDER_PRICE_PVT.APPEND_ASKED_FOR' , 1 ) ;
838: END IF;
839: for asked_for_rec in asked_for_cur loop
840: If asked_for_rec.flex_title = 'QP_ATTR_DEFNS_PRICING' then
841: if asked_for_rec.PRICING_ATTRIBUTE1 is not null then
1686: i := px_req_line_attr_tbl.first;
1687: while i is not null loop
1688: k:=k+1;
1689: IF l_debug_level > 0 THEN
1690: oe_debug_pub.add( 'POPULATE LINE ATTRS'||K||' '||PX_REQ_LINE_ATTR_TBL ( I ) .PRICING_CONTEXT , 3 ) ;
1691: END IF;
1692: IF (px_req_line_attr_tbl(I).PRICING_CONTEXT = QP_PREQ_GRP.G_ITEM_CONTEXT) THEN
1693: l_attribute_type := QP_PREQ_GRP.G_PRODUCT_TYPE;
1694: ELSIF (px_req_line_attr_tbl(I).PRICING_CONTEXT = 'MODLIST') THEN
1697: l_attribute_type := QP_PREQ_GRP.G_PRICING_TYPE;
1698: END IF;
1699: G_ATTR_LINE_INDEX_tbl(k) := p_line_index; --p_header_id + nvl(p_line_id,0);
1700: IF l_debug_level > 0 THEN
1701: oe_debug_pub.add( 'LINE_INDEX:'||G_ATTR_LINE_INDEX_TBL ( K ) ) ;
1702: END IF;
1703: G_ATTR_LINE_DETAIL_INDEX_tbl(k) := NULL;
1704: G_ATTR_ATTRIBUTE_LEVEL_tbl(k) := QP_PREQ_GRP.G_LINE_LEVEL;
1705: G_ATTR_VALIDATED_FLAG_tbl(k) := px_Req_line_attr_Tbl(i).Validated_Flag; --'N';
1734: i := px_req_line_attr_tbl.next(i);
1735: end loop;
1736: px_line_attr_index := k;
1737: IF l_debug_level > 0 THEN
1738: oe_debug_pub.add( 'EXITING OE_ORDER_PRICE_PVT.APPEND_ASKED_FOR' , 1 ) ;
1739: END IF;
1740:
1741: end Append_asked_for;
1742:
1766: l_rate NUMBER;
1767: --bug 3968023 end
1768:
1769: --
1770: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1771: --
1772: Begin
1773: G_STMT_NO := 'Get_the_parent_Line#10';
1774: IF l_debug_level > 0 THEN
1771: --
1772: Begin
1773: G_STMT_NO := 'Get_the_parent_Line#10';
1774: IF l_debug_level > 0 THEN
1775: oe_debug_pub.add( 'ENTERING OE_ORDER_PRICE_PVT.GET_THE_PARENT_LINE' , 1 ) ;
1776: END IF;
1777: line_Tbl_Index := px_Line_Tbl.First;
1778: While line_Tbl_Index is not null loop
1779: If px_Line_Tbl(line_Tbl_Index).line_Id = p_Reference_line_Id Then
1811: WHERE header_id = l_line_rec.header_id;
1812:
1813: IF l_debug_level > 0 THEN
1814:
1815: oe_debug_pub.add('pviprana: l_transactional_curr_code is ' || l_transactional_curr_code);
1816: oe_debug_pub.add('pviprana: l_set_of_books.currency_code' || l_set_of_books.currency_code);
1817: oe_debug_pub.add('pviprana: l_conversion_type_code' || l_conversion_type_code);
1818: oe_debug_pub.add('pviprana: l_conversion_rate_date ' || l_conversion_rate_date);
1819: oe_debug_pub.add('pviprana: l_conversion_rate' || l_conversion_rate);
1812:
1813: IF l_debug_level > 0 THEN
1814:
1815: oe_debug_pub.add('pviprana: l_transactional_curr_code is ' || l_transactional_curr_code);
1816: oe_debug_pub.add('pviprana: l_set_of_books.currency_code' || l_set_of_books.currency_code);
1817: oe_debug_pub.add('pviprana: l_conversion_type_code' || l_conversion_type_code);
1818: oe_debug_pub.add('pviprana: l_conversion_rate_date ' || l_conversion_rate_date);
1819: oe_debug_pub.add('pviprana: l_conversion_rate' || l_conversion_rate);
1820: END IF;
1813: IF l_debug_level > 0 THEN
1814:
1815: oe_debug_pub.add('pviprana: l_transactional_curr_code is ' || l_transactional_curr_code);
1816: oe_debug_pub.add('pviprana: l_set_of_books.currency_code' || l_set_of_books.currency_code);
1817: oe_debug_pub.add('pviprana: l_conversion_type_code' || l_conversion_type_code);
1818: oe_debug_pub.add('pviprana: l_conversion_rate_date ' || l_conversion_rate_date);
1819: oe_debug_pub.add('pviprana: l_conversion_rate' || l_conversion_rate);
1820: END IF;
1821:
1814:
1815: oe_debug_pub.add('pviprana: l_transactional_curr_code is ' || l_transactional_curr_code);
1816: oe_debug_pub.add('pviprana: l_set_of_books.currency_code' || l_set_of_books.currency_code);
1817: oe_debug_pub.add('pviprana: l_conversion_type_code' || l_conversion_type_code);
1818: oe_debug_pub.add('pviprana: l_conversion_rate_date ' || l_conversion_rate_date);
1819: oe_debug_pub.add('pviprana: l_conversion_rate' || l_conversion_rate);
1820: END IF;
1821:
1822: IF (nvl(l_transactional_curr_code, 'XXX') <> nvl(oe_order_pub.g_hdr.transactional_curr_code,'XXX')) THEN
1815: oe_debug_pub.add('pviprana: l_transactional_curr_code is ' || l_transactional_curr_code);
1816: oe_debug_pub.add('pviprana: l_set_of_books.currency_code' || l_set_of_books.currency_code);
1817: oe_debug_pub.add('pviprana: l_conversion_type_code' || l_conversion_type_code);
1818: oe_debug_pub.add('pviprana: l_conversion_rate_date ' || l_conversion_rate_date);
1819: oe_debug_pub.add('pviprana: l_conversion_rate' || l_conversion_rate);
1820: END IF;
1821:
1822: IF (nvl(l_transactional_curr_code, 'XXX') <> nvl(oe_order_pub.g_hdr.transactional_curr_code,'XXX')) THEN
1823: IF (nvl(l_transactional_curr_code, 'XXX') <> nvl(l_set_of_books.currency_code,'XXX') AND
1838: ELSE
1839:
1840: IF nvl(l_transactional_curr_code,'XXX') <> nvl(l_set_of_books.currency_code,'XXX') THEN
1841: IF l_debug_level > 0 THEN
1842: oe_debug_pub.add('pviprana: first conversion: conversion_type is '|| l_transactional_curr_code);
1843: END IF;
1844: gl_currency_api.convert_closest_amount
1845: ( x_from_currency => l_transactional_curr_code
1846: , x_to_currency => l_set_of_books.currency_code
1858: END IF;
1859:
1860: IF nvl(l_set_of_books.currency_code,'XXX') <> nvl(oe_order_pub.g_hdr.transactional_curr_code,'XXX') THEN
1861: IF l_debug_level > 0 THEN
1862: oe_debug_pub.add('pviprana: second conversion: conversion_type is '|| oe_order_pub.g_hdr.conversion_type_code);
1863: END IF;
1864: gl_currency_api.convert_closest_amount
1865: ( x_from_currency => l_set_of_books.currency_code
1866: , x_to_currency => oe_order_pub.g_hdr.transactional_curr_code
1877:
1878: END IF;
1879: px_Line_Tbl(line_Tbl_index).unit_list_price_per_pqty := px_Line_Tbl(line_Tbl_index).unit_list_price * px_Line_Tbl(line_Tbl_index).ordered_quantity / nvl(px_Line_Tbl(line_Tbl_index).pricing_quantity,px_Line_Tbl(line_Tbl_index).ordered_quantity);
1880: IF l_debug_level > 0 THEN
1881: oe_debug_pub.add('pviprana: unit_list_price_per_pqty '||px_Line_Tbl(line_Tbl_index).unit_list_price_per_pqty );
1882: END IF;
1883: END IF;
1884: END IF;
1885:
1888: Exception when No_Data_Found Then
1889: Null;
1890: WHEN OTHERS THEN
1891: IF l_debug_level > 0 THEN
1892: oe_debug_pub.add('pviprana: error while converting the parent lines unit_list_price to the service orders currency' );
1893: END IF;
1894: px_Line_Tbl(line_Tbl_index).unit_list_price := null;
1895: px_Line_Tbl(line_Tbl_index).unit_list_price_per_pqty := null;
1896:
1898: End If;
1899:
1900: BEGIN
1901: IF l_debug_level > 0 THEN
1902: oe_debug_pub.add( 'INSERT INTO RLTD LINES TBL FOR SERVICE' , 3 ) ;
1903: END IF;
1904:
1905: -- Added if condition for Bug 2604056
1906:
1923: ,x_status_text => l_status_text
1924: );
1925:
1926: IF l_status_code = FND_API.G_RET_STS_UNEXP_ERROR THEN
1927: oe_debug_pub.add('QP_PREQ_GRP.INSERT_RLTD_LINES2 has reported errors:'||SQLERRM);
1928: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1929: ELSIF l_status_code = FND_API.G_RET_STS_ERROR THEN
1930: oe_debug_pub.add('QP_PREQ_GRP.INSERT_RLTD_LINES2 has reported errors:'||SQLERRM);
1931: RAISE FND_API.G_EXC_ERROR;
1926: IF l_status_code = FND_API.G_RET_STS_UNEXP_ERROR THEN
1927: oe_debug_pub.add('QP_PREQ_GRP.INSERT_RLTD_LINES2 has reported errors:'||SQLERRM);
1928: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1929: ELSIF l_status_code = FND_API.G_RET_STS_ERROR THEN
1930: oe_debug_pub.add('QP_PREQ_GRP.INSERT_RLTD_LINES2 has reported errors:'||SQLERRM);
1931: RAISE FND_API.G_EXC_ERROR;
1932: END IF;
1933: ELSE --lower than 110510
1934: INSERT INTO QP_PREQ_RLTD_LINES_TMP
1954: End If;
1955: EXCEPTION
1956: WHEN OTHERS THEN
1957: IF l_debug_level > 0 THEN
1958: oe_debug_pub.add( 'ERROR INSERTING'||SQLERRM , 3 ) ;
1959: END IF;
1960: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1961: END;
1962: IF l_debug_level > 0 THEN
1959: END IF;
1960: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1961: END;
1962: IF l_debug_level > 0 THEN
1963: oe_debug_pub.add( 'EXITING OE_ORDER_PRICE_PVT.GET_THE_PARENT_LINE' , 1 ) ;
1964: END IF;
1965:
1966: End Get_the_parent_Line;
1967:
1984: adj2.line_id = p_line_id;
1985: l_prg_line_id NUMBER;
1986: l_rltd_price_adj_id NUMBER;
1987: --
1988: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1989: --
1990: Begin
1991: G_STMT_NO := 'Get_prg_Line#10';
1992: IF l_debug_level > 0 THEN
1989: --
1990: Begin
1991: G_STMT_NO := 'Get_prg_Line#10';
1992: IF l_debug_level > 0 THEN
1993: oe_debug_pub.add( 'ENTERING OE_ORDER_PRICE_PVT.GET_PRG_LINES'||P_LINE_ID , 1 ) ;
1994: END IF;
1995:
1996: for i in prg_lines loop
1997: IF l_debug_level > 0 THEN
1994: END IF;
1995:
1996: for i in prg_lines loop
1997: IF l_debug_level > 0 THEN
1998: oe_debug_pub.add( 'PRG LINE ID = ' || I.PRG_LINE_ID ) ;
1999: END IF;
2000: BEGIN
2001: Query_line(i.prg_line_Id,L_Line_Rec );
2002: line_Tbl_index := px_line_tbl.last + 1;
2011: End;
2012: End LOOP;
2013:
2014: IF l_debug_level > 0 THEN
2015: oe_debug_pub.add( 'EXITING OE_ORDER_PRICE_PVT.GET_PRG_LINES' , 1 ) ;
2016: END IF;
2017:
2018: End Get_prg_Lines;
2019:
2037: service_reference_type_code='ORDER'and
2038: header_id=p_header_id and
2039: original_list_price is NULL;
2040:
2041: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
2042: BEGIN
2043: IF l_debug_level > 0 THEN
2044: oe_debug_pub.add( 'ENTERING OE_ORDER_PRICE_PVT.GET_SERVICE_LINES'||P_LINE_ID , 1 ) ;
2045: END IF;
2040:
2041: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
2042: BEGIN
2043: IF l_debug_level > 0 THEN
2044: oe_debug_pub.add( 'ENTERING OE_ORDER_PRICE_PVT.GET_SERVICE_LINES'||P_LINE_ID , 1 ) ;
2045: END IF;
2046:
2047: FOR I in service_lines loop
2048: IF l_debug_level > 0 THEN
2045: END IF;
2046:
2047: FOR I in service_lines loop
2048: IF l_debug_level > 0 THEN
2049: oe_debug_pub.add( 'SERVICE LINE ID = ' || I.LINE_ID ) ;
2050: END IF;
2051: line_Tbl_Index := px_Line_Tbl.First;
2052:
2053: While line_Tbl_Index is not null loop
2080: select modified_from from oe_price_adjustments
2081: where line_id=px_line_rec.line_id
2082: and list_line_type_code='IUE';
2083: --
2084: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
2085: --
2086: begin
2087: IF l_debug_level > 0 THEN
2088: oe_debug_pub.add( 'ENTERING OE_ORDER_PRICE_PVT.GET_ITEM_FOR_IUE' , 1 ) ;
2084: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
2085: --
2086: begin
2087: IF l_debug_level > 0 THEN
2088: oe_debug_pub.add( 'ENTERING OE_ORDER_PRICE_PVT.GET_ITEM_FOR_IUE' , 1 ) ;
2089: END IF;
2090: For Adj_rec in Adj_cur loop
2091: -- There is an item upgrade for this line
2092: px_line_rec.inventory_item_id := to_number(Adj_rec.modified_from);
2107: Exit;
2108: End Loop;
2109:
2110: IF l_debug_level > 0 THEN
2111: oe_debug_pub.add( 'EXITING OE_ORDER_PRICE_PVT.GET_ITEM_FOR_IUE' , 1 ) ;
2112: END IF;
2113: end Get_item_for_iue;
2114:
2115:
2121: PROCEDURE Reset_All_Tbls
2122: AS
2123: l_routine VARCHAR2(240):='QP_PREQ_GRP.Reset_All_Tbls';
2124: --
2125: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
2126: --
2127: BEGIN
2128: G_LINE_INDEX_tbl.delete;
2129: G_LINE_TYPE_CODE_TBL.delete ;
2190: G_ADDED_PARENT_TBL.delete;
2191: EXCEPTION
2192: WHEN OTHERS THEN
2193: IF l_debug_level > 0 THEN
2194: oe_debug_pub.add( L_ROUTINE||': '||SQLERRM , 1 ) ;
2195: END IF;
2196: END reset_all_tbls;
2197:
2198: PROCEDURE UPDATE_GLOBAL(p_old_line_rec IN OE_ORDER_PUB.LINE_REC_TYPE,
2200: IS
2201: l_notify_index NUMBER;
2202: l_return_status VARCHAR2(1);
2203: l_line_rec OE_ORDER_PUB.LINE_REC_TYPE;
2204: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
2205: --
2206: BEGIN
2207: l_line_rec:= p_line_rec;
2208: --need to update global picture when line changes
2206: BEGIN
2207: l_line_rec:= p_line_rec;
2208: --need to update global picture when line changes
2209: IF l_debug_level > 0 THEN
2210: oe_debug_pub.add(' Calling update_global_picture to register line changes');
2211: END IF;
2212:
2213: l_notify_index := NULL;
2214:
2221: x_return_status => l_return_status);
2222:
2223:
2224: IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
2225: oe_debug_pub.add(' Update_global_price called from oe_order_price_pvt.populate_line_tbl reports errors');
2226: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2227: END IF;
2228:
2229: IF l_notify_index IS NOT NULL THEN
2227: END IF;
2228:
2229: IF l_notify_index IS NOT NULL THEN
2230: IF l_debug_level > 0 THEN
2231: oe_debug_pub.add(' Global index obtained is:'||l_notify_index);
2232: oe_debug_pub.add(' Global OLD_LINE USP BEFORE ASSIGNMENT:'||OE_ORDER_UTIL.g_old_line_tbl(l_notify_index).unit_selling_price);
2233: oe_debug_pub.add(' p_old_line_rec.usp:'||p_old_line_rec.unit_selling_price);
2234: oe_debug_pub.add(' new line rec.usp:'||l_line_rec.unit_selling_price);
2235: END IF;
2228:
2229: IF l_notify_index IS NOT NULL THEN
2230: IF l_debug_level > 0 THEN
2231: oe_debug_pub.add(' Global index obtained is:'||l_notify_index);
2232: oe_debug_pub.add(' Global OLD_LINE USP BEFORE ASSIGNMENT:'||OE_ORDER_UTIL.g_old_line_tbl(l_notify_index).unit_selling_price);
2233: oe_debug_pub.add(' p_old_line_rec.usp:'||p_old_line_rec.unit_selling_price);
2234: oe_debug_pub.add(' new line rec.usp:'||l_line_rec.unit_selling_price);
2235: END IF;
2236: --update Global Picture directly
2229: IF l_notify_index IS NOT NULL THEN
2230: IF l_debug_level > 0 THEN
2231: oe_debug_pub.add(' Global index obtained is:'||l_notify_index);
2232: oe_debug_pub.add(' Global OLD_LINE USP BEFORE ASSIGNMENT:'||OE_ORDER_UTIL.g_old_line_tbl(l_notify_index).unit_selling_price);
2233: oe_debug_pub.add(' p_old_line_rec.usp:'||p_old_line_rec.unit_selling_price);
2234: oe_debug_pub.add(' new line rec.usp:'||l_line_rec.unit_selling_price);
2235: END IF;
2236: --update Global Picture directly
2237: --OE_ORDER_UTIL.g_old_line_tbl(l_notify_index):= p_old_line_rec;
2230: IF l_debug_level > 0 THEN
2231: oe_debug_pub.add(' Global index obtained is:'||l_notify_index);
2232: oe_debug_pub.add(' Global OLD_LINE USP BEFORE ASSIGNMENT:'||OE_ORDER_UTIL.g_old_line_tbl(l_notify_index).unit_selling_price);
2233: oe_debug_pub.add(' p_old_line_rec.usp:'||p_old_line_rec.unit_selling_price);
2234: oe_debug_pub.add(' new line rec.usp:'||l_line_rec.unit_selling_price);
2235: END IF;
2236: --update Global Picture directly
2237: --OE_ORDER_UTIL.g_old_line_tbl(l_notify_index):= p_old_line_rec;
2238:
2266:
2267:
2268:
2269: IF l_debug_level > 0 THEN
2270: oe_debug_pub.add('Global picture OLD USP is:'||OE_ORDER_UTIL.G_OLD_LINE_TBL(L_NOTIFY_INDEX).UNIT_SELLING_PRICE);
2271: oe_debug_pub.add('Global picture NEW USP is:'||OE_ORDER_UTIL.G_LINE_TBL(L_NOTIFY_INDEX).UNIT_SELLING_PRICE) ;
2272: oe_debug_pub.add('Global picture NEW OPR is:'||OE_ORDER_UTIL.G_LINE_TBL(L_NOTIFY_INDEX).operation);
2273: oe_debug_pub.add('Global picture OLD QTY is:'||OE_ORDER_UTIL.G_OLD_LINE_TBL(L_NOTIFY_INDEX).ordered_quantity);
2274: oe_debug_pub.add('Global picture NEW QTY is:'||OE_ORDER_UTIL.G_LINE_TBL(L_NOTIFY_INDEX).ordered_quantity);
2267:
2268:
2269: IF l_debug_level > 0 THEN
2270: oe_debug_pub.add('Global picture OLD USP is:'||OE_ORDER_UTIL.G_OLD_LINE_TBL(L_NOTIFY_INDEX).UNIT_SELLING_PRICE);
2271: oe_debug_pub.add('Global picture NEW USP is:'||OE_ORDER_UTIL.G_LINE_TBL(L_NOTIFY_INDEX).UNIT_SELLING_PRICE) ;
2272: oe_debug_pub.add('Global picture NEW OPR is:'||OE_ORDER_UTIL.G_LINE_TBL(L_NOTIFY_INDEX).operation);
2273: oe_debug_pub.add('Global picture OLD QTY is:'||OE_ORDER_UTIL.G_OLD_LINE_TBL(L_NOTIFY_INDEX).ordered_quantity);
2274: oe_debug_pub.add('Global picture NEW QTY is:'||OE_ORDER_UTIL.G_LINE_TBL(L_NOTIFY_INDEX).ordered_quantity);
2275: END IF;
2268:
2269: IF l_debug_level > 0 THEN
2270: oe_debug_pub.add('Global picture OLD USP is:'||OE_ORDER_UTIL.G_OLD_LINE_TBL(L_NOTIFY_INDEX).UNIT_SELLING_PRICE);
2271: oe_debug_pub.add('Global picture NEW USP is:'||OE_ORDER_UTIL.G_LINE_TBL(L_NOTIFY_INDEX).UNIT_SELLING_PRICE) ;
2272: oe_debug_pub.add('Global picture NEW OPR is:'||OE_ORDER_UTIL.G_LINE_TBL(L_NOTIFY_INDEX).operation);
2273: oe_debug_pub.add('Global picture OLD QTY is:'||OE_ORDER_UTIL.G_OLD_LINE_TBL(L_NOTIFY_INDEX).ordered_quantity);
2274: oe_debug_pub.add('Global picture NEW QTY is:'||OE_ORDER_UTIL.G_LINE_TBL(L_NOTIFY_INDEX).ordered_quantity);
2275: END IF;
2276: END IF;
2269: IF l_debug_level > 0 THEN
2270: oe_debug_pub.add('Global picture OLD USP is:'||OE_ORDER_UTIL.G_OLD_LINE_TBL(L_NOTIFY_INDEX).UNIT_SELLING_PRICE);
2271: oe_debug_pub.add('Global picture NEW USP is:'||OE_ORDER_UTIL.G_LINE_TBL(L_NOTIFY_INDEX).UNIT_SELLING_PRICE) ;
2272: oe_debug_pub.add('Global picture NEW OPR is:'||OE_ORDER_UTIL.G_LINE_TBL(L_NOTIFY_INDEX).operation);
2273: oe_debug_pub.add('Global picture OLD QTY is:'||OE_ORDER_UTIL.G_OLD_LINE_TBL(L_NOTIFY_INDEX).ordered_quantity);
2274: oe_debug_pub.add('Global picture NEW QTY is:'||OE_ORDER_UTIL.G_LINE_TBL(L_NOTIFY_INDEX).ordered_quantity);
2275: END IF;
2276: END IF;
2277:
2270: oe_debug_pub.add('Global picture OLD USP is:'||OE_ORDER_UTIL.G_OLD_LINE_TBL(L_NOTIFY_INDEX).UNIT_SELLING_PRICE);
2271: oe_debug_pub.add('Global picture NEW USP is:'||OE_ORDER_UTIL.G_LINE_TBL(L_NOTIFY_INDEX).UNIT_SELLING_PRICE) ;
2272: oe_debug_pub.add('Global picture NEW OPR is:'||OE_ORDER_UTIL.G_LINE_TBL(L_NOTIFY_INDEX).operation);
2273: oe_debug_pub.add('Global picture OLD QTY is:'||OE_ORDER_UTIL.G_OLD_LINE_TBL(L_NOTIFY_INDEX).ordered_quantity);
2274: oe_debug_pub.add('Global picture NEW QTY is:'||OE_ORDER_UTIL.G_LINE_TBL(L_NOTIFY_INDEX).ordered_quantity);
2275: END IF;
2276: END IF;
2277:
2278: END;
2289: l_check_sec BOOLEAN := FALSE;
2290: l_line_index NUMBER;
2291: l_line_rec OE_ORDER_PUB.LINE_REC_TYPE;
2292: --
2293: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
2294: --
2295: l_validate_desc_flex varchar2(1) := 'N';
2296: Begin
2297:
2295: l_validate_desc_flex varchar2(1) := 'N';
2296: Begin
2297:
2298: IF l_debug_level > 0 THEN
2299: oe_debug_pub.add( 'INSIDE POPULATE_LINE_TBL:'||PX_LINE_TBL.COUNT , 3 ) ;
2300: END IF;
2301: l_line_index := px_line_tbl.first;
2302: while l_line_index is not null loop
2303: l_line_rec := px_line_tbl(l_line_index);
2300: END IF;
2301: l_line_index := px_line_tbl.first;
2302: while l_line_index is not null loop
2303: l_line_rec := px_line_tbl(l_line_index);
2304: oe_debug_pub.add('Ord Qty:'||l_line_rec.ordered_quantity, 3 ) ;
2305: if l_line_rec.ordered_quantity <> 0 then --bug 2823498
2306: BEGIN
2307: select /*+ INDEX(lines qp_preq_lines_tmp_n1) */
2308: nvl(lines.order_uom_selling_price, lines.ADJUSTED_UNIT_PRICE * nvl(lines.priced_quantity,l_line_rec.ordered_quantity)/l_line_rec.ordered_quantity)
2337: (QP_PREQ_GRP.G_STATUS_GSA_VIOLATION,
2338: QP_PREQ_GRP.G_STATUS_UPDATED);
2339:
2340: IF l_debug_level > 0 THEN
2341: oe_debug_pub.add( 'UNIT_SELLING_PRICE:'||L_LINE_REC.UNIT_SELLING_PRICE||' FOR LINE:'||L_LINE_REC.LINE_ID , 3 ) ;
2342: oe_debug_pub.add(' QTY:'||l_line_rec.ordered_quantity,3);
2343: oe_debug_pub.add( 'SCHEDULE_DATE'||L_LINE_REC.SCHEDULE_SHIP_DATE||':'||L_LINE_REC.SCHEDULE_ARRIVAL_DATE ) ;
2344: oe_debug_pub.add('New price list id : ' ||l_line_rec.price_list_id);
2345: oe_debug_pub.add('Old price list id : ' ||px_line_tbl(l_line_index).price_list_id);
2338: QP_PREQ_GRP.G_STATUS_UPDATED);
2339:
2340: IF l_debug_level > 0 THEN
2341: oe_debug_pub.add( 'UNIT_SELLING_PRICE:'||L_LINE_REC.UNIT_SELLING_PRICE||' FOR LINE:'||L_LINE_REC.LINE_ID , 3 ) ;
2342: oe_debug_pub.add(' QTY:'||l_line_rec.ordered_quantity,3);
2343: oe_debug_pub.add( 'SCHEDULE_DATE'||L_LINE_REC.SCHEDULE_SHIP_DATE||':'||L_LINE_REC.SCHEDULE_ARRIVAL_DATE ) ;
2344: oe_debug_pub.add('New price list id : ' ||l_line_rec.price_list_id);
2345: oe_debug_pub.add('Old price list id : ' ||px_line_tbl(l_line_index).price_list_id);
2346: END IF;
2339:
2340: IF l_debug_level > 0 THEN
2341: oe_debug_pub.add( 'UNIT_SELLING_PRICE:'||L_LINE_REC.UNIT_SELLING_PRICE||' FOR LINE:'||L_LINE_REC.LINE_ID , 3 ) ;
2342: oe_debug_pub.add(' QTY:'||l_line_rec.ordered_quantity,3);
2343: oe_debug_pub.add( 'SCHEDULE_DATE'||L_LINE_REC.SCHEDULE_SHIP_DATE||':'||L_LINE_REC.SCHEDULE_ARRIVAL_DATE ) ;
2344: oe_debug_pub.add('New price list id : ' ||l_line_rec.price_list_id);
2345: oe_debug_pub.add('Old price list id : ' ||px_line_tbl(l_line_index).price_list_id);
2346: END IF;
2347:
2340: IF l_debug_level > 0 THEN
2341: oe_debug_pub.add( 'UNIT_SELLING_PRICE:'||L_LINE_REC.UNIT_SELLING_PRICE||' FOR LINE:'||L_LINE_REC.LINE_ID , 3 ) ;
2342: oe_debug_pub.add(' QTY:'||l_line_rec.ordered_quantity,3);
2343: oe_debug_pub.add( 'SCHEDULE_DATE'||L_LINE_REC.SCHEDULE_SHIP_DATE||':'||L_LINE_REC.SCHEDULE_ARRIVAL_DATE ) ;
2344: oe_debug_pub.add('New price list id : ' ||l_line_rec.price_list_id);
2345: oe_debug_pub.add('Old price list id : ' ||px_line_tbl(l_line_index).price_list_id);
2346: END IF;
2347:
2348: --bug 3702538
2341: oe_debug_pub.add( 'UNIT_SELLING_PRICE:'||L_LINE_REC.UNIT_SELLING_PRICE||' FOR LINE:'||L_LINE_REC.LINE_ID , 3 ) ;
2342: oe_debug_pub.add(' QTY:'||l_line_rec.ordered_quantity,3);
2343: oe_debug_pub.add( 'SCHEDULE_DATE'||L_LINE_REC.SCHEDULE_SHIP_DATE||':'||L_LINE_REC.SCHEDULE_ARRIVAL_DATE ) ;
2344: oe_debug_pub.add('New price list id : ' ||l_line_rec.price_list_id);
2345: oe_debug_pub.add('Old price list id : ' ||px_line_tbl(l_line_index).price_list_id);
2346: END IF;
2347:
2348: --bug 3702538
2349: If nvl(l_line_rec.price_list_id,-9999) <> nvl(px_line_tbl(l_line_index).price_list_id,-9999) THEN
2356:
2357: EXCEPTION
2358: WHEN NO_DATA_FOUND THEN
2359: IF l_debug_level > 0 THEN
2360: oe_debug_pub.add( 'LINE '||L_LINE_REC.LINE_ID||' DID NOT GET NEW PRICE' ) ;
2361: END IF;
2362: END;
2363:
2364: --UPDATE_GLOBAL(p_old_line_rec=>px_line_tbl(l_line_index),p_line_rec=>l_line_rec);
2384:
2385: OE_GLOBALS.G_PRICING_RECURSION := 'Y';
2386:
2387: IF l_debug_level > 0 THEN
2388: oe_debug_pub.add( 'validate desc flex:'||OE_GLOBALS.g_validate_desc_flex) ;
2389: END IF;
2390: l_validate_desc_flex := OE_GLOBALS.g_validate_desc_flex;
2391: OE_GLOBALS.g_validate_desc_flex := 'N';
2392: OE_Order_Pvt.Lines
2402: RAISE FND_API.G_EXC_ERROR;
2403: END IF;
2404: OE_GLOBALS.g_validate_desc_flex := l_validate_desc_flex;
2405: IF l_debug_level > 0 THEN
2406: oe_debug_pub.add( 'reset validate desc flex:'||OE_GLOBALS.g_validate_desc_flex) ;
2407: END IF;
2408: OE_GLOBALS.G_PRICING_RECURSION := 'N';
2409: END IF;
2410: --bug 3702538
2420: l_old_line_rec OE_ORDER_PUB.LINE_REC_TYPE;
2421: l_sec_result varchar2(1);
2422: l_return_status varchar2(1);
2423: --
2424: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
2425: --
2426: l_old_change_reason varchar2(30);
2427: l_old_change_comments varchar2(2000);
2428: Begin
2426: l_old_change_reason varchar2(30);
2427: l_old_change_comments varchar2(2000);
2428: Begin
2429: IF l_debug_level > 0 THEN
2430: oe_debug_pub.add( 'INSIDE SECURITY_AND_GLOBAL_PICTURE' , 3 ) ;
2431: END IF;
2432:
2433: l_line_index := px_line_tbl.first;
2434: while l_line_index is not null loop
2434: while l_line_index is not null loop
2435: l_line_rec := px_line_tbl(l_line_index);
2436: l_old_line_rec := l_line_rec;
2437: IF l_debug_level > 0 THEN
2438: oe_debug_pub.add( 'LINE ID'||L_LINE_REC.LINE_ID ) ;
2439: END IF;
2440: -- bug 4866684 setting the msg context
2441: OE_MSG_PUB.set_msg_context
2442: ( p_entity_code => 'LINE'
2488: OR l_line_rec.operation= FND_API.G_MISS_CHAR) THEN
2489: l_line_rec.operation := OE_GLOBALS.G_OPR_UPDATE;
2490: END IF;
2491: IF l_debug_level > 0 THEN
2492: oe_debug_pub.add( 'LINE PRICE'||L_LINE_REC.UNIT_SELLING_PRICE||L_LINE_REC.OPERATION||' '||L_OLD_LINE_REC.OPERATION , 3 ) ;
2493: END IF;
2494:
2495: --IF (NOT OE_GLOBALS.G_HEADER_CREATED ) THEN
2496: IF l_debug_level > 0 THEN
2493: END IF;
2494:
2495: --IF (NOT OE_GLOBALS.G_HEADER_CREATED ) THEN
2496: IF l_debug_level > 0 THEN
2497: oe_debug_pub.add(' Checking Security');
2498: END IF;
2499:
2500: --bug 2823794, the security api doesn't like delete operation.
2501: --it will raise error if a delete operation is passed.
2539: RAISE FND_API.G_EXC_ERROR;
2540: END IF;
2541:
2542: IF l_debug_level > 0 THEN
2543: oe_debug_pub.add( 'AFTER CHECK_SECURITY'||L_SEC_RESULT ) ;
2544: oe_debug_Pub.add( 'BEFORE UPDATE GLOBAL');
2545: END IF;
2546:
2547: IF p_write_to_db THEN
2540: END IF;
2541:
2542: IF l_debug_level > 0 THEN
2543: oe_debug_pub.add( 'AFTER CHECK_SECURITY'||L_SEC_RESULT ) ;
2544: oe_debug_Pub.add( 'BEFORE UPDATE GLOBAL');
2545: END IF;
2546:
2547: IF p_write_to_db THEN
2548: UPDATE_GLOBAL(p_old_line_rec=>l_old_line_rec,p_line_rec=>l_line_rec);
2548: UPDATE_GLOBAL(p_old_line_rec=>l_old_line_rec,p_line_rec=>l_line_rec);
2549: END IF;
2550:
2551: IF l_debug_level > 0 THEN
2552: oe_debug_pub.add(' AFTER UPDATE GLOBAL');
2553: oe_debug_pub.add('old SP :'||l_old_line_rec.unit_selling_price);
2554: oe_debug_pub.add('new SP :'||l_line_rec.unit_selling_price);
2555: oe_debug_pub.add('order_source_id:'||l_line_rec.order_source_id);
2556: oe_debug_pub.add('xml_transaction_type_code:'||l_line_rec.xml_transaction_type_code);
2549: END IF;
2550:
2551: IF l_debug_level > 0 THEN
2552: oe_debug_pub.add(' AFTER UPDATE GLOBAL');
2553: oe_debug_pub.add('old SP :'||l_old_line_rec.unit_selling_price);
2554: oe_debug_pub.add('new SP :'||l_line_rec.unit_selling_price);
2555: oe_debug_pub.add('order_source_id:'||l_line_rec.order_source_id);
2556: oe_debug_pub.add('xml_transaction_type_code:'||l_line_rec.xml_transaction_type_code);
2557: END IF;
2550:
2551: IF l_debug_level > 0 THEN
2552: oe_debug_pub.add(' AFTER UPDATE GLOBAL');
2553: oe_debug_pub.add('old SP :'||l_old_line_rec.unit_selling_price);
2554: oe_debug_pub.add('new SP :'||l_line_rec.unit_selling_price);
2555: oe_debug_pub.add('order_source_id:'||l_line_rec.order_source_id);
2556: oe_debug_pub.add('xml_transaction_type_code:'||l_line_rec.xml_transaction_type_code);
2557: END IF;
2558:
2551: IF l_debug_level > 0 THEN
2552: oe_debug_pub.add(' AFTER UPDATE GLOBAL');
2553: oe_debug_pub.add('old SP :'||l_old_line_rec.unit_selling_price);
2554: oe_debug_pub.add('new SP :'||l_line_rec.unit_selling_price);
2555: oe_debug_pub.add('order_source_id:'||l_line_rec.order_source_id);
2556: oe_debug_pub.add('xml_transaction_type_code:'||l_line_rec.xml_transaction_type_code);
2557: END IF;
2558:
2559: -- Moved to OE_ACKNOWLEDGMENT_PUB as part of 3417899 and 3412458
2552: oe_debug_pub.add(' AFTER UPDATE GLOBAL');
2553: oe_debug_pub.add('old SP :'||l_old_line_rec.unit_selling_price);
2554: oe_debug_pub.add('new SP :'||l_line_rec.unit_selling_price);
2555: oe_debug_pub.add('order_source_id:'||l_line_rec.order_source_id);
2556: oe_debug_pub.add('xml_transaction_type_code:'||l_line_rec.xml_transaction_type_code);
2557: END IF;
2558:
2559: -- Moved to OE_ACKNOWLEDGMENT_PUB as part of 3417899 and 3412458
2560: /* IF l_line_rec.unit_selling_price <> l_old_line_rec.unit_selling_price
2564: AND nvl(l_line_rec.xml_transaction_type_code, OE_Acknowledgment_Pub.G_TRANSACTION_CSO) = OE_Acknowledgment_Pub.G_TRANSACTION_CSO
2565: AND nvl(l_line_rec.booked_flag, 'X') = 'Y'
2566: AND l_line_rec.ordered_quantity <> 0 THEN
2567: IF l_debug_level > 0 THEN
2568: oe_debug_pub.add( 'calling OE_Acknowlegment_PUB.apply_3a7_hold', 2 ) ;
2569: END IF;
2570: OE_Acknowledgment_PUB.Apply_3A7_Hold(
2571: p_header_id => l_line_rec.header_id
2572: , p_line_id => l_line_rec.line_id
2572: , p_line_id => l_line_rec.line_id
2573: , p_sold_to_org_id => l_line_rec.sold_to_org_id
2574: , x_return_status => l_return_status);
2575: IF l_debug_level > 0 THEN
2576: oe_debug_pub.add( 'Return status after call to apply_3a7_hold:' || l_return_status, 2 ) ;
2577: END IF;
2578: IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2579: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2580: ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
2585:
2586: EXCEPTION
2587: WHEN NO_DATA_FOUND THEN
2588: IF l_debug_level > 0 THEN
2589: oe_debug_pub.add( 'LINE '||L_LINE_REC.LINE_ID||' DID NOT GET NEW PRICE' ) ;
2590: END IF;
2591: END;
2592:
2593: l_line_index := px_line_tbl.next(l_line_index);
2593: l_line_index := px_line_tbl.next(l_line_index);
2594: END LOOP;
2595:
2596: IF l_debug_level > 0 THEN
2597: oe_debug_pub.add('Leaving SERURITY_AND_GLOBAL_PICTURE');
2598: END IF;
2599:
2600: END SECURITY_AND_GLOBAL_PICTURE;
2601:
2631: WHERE LINE_TYPE_CODE='LINE'
2632: AND PROCESS_STATUS <> 'NOT_VALID'
2633: AND PRICING_STATUS_CODE = (QP_PREQ_GRP.G_STATUS_UPDATED);
2634: --
2635: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
2636: --
2637: --these variables are introduced for bug 3021992
2638: l_mod_lineid NUMBER;
2639: l_line_num VARCHAR2(10);
2638: l_mod_lineid NUMBER;
2639: l_line_num VARCHAR2(10);
2640: BEGIN
2641: IF l_debug_level > 0 THEN
2642: oe_debug_pub.add( 'GSA ENABLED?'||L_GSA_ENABLED_FLAG||' ACTION:'||L_GSA_VIOLATION_ACTION ) ;
2643: END IF;
2644: IF (l_GSA_Enabled_Flag = 'Y') THEN
2645:
2646: FOR i IN gsa_violators LOOP
2644: IF (l_GSA_Enabled_Flag = 'Y') THEN
2645:
2646: FOR i IN gsa_violators LOOP
2647: IF l_debug_level > 0 THEN
2648: oe_debug_pub.add( 'GSA VIOLATION LINE:'||I.LINE_ID , 3 ) ;
2649: END IF;
2650: l_mod_lineid := MOD(i.line_id,2147483647) ;
2651: IF l_gsa_violation_action = 'WARNING' THEN
2652:
2688: --for bug 2028480 Begin
2689: --check if hold released earlier for this line , if so, do not go
2690: --thru the holds logic
2691: IF l_debug_level > 0 THEN
2692: oe_debug_pub.add( 'HOLD ID :'||L_HOLD_SOURCE_REC.HOLD_ID ) ;
2693: END IF;
2694: Begin
2695: --changed select below to fix bug 3039915
2696: select 'Y' into l_gsa_released from
2705: when others then
2706: l_gsa_released := 'N';
2707: end;
2708: IF l_debug_level > 0 THEN
2709: oe_debug_pub.add( 'GSA RELEASED VALUE :'||L_GSA_RELEASED ) ;
2710: END IF;
2711: --for bug 2028480 end
2712: if l_gsa_released = 'N' then --for bug 2028480
2713: -- check if line already on gsa hold, place hold if not
2723: );
2724:
2725: If l_x_result_out = FND_API.G_FALSE then
2726: IF l_debug_level > 0 THEN
2727: oe_debug_pub.add( 'HOLD LINE WITH HEADER_ID:'||L_HEADER_ID||' LINE_ID: '||I.LINE_ID , 1 ) ;
2728: END IF;
2729: OE_HOLDS_PUB.Apply_Holds(
2730: p_api_version => 1.0
2731: ,p_hold_source_rec => l_hold_source_rec
2759:
2760: IF (l_gsa_violation_action = 'ERROR') THEN
2761: FOR i in updated_lines LOOP
2762: IF l_debug_level > 0 THEN
2763: oe_debug_pub.add( 'UPDATING LINE:'||I.LINE_ID||' RELEASING HOLD IF ANY' , 3 ) ;
2764: END IF;
2765: -- release hold if there is one
2766:
2767: If l_hold_source_rec.hold_id is null or
2797: END IF;
2798:
2799: If l_x_result_out = FND_API.G_TRUE then
2800: IF l_debug_level > 0 THEN
2801: oe_debug_pub.add( 'RELEASING GSA_HOLD ON LINE'||I.LINE_ID , 3 ) ;
2802: END IF;
2803: -- Hold is found , Release the hold.
2804:
2805: G_STMT_NO := 'Gsa_Check#20.35';
2820: );
2821:
2822: IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2823: IF l_debug_level > 0 THEN
2824: oe_debug_pub.add( 'ERROR WHILE RELEASING GSA HOLD' ) ;
2825: END IF;
2826: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2827: ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
2828: IF l_debug_level > 0 THEN
2825: END IF;
2826: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2827: ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
2828: IF l_debug_level > 0 THEN
2829: oe_debug_pub.add( 'ERROR WHILE RELEASING GSA HOLD' ) ;
2830: END IF;
2831: RAISE FND_API.G_EXC_ERROR;
2832: END IF;
2833: End if; -- Release Hold
2842: px_header_rec IN OE_ORDER_PUB.HEADER_REC_TYPE
2843: )
2844: IS
2845: --
2846: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
2847: --
2848: BEGIN
2849: NULL;
2850: /*
2849: NULL;
2850: /*
2851: IF (px_header_rec.price_request_code IS NULL)
2852: THEN
2853: oe_debug_pub.add('update order header with price_request_code');
2854:
2855: update oe_order_headers
2856: set price_request_code
2857: = (select price_request_code
2857: = (select price_request_code
2858: from qp_preq_lines_tmp
2859: where line_type_code='ORDER'
2860: and line_id=px_header_rec.header_id);
2861: oe_debug_pub.add('done updating header');
2862: END IF;
2863: */
2864: EXCEPTION
2865: WHEN NO_DATA_FOUND THEN
2926: AND l.ordered_quantity <> 0 -- bug 3958480
2927: AND l.line_id = lines.line_id;
2928:
2929: --
2930: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
2931: --
2932: l_notify_index NUMBER:=NULL;
2933: --bug 4332307
2934: l_header_id Number;
2978: when no_data_found then
2979: l_tax_event_code := 0;
2980: when others then
2981: IF l_debug_level > 0 THEN
2982: oe_debug_pub.add( 'REN: FAILED WHILE QUERY UP TAX_EVENT' ) ;
2983: END IF;
2984: RAISE;
2985:
2986: END;
2984: RAISE;
2985:
2986: END;
2987: IF l_debug_level > 0 THEN
2988: oe_debug_pub.add( 'TAX EVENT CODE'||L_TAX_EVENT_CODE ) ;
2989: END IF;
2990:
2991: for update_line in updated_lines loop
2992: IF l_debug_level > 0 THEN
2989: END IF;
2990:
2991: for update_line in updated_lines loop
2992: IF l_debug_level > 0 THEN
2993: oe_debug_pub.add( 'LOG REQUEST FOR UPDATED LINE '||UPDATE_LINE.LINE_ID ) ;
2994: oe_debug_pub.add('adjusted_unit_price : '||update_line.adjusted_unit_price);
2995: oe_debug_pub.add('order_uom_selling_price : '||update_line.ousp);
2996: oe_debug_pub.add('unit_selling_price_per_pqty : '||update_line.unit_selling_price_per_pqty);
2997: oe_debug_pub.add('unit_selling_price : '||update_line.usp);
2990:
2991: for update_line in updated_lines loop
2992: IF l_debug_level > 0 THEN
2993: oe_debug_pub.add( 'LOG REQUEST FOR UPDATED LINE '||UPDATE_LINE.LINE_ID ) ;
2994: oe_debug_pub.add('adjusted_unit_price : '||update_line.adjusted_unit_price);
2995: oe_debug_pub.add('order_uom_selling_price : '||update_line.ousp);
2996: oe_debug_pub.add('unit_selling_price_per_pqty : '||update_line.unit_selling_price_per_pqty);
2997: oe_debug_pub.add('unit_selling_price : '||update_line.usp);
2998: END IF;
2991: for update_line in updated_lines loop
2992: IF l_debug_level > 0 THEN
2993: oe_debug_pub.add( 'LOG REQUEST FOR UPDATED LINE '||UPDATE_LINE.LINE_ID ) ;
2994: oe_debug_pub.add('adjusted_unit_price : '||update_line.adjusted_unit_price);
2995: oe_debug_pub.add('order_uom_selling_price : '||update_line.ousp);
2996: oe_debug_pub.add('unit_selling_price_per_pqty : '||update_line.unit_selling_price_per_pqty);
2997: oe_debug_pub.add('unit_selling_price : '||update_line.usp);
2998: END IF;
2999: -- Delayed Requests to be logged if selling price change
2992: IF l_debug_level > 0 THEN
2993: oe_debug_pub.add( 'LOG REQUEST FOR UPDATED LINE '||UPDATE_LINE.LINE_ID ) ;
2994: oe_debug_pub.add('adjusted_unit_price : '||update_line.adjusted_unit_price);
2995: oe_debug_pub.add('order_uom_selling_price : '||update_line.ousp);
2996: oe_debug_pub.add('unit_selling_price_per_pqty : '||update_line.unit_selling_price_per_pqty);
2997: oe_debug_pub.add('unit_selling_price : '||update_line.usp);
2998: END IF;
2999: -- Delayed Requests to be logged if selling price change
3000: -- Tax, Verify_Payment, Commitment
2993: oe_debug_pub.add( 'LOG REQUEST FOR UPDATED LINE '||UPDATE_LINE.LINE_ID ) ;
2994: oe_debug_pub.add('adjusted_unit_price : '||update_line.adjusted_unit_price);
2995: oe_debug_pub.add('order_uom_selling_price : '||update_line.ousp);
2996: oe_debug_pub.add('unit_selling_price_per_pqty : '||update_line.unit_selling_price_per_pqty);
2997: oe_debug_pub.add('unit_selling_price : '||update_line.usp);
2998: END IF;
2999: -- Delayed Requests to be logged if selling price change
3000: -- Tax, Verify_Payment, Commitment
3001: --populate a temp l_line_rec, only fields necessary to get tax flag
3026: cust_type.cust_trx_type_id = cust_trx.cust_trx_type_id
3027: and cust_trx.customer_trx_id = update_line.commitment_id
3028: );
3029: IF l_debug_level > 0 THEN
3030: oe_debug_pub.add( 'L_COMMIT TAX FLAG: '||L_COMMT_TAX_FLAG , 1 ) ;
3031: END IF;
3032: exception
3033: when others then
3034: IF l_debug_level > 0 THEN
3031: END IF;
3032: exception
3033: when others then
3034: IF l_debug_level > 0 THEN
3035: oe_debug_pub.add( 'IN EXCEPTION COMMITMENT ' , 1 ) ;
3036: END IF;
3037: l_commt_tax_flag := 'N';
3038: end;
3039: end if;
3042:
3043: --l_tax_calculation_flag := 'Y';
3044:
3045: IF l_debug_level > 0 THEN
3046: oe_debug_pub.add( 'L_TAX_CALCULATION_FLAG'||L_TAX_CALCULATION_FLAG ) ;
3047: END IF;
3048:
3049: -- commented portion of the following condition for bug7306510
3050: -- with ebtax upkae in R12 ,meaning of ra_cust_trx_types.tax_calculation_flag has changed
3062: --update_line.tax_exempt_flag = 'R' OR l_commt_tax_flag = 'Y' )
3063: ) THEN
3064:
3065: IF l_debug_level > 0 THEN
3066: oe_debug_pub.add( 'LOGGING DELAYED REQUEST FOR TAXING' ) ;
3067: END IF;
3068: l_commt_tax_flag := 'N' ; --bug 2505961
3069: -- lkxu, make changes for bug 1581188
3070: IF (OE_GLOBALS.G_UI_FLAG) THEN
3091:
3092: l_verify_payment := 'N';
3093: IF OE_ORDER_PUB.G_HDR.PAYMENT_TYPE_CODE = 'CREDIT_CARD' THEN
3094: IF l_debug_level > 0 THEN
3095: oe_debug_pub.add( 'CREDIT CARD:'||UPDATE_LINE.ADJUSTED_UNIT_PRICE||'>'||UPDATE_LINE.UNIT_SELLING_PRICE_PER_PQTY||'?' ) ;
3096: END IF;
3097: IF update_line.adjusted_unit_price > update_line.unit_selling_price_per_pqty or
3098: nvl(update_line.ousp,0) > nvl(update_line.usp,0)
3099: THEN
3099: THEN
3100: -- Log Request if commitment id is NULL
3101: IF update_line.commitment_id is NULL THEN
3102: IF l_debug_level > 0 THEN
3103: oe_debug_pub.add( 'LOG VERIFY PAYMENT DELAYED REQUSET IN SELLING PRICE' ) ;
3104: END IF;
3105: l_verify_payment := 'Y';
3106: ELSE
3107: IF l_debug_level > 0 THEN
3104: END IF;
3105: l_verify_payment := 'Y';
3106: ELSE
3107: IF l_debug_level > 0 THEN
3108: oe_debug_pub.add( 'COMMITMENT:'||UPDATE_LINE.COMMITMENT_ID ) ;
3109: END IF;
3110: END IF;
3111: END IF;
3112: ELSE
3110: END IF;
3111: END IF;
3112: ELSE
3113: IF l_debug_level > 0 THEN
3114: oe_debug_pub.add( 'PAYMENT TYPE:'||OE_ORDER_PUB.G_HDR.PAYMENT_TYPE_CODE||' BOOKED?'||UPDATE_LINE.BOOKED_FLAG ) ;
3115: END IF;
3116: IF nvl(update_line.booked_flag,'X') = 'Y' THEN
3117: IF l_debug_level > 0 THEN
3118: oe_debug_pub.add( 'LOG VERIFY PAYMENT REQUEST' ) ;
3114: oe_debug_pub.add( 'PAYMENT TYPE:'||OE_ORDER_PUB.G_HDR.PAYMENT_TYPE_CODE||' BOOKED?'||UPDATE_LINE.BOOKED_FLAG ) ;
3115: END IF;
3116: IF nvl(update_line.booked_flag,'X') = 'Y' THEN
3117: IF l_debug_level > 0 THEN
3118: oe_debug_pub.add( 'LOG VERIFY PAYMENT REQUEST' ) ;
3119: END IF;
3120: l_verify_payment := 'Y';
3121: END IF;
3122: END IF; -- credit card;
3122: END IF; -- credit card;
3123:
3124: IF (l_verify_payment = 'Y' AND update_line.line_category_code <> 'RETURN') THEN
3125: IF l_debug_level > 0 THEN
3126: oe_debug_pub.add( 'LOGGING DELAYED REQUEST FOR VERIFY PAYMENT' ) ;
3127: END IF;
3128: --
3129: OE_delayed_requests_Pvt.log_request
3130: (p_entity_code => OE_GLOBALS.G_ENTITY_ALL,
3140: END IF;
3141: END IF;
3142:
3143: IF l_debug_level > 0 THEN
3144: oe_debug_pub.add( 'COMMITMENT '||UPDATE_LINE.COMMITMENT_ID ) ;
3145: END IF;
3146:
3147: IF l_commitment_sequencing AND update_line.commitment_id IS NOT NULL THEN
3148: IF l_debug_level > 0 THEN
3145: END IF;
3146:
3147: IF l_commitment_sequencing AND update_line.commitment_id IS NOT NULL THEN
3148: IF l_debug_level > 0 THEN
3149: oe_debug_pub.add( 'LOGGING DELAYED REQUEST FOR COMMITMENT.' , 2 ) ;
3150: END IF;
3151: OE_Delayed_Requests_Pvt.Log_Request(
3152: p_entity_code => OE_GLOBALS.G_ENTITY_LINE,
3153: p_entity_id => update_line.line_id,
3162: END IF;
3163: END IF;
3164:
3165: IF l_debug_level > 0 THEN
3166: oe_debug_pub.add('old SP :'||update_line.unit_selling_price);
3167: oe_debug_pub.add('new SP :'||update_line.new_selling_price);
3168: END IF;
3169:
3170: -- BLANKETS: log request to update blanket amounts if price changes
3163: END IF;
3164:
3165: IF l_debug_level > 0 THEN
3166: oe_debug_pub.add('old SP :'||update_line.unit_selling_price);
3167: oe_debug_pub.add('new SP :'||update_line.new_selling_price);
3168: END IF;
3169:
3170: -- BLANKETS: log request to update blanket amounts if price changes
3171: -- BUG 2746595, send currency code as request_unique_key1 parameter to
3178: AND update_line.blanket_number IS NOT NULL
3179: THEN
3180:
3181: IF l_debug_level > 0 THEN
3182: oe_debug_pub.add('OEXVOPRB log blanket request');
3183: oe_debug_pub.add('old SP :'||update_line.unit_selling_price);
3184: oe_debug_pub.add('new SP :'||update_line.new_selling_price);
3185: END IF;
3186:
3179: THEN
3180:
3181: IF l_debug_level > 0 THEN
3182: oe_debug_pub.add('OEXVOPRB log blanket request');
3183: oe_debug_pub.add('old SP :'||update_line.unit_selling_price);
3184: oe_debug_pub.add('new SP :'||update_line.new_selling_price);
3185: END IF;
3186:
3187: OE_Order_Cache.Load_Order_Header(update_line.header_id);
3180:
3181: IF l_debug_level > 0 THEN
3182: oe_debug_pub.add('OEXVOPRB log blanket request');
3183: oe_debug_pub.add('old SP :'||update_line.unit_selling_price);
3184: oe_debug_pub.add('new SP :'||update_line.new_selling_price);
3185: END IF;
3186:
3187: OE_Order_Cache.Load_Order_Header(update_line.header_id);
3188: --for bug 3108881
3259:
3260: --bug 4332307
3261: IF l_log_mrg_hold_req = 'Y' THEN
3262: IF l_debug_level > 0 THEN
3263: oe_debug_pub.add( 'LOGGING DELAYED REQUEST FOR MARGIN HOLD FOR BOOKED HEADER_ID:'||l_header_id ) ;
3264: END IF;
3265: oe_delayed_requests_pvt.log_request(
3266: p_entity_code => OE_GLOBALS.G_ENTITY_ALL,
3267: p_entity_id => l_header_id,
3276:
3277:
3278: IF (G_PASS_ALL_LINES in ('N', 'R')) THEN
3279: IF l_debug_level > 0 THEN
3280: oe_debug_pub.add( 'DID NOT PASS ALL LINES , LOG REQUEST' ) ;
3281: END IF;
3282: BEGIN
3283: SELECT processed_flag
3284: INTO l_order_adj_changed_flag
3284: INTO l_order_adj_changed_flag
3285: FROM qp_preq_lines_tmp
3286: WHERE line_type_code='ORDER' and price_flag='Y';
3287: IF l_debug_level > 0 THEN
3288: oe_debug_pub.add( 'ORDER ADJ CHANGED:'||L_ORDER_ADJ_CHANGED_FLAG ) ;
3289: END IF;
3290: IF (l_order_adj_changed_flag = 'C') THEN
3291: IF l_debug_level > 0 THEN
3292: oe_debug_pub.add( 'LOGGING REQUEST TO UPDATE ALL LINES FOR HEADER LEVEL ADJUSTMENT.' , 1 ) ;
3288: oe_debug_pub.add( 'ORDER ADJ CHANGED:'||L_ORDER_ADJ_CHANGED_FLAG ) ;
3289: END IF;
3290: IF (l_order_adj_changed_flag = 'C') THEN
3291: IF l_debug_level > 0 THEN
3292: oe_debug_pub.add( 'LOGGING REQUEST TO UPDATE ALL LINES FOR HEADER LEVEL ADJUSTMENT.' , 1 ) ;
3293: END IF;
3294: OE_DELAYED_REQUESTS_PVT.LOG_REQUEST(
3295: p_entity_code => OE_GLOBALS.G_ENTITY_ALL,
3296: p_entity_id => oe_order_pub.g_hdr.header_id,
3302: END IF;
3303: EXCEPTION
3304: WHEN NO_DATA_FOUND THEN
3305: IF l_debug_level > 0 THEN
3306: oe_debug_pub.add( 'NO SUMMARY LINE WITH PRICE FLAG OF Y' ) ;
3307: END IF;
3308: NULL;
3309: WHEN OTHERS THEN
3310: IF l_debug_level > 0 THEN
3307: END IF;
3308: NULL;
3309: WHEN OTHERS THEN
3310: IF l_debug_level > 0 THEN
3311: oe_debug_pub.add( 'PROBLEM?'||SQLERRM ) ;
3312: END IF;
3313: END;
3314: END IF;
3315:
3313: END;
3314: END IF;
3315:
3316: IF l_debug_level > 0 THEN
3317: oe_debug_pub.add( 'AFTER LOG_REQUEST' , 3 ) ;
3318: END IF;
3319:
3320: EXCEPTION
3321: WHEN OTHERS THEN
3319:
3320: EXCEPTION
3321: WHEN OTHERS THEN
3322: IF l_debug_level > 0 THEN
3323: oe_debug_pub.add( 'WRONG IN LOG_REQUEST'||SQLERRM , 1 ) ;
3324: END IF;
3325: raise fnd_api.g_exc_error;
3326: End LOG_REQUEST;
3327:
3341: Select Waiting_Session,Holding_session,lock_type,MODE_HELD,MODE_REQUESTED,LOCK_ID1,LOCK_ID2
3342: From dba_waiters;
3343: */
3344: --
3345: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3346: --
3347: Begin
3348: --RT{
3349: IF nvl(G_PRICING_EVENT,';xx-') = 'RETROBILL' THEN
3346: --
3347: Begin
3348: --RT{
3349: IF nvl(G_PRICING_EVENT,';xx-') = 'RETROBILL' THEN
3350: oe_debug_pub.add('Calling update retrobill lines');
3351: LOG_REQUEST(px_line_tbl);
3352: Oe_Retrobill_Pvt.UPDATE_RETROBILL_LINES(G_RETROBILL_OPERATION);
3353: ELSE --RT
3354: IF l_debug_level > 0 THEN
3351: LOG_REQUEST(px_line_tbl);
3352: Oe_Retrobill_Pvt.UPDATE_RETROBILL_LINES(G_RETROBILL_OPERATION);
3353: ELSE --RT
3354: IF l_debug_level > 0 THEN
3355: oe_debug_pub.add( ' ENTERING OE_ORDER_PRICE_PVT.UPDATE_ORDER_LINES' ) ;
3356: END IF;
3357:
3358: SECURITY_AND_GLOBAL_PICTURE(px_line_tbl,p_write_to_db);
3359:
3359:
3360: LOG_REQUEST(px_line_tbl);
3361:
3362: IF l_debug_level > 0 THEN
3363: oe_debug_pub.add( ' BEFORE UPDATING ORDER LINES' , 3 ) ;
3364: END IF;
3365: UPDATE OE_ORDER_LINES_all l
3366: SET (UNIT_SELLING_PRICE
3367: , UNIT_LIST_PRICE
3416: and lines.process_status <> 'NOT_VALID'
3417: and
3418: lines.line_type_code='LINE');
3419: IF l_debug_level > 0 THEN
3420: oe_debug_pub.add( ' LEAVING UPDATE_ORDER_LINES:'||SQL%ROWCOUNT , 3 ) ;
3421: END IF;
3422: x_num_changed_lines := SQL%ROWCOUNT;
3423: END IF; --RT
3424: EXCEPTION
3423: END IF; --RT
3424: EXCEPTION
3425: WHEN DEADLOCK_DETECTED THEN
3426: IF l_debug_level > 0 THEN
3427: oe_debug_pub.add( 'WRONG IN UPDATE_ORDER_LINES'||SQLERRM , 1 ) ;
3428: END IF;
3429: /*
3430: For i in get_lock_info Loop
3431: oe_debug_pub.add('Waiting_Session:'||i.waiting_Session||' Holding_session:'||i.Holding_session);
3427: oe_debug_pub.add( 'WRONG IN UPDATE_ORDER_LINES'||SQLERRM , 1 ) ;
3428: END IF;
3429: /*
3430: For i in get_lock_info Loop
3431: oe_debug_pub.add('Waiting_Session:'||i.waiting_Session||' Holding_session:'||i.Holding_session);
3432: oe_debug_pub.add('Lock_type:'||i.lock_type||' MODE_HELD:'||i.MODE_HELD||' MODE_REQUESTED'||i.MODE_REQUESTED);
3433: oe_debug_pub.add('Lock_ID1:'||i.Lock_ID1||' Lock_ID2:'||i.Lock_ID2);
3434: End Loop;
3435: */
3428: END IF;
3429: /*
3430: For i in get_lock_info Loop
3431: oe_debug_pub.add('Waiting_Session:'||i.waiting_Session||' Holding_session:'||i.Holding_session);
3432: oe_debug_pub.add('Lock_type:'||i.lock_type||' MODE_HELD:'||i.MODE_HELD||' MODE_REQUESTED'||i.MODE_REQUESTED);
3433: oe_debug_pub.add('Lock_ID1:'||i.Lock_ID1||' Lock_ID2:'||i.Lock_ID2);
3434: End Loop;
3435: */
3436: raise fnd_api.g_exc_unexpected_error;
3429: /*
3430: For i in get_lock_info Loop
3431: oe_debug_pub.add('Waiting_Session:'||i.waiting_Session||' Holding_session:'||i.Holding_session);
3432: oe_debug_pub.add('Lock_type:'||i.lock_type||' MODE_HELD:'||i.MODE_HELD||' MODE_REQUESTED'||i.MODE_REQUESTED);
3433: oe_debug_pub.add('Lock_ID1:'||i.Lock_ID1||' Lock_ID2:'||i.Lock_ID2);
3434: End Loop;
3435: */
3436: raise fnd_api.g_exc_unexpected_error;
3437: WHEN OTHERS THEN
3435: */
3436: raise fnd_api.g_exc_unexpected_error;
3437: WHEN OTHERS THEN
3438: IF l_debug_level > 0 THEN
3439: oe_debug_pub.add( 'WRONG IN UPDATE_ORDER_LINES'||SQLERRM , 1 ) ;
3440: END IF;
3441: raise fnd_api.g_exc_unexpected_error;
3442: End UPDATE_ORDER_LINES;
3443:
3458: l_index NUMBER;
3459: l_booked_flag varchar2(1) := oe_order_cache.g_header_rec.booked_flag;
3460:
3461: --
3462: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3463: --
3464: BEGIN
3465: IF l_debug_level > 0 THEN
3466: oe_debug_pub.add('l_booked_flag in delete dependents = '||l_booked_flag);
3462: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3463: --
3464: BEGIN
3465: IF l_debug_level > 0 THEN
3466: oe_debug_pub.add('l_booked_flag in delete dependents = '||l_booked_flag);
3467: END IF;
3468: If p_adj_id_tbl.count > 0 Then
3469: IF OE_CODE_CONTROL.Get_Code_Release_Level >= '110509' THEN
3470: --IF l_booked_flag = 'Y' THEN
3469: IF OE_CODE_CONTROL.Get_Code_Release_Level >= '110509' THEN
3470: --IF l_booked_flag = 'Y' THEN
3471: --IF oe_adv_price_pvt.check_notify_OC then
3472: IF l_debug_level > 0 THEN
3473: oe_debug_pub.add('Delete adjustments notify to OC');
3474: END IF;
3475: i := p_adj_id_tbl.first;
3476: while i is not null loop
3477: l_Line_Adj_rec.operation := OE_GLOBALS.G_OPR_DELETE;
3485: l_Line_Adj_rec.applied_flag := p_applied_flag_tbl(i);
3486: l_Line_Adj_rec.adjusted_amount := p_adjusted_amount_tbl(i);
3487: l_Line_Adj_rec.last_update_date := sysdate;
3488: IF l_debug_level > 0 THEN
3489: oe_debug_pub.add('header_id:'||l_Line_Adj_rec.header_id||'line_id:'|| l_Line_Adj_rec.line_id);
3490: oe_debug_pub.add('list_line_id:'||l_Line_Adj_rec.list_line_id||'list_header_id:'||l_Line_Adj_rec.list_header_id);
3491: oe_debug_pub.add('last_update_date:'||l_Line_Adj_rec.last_update_date);
3492: END IF;
3493: --bug 3882620
3486: l_Line_Adj_rec.adjusted_amount := p_adjusted_amount_tbl(i);
3487: l_Line_Adj_rec.last_update_date := sysdate;
3488: IF l_debug_level > 0 THEN
3489: oe_debug_pub.add('header_id:'||l_Line_Adj_rec.header_id||'line_id:'|| l_Line_Adj_rec.line_id);
3490: oe_debug_pub.add('list_line_id:'||l_Line_Adj_rec.list_line_id||'list_header_id:'||l_Line_Adj_rec.list_header_id);
3491: oe_debug_pub.add('last_update_date:'||l_Line_Adj_rec.last_update_date);
3492: END IF;
3493: --bug 3882620
3494: OE_ORDER_UTIL.Update_Global_Picture(p_Upd_New_Rec_If_Exists => True,
3487: l_Line_Adj_rec.last_update_date := sysdate;
3488: IF l_debug_level > 0 THEN
3489: oe_debug_pub.add('header_id:'||l_Line_Adj_rec.header_id||'line_id:'|| l_Line_Adj_rec.line_id);
3490: oe_debug_pub.add('list_line_id:'||l_Line_Adj_rec.list_line_id||'list_header_id:'||l_Line_Adj_rec.list_header_id);
3491: oe_debug_pub.add('last_update_date:'||l_Line_Adj_rec.last_update_date);
3492: END IF;
3493: --bug 3882620
3494: OE_ORDER_UTIL.Update_Global_Picture(p_Upd_New_Rec_If_Exists => True,
3495: p_line_adj_rec =>l_line_adj_rec,
3497: p_old_line_adj_rec =>l_line_adj_rec,
3498: x_index => l_index,
3499: x_return_status => l_return_status);
3500: IF l_debug_level > 0 THEN
3501: oe_debug_pub.add( 'UPDATE_GLOBAL RETURN STATUS FROM OE_ORDER_PRICE_PVT.DELETE_DEPENDENTS IS: ' || L_RETURN_STATUS ) ;
3502: END IF;
3503:
3504: IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
3505:
3503:
3504: IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
3505:
3506: IF l_debug_level > 0 THEN
3507: oe_debug_pub.add( 'EVENT NOTIFY - UNEXPECTED ERROR' ) ;
3508: oe_debug_pub.add( 'EXITING OE_ORDER_PRICE_PVT.DELETE_DEPENDENTS', 1 ) ;
3509: END IF;
3510: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3511: ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
3504: IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
3505:
3506: IF l_debug_level > 0 THEN
3507: oe_debug_pub.add( 'EVENT NOTIFY - UNEXPECTED ERROR' ) ;
3508: oe_debug_pub.add( 'EXITING OE_ORDER_PRICE_PVT.DELETE_DEPENDENTS', 1 ) ;
3509: END IF;
3510: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3511: ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
3512: IF l_debug_level > 0 THEN
3509: END IF;
3510: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3511: ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
3512: IF l_debug_level > 0 THEN
3513: oe_debug_pub.add( 'UPDATE_GLOBAL_PICTURE ERROR IN OE_ORDER_PRICE_PVT.DELETE_DEPENDENTS' ) ;
3514: oe_debug_pub.add( 'EXITING OE_ORDER_PRICE_PVT.DELETE_DEPENDENTS', 1 ) ;
3515: END IF;
3516: RAISE FND_API.G_EXC_ERROR;
3517: END IF;
3510: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3511: ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
3512: IF l_debug_level > 0 THEN
3513: oe_debug_pub.add( 'UPDATE_GLOBAL_PICTURE ERROR IN OE_ORDER_PRICE_PVT.DELETE_DEPENDENTS' ) ;
3514: oe_debug_pub.add( 'EXITING OE_ORDER_PRICE_PVT.DELETE_DEPENDENTS', 1 ) ;
3515: END IF;
3516: RAISE FND_API.G_EXC_ERROR;
3517: END IF;
3518: i := p_adj_id_tbl.next(i);
3523:
3524: FORALL i IN p_adj_id_tbl.FIRST..p_adj_id_tbl.LAST
3525: DELETE FROM OE_PRICE_ADJ_ATTRIBS WHERE price_adjustment_id = p_adj_id_tbl(i);
3526: IF l_debug_level > 0 THEN
3527: oe_debug_pub.add( ' DELETED '||SQL%ROWCOUNT||' ATTRIBS' , 3 ) ;
3528: END IF;
3529:
3530: FORALL i IN p_adj_id_tbl.FIRST..p_adj_id_tbl.LAST
3531: DELETE FROM OE_PRICE_ADJ_ASSOCS WHERE price_adjustment_id = p_adj_id_tbl(i);
3529:
3530: FORALL i IN p_adj_id_tbl.FIRST..p_adj_id_tbl.LAST
3531: DELETE FROM OE_PRICE_ADJ_ASSOCS WHERE price_adjustment_id = p_adj_id_tbl(i);
3532: IF l_debug_level > 0 THEN
3533: oe_debug_pub.add( ' DELETED '||SQL%ROWCOUNT||' ASSOCS' , 3 ) ;
3534: END IF;
3535:
3536: FORALL i IN p_adj_id_tbl.FIRST..p_adj_id_tbl.LAST
3537: DELETE FROM OE_PRICE_ADJ_ASSOCS WHERE rltd_price_adj_id = p_adj_id_tbl(i);
3535:
3536: FORALL i IN p_adj_id_tbl.FIRST..p_adj_id_tbl.LAST
3537: DELETE FROM OE_PRICE_ADJ_ASSOCS WHERE rltd_price_adj_id = p_adj_id_tbl(i);
3538: IF l_debug_level > 0 THEN
3539: oe_debug_pub.add( ' DELETED '||SQL%ROWCOUNT||' RLTD ASSOCS' , 3 ) ;
3540: END IF;
3541:
3542: p_adj_id_tbl.delete;
3543: End If;
3562: l_list_header_id_tbl Number_Type;
3563: l_adjusted_amount_tbl Number_Type;
3564: l_list_line_id_tbl Number_Type;
3565: --bug 3882620
3566: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3567:
3568: BEGIN
3569:
3570: IF p_hdr_price_flag in ('Y', 'P') AND p_hdr_pricing_status_code IN
3609: l_applied_flag_tbl,
3610: l_adjusted_amount_tbl;
3611:
3612: IF l_debug_level > 0 THEN
3613: oe_debug_pub.add( 'DELETED '||SQL%ROWCOUNT||' HEADER LEVEL ADJUSTMENTS/CHARGES' , 3 ) ;
3614: END IF;
3615: DELETE_DEPENDENTS(l_adj_id_tbl,l_header_id_tbl,l_line_id_tbl,l_list_line_id_tbl,l_list_header_id_tbl,l_list_line_type_code_tbl,l_applied_flag_tbl,l_adjusted_amount_tbl);
3616: END IF;
3617: END DELETE_HDR_ADJS;
3638: l_list_header_id_tbl Number_Type;
3639: l_adjusted_amount_tbl Number_Type;
3640: l_list_line_id_tbl Number_Type;
3641: --bug 3882620
3642: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3643:
3644: BEGIN
3645:
3646: l_line_type_code := 'LINE';
3688: l_applied_flag_tbl,
3689: l_adjusted_amount_tbl;
3690:
3691: IF l_debug_level > 0 THEN
3692: oe_debug_pub.add( 'DELETED '||SQL%ROWCOUNT||' LINE LEVEL ADJUSTMENTS/CHARGES FOR LINE:'||ONE_LINE.LINE_ID , 3 ) ;
3693: END IF;
3694: DELETE_DEPENDENTS(l_adj_id_tbl,l_header_id_tbl,l_line_id_tbl,l_list_line_id_tbl,l_list_header_id_tbl,l_list_line_type_code_tbl,l_applied_flag_tbl,l_adjusted_amount_tbl);
3695: END LOOP;
3696:
3711: l_list_header_id_tbl Number_Type;
3712: l_adjusted_amount_tbl Number_Type;
3713: l_list_line_id_tbl Number_Type;
3714: --bug 3882620
3715: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3716:
3717: BEGIN
3718:
3719: select line_id,
3773: l_applied_flag_tbl,
3774: l_adjusted_amount_tbl;
3775:
3776: IF l_debug_level > 0 THEN
3777: oe_debug_pub.add( 'DELETED '||SQL%ROWCOUNT||' LINE LEVEL ADJUSTMENTS/CHARGES' , 3 ) ;
3778: END IF;
3779: DELETE_DEPENDENTS(l_adj_id_tbl,l_header_id_tbl,l_line_id_tbl,l_list_line_id_tbl,l_list_header_id_tbl,l_list_line_type_code_tbl,l_applied_flag_tbl,l_adjusted_amount_tbl);
3780:
3781: END DELETE_ONE_LINE_ADJS;
3790: )
3791: IS
3792:
3793: l_price_adjustment_id NUMBER;
3794: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3795:
3796: BEGIN
3797:
3798: IF l_debug_level > 0 THEN
3795:
3796: BEGIN
3797:
3798: IF l_debug_level > 0 THEN
3799: oe_debug_pub.add('entering procedure update_adj');
3800: oe_debug_pub.add('p_price_adjustment_id : '||p_price_adjustment_id);
3801: oe_debug_pub.add('p_line_detail_index : '||p_line_detail_index);
3802: END IF;
3803:
3796: BEGIN
3797:
3798: IF l_debug_level > 0 THEN
3799: oe_debug_pub.add('entering procedure update_adj');
3800: oe_debug_pub.add('p_price_adjustment_id : '||p_price_adjustment_id);
3801: oe_debug_pub.add('p_line_detail_index : '||p_line_detail_index);
3802: END IF;
3803:
3804: --bug 5497035
3797:
3798: IF l_debug_level > 0 THEN
3799: oe_debug_pub.add('entering procedure update_adj');
3800: oe_debug_pub.add('p_price_adjustment_id : '||p_price_adjustment_id);
3801: oe_debug_pub.add('p_line_detail_index : '||p_line_detail_index);
3802: END IF;
3803:
3804: --bug 5497035
3805: BEGIN
3810: WHERE price_adjustment_id = p_price_adjustment_id
3811: FOR UPDATE NOWAIT;
3812:
3813: IF l_debug_level > 0 Then
3814: oe_Debug_pub.add('Adjustment row successfully locked');
3815: END IF;
3816:
3817: EXCEPTION
3818: WHEN APP_EXCEPTIONS.RECORD_LOCK_EXCEPTION THEN
3816:
3817: EXCEPTION
3818: WHEN APP_EXCEPTIONS.RECORD_LOCK_EXCEPTION THEN
3819: IF l_debug_level > 0 THEN
3820: oe_debug_pub.add('in lock record exception, someone else working on the row');
3821: END IF;
3822: FND_MESSAGE.SET_NAME('ONT','OE_LOCK_ROW_ALREADY_LOCKED');
3823: OE_MSG_PUB.Add;
3824: RAISE FND_API.G_EXC_ERROR;
3824: RAISE FND_API.G_EXC_ERROR;
3825:
3826: WHEN NO_DATA_FOUND THEN
3827: IF l_debug_level > 0 THEN
3828: oe_debug_pub.add('no_data_found, record lock exception');
3829: END IF;
3830: --bug 5709185 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3831:
3832: WHEN OTHERS THEN
3830: --bug 5709185 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3831:
3832: WHEN OTHERS THEN
3833: IF l_debug_level > 0 THEN
3834: oe_debug_pub.add('record lock exception, others');
3835: END IF;
3836: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3837:
3838: END;
3936: )
3937: where adj.price_adjustment_id = p_price_adjustment_id
3938: returning adj.list_line_id bulk collect into px_debug_upd_adj_tbl;
3939: IF l_debug_level > 0 THEN
3940: oe_debug_pub.add('exiting update_adj procedure');
3941: END IF;
3942: END update_adj;
3943: --bug 3836854
3944:
4108: l_hdr_pricing_status_code VARCHAR2(30);
4109: l_no_summary_line boolean := FALSE;
4110: ---bug 3740009
4111: --
4112: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
4113: --
4114: BEGIN
4115:
4116: IF l_debug_level > 0 THEN
4113: --
4114: BEGIN
4115:
4116: IF l_debug_level > 0 THEN
4117: oe_debug_pub.add( 'INSIDE REFRESH_ADJS FOR LINE ID:'||P_LINE_ID|| ' EVENT:'||P_PRICING_EVENTS , 3 ) ;
4118: END IF;
4119:
4120: ---bug 3740009
4121: BEGIN
4132: where line_type_code = 'ORDER'
4133: and process_status <> 'NOT_VALID';
4134: EXCEPTION
4135: WHEN NO_DATA_FOUND THEN
4136: oe_debug_pub.add('No summary line');
4137: l_no_summary_line := TRUE;
4138: END;
4139: ---bug 3740009
4140:
4169: --pviprana: Debug messages to show the contents in the qp temp tables
4170: -- THE FOLLOWING CURSORS RETRIEVE ALL THE NEEDED VALUES FROM QP TEMP TABLES
4171: -- PLEASE PRINT THE NEEDED VALUES FOR DEBUGGING PURPOSES
4172: IF l_debug_level > 0 THEN
4173: oe_debug_pub.add('UPDATABLE ORDER LEVEL ADJUSTMENTS :');
4174: FOR updble_order_adj IN debug_updatable_order_adj LOOP
4175: oe_debug_pub.add( '************************************************************************');
4176: oe_debug_pub.add('LIST_LINE_ID : '||updble_order_adj.list_line_id);
4177: oe_debug_pub.add('ORDER_QTY_ADJ_AMT: '||updble_order_adj.order_qty_adj_amt);
4171: -- PLEASE PRINT THE NEEDED VALUES FOR DEBUGGING PURPOSES
4172: IF l_debug_level > 0 THEN
4173: oe_debug_pub.add('UPDATABLE ORDER LEVEL ADJUSTMENTS :');
4174: FOR updble_order_adj IN debug_updatable_order_adj LOOP
4175: oe_debug_pub.add( '************************************************************************');
4176: oe_debug_pub.add('LIST_LINE_ID : '||updble_order_adj.list_line_id);
4177: oe_debug_pub.add('ORDER_QTY_ADJ_AMT: '||updble_order_adj.order_qty_adj_amt);
4178: oe_debug_pub.add('ADJUSTMENT_AMOUNT: '||updble_order_adj.adjustment_amount);
4179: oe_debug_pub.add( '************************************************************************');
4172: IF l_debug_level > 0 THEN
4173: oe_debug_pub.add('UPDATABLE ORDER LEVEL ADJUSTMENTS :');
4174: FOR updble_order_adj IN debug_updatable_order_adj LOOP
4175: oe_debug_pub.add( '************************************************************************');
4176: oe_debug_pub.add('LIST_LINE_ID : '||updble_order_adj.list_line_id);
4177: oe_debug_pub.add('ORDER_QTY_ADJ_AMT: '||updble_order_adj.order_qty_adj_amt);
4178: oe_debug_pub.add('ADJUSTMENT_AMOUNT: '||updble_order_adj.adjustment_amount);
4179: oe_debug_pub.add( '************************************************************************');
4180: END LOOP;
4173: oe_debug_pub.add('UPDATABLE ORDER LEVEL ADJUSTMENTS :');
4174: FOR updble_order_adj IN debug_updatable_order_adj LOOP
4175: oe_debug_pub.add( '************************************************************************');
4176: oe_debug_pub.add('LIST_LINE_ID : '||updble_order_adj.list_line_id);
4177: oe_debug_pub.add('ORDER_QTY_ADJ_AMT: '||updble_order_adj.order_qty_adj_amt);
4178: oe_debug_pub.add('ADJUSTMENT_AMOUNT: '||updble_order_adj.adjustment_amount);
4179: oe_debug_pub.add( '************************************************************************');
4180: END LOOP;
4181: oe_debug_pub.add('UPDATABLE LINE LEVEL ADJUSTMENTS :');
4174: FOR updble_order_adj IN debug_updatable_order_adj LOOP
4175: oe_debug_pub.add( '************************************************************************');
4176: oe_debug_pub.add('LIST_LINE_ID : '||updble_order_adj.list_line_id);
4177: oe_debug_pub.add('ORDER_QTY_ADJ_AMT: '||updble_order_adj.order_qty_adj_amt);
4178: oe_debug_pub.add('ADJUSTMENT_AMOUNT: '||updble_order_adj.adjustment_amount);
4179: oe_debug_pub.add( '************************************************************************');
4180: END LOOP;
4181: oe_debug_pub.add('UPDATABLE LINE LEVEL ADJUSTMENTS :');
4182: FOR updble_line_adj IN debug_updatable_line_adj LOOP
4175: oe_debug_pub.add( '************************************************************************');
4176: oe_debug_pub.add('LIST_LINE_ID : '||updble_order_adj.list_line_id);
4177: oe_debug_pub.add('ORDER_QTY_ADJ_AMT: '||updble_order_adj.order_qty_adj_amt);
4178: oe_debug_pub.add('ADJUSTMENT_AMOUNT: '||updble_order_adj.adjustment_amount);
4179: oe_debug_pub.add( '************************************************************************');
4180: END LOOP;
4181: oe_debug_pub.add('UPDATABLE LINE LEVEL ADJUSTMENTS :');
4182: FOR updble_line_adj IN debug_updatable_line_adj LOOP
4183: oe_debug_pub.add( '************************************************************************');
4177: oe_debug_pub.add('ORDER_QTY_ADJ_AMT: '||updble_order_adj.order_qty_adj_amt);
4178: oe_debug_pub.add('ADJUSTMENT_AMOUNT: '||updble_order_adj.adjustment_amount);
4179: oe_debug_pub.add( '************************************************************************');
4180: END LOOP;
4181: oe_debug_pub.add('UPDATABLE LINE LEVEL ADJUSTMENTS :');
4182: FOR updble_line_adj IN debug_updatable_line_adj LOOP
4183: oe_debug_pub.add( '************************************************************************');
4184: oe_debug_pub.add('LIST_LINE_ID : '||updble_line_adj.list_line_id);
4185: oe_debug_pub.add('ORDER_QTY_ADJ_AMT: '||updble_line_adj.order_qty_adj_amt);
4179: oe_debug_pub.add( '************************************************************************');
4180: END LOOP;
4181: oe_debug_pub.add('UPDATABLE LINE LEVEL ADJUSTMENTS :');
4182: FOR updble_line_adj IN debug_updatable_line_adj LOOP
4183: oe_debug_pub.add( '************************************************************************');
4184: oe_debug_pub.add('LIST_LINE_ID : '||updble_line_adj.list_line_id);
4185: oe_debug_pub.add('ORDER_QTY_ADJ_AMT: '||updble_line_adj.order_qty_adj_amt);
4186: oe_debug_pub.add('ADJUSTMENT_AMOUNT: '||updble_line_adj.adjustment_amount);
4187: oe_debug_pub.add( '************************************************************************');
4180: END LOOP;
4181: oe_debug_pub.add('UPDATABLE LINE LEVEL ADJUSTMENTS :');
4182: FOR updble_line_adj IN debug_updatable_line_adj LOOP
4183: oe_debug_pub.add( '************************************************************************');
4184: oe_debug_pub.add('LIST_LINE_ID : '||updble_line_adj.list_line_id);
4185: oe_debug_pub.add('ORDER_QTY_ADJ_AMT: '||updble_line_adj.order_qty_adj_amt);
4186: oe_debug_pub.add('ADJUSTMENT_AMOUNT: '||updble_line_adj.adjustment_amount);
4187: oe_debug_pub.add( '************************************************************************');
4188: END LOOP;
4181: oe_debug_pub.add('UPDATABLE LINE LEVEL ADJUSTMENTS :');
4182: FOR updble_line_adj IN debug_updatable_line_adj LOOP
4183: oe_debug_pub.add( '************************************************************************');
4184: oe_debug_pub.add('LIST_LINE_ID : '||updble_line_adj.list_line_id);
4185: oe_debug_pub.add('ORDER_QTY_ADJ_AMT: '||updble_line_adj.order_qty_adj_amt);
4186: oe_debug_pub.add('ADJUSTMENT_AMOUNT: '||updble_line_adj.adjustment_amount);
4187: oe_debug_pub.add( '************************************************************************');
4188: END LOOP;
4189: END IF;
4182: FOR updble_line_adj IN debug_updatable_line_adj LOOP
4183: oe_debug_pub.add( '************************************************************************');
4184: oe_debug_pub.add('LIST_LINE_ID : '||updble_line_adj.list_line_id);
4185: oe_debug_pub.add('ORDER_QTY_ADJ_AMT: '||updble_line_adj.order_qty_adj_amt);
4186: oe_debug_pub.add('ADJUSTMENT_AMOUNT: '||updble_line_adj.adjustment_amount);
4187: oe_debug_pub.add( '************************************************************************');
4188: END LOOP;
4189: END IF;
4190:
4183: oe_debug_pub.add( '************************************************************************');
4184: oe_debug_pub.add('LIST_LINE_ID : '||updble_line_adj.list_line_id);
4185: oe_debug_pub.add('ORDER_QTY_ADJ_AMT: '||updble_line_adj.order_qty_adj_amt);
4186: oe_debug_pub.add('ADJUSTMENT_AMOUNT: '||updble_line_adj.adjustment_amount);
4187: oe_debug_pub.add( '************************************************************************');
4188: END LOOP;
4189: END IF;
4190:
4191: --bug 3836854
4190:
4191: --bug 3836854
4192: for i in upd_adj('ORDER') loop
4193: IF l_debug_level > 0 THEN
4194: oe_debug_pub.add('within upd_adj cursor for order');
4195: oe_debug_pub.add('l_hdr_price_flag : '||l_hdr_price_flag);
4196: IF l_no_summary_line THEN
4197: oe_debug_pub.add('l_no_summary_line : '|| 'TRUE');
4198: ELSE
4191: --bug 3836854
4192: for i in upd_adj('ORDER') loop
4193: IF l_debug_level > 0 THEN
4194: oe_debug_pub.add('within upd_adj cursor for order');
4195: oe_debug_pub.add('l_hdr_price_flag : '||l_hdr_price_flag);
4196: IF l_no_summary_line THEN
4197: oe_debug_pub.add('l_no_summary_line : '|| 'TRUE');
4198: ELSE
4199: oe_debug_pub.add('l_no_summary_line : '|| 'FALSE');
4193: IF l_debug_level > 0 THEN
4194: oe_debug_pub.add('within upd_adj cursor for order');
4195: oe_debug_pub.add('l_hdr_price_flag : '||l_hdr_price_flag);
4196: IF l_no_summary_line THEN
4197: oe_debug_pub.add('l_no_summary_line : '|| 'TRUE');
4198: ELSE
4199: oe_debug_pub.add('l_no_summary_line : '|| 'FALSE');
4200: END IF;
4201: END IF;
4195: oe_debug_pub.add('l_hdr_price_flag : '||l_hdr_price_flag);
4196: IF l_no_summary_line THEN
4197: oe_debug_pub.add('l_no_summary_line : '|| 'TRUE');
4198: ELSE
4199: oe_debug_pub.add('l_no_summary_line : '|| 'FALSE');
4200: END IF;
4201: END IF;
4202: IF nvl(l_hdr_price_flag,'N') <> 'N' OR NOT l_no_summary_line THEN
4203: IF l_debug_level > 0 THEN
4200: END IF;
4201: END IF;
4202: IF nvl(l_hdr_price_flag,'N') <> 'N' OR NOT l_no_summary_line THEN
4203: IF l_debug_level > 0 THEN
4204: oe_debug_pub.add('within if l_hdr_price_flag');
4205: END IF;
4206: update_adj(i.price_adjustment_id, i.line_detail_index , l_debug_upd_order_adj_tbl);
4207: IF l_debug_level > 0 THEN
4208: oe_debug_pub.add('after update_adj order');
4204: oe_debug_pub.add('within if l_hdr_price_flag');
4205: END IF;
4206: update_adj(i.price_adjustment_id, i.line_detail_index , l_debug_upd_order_adj_tbl);
4207: IF l_debug_level > 0 THEN
4208: oe_debug_pub.add('after update_adj order');
4209: END IF;
4210: END IF;
4211: IF l_debug_level > 0 THEN
4212: oe_debug_pub.add( 'UPDATED '||SQL%ROWCOUNT||' ORDER LEVEL ADJUSTMENTS' , 3 ) ;
4208: oe_debug_pub.add('after update_adj order');
4209: END IF;
4210: END IF;
4211: IF l_debug_level > 0 THEN
4212: oe_debug_pub.add( 'UPDATED '||SQL%ROWCOUNT||' ORDER LEVEL ADJUSTMENTS' , 3 ) ;
4213: END IF;
4214: end loop;
4215:
4216: for i in upd_adj('LINE') loop
4214: end loop;
4215:
4216: for i in upd_adj('LINE') loop
4217: IF l_debug_level > 0 THEN
4218: oe_debug_pub.add('within upd_adj cursor for line');
4219: END IF;
4220: update_adj(i.price_adjustment_id, i.line_detail_index, l_debug_upd_line_adj_tbl);
4221: IF l_debug_level > 0 THEN
4222: oe_debug_pub.add('after update_adj for line');
4218: oe_debug_pub.add('within upd_adj cursor for line');
4219: END IF;
4220: update_adj(i.price_adjustment_id, i.line_detail_index, l_debug_upd_line_adj_tbl);
4221: IF l_debug_level > 0 THEN
4222: oe_debug_pub.add('after update_adj for line');
4223: oe_debug_pub.add( 'UPDATED '||SQL%ROWCOUNT||' LINE LEVEL ADJUSTMENTS' , 3 ) ;
4224: END IF;
4225: end loop;
4226: --bug 3836854
4219: END IF;
4220: update_adj(i.price_adjustment_id, i.line_detail_index, l_debug_upd_line_adj_tbl);
4221: IF l_debug_level > 0 THEN
4222: oe_debug_pub.add('after update_adj for line');
4223: oe_debug_pub.add( 'UPDATED '||SQL%ROWCOUNT||' LINE LEVEL ADJUSTMENTS' , 3 ) ;
4224: END IF;
4225: end loop;
4226: --bug 3836854
4227:
4226: --bug 3836854
4227:
4228: --pviprana: printing the list_line_ids of order level adjustments that were updated
4229: IF l_debug_level > 0 THEN
4230: oe_debug_pub.add( '************************************************************************');
4231: oe_debug_pub.add('UPDATED ORDER LEVEL ADJ LIST LINE IDS ARE:');
4232: IF(l_debug_upd_order_adj_tbl.count > 0) THEN
4233: FOR i IN l_debug_upd_order_adj_tbl.FIRST..l_debug_upd_order_adj_tbl.LAST LOOP
4234: oe_debug_pub.add(l_debug_upd_order_adj_tbl(i));
4227:
4228: --pviprana: printing the list_line_ids of order level adjustments that were updated
4229: IF l_debug_level > 0 THEN
4230: oe_debug_pub.add( '************************************************************************');
4231: oe_debug_pub.add('UPDATED ORDER LEVEL ADJ LIST LINE IDS ARE:');
4232: IF(l_debug_upd_order_adj_tbl.count > 0) THEN
4233: FOR i IN l_debug_upd_order_adj_tbl.FIRST..l_debug_upd_order_adj_tbl.LAST LOOP
4234: oe_debug_pub.add(l_debug_upd_order_adj_tbl(i));
4235: END LOOP;
4230: oe_debug_pub.add( '************************************************************************');
4231: oe_debug_pub.add('UPDATED ORDER LEVEL ADJ LIST LINE IDS ARE:');
4232: IF(l_debug_upd_order_adj_tbl.count > 0) THEN
4233: FOR i IN l_debug_upd_order_adj_tbl.FIRST..l_debug_upd_order_adj_tbl.LAST LOOP
4234: oe_debug_pub.add(l_debug_upd_order_adj_tbl(i));
4235: END LOOP;
4236: END IF;
4237: oe_debug_pub.add( '************************************************************************');
4238: END IF;
4233: FOR i IN l_debug_upd_order_adj_tbl.FIRST..l_debug_upd_order_adj_tbl.LAST LOOP
4234: oe_debug_pub.add(l_debug_upd_order_adj_tbl(i));
4235: END LOOP;
4236: END IF;
4237: oe_debug_pub.add( '************************************************************************');
4238: END IF;
4239:
4240:
4241: IF l_debug_level > 0 THEN
4239:
4240:
4241: IF l_debug_level > 0 THEN
4242: --pviprana: printing the list_line_ids of line level adjustments that were updated
4243: oe_debug_pub.add( '************************************************************************');
4244: oe_debug_pub.add('UPDATED LINE LEVEL ADJ LIST LINE IDS ARE:');
4245: IF(l_debug_upd_line_adj_tbl.count > 0) THEN
4246: FOR i IN l_debug_upd_line_adj_tbl.FIRST..l_debug_upd_line_adj_tbl.LAST LOOP
4247: oe_debug_pub.add(l_debug_upd_line_adj_tbl(i));
4240:
4241: IF l_debug_level > 0 THEN
4242: --pviprana: printing the list_line_ids of line level adjustments that were updated
4243: oe_debug_pub.add( '************************************************************************');
4244: oe_debug_pub.add('UPDATED LINE LEVEL ADJ LIST LINE IDS ARE:');
4245: IF(l_debug_upd_line_adj_tbl.count > 0) THEN
4246: FOR i IN l_debug_upd_line_adj_tbl.FIRST..l_debug_upd_line_adj_tbl.LAST LOOP
4247: oe_debug_pub.add(l_debug_upd_line_adj_tbl(i));
4248: END LOOP;
4243: oe_debug_pub.add( '************************************************************************');
4244: oe_debug_pub.add('UPDATED LINE LEVEL ADJ LIST LINE IDS ARE:');
4245: IF(l_debug_upd_line_adj_tbl.count > 0) THEN
4246: FOR i IN l_debug_upd_line_adj_tbl.FIRST..l_debug_upd_line_adj_tbl.LAST LOOP
4247: oe_debug_pub.add(l_debug_upd_line_adj_tbl(i));
4248: END LOOP;
4249: END IF;
4250: oe_debug_pub.add( '************************************************************************');
4251: END IF;
4246: FOR i IN l_debug_upd_line_adj_tbl.FIRST..l_debug_upd_line_adj_tbl.LAST LOOP
4247: oe_debug_pub.add(l_debug_upd_line_adj_tbl(i));
4248: END LOOP;
4249: END IF;
4250: oe_debug_pub.add( '************************************************************************');
4251: END IF;
4252:
4253: IF (p_Calculate_Flag <> QP_PREQ_GRP.G_CALCULATE_ONLY) THEN
4254: l_stmt:=7;
4481: );
4482:
4483:
4484: IF l_debug_level > 0 THEN
4485: oe_debug_pub.add( 'INSERTED '||SQL%ROWCOUNT||' ADJUSTMENTS' , 3 ) ;
4486: END IF;
4487:
4488: /*Insert ASSO for header level adj
4489: * Comment out--Not possible to have header level adjustments with associations
4584: RLTD.PRICING_STATUS_CODE = 'N');
4585:
4586:
4587: IF l_debug_level > 0 THEN
4588: oe_debug_pub.add( 'INSERTED '||SQL%ROWCOUNT||' PRICE ADJ ASSOCS' , 3 ) ;
4589: END IF;
4590:
4591: End If; -- insert_adj
4592:
4623: --AND LDETS.LINE_INDEX = oe_order_pub.g_hdr.header_id + l_line_id_tbl(i)
4624: --AND ADJ.PRICE_ADJUSTMENT_ID = l_adj_id_tbl(i)
4625: ) ;
4626: IF l_debug_level > 0 THEN
4627: oe_debug_pub.add( 'DELETED '||SQL%ROWCOUNT||' ATTRIBUTES' ) ;
4628: END IF;
4629: l_stmt:=10;
4630: FORALL i IN l_adj_id_tbl.FIRST..l_adj_id_tbl.LAST
4631: INSERT INTO OE_PRICE_ADJ_ATTRIBS
4692: FROM OE_PRICE_ADJ_ATTRIBS
4693: WHERE PRICE_ADJUSTMENT_ID = l_adj_id_tbl(i)
4694: ));
4695: IF l_debug_level > 0 THEN
4696: oe_debug_pub.add( 'INSERTED '||SQL%ROWCOUNT||' CHANGED ATTRIBS' ) ;
4697: END IF;
4698: End If;
4699: close del_attribs1;
4700: l_stmt:=11;
4729: --AND LDETS.LINE_INDEX = ADJ.HEADER_ID
4730: --AND ADJ.PRICE_ADJUSTMENT_ID = l_adj_id_tbl(i)
4731: ) ;
4732: IF l_debug_level > 0 THEN
4733: oe_debug_pub.add( 'DELETED '||SQL%ROWCOUNT||'ORDER ADJ LEVEL ATTRIBUTES' ) ;
4734: END IF;
4735: l_stmt:=12;
4736: FORALL i IN l_adj_id_tbl.FIRST..l_adj_id_tbl.LAST
4737: INSERT INTO OE_PRICE_ADJ_ATTRIBS
4944: QP_PREQ_PUB.G_STATUS_GSA_VIOLATION)
4945: AND QPLINE.PROCESS_STATUS <> 'NOT_VALID'
4946: );
4947: IF l_debug_level > 0 THEN
4948: oe_debug_pub.add( 'INSERTED '||SQL%ROWCOUNT||' ATTRIBS' , 3 ) ;
4949: END IF;
4950: END IF;
4951:
4952: ELSE
4951:
4952: ELSE
4953: --RETOBILL REQUEST EVENT
4954: --Different handling..
4955: oe_debug_pub.add('Retro:Calling Oe_Retrobill_Pvt.Process_Retrobill_Adjustments,Operation:'||G_RETROBILL_OPERATION);
4956: Oe_Retrobill_Pvt.Process_Retrobill_Adjustments(G_RETROBILL_OPERATION);
4957: END IF;
4958: --RT}
4959:
4961: WHEN NO_DATA_FOUND THEN
4962: NULL;
4963: WHEN OTHERS THEN
4964: IF l_debug_level > 0 THEN
4965: oe_debug_pub.add( 'WRONG IN REFRESH_ADJ'||SQLERRM||L_STMT , 1 ) ;
4966: END IF;
4967: raise fnd_api.g_exc_error;
4968:
4969: End REFRESH_ADJS;
4981: is
4982: l_req_line_rec QP_PREQ_GRP.LINE_REC_TYPE;
4983: --l_line_index pls_integer := px_req_line_tbl.count;
4984: --
4985: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
4986: --
4987: begin
4988: G_STMT_NO := 'copy_Header_to_request#10';
4989: IF l_debug_level > 0 THEN
4986: --
4987: begin
4988: G_STMT_NO := 'copy_Header_to_request#10';
4989: IF l_debug_level > 0 THEN
4990: oe_debug_pub.add( 'ENTERING OE_ORDER_PRICE_PVT.COPY_HEADER_TO_REQUEST' , 1 ) ;
4991: END IF;
4992:
4993: --l_line_index := l_line_index+1;
4994: px_line_index := px_line_index+1;
5084: G_LIST_PRICE_OVERRIDE_FLAG_TBL(px_line_index):=NULL;
5085: G_CHARGE_PERIODICITY_CODE_TBL(px_line_index):=NULL;
5086:
5087: IF l_debug_level > 0 THEN
5088: oe_debug_pub.add( 'EXISTING OE_ORDER_PRICE_PVT.COPY_HEADER_TO_REQUEST' , 1 ) ;
5089: END IF;
5090:
5091: end copy_Header_to_request;
5092:
5115: x_item_rec OE_Order_Cache.Item_Rec_Type;
5116: l_fulfilled_qty NUMBER;
5117:
5118: --
5119: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
5120: --
5121: begin
5122: G_STMT_NO := 'copy_Line_to_request#10';
5123: IF l_debug_level > 0 THEN
5120: --
5121: begin
5122: G_STMT_NO := 'copy_Line_to_request#10';
5123: IF l_debug_level > 0 THEN
5124: oe_debug_pub.add( 'ENTERING OE_ORDER_PRICE_PVT.COPY_LINE_TO_REQUEST' , 1 ) ;
5125: END IF;
5126:
5127:
5128: --RT{
5127:
5128: --RT{
5129: IF p_line_rec.retrobill_request_id IS NOT NULL AND p_pricing_events <> 'RETROBILL' THEN
5130: --Do not price this retrobill line with other events
5131: oe_debug_pub.add( 'LEAVING OE_ORDER_PRICE_PVT.COPY_LINE_TO_REQUEST' , 1 ) ;
5132: RETURN;
5133: END IF;
5134: --RT}
5135:
5136:
5137:
5138: -- px_line_index := px_line_index+1;
5139: IF l_debug_level > 0 THEN
5140: oe_debug_pub.add( 'LINE ID:FROM COPY LINE TO REQUEST:'||P_LINE_REC.LINE_ID ) ;
5141: END IF;
5142: IF OE_CODE_CONTROL.Get_Code_Release_Level >= '110510' THEN
5143: px_req_line_tbl(px_line_index).line_id := p_Line_rec.line_id;
5144: px_req_line_tbl(px_line_index).LINE_TYPE_CODE := 'LINE';
5185:
5186: l_req_line_rec.CURRENCY_CODE :=
5187: OE_Order_PUB.g_hdr.transactional_curr_code;
5188: IF l_debug_level > 0 THEN
5189: oe_debug_pub.add( 'UNIT PRICE'||P_LINE_REC.UNIT_LIST_PRICE||L_REQ_LINE_REC.CURRENCY_CODE , 3 ) ;
5190: END IF;
5191: If p_Line_rec.unit_list_price_per_pqty <> FND_API.G_MISS_NUM Then
5192: l_req_line_rec.UNIT_PRICE := p_Line_rec.unit_list_price_per_pqty;
5193: Elsif p_line_rec.unit_list_price <> FND_API.G_MISS_NUM THEN
5199: l_req_line_rec.adjusted_unit_price := nvl(p_line_rec.unit_selling_price_per_pqty,
5200: nvl(p_line_rec.unit_selling_price,p_line_rec.unit_list_price));
5201: --bug 2650505
5202: IF l_debug_level > 0 THEN
5203: oe_debug_pub.add( 'ADJ PRICE 1:'||L_REQ_LINE_REC.ADJUSTED_UNIT_PRICE ) ;
5204: END IF;
5205: if l_req_line_rec.adjusted_unit_price = FND_API.G_MISS_NUM then
5206: l_req_line_rec.adjusted_unit_price := NULL;
5207: end if;
5240: ,p_target_uom => p_line_rec.Order_quantity_uom
5241: ,p_org_id => p_line_rec.org_id);
5242: END IF;
5243: IF (l_debug_level > 0) THEN
5244: oe_debug_pub.add('uom quantity:'||l_req_line_rec.uom_quantity, 3);
5245: oe_debug_pub.add('service start date:'||l_req_line_rec.contract_start_Date, 3);
5246: oe_debug_pub.add('service end date:'||l_req_line_rec.contract_end_date, 3);
5247: END IF;
5248: -- bug 4642002 end
5241: ,p_org_id => p_line_rec.org_id);
5242: END IF;
5243: IF (l_debug_level > 0) THEN
5244: oe_debug_pub.add('uom quantity:'||l_req_line_rec.uom_quantity, 3);
5245: oe_debug_pub.add('service start date:'||l_req_line_rec.contract_start_Date, 3);
5246: oe_debug_pub.add('service end date:'||l_req_line_rec.contract_end_date, 3);
5247: END IF;
5248: -- bug 4642002 end
5249: End If;
5242: END IF;
5243: IF (l_debug_level > 0) THEN
5244: oe_debug_pub.add('uom quantity:'||l_req_line_rec.uom_quantity, 3);
5245: oe_debug_pub.add('service start date:'||l_req_line_rec.contract_start_Date, 3);
5246: oe_debug_pub.add('service end date:'||l_req_line_rec.contract_end_date, 3);
5247: END IF;
5248: -- bug 4642002 end
5249: End If;
5250:
5336:
5337: End If;
5338:
5339: IF l_debug_level > 0 THEN
5340: oe_debug_pub.add( 'ITEM TYPE CODE'||P_LINE_REC.ITEM_TYPE_CODE , 3 ) ;
5341: END IF;
5342:
5343: l_req_line_rec.Active_date_first_type := 'ORD';
5344: l_req_line_rec.Active_date_first := OE_Order_Pub.G_HDR.Ordered_date;
5352: If l_req_line_rec.currency_code is NULL
5353: or l_req_line_rec.currency_code = FND_API.G_MISS_CHAR
5354: THEN
5355: IF l_debug_level > 0 THEN
5356: oe_debug_pub.add( 'CURRENCY CODE IS NULL' , 4 ) ;
5357: END IF;
5358: RAISE FND_API.G_EXC_ERROR;
5359: -- Question: Pricing Engine should populate g_currency_code?
5360: End If;
5377: -- bug 3658057
5378: l_fulfilled_qty := NVL(p_line_rec.fulfilled_quantity, NVL(p_line_rec.shipped_quantity, NVL(p_line_rec.ordered_quantity, 0)));
5379:
5380: IF l_debug_level > 0 THEN
5381: oe_debug_pub.add('l_fulfilled_qty:'|| l_fulfilled_qty);
5382: END IF;
5383:
5384: IF oe_line_util.dual_uom_control -- INVCONV Process_Characteristics
5385: (p_line_rec.inventory_item_id
5389:
5390: -- IF l_item_rec.ont_pricing_qty_source = 1 THEN -- INVCONV price by quantity 2
5391: IF l_item_rec.ont_pricing_qty_source = 'S' THEN -- INVCONV
5392: IF l_debug_level > 0 THEN
5393: oe_debug_pub.add( 'DUAL - ONT_PRICING_QTY_SOURCE = S IN OEXVOPRB.PLS ' ) ;
5394: END IF;
5395: l_req_line_rec.LINE_QUANTITY := p_Line_rec.Ordered_quantity2 ;
5396: l_req_line_rec.LINE_UOM_CODE := p_Line_rec.Ordered_quantity_uom2 ;
5397: G_catchweight_qty_tbl(px_line_index) := p_line_rec.shipped_quantity2;
5402: END IF;
5403:
5404:
5405: IF l_debug_level > 0 THEN
5406: oe_debug_pub.add('OM Order Qty:'||p_line_rec.ordered_quantity);
5407: oe_debug_pub.add('actual order qty :'|| g_actual_order_qty_tbl(px_line_index) ) ;
5408: END IF;
5409:
5410: else
5403:
5404:
5405: IF l_debug_level > 0 THEN
5406: oe_debug_pub.add('OM Order Qty:'||p_line_rec.ordered_quantity);
5407: oe_debug_pub.add('actual order qty :'|| g_actual_order_qty_tbl(px_line_index) ) ;
5408: END IF;
5409:
5410: else
5411: l_req_line_rec.LINE_QUANTITY := p_Line_rec.Ordered_quantity ;
5412: l_req_line_rec.LINE_UOM_CODE := p_Line_rec.Order_quantity_uom ;
5413: END IF;
5414:
5415: IF l_debug_level > 0 THEN
5416: oe_debug_pub.add( 'DUAL - PRICING QUANTITY IS : ' ||L_REQ_LINE_REC.LINE_QUANTITY ) ;
5417: END IF;
5418: IF l_debug_level > 0 THEN
5419: oe_debug_pub.add( 'DUAL - PRICING QUANTITY UOM IS : ' || L_REQ_LINE_REC.LINE_UOM_CODE )
5420: ;
5415: IF l_debug_level > 0 THEN
5416: oe_debug_pub.add( 'DUAL - PRICING QUANTITY IS : ' ||L_REQ_LINE_REC.LINE_QUANTITY ) ;
5417: END IF;
5418: IF l_debug_level > 0 THEN
5419: oe_debug_pub.add( 'DUAL - PRICING QUANTITY UOM IS : ' || L_REQ_LINE_REC.LINE_UOM_CODE )
5420: ;
5421: END IF;
5422: -- Pack J catchweight
5423: ELSIF OE_CODE_CONTROL.Code_Release_level >= '110510' THEN
5421: END IF;
5422: -- Pack J catchweight
5423: ELSIF OE_CODE_CONTROL.Code_Release_level >= '110510' THEN
5424: IF l_debug_level > 0 THEN
5425: oe_debug_pub.add('inventory_item_id:'|| p_line_rec.inventory_item_id);
5426: oe_debug_pub.add('ship_from_org_id :'|| p_line_rec.ship_from_org_id );
5427: END IF;
5428:
5429: IF (p_line_rec.inventory_item_id IS NOT NULL AND
5422: -- Pack J catchweight
5423: ELSIF OE_CODE_CONTROL.Code_Release_level >= '110510' THEN
5424: IF l_debug_level > 0 THEN
5425: oe_debug_pub.add('inventory_item_id:'|| p_line_rec.inventory_item_id);
5426: oe_debug_pub.add('ship_from_org_id :'|| p_line_rec.ship_from_org_id );
5427: END IF;
5428:
5429: IF (p_line_rec.inventory_item_id IS NOT NULL AND
5430: p_line_rec.inventory_item_id <> FND_API.G_MISS_NUM) AND
5433: x_item_rec := OE_Order_Cache.Load_Item (p_line_rec.inventory_item_id
5434: ,p_line_rec.ship_from_org_id);
5435: END IF;
5436: IF l_debug_level > 0 THEN
5437: oe_debug_pub.add('ont_pricing_qty_source:'|| l_item_rec.ont_pricing_qty_source);
5438: oe_debug_pub.add('tracking_quantity_ind:'|| l_item_rec.tracking_quantity_ind);
5439: oe_debug_pub.add('wms_enabled_flag:'|| l_item_rec.wms_enabled_flag);
5440: END IF;
5441: --IF x_item_rec.ont_pricing_qty_source = 1 AND -- INVCONV
5434: ,p_line_rec.ship_from_org_id);
5435: END IF;
5436: IF l_debug_level > 0 THEN
5437: oe_debug_pub.add('ont_pricing_qty_source:'|| l_item_rec.ont_pricing_qty_source);
5438: oe_debug_pub.add('tracking_quantity_ind:'|| l_item_rec.tracking_quantity_ind);
5439: oe_debug_pub.add('wms_enabled_flag:'|| l_item_rec.wms_enabled_flag);
5440: END IF;
5441: --IF x_item_rec.ont_pricing_qty_source = 1 AND -- INVCONV
5442: IF x_item_rec.ont_pricing_qty_source = 'S' AND -- INVCONV
5435: END IF;
5436: IF l_debug_level > 0 THEN
5437: oe_debug_pub.add('ont_pricing_qty_source:'|| l_item_rec.ont_pricing_qty_source);
5438: oe_debug_pub.add('tracking_quantity_ind:'|| l_item_rec.tracking_quantity_ind);
5439: oe_debug_pub.add('wms_enabled_flag:'|| l_item_rec.wms_enabled_flag);
5440: END IF;
5441: --IF x_item_rec.ont_pricing_qty_source = 1 AND -- INVCONV
5442: IF x_item_rec.ont_pricing_qty_source = 'S' AND -- INVCONV
5443: x_item_rec.tracking_quantity_ind = 'P' and
5447: END IF;
5448: IF p_Line_rec.Ordered_quantity2 IS NOT NULL THEN
5449: /*<< This should be possible for referenced returns if ordered qty2 is populated based on shipped_quantity2>> */
5450: IF l_debug_level > 0 THEN
5451: oe_debug_pub.add('Ordered_quantity2 is NOT null ');
5452: END IF;
5453: l_req_line_rec.LINE_QUANTITY := p_Line_rec.Ordered_quantity2 ;
5454: l_req_line_rec.LINE_UOM_CODE := p_Line_rec.Ordered_quantity_uom2 ;
5455: g_actual_order_qty_tbl(px_line_index) := l_fulfilled_qty; -- bug 3658057
5454: l_req_line_rec.LINE_UOM_CODE := p_Line_rec.Ordered_quantity_uom2 ;
5455: g_actual_order_qty_tbl(px_line_index) := l_fulfilled_qty; -- bug 3658057
5456: ELSE
5457: IF l_debug_level > 0 THEN
5458: oe_debug_pub.add('Ordered_quantity2 is null');
5459: END IF;
5460:
5461: l_dummy := WMS_CATCH_WEIGHT_GRP.Get_Default_Secondary_Quantity (
5462: p_api_version => 1.0
5470: , x_secondary_uom_code => x_secondary_uom_code --returns default catch wt uom
5471: );
5472:
5473: IF l_debug_level > 0 THEN
5474: oe_debug_pub.add('x_secondary_qauntity:'|| x_secondary_quantity);
5475: oe_debug_pub.add('x_secondary_uom_code:'|| x_secondary_uom_code);
5476: END IF;
5477: /* Populating x_secondary_uom_code with the value in x_item_rec, because wms api is returning null */
5478: x_secondary_uom_code := x_item_rec.secondary_uom_code;
5471: );
5472:
5473: IF l_debug_level > 0 THEN
5474: oe_debug_pub.add('x_secondary_qauntity:'|| x_secondary_quantity);
5475: oe_debug_pub.add('x_secondary_uom_code:'|| x_secondary_uom_code);
5476: END IF;
5477: /* Populating x_secondary_uom_code with the value in x_item_rec, because wms api is returning null */
5478: x_secondary_uom_code := x_item_rec.secondary_uom_code;
5479: IF l_debug_level > 0 THEN
5476: END IF;
5477: /* Populating x_secondary_uom_code with the value in x_item_rec, because wms api is returning null */
5478: x_secondary_uom_code := x_item_rec.secondary_uom_code;
5479: IF l_debug_level > 0 THEN
5480: oe_debug_pub.add('after populating from x_item_rec :');
5481: oe_debug_pub.add('x_secondary_uom_code : '||x_secondary_uom_code);
5482: END IF;
5483: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
5484: IF l_debug_level > 0 THEN
5477: /* Populating x_secondary_uom_code with the value in x_item_rec, because wms api is returning null */
5478: x_secondary_uom_code := x_item_rec.secondary_uom_code;
5479: IF l_debug_level > 0 THEN
5480: oe_debug_pub.add('after populating from x_item_rec :');
5481: oe_debug_pub.add('x_secondary_uom_code : '||x_secondary_uom_code);
5482: END IF;
5483: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
5484: IF l_debug_level > 0 THEN
5485: oe_debug_pub.add('Error getting secondary UOM/quantity from WMS API. Return Status: '||x_return_status||' msg_count:'||x_msg_count);
5481: oe_debug_pub.add('x_secondary_uom_code : '||x_secondary_uom_code);
5482: END IF;
5483: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
5484: IF l_debug_level > 0 THEN
5485: oe_debug_pub.add('Error getting secondary UOM/quantity from WMS API. Return Status: '||x_return_status||' msg_count:'||x_msg_count);
5486: END IF;
5487: oe_msg_pub.transfer_msg_stack;
5488: RAISE FND_API.G_EXC_ERROR;
5489: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
5487: oe_msg_pub.transfer_msg_stack;
5488: RAISE FND_API.G_EXC_ERROR;
5489: ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
5490: IF l_debug_level > 0 THEN
5491: oe_debug_pub.add('Error getting secondary UOM/quantity from WMS API. Return Status: '||x_return_status||' msg_count:'||x_msg_count);
5492: END IF;
5493: oe_msg_pub.transfer_msg_stack;
5494: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5495: END IF;
5500: g_actual_order_qty_tbl(px_line_index) := l_fulfilled_qty; -- bug3658057
5501: END IF; -- end check for ordered_quantity2
5502:
5503: IF l_debug_level > 0 THEN
5504: oe_debug_pub.add('fulfilled_quantity:'|| p_line_rec.fulfilled_quantity);
5505: oe_debug_pub.add('shipped_quantity:'|| p_line_rec.shipped_quantity);
5506: oe_debug_pub.add('shipped_quantity2 :'|| p_line_rec.shipped_quantity2);
5507: oe_debug_pub.add('source_type_code :'|| p_line_rec.source_type_code);
5508: oe_debug_pub.add('line_category_code :'|| p_line_rec.line_category_code);
5501: END IF; -- end check for ordered_quantity2
5502:
5503: IF l_debug_level > 0 THEN
5504: oe_debug_pub.add('fulfilled_quantity:'|| p_line_rec.fulfilled_quantity);
5505: oe_debug_pub.add('shipped_quantity:'|| p_line_rec.shipped_quantity);
5506: oe_debug_pub.add('shipped_quantity2 :'|| p_line_rec.shipped_quantity2);
5507: oe_debug_pub.add('source_type_code :'|| p_line_rec.source_type_code);
5508: oe_debug_pub.add('line_category_code :'|| p_line_rec.line_category_code);
5509: oe_debug_pub.add('reference_line_id :'|| p_line_rec.reference_line_id);
5502:
5503: IF l_debug_level > 0 THEN
5504: oe_debug_pub.add('fulfilled_quantity:'|| p_line_rec.fulfilled_quantity);
5505: oe_debug_pub.add('shipped_quantity:'|| p_line_rec.shipped_quantity);
5506: oe_debug_pub.add('shipped_quantity2 :'|| p_line_rec.shipped_quantity2);
5507: oe_debug_pub.add('source_type_code :'|| p_line_rec.source_type_code);
5508: oe_debug_pub.add('line_category_code :'|| p_line_rec.line_category_code);
5509: oe_debug_pub.add('reference_line_id :'|| p_line_rec.reference_line_id);
5510: END IF;
5503: IF l_debug_level > 0 THEN
5504: oe_debug_pub.add('fulfilled_quantity:'|| p_line_rec.fulfilled_quantity);
5505: oe_debug_pub.add('shipped_quantity:'|| p_line_rec.shipped_quantity);
5506: oe_debug_pub.add('shipped_quantity2 :'|| p_line_rec.shipped_quantity2);
5507: oe_debug_pub.add('source_type_code :'|| p_line_rec.source_type_code);
5508: oe_debug_pub.add('line_category_code :'|| p_line_rec.line_category_code);
5509: oe_debug_pub.add('reference_line_id :'|| p_line_rec.reference_line_id);
5510: END IF;
5511:
5504: oe_debug_pub.add('fulfilled_quantity:'|| p_line_rec.fulfilled_quantity);
5505: oe_debug_pub.add('shipped_quantity:'|| p_line_rec.shipped_quantity);
5506: oe_debug_pub.add('shipped_quantity2 :'|| p_line_rec.shipped_quantity2);
5507: oe_debug_pub.add('source_type_code :'|| p_line_rec.source_type_code);
5508: oe_debug_pub.add('line_category_code :'|| p_line_rec.line_category_code);
5509: oe_debug_pub.add('reference_line_id :'|| p_line_rec.reference_line_id);
5510: END IF;
5511:
5512: IF p_line_rec.shipped_quantity IS NOT NULL AND
5505: oe_debug_pub.add('shipped_quantity:'|| p_line_rec.shipped_quantity);
5506: oe_debug_pub.add('shipped_quantity2 :'|| p_line_rec.shipped_quantity2);
5507: oe_debug_pub.add('source_type_code :'|| p_line_rec.source_type_code);
5508: oe_debug_pub.add('line_category_code :'|| p_line_rec.line_category_code);
5509: oe_debug_pub.add('reference_line_id :'|| p_line_rec.reference_line_id);
5510: END IF;
5511:
5512: IF p_line_rec.shipped_quantity IS NOT NULL AND
5513: p_line_rec.shipped_quantity <> FND_API.G_MISS_NUM THEN
5537: G_catchweight_qty_tbl(px_line_index) :=l_shipped_quantity2;
5538: END IF; --check for reference_line_id
5539: ELSE /*<< raise error here if shipped_quantity exists but not shipped_quantity2>> -- This error should not be raised for returns and dropship orders. */
5540: IF l_debug_level > 0 THEN
5541: oe_debug_pub.add('Shipped_quantity2 is null and not dropship, return- Raise error');
5542: END IF;
5543: FND_MESSAGE.SET_NAME('ONT','ONT_CATCHWEIGHT_QTY2_REQUIRED');
5544: OE_MSG_PUB.Add;
5545: RAISE FND_API.G_EXC_ERROR;
5572: -- Override List Price
5573: END IF; -- bug 4938837
5574:
5575: IF l_debug_level > 0 THEN
5576: oe_debug_pub.add('list_price_override_flag:'||l_req_line_rec.list_price_override_flag);
5577: oe_debug_pub.add('unit_price:'||l_req_line_rec.unit_price);
5578: oe_debug_pub.add('line_unit_price:'||l_req_line_rec.line_unit_price);
5579: oe_debug_pub.add('unit_list_price_per_pqty:'||p_line_rec.unit_list_price_per_pqty);
5580: oe_debug_pub.add('original_list_price:'||p_line_rec.original_list_price||':unit_list_price:'||p_line_rec.unit_list_price);
5573: END IF; -- bug 4938837
5574:
5575: IF l_debug_level > 0 THEN
5576: oe_debug_pub.add('list_price_override_flag:'||l_req_line_rec.list_price_override_flag);
5577: oe_debug_pub.add('unit_price:'||l_req_line_rec.unit_price);
5578: oe_debug_pub.add('line_unit_price:'||l_req_line_rec.line_unit_price);
5579: oe_debug_pub.add('unit_list_price_per_pqty:'||p_line_rec.unit_list_price_per_pqty);
5580: oe_debug_pub.add('original_list_price:'||p_line_rec.original_list_price||':unit_list_price:'||p_line_rec.unit_list_price);
5581: END IF;
5574:
5575: IF l_debug_level > 0 THEN
5576: oe_debug_pub.add('list_price_override_flag:'||l_req_line_rec.list_price_override_flag);
5577: oe_debug_pub.add('unit_price:'||l_req_line_rec.unit_price);
5578: oe_debug_pub.add('line_unit_price:'||l_req_line_rec.line_unit_price);
5579: oe_debug_pub.add('unit_list_price_per_pqty:'||p_line_rec.unit_list_price_per_pqty);
5580: oe_debug_pub.add('original_list_price:'||p_line_rec.original_list_price||':unit_list_price:'||p_line_rec.unit_list_price);
5581: END IF;
5582: -- bug 2812566, set price_flag to be 'N' when line is cancelled
5575: IF l_debug_level > 0 THEN
5576: oe_debug_pub.add('list_price_override_flag:'||l_req_line_rec.list_price_override_flag);
5577: oe_debug_pub.add('unit_price:'||l_req_line_rec.unit_price);
5578: oe_debug_pub.add('line_unit_price:'||l_req_line_rec.line_unit_price);
5579: oe_debug_pub.add('unit_list_price_per_pqty:'||p_line_rec.unit_list_price_per_pqty);
5580: oe_debug_pub.add('original_list_price:'||p_line_rec.original_list_price||':unit_list_price:'||p_line_rec.unit_list_price);
5581: END IF;
5582: -- bug 2812566, set price_flag to be 'N' when line is cancelled
5583: IF p_line_rec.ordered_quantity = 0 THEN
5576: oe_debug_pub.add('list_price_override_flag:'||l_req_line_rec.list_price_override_flag);
5577: oe_debug_pub.add('unit_price:'||l_req_line_rec.unit_price);
5578: oe_debug_pub.add('line_unit_price:'||l_req_line_rec.line_unit_price);
5579: oe_debug_pub.add('unit_list_price_per_pqty:'||p_line_rec.unit_list_price_per_pqty);
5580: oe_debug_pub.add('original_list_price:'||p_line_rec.original_list_price||':unit_list_price:'||p_line_rec.unit_list_price);
5581: END IF;
5582: -- bug 2812566, set price_flag to be 'N' when line is cancelled
5583: IF p_line_rec.ordered_quantity = 0 THEN
5584: l_req_line_rec.PRICE_FLAG := 'N';
5584: l_req_line_rec.PRICE_FLAG := 'N';
5585: END IF;
5586:
5587: IF l_debug_level > 0 THEN
5588: oe_debug_pub.add( 'POPULATING BULK INSERT TABLES' , 4 ) ;
5589: oe_debug_pub.add('inserting line index:'||l_req_line_rec.line_index);
5590: END IF;
5591:
5592: G_LINE_INDEX_TBL(px_line_index) := l_req_line_rec.LINE_INDEX;
5585: END IF;
5586:
5587: IF l_debug_level > 0 THEN
5588: oe_debug_pub.add( 'POPULATING BULK INSERT TABLES' , 4 ) ;
5589: oe_debug_pub.add('inserting line index:'||l_req_line_rec.line_index);
5590: END IF;
5591:
5592: G_LINE_INDEX_TBL(px_line_index) := l_req_line_rec.LINE_INDEX;
5593: G_LINE_TYPE_CODE_TBL(px_line_index) := l_req_line_rec.LINE_TYPE_CODE;
5597: G_ACTIVE_DATE_SECOND_TBL(px_line_index) := TRUNC(l_req_line_rec.ACTIVE_DATE_SECOND);
5598: G_ACTIVE_DATE_SECOND_TYPE_TBL(px_line_index):= l_req_line_rec.ACTIVE_DATE_SECOND_TYPE;
5599: --l_req_line_rec.priced_quantity := NULL;
5600: IF l_debug_level > 0 THEN
5601: oe_debug_pub.add( 'QUANTITY'||L_REQ_LINE_REC.LINE_QUANTITY||' '||L_REQ_LINE_REC.PRICED_QUANTITY , 3 ) ;
5602: END IF;
5603: IF l_debug_level > 0 THEN
5604: oe_debug_pub.add( 'PRICE FLAG'||L_REQ_LINE_REC.PRICE_FLAG ) ;
5605: END IF;
5600: IF l_debug_level > 0 THEN
5601: oe_debug_pub.add( 'QUANTITY'||L_REQ_LINE_REC.LINE_QUANTITY||' '||L_REQ_LINE_REC.PRICED_QUANTITY , 3 ) ;
5602: END IF;
5603: IF l_debug_level > 0 THEN
5604: oe_debug_pub.add( 'PRICE FLAG'||L_REQ_LINE_REC.PRICE_FLAG ) ;
5605: END IF;
5606: G_LINE_QUANTITY_TBL(px_line_index) := l_req_line_rec.LINE_QUANTITY;
5607: G_LINE_UOM_CODE_TBL(px_line_index) := l_req_line_rec.LINE_UOM_CODE;
5608: G_REQUEST_TYPE_CODE_TBL(px_line_index) := l_req_line_rec.REQUEST_TYPE_CODE;
5612: G_CONTRACT_END_DATE_TBL(px_line_index) := l_req_line_rec.CONTRACT_END_DATE;
5613: G_PRICED_UOM_CODE_TBL(px_line_index) := l_req_line_rec.PRICED_UOM_CODE;
5614: G_CURRENCY_CODE_TBL(px_line_index) := l_req_line_rec.CURRENCY_CODE;
5615: IF l_debug_level > 0 THEN
5616: oe_debug_pub.add( 'UNIT PRICE'||L_REQ_LINE_REC.UNIT_PRICE||' '||L_REQ_LINE_REC.ADJUSTED_UNIT_PRICE ) ;
5617: END IF;
5618: G_UNIT_PRICE_TBL(px_line_index) := l_req_line_rec.unit_price; -- AG
5619: G_PERCENT_PRICE_TBL(px_line_index) := l_req_line_rec.PERCENT_PRICE;
5620: G_ADJUSTED_UNIT_PRICE_TBL(px_line_index) := l_req_line_rec.ADJUSTED_UNIT_PRICE;
5621: G_PROCESSED_FLAG_TBL(px_line_index) := QP_PREQ_GRP.G_NOT_PROCESSED;
5622: G_PRICE_FLAG_TBL(px_line_index) := l_req_line_rec.PRICE_FLAG;
5623: G_LINE_ID_TBL(px_line_index) := l_req_line_rec.LINE_ID;
5624: IF l_debug_level > 0 THEN
5625: oe_debug_pub.add( 'LINE ID IN G_LINE_ID_TBL:'|| G_LINE_ID_TBL ( PX_LINE_INDEX ) ) ;
5626: END IF;
5627: G_ROUNDING_FLAG_TBL(px_line_index) := G_ROUNDING_FLAG; -- AG
5628: G_ROUNDING_FACTOR_TBL(px_line_index) := l_req_line_rec.ROUNDING_FACTOR;
5629: G_PROCESSING_ORDER_TBL(px_line_index) := NULL;
5644: -- Bug3380345
5645: IF G_LIST_PRICE_OVERRIDE_FLAG_TBL(px_line_index) = 'Y' AND
5646: p_pricing_events = 'PRICE' THEN
5647: IF l_debug_level > 0 THEN
5648: oe_debug_pub.add( 'setting process code as UPDATED for override list price');
5649: END IF;
5650: G_PRICING_STATUS_CODE_tbl(px_line_index) := QP_PREQ_GRP.G_STATUS_UPDATED;
5651: END IF;
5652:
5651: END IF;
5652:
5653:
5654: IF l_debug_level > 0 THEN
5655: oe_debug_pub.add( 'EXISTING OE_ORDER_PRICE_PVT.COPY_LINE_TO_REQUEST' , 1 ) ;
5656: END IF;
5657:
5658: end copy_Line_to_request;
5659:
5661: IS
5662: l_return_status varchar2(1) := FND_API.G_RET_STS_SUCCESS;
5663: l_return_status_Text varchar2(240) ;
5664: --
5665: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
5666: --
5667: BEGIN
5668: IF l_debug_level > 0 THEN
5669: oe_debug_pub.add( 'BEFORE DIRECT INSERT INTO TEMP TABLE: BULK INSERT'||G_LINE_INDEX_TBL.COUNT , 1 ) ;
5665: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
5666: --
5667: BEGIN
5668: IF l_debug_level > 0 THEN
5669: oe_debug_pub.add( 'BEFORE DIRECT INSERT INTO TEMP TABLE: BULK INSERT'||G_LINE_INDEX_TBL.COUNT , 1 ) ;
5670: oe_debug_pub.add('G_CHARGE_PERIODICITY_CODE_TBL.Count:'||G_CHARGE_PERIODICITY_CODE_TBL.COUNT);
5671: END IF;
5672: QP_PREQ_GRP.INSERT_LINES2
5673: (p_LINE_INDEX => G_LINE_INDEX_TBL,
5666: --
5667: BEGIN
5668: IF l_debug_level > 0 THEN
5669: oe_debug_pub.add( 'BEFORE DIRECT INSERT INTO TEMP TABLE: BULK INSERT'||G_LINE_INDEX_TBL.COUNT , 1 ) ;
5670: oe_debug_pub.add('G_CHARGE_PERIODICITY_CODE_TBL.Count:'||G_CHARGE_PERIODICITY_CODE_TBL.COUNT);
5671: END IF;
5672: QP_PREQ_GRP.INSERT_LINES2
5673: (p_LINE_INDEX => G_LINE_INDEX_TBL,
5674: p_LINE_TYPE_CODE => G_LINE_TYPE_CODE_TBL,
5714: x_status_text =>l_return_status_text);
5715:
5716: IF l_return_status = FND_API.G_RET_STS_ERROR THEN
5717: IF l_debug_level > 0 THEN
5718: oe_debug_pub.add( 'WRONG IN INSERT_LINES2'||L_RETURN_STATUS_TEXT , 1 ) ;
5719: END IF;
5720: FND_MESSAGE.SET_NAME('ONT','ONT_PRICING_ERRORS'); --bug#7149497
5721: FND_MESSAGE.SET_TOKEN('ERR_TEXT',l_return_status_text);
5722: OE_MSG_PUB.Add;
5759: l_return_status_text );
5760:
5761: IF l_return_status = FND_API.G_RET_STS_ERROR THEN
5762: IF l_debug_level > 0 THEN
5763: oe_debug_pub.add( 'ERROR INSERTING INTO LINE ATTRS'||SQLERRM ) ;
5764: END IF;
5765: FND_MESSAGE.SET_NAME('ONT','ONT_PRICING_ERRORS'); --bug#7149497
5766: FND_MESSAGE.SET_TOKEN('ERR_TEXT',l_return_status_text);
5767: OE_MSG_PUB.Add;
5769: END IF;
5770:
5771: END IF;
5772: IF l_debug_level > 0 THEN
5773: oe_debug_pub.add( 'AFTER DIRECT INSERT INTO TEMP TABLE: BULK INSERT' , 1 ) ;
5774: END IF;
5775:
5776: EXCEPTION
5777: WHEN OTHERS THEN
5785: ) RETURN VARCHAR2
5786: IS
5787: l_total_lines NUMBER;
5788: l_num_changed_lines NUMBER;
5789: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
5790: i pls_integer;
5791: BEGIN
5792:
5793: -- only one changed line, query that line
5801: where header_id = p_header_id;
5802: EXCEPTION
5803: WHEN OTHERS THEN
5804: IF l_debug_level > 0 THEN
5805: oe_debug_pub.add('could not find out nocopy total number of lines!');
5806: END IF;
5807: RETURN 'N';
5808: END;
5809:
5808: END;
5809:
5810: IF (l_total_lines > OE_Line_Adj_Util.G_CHANGED_LINE_TBL.count) THEN
5811: IF l_debug_level > 0 THEN
5812: oe_debug_pub.add('total lines larger than changed '||l_total_lines
5813: ||' '||OE_Line_Adj_Util.G_CHANGED_LINE_TBL.count);
5814: END IF;
5815: RETURN 'N';
5816: ELSE
5814: END IF;
5815: RETURN 'N';
5816: ELSE
5817: IF l_debug_level > 0 THEN
5818: oe_debug_pub.add('total lines smaller than or equal to changed '||l_total_lines
5819: ||' '||OE_Line_Adj_Util.G_CHANGED_LINE_TBL.count);
5820: END IF;
5821:
5822: l_num_changed_lines := 0;
5828: i:= Oe_Line_Adj_Util.G_CHANGED_LINE_TBL.Next(i);
5829: End Loop;
5830:
5831: IF l_debug_level > 0 THEN
5832: oe_debug_pub.add('total changed lines in this order '||l_num_changed_lines);
5833: END IF;
5834: IF (l_total_lines = l_num_changed_lines) THEN
5835: RETURN 'Y';
5836: ELSE
5851: x_line_tbl OUT NOCOPY OE_ORDER_PUB.LINE_TBL_TYPE ) AS
5852: i PLS_INTEGER;
5853: l_line_rec OE_ORDER_PUB.LINE_REC_TYPE;
5854: j PLS_INTEGER;
5855: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
5856: BEGIN
5857: i := Oe_Line_Adj_Util.G_CHANGED_LINE_TBL.FIRST;
5858: j := 1;
5859: While i is Not Null Loop
5859: While i is Not Null Loop
5860: Begin
5861: --bug 3020702
5862: IF l_debug_level > 0 THEN
5863: oe_debug_pub.add('header_id:'||Oe_Line_Adj_Util.G_CHANGED_LINE_TBL(i).header_id);
5864: END IF;
5865: if oe_line_adj_util.G_CHANGED_LINE_TBL(i).header_id = p_header_id then
5866:
5867: IF l_debug_level > 0 THEN
5864: END IF;
5865: if oe_line_adj_util.G_CHANGED_LINE_TBL(i).header_id = p_header_id then
5866:
5867: IF l_debug_level > 0 THEN
5868: oe_debug_pub.add('query line_id:'||Oe_Line_Adj_Util.G_CHANGED_LINE_TBL(i).line_id);
5869: END IF;
5870: query_line(Oe_Line_Adj_Util.G_CHANGED_LINE_TBL(i).line_id,l_line_rec);
5871: x_line_tbl(j):=l_line_rec;
5872: j:=j+1;
5870: query_line(Oe_Line_Adj_Util.G_CHANGED_LINE_TBL(i).line_id,l_line_rec);
5871: x_line_tbl(j):=l_line_rec;
5872: j:=j+1;
5873:
5874: oe_debug_pub.add('link to line id:'|| l_line_rec.link_to_line_id);
5875:
5876: LOOP
5877: IF l_line_rec.link_to_line_id IS NOT null
5878: and l_line_rec.link_to_line_id <> FND_API.G_MISS_NUM
5896: end if;
5897: Exception
5898: When no_data_found Then
5899: IF l_debug_level > 0 THEN
5900: Oe_Debug_Pub.add('No data found for line id:'||Oe_Line_Adj_Util.G_CHANGED_LINE_TBL(i).line_id);
5901: END IF;
5902: End;
5903: i:= Oe_Line_Adj_Util.G_CHANGED_LINE_TBL.Next(i);
5904: End Loop;
5952: l_order_status_rec QP_UTIL_PUB.ORDER_LINES_STATUS_REC_TYPE;
5953: l_total_lines NUMBER;
5954: G_INT_CHANGED_LINE_ON Varchar2(3):= nvl(FND_PROFILE.VALUE('ONT_INTERNAL_CHANGED_LINE'),'Y');
5955: l_header_id2 NUMBER;
5956: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
5957: l_check_line_flag varchar2(1);
5958: l_pass_line varchar2(1);
5959: --2740845 begin
5960: l_agreement_name varchar2(240);
5964: --bug 3968023
5965: l_event_in_phase1 VARCHAR2(1);
5966:
5967: begin
5968: oe_debug_pub.add('Entering oe_order_price_pvt.calulate_adjustments', 1);
5969:
5970: reset_all_tbls;
5971: --DELETE FROM QP_PREQ_LINES_TMP;
5972: --DELETE FROM QP_PREQ_LINE_ATTRS_TMP;
6018: , x_header_rec=>oe_order_pub.g_hdr);
6019: Exception when no_data_found then
6020: x_return_status := 'NOOP';
6021: IF l_debug_level > 0 THEN
6022: oe_debug_pub.add( G_STMT_NO||'INVALID HEADER_ID '||P_HEADER_ID , 1 ) ;
6023: END IF;
6024: Return;
6025: End;
6026:
6027: G_STMT_NO := 'calculate_adjustments#40';
6028: j:=1;
6029:
6030: Begin
6031: oe_debug_pub.add('Before querying lines for header:'||p_Header_id||' event:'||p_pricing_events);
6032:
6033:
6034: -- How to determine whether all lines needs to be passed to Pricing Engine?
6035: -- 1. When BOOK button is pressed, all lines needs to be passed
6055: -- call lines to pricing engine.
6056: QP_UTIL_PUB.Get_Order_Lines_Status(p_pricing_events,l_order_status_rec);
6057:
6058:
6059: oe_debug_pub.add(' All_lines_flag returned from pricing:'||l_order_status_rec.all_lines_flag);
6060: oe_debug_pub.add(' Changed_lines_flag returned from pricing:'||l_order_status_rec.Changed_lines_flag);
6061:
6062:
6063: If l_order_status_rec.ALL_LINES_FLAG = 'Y' and nvl(OE_LINE_ADJ_UTIL.G_SEND_ALL_LINES_FOR_DSP,'Y') = 'Y' and p_pricing_events <> 'SHIP'
6056: QP_UTIL_PUB.Get_Order_Lines_Status(p_pricing_events,l_order_status_rec);
6057:
6058:
6059: oe_debug_pub.add(' All_lines_flag returned from pricing:'||l_order_status_rec.all_lines_flag);
6060: oe_debug_pub.add(' Changed_lines_flag returned from pricing:'||l_order_status_rec.Changed_lines_flag);
6061:
6062:
6063: If l_order_status_rec.ALL_LINES_FLAG = 'Y' and nvl(OE_LINE_ADJ_UTIL.G_SEND_ALL_LINES_FOR_DSP,'Y') = 'Y' and p_pricing_events <> 'SHIP'
6064: Then --bug 2965218
6078: Elsif l_order_status_rec.CHANGED_LINES_FLAG = 'Y' OR nvl(OE_LINE_ADJ_UTIL.G_SEND_ALL_LINES_FOR_DSP,'Y') = 'N' OR p_pricing_events = 'SHIP'
6079: Then
6080: IF Need_Query_All_Lines(p_header_id) = 'Y' THEN
6081: IF l_debug_level > 0 THEN
6082: oe_debug_pub.add(' Need query all lines because all lines are changed');
6083: END IF;
6084: G_PASS_ALL_LINES := 'Y';
6085: ELSE
6086: -------------------------------------------------------------------
6085: ELSE
6086: -------------------------------------------------------------------
6087: --Pricing says passing only changed lines, use query_line
6088: --------------------------------------------------------------------
6089: oe_debug_pub.add('Query individual line changed:'||OE_Line_Adj_Util.G_CHANGED_LINE_TBL.count);
6090:
6091: --bug4529937 have put the code to query for changed lines in a procedure
6092: Query_Changed_Lines(p_header_id => p_header_id,
6093: x_line_tbl => l_line_tbl);
6101: If G_PASS_ALL_LINES in ('Y', 'R') Then
6102: --bug4529937 if the call is from mass change api, and there are more lines remaining to be processed after the current set, we would just pass the changed lines to pricing engine
6103: IF oe_mass_change_pvt.Lines_Remaining = 'Y' THEN
6104: IF l_debug_level > 0 THEN
6105: oe_debug_pub.add(' Query only changed line');
6106: END IF;
6107: Query_Changed_Lines(p_header_id => p_header_id,
6108: x_line_tbl => l_line_tbl);
6109: l_all_lines_from_db := FALSE;
6108: x_line_tbl => l_line_tbl);
6109: l_all_lines_from_db := FALSE;
6110: ELSE
6111: IF l_debug_level > 0 THEN
6112: oe_debug_pub.add(' Pass all the lines');
6113: END IF;
6114: query_lines(p_header_id => p_Header_id, p_line_id => Null, x_line_tbl => l_Line_Tbl);
6115: --1472635
6116: l_all_lines_from_db := True;
6115: --1472635
6116: l_all_lines_from_db := True;
6117: END IF;
6118: End If;
6119: oe_debug_pub.add('line_count after querying:'||l_Line_Tbl.count);
6120:
6121: /* debug statement
6122: For i in l_Line_Tbl.first .. l_Line_Tbl.last Loop
6123: oe_debug_pub.add('line id in l_line_tbl!:'||l_Line_Tbl(i).line_id);
6119: oe_debug_pub.add('line_count after querying:'||l_Line_Tbl.count);
6120:
6121: /* debug statement
6122: For i in l_Line_Tbl.first .. l_Line_Tbl.last Loop
6123: oe_debug_pub.add('line id in l_line_tbl!:'||l_Line_Tbl(i).line_id);
6124: End Loop; */
6125:
6126: Exception when no_data_found then
6127: -- No need to process this order
6125:
6126: Exception when no_data_found then
6127: -- No need to process this order
6128: x_return_status := 'NOOP';
6129: oe_debug_pub.add(G_STMT_NO||'Invalid header_id '||p_Header_id,1);
6130: Return;
6131: End ;
6132:
6133: else -- Query the line Record
6141:
6142: Exception when no_data_found then
6143: -- No need to process this line
6144: x_return_status := 'NOOP';
6145: oe_debug_pub.add(G_STMT_NO||'Invalid line_id '||p_line_id,1);
6146: Return;
6147: End ;
6148: Else
6149: l_Line_Tbl := px_line_Tbl;
6157: , oe_order_pub.g_hdr);
6158: Exception when no_data_found then
6159: -- No need to process this order
6160: x_return_status := 'NOOP';
6161: oe_debug_pub.add(G_STMT_NO||'Invalid header_id '||l_line_Tbl(1).Header_id,1);
6162: Return;
6163: End ;
6164: Else
6165: --Do Nothing since the flag says that the global record has been set
6243: IF l_Line_Tbl(line_Tbl_Index).item_type_code = 'SERVICE' AND
6244: l_Line_Tbl(line_Tbl_Index).service_reference_type_code='CUSTOMER_PRODUCT' AND
6245: l_line_Tbl(line_Tbl_Index).cancelled_flag = 'N' AND
6246: l_Line_Tbl(line_Tbl_Index).service_reference_line_id IS NOT NULL THEN
6247: oe_debug_pub.add('1828553: Line is a customer product');
6248: OE_SERVICE_UTIL.Get_Cust_Product_Line_Id
6249: ( x_return_status => l_return_status
6250: , p_reference_line_id => l_Line_Tbl(line_Tbl_Index).service_reference_line_id
6251: , p_customer_id => l_Line_Tbl(line_Tbl_Index).sold_to_org_id
6251: , p_customer_id => l_Line_Tbl(line_Tbl_Index).sold_to_org_id
6252: , x_cust_product_line_id => l_order_line_id
6253: );
6254: IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
6255: oe_debug_pub.add('1828553: Success');
6256: oe_debug_pub.add('1828553: Service line id is ' || l_order_line_id)
6257: ;
6258: l_service_reference_line_id := l_order_line_id;
6259: ELSE
6252: , x_cust_product_line_id => l_order_line_id
6253: );
6254: IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
6255: oe_debug_pub.add('1828553: Success');
6256: oe_debug_pub.add('1828553: Service line id is ' || l_order_line_id)
6257: ;
6258: l_service_reference_line_id := l_order_line_id;
6259: ELSE
6260: oe_debug_pub.add('Not able to retrieve cust product line id');
6256: oe_debug_pub.add('1828553: Service line id is ' || l_order_line_id)
6257: ;
6258: l_service_reference_line_id := l_order_line_id;
6259: ELSE
6260: oe_debug_pub.add('Not able to retrieve cust product line id');
6261: RAISE NO_DATA_FOUND;
6262: END IF;
6263:
6264: ELSE
6264: ELSE
6265: l_service_reference_line_id := l_Line_Tbl(line_Tbl_Index).service_reference_line_id;
6266: END IF;
6267:
6268: oe_debug_pub.add('1828553: l_Service_Reference_Line_Id: '||l_Service_Reference_line_id);
6269: --3273289{
6270: If(l_Service_Reference_Line_Id is NOT NULL) THEN
6271: --bug 3968023 to call the procedure Get_The_Parent_Line only if the event contains phase 1
6272: BEGIN
6300:
6301: End If;
6302:
6303: IF OE_CODE_CONTROL.Get_Code_Release_Level >= '110509' THEN
6304: oe_debug_pub.add('calling get_prg_lines 5647210 added mass change');
6305: IF ((p_line_id IS NOT NULL and p_control_rec.p_write_to_db) OR oe_mass_change_pvt.Lines_Remaining = 'Y') THEN
6306: Get_PRG_Lines(l_line_tbl(line_tbl_index).line_id, l_line_tbl, line_tbl_index);
6307: -- 3529369 In the case overriding the list price of servicable line the service lines will be
6308: -- repriced if they are in the same order and service line has an service_reference_type of order
6336: AND l_line_tbl(line_tbl_index).cancelled_flag = 'N') THEN
6337:
6338: l_any_frozen_line := TRUE;
6339: x_any_frozen_line := TRUE;
6340: oe_debug_pub.add('Any frozen line is true');
6341: IF l_line_tbl(line_tbl_index).calculate_price_flag = 'P' THEN
6342: l_completely_frozen := FALSE;
6343:
6344: END IF;
6356: p_pricing_events <> 'RETROBILL' and nvl(l_line_tbl(line_tbl_index).retrobill_request_id,FND_API.G_MISS_NUM) <> FND_API.G_MISS_NUM THEN
6357: --Do nothing for these invalid combinations
6358: --RETROBILL event must have retrobill_request_id
6359: --Request None retrobill event with retrobill_request_id should be ignored
6360: oe_debug_pub.add('VOPRB:event'||p_pricing_events||'retrobill id:'||l_line_tbl(line_tbl_index).retrobill_request_id);
6361:
6362: NULL;
6363: ELSE
6364: --RT{
6372:
6373:
6374: G_STMT_NO := 'Build_Context for Line';
6375: If l_bypass_pricing = 'Y' OR l_line_tbl(line_tbl_index).calculate_price_flag = 'X' Then
6376: oe_debug_pub.add('Bypassing the qualifier build',1);
6377: l_check_line_flag := 'N';
6378: l_pass_line := 'Y';
6379: l_line_index := l_line_index + 1;
6380: Else
6377: l_check_line_flag := 'N';
6378: l_pass_line := 'Y';
6379: l_line_index := l_line_index + 1;
6380: Else
6381: oe_debug_pub.add('Before QP_Attr_Mapping_PUB.Build_Contexts for line',1);
6382: IF (G_PASS_ALL_LINES = 'R' and
6383: NOT OE_LINE_ADJ_UTIL.G_CHANGED_LINE_TBL.exists(mod(l_line_Tbl(line_tbl_index).line_id,G_BINARY_LIMIT)) and
6384: OE_CODE_CONTROL.Get_Code_Release_Level >= '110509') THEN
6385: l_check_line_flag := 'Y';
6404: --like to check the l_pass_line is needed #bug 289804100.
6405: --QP will need to unconditionally build sourcing.
6406: --BTEA
6407:
6408: oe_debug_pub.add('p_header_id:'||nvl(p_header_id,-100));
6409:
6410: IF p_header_id IS NULL THEN
6411: l_check_line_flag := 'N';
6412: END IF;
6412: END IF;
6413: -- bug 3643645
6414: l_line_index := l_line_index + 1;
6415: if (l_debug_level > 0) Then
6416: oe_debug_pub.add('before build_context:'||l_line_index);
6417: end if;
6418: QP_Attr_Mapping_PUB.Build_Contexts(
6419: p_request_type_code => 'ONT',
6420: p_line_index => l_line_index,
6428: l_line_index := l_line_index - 1;
6429: END IF;
6430:
6431: if (l_debug_level > 0) Then
6432: oe_debug_pub.add('after build_context:'||l_line_index);
6433: end if;
6434: End If; -- bypass pricing
6435:
6436: IF l_debug_level > 0 THEN
6433: end if;
6434: End If; -- bypass pricing
6435:
6436: IF l_debug_level > 0 THEN
6437: oe_debug_pub.add('check line'||l_check_line_flag||' pass line:'||l_pass_line);
6438: END IF;
6439:
6440: If l_check_line_flag = 'N' or l_pass_line = 'Y' Then
6441:
6519: l_message_displayed := TRUE;
6520: End If;
6521:
6522: l_any_frozen_line:=FALSE;
6523: oe_debug_pub.add('BCT:ONT_LINE_FROZEN');
6524: Elsif l_all_lines_from_db = False Then
6525: --1472635
6526: --Didn't query from db, need to do that to check if
6527: --all other previously save lines is frozen
6524: Elsif l_all_lines_from_db = False Then
6525: --1472635
6526: --Didn't query from db, need to do that to check if
6527: --all other previously save lines is frozen
6528: oe_debug_pub.add('BCT all line from db is false');
6529:
6530: If p_header_id is null then
6531: --ine_tbl_index := l_line_tbl.first;
6532: l_header_id := l_line_tbl(l_line_tbl.first).header_id;
6532: l_header_id := l_line_tbl(l_line_tbl.first).header_id;
6533: Else
6534: l_header_id := p_header_id;
6535: End If;
6536: oe_debug_pub.add('BCT order header id '||l_header_id);
6537:
6538:
6539: Begin
6540: BEGIN
6577: If nvl(l_calculate_price_flag,'X') not in ('N','P') Then
6578: l_calculate_price_flag:='Y';
6579: End If;
6580: ELSE
6581: oe_debug_pub.add('BCT:any_frozen_line is false');
6582: l_calculate_price_flag := 'Y';
6583: END IF;
6584: END IF; --end if for honor price flag check
6585:
6595: );
6596: G_STMT_NO := 'Build_Context for Header';
6597: IF l_bypass_pricing = 'Y' Then
6598:
6599: oe_debug_pub.add('Bypassing the qualifier build',1);
6600: Else
6601: oe_debug_pub.add('Before QP_Attr_Mapping_PUB.Build_Contexts for Header',1);
6602: QP_Attr_Mapping_PUB.Build_Contexts(
6603: p_request_type_code => 'ONT',
6597: IF l_bypass_pricing = 'Y' Then
6598:
6599: oe_debug_pub.add('Bypassing the qualifier build',1);
6600: Else
6601: oe_debug_pub.add('Before QP_Attr_Mapping_PUB.Build_Contexts for Header',1);
6602: QP_Attr_Mapping_PUB.Build_Contexts(
6603: p_request_type_code => 'ONT',
6604: --p_line_index=> l_line_index,
6605: p_line_index=> l_line_index, --oe_order_pub.g_hdr.header_id,
6628: );
6629: Exception
6630: when no_data_found then null;
6631: when others then
6632: Oe_Debug_Pub.Add('Error when querying asked_for:'||SQLERRM);
6633: End;
6634:
6635: G_STMT_NO := 'calculate_adjustments#180';
6636: -- AG change --
6644: px_line_tbl := l_line_tbl;
6645:
6646: exception
6647: when FND_API.G_EXC_ERROR then
6648: oe_debug_pub.add('error in calculate adjustments'||G_STMT_NO, 2);
6649: RAISE FND_API.G_EXC_ERROR;
6650: when others then
6651: oe_debug_pub.add('others error in calculate adjustments'||G_STMT_NO,2);
6652: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
6647: when FND_API.G_EXC_ERROR then
6648: oe_debug_pub.add('error in calculate adjustments'||G_STMT_NO, 2);
6649: RAISE FND_API.G_EXC_ERROR;
6650: when others then
6651: oe_debug_pub.add('others error in calculate adjustments'||G_STMT_NO,2);
6652: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
6653: End Calculate_Adjustments;
6654:
6655:
6681: x_Req_LINE_DETAIL_attr_tbl QP_PREQ_GRP.LINE_DETAIL_ATTR_TBL_TYPE;
6682: x_Req_related_lines_tbl QP_PREQ_GRP.RELATED_LINES_TBL_TYPE;
6683: */
6684: --
6685: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
6686: --
6687: BEGIN
6688: IF l_debug_level > 0 THEN
6689: oe_debug_pub.add( 'BEFORE QP_PREQ_PUB.PRICE_REQUEST' , 1 ) ;
6685: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
6686: --
6687: BEGIN
6688: IF l_debug_level > 0 THEN
6689: oe_debug_pub.add( 'BEFORE QP_PREQ_PUB.PRICE_REQUEST' , 1 ) ;
6690: END IF;
6691:
6692: l_control_rec.calculate_flag := p_control_rec.p_calculate_flag;
6693: l_control_rec.simulation_flag := p_control_rec.p_simulation_flag;
6712:
6713: -- added for freight rating.
6714: l_control_rec.get_freight_flag := p_control_rec.p_get_freight_flag;
6715: IF l_debug_level > 0 THEN
6716: oe_debug_pub.add('get_freight_flag before calling pricing engine is: '||l_control_rec.get_freight_flag, 3 ) ;
6717: END IF;
6718:
6719: IF (G_PASS_ALL_LINES in ('N', 'R')) THEN
6720: l_control_rec.full_pricing_call := 'N';
6773: l_return_status varchar2(30);
6774: l_x_msg_count number;
6775: l_x_msg_data Varchar2(2000);
6776: l_x_result_out Varchar2(30);
6777: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
6778:
6779: begin
6780:
6781: l_hold_source_rec.hold_id := G_SEEDED_PRICE_ERROR_HOLD_ID;
6783: l_hold_source_rec.Hold_Entity_code := 'O';
6784: l_hold_source_rec.header_id := p_header_id;
6785: l_hold_source_rec.line_id := p_line_id;
6786: IF l_debug_level > 0 THEN
6787: oe_debug_pub.add('p_line_id = '||p_line_id,1);
6788: END IF;
6789:
6790: OE_Holds_Pub.Check_Holds(
6791: p_api_version => 1.0
6802: );
6803:
6804: IF (l_return_status <> FND_API.g_ret_sts_success) THEN
6805: IF l_debug_level > 0 THEN
6806: oe_debug_pub.add(' OE_HOLD_PUB.Check_Holds returns unexpected error!');
6807: END IF;
6808: RAISE FND_API.G_EXC_ERROR;
6809: null;
6810: END IF;
6821: END IF;
6822:
6823: IF l_return_status = FND_API.g_ret_sts_success then
6824: IF l_debug_level > 0 THEN
6825: oe_debug_pub.add('just before showing formula error',1);
6826: END IF;
6827:
6828: FND_MESSAGE.SET_NAME('ONT','ONT_PRICING_ERROR_HOLD');
6829: FND_MESSAGE.SET_TOKEN('ERR_TEXT',pmsg);
6850: return l_formula_name;
6851: close get_formula;
6852: Exception
6853: when no_data_found then
6854: oe_debug_pub.add('Formula name not found for the errorneous formula');
6855: return null;
6856: End;
6857:
6858: procedure Report_Engine_Errors(
6927: --and lines.pricing_status_code in (QP_PREQ_GRP.G_STATUS_UPDATED
6928: -- , QP_PREQ_GRP.G_STATUS_GSA_VIOLATION
6929: -- );
6930: --
6931: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
6932: --
6933: begin
6934: -- Update Order Lines
6935: IF l_debug_level > 0 THEN
6932: --
6933: begin
6934: -- Update Order Lines
6935: IF l_debug_level > 0 THEN
6936: oe_debug_pub.add( 'ENTERING OE_ORDER_PRICE_PVT.REPORT_ENGINE_ERROR' , 1 ) ;
6937: END IF;
6938: --bug 3696768
6939: IF G_IPL_ERRORS_TBL.count <> 0 THEN
6940: FOR I in reset_ipl_tbl LOOP
6956: , x_line_rec => l_line_rec);
6957: Exception when no_data_found then
6958: null;
6959: IF l_debug_level > 0 THEN
6960: oe_debug_pub.add( 'REPORT_ENGINE_ERROR QUERY_LINE , NO DATA FOUND' ) ;
6961: END IF;
6962: End;
6963: Else
6964: J:= px_Line_Tbl.First;
6963: Else
6964: J:= px_Line_Tbl.First;
6965: While J is not null loop
6966: IF l_debug_level > 0 THEN
6967: oe_debug_pub.add( 'ERROR '||J||' LINE'||PX_LINE_TBL ( J ) .LINE_ID||' '||WRONG_LINE.LINE_ID ) ;
6968: END IF;
6969: If px_Line_Tbl(j).line_id = wrong_line.line_id
6970: --or
6971: -- J = wrong_line.line_index
6971: -- J = wrong_line.line_index
6972: then
6973: l_line_rec := px_Line_Tbl(J);
6974: IF l_debug_level > 0 THEN
6975: oe_debug_pub.add( 'PRICE'||L_LINE_REC.UNIT_LIST_PRICE||'+'||L_LINE_REC.UNIT_LIST_PRICE_PER_PQTY ) ;
6976: END IF;
6977: exit;
6978: End if;
6979: J:= px_Line_Tbl.next(j);
6995: ,p_source_document_line_id => l_line_rec.source_document_line_id
6996: );
6997:
6998: IF l_debug_level > 0 THEN
6999: oe_debug_pub.add( 'THE STATUS'||WRONG_LINE.PRICING_STATUS_CODE||':'||WRONG_LINE.PROCESSED_CODE||':'||WRONG_LINE.STATUS_TEXT ) ;
7000: END IF;
7001: l_invalid_line := 'N';
7002: -- add message when the price list is found to be inactive
7003: /*IF wrong_line.line_Type_code ='LINE' and
7007: and
7008: G_IPL_ERRORS_TBL(MOD(l_line_rec.line_id,G_BINARY_LIMIT))<>l_line_rec.price_list_id)
7009: Then
7010: IF l_debug_level > 0 THEN
7011: oe_debug_pub.add( 'PRICE LIST NOT FOUND' ) ;
7012: END IF;
7013: IF l_debug_level > 0 THEN
7014: oe_debug_pub.add( 'INVALID PRICE LIST ' , 1 ) ;
7015: END IF;
7010: IF l_debug_level > 0 THEN
7011: oe_debug_pub.add( 'PRICE LIST NOT FOUND' ) ;
7012: END IF;
7013: IF l_debug_level > 0 THEN
7014: oe_debug_pub.add( 'INVALID PRICE LIST ' , 1 ) ;
7015: END IF;
7016: FND_MESSAGE.SET_NAME('ONT','ONT_NO_PRICE_LIST_FOUND');
7017: FND_MESSAGE.SET_TOKEN('ITEM',nvl(l_line_rec.Ordered_Item,l_line_rec.inventory_item_id));
7018: FND_MESSAGE.SET_TOKEN('UOM',l_line_rec.Order_Quantity_uom);
7055: End;
7056:
7057: If wrong_line.pricing_status_code = QP_PREQ_GRP.G_STATUS_INVALID_PRICE_LIST then
7058: IF l_debug_level > 0 THEN
7059: oe_debug_pub.add( 'INVALID ITEM/PRICE LIST COMBINATION'||L_LINE_REC.ORDERED_ITEM||L_LINE_REC.ORDER_QUANTITY_UOM||L_PRICE_LIST ) ;
7060: END IF;
7061:
7062:
7063: IF not G_IPL_ERRORS_TBL.exists(MOD(l_line_rec.line_id,G_BINARY_LIMIT))
7087: G_IPL_ERRORS_TBL(MOD(l_line_rec.line_id,G_BINARY_LIMIT)):=l_line_rec.price_list_id;
7088: END IF;
7089:
7090: IF l_debug_level > 0 THEN
7091: oe_debug_pub.add( 'BEFORE CHECKING BOOK FLAG' ) ;
7092: END IF;
7093:
7094: If nvl(l_line_rec.booked_flag,'X') = 'Y' Then
7095: IF l_debug_level > 0 THEN
7092: END IF;
7093:
7094: If nvl(l_line_rec.booked_flag,'X') = 'Y' Then
7095: IF l_debug_level > 0 THEN
7096: oe_debug_pub.add( ' EXCEPTION: PRICE LIST MISSING FOR BOOKED ORDER' ) ;
7097: END IF;
7098: FND_MESSAGE.SET_NAME('ONT','OE_BOOK_REQD_LINE_ATTRIBUTE');
7099: FND_MESSAGE.SET_TOKEN('ATTRIBUTE',OE_ORDER_UTIL.GET_ATTRIBUTE_NAME('UNIT_LIST_PRICE'));
7100: OE_MSG_PUB.ADD;
7100: OE_MSG_PUB.ADD;
7101: RAISE FND_API.G_EXC_ERROR;
7102: End If;
7103: IF l_debug_level > 0 THEN
7104: oe_debug_pub.add( 'PRICE'||L_LINE_REC.UNIT_SELLING_PRICE||':'||L_LINE_REC.UNIT_LIST_PRICE ) ;
7105: END IF;
7106:
7107: --Fix bug 1650637
7108: If (l_line_rec.unit_selling_price Is Not Null or
7115: l_line_rec.unit_list_price_per_pqty := NULL;
7116: END IF;
7117:
7118: IF l_debug_level > 0 THEN
7119: oe_debug_pub.add('invalid price done');
7120: END IF;
7121: Elsif wrong_line.pricing_status_code = QP_PREQ_GRP.G_STS_LHS_NOT_FOUND Then
7122: IF l_debug_level > 0 THEN
7123: oe_debug_pub.add( 'PRICE LIST NOT FOUND' ) ;
7119: oe_debug_pub.add('invalid price done');
7120: END IF;
7121: Elsif wrong_line.pricing_status_code = QP_PREQ_GRP.G_STS_LHS_NOT_FOUND Then
7122: IF l_debug_level > 0 THEN
7123: oe_debug_pub.add( 'PRICE LIST NOT FOUND' ) ;
7124: END IF;
7125: FND_MESSAGE.SET_NAME('ONT','ONT_NO_PRICE_LIST_FOUND');
7126: FND_MESSAGE.SET_TOKEN('ITEM',nvl(l_line_rec.Ordered_Item,l_line_rec.inventory_item_id));
7127: FND_MESSAGE.SET_TOKEN('UOM',l_line_rec.Order_Quantity_uom);
7135: OE_MSG_PUB.Add;
7136: end if;
7137: Elsif wrong_line.pricing_status_code = QP_PREQ_GRP.G_STATUS_FORMULA_ERROR then
7138: IF l_debug_level > 0 THEN
7139: oe_debug_pub.add( 'ERROR IN FORMULA PROCESSING' ) ;
7140: END IF;
7141: FND_MESSAGE.SET_NAME('ONT','ONT_PRC_ERROR_IN_FORMULA');
7142: FND_MESSAGE.SET_TOKEN('ERR_TEXT',wrong_line.status_text||','||get_formula(wrong_line.line_index));
7143: IF OE_CODE_CONTROL.Get_Code_Release_Level >= '110509' THEN
7153: ( QP_PREQ_GRP.G_STATUS_OTHER_ERRORS , FND_API.G_RET_STS_UNEXP_ERROR,
7154: FND_API.G_RET_STS_ERROR)
7155: then
7156: IF l_debug_level > 0 THEN
7157: oe_debug_pub.add( 'OTHER ERRORS PROCESSING' ) ;
7158: END IF;
7159: FND_MESSAGE.SET_NAME('ONT','ONT_PRICING_ERRORS'); --bug#7149497
7160: FND_MESSAGE.SET_TOKEN('ERR_TEXT',wrong_line.status_text);
7161: IF OE_CODE_CONTROL.Get_Code_Release_Level >= '110509' THEN
7168: OE_MSG_PUB.Add;
7169: end if;
7170: Elsif wrong_line.pricing_status_code = QP_PREQ_GRP.G_STATUS_INVALID_UOM then
7171: IF l_debug_level > 0 THEN
7172: oe_debug_pub.add( 'INVALID UOM' ) ;
7173: END IF;
7174: FND_MESSAGE.SET_NAME('ONT','ONT_PRC_INVALID_UOM');
7175: FND_MESSAGE.SET_TOKEN('ITEM',nvl(l_line_rec.Ordered_Item,l_line_rec.inventory_item_id));
7176: FND_MESSAGE.SET_TOKEN('UOM',l_line_rec.Order_Quantity_uom);
7184: OE_MSG_PUB.Add;
7185: end if;
7186: Elsif wrong_line.pricing_status_code = QP_PREQ_GRP.G_STATUS_DUP_PRICE_LIST then
7187: IF l_debug_level > 0 THEN
7188: oe_debug_pub.add( 'DUPLICATE PRICE LIST' ) ;
7189: END IF;
7190: FND_MESSAGE.SET_NAME('ONT','ONT_PRC_DUPLICATE_PRICE_LIST');
7191:
7192: Begin
7232: OE_MSG_PUB.Add;
7233: end if;
7234: Elsif wrong_line.pricing_status_code = QP_PREQ_GRP.G_STATUS_INVALID_UOM_CONV then
7235: IF l_debug_level > 0 THEN
7236: oe_debug_pub.add( 'INVALID UOM CONVERSION' ) ;
7237: END IF;
7238: FND_MESSAGE.SET_NAME('ONT','ONT_PRC_INVALID_UOM_CONVERSION');
7239: FND_MESSAGE.SET_TOKEN('UOM_TEXT','( '||l_line_rec.Ordered_Item||' ) '||
7240: wrong_line.status_text);
7248: OE_MSG_PUB.Add;
7249: end if;
7250: Elsif wrong_line.pricing_status_code = QP_PREQ_GRP.G_STATUS_INVALID_INCOMP then
7251: IF l_debug_level > 0 THEN
7252: oe_debug_pub.add( 'UNABLE TO RESOLVE INCOMPATIBILITY' ) ;
7253: END IF;
7254: FND_MESSAGE.SET_NAME('ONT','ONT_PRC_INVALID_INCOMP');
7255: FND_MESSAGE.SET_TOKEN('ERR_TEXT','( '||
7256: l_line_rec.Ordered_Item||' ) '||wrong_line.status_text);
7264: OE_MSG_PUB.Add;
7265: end if;
7266: Elsif wrong_line.pricing_status_code = QP_PREQ_GRP.G_STATUS_BEST_PRICE_EVAL_ERROR then
7267: IF l_debug_level > 0 THEN
7268: oe_debug_pub.add( 'ERROR WHILE EVALUATING THE BEST PRICE' ) ;
7269: END IF;
7270: FND_MESSAGE.SET_NAME('ONT','ONT_PRC_BEST_PRICE_ERROR');
7271: FND_MESSAGE.SET_TOKEN('ITEM',nvl(l_line_rec.Ordered_Item,l_line_rec.inventory_item_id));
7272: FND_MESSAGE.SET_TOKEN('ERR_TEXT',wrong_line.status_text);
7299: --since the line_rec doesn't have the place holder to hold error status
7300: l_line_rec.industry_attribute30
7301: := wrong_line.pricing_status_code;
7302: IF l_debug_level > 0 THEN
7303: oe_debug_pub.add( 'J IS '||J ) ;
7304: END IF;
7305: if (j<>0) THEN
7306: px_line_tbl(j) := l_line_rec;
7307: END IF;
7306: px_line_tbl(j) := l_line_rec;
7307: END IF;
7308:
7309: IF l_debug_level > 0 THEN
7310: oe_debug_pub.add( 'PASSING BACK PRICE'||L_LINE_REC.UNIT_LIST_PRICE||' '||L_LINE_REC.UNIT_SELLING_PRICE ) ;
7311: END IF;
7312: IF l_debug_level > 0 THEN
7313: oe_debug_pub.add( 'LINE'||L_LINE_REC.HEADER_ID||'+'||L_LINE_REC.LINE_ID ) ;
7314: END IF;
7309: IF l_debug_level > 0 THEN
7310: oe_debug_pub.add( 'PASSING BACK PRICE'||L_LINE_REC.UNIT_LIST_PRICE||' '||L_LINE_REC.UNIT_SELLING_PRICE ) ;
7311: END IF;
7312: IF l_debug_level > 0 THEN
7313: oe_debug_pub.add( 'LINE'||L_LINE_REC.HEADER_ID||'+'||L_LINE_REC.LINE_ID ) ;
7314: END IF;
7315: End If;
7316: --btea end
7317:
7328: (wrong_line.unit_price <0 or wrong_line.adjusted_unit_price<0)
7329: Then
7330:
7331: IF l_debug_level > 0 THEN
7332: oe_debug_pub.add( 'NEGATIVE LIST PRICE '||WRONG_LINE.UNIT_PRICE ||'OR SELLING PRICE '||WRONG_LINE.ADJUSTED_UNIT_PRICE ) ;
7333: END IF;
7334: FND_MESSAGE.SET_NAME('ONT','ONT_NEGATIVE_PRICE');
7335: FND_MESSAGE.SET_TOKEN('ITEM',nvl(l_line_rec.Ordered_Item,l_line_rec.inventory_item_id));
7336: FND_MESSAGE.SET_TOKEN('LIST_PRICE',wrong_line.unit_price);
7336: FND_MESSAGE.SET_TOKEN('LIST_PRICE',wrong_line.unit_price);
7337: FND_MESSAGE.SET_TOKEN('SELLING_PRICE',wrong_line.Adjusted_unit_price);
7338: OE_MSG_PUB.Add;
7339: IF l_debug_level > 0 THEN
7340: oe_debug_pub.add( 'BEFORE SHOWING NEGATIVE MODIFIERS MESSAGE' ) ;
7341: END IF;
7342: l_list_line_no:=get_list_lines(wrong_line.line_id);
7343:
7344: IF l_list_line_no IS NOT NULL THEN
7347: OE_MSG_PUB.Add;
7348: END IF;
7349:
7350: IF l_debug_level > 0 THEN
7351: oe_debug_pub.add( 'MODIFIERS:'||GET_LIST_LINES ( WRONG_LINE.LINE_ID ) ) ;
7352: END IF;
7353:
7354: --place the line on invoicing hold to avoid stuck order it the ship quatity is there.
7355: IF l_line_rec.shipped_quantity is not null and l_line_rec.shipped_quantity <> FND_API.G_MISS_NUM THEN
7353:
7354: --place the line on invoicing hold to avoid stuck order it the ship quatity is there.
7355: IF l_line_rec.shipped_quantity is not null and l_line_rec.shipped_quantity <> FND_API.G_MISS_NUM THEN
7356: vmsg := FND_MESSAGE.GET;
7357: oe_debug_pub.add('vmsg = '||vmsg,1);
7358: pricing_errors_hold(l_line_rec.header_id,l_line_rec.line_id,vmsg);
7359: -- select oe_msg_request_id_s.nextval into l_request_id from dual;
7360: -- OE_MSG_PUB.INSERT_MESSAGE(OE_MSG_PUB.COUNT_MSG, l_request_id,'U');
7361: -- 4919922
7373: end if;
7374:
7375: IF wrong_line.line_type_code='ORDER' THEN
7376: if wrong_line.pricing_status_code = QP_PREQ_GRP.G_STATUS_FORMULA_ERROR then
7377: oe_debug_pub.add( 'ERROR IN ORDER LEVEL FORMULA PROCESSING' ) ;
7378: FND_MESSAGE.SET_NAME('ONT','ONT_PRC_ERROR_IN_FORMULA');
7379: FND_MESSAGE.SET_TOKEN('ERR_TEXT',wrong_line.status_text||','||get_formula(wrong_line.line_index));
7380: OE_MSG_PUB.Add;
7381: vmsg := FND_MESSAGE.GET;
7379: FND_MESSAGE.SET_TOKEN('ERR_TEXT',wrong_line.status_text||','||get_formula(wrong_line.line_index));
7380: OE_MSG_PUB.Add;
7381: vmsg := FND_MESSAGE.GET;
7382: else
7383: oe_debug_pub.add( 'OTHER ERRORS PROCESSING' ) ;
7384: FND_MESSAGE.SET_NAME('ONT','ONT_PRICING_ERRORS'); --bug#7149497
7385: FND_MESSAGE.SET_TOKEN('ERR_TEXT',wrong_line.status_text);
7386: OE_MSG_PUB.Add;
7387: vmsg := FND_MESSAGE.GET;
7391: If l_invalid_line = 'Y' Then
7392: IF OE_CODE_CONTROL.Get_Code_Release_Level >= '110509' THEN
7393: if l_line_rec.shipped_quantity is not null and l_line_rec.shipped_quantity <> FND_API.G_MISS_NUM then
7394: IF l_debug_level > 0 THEN
7395: oe_debug_pub.add('vmsg = '||vmsg,1);
7396: END IF;
7397: pricing_errors_hold(l_line_rec.header_id,l_line_rec.line_id,vmsg);
7398: -- select oe_msg_request_id_s.nextval into l_request_id from dual;
7399:
7406: OE_MSG_PUB.INSERT_MESSAGE(OE_MSG_PUB.COUNT_MSG, G_REQUEST_ID,'U');
7407: END IF;
7408:
7409: else
7410: oe_debug_pub.add('has invalid line');
7411: l_temp_line_rec.line_id := Wrong_line.line_id;
7412: oe_debug_pub.add('has invalid line2');
7413: l_temp_line_rec.ordered_quantity := Wrong_line.line_quantity;
7414: oe_debug_pub.add('has invalid line3');
7408:
7409: else
7410: oe_debug_pub.add('has invalid line');
7411: l_temp_line_rec.line_id := Wrong_line.line_id;
7412: oe_debug_pub.add('has invalid line2');
7413: l_temp_line_rec.ordered_quantity := Wrong_line.line_quantity;
7414: oe_debug_pub.add('has invalid line3');
7415: l_temp_line_rec.pricing_quantity := Wrong_line.priced_quantity;
7416: oe_debug_pub.add('has invalid line4');
7410: oe_debug_pub.add('has invalid line');
7411: l_temp_line_rec.line_id := Wrong_line.line_id;
7412: oe_debug_pub.add('has invalid line2');
7413: l_temp_line_rec.ordered_quantity := Wrong_line.line_quantity;
7414: oe_debug_pub.add('has invalid line3');
7415: l_temp_line_rec.pricing_quantity := Wrong_line.priced_quantity;
7416: oe_debug_pub.add('has invalid line4');
7417: -- select oe_msg_request_id_s.nextval into l_request_id from dual;
7418:
7412: oe_debug_pub.add('has invalid line2');
7413: l_temp_line_rec.ordered_quantity := Wrong_line.line_quantity;
7414: oe_debug_pub.add('has invalid line3');
7415: l_temp_line_rec.pricing_quantity := Wrong_line.priced_quantity;
7416: oe_debug_pub.add('has invalid line4');
7417: -- select oe_msg_request_id_s.nextval into l_request_id from dual;
7418:
7419: -- OE_MSG_PUB.INSERT_MESSAGE(OE_MSG_PUB.COUNT_MSG, l_request_id,'U');
7420: -- 4919922
7424: END IF;
7425: OE_MSG_PUB.INSERT_MESSAGE(OE_MSG_PUB.COUNT_MSG, G_REQUEST_ID,'U');
7426: END IF;
7427:
7428: oe_debug_pub.add('has invalid line 5');
7429: Oe_Order_Adj_Pvt.Reset_Fields(l_temp_line_rec);
7430: end if;
7431: else
7432: l_temp_line_rec.line_id := Wrong_line.line_id;
7445:
7446: Oe_Order_Adj_Pvt.Reset_Fields(l_temp_line_rec);
7447: end if;
7448: Else
7449: oe_debug_pub.add('No invalid line');
7450: l_invalid_line:='N';
7451: End If;
7452:
7453: end loop; /* wrong_lines cursor */
7466: FND_MESSAGE.SET_NAME('ONT','OE_BOOK_REQD_LINE_ATTRIBUTE');
7467: FND_MESSAGE.SET_TOKEN('ATTRIBUTE',
7468: OE_Order_UTIL.Get_Attribute_Name('UNIT_LIST_PRICE'));
7469: IF l_debug_level > 0 THEN
7470: oe_debug_pub.add( ' ERROR: UNIT LIST PRICE CAN NOT BE NULL' ) ;
7471: END IF;
7472: IF OE_CODE_CONTROL.Get_Code_Release_Level >= '110509' THEN
7473: if book_line.shipped_quantity is not null or book_line.shipped_quantity <> FND_API.G_MISS_NUM then
7474: vmsg := FND_MESSAGE.GET;
7490: FND_MESSAGE.SET_NAME('ONT','OE_BOOK_REQD_LINE_ATTRUIBUTE');
7491: FND_MESSAGE.SET_TOKEN('ATTRIBUTE',OE_ORDER_UTIL.Get_Attribute_Name('PRICE_LIST_ID'));
7492: OE_MSG_PUB.ADD;
7493: IF l_debug_level > 0 THEN
7494: oe_debug_pub.add( ' ERROR: PRICE LIST ID CAN NOT BE NULL' ) ;
7495: END IF;
7496: RAISE FND_API.G_EXC_ERROR;
7497: END IF;
7498:
7497: END IF;
7498:
7499: End loop; /* wrong booked lines */
7500: IF l_debug_level > 0 THEN
7501: oe_debug_pub.add( 'EXITING REPORT_ENGINE_ERRORS' ) ;
7502: END IF;
7503: End Report_Engine_Errors;
7504:
7505: procedure process_adjustments
7535: l_msg_data VARCHAR2(2000);
7536:
7537:
7538: --
7539: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
7540: --
7541: BEGIN
7542:
7543: SAVEPOINT PROCESS_ADJUSTMENTS;
7554: END IF;
7555:
7556: IF p_control_rec.p_write_to_db THEN
7557: IF l_debug_level > 0 THEN
7558: oe_debug_pub.add( 'WRITING TO DATABASE' , 3 ) ;
7559: END IF;
7560:
7561: CHECK_GSA;
7562:
7566: , l_num_changed_lines); moved after oe_adv_price_pvt.process_adv_modifiers */
7567:
7568: IF OE_CODE_CONTROL.Get_Code_Release_Level >= '110509' THEN
7569: IF l_debug_level > 0 THEN
7570: oe_debug_pub.add( 'CALLING OE_ADV_PRICE_PVT.PROCESS_ADV_MODIFIERS:'||OE_CODE_CONTROL.GET_CODE_RELEASE_LEVEL ) ;
7571: END IF;
7572: oe_adv_price_pvt.process_adv_modifiers
7573: (x_return_status => x_return_status,
7574: p_Control_Rec => p_Control_Rec,
7596: OR instr(p_pricing_events||',', 'BOOK') > 0
7597: OR instr(p_pricing_events||',', 'BATCH') > 0 then
7598: IF (l_num_changed_lines > 0) THEN
7599: IF l_debug_level > 0 THEN
7600: oe_debug_pub.add( 'SETTING CASCADING FLAG TO REFRESH ORDER' ) ;
7601: END IF;
7602: OE_GLOBALS.G_CASCADING_REQUEST_LOGGED := TRUE;
7603: END IF;
7604: End if;
7627:
7628: END IF;
7629:
7630: IF l_debug_level > 0 THEN
7631: oe_debug_pub.add( 'VOPRB RECURSION MODE'||OE_GLOBALS.G_RECURSION_MODE ) ;
7632: END IF;
7633:
7634: -- 2366123: execute delayed requests only when not called by UI
7635: -- IF (OE_GLOBALS.G_RECURSION_MODE <> FND_API.G_TRUE
7644: END IF;
7645:
7646: IF l_process_requests THEN
7647: IF l_debug_level > 0 THEN
7648: oe_debug_pub.add( 'VOPRB BEFORE CALLING PROCESS_REQUESTS_AND_NOTIFY' ) ;
7649: END IF;
7650:
7651: IF (oe_order_cache.g_header_rec.booked_flag = 'Y') Then
7652: l_process_ack := TRUE;
7661: , p_old_line_tbl => l_old_line_tbl
7662: );
7663:
7664: IF l_debug_level > 0 THEN
7665: oe_debug_pub.add( 'RETRURNED FROM PROCESS_REQUEST AND NOTIFY : '||X_RETURN_STATUS , 3 ) ;
7666: END IF;
7667:
7668: IF x_return_status = FND_API.G_RET_STS_ERROR THEN
7669: RAISE FND_API.G_EXC_ERROR;
7673: END IF;
7674:
7675: /*AS per Jyothi Narayan, Process_Requests_And_Notify has notify call. No extra call is needed
7676: If l_debug_level > 0 THEN
7677: oe_debug_pub.add('l_booked_flag in process_adjustments = '||l_booked_flag); End If;
7678: IF OE_CODE_CONTROL.Get_Code_Release_Level >= '110509' THEN
7679: IF l_booked_flag = 'Y' AND p_control_rec.p_write_to_db = TRUE THEN
7680: IF NOT OE_GLOBALS.G_UI_FLAG AND OE_GLOBALS.G_RECURSION_MODE = 'N' THEN
7681: If l_debug_level > 0 THEN
7678: IF OE_CODE_CONTROL.Get_Code_Release_Level >= '110509' THEN
7679: IF l_booked_flag = 'Y' AND p_control_rec.p_write_to_db = TRUE THEN
7680: IF NOT OE_GLOBALS.G_UI_FLAG AND OE_GLOBALS.G_RECURSION_MODE = 'N' THEN
7681: If l_debug_level > 0 THEN
7682: oe_debug_pub.add('Before calling OE_SERVICE_UTIL.Notify_OC in process adj');
7683:
7684: End If;
7685: OE_SERVICE_UTIL.Notify_OC
7686: ( p_api_version_number => 1.0
7691: , p_Line_Adj_tbl => OE_ORDER_UTIL.g_Line_Adj_tbl
7692: , p_old_Line_Adj_tbl => OE_ORDER_UTIL.g_old_Line_Adj_tbl);
7693:
7694: IF l_debug_level > 0 THEN
7695: oe_debug_pub.add( 'AFTER NOTIFY_OC API' , 1 ) ;
7696: END IF;
7697: IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
7698: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
7699: ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
7709: WHEN FND_API.G_EXC_ERROR THEN
7710: x_return_status := FND_API.G_RET_STS_ERROR;
7711:
7712: IF l_debug_level > 0 THEN
7713: oe_debug_pub.add( 'EXITING PROCESS_ADJUSTMENTS WITH EXC ERROR with rollback' , 1 ) ;
7714: END IF;
7715: ROLLBACK TO SAVEPOINT PROCESS_ADJUSTMENTS;
7716:
7717: RAISE FND_API.G_EXC_ERROR;
7718: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
7719: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
7720:
7721: IF l_debug_level > 0 THEN
7722: oe_debug_pub.add( 'EXITING PROCESS_ADJUSTMENTS WITH UNEXPECTED ERROR with rollback' , 1 ) ;
7723: END IF;
7724: ROLLBACK TO SAVEPOINT PROCESS_ADJUSTMENTS;
7725: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
7726: WHEN OTHERS THEN
7725: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
7726: WHEN OTHERS THEN
7727: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
7728: IF l_debug_level > 0 THEN
7729: oe_debug_pub.add( 'ERROR IN OE_ORDER_PRICE_PVT.PROCESS_ADJUSTMENTS with rollback' , 1 ) ;
7730: END IF;
7731: IF l_debug_level > 0 THEN
7732: oe_debug_pub.add( SQLERRM , 1 ) ;
7733: END IF;
7728: IF l_debug_level > 0 THEN
7729: oe_debug_pub.add( 'ERROR IN OE_ORDER_PRICE_PVT.PROCESS_ADJUSTMENTS with rollback' , 1 ) ;
7730: END IF;
7731: IF l_debug_level > 0 THEN
7732: oe_debug_pub.add( SQLERRM , 1 ) ;
7733: END IF;
7734:
7735: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
7736: THEN
7741: );
7742: END IF;
7743:
7744: IF l_debug_level > 0 THEN
7745: oe_debug_pub.add( 'EXITING OE_ORDER_PRICE_PVT.PROCESS_ADJUSTMENTS with rollback' , 1 ) ;
7746: END IF;
7747: ROLLBACK TO SAVEPOINT PROCESS_ADJUSTMENTS;
7748: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
7749: IF l_debug_level > 0 THEN
7746: END IF;
7747: ROLLBACK TO SAVEPOINT PROCESS_ADJUSTMENTS;
7748: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
7749: IF l_debug_level > 0 THEN
7750: oe_debug_pub.add( 'EXITING OE_ORDER_PRICE_PVT.PROCESS_ADJUSTMENTS' , 1 ) ;
7751: END IF;
7752: END Process_Adjustments;
7753:
7754: -- Price_Line is the main Pricing Integration API
7769: is
7770: l_any_frozen_line BOOLEAN;
7771: lx_header_rec OE_ORDER_PUB.HEADER_REC_TYPE;
7772: --
7773: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
7774: --
7775: Begin
7776:
7777: IF l_debug_level > 0 THEN
7774: --
7775: Begin
7776:
7777: IF l_debug_level > 0 THEN
7778: oe_debug_pub.add('Version:'||get_version);
7779: END IF;
7780:
7781: --RT{
7782: G_PRICING_EVENT:=p_pricing_events;
7781: --RT{
7782: G_PRICING_EVENT:=p_pricing_events;
7783: G_RETROBILL_OPERATION:=p_request_rec.param3;
7784:
7785: oe_debug_pub.add('Retrobill Operation:'||g_retrobill_operation);
7786: --RT}
7787:
7788: If OE_DEBUG_PUB.G_DEBUG = FND_API.G_TRUE Then
7789: G_DEBUG := TRUE;
7784:
7785: oe_debug_pub.add('Retrobill Operation:'||g_retrobill_operation);
7786: --RT}
7787:
7788: If OE_DEBUG_PUB.G_DEBUG = FND_API.G_TRUE Then
7789: G_DEBUG := TRUE;
7790: IF l_debug_level > 0 THEN
7791: oe_debug_pub.add( 'BCT G_DEBUG IS:'||OE_DEBUG_PUB.G_DEBUG ) ;
7792: END IF;
7787:
7788: If OE_DEBUG_PUB.G_DEBUG = FND_API.G_TRUE Then
7789: G_DEBUG := TRUE;
7790: IF l_debug_level > 0 THEN
7791: oe_debug_pub.add( 'BCT G_DEBUG IS:'||OE_DEBUG_PUB.G_DEBUG ) ;
7792: END IF;
7793: Else
7794: G_DEBUG := FALSE;
7795: End If;
7794: G_DEBUG := FALSE;
7795: End If;
7796:
7797: IF l_debug_level > 0 THEN
7798: oe_debug_pub.add( 'SETTING REQUEST ID' , 1 ) ;
7799: END IF;
7800:
7801: qp_price_request_context.set_request_id;
7802:
7800:
7801: qp_price_request_context.set_request_id;
7802:
7803: IF l_debug_level > 0 THEN
7804: oe_debug_pub.add( ' REQUEST ID IS : ' || QP_PREQ_GRP.G_REQUEST_ID , 1 ) ;
7805: END IF;
7806:
7807: G_IS_THERE_FREEZE_OVERRIDE:=TRUE;
7808: G_IS_THERE_FREEZE_OVERRIDE:=Check_Freeze_Override(p_pricing_events);
7807: G_IS_THERE_FREEZE_OVERRIDE:=TRUE;
7808: G_IS_THERE_FREEZE_OVERRIDE:=Check_Freeze_Override(p_pricing_events);
7809:
7810: IF l_debug_level > 0 THEN
7811: oe_debug_pub.add( 'PRICE_LINE:'||P_HEADER_ID||'+'||P_LINE_ID||'OF EVENT '||P_PRICING_EVENTS , 1 ) ;
7812: END IF;
7813: x_return_status := FND_API.G_RET_STS_SUCCESS;
7814:
7815: calculate_adjustments
7828: --l_Control_Rec.calculate_flag := 'N';
7829: -- Do no proceed , if there are no order lines
7830: IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
7831: IF l_debug_level > 0 THEN
7832: oe_debug_pub.add( 'CALCULATE ADJUSTMENTS ERROR' ) ;
7833: END IF;
7834: raise fnd_api.g_exc_error;
7835: END IF;
7836:
7835: END IF;
7836:
7837: If x_return_status = 'NOOP' Then
7838: IF l_debug_level > 0 THEN
7839: oe_debug_pub.add( 'THERE ARE NO ORDER LINES FOR '||P_LINE_ID ) ;
7840: END IF;
7841: OE_Order_PUB.G_LINE := NULL;
7842: OE_Order_PUB.G_HDR := NULL;
7843: Return;
7843: Return;
7844: End If;
7845:
7846: IF l_debug_level > 0 THEN
7847: oe_debug_pub.add( 'CALLING PRICING ENGINE PUBLIC API' , 2 ) ;
7848: END IF;
7849: Call_Pricing_Engine(p_Control_Rec
7850: ,p_Pricing_Events
7851: ,x_return_status
7851: ,x_return_status
7852: );
7853: IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
7854: IF l_debug_level > 0 THEN
7855: oe_debug_pub.add( 'PRICING ENGINE ERROR' ) ;
7856: END IF;
7857: raise fnd_api.g_exc_error;
7858: END IF;
7859:
7857: raise fnd_api.g_exc_error;
7858: END IF;
7859:
7860: IF l_debug_level > 0 THEN
7861: oe_debug_pub.add( 'BEFORE OE_ORDER_PRICE_PVT.PROCESS_ADJUSTMENTS' , 1 ) ;
7862: END IF;
7863:
7864: process_adjustments
7865: (
7874: );
7875:
7876: IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
7877: IF l_debug_level > 0 THEN
7878: oe_debug_pub.add( 'PROCESS ADJUSTMENTS ERROR' ) ;
7879: END IF;
7880: raise fnd_api.g_exc_error;
7881: END IF;
7882: --reseting global structure after engine call
7883: OE_Order_PUB.G_LINE := NULL;
7884: OE_Order_PUB.G_HDR := NULL;
7885:
7886: IF l_debug_level > 0 THEN
7887: oe_debug_pub.add( 'EXITING OE_ORDER_PRICE_PVT.PRICE_LINE' , 1 ) ;
7888: END IF;
7889:
7890: Exception
7891: WHEN FND_API.G_EXC_ERROR THEN
7895: OE_Order_PUB.G_HDR := NULL;
7896: x_return_status := FND_API.G_RET_STS_ERROR;
7897:
7898: IF l_debug_level > 0 THEN
7899: oe_debug_pub.add( 'EXITING PRICE_LINE WITH EXC ERROR' , 1 ) ;
7900: END IF;
7901: RAISE FND_API.G_EXC_ERROR;
7902: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
7903:
7905: OE_Order_PUB.G_LINE := NULL;
7906: OE_Order_PUB.G_HDR := NULL;
7907: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
7908: IF l_debug_level > 0 THEN
7909: oe_debug_pub.add( 'EXITING PRICE_LINE WITH UNEXPECTED ERROR' , 1 ) ;
7910: END IF;
7911: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
7912: WHEN OTHERS THEN
7913:
7915: --reseting global structure after engine call
7916: OE_Order_PUB.G_LINE := NULL;
7917: OE_Order_PUB.G_HDR := NULL;
7918: IF l_debug_level > 0 THEN
7919: oe_debug_pub.add( 'ERROR IN OE_ORDER_PRICE_PVT.PRICE_LINE' , 1 ) ;
7920: END IF;
7921: IF l_debug_level > 0 THEN
7922: oe_debug_pub.add( SQLERRM , 1 ) ;
7923: END IF;
7918: IF l_debug_level > 0 THEN
7919: oe_debug_pub.add( 'ERROR IN OE_ORDER_PRICE_PVT.PRICE_LINE' , 1 ) ;
7920: END IF;
7921: IF l_debug_level > 0 THEN
7922: oe_debug_pub.add( SQLERRM , 1 ) ;
7923: END IF;
7924:
7925: IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
7926: THEN
7930: );
7931: END IF;
7932:
7933: IF l_debug_level > 0 THEN
7934: oe_debug_pub.add( 'EXITING OE_ORDER_PRICE_PVT.PRICE_LINE' , 1 ) ;
7935: END IF;
7936: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
7937:
7938: IF l_debug_level > 0 THEN
7935: END IF;
7936: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
7937:
7938: IF l_debug_level > 0 THEN
7939: oe_debug_pub.add( 'EXITING OE_ORDER_PRICE_PVT.PRICE_LINE' , 1 ) ;
7940: END IF;
7941:
7942: End Price_Line;
7943: