Monday, June 19, 2017

Script to Create Receivables (AR) Credit Memo

DECLARE
   v_msg_count       NUMBER;
   v_msg_data        VARCHAR2 (2000);
   v_return_status   VARCHAR2 (1);
   V_REQUEST_ID      NUMBER;

BEGIN
   FND_GLOBAL.APPS_INITIALIZE (user_id           => 1134,
                               resp_id           => 20678,
                               resp_appl_id      => 222
                              );
                             
   mo_global.init ('AR');
   mo_global.set_policy_context ('S', 81);
  
   AR_CREDIT_MEMO_API_PUB.CREATE_REQUEST
        ( -- Standard api parameters
         p_api_version                => 1.0,
         p_init_msg_list              => fnd_api.g_true,
         p_commit                     => fnd_api.g_true,
         x_return_status              => v_return_status,
         x_msg_count                  => v_msg_count,
         x_msg_data                   => v_msg_data,
    -- Credit memo request parameters
        
    p_customer_trx_id            => 4521,
    -- TRX_ID of invoice to be cancelled
        
    p_line_credit_flag           => 'N',
         p_line_amount                => -6300,
         p_tax_amount                 => 0,
         p_cm_reason_code             => 'CANCELLATION',
         p_skip_workflow_flag         => 'Y',
         p_batch_source_name          => 'Premium_Invoices_Imported',
         p_credit_method_installments => NULL,
         p_credit_method_rules        => NULL,
         -- p_cust_trx_type_id        => 1000,
         x_request_id                 => v_request_id
        );
       
   IF    v_return_status = fnd_api.g_ret_sts_unexp_error
      OR v_return_status = fnd_api.g_ret_sts_error
   THEN
      DBMS_OUTPUT.put_line (v_msg_data);
   END IF;
  
   IF v_msg_count > 1
   THEN
      v_msg_count := 0;
      LOOP
         v_msg_data := fnd_msg_pub.get (fnd_msg_pub.g_next, fnd_api.g_false);
         IF v_msg_data IS NULL
         THEN
            EXIT;
         END IF;
         DBMS_OUTPUT.put_line (v_msg_data);
      END LOOP;
   END IF;
  
   IF v_return_status = fnd_api.g_ret_sts_success
   THEN
      DBMS_OUTPUT.put_line (v_msg_data);
   END IF;
  
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line ('Error in Crea_cm:' || SQLERRM);
END;
/


Oracle Receivables Charge Back Process

Overview
In Oracle Receivables you can create a chargeback against transactions to which you are applying a receipt. You can create multiple chargebacks against each transaction, for positive or negative amounts. Receivable’s lets you enter a chargeback against a credit memo or an on-account credit memo only if they have a positive balance.

When performing the chargeback function, Receivable’s uses the transaction type of the transaction you are adjusting to validate the chargeback amount. If the Transaction Type does not allow over application then you will not be able to enter an amount that will reverse the sign of the transaction. Chargebacks do not follow the natural application rules and will allow the adjustment of a transaction in either a positive or negative direction regardless of the natural application flag.

You can use the chargeback functionality to create a new debit item when closing an existing debit item. Receivable requires that you automatically number your chargeback sequences by updating the Last Invoice Number field for the chargeback Transaction Batch Source in the Transaction Source Window. This will be covered within the setting up of the chargeback functionality later within this document.

This post will cover the following chargeback information:
Chargeback Functionality Setup
How to Manually Generate a Chargeback
Reversing a Chargeback
Viewing Chargeback
Accounting for Chargeback
Chargeback Table Information
Chargeback Troubleshooting


Chargeback Setup
The following information must be setup prior to processing any chargeback functionality. Oracle provides seeded values to allow you to perform your initial testing of the application. Listed below are Profile and Seeded Oracle Setup Sources and Transaction Types that can be used to perform this functionality. If is recommended to use the seeded setup’s that are provided for your initial testing before generating you own Batch Source, Transaction Type.

1.      Profile: Chargeback Due Date
Enter the Chargeback Due Date profile that will be defaulted when running the Chargeback Functionality. Select from the following Options:
a.      Open Invoice Due Date – Use the due date of the invoice or debit memo as the default.
b.      Receipt Date – Use the receipt date as the default. This will be the date receipt was entered.
c.       Current Date – Today’s date.
d.     Deposit Date – Use the receipt deposit date as the default.

Navigation: Setup>System>System Options
Tab: Miscellaneous

2.      Transaction Batch Source
Transaction Batch Sources controls the transaction type they are assigned in determining whether Receivables automatically numbers your transactions and transaction batches. As indicated earlier within this document, Receivables requires that you check the Automatic Transaction Numbering for the batch source that you are setting up. This will allow the instance to automatically number the Chargebacks that are performed using a sequence that is created during the initial creation of the batch source.

