Saturday, 2 June 2018

api to create ap invoice in oracle apps r12.payables api in oracle apps r12

Api to create ap invoice in oracle apps r12.Payables api in oracle apps r12

In this post , We are sharing the AP Invoice Creation API. Oracle has provided the standard API to create payables invoices in oracle apps.
 
 

api to create ap invoice in oracle apps r12.

 
Oracle had provided three API's to create AP invoices in Oracle Apps.
 
 
AP_AI_TABLE_HANDLER_PKG.INSERT_ROW ==> For Invoice Headers
 
AP_AIL_TABLE_HANDLER_PKG.INSERT_ROW  ==> For Invoice Lines
 
AP_AID_TABLE_HANDLER_PKG.INSERT_ROW  ==> For Invoice Distributions




  

declare

 

SELECT AP_INVOICES_S.NEXTVAL

    INTO l_INVOICE_ID

    FROM DUAL;

 

  BEGIN

 

 AP_AI_TABLE_HANDLER_PKG.INSERT_ROW

  (P_ROWID                       =>’ROW_ID’

,P_INVOICE_ID                    => l_INVOICE_ID,

P_LAST_UPDATE_DATE              =>SYSDATE

,P_LAST_UPDATED_BY               =>L_USER_ID

,P_VENDOR_ID                     =>LV_VENDOR_ID

,P_INVOICE_NUM                   =>’INVOICE_NUM’

,P_INVOICE_AMOUNT                =>’INVOICE_AMOUNT’

,P_VENDOR_SITE_ID                =>’VENDOR_SITE_ID’

,P_AMOUNT_PAID                   =>0.00

,P_DISCOUNT_AMOUNT_TAKEN         =>0

,P_INVOICE_DATE                  =>SYSDATE

,P_SOURCE                        =>’LV_SOURCE’

,P_INVOICE_TYPE_LOOKUP_CODE      =>’LV_INVOICE_TYPE’

,P_DESCRIPTION                   =>NULL

,P_BATCH_ID                      =>NULL

,P_AMT_APPLICABLE_TO_DISCOUNT    =>’INVOICE_AMOUNT’

,P_TERMS_ID                      =>’TERM_ID’

,P_TERMS_DATE                    =>SYSDATE

,P_GOODS_RECEIVED_DATE           =>NULL

,P_INVOICE_RECEIVED_DATE         =>NULL

,P_VOUCHER_NUM                   =>NULL

,P_APPROVED_AMOUNT               =>’INVOICE_AMOUNT’

,P_APPROVAL_STATUS               =>NULL

,P_APPROVAL_DESCRIPTION          =>NULL

,P_PAY_GROUP_LOOKUP_CODE         =>'Standard'

,P_SET_OF_BOOKS_ID               =>’SET_OF_BOOKS_ID’

,P_ACCTS_PAY_CCID                =>NULL--LV_CODE_COMBINATION_ID

,P_RECURRING_PAYMENT_ID          =>NULL

,P_INVOICE_CURRENCY_CODE         =>’INVOICE_CURRENCY_CODE’

,P_PAYMENT_CURRENCY_CODE         =>’INVOICE_CURRENCY_CODE’

,P_EXCHANGE_RATE                 =>NULL

,P_PAYMENT_AMOUNT_TOTAL          =>NULL

,P_PAYMENT_STATUS_FLAG           =>'N'

,P_POSTING_STATUS                =>NULL

,P_AUTHORIZED_BY                 =>NULL

,P_ATTRIBUTE_CATEGORY            =>NULL

,P_ATTRIBUTE1                    =>NULL

,P_ATTRIBUTE2                    =>NULL

,P_ATTRIBUTE3                    =>NULL

,P_ATTRIBUTE4                    =>NULL

,P_ATTRIBUTE5                    =>NULL

,P_CREATION_DATE                 =>SYSDATE

,P_CREATED_BY                    =>L_USER_ID

,P_VENDOR_PREPAY_AMOUNT          =>NULL

,P_BASE_AMOUNT                   =>NULL

,P_EXCHANGE_RATE_TYPE            =>NULL

,P_EXCHANGE_DATE                 =>NULL

,P_PAYMENT_CROSS_RATE            =>1

,P_PAYMENT_CROSS_RATE_TYPE       =>NULL

,P_PAYMENT_CROSS_RATE_DATE       =>SYSDATE

,P_PAY_CURR_INVOICE_AMOUNT       =>’INVOICE_AMOUNT’

,P_LAST_UPDATE_LOGIN             =>NULL

,P_ORIGINAL_PREPAYMENT_AMOUNT    =>NULL

,P_EARLIEST_SETTLEMENT_DATE      =>NULL

,P_ATTRIBUTE11                   =>NULL

,P_ATTRIBUTE12                   =>NULL

,P_ATTRIBUTE13                   =>NULL

,P_ATTRIBUTE14                   =>NULL

,P_ATTRIBUTE6                    =>NULL

,P_ATTRIBUTE7                    =>NULL

,P_ATTRIBUTE8                    =>NULL

,P_ATTRIBUTE9                    =>NULL

,P_ATTRIBUTE10                   =>NULL

,P_ATTRIBUTE15                   =>NULL

,P_CANCELLED_DATE                =>NULL

,P_CANCELLED_BY                  =>NULL

,P_CANCELLED_AMOUNT              =>NULL

,P_TEMP_CANCELLED_AMOUNT         =>NULL

,P_EXCLUSIVE_PAYMENT_FLAG        =>NULL

,P_PO_HEADER_ID                  =>NULL

,P_DOC_SEQUENCE_ID               =>NULL

,P_DOC_SEQUENCE_VALUE            =>NULL

,P_DOC_CATEGORY_CODE             =>NULL

,P_EXPENDITURE_ITEM_DATE         =>NULL

,P_EXPENDITURE_ORGANIZATION_ID   =>NULL

,P_EXPENDITURE_TYPE              =>NULL

,P_PA_DEFAULT_DIST_CCID          =>NULL

,P_PA_QUANTITY                   =>NULL

,P_PROJECT_ID                    =>NULL

,P_TASK_ID                       =>NULL

,P_AWT_FLAG                      =>NULL

,P_AWT_GROUP_ID                  =>NULL

,P_PAY_AWT_GROUP_ID              =>NULL

,P_REFERENCE_1                   =>NULL

,P_REFERENCE_2                   =>NULL

,P_ORG_ID                        =>’ORG_ID’

,P_CALLING_SEQUENCE              =>'1'

,P_GL_DATE                       =>SYSDATE

,P_AWARD_ID                      =>NULL

,P_APPROVAL_ITERATION            =>NULL

,P_APPROVAL_READY_FLAG           =>'Y'

,P_WFAPPROVAL_STATUS             =>'NOT REQUIRED'

,P_PAYMENT_METHOD_CODE           =>’PAYMENT_METHOD_CODE’

,P_PARTY_ID                      =>’PARTY_ID’

,P_PARTY_SITE_ID                 =>’PARTY_SITE_ID’

,P_TAXATION_COUNTRY              =>NULL

,P_LEGAL_ENTITY_ID               =>’ORG_ID’

,P_QUICK_PO_HEADER_ID            =>’PO_HEADER_ID’);

 

  DBMS_OUTPUT.PUT_LINE('headers end ');

     COMMIT;

      EXCEPTION

   WHEN TOO_MANY_ROWS THEN

   DBMS_OUTPUT.PUT_LINE(SQLERRM);

   DBMS_OUTPUT.PUT_LINE(SQLCODE);

   WHEN NO_DATA_FOUND THEN

   DBMS_OUTPUT.PUT_LINE(SQLERRM);

   DBMS_OUTPUT.PUT_LINE(SQLCODE);

   WHEN OTHERS THEN

   DBMS_OUTPUT.PUT_LINE(SQLERRM);

   DBMS_OUTPUT.PUT_LINE(SQLCODE);

    COMMIT;

  END;

 

