Friday, November 2, 2018

Revenue Adjustment Script

Revenue Adjustment Script

This script can be used to adjust the Revenue for a particular transaction. The amount can be adjusted from one transaction line to another line by specifying the actual amount to adjust or percentage. Run this procedure in loop to adjust many transactions.
CREATE OR REPLACE PROCEDURE adjustment_api
IS
   p_revenue_adj_rec     ar_revenue_adjustment_pvt.rev_adj_rec_type;
   x_return_status       VARCHAR2 (2000);
   x_msg_count           NUMBER;
   x_msg_data            VARCHAR2 (2000);
   x_adjustment_id       NUMBER;
   x_adjustment_number   VARCHAR2 (50);
   l_return_status       VARCHAR2 (100);
   l_msg_count           NUMBER;
   l_msg_data            VARCHAR2 (1000);
   l_adjustment_id       NUMBER;
   l_adjustment_number   VARCHAR2 (1000);
 
BEGIN
 
   --GLOBAL VARIABLES INITIALIZATION
   DBMS_APPLICATION_INFO.set_client_info (107);
   arp_global.init_global;
   arp_standard.init_standard;
 
   --ASSIGN VALUES
 
   p_revenue_adj_rec.trx_number := '2008332';
   p_revenue_adj_rec.batch_source_name := 'WRS ORDER MANAGEMENT';
   p_revenue_adj_rec.amount_mode := 'P';
   -- P_REVENUE_ADJ_REC.AMOUNT := 10;
   p_revenue_adj_rec.PERCENT := 2.6;
   --P_REVENUE_ADJ_REC.FROM_CUST_TRX_LINE_ID := ;
   --P_REVENUE_ADJ_REC.TO_CUST_TRX_LINE_ID := ;
   p_revenue_adj_rec.gl_date := '05-APR-06';
   p_revenue_adj_rec.reason_code := 'RA';
  
-- ACTUAL BLOCK
 
   ar_revenueadjust_pub.earn_revenue
                                  (p_api_version            => 2.0,
                                   p_init_msg_list          => fnd_api.g_true,
                                   x_return_status          => l_return_status,
                                   x_msg_count              => l_msg_count,
                                   x_msg_data               => l_msg_data,
                                   p_rev_adj_rec            => p_revenue_adj_rec,
                                   x_adjustment_id          => l_adjustment_id,
                                   x_adjustment_number      => l_adjustment_number
                                  );
 
   -- DISPLAY OUT PARAMETERS
 
   DBMS_OUTPUT.put_line ('x_return_status: ' || l_return_status);
   DBMS_OUTPUT.put_line ('x_msg_count: ' || l_msg_count);
   DBMS_OUTPUT.put_line ('x_msg_data: ' || l_msg_data);
   DBMS_OUTPUT.put_line ('x_adjustment_id: ' || l_adjustment_id);
   DBMS_OUTPUT.put_line ('x_adjustment_number: ' || l_adjustment_number);
 
   COMMIT;
 
END adjustment_api;

No comments:

Post a Comment

SQL Important Queries

  How to delete rows with no where clause The following example deletes  all rows  from the  Person.Person  the table in the AdventureWork...