Receivables has provided a seeded transaction batch source that is used with the Chargeback Transaction Type that also seeded for your use or testing purposes.
Navigation: Setup>Transactions>Sources

3.      Transaction Type: Chargeback
Transaction types are used to define the accounting for debit memos, credit memos, on-account credits, chargebacks, commitments, invoices, and bills receivable you create. They are also used to determine if balances are posted to the General Ledger or whether the balances of the customers’ accounts are updated. Autoaccounting uses that gl accounts that are setup here based on the AutoAccounting setup that is performed. Oracle has provided a seeded Transaction Type: Chargeback to be used in the initial testing phase that you are performing. Note that the creation sign for the seeded value has positive sign and over application checked. If you want to have the transaction that is generated be posted to general ledger, you will need to have the post to GL flag checked. If you want to have the transaction that is generated update with the customer balances for a chargeback transaction that has been generated when you will need to have Open Receivables checked.

Navigation: Setup>Transactions>Transaction Types


4.      Receivables Activities Setup:
Define receivables activities to default accounting information for this Chargeback Adjustment and Chargeback Reversal functionalities that will be talked about later within this document. Activities that you define here appear as a List of Values (LOV) when performing the various functionalities of the Chargeback Transaction generation.

Query the Chargeback Adjustment that is a seeded value and assign a General Ledger Code Combination that you want to use for this functionality. Save the Receivables Activity after entering the CCID for this activity. This activity is reserved for internal use only.

Query the Chargeback Reversal Activity that is a seeded value and assign a General Ledger Code Combination that you want to use for this functionality. Save the Receivables Activity after entering the CCID for this activity. This activity is reserved for internal use only.

Note: Once a Receivable Activity is generated you can not change its type. However, you can update an existing activity’s GL account, even if you have already assigned this activity to a transaction.

Navigation: Setup>Receipts>Receivables Activities
View>Find
Select from LOV Chargeback Adjustment: Enter the GL account that you setup within General Ledger View>Find
Select from LOV Chargeback Reversal: Enter the GL account that you setup within General Ledger

5.      Receivable Lookups
Oracle provides seeded Adjustment Reasons that can be used when generating Chargeback Adjustments. Should you want to add additional Adjustment Reasons, perform the following.
Navigation:  Setup>System>Quickcodes>Receivables

a.      Query the Lookup type ADJUST_REASON. This will indicate the seeded values that come with the Oracle Application. You can add additional adjustment reasons here if needed.

6.      The Chargeback and Adjustment Button within the Receipts Workbench under Applications From.
If these buttons are not available you will need to ensure that the following profile is setup to allow the use of these buttons.

Responsibility: System Administrator

Navigation: Profile>System
a.        Enter the following to allow the access of these buttons.
b.       Query the following profile.  AR: Cash – Allow Actions
c.        Set this Profile to YES and Save.


How to Manually Generate a Chargeback
Use chargebacks to create a new debit item for your customer when closing an existing debit item. This allows an aged debit item to be re-invoiced to a new debit item using the chargeback adjustment receivables activity setup in prior setup steps above.

To manually generate a chargeback:
1.      Navigate to the Receipts Workbench from the Receivable Responsibility Navigate: Receipts>Receipts
2.      Enter the following information into the Receipts>Receipts form.
a.              Enter in a Receipt Number if you are using a Manually Receipt Numbering Batch Source.
b.              Receipt Type should be CASH by default.
c.               Enter in the receipt amount. Example 100.00 USD
d.             Receipt Date and GL Date will default based on the system date of entering in this receipt. These can be changed based on your needs.
e.              Select a Payment Method. Example using the Manual with Clearance which is a Seeded Payment Method type. This should give you a Confirm Status for this receipt.
f.                Click on Customer Name and select Customer that you would like to apply this receipt too. If you know the Debit Item number (Transaction Number) you can also enter this instead of the Customer Name. Hit the TAB key. This will fill in the Customer Number and Location for this customer.
g.              Click on the Application Button that now should be illuminated.

3.      This will now open the Application Form within the Receipts Workbench.
a.              Using the LOV that is found for the column Apply To select an invoice that is greater than the amount that you are going to apply. This will leave a Balance Due if you scroll across using the slide bar.
b.              Save this transaction. This will now have the save and apply check boxes both checked indicating that this has been applied to this invoice.

