Vous êtes sur la page 1sur 12

28/07/2015

SandeepOracleAppsNotes:APINVOICEINTERFACEPROCEDURE
0

More NextBlog

CreateBlog SignIn

SandeepOracleAppsNotes
ThisistheblogdedicatedtoOracleApplicationsusers.HereIwillbepostinginformationonOracleApplicationwhich
willhavetechnical,functionalandAdministrationrelatedtopics.Althoughthesitemaybemorebeneficialtotechnial
junkies.Pleaseremembertovisitsiteregularlyasitwillbeupdatedquiteoftenanddoremembertoencouragemeby
postingyourvaluablecomments.ThanksandRegardsSandeepReddyDudipala

Sunday,10July2011

SearchThisBlog

Search

APINVOICEINTERFACEPROCEDURE
AP_INVOICES_INTERFACE

FollowbyEmail

Emailaddress...

Submit

1)INVOICE_IDnotnullRequired,Primarykey.Thisvalueisassignedin
theInvoiceGatewaybytheAP_INVOICES_INTERFACE_Ssequence.
Followers

2)INVOICE_NUMRequiredifthereismorethanoneinvoiceforthe
supplierduringimport
3)VENDOR_IDorVENDOR_NAMEorVENDOR_NUMisreqdifnotmatchedtoPO

Jointhissite
withGoogleFriendConnect

Members(14)

4)VENDOR_SITE_IDorVENDOR_SITE_CODEisreqdifnotmatchedtoPO
5)INVOICE_AMOUNT
6)PO_NUMBER
6)INVOICE_CURRENCY_CODE:ifnoteneterddefaultedtofunctionalcurrency
7)EXCHANGE_RATE_TYPE:User,Spot,Corporate,EMUFixed,anduserdefined.forSpot,
Corporate,oranyuserdefinedratetype,thevalueyouenterhereisvalidatedagainst
theGLDailyRatestable.IfyouuseEMUFixed,Payableswillprovidetheexchangerateduring
import.IfyouuseUserastheexchangeratetype,youmustenteravalueforEXCHANGE_RATE
ortherecordwillberejectedduringimport.
8)TERMS_NAMEorTERMS_ID.:Payablessearches1)invoicerecordheader2)purchaseorder
termsifinvoiceismatchedtoPO3)suppliersite.

Alreadyamember?Signin

BlogArchive

2011(34)
September(3)
August(10)
July(21)
Jul27(1)
Jul19(1)

9)SOURCE
10)DOC_CATEGORY_CODE:
Ifyouareusingautomaticsequentialnumbering,thenPayablesOpen
InterfaceImportusesthiscolumntoassignadocumentcategorytothe
invoiceitcreates.IftheSequentialNumberingprofilevalueisAlwaysandyoudonot
enteravalueinthiscolumn,thenduringimportPayableswilluseSTANDARDasthecategoryif
theinvoiceamountiszeroorpositive,andCREDITiftheinvoiceamountisnegative.
IfyouenabletheAllowDocumentCategoryOverridePayablesoption,youcanenterthedocument
categoryyouwantOpenInterfaceImporttoassigntotheinvoicecreatedfromthisrecord
10)VOUCHER_NUM:Ifyouusemanualsequentialnumbering,thenenterauniquevalue
11)PAYMENT_CURRENCY_CODE:Currencycodeforthepayment.Ifyoudonotprovidea
value,then
duringimportPAYMENT_CURRENCY_CODEwillbesettothesamevalueasthe
INVOICE_CURRENCY_CODE,
12)PAYMENT_METHOD_LOOKUP_CODE:Methodthatwillbeusedtopaytheinvoice.
ThevaluemustbeavalidvalueforthePAYMENT_METHODlookupcode:Validation:

Jul14(8)
Jul11(4)
Jul10(6)
ImportanttablesinAPmodules
OracleAppsHelpfulNotes:Sales
OrderInterfaceU...
OracleAppsHelpfulNotes:Unix
Material
OracleAppsHelpfulNotes:AP
INVOICEINTERFACEPR...
APINVOICEINTERFACE
PROCEDURE
UnixMaterial
Jul08(1)

AboutMe

13)ACCTS_PAY_CODE_COMBINATION_ID:Liabilityaccount.
14)ORG_ID
AP_INVOICE_LINES_INTERFACE

http://sandeeporaclenotes.blogspot.in/2011/07/apinvoiceinterfaceprocedure.html

