[Home] [Help]
PACKAGE BODY: APPS.AR_EXCHANGE_INTERFACE
Source
1 PACKAGE BODY ar_exchange_interface as
2 /*$Header: AREXINTB.pls 115.7 2002/11/15 02:33:15 anukumar ship $ */
3
4 /* Private procedures */
5 PROCEDURE debug( p_indent IN NUMBER, p_text IN VARCHAR2 ) IS
6 BEGIN
7 fnd_file.put_line( FND_FILE.LOG, RPAD(' ', p_indent*2)||p_text );
8 --dbms_output.put_line( RPAD(' ', p_indent*2)||p_text );
9 END debug;
10
11 PROCEDURE request_output( p_indent IN NUMBER, p_text IN VARCHAR2 ) IS
12 BEGIN
13 --fnd_file.put_line( FND_FILE.OUTPUT, RPAD(' ', p_indent*2)||p_text );
14 --dbms_output.put_line( RPAD(' ', p_indent*2)||p_text );
15 null;
16 END request_output;
17
18 /*
19 Create customers in AR for exchange party.
20 */
21 procedure ar_customer_interface (
22 errbuf out NOCOPY varchar2,
23 retcode out NOCOPY varchar2,
24 p_customer_name IN VARCHAR2 default null
25 ) IS
26
27 l_error_code varchar2(30);
28 l_error_msg varchar2(255);
29 l_conc_request_id NUMBER;
30
31 l_cust_autonum_flag varchar2(10);
32
33 LEVEL0 CONSTANT NUMBER := 0;
34 LEVEL2 CONSTANT NUMBER := 2;
35 LEVEL4 CONSTANT NUMBER := 4;
36 LEVEL_MIDDLE CONSTANT NUMBER := 16;
37 OUTPUT_LINE_WIDTH CONSTANT NUMBER := 40;
38
39 cursor c_sysop is
40 select nvl(generate_customer_number,'N')
41 from ar_system_parameters;
42 BEGIN
43
44 debug(LEVEL0,'ar_exchange_interface.ar_customer_interface +');
45 debug(LEVEL0,'-----------------------------------------');
46 l_conc_request_id := fnd_global.conc_request_id;
47 debug(LEVEL0,'conc.request id = '||to_char(l_conc_request_id));
48
49 debug(LEVEL0,'Calling ar_exchange_interface_pkg.customer_interface + ');
50 ar_exchange_interface_pkg.customer_interface
51 (null,
52 null,
53 l_conc_request_id,
54 l_error_code,
55 l_error_msg);
56
57
58 l_cust_autonum_flag := 'Y';
59
60 /* Get value into l_cust_autonum_flag here */
61
62 open c_sysop;
63 fetch c_sysop into l_cust_autonum_flag;
64 close c_sysop;
65
66 debug(LEVEL2, 'Resetting customer_number field (autonum = '||l_cust_autonum_flag||')');
67 update ra_customers_interface_all
68 set customer_number = decode(l_cust_autonum_flag, 'Y', NULL, customer_number)
69 where orig_system_customer_ref like 'EXCHANGE_CUST%';
70
71 debug(LEVEL4,'Status code from remote call: '||l_error_code);
72
73 COMMIT WORK;
74 EXCEPTION
75 WHEN OTHERS THEN
76 debug(LEVEL0,'Error from remote call: '||sqlcode||','||sqlerrm);
77 END ar_customer_interface;
78
79 /*
80 Create invoices in AR for billing activity for a party, consolidated for a month.
81 */
82 procedure ar_invoice_interface (
83 errbuf out NOCOPY varchar2,
84 retcode out NOCOPY varchar2,
85 p_cutoff_date IN date default null ,
86 p_customer_name IN VARCHAR2 default null
87 ) IS
88
89 l_billing_period varchar2(30);
90 l_error_code varchar2(30);
91 l_error_msg varchar2(255);
92 l_conc_request_id NUMBER;
93
94 LEVEL0 CONSTANT NUMBER := 0;
95 LEVEL2 CONSTANT NUMBER := 2;
96 LEVEL4 CONSTANT NUMBER := 4;
97 LEVEL_MIDDLE CONSTANT NUMBER := 16;
98 OUTPUT_LINE_WIDTH CONSTANT NUMBER := 40;
99
100 BEGIN
101
102
103 debug(LEVEL0,'ar_exchange_interface.invoice_interface +');
104 debug(LEVEL0,'-----------------------------------------');
105 l_conc_request_id := fnd_global.conc_request_id;
106 debug(LEVEL0,'conc.request id = '||to_char(l_conc_request_id));
107
108 debug(LEVEL0,'Calling ar_exchange_interface_pkg.invoice_interface() + ');
109 ar_exchange_interface_pkg.invoice_interface
110 (p_cutoff_date,
111 p_customer_name,
112 l_conc_request_id,
113 l_error_code,
114 l_error_msg );
115 debug(LEVEL4,'Status code from remote call: '||l_error_code);
116
117 COMMIT WORK;
118 EXCEPTION
119 WHEN OTHERS THEN
120 debug(LEVEL0,'Error from remote call: '||sqlcode||','||sqlerrm);
121 END ar_invoice_interface;
122
123 END ar_exchange_interface;