4.      In generating the Chargeback now on this invoice you will note that both the Chargeback and Adjust button at the bottom of the Applications Form are now illuminated. Perform the following steps in order to generate the chargeback to this invoice.
a.              Click on the Chargeback Button at the bottom of the Application Form for the invoice that you want to generated the new Chargeback invoice for. This will put you into the Chargebacks form.
b.              Select under Type the transaction type for this Chargeback. This transaction type should be of a Class of Chargeback. Oracle provides a seeded value for the function so we will select, Chargeback Transaction Type.
c.               The amount on the chargeback form should match the amount of the invoice balance that you are generating this chargeback for. Should you only want to generate for a partial amount of the transaction you will be able to enter in a value here based on the Balance indicated in the Zone above within this form.
d.             Note that the GL account is now shown for the Chargeback function. This is the GL account for the Chargeback Adjustment Receivables Activity that was performed in the setup steps above.
e.              Click on the Due Date. Note that this is populated based on the setup that was performed within the Setup>System>System Options setup that was performed in the setup steps above.
f.                Click on the MORE tab that is available for additional entry. This is not required but does provide a place to enter the reason that you are generating the Chargeback for the debit item.
g.              Select a reason from the LOV for this Chargeback action.
h.              Enter any additional information within the Comments section of the form.
i.                Click on the save icon above within the Tool Bar.


5.      This will have generated a Chargeback Number that is now the new debit item for the remaining balance that was entered for this transaction. You will now be able to exit this form and the debit item that was used to generate this Chargeback will now be closed and the new debit Chargeback will be generated for the remaining balance of the invoice.

Reversing a Chargeback
Like other conditions, you may have generated a Chargeback and want to reverse the Chargeback that was generated against an Invoice. Listed below are the steps to reverse the Chargeback that was generated using the receipts workbench.

To reverse a chargeback generated via the Receipts Workbench:
1.      Navigate to the Receipts window (Receipts>Receipts or Receipts>Batches).
2.      Query the existing cash receipt.
3.      Choose the Applications button.
4.      Select the Transaction that the Chargeback was generate against by clicking on the transaction.
5.      Click on the Chargeback Button.

6.      This should bring up the Chargeback form within the Receipt Workbench and indicate the Chargeback that you want to reverse. Perform the following steps.
    1. Click on the Chargeback that you want to reverse. Remember that you can have multiple chargebacks for the same Debit Item
    2. Click on the red ‘X’ within the Tool Bar that indicates Delete. This should remove the Chargeback information that was generated for this debit item.
    3. When exiting from the form you will be asked to save your changes. Click Yes.
    4. This will bring you back to the Applications form within the Receipts Workbench.
    5. If you click on the adjustments button for this debit item (Invoice) you will notice 2 adjustment rows were generated for this debit item. One is the Chargeback Adjustment that would have closed this debit item and generated the original Chargeback and the other is a Chargeback Reversal Adjustment that reverses the original and puts the Debit Item (Invoice) back to its original condition prior to performing the Chargeback.
    6. You can verify the effects of the Chargeback Reversal by Querying up the Chargeback that was originally generated and see that it is now closed as well via the following navigational steps. Collections>Account Details
Query on Class Chargeback and Status closed. You will find the Chargeback that was generated is now closed.

7.      Save your work.
8.      See the Section on Viewing a Chargeback to see how this was performed.


Viewing Chargeback and Chargeback Reversal
Listed below are the steps involved to view the original invoice and the chargeback that was generated. We will also drill down and indicate the adjustments below that were generated when the Chargeback was generated and when the Chargeback was reversed.

To review the Original Debit Item where the Chargeback Adjustment was Performed:
1.      Navigate to the Collections Workbench and perform the follow to query the Original Invoice.
a.       Navigation Steps: Collections>Account Details
b.      Query the Debit Item (Invoice) that Chargeback was generated against by entering in the invoice number under the Trans Num Column. NOTE: If this debit item was closed by the Chargeback you will need to ensure that you select Status Closed prior to Clicking on the Find button
c.       This will bring up the original Debit Item. Click on the Activities Button to show all activities that were generated against this Debit Item.
d.      Notice that prior to the Reversal there is one adjustment generated against this debit item. This is the Chargeback Adjustment that was setup in prior steps within the Setup Section of this paper.
e.       If reversal was performed you will see two adjustments have been performed. One will be the Chargeback Adjustment to close out the original invoice and the other is the Chargeback Reversal to put the original Debit Item back to its original state prior to performing the Chargeback.

To review Chargeback that was generated:
2.      Navigate to the Collections Workbench and perform the follow to query the Chargeback that was generated.
a.       Navigation Steps: Collections>Account Details
b.      Query the Chargeback that was generated against by entering the Chargeback Number under the Trans Num Column. NOTE: If this Chargeback was reversed by a Chargeback Reversal you will need to ensure that you select Status Closed prior to Clicking on the Find button
c.       This will bring up the original Chargeback. Click on the Activities Button to show all activities that were generated against this Debit Item.
d.      Notice that prior to the Reversal there is no activities. This is because the Chargeback is considered a new debit item and no adjustment rows where generated. It is like a new invoices was generated but is linked to the original invoice. If you click on Details Button for this Chargeback you will get the Header Record of the Chargeback via the Transaction Workbench. By clicking on the MORE tab you will see the Original Transaction Column that indicates where this Chargeback was generated from.
e.       If Chargeback reversal was performed you will see one adjustment. The Chargeback Reversal Adjustment will close out this Chargeback and reopen the Original Debit Item that the Chargeback was generated against.