SandeepReddyDudipala
Viewmycompleteprofile

1/12

28/07/2015

SandeepOracleAppsNotes:APINVOICEINTERFACEPROCEDURE
1)INVOICE_ID:required
2)INVOICE_LINE_ID:notreqd,useAP_INVOICE_LINES_INTERFACE_S
3)LINE_NUMBER:unique,reqd
4)LINE_TYPE_LOOKUP_CODE:validvaluesITEM,TAX,MISCELLANEOUS,orFREIGHT.
5)AMOUNT:Invoicedistributionamount
6)ACCOUNTING_DATE:TheGLDatefortheinvoicedistributions.Thedatemustbeinanopen
orfutureperiod.
7)PO_HEADER_IDorPO_NUMBER
8)PO_LINE_IDorPO_LINE_NUMBER
9)dist_code_combination_idorDIST_CODE_CONCATENATED
10)ORG_ID

TotalPageviews

4 1 1 5
4

DocumentCategoryAssignmentandDocumentSequenceSetup:
fromfnd_doc_sequence_assignment,fnd_document_sequences
Nowcreatebothheadersandlineinonepackage:
CreateorReplaceProcedurem_ap_invoices(ERRBUFoutVARCHAR2,RETCODEout
VARCHAR2)
IS
startsthedeclaringvariablesforheaders
v_invoice_idap_invoices_interface.INVOICE_ID%TYPE
v_typeap_invoices_interface.INVOICE_TYPE_LOOKUP_CODE%TYPE
v_supplierap_invoices_interface.VENDOR_NAME%TYPE
v_invoice_dateap_invoices_interface.INVOICE_DATE%TYPE
v_invoice_numap_invoices_interface.INVOICE_NUM%TYPE
v_invoice_currap_invoices_interface.INVOICE_CURRENCY_CODE%TYPE
v_invoice_amountap_invoices_interface.INVOICE_AMOUNT%TYPE
v_payment_cross_rateap_invoices_interface.PAYMENT_CROSS_RATE%TYPE
v_cross_payment_currap_invoices_interface.PAYMENT_CURRENCY_CODE%TYPE
v_pay_rate_dateap_invoices_interface.PAYMENT_CROSS_RATE_DATE%TYPE
v_payment_rate_typeap_invoices_interface.PAYMENT_CROSS_RATE_TYPE%TYPE
v_descriptionap_invoices_interface.DESCRIPTION%TYPE
v_rate_typeap_invoices_interface.EXCHANGE_RATE_TYPE%TYPE
v_exchange_dateap_invoices_interface.EXCHANGE_DATE%TYPE
v_exchange_rateap_invoices_interface.EXCHANGE_RATE%TYPE
v_terms_dateap_invoices_interface.TERMS_DATE%TYPE
v_termsap_invoices_interface.TERMS_ID%TYPE
v_payment_methodap_invoices_interface.PAYMENT_METHOD_LOOKUP_CODE%TYPE
v_discountable_amtap_invoices_interface.AMOUNT_APPLICABLE_TO_DISCOUNT%TYPE
v_invoice_recieved_dateap_invoices_interface.INVOICE_RECEIVED_DATE%TYPE
v_recieved_goods_dateap_invoices_interface.GOODS_RECEIVED_DATE%TYPE
v_pay_code_combination_id
ap_invoices_interface.ACCTS_PAY_CODE_COMBINATION_ID%TYPE
v_statusap_invoices_interface.STATUS%TYPE
v_po_numberap_invoices_interface.PO_NUMBER%TYPE:=NULL
v_attribute1ap_invoices_interface.attribute1%TYPE
v_attribute2ap_invoices_interface.attribute2%TYPE
v_attribute3ap_invoices_interface.attribute3%TYPE
v_attribute4ap_invoices_interface.attribute4%TYPE
v_attribute5ap_invoices_interface.attribute5%TYPE
v_attribute6ap_invoices_interface.attribute6%TYPE
v_attribute7ap_invoices_interface.attribute7%TYPE
v_attribute8ap_invoices_interface.attribute8%TYPE
v_attribute9ap_invoices_interface.attribute9%TYPE
v_attribute10ap_invoices_interface.attribute10%TYPE
v_vendor_idpo_vendors.vendor_id%TYPE
v_vendor_site_cdpo_vendor_sites.vendor_site_code%TYPE
v_vendor_site_idpo_vendor_sites.vendor_site_id%TYPE
v_currency_codefnd_currencies.currency_code%TYPE
v_lookup_codeap_lookup_codes.lookup_code%TYPE
v_code_combgl_code_combinations.code_combination_id%TYPE
v_segment1po_headers_all.segment1%TYPE
v_term_nameap_terms.name%TYPE
v_term_idap_terms.term_id%TYPE
v_closed_datepo_headers_all.closed_date%type
v_process_flagchar(1):=NULL
v_last_dateDATE
v_countnumber
endsthedeclaringvariablesforheaders
statrtsthedeclaringvariablesforlines
v_invoice_idap_invoice_lines_interface.invoice_id%type
v_line_noap_invoice_lines_interface.line_number%type
v_amountap_invoice_lines_interface.amount%type

