DECLARE
l_return_status VARCHAR2(500);
l_msg_count NUMBER;
l_msg_data VARCHAR2(500);
l_count NUMBER;
l_cash_receipt_id NUMBER;
l_msg_data_out VARCHAR2(500);
l_mesg VARCHAR2(500);
p_count number;
p_receipt_number_1 varchar2(50);
P_attribute_rec_type_1 AR_RECEIPT_API_PUB.attribute_rec_type;
--p_currency_code varchar2(20);
cursor c1
is
select rowid, a.*
from xx_err_2 a;
-- where ACCOUNT_ID IS NOT NULL
-- and SEQ_NO = 1750;
--and receipt_number not in ('130FV');
BEGIN
FND_global.APPS_INITIALIZE(1090,20678,222);
MO_GLOBAL.SET_POLICY_CONTEXT('S', 82);
--mo_global.SET_ORG_ACCESS('XXXX OU');
for z in
c1 loop
dbms_output.put_line('Start');
l_return_status:=null;
p_receipt_number_1:=z.RECEIPT_NUMBER;
--P_attribute_rec_type_1.attribute_category := 'PDC'; --i.attribute_category;
--P_attribute_rec_type_1.attribute1 := z.REFF_NUMBER;
--P_attribute_rec_type_1.attribute2 := z.attribute2;
--arp_standard.enable_debug;
--arp_standard.enable_file_debug('C:\re', 're');
AR_RECEIPT_API_PUB.create_cash
( p_api_version => 1.0,
p_init_msg_list => FND_API.G_TRUE,
p_commit => FND_API.G_TRUE,
p_validation_level => FND_API.G_VALID_LEVEL_FULL,
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data,
p_currency_code => z.RECEIPT_CURRENCY,
p_amount => z.RECEIPT_AMOUNT,
p_receipt_number => z.RECEIPT_NUMBER,
p_doc_sequence_value => NULL,
p_receipt_date => TO_DATE(z.RECEIPT_DATE,'DD/MM/RRRR'),
p_gl_date => z.GL_DATE,
--p_customer_number => z.CUSTOMER_NUMBER,
p_customer_id => z.ACCOUNT_ID,
p_receipt_method_id => 1040,
p_cr_id => l_cash_receipt_id,
--p_attribute_rec => P_attribute_rec_type_1,
p_maturity_date => to_date(z.MARUTIRY_DATE,'DD/MM/RRRR'),
p_customer_receipt_reference => replace(z.REFF_NUMBER,' ',''),
p_comments => z.COMMENT1,
p_org_id => 82 );
dbms_output.put_line('Status ' || l_return_status);
dbms_output.put_line('Cash Receipt id ' || l_cash_receipt_id );
dbms_output.put_line('Message count ' || l_msg_count);
if l_return_status = 'E' then
update xx_err_2
set account_number= substr(l_return_status||'-'||l_msg_data,1,50)
where rowid=z.rowid;
commit;
end if;
IF l_msg_count = 1 Then
dbms_output.put_line('l_msg_data '||l_msg_data);
dbms_output.put_line('RECEIPT NUMBER' || p_receipt_number_1 );
ELSIF l_msg_count > 1 Then
LOOP
p_count := p_count+1;
l_msg_data := FND_MSG_PUB.Get(FND_MSG_PUB.G_NEXT,FND_API.G_FALSE);
IF l_msg_data is NULL Then
EXIT;
END IF;
dbms_output.put_line('Message' || p_count ||'.'||l_msg_data);
END LOOP;
END IF;
end loop;
arp_standard.disable_debug;
END;
No comments:
Post a Comment