1 PACKAGE BODY OE_Default_Header_Scredit AS
2 /* $Header: OEXDHSCB.pls 120.0 2005/06/01 23:13:14 appldev noship $ */
3
4 -- Global constant holding the package name
5 G_PKG_NAME CONSTANT VARCHAR2(30) := 'OE_Default_Header_Scredit';
6
7 g_header_scredit_rec OE_ORDER_PUB.Header_Scredit_Rec_Type;
8
9 FUNCTION Get_Sales_Credit
10 RETURN NUMBER
11 IS
12 l_id number;
13 --
14 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
15 --
16 BEGIN
17 select OE_SALES_CREDITS_S.nextval
18 into l_id
19 from dual;
20 return l_id;
21 END Get_Sales_Credit;
22
23
24 PROCEDURE Attributes
25 ( p_x_Header_Scredit_rec IN OUT NOCOPY OE_Order_PUB.Header_Scredit_Rec_Type
26 , p_old_Header_Scredit_rec IN OE_Order_PUB.Header_Scredit_Rec_Type
27 , p_iteration IN NUMBER := 1
28 )
29 IS
30 --l_old_header_scredit_rec OE_AK_HEADER_SCREDITS_V%ROWTYPE;
31 l_operation VARCHAR2(30);
32 l_action NUMBER;
33 --
34 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
35 --
36 BEGIN
37 IF l_debug_level > 0 THEN
38 oe_debug_pub.add( 'ENTER OE_DEFAULT_HEADER_SCREDIT.ATTRIBUTES' ) ;
39 END IF;
40
41 /* Commented the following code to fix the bug 2044438
42
43 -- Due to incompatibilities in the record type structure
44 -- copy the data to a rowtype record format
45 oe_debug_pub.add('In defaulting1');
46
47 OE_Header_Scredit_UTIL.API_Rec_To_Rowtype_Rec
48 (p_header_scredit_rec => p_x_header_scredit_rec
49 ,x_rowtype_rec => g_header_scredit_rec);
50 oe_debug_pub.add('In defaulting2');
51 OE_Header_Scredit_UTIL.API_Rec_To_Rowtype_Rec
52 (p_header_scredit_rec => p_old_header_scredit_rec
53 ,x_rowtype_rec => l_old_header_scredit_rec);
54 oe_debug_pub.add('In defaulting3');
55
56 End Comment for bug 2044438 */
57
58 g_header_scredit_rec := p_x_header_scredit_rec;
59
60 -- For some fields, get hardcoded defaults based on the operation
61 l_operation := p_x_header_scredit_rec.operation;
62
63 IF l_operation = OE_GLOBALS.G_OPR_CREATE THEN
64
65 IF g_header_scredit_rec.sales_credit_id = FND_API.G_MISS_NUM THEN
66 g_header_scredit_rec.sales_credit_id := Get_Sales_Credit;
67 END IF;
68
69 END IF;
70
71
72 /* Commented the following code to fix the bug 2044438
73
74 -- call the default handler framework to default the missing attributes
75 oe_debug_pub.add('In defaulting4');
76
77 ONT_HEADER_SCREDIT_Def_Hdlr.Default_Record
78 (p_x_rec => g_header_scredit_rec
79 ,p_in_old_rec => l_old_header_scredit_rec);
80
81 oe_debug_pub.add('In defaulting5');
82
83 -- copy the data back to a format that is compatible with the API architecture
84
85 OE_Header_Scredit_UTIL.RowType_Rec_to_API_Rec
86 (p_record => g_header_scredit_rec
87 ,x_api_rec => p_x_header_scredit_rec);
88
89 End Comment for bug 2044438 */
90
91 /* Added the following code to fix the bug 2044438 */
92
93 p_x_header_scredit_rec := g_header_scredit_rec;
94
95 IF l_debug_level > 0 THEN
96 oe_debug_pub.add( 'CALL CONVERT_MISS_TO_NULL' ) ;
97 END IF;
98 OE_HEADER_SCREDIT_UTIL.Convert_Miss_To_Null
99 (p_x_header_scredit_rec);
100
101 /* End of the code added to fix the bug 2044438 */
102
103 /* 1581620 start */
104
105 IF (p_x_Header_Scredit_rec.lock_control = FND_API.G_MISS_NUM) THEN
106 p_x_Header_Scredit_rec.lock_control := NULL;
107 END IF;
108
109 IF (p_x_Header_Scredit_rec.orig_sys_credit_ref = FND_API.G_MISS_CHAR) THEN
110 p_x_Header_Scredit_rec.orig_sys_credit_ref := 'OE_SALES_CREDITS'||p_x_Header_Scredit_rec.sales_credit_id;
111 END IF;
112
113 /* 1581620 end */
114
115 IF l_debug_level > 0 THEN
116 oe_debug_pub.add( 'IN DEFAULTING6' ) ;
117 END IF;
118 IF l_debug_level > 0 THEN
119 oe_debug_pub.add( 'EXIT OE_DEFAULT_HEADER_SCREDIT.ATTRIBUTES' ) ;
120 END IF;
121
122 EXCEPTION
123
124 WHEN FND_API.G_EXC_ERROR THEN
125
126 RAISE FND_API.G_EXC_ERROR;
127
128 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
129
130 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
131
132 WHEN OTHERS THEN
133
134 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
135 THEN
136 OE_MSG_PUB.Add_Exc_Msg
137 ( G_PKG_NAME
138 , 'Attributes'
139 );
140 END IF;
141 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
142
143 END Attributes;
144
145 END OE_Default_Header_Scredit ;