http://sandeeporaclenotes.blogspot.in/2011/07/apinvoiceinterfaceprocedure.html

poweredby

YahooNews:TopStories

MakeMoneyOnline!
YahooNewsTopStories
Principal'ssuicide,forgedtestsrock
promisingNYschool
NEWYORK(AP)JeaneneWorrell
Breedenhadwhatshecalledadream
jobrunningapublicschoollinkedwith
ColumbiaUniversity'sTeachers
Collegewhenshekilledherselfby
jumpinginfrontofasubwaycarthis
spring.
ARodhomerson40thbirthdayin
Yankees'62winatRangers
ARLINGTON,
Texas(AP)
AlexRodriguez
hadquitea
40thbirthday
bash.
House,Senateoncollisioncoursein

highwaydebate

2/12

28/07/2015

SandeepOracleAppsNotes:APINVOICEINTERFACEPROCEDURE
v_expence_accountap_invoice_lines_interface.dist_code_combination_id%type
v_expence_Account1ap_invoice_lines_interface.dist_code_concatenated%type
v_line_typeap_invoice_lines_interface.line_type_lookup_code%type
v_accounting_dateap_invoice_lines_interface.accounting_date%type
v_invoice_line_idap_invoice_lines_interface.invoice_line_id%type
v_line_attribute1ap_invoice_lines_interface.attribute1%TYPE
v_line_attribute2ap_invoice_lines_interface.attribute2%TYPE
v_line_attribute3ap_invoice_lines_interface.attribute3%TYPE
v_line_attribute4ap_invoice_lines_interface.attribute4%TYPE
v_line_attribute5ap_invoice_lines_interface.attribute5%TYPE
v_line_attribute6ap_invoice_lines_interface.attribute6%TYPE
v_line_attribute7ap_invoice_lines_interface.attribute7%TYPE
v_line_attribute8ap_invoice_lines_interface.attribute8%TYPE
v_line_attribute9ap_invoice_lines_interface.attribute9%TYPE
v_line_attribute10ap_invoice_lines_interface.attribute10%TYPE
v_receipt_numberap_invoice_lines_interface.receipt_number%TYPE
/*followingvariablesforPOrelatedinvoices*/
v_foundchar(1):=NULL
v_po_header_idap_invoice_lines_interface.po_header_id%TYPE
v_po_line_idap_invoice_lines_interface.po_line_id%TYPE
v_po_line_numap_invoice_lines_interface.po_line_number%TYPE
v_po_segmentap_invoice_lines_interface.po_number%TYPE
v_line_location_idap_invoice_lines_interface.po_line_location_id%TYPE
v_shipment_numap_invoice_lines_interface.po_shipment_num%TYPE
v_po_distribution_idap_invoice_lines_interface.po_distribution_id%TYPE
v_po_distribution_numap_invoice_lines_interface.po_distribution_num%TYPE
endsthedeclaringvariablesforlines
declaringcursorforfetchingheader,Linesvaluesfromstagingtable.
CURSORinvoice_cur
IS
SELECTINVH.REC_ID,
INVH.TYPE,
INVH.SUPPLIER,
INVH.SITE,
INVH.INVOICE_DATE,
INVH.INVOICE_NUMINVOICE_NUM,
INVH.INVOICE_CURR,
INVH.INVOICE_AMOUNT,
INVH.AMOUNT_PAID,
INVH.PAYMENT_CROSS_RATE,
INVH.PAYMENT_CROSS_CURR,
INVH.PAY_RATE_DATE,
INVH.PAYMENT_RATE_TYPE,
INVH.PAYMENT_RATE,
INVH.PAYMENT_AMT,
INVH.DESCRIPTION,
INVH.TRANCTION_CODE,
INVH.RATE_TYPE,
INVH.EXCHANGE_DATE,
INVH.EXCHANGE_RATE,
INVH.FUNCTIONAL_AMOUNT,
INVH.TERMS_DATE,
INVH.TERMS,
INVH.PAYMENT_METHOD,
INVH.DISCOUNTABLE_AMT,
INVH.INVOICE_RECIEVED_DATE,
INVH.RECIEVED_GOODS_DATE,
INVH.ACCTS_PAY_CODE_COMBINATION_ID,
INVH.STATUS,
INVH.PO_NUMBER,
INVH.ATTRIBUTE1HEADATTR1,
INVH.ATTRIBUTE2HEADATTR2,
INVH.ATTRIBUTE3HEADATTR3,
INVH.ATTRIBUTE4HEADATTR4,
INVH.ATTRIBUTE5HEADATTR5,
INVH.ATTRIBUTE6HEADATTR6,
INVH.ATTRIBUTE7HEADATTR7,
INVH.ATTRIBUTE8HEADATTR8,
INVH.ATTRIBUTE9HEADATTR9,
INVH.ATTRIBUTE10HEADATTR10,
INVH.PROCESS_FLAG,
INVL.INVOICE_NUMLINE_INVOICE_NUM,
INVL.LINE_NO,
INVL.AMOUNT,
INVL.EXPENCE_ACCOUNT,
INVL.EXPENCE_ACCOUNT1,

