Join the OracleApps88 Telegram group @OracleApps88to get more information on Oracle EBS R12/Oracle Fusion applications.

If you are facing any issues while copying the Code/Script or any issues with Posts, Please send a mail to OracleApp88@Yahoo.com or message me at @apps88 or +91 905 957 4321 in telegram.

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;
/


No comments:

Post a Comment

If you are facing any issues while copying the Code/Script or any issues with Posts, Please send a mail to OracleApp88@Yahoo.com or message me at @apps88 or +91 905 957 4321 in telegram.
Best Blogger TipsGet Flower Effect