Anda di halaman 1dari 9

28/07/2015

ORACLESTUDENTSTUFF:CompleteAPInterface
1

More NextBlog

aaedulapuram@triniti.com

ORACLE STUDENT STUFF


ERPEDGEStudentsStuff------------------------------

WEDNESDAY, 6 JUNE 2012

TOTAL PAGEVIEWS

28,005

Complete AP Interface
APPS STUFF

Pre-requisites:

a)VendorsandtheirSitesShouldBeSetup
b)CurrencyandexchangeRatesShouldBesetup
c)Sourceandinvoicetypelookupcodemustbedefined
d)AccountPayablesAccountandDistributionAccountmustbedefined.
e)PaymentTermsshouldbedefinesandGLPeriodmustbeinopenedstatus.
InterfaceTables:
AP_INVOICES_INTERFACE
AP_INVOCE_LINES_INTERFACE
BASETABLES:

2013(24)
2012(27)
June(27)
Jun21(1)
Jun07(13)
Jun06(13)

BackEndRegistrati

FlexSQL,FlexIDCod

P2P(Procure-to-Pay
withJoins

O2C(Order-to-cash
withJoins
FNDLOADSyntax

AP_INVOICES_ALL
AP_INVOICE_DISTRIBUTIONS_ALL
AP_PAYMENT_SCHEDULES

AllBack-endTable

INTERFACEPROGRAM:

CompleteAPInterf

PayablesOpenInterfaceImport

R12Features,

RegistrationOfTab

Complete

DevelopmentofOu
Interface

InterfaceDefinitio

Parameterstobepassedduringtheprogram:

Source=External
group_id=AsSpecifiedinthedatafile
BatchName=N/A
HoldName=null
HoldReason=null
gldate=null
Purge=No
Summarize=No

InterfacesOvervie

ABOUT ME
obulreddy
Follow

Viewmycompleteprofile

ErrorTables:
AP_INTERFACE_REJECTIONS
AP_INTERFACE_CONTROLS
MainColumnsInAP_INVOICES_INTERFACE:
INVOICE_ID,INVOICE_NUM,INVOICE_DATE,INVOICE_AMOUNT
VENDOR_ID,VENDOR_NUM,VENDOR_NAME,VENDOR_SITE_CODE,VENDOR_SITE_ID
TERMS_NAME,TERM_ID,TERM_DATE,SOURCE,PAYMENT_METHOD_LOOKUP_CODE,
GL_DATE,PO_NUMBER,INVOICE_CURRENCE_CODE,EXCHANGE_RATE_TYPE
VOUCHER_NUMBER,PAYMENT_CURRENCY_CODE,DOC_CATEGPRY_CODE
MainColumnsInAP_INVOICE_LINES_INTERFACE:
INVOICE_ID,INVOICE_LINE_ID,LINE_NUM,LINE_TYPE_LOOKUP_CODE
AMOUNR,DIST_CODE_COMBINATION_ID,DIST_CODE_CONCATENATED
PO_HEADER_ID,PO_LINE_ID,PO_LINE_NUMBER
TablesToBeUsedForValidation:

http://appsburn.blogspot.in/2012/06/completeapinterface.html

1/9

28/07/2015

ORACLESTUDENTSTUFF:CompleteAPInterface

PO_VENDORSAP_TERMSORG_ORGANIZATION_DEFINITIONS
FND_CURRNECIESAP_INVOICES_ALLGL_DAILY_CONVERSION_TYPES
GL_CODE_COMBINATIONSAP_LOOKUP_CODESGL_PERIOD_STATUSES

ControlfileforHeaders:OPTIONS(SKIP=1)
LOADDATA
INFILE'/apps/aptest/visappl/xxcus/11.5.0/bin/ap_int_temp.csv'
truncateintotableap_int_temp
fieldsterminatedby','optionallyenclosedby'"'
trailingnullcols
(
INVOICE_NUM,
INVOICE_DATE,
INVOICE_TYPE_LOOKUP_CODE,
VENDOR_NAME,
VENDOR_SITE_CODE,
INVOICE_AMOUNT,
INVOICE_CURRENCY_CODE,
DESCRIPTION,
SOURCE,
PAYMENT_METHOD_LOOKUP_CODE,
PAY_GROUP_LOOKUP_CODE,
OU_NAME"REPLACE(:OU_NAME,CHR(13),'')"
)

ForLines:OPTIONS(SKIP=1)
LOADDATA
INFILE'/apps/aptest/visappl/xxcus/11.5.0/bin/ap_int_line_temp.csv'
truncateintotableap_int_line_temp
fieldsterminatedby','optionallyenclosedby'"'
trailingnullcols
(
INVOICE_NUM,
OU_NAME,
LINE_NUMBER,
LINE_TYPE_LOOKUP_CODE,
AMOUNT,
DESCRIPTION,
DIST_CODE_CONCATENATED"REPLACE(:DIST_CODE_CONCATENATED,CHR(13),'')"
)

ShellScript:sqlldrapps/appscontrol='/apps/aptest/visappl/xxcus/11.5.0/bin/ap_int_temp.ctl'
log='/apps/aptest/visappl/xxcus/11.5.0/bin/ap_int_temp.log'
sqlldrapps/appscontrol='/apps/aptest/visappl/xxcus/11.5.0/bin/ap_int_line_temp.ctl'
log='/apps/aptest/visappl/xxcus/11.5.0/bin/ap_int_line_temp.log'
exit0

Commonerrortableandprocedure:createtableap_common_err_tab
(
interface_namevarchar2(50),
table_namevarchar2(50),
column_namevarchar2(50),
error_messagevarchar2(100),
created_byvarchar2(10),
creation_datedate,
last_updated_byvarchar2(10),
last_update_datedate,
request_idvarchar2(10)
);
createorreplaceprocedureap_common_err_proc
(
p_interface_namevarchar2,
p_table_namevarchar2,
p_column_namevarchar2,
p_error_messagevarchar2
)
is
begin

http://appsburn.blogspot.in/2012/06/completeapinterface.html

2/9

28/07/2015

ORACLESTUDENTSTUFF:CompleteAPInterface

insertintoap_common_err_tab
values
(
p_interface_name,
p_table_name,
p_column_name,
p_error_message,
fnd_profile.value('USER_ID'),
SYSDATE,
fnd_profile.value('USER_ID'),
SYSDATE,
fnd_profile.value('CONC_REQUEST_ID')
);

TotalPackageWithValidation:CREATEORREPLACEpackagebodyAPPS.ee_ap_inv_pkg
is
--fordeclaringglobalvariables
g_user_idnumber(10):=fnd_profile.value('USER_ID');
g_datedate:=sysdate;
procedureap_record_details
is
cursorc1isselect*fromap_inv_head
whereprocess_flag='S';
cursorc2isselect*fromap_inv_head
whereprocess_flag='E';
v_tot_recnumber;
v_sus_recnumber;
v_err_recnumber;
begin

--fortotalrecords
selectcount(*)intov_tot_rec
fromap_inv_head;
--forsuccessrecords
selectcount(*)intov_sus_rec
fromap_inv_head
whereprocess_flag='S';
--forerrorrecords
selectcount(*)intov_err_rec
fromap_inv_head
whereprocess_flag='E';
forinfoinc1
loop
fnd_file.put_line(fnd_file.output,'---------------------------');
fnd_file.put_line(fnd_file.output,'FORSUSCESSINFORMATION');
fnd_file.put_line(fnd_file.output,'---------------------------');
fnd_file.put_line(fnd_file.output,'INVOICENUM=>'||info.invoice_num);
fnd_file.put_line(fnd_file.output,'VENDORNAME=>'||info.vendor_name);
fnd_file.put_line(fnd_file.output,'TOTALRECORDS=>'||v_tot_rec);
fnd_file.put_line(fnd_file.output,'TOTALSUCESSRECORDS=>'||v_sus_rec);
fnd_file.put_line(fnd_file.output,'TOTALERRORRECORDS=>'||v_err_rec);
endloop;
forinfo1inc2
loop
fnd_file.put_line(fnd_file.output,'---------------------------');
fnd_file.put_line(fnd_file.output,'FORERRORINFORMATION');
fnd_file.put_line(fnd_file.output,'---------------------------');
fnd_file.put_line(fnd_file.output,'INVOICENUM=>'||info1.invoice_num);
fnd_file.put_line(fnd_file.output,'VENDORNAME=>'||info1.vendor_name);
fnd_file.put_line(fnd_file.output,'TOTALRECORDS=>'||v_tot_rec);
fnd_file.put_line(fnd_file.output,'TOTALSUCESSRECORDS=>'||v_sus_rec);
fnd_file.put_line(fnd_file.output,'TOTALERRORRECORDS=>'||v_err_rec);
fnd_file.put_line(fnd_file.output,'ERRORMESSAGE=>'||info1.error_message);
endloop;
endap_record_details;
---archtableinformation
procedurearch_proc
is
begin
insertintoap_inv_head_archselect*fromap_inv_head;
insertintoap_inv_line_archselect*fromap_inv_line;
deletefromap_inv_head;
deletefromap_inv_line;

http://appsburn.blogspot.in/2012/06/completeapinterface.html

3/9

28/07/2015

ORACLESTUDENTSTUFF:CompleteAPInterface

commit;
end;
proceduredis_log(p_msginvarchar2)
is
begin
fnd_file.put_line(fnd_file.log,p_msg);
enddis_log;
proceduremain(errbufoutvarchar2,
retcodeoutvarchar2
)
is
cursorheadisselect*fromap_inv_head;

cursorline(p_inv_numinvarchar2)isselect*fromap_inv_line
whereinvoice_num=p_inv_num;

v_headap_invoices_interface%rowtype;
v_lineap_invoice_lines_interface%rowtype;
v_head_tabvarchar2(100):='AP_INV_HEAD';
v_line_tabvarchar2(100):='AP_INV_LINE';
v_conc_programvarchar2(100);
v_process_flagvarchar2(1);
v_error_messagevarchar2(100);
v_tot_err_msgvarchar2(1000);
v_countnumber;
v_inv_num_existsexception;
v_amountnumber;

begin
---concurrentprogram-----selectfcp.user_concurrent_program_name
intov_conc_program
fromfnd_concurrent_programs_vlfcp,
fnd_concurrent_requestsfcr
wherefcp.concurrent_program_id=fcr.concurrent_program_id
andfcr.request_id=g_request_id;
---endofconcurrentprogram-----
forrec_headinhead
loop
begin
v_process_flag:='S';
v_error_message:=null;
v_tot_err_msg:=null;

--*****invoicetypelookypcode****-begin
selectlookup_codeintov_head.invoice_type_lookup_code
fromap_lookup_codes
wherelookup_type='INVOICETYPE'
anddisplayed_field=rec_head.invoice_type_lookup_code;
exception
whenno_data_foundthen
v_process_flag:='E';
v_error_message:='INVALIDINVOICETYPELOOKUPCODE=>'||rec_head.invoice_type_lookup_code;
v_tot_err_msg:=v_tot_err_msg||''||v_error_message;
ee_ap_comm_err_procedure(p_interface_name=>v_conc_program,
p_table_name=>v_head_tab,
p_column_name=>'INVOICETYPELOOKYPCODE',
p_error_message=>v_error_message
);
whenothersthen
v_process_flag:='E';
v_error_message:='EXCEPTIONATINVOICETYPELOOKUPCODEVALIDATION=>'||rec_head.invoice_type_lookup_code||'
'||sqlerrm;
v_tot_err_msg:=v_tot_err_msg||''||v_error_message;
ee_ap_comm_err_procedure(p_interface_name=>v_conc_program,
p_table_name=>v_head_tab,
p_column_name=>'INVOICETYPELOOKYPCODE',
p_error_message=>v_error_message
);
end;

--*****vendornamevalidation*****--begin
selectvendor_idintov_head.vendor_id
frompo_vendors

http://appsburn.blogspot.in/2012/06/completeapinterface.html

4/9

28/07/2015

ORACLESTUDENTSTUFF:CompleteAPInterface

wherevendor_name=rec_head.vendor_name;
exception
whenno_data_foundthen
v_process_flag:='E';
v_error_message:='INVALIDVENDORNAME=>'||rec_head.vendor_name;
v_tot_err_msg:=v_tot_err_msg||''||v_error_message;
ee_ap_comm_err_procedure(p_interface_name=>v_conc_program,
p_table_name=>v_head_tab,
p_column_name=>'VENDOR_NAME',
p_error_message=>v_error_message
);
whenothersthen
v_process_flag:='E';
v_error_message:='EXCEPTIONATVENDOR_NAMEVALIDATION=>'||rec_head.vendor_name||''||sqlerrm;
v_tot_err_msg:=v_tot_err_msg||''||v_error_message;
ee_ap_comm_err_procedure(p_interface_name=>v_conc_program,
p_table_name=>v_head_tab,
p_column_name=>'VENDOR_NAME',
p_error_message=>v_error_message
);

end;

---*****organiozationnamevalidation********--begin
selectorganization_idintov_head.org_id
fromorg_organization_definitions
whereorganization_name=rec_head.ou_name;
exception
whenno_data_foundthen
v_process_flag:='E';
v_error_message:='INVALIDORGNAME=>'||rec_head.ou_name;
v_tot_err_msg:=v_tot_err_msg||''||v_error_message;
ee_ap_comm_err_procedure(p_interface_name=>v_conc_program,
p_table_name=>v_head_tab,
p_column_name=>'ORGANIZATIONNAME',
p_error_message=>v_error_message
);
whenothersthen
v_process_flag:='E';
v_error_message:='EXCEPTIONATORG_NAMEVALIDATION=>'||rec_head.ou_name||''||sqlerrm;
v_tot_err_msg:=v_tot_err_msg||''||v_error_message;
ee_ap_comm_err_procedure(p_interface_name=>v_conc_program,
p_table_name=>v_head_tab,
p_column_name=>'ORGANIZATIONNAME',
p_error_message=>v_error_message
);
end;

---*****vendorsitecodevalidation*******-----begin
selectvendor_site_idintov_head.vendor_site_id
frompo_vendor_sites_all
wherevendor_site_code=rec_head.vendor_site_code
andvendor_id=v_head.vendor_id
andorg_id=v_head.org_id;
exception
whenno_data_foundthen
v_process_flag:='E';
v_error_message:='INVALIDVENDORSITECODE=>'||rec_head.vendor_site_code;
v_tot_err_msg:=v_tot_err_msg||''||v_error_message;
ee_ap_comm_err_procedure(p_interface_name=>v_conc_program,
p_table_name=>v_head_tab,
p_column_name=>'VENDOR_SITE_CODE',
p_error_message=>v_error_message
);
whenothersthen
v_process_flag:='E';
v_error_message:='EXCEPTIONATORG_NAMEVALIDATION=>'||rec_head.vendor_site_code||''||sqlerrm;
v_tot_err_msg:=v_tot_err_msg||''||v_error_message;
ee_ap_comm_err_procedure(p_interface_name=>v_conc_program,
p_table_name=>v_head_tab,
p_column_name=>'VENDOR_SITE_CODE',
p_error_message=>v_error_message
);

end;

http://appsburn.blogspot.in/2012/06/completeapinterface.html

5/9

28/07/2015

ORACLESTUDENTSTUFF:CompleteAPInterface

--*******invoicenumvalidation****--
selectcount(1)intov_count
fromap_invoices_all
whereinvoice_num=rec_head.invoice_num
andvendor_id=v_head.vendor_id
andorg_id=v_head.org_id;
ifv_count>0
then
raisev_inv_num_exists;
endif;

-----****sourcevalidation****----
begin
selectlookup_codeintov_head.source
fromap_lookup_codes
wherelookup_type='SOURCE'
anddisplayed_field=rec_head.source;
exception
whenno_data_foundthen
v_process_flag:='E';
v_error_message:='INVALIDSOURCE=>'||rec_head.source;
v_tot_err_msg:=v_tot_err_msg||''||v_error_message;
ee_ap_comm_err_procedure(p_interface_name=>v_conc_program,
p_table_name=>v_head_tab,
p_column_name=>'SOURCE',
p_error_message=>v_error_message
);
whenothersthen
v_process_flag:='E';
v_error_message:='EXCEPTIONATSOURCEVALIDATION=>'||rec_head.source||''||sqlerrm;
v_tot_err_msg:=v_tot_err_msg||''||v_error_message;
ee_ap_comm_err_procedure(p_interface_name=>v_conc_program,
p_table_name=>v_head_tab,
p_column_name=>'SOURCE',
p_error_message=>v_error_message
);

end;

---***termsvalidation***---
begin
selectterm_idintov_head.terms_id
fromap_terms
wherename=rec_head.terms_name;
exception
whenno_data_foundthen
v_process_flag:='E';
v_error_message:='INVALIDTERMSNAME=>'||rec_head.terms_name;
v_tot_err_msg:=v_tot_err_msg||''||v_error_message;
ee_ap_comm_err_procedure(p_interface_name=>v_conc_program,
p_table_name=>v_head_tab,
p_column_name=>'TERMS_NAME',
p_error_message=>v_error_message
);
whenothersthen
v_process_flag:='E';
v_error_message:='EXCEPTIONATTERMSNAMEVALIDATION=>'||rec_head.terms_name||''||sqlerrm;
v_tot_err_msg:=v_tot_err_msg||''||v_error_message;
ee_ap_comm_err_procedure(p_interface_name=>v_conc_program,
p_table_name=>v_head_tab,
p_column_name=>'TERMS_NAME',
p_error_message=>v_error_message
);

end;

---****invoiceamountvalidation****---begin

selectsum(amount)intov_amount
fromap_inv_line
whereinvoice_num=rec_head.invoice_num;
ifrec_head.invoice_amount<>v_amountthen

http://appsburn.blogspot.in/2012/06/completeapinterface.html

6/9

28/07/2015

ORACLESTUDENTSTUFF:CompleteAPInterface

v_process_flag:='E';
v_error_message:='INVOICEAMOUNTDOESNOTMATCHYOURLINEAMOUNT=>'||rec_head.invoice_amount;
v_tot_err_msg:=v_tot_err_msg||''||v_error_message;
ee_ap_comm_err_procedure(p_interface_name=>v_conc_program,
p_table_name=>v_head_tab,
p_column_name=>'INVOICEAMOUNT',
p_error_message=>v_error_message
);
endif;
end;

selectap_invoices_interface_s.nextvalintov_head.invoice_idfromdual;

v_head.invoice_num:=rec_head.invoice_num;
--v_head.invoice_type_lookup_code:=rec_head.invoice_type_lookup_code;
v_head.vendor_name:=rec_head.vendor_name;
v_head.vendor_site_code:=rec_head.vendor_site_code;
v_head.invoice_amount:=rec_head.invoice_amount;
v_head.terms_name:=rec_head.terms_name;
v_head.created_by:=g_user_id;
v_head.creation_date:=g_date;
v_head.last_updated_by:=g_user_id;
v_head.last_update_date:=g_date;

forrec_lineinline(rec_head.invoice_num)
loop

---***linetypevalidation***---begin
selectlookup_codeintov_line.line_type_lookup_code
fromap_lookup_codes
wherelookup_type='INVOICEDISTRIBUTIONTYPE'
anddisplayed_field=rec_line.line_type_lookup_code;

exception
whenno_data_foundthen
v_process_flag:='E';
v_error_message:='INVALIDLINETYPELOOKUPCODE=>'||rec_line.line_type_lookup_code;
v_tot_err_msg:=v_tot_err_msg||''||v_error_message;
ee_ap_comm_err_procedure(p_interface_name=>v_conc_program,
p_table_name=>v_line_tab,
p_column_name=>'LINETYPELOOKUPCODE',
p_error_message=>v_error_message
);
whenothersthen
v_process_flag:='E';
v_error_message:='EXCEPTIONATLINETYPELOOKUPCODEVALIDATION=>'||rec_line.line_type_lookup_code||''||sqlerrm;
v_tot_err_msg:=v_tot_err_msg||''||v_error_message;
ee_ap_comm_err_procedure(p_interface_name=>v_conc_program,
p_table_name=>v_line_tab,
p_column_name=>'LINETYPELOOKUPCODE',
p_error_message=>v_error_message
);

end;

---***chargeaccountvaliation***-----begin
selectgcc.code_combination_idintov_line.dist_code_combination_id
fromgl_code_combinations_kfvgcc,
gl_sets_of_booksgsb
wheregcc.chart_of_accounts_id=gsb.chart_of_accounts_id
andgsb.set_of_books_id=fnd_profile.value('GL_SET_OF_BKS_ID')
andgcc.concatenated_segments=rec_line.dist_code_concatenated;
exception
whenno_data_foundthen
v_process_flag:='E';
v_error_message:='INVALIDCHARGEACCOUNT=>'||rec_line.dist_code_concatenated;
v_tot_err_msg:=v_tot_err_msg||''||v_error_message;
ee_ap_comm_err_procedure(p_interface_name=>v_conc_program,
p_table_name=>v_line_tab,
p_column_name=>'CHARGEACCOUNT',
p_error_message=>v_error_message
);
whenothersthen
v_process_flag:='E';

http://appsburn.blogspot.in/2012/06/completeapinterface.html

7/9

28/07/2015

ORACLESTUDENTSTUFF:CompleteAPInterface

v_error_message:='EXCEPTIONATCHARGEACCOUNTVALIDATION=>'||rec_line.dist_code_concatenated||''||sqlerrm;
v_tot_err_msg:=v_tot_err_msg||''||v_error_message;
ee_ap_comm_err_procedure(p_interface_name=>v_conc_program,
p_table_name=>v_line_tab,
p_column_name=>'CHARGEACCOUNT',
p_error_message=>v_error_message
);

end;

selectap_invoice_lines_interface_s.nextvalintov_line.invoice_line_idfromdual;

v_line.invoice_id:=v_head.invoice_id;
v_line.line_number:=rec_line.line_number;
--v_line.line_type_lookup_code:=rec_line.line_type_lookup_code;
v_line.amount:=rec_line.amount;
v_line.dist_code_concatenated:=rec_line.dist_code_concatenated;
v_line.created_by:=g_user_id;
v_line.creation_date:=g_date;
v_line.last_updated_by:=g_user_id;
v_line.last_update_date:=g_date;
v_line.org_id:=v_head.org_id;

dis_log('PROCESS_FLAG=>'||v_process_flag);

ifv_process_flag='S'then
insertintoap_invoice_lines_interfacevaluesv_line;
endif;

endloop;
dis_log('PROCESS_FLAG=>'||v_process_flag);

ifv_process_flag='S'then
insertintoap_invoices_interfacevaluesv_head;
endif;

updateap_inv_headsetprocess_flag=v_process_flag,
error_message=v_tot_err_msg
whereinvoice_num=rec_head.invoice_num;
exception
whenv_inv_num_existsthen
v_process_flag:='E';
dis_log('PROCESS_FLAG=>'||v_process_flag);
v_error_message:='INVOICENUMALREADYEXISTS=>'||rec_head.invoice_num;
v_tot_err_msg:=v_tot_err_msg||''||v_error_message;
ee_ap_comm_err_procedure(p_interface_name=>v_conc_program,
p_table_name=>v_head_tab,
p_column_name=>'INVOICENUM',
p_error_message=>v_error_message
);
updateap_inv_headsetprocess_flag=v_process_flag,
error_message=v_tot_err_msg
whereinvoice_num=rec_head.invoice_num;
end;
endloop;

ap_record_details;--forrecordsinformation
arch_proc;--forarchtablesinformation

exception
whenothersthen
dis_log('EXCEPTIONATPACKAGE=>'||sqlerrm);

endmain;

endee_ap_inv_pkg;
/
Postedbyobulreddyat12:38

+1 Recommend this on Google

Labels:APInterface

No comments:
Post a Comment
http://appsburn.blogspot.in/2012/06/completeapinterface.html

8/9

28/07/2015

ORACLESTUDENTSTUFF:CompleteAPInterface

Enteryourcomment...

Commentas:

Publish

Unknown(Google)

Signout

Notifyme

Preview

NewerPost

Home

OlderPost

Subscribeto:PostComments(Atom)

PictureWindowtemplate.Templateimagesbykonradlew.PoweredbyBlogger.

http://appsburn.blogspot.in/2012/06/completeapinterface.html

9/9

Anda mungkin juga menyukai