http://sandeeporaclenotes.blogspot.in/2011/07/apinvoiceinterfaceprocedure.html

3/12

28/07/2015

SandeepOracleAppsNotes:APINVOICEINTERFACEPROCEDURE
INVL.ACCOUNTING_DATE,
INVL.ATTRIBUTE1LINEATTR1,
INVL.ATTRIBUTE2LINEATTR2,
INVL.ATTRIBUTE3LINEATTR3,
INVL.ATTRIBUTE4LINEATTR4,
INVL.ATTRIBUTE5LINEATTR5,
INVL.ATTRIBUTE6LINEATTR6,
INVL.ATTRIBUTE7LINEATTR7,
INVL.ATTRIBUTE8LINEATTR8,
INVL.ATTRIBUTE9LINEATTR9,
INVL.ATTRIBUTE10LINEATTR10
FROMM_INVOICE_HEADERS_INTINVH,M_INVOICE_LINES_INTINVL
WHEREINVH.REC_ID=INVL.REC_ID
BEGIN
FORcur_invoiceINinvoice_cur
LOOP
begin
Loopstartsheretoprocessinvoiceheadersdata
fetchingsequencevalueforinvoice_id
SELECTap_invoices_interface_s.nextvalINTOv_invoice_idFROMdual
v_type:=cur_invoice.type
v_supplier:=cur_invoice.supplier
v_invoice_date:=cur_invoice.invoice_date
v_invoice_num:=cur_invoice.invoice_num
v_invoice_curr:=cur_invoice.invoice_curr
v_invoice_amount:=cur_invoice.invoice_amount
v_payment_cross_rate:=cur_invoice.payment_cross_rate
v_cross_payment_curr:=cur_invoice.payment_cross_curr
v_pay_rate_date:=cur_invoice.pay_rate_date
v_payment_rate_type:=cur_invoice.payment_rate_type
v_description:=cur_invoice.description
v_rate_type:=cur_invoice.rate_type
v_exchange_date:=cur_invoice.exchange_date
v_exchange_rate:=cur_invoice.exchange_rate
v_terms_date:=cur_invoice.terms_date
v_terms:=cur_invoice.terms
v_payment_method:=cur_invoice.payment_method
v_discountable_amt:=cur_invoice.discountable_amt
v_invoice_recieved_date:=cur_invoice.invoice_recieved_date
v_recieved_goods_date:=cur_invoice.recieved_goods_date
v_pay_code_combination_id:=cur_invoice.accts_pay_code_combination_id
v_status:=cur_invoice.status
v_po_number:=cur_invoice.po_number
v_attribute1:=cur_invoice.HEADATTR1
v_attribute2:=cur_invoice.HEADATTR2
v_attribute3:=cur_invoice.HEADATTR3
v_attribute4:=cur_invoice.HEADATTR4
v_attribute5:=cur_invoice.HEADATTR5
v_attribute6:=cur_invoice.HEADATTR6
v_attribute7:=cur_invoice.HEADATTR7
v_attribute8:=cur_invoice.HEADATTR8
v_attribute9:=cur_invoice.HEADATTR9
v_attribute10:=cur_invoice.HEADATTR10
v_process_flag:=cur_invoice.process_flag
/*Validateinvoicenumberifnullthenassigninvoicenumberequaltoweek_end_date.*/
IFv_invoice_numisnullTHEN
SELECTNEXT_DAY(SYSDATE,'FRIDAY')
INTOV_LAST_DATE
FROMDUAL
v_invoice_num:=v_last_date
ENDIF
/*validateinvoicetype*/
IFv_type<>'STANDARD'ORv_type<>'CREDIT'ORv_type<>'DEBIT'THEN
V_TYPE:=NULL
ENDIF
/*validatingvendorid*/
BEGIN
selectVENDOR_ID
intov_vendor_id
fromPO_VENDORS
wherevendor_name=ltrim(rtrim(upper(v_supplier)))
andsysdate>=start_date_active
ANDsysdate<end_date_active
EXCEPTION
WHENNO_DATA_FOUNDTHEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'NovendoridfoundORvendorstatusisnotactive