declare

BEGIN

 

         DBMS_OUTPUT.PUT_LINE('row ID for lines insert IS  : '||L.ROW_ID);

 

    DBMS_OUTPUT.PUT_LINE('invoice id at lines :   : '|| l_INVOICE_ID);

 

  AP_AIL_TABLE_HANDLER_PKG.INSERT_ROW(

 P_ROWID                             =>’ROW_ID’

,P_INVOICE_ID                        =>l_INVOICE_ID

,P_LINE_NUMBER                       =>’LINE_NUMBER’

,P_LINE_TYPE_LOOKUP_CODE             =>’LINE_TYPE’

,P_LINE_GROUP_NUMBER                 =>NULL

,P_REQUESTER_ID                      =>NULL

,P_DESCRIPTION                       =>NULL

,P_LINE_SOURCE                       =>'Manual Invoice Line Entry'

,P_ORG_ID                            =>’ORG_ID’

,P_INVENTORY_ITEM_ID                 =>’INVENTORY_ITEM_ID’

,P_ITEM_DESCRIPTION                  =>’DESCRIPTION’

,P_SERIAL_NUMBER                     =>NULL

,P_MANUFACTURER                      =>NULL

,P_MODEL_NUMBER                      =>NULL

,P_WARRANTY_NUMBER                   =>NULL

,P_GENERATE_DISTS                    =>'D'

,P_MATCH_TYPE                        =>NULL

,P_DISTRIBUTION_SET_ID               =>NULL

,P_ACCOUNT_SEGMENT                   =>NULL

,P_BALANCING_SEGMENT                 =>NULL

,P_COST_CENTER_SEGMENT               =>NULL

,P_OVERLAY_DIST_CODE_CONCAT          =>NULL

,P_DEFAULT_DIST_CCID                 =>NULL

,P_PRORATE_ACROSS_ALL_ITEMS          =>NULL

,P_ACCOUNTING_DATE                   =>SYSDATE

,P_PERIOD_NAME                       =>NULL

,P_DEFERRED_ACCTG_FLAG               =>'N'

,P_DEF_ACCTG_START_DATE              =>NULL

,P_DEF_ACCTG_END_DATE                =>NULL

,P_DEF_ACCTG_NUMBER_OF_PERIODS       =>NULL

,P_DEF_ACCTG_PERIOD_TYPE             =>NULL

,P_SET_OF_BOOKS_ID                   =>’SET_OF_BOOKS_ID’

,P_AMOUNT                            =>’LINE_AMOUNT’

,P_BASE_AMOUNT                       =>NULL

,P_ROUNDING_AMT                      =>NULL

,P_QUANTITY_INVOICED                 =>’QUANTITY_INVOICED’

,P_UNIT_MEAS_LOOKUP_CODE             =>’UNIT_MEASURE’

,P_UNIT_PRICE                        =>’UNIT_PRICE’

,P_WFAPPROVAL_STATUS                 =>'NOT REQUIRED'

,P_DISCARDED_FLAG                    =>NULL

,P_ORIGINAL_AMOUNT                   =>NULL

,P_ORIGINAL_BASE_AMOUNT              =>NULL

,P_ORIGINAL_ROUNDING_AMT             =>NULL

,P_CANCELLED_FLAG                    =>NULL

,P_INCOME_TAX_REGION                 =>NULL

,P_TYPE_1099                         =>NULL

,P_STAT_AMOUNT                       =>NULL

,P_PREPAY_INVOICE_ID                 =>NULL

,P_PREPAY_LINE_NUMBER                =>NULL

,P_INVOICE_INCLUDES_PREPAY_FLAG      =>NULL

,P_CORRECTED_INV_ID                  =>NULL

,P_CORRECTED_LINE_NUMBER             =>NULL

,P_PO_HEADER_ID                      =>’PO_HEADER_ID’

,P_PO_RELEASE_ID                     =>NULL

,P_PO_LINE_LOCATION_ID               =>’LINE_LOCATION_ID’

,P_PO_DISTRIBUTION_ID                =>NULL

 ,P_PO_LINE_ID                       =>’PO_LINE_ID’

,P_RCV_TRANSACTION_ID                =>NULL

,P_FINAL_MATCH_FLAG                  =>NULL

,P_ASSETS_TRACKING_FLAG              =>'Y'

,P_ASSET_BOOK_TYPE_CODE              =>NULL

,P_ASSET_CATEGORY_ID                 =>NULL

,P_PROJECT_ID                        =>NULL

,P_TASK_ID                           =>NULL

,P_EXPENDITURE_TYPE                  =>NULL

,P_EXPENDITURE_ITEM_DATE             =>NULL

,P_EXPENDITURE_ORGANIZATION_ID       =>NULL

,P_PA_QUANTITY                       =>1

,P_PA_CC_AR_INVOICE_ID               =>NULL

,P_PA_CC_AR_INVOICE_LINE_NUM         =>NULL

,P_PA_CC_PROCESSED_CODE              =>NULL

,P_AWARD_ID                          =>NULL

,P_AWT_GROUP_ID                      =>NULL

,P_PAY_AWT_GROUP_ID                  =>NULL

,P_REFERENCE_1                       =>NULL

,P_REFERENCE_2                       =>NULL

,P_RECEIPT_VERIFIED_FLAG             =>NULL

,P_RECEIPT_REQUIRED_FLAG             =>NULL

,P_RECEIPT_MISSING_FLAG              =>NULL

,P_JUSTIFICATION                     =>NULL

,P_EXPENSE_GROUP                     =>NULL

,P_START_EXPENSE_DATE                =>NULL

,P_END_EXPENSE_DATE                  =>NULL

,P_RECEIPT_CURRENCY_CODE             =>NULL

,P_RECEIPT_CONVERSION_RATE           =>NULL

,P_RECEIPT_CURRENCY_AMOUNT           =>NULL

,P_DAILY_AMOUNT                      =>NULL

,P_WEB_PARAMETER_ID                  =>NULL

,P_ADJUSTMENT_REASON                 =>NULL

,P_MERCHANT_DOCUMENT_NUMBER          =>NULL

,P_MERCHANT_NAME                     =>NULL

,P_MERCHANT_REFERENCE                =>NULL

,P_MERCHANT_TAX_REG_NUMBER           =>NULL

,P_MERCHANT_TAXPAYER_ID              =>NULL

,P_COUNTRY_OF_SUPPLY                 =>NULL

,P_CREDIT_CARD_TRX_ID                =>NULL

,P_COMPANY_PREPAID_INVOICE_ID        =>NULL

,P_CC_REVERSAL_FLAG                  =>NULL

,P_CREATION_DATE                     =>SYSDATE

,P_CREATED_BY                        =>NULL

,P_LAST_UPDATED_BY                   =>L_USER_ID

,P_LAST_UPDATE_DATE                  =>SYSDATE

,P_LAST_UPDATE_LOGIN                 =>NULL

,P_PROGRAM_APPLICATION_ID            =>NULL

,P_PROGRAM_ID                        =>NULL

,P_PROGRAM_UPDATE_DATE               =>NULL

,P_REQUEST_ID                        =>NULL

,P_ATTRIBUTE_CATEGORY                =>NULL

,P_ATTRIBUTE1                        =>NULL

,P_ATTRIBUTE2                        =>NULL

,P_ATTRIBUTE3                        =>NULL

,P_ATTRIBUTE4                        =>NULL

,P_ATTRIBUTE5                        =>NULL

,P_CALLING_SEQUENCE                  =>'1'

,P_SHIP_TO_LOCATION_ID               =>NULL);

 

 

     DBMS_OUTPUT.PUT_LINE('AMOUNT :  '||L.LINE_AMOUNT);

     DBMS_OUTPUT.PUT_LINE('INVOICE ID  :  '||XX_AP_SEQ);

     DBMS_OUTPUT.PUT_LINE('H.LINE_NUMBER  :  '||L.LINE_NUMBER);