Accounting for Chargebacks
Utilizing the release 11i application functionalities you can view the accounting that was performed on the above transactions with the following navigational steps. This will give you a detail look at the Accounting that was performed for both the Original Debit Item and the Chargeback that was generated including the drilling down to the chargeback adjustment and chargeback adjustment reversal levels. Please follow the following navigational steps to see both the Accounting and T-Accounts.

Original Invoice Accounting:
1. Original Invoice Accounting:
a.       Navigation Steps: Collections>Account Details
b.      Enter the Original Invoice number in the Trans Num column and click Find.
c.       Click on Details for this Original Invoice.
d.      Click within the Tool Bar  Tools>View Accounting
e.       If you wish to see the T-Accounts for this Transaction click on T-Accounts Button.

2.   Original Invoice Receipt Application Accounting
a.       Navigation Steps: Collections>Account Details
b.      Enter the Original Invoice number in the Trans Num column and click Find.
c.       Click on Activities for this Original Invoice.
d.      Select the Receipt that was applied to the invoice.
e.      Click on Details
f.        Click within the Tool Bar  Tools>View Accounting
g.      If you wish to see the T-Accounts for this Transaction click on T-Accounts Button.

3.   Original Invoice Chargeback Adjustment Accounting
a.       Navigation Steps: Collections>Account Details
b.      Enter the Original Invoice number in the Trans Num column and click Find.
c.       Click on Activities for this Original Invoice.
d.      Select the Chargeback Adjustment that was applied to the invoice.
e.       Click on Details
f.        Click within the Tool Bar  Tools>View Accounting
g.      If you wish to see the T-Accounts for this Transaction click on T-Accounts Button.

4.   Original Invoice Chargeback Reversal Accounting
a.       Navigation Steps: Collections>Account Details
b.      Enter the Original Invoice number in the Trans Num column and click Find.
c.       Click on Activities for this Original Invoice.
d.      Select the Chargeback Adjustment Reversal if this original invoice had a Chargeback reversal performed
e.      Click on Details
f.        Click within the Tool Bar  Tools>View Accounting
g.      If you wish to see the T-Accounts for this Transaction click on T-Accounts Button.


Chargeback (Invoice) Accounting:
1. Chargeback Accounting:
a.       Navigation Steps: Collections>Account Details
b.      Enter the Chargeback number in the Trans Num column and click Find.
c.       Click on Details for this Chargeback.
d.      Click within the Tool Bar  Tools>View Accounting
e.       If you wish to see the T-Accounts for this Transaction click on T-Accounts Button

2. Chargeback Adjustment Reversal against the Chargeback:
a.              Navigation Steps: Collections>Account Details
b.              Enter the Chargeback number in the Trans Num column and click Find.
c.               Click on Activities for this Chargeback.
d.             Select the Chargeback Adjustment Reversal for this Chargeback.
e.              Click within the Tool Bar  Tools>View Accounting
f.                If you wish to see the T-Accounts for this Transaction click on T-Accounts Button.

Chargeback: Table Information
Chargebacks when generated are stored like a regular invoice within the Oracle Receivable’s Tables. What is important is the linking of the Chargebacks that are generated to the Original invoice via the Chargeback Adjustment and the Chargeback Reversal. Listed below are the tables and columns that are effected and the columns that are important when a Chargeback is Generated and when a Chargeback is Reversed.
-          AR_ADJUSTMENTS_ALL: One adjustment record is created against the Original Invoice when the Chargeback is created. Listed below are the relevant columns of the adjustment that indicates it is an adjustment against the original invoice but is tied to a Chargeback Transaction as well. One adjustment row is generated against the original invoice and the Chargeback that was generated when a Chargeback Reversal is generated.
Adjustment_Number
Adjustment Number generated from sequence


AR_ADJUSTMENT_NUMBER_S
Adjustment_Id

Adjustment Identifier generated from sequence


AR_ADJUSTMENTS_S
Customer_Trx_Id

Identifier of customer transaction associated with this adjustment
Postable

Indicates whether this adjustment is postable – it should be null


   valued to ‘Y’
Status

Approval_Type indicated from AR_LOOKUPS with the


following values :


A
Approved


M
More Research


R
Rejected


U
Unaccrued Charges


W
Waiting Approval
Adjustment_Type

Invoice – Manual for generated transactions for Chargebacks
Chargeback_Customer_Trx_Id
Identifier of Chargeback Transaction associated by this


adjustment
Org_id

Operating Unit Identifier
Best Blogger TipsGet Flower Effect