http://sandeeporaclenotes.blogspot.in/2011/07/apinvoiceinterfaceprocedure.html

4/12

28/07/2015

SandeepOracleAppsNotes:APINVOICEINTERFACEPROCEDURE
=')
WHENOTHERSTHEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'Exception'||SQLERRM)
END
/*ValidationforVENDOR_SITE_CODE*/
BEGIN
selectvendor_site_code,vendor_site_idintov_vendor_site_cd,v_vendor_site_idfrom
PO_VENDOR_SITESwhereVENDOR_ID=v_vendor_id
EXCEPTION
WHENNO_DATA_FOUNDTHEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'Novendorsitecodefoundforthisvendor
'||v_supplier)
WHENOTHERSTHEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'Exception'||SQLERRM)
END
/*Invoicecurrecycode*/
BEGIN
SELECTcurrency_code
INTOv_currency_code
FROMFND_CURRENCIES
WHEREcurrency_code=ltrim(rtrim(upper(v_invoice_curr)))
andsysdatebetweennvl(start_date_Active,sysdate)andnvl(end_date_active,sysdate)
EXCEPTION
WHENNO_DATA_FOUNDTHEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'CurrencyCodeDoesnotExistfor
'||v_invoice_curr)
WHENOTHERSTHEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'Exception'||SQLERRM)
END
/*validatingtermid*/
BEGIN
SELECTTERM_ID,NAME
INTOV_TERM_ID,V_TERM_NAME
FROMAP_TERMS
WHERETERM_ID=v_terms
andv_terms_datebetweennvl(start_date_Active,sysdate)andnvl(end_date_active,sysdate)
v_term_datenotinver11.5.0
EXCEPTION
WHENNO_DATA_FOUNDTHEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'TermidORTermnameDoesnotExistfor
'||v_terms)
WHENOTHERSTHEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'Exception'||SQLERRM)
END
/*validatingpaymentmethod*/
BEGIN
SELECTlookup_code
INTOv_lookup_code
FROMap_lookup_codes
WHERElookup_code=upper(v_payment_method)
EXCEPTION
WHENNO_DATA_FOUNDTHEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'PaymentMethodarenotexist
inlookuptable')
WHENOTHERSTHEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'Exception'||SQLERRM)
END
/*validatingGLCodeCombinationvalidation*/
BEGIN
SELECTcode_combination_id
INTOv_code_comb
FROMgl_code_combinations
WHEREcode_combination_id=v_pay_code_combination_id
EXCEPTION
WHENNO_DATA_FOUNDTHEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'CodeCombinationidnotexistintable')
WHENOTHERSTHEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'Exception'||SQLERRM)
END
/*validatingponumber*/
BEGIN
IFv_po_numberisnotnullTHEN
SELECTsegment1,closed_date
INTOv_segment1,v_closed_date
FROMpo_headers_all
WHEREsegment1=v_po_number

http://sandeeporaclenotes.blogspot.in/2011/07/apinvoiceinterfaceprocedure.html

5/12

28/07/2015