End;

 

declare

BEGIN

 

    SELECT AP_INVOICE_DISTRIBUTIONS_S.NEXTVAL

   INTO L_AP_INVOICE_DIS_ID

   FROM DUAL;

 

 

   DBMS_OUTPUT.PUT_LINE('invoice id distributions :'|| l_INVOICE_ID);

 

AP_AID_TABLE_HANDLER_PKG.INSERT_ROW

( P_ROWID                             =>D.ROW_ID

,P_INVOICE_ID                         =>l_INVOICE_ID

,P_INVOICE_LINE_NUMBER                =>’LINE_NUMBER’

,P_DISTRIBUTION_CLASS                 =>'PERMANENT'

,P_INVOICE_DISTRIBUTION_ID            =>L_AP_INVOICE_DIS_ID

,P_DIST_CODE_COMBINATION_ID           =>’CODE_COMBINATION_ID’

,P_LAST_UPDATE_DATE                   =>SYSDATE

,P_LAST_UPDATED_BY                    =>L_USER_ID

,P_ACCOUNTING_DATE                    =>SYSDATE

,P_PERIOD_NAME                        =>’PERIOD_NAME’

,P_SET_OF_BOOKS_ID                    =>’SET_OF_BOOKS_ID’

,P_AMOUNT                             =>’AMOUNT’

,P_DESCRIPTION                        =>NULL

,P_TYPE_1099                          =>NULL

,P_POSTED_FLAG                        =>'N'

,P_BATCH_ID                           =>NULL

,P_QUANTITY_INVOICED                  =>NULL

,P_UNIT_PRICE                         =>NULL

,P_MATCH_STATUS_FLAG                  =>NULL

,P_ATTRIBUTE_CATEGORY                 =>NULL

,P_ATTRIBUTE1                         =>NULL

,P_ATTRIBUTE2                         =>NULL

,P_ATTRIBUTE3                         =>NULL

,P_ATTRIBUTE4                         =>NULL

,P_ATTRIBUTE5                         =>NULL

,P_PREPAY_AMOUNT_REMAINING            =>NULL

,P_ASSETS_ADDITION_FLAG               =>'N'

,P_ASSETS_TRACKING_FLAG               =>'Y'

,P_DISTRIBUTION_LINE_NUMBER           =>’DIS_LINE_NUM’

,P_LINE_TYPE_LOOKUP_CODE              =>’DIS_TYPE’

,P_PO_DISTRIBUTION_ID                 =>’PO_DISTRIBUTION_ID’

,P_BASE_AMOUNT                        =>NULL

,P_PA_ADDITION_FLAG                   =>NULL

,P_POSTED_AMOUNT                      =>NULL

,P_POSTED_BASE_AMOUNT                 =>NULL

,P_ENCUMBERED_FLAG                    =>NULL

,P_ACCRUAL_POSTED_FLAG                =>NULL

,P_CASH_POSTED_FLAG                   =>NULL

,P_LAST_UPDATE_LOGIN                  =>NULL

,P_CREATION_DATE                      =>NULL

,P_CREATED_BY                         =>NULL

,P_STAT_AMOUNT                        =>NULL

,P_ATTRIBUTE11                        =>NULL

,P_ATTRIBUTE12                        =>NULL

,P_ATTRIBUTE13                        =>NULL

,P_ATTRIBUTE14                        =>NULL

,P_ATTRIBUTE6                         =>NULL

,P_ATTRIBUTE7                         =>NULL

,P_ATTRIBUTE8                         =>NULL

,P_ATTRIBUTE9                         =>NULL

,P_ATTRIBUTE10                        =>NULL

,P_ATTRIBUTE15                        =>NULL

,P_ACCTS_PAY_CODE_COMB_ID             =>NULL

,P_REVERSAL_FLAG                      =>NULL

,P_PARENT_INVOICE_ID                  =>NULL

,P_INCOME_TAX_REGION                  =>NULL

,P_FINAL_MATCH_FLAG                   =>NULL

,P_EXPENDITURE_ITEM_DATE              =>NULL

,P_EXPENDITURE_ORGANIZATION_ID        =>NULL

,P_EXPENDITURE_TYPE                   =>NULL

,P_PA_QUANTITY                        =>NULL

,P_PROJECT_ID                         =>NULL

,P_TASK_ID                            =>NULL

,P_QUANTITY_VARIANCE                  =>NULL

,P_BASE_QUANTITY_VARIANCE             =>NULL

,P_PACKET_ID                          =>NULL

,P_AWT_FLAG                           =>NULL

,P_AWT_GROUP_ID                       =>NULL

,P_PAY_AWT_GROUP_ID                   =>NULL

,P_AWT_TAX_RATE_ID                    =>NULL

,P_AWT_GROSS_AMOUNT                   =>NULL

,P_REFERENCE_1                        =>NULL

,P_REFERENCE_2                        =>NULL

,P_ORG_ID                             =>’ORG_ID’

,P_OTHER_INVOICE_ID                   =>NULL

,P_AWT_INVOICE_ID                     =>NULL

,P_AWT_ORIGIN_GROUP_ID                =>NULL

,P_PROGRAM_APPLICATION_ID             =>NULL

,P_PROGRAM_ID                         =>NULL

,P_PROGRAM_UPDATE_DATE                =>NULL

,P_REQUEST_ID                         =>NULL

,P_TAX_RECOVERABLE_FLAG               =>NULL

,P_AWARD_ID                           =>NULL

,P_START_EXPENSE_DATE                 =>NULL

,P_MERCHANT_DOCUMENT_NUMBER           =>NULL

,P_MERCHANT_NAME                      =>NULL

,P_MERCHANT_TAX_REG_NUMBER            =>NULL

,P_MERCHANT_TAXPAYER_ID               =>NULL

,P_COUNTRY_OF_SUPPLY                  =>NULL

,P_MERCHANT_REFERENCE                 =>NULL

,P_PARENT_REVERSAL_ID                 =>NULL

,P_RCV_TRANSACTION_ID                 =>NULL

,P_MATCHED_UOM_LOOKUP_CODE            =>NULL

,P_CALLING_SEQUENCE                   =>'1'

,P_RCV_CHARGE_ADDITION_FLAG            =>NULL

);

 

     DBMS_OUTPUT.PUT_LINE('distributions  end ');

 

             DBMS_OUTPUT.PUT_LINE('values successfully inserted ');

 

End;

4 comments:

Daphne Joli said...
This comment has been removed by the author.
Oracle blog said...

oracleapplicationsblog@gmail.com, Please share your code.

Ansh said...

How to generate row_id?

Anonymous said...

Could you give example with clear values like row id and others please?

Post a Comment

Contact us for any Collaboration, Project Support & On Job Support Work

Name

Email *

Message *