Documente Academic
Documente Profesional
Documente Cultură
l_flag varchar2(1);
l_currency_code varchar2(5);
l_CUST_TRX_TYPE_ID number;
err_msg varchar2(2000);
L_batch_source_id varchar2(30);
L_tax_id varchar2(30);
L_cust_number varchar2(50);
l_cust_bill_add_id varchar2(50);
l_cust_ship_add_id varchar2(50);
l_sequence_no number;
l_attri2 varchar2(50);
L_term_id varchar2(10);
l_cust_account_id varchar2(10);
L_uom varchar2(10);
l_interface_line_attribute1 varchar2(120);
l_convertion_type varchar2(100);
l_set_of_books_id number;
L_INVENTORY_ITEM_ID number;
org_id number;
L_CONVERSION_RATE number;
l_account_number number;
begin
for i in c loop
l_flag:='Y';
BEGIN
SELECT UOM_CODE INTO L_uom
FROM MTL_UNITS_OF_MEASURE
WHERE trim(UOM_CODE)=trim(i.UOM);
exception
when others then
l_flag:='E';
err_msg:=err_msg||'uom code Is Not Existing'||'/';
end;
-- Currency validation
BEGIN
SELECT CURRENCY_CODE
INTO L_CURRENCY_CODE
FROM FND_CURRENCIES
WHERE trim(CURRENCY_CODE)=trim(I.INVOICE_CURRENCY);
EXCEPTION
WHEN OTHERS THEN
L_FLAG:='E';
ERR_MSG:=ERR_MSG||'Invalid Currency '||'/';
END;
-- TO GET CUST ID
begin
select cust_account_id,account_number
into l_cust_account_id,l_account_number
from hz_cust_accounts hca,hz_parties hp
where account_number =C1.CUSTOMER_NUMBER
and hp.party_id=hca.party_id;
exception
when others then
l_flag:='E';
err_msg:=err_msg||'Cust Account No Is Not Existing'||'/';
end;
-- to get bill to address id
begin
SELECT HCSUA.cust_acct_site_id
INTO l_cust_bill_add_id
FROM hz_cust_acct_sites_all HCASA,
hz_cust_site_uses_all HCSUA
WHERE cust_account_id=(SELECT cust_account_id FROM hz_cust_accounts
HCA, hz_parties HP
WHERE account_number=l_account_number AND hp.party_id=hca.party_id)
AND hcasa.cust_acct_site_id=hcsua.cust_acct_site_id
AND site_use_code='BILL_TO';
-- AND HCSUA.SITE_USE_ID=i.ORACLE_BILL_TO ;
exception
when others then
l_flag:='E';
err_msg:=err_msg||'Cust Account Site id BILL_TO Is Not Existing'||'/
';
end;
DBMS_OUTPUT.PUT_LINE('BILL TO ADDRESS ID'||l_cust_bill_add_id);
BEGIN
SELECT CONVERSION_TYPE INTO l_convertion_type
from GL_DAILY_CONVERSION_TYPES
where CONVERSION_TYPE='User';
exception
when others then
l_flag:='E';
err_msg:=err_msg||'Conversion type Is Not Existing'||'/
';
end;
--To set-of-books id
begin
select SET_OF_BOOKS_ID into l_set_of_books_id
from AR_SYSTEM_PARAMETERS_ALL where ORG_ID=org_id;
exception
when others then
l_flag:='E';
err_msg:=err_msg||'set of books id Is Not Existing'||'/
';
end;
BEGIN
SELECT TAX_RATE_CODE INTO L_tax_id
FROM zx_rates_b
WHERE trim(TAX_RATE_CODE)=trim(i.TAX_RATE_CODE);
exception
when others then
l_flag:='E';
err_msg:=err_msg||'Tax code Is Not Existing'||'/';
end;
l_interface_line_attribute1:= l_sequence_no||i.INVOICE_NUMBER;
if l_flag<>'E' then
DBMS_OUTPUT.PUT_LINE('INSIDE LOOP');