SandeepOracleAppsNotes:APINVOICEINTERFACEPROCEDURE
IFv_closed_dateisnotnullTHEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'POStausisinactive')
ENDIF
ENDIF
EXCEPTION
WHENNO_DATA_FOUNDTHEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'POnumbernotfound')
WHENOTHERSTHEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'Exception'||SQLERRM)
END
/*ValidatingPaymentcrossrate*/
BEGIN
IFv_invoice_curr=v_cross_payment_currTHEN
v_payment_cross_rate:=1
ELSE
SELECTconversion_rate
INTOv_payment_cross_ratev_conversion_rate
FROMgl_daily_rates
WHEREfrom_currency=v_invoice_curr
andto_currency=v_cross_payment_curr
andconversion_date=v_pay_rate_date
andconversion_type=v_payment_rate_type
ENDIF
EXCEPTION
WHENNO_DATA_FOUNDTHEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'Conversionratesnotfound')
WHENOTHERSTHEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'Exception'||SQLERRM)
END
/*validatingexchangerate*/
IFv_rate_type='USER'andv_exchange_rateisnotnullTHEN
NULL
ELSIFv_rate_type='USER'andv_exchange_rateisnullTHEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'Exchangerateisnullfortheinvoicenumber
'||v_invoice_num)
ELSIFv_rate_type<>'USER'andv_exchange_rateisnotnullTHEN
v_exchange_rate:=0
ENDIF
/*validatingduplicationofinvoice*/
SELECTCOUNT(*)
INTOv_count
FROMAP_INVOICES_ALL
WHEREINVOICE_NUM=V_INVOICE_NUM
ANDVENDOR_ID=v_vendor_id
IFv_count>0THEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'InvociealreadyExists'||v_invoice_num)
UPDATEM_INVOICE_HEADERS_INT
SETprocess_flag='N'
WHEREinvoice_num=v_invoice_num
andsupplier=v_supplier
Else
insertingvalidatedvaluestointerfacetable(headers)
INSERTINTOap_invoices_interface(
invoice_id,
invoice_num,
invoice_type_lookup_code,
invoice_date,
po_number,
vendor_id,
vendor_name,
vendor_site_id,
vendor_site_code,
invoice_amount,
invoice_currency_code,
exchange_rate,
exchange_rate_type,
exchange_date,
terms_id,
terms_name,
terms_date,
description,
status,
source,
payment_cross_rate_type,
payment_cross_rate_date,
payment_cross_rate,

http://sandeeporaclenotes.blogspot.in/2011/07/apinvoiceinterfaceprocedure.html

6/12

28/07/2015

SandeepOracleAppsNotes:APINVOICEINTERFACEPROCEDURE
payment_currency_code,
payment_method_lookup_code,
goods_received_date,
invoice_received_date,
gl_date,
accts_pay_code_combination_id,
amount_applicable_to_discount,
attribute1,
attribute2,
attribute3,
attribute4,
attribute5,
attribute6,
attribute7,
attribute8,
attribute9,
attribute10,
creation_date,
created_by,
last_update_date,
last_updated_by
)
VALUES
(
v_invoice_id,
v_invoice_num,
v_type,
v_invoice_date,
v_po_number,
v_vendor_id,
v_supplier,
v_vendor_site_id,
v_vendor_site_cd,
nvl(v_invoice_amount,0),
v_invoice_curr,
v_exchange_rate,
v_rate_type,
v_exchange_date,
v_terms,
v_term_name,
v_terms_date,
v_description,
v_status,
'InvoiceGateway',
v_payment_rate_type,
v_pay_rate_date,
v_payment_cross_rate,
v_cross_payment_curr,
v_payment_method,
v_recieved_goods_date,
v_invoice_recieved_date,
'30NOV2003',
v_pay_code_combination_id,
v_discountable_amt,
v_attribute1,
v_attribute2,
v_attribute3,
v_attribute4,
v_attribute5,
v_attribute6,
v_attribute7,
v_attribute8,
v_attribute9,
v_attribute10,
sysdate,
FND_GLOBAL.user_id,
sysdate,
FND_GLOBAL.user_id
)
startsheretoprocessinvoicelinesdata
fetchingsequencevalueforinvoice_line_id
selectap_invoice_lines_interface_s.nextvalintov_invoice_line_idfromdual
assigningvaluesfromstagingtable(lines)
v_invoice_num:=cur_invoice.invoice_num
v_line_no:=cur_invoice.line_no
v_amount:=cur_invoice.amount

http://sandeeporaclenotes.blogspot.in/2011/07/apinvoiceinterfaceprocedure.html

7/12

28/07/2015

SandeepOracleAppsNotes:APINVOICEINTERFACEPROCEDURE
v_expence_account:=cur_invoice.expence_account
v_expence_account1:=cur_invoice.expence_account1
v_accounting_date:=cur_invoice.accounting_date
v_line_type:='Item'(Item,Fright,Tax,Miscellaneous)
v_line_attribute1:=cur_invoice.LINEATTR1
v_line_attribute2:=cur_invoice.LINEATTR2
v_line_attribute3:=cur_invoice.LINEATTR3
v_line_attribute4:=cur_invoice.LINEATTR4
v_line_attribute5:=cur_invoice.LINEATTR5
v_line_attribute6:=cur_invoice.LINEATTR6
v_line_attribute7:=cur_invoice.LINEATTR7
v_line_attribute8:=cur_invoice.LINEATTR8
v_line_attribute9:=cur_invoice.LINEATTR9
v_line_attribute10:=cur_invoice.LINEATTR10
ValidateLineLevelAccountingDate
BEGIN
SELECT'Y'
INTOv_found
FROMgl_period_statuses
WHEREapplication_id=200ASSUMTION
ANDset_of_books_id=3ASSUMTION
ANDSYSDATEbetweenstart_dateANDend_date
ANDclosing_statusIN('O','F')
ANDNVL(adjustment_period_flag,'N')='N'
ANDROWNUM=1
EXCEPTION
WHENNO_DATA_FOUNDTHEN
FND_FILE.PUT_LINE(FND_FILE.log,'AccountingDateIsNotInOpen')
END
/*starttoValidateLineLevelforpo_numbermatching/validating*/
gettheinfoofheader(ifinvoiceisrelatedtopo_number)
BEGIN
Selectpo_header_id,segment1
intov_po_header_id,v_po_segment
Frompo_headers_all
whereVendor_ID=vendor_id
EXCEPTION
WHENNO_DATA_FOUNDTHEN
FND_FILE.PUT_LINE(FND_FILE.log,'POnotfoundinHeaders')
END
gettheinfoline(ifinvoiceisrelatedtopo_number)
BEGIN
Selectpo_line_id,line_num
intov_po_line_id,v_po_line_num
Frompo_lines_all
where
Po_Header_ID=v_po_header_id
EXCEPTION
WHENNO_DATA_FOUNDTHEN
FND_FILE.PUT_LINE(FND_FILE.log,'POnotfoundinLines')
END
gettheinfolocation(ifinvoiceisrelatedtopo_number)
BEGIN
Selectline_location_id,shipment_num
intov_line_location_id,v_shipment_num
Frompo_line_locations_all
where
Po_Header_ID=v_po_header_id
and
Po_Line_ID=v_po_line_id
EXCEPTION
WHENNO_DATA_FOUNDTHEN
FND_FILE.PUT_LINE(FND_FILE.log,'POnotfoundinLocations')
END
gettheinfoofdistributions(ifinvoiceisrelatedtopo_number)
BEGIN
Selectpo_distribution_id,distribution_num
intov_po_distribution_id,v_po_distribution_num
Frompo_distributions_all
where
Po_Header_ID=v_po_header_id
and
Po_Line_ID=v_po_line_id
and
Line_Location_ID=v_line_location_id
EXCEPTION

http://sandeeporaclenotes.blogspot.in/2011/07/apinvoiceinterfaceprocedure.html

8/12

28/07/2015

SandeepOracleAppsNotes:APINVOICEINTERFACEPROCEDURE
WHENNO_DATA_FOUNDTHEN
FND_FILE.PUT_LINE(FND_FILE.log,'POnotfoundindistributionss')
END
/*endtoValidateLineLevelforpo_numbermatching/validating*/
/*starttoinsertinginvoiceline*/
INSERTINTOap_invoice_lines_interface(
invoice_id,
invoice_line_id,
line_number,
line_type_lookup_code,
amount,
accounting_date,
dist_code_concatenated,
dist_code_combination_id,
po_header_id,
po_number,
po_line_id,
po_line_number,
po_line_location_id,
po_shipment_num,
po_distribution_id,
po_distribution_num,
receipt_number,
attribute1,
attribute2,
attribute3,
attribute4,
attribute5,
attribute6,
attribute7,
attribute8,
attribute9,
attribute10,
creation_date,
created_by,
last_update_date,
last_updated_by
)
VALUES(v_invoice_id,
v_invoice_line_id,
v_line_no,
v_line_type,
v_amount,
v_accounting_date,
v_expence_account1,
v_expence_account,
v_po_header_id,
v_po_segment,
v_po_line_id,
v_po_line_num,
v_line_location_id,
v_shipment_num,
v_po_distribution_id,
v_po_distribution_num,
v_receipt_number,
v_line_attribute1,
v_line_attribute2,
v_line_attribute3,
v_line_attribute4,
v_line_attribute5,
v_line_attribute6,
v_line_attribute7,
v_line_attribute8,
v_line_attribute9,
v_line_attribute10,
sysdate,
FND_GLOBAL.user_id,
sysdate,
FND_GLOBAL.user_id
)
/*endtoinsertinginvoiceline*/
endsheretoprocessinvoicelinesdata
ENDIF
EXCEPTION
WHENNO_DATA_FOUNDTHEN
commit

http://sandeeporaclenotes.blogspot.in/2011/07/apinvoiceinterfaceprocedure.html

9/12

28/07/2015

SandeepOracleAppsNotes:APINVOICEINTERFACEPROCEDURE
exit
WHENOTHERSTHEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'Exception'||SQLERRM)
rollback
exit
end
ENDLOOPLoopendsheretoprocessinvoiceheadersdata
FND_FILE.PUT_LINE(FND_FILE.log,'DataTransferisSuccessfull')
END
/
Ifthisnotesisusefulforanyonepleasesubmityourcomments
thankyou
sandeep
PostedbySandeepReddyDudipalaat23:03

Recommend this on Google

16comments:
Anonymous 19August2012at13:38
Thiscodeisreallyhelpfulandthanksfortheeffort.
Reply

Anonymous 6November2012at03:39
Thanksalot...Itreallyhelp.
Reply

Anonymous 27February2013at19:31
Agoodpieceofwork..thanksfortheeffort.
Reply

Anonymous 4July2013at12:08
Goodwork!
Reply

Anonymous 25July2013at03:23
Goodcontent.Thnx.
Reply

Anonymous 17September2013at23:19
GoodWork...
Reply

Anonymous 2October2013at13:04
HiThere,
Isthereawaytoidentifythesalesorderlinesdeletedfromra_transaction_interfacewherethe
linesofthesalesordersareclosed.IsthereawaytobringthembacktointerfaceforInvocie.
Thanks
G
Reply

PreedaChuenban 13October2013at06:21
GoodContent,Thankyouverymuch.
Reply

Anonymous 12November2013at01:38
YesSandeepit'sVeryVeryUsefultoFunctionalConsultantslikeus.Thankyouforpostingsuch

http://sandeeporaclenotes.blogspot.in/2011/07/apinvoiceinterfaceprocedure.html

10/12

28/07/2015

SandeepOracleAppsNotes:APINVOICEINTERFACEPROCEDURE
kindofThankyouverymuchkeepituplikeDearSandeep.
Reply

Anonymous 12November2013at02:29
HiSandeepCouldupleasepostGLInterfaceDetailprocoessasitislikethis.
Reply

Anonymous 27November2013at22:45
GoodWorkSandeep,Reallythisclearexplanationwillhelpforbeginnersalot.
Reply

RusithaUdayanga 23April2014at00:44
Thanksalot
Reply

BrajabandhuBehera 23July2014at23:44
HiSandeep,
Thanksforthiscode.
IamtryingtosubmittheOpenintarfaceprograminAppsR12.2.3version,iGottheerror,canyou
pleasehelpme.
MSG00883:AfterRepportTrigger:SettingtheOrgContexttoMultiple
Reply

MultiJack213 11March2015at01:58
ThanksaLot
Reply

SHIRAZZZZ!!!!!!!!!! 4May2015at23:54
Wonderful.Thanksforit.Helpsalottounderstandtheflow
Reply

indra 20June2015at23:06
thanks,itisveryusefulformetolearningmore
Reply

Enteryourcomment...

Commentas:

Publish

Unknown(Google)

Signout

Notifyme

Preview

Linkstothispost
CreateaLink
NewerPost

Home

OlderPost

Subscribeto:PostComments(Atom)

Pages

Home

http://sandeeporaclenotes.blogspot.in/2011/07/apinvoiceinterfaceprocedure.html

11/12

28/07/2015

SandeepOracleAppsNotes:APINVOICEINTERFACEPROCEDURE
AvrilGirl

Simpletemplate.PoweredbyBlogger.

http://sandeeporaclenotes.blogspot.in/2011/07/apinvoiceinterfaceprocedure.html

12/12

Vous aimerez peut-être aussi