OracleAppsDNA

PL/SQL API to Cancel Dispute on an Invoice Transaction

Oracle has provided an API IEX_DISPUTE_PUB.CANCEL_DISPUTE which is part of Advanced Collections to cancel a dispute on an Invoice Transaction. Below is the sample API script:

SET serveroutput ON;
---
---

DECLARE
   lv_return_status_txt   VARCHAR2 (1000);
   lv_msg_count_num       NUMBER;
   lv_msg_count_txt       VARCHAR2 (10000);
   lv_cm_request_id       VARCHAR2 (1000);
   lv_index_num           NUMBER;
   lv_err_msg_stack_txt   VARCHAR2 (4000);
   l_user_id              NUMBER;
   l_responsibility_id    NUMBER           := 22941;     -- collections agent
   l_customer_trx_id      NUMBER           := 468415;
   l_org_id               NUMBER;

   CURSOR c_user_id
   IS
      SELECT user_id
        FROM fnd_user
       WHERE user_name = UPPER ('CHAUDHARYN');

   CURSOR c_org_id
   IS
      SELECT org_id
        FROM ra_customer_trx_all
       WHERE customer_trx_id = l_customer_trx_id;
BEGIN
   OPEN c_user_id;

   FETCH c_user_id
    INTO l_user_id;

   CLOSE c_user_id;

   OPEN c_org_id;

   FETCH c_org_id
    INTO l_org_id;

   CLOSE c_org_id;

   IF l_user_id IS NULL
   THEN
      DBMS_OUTPUT.put_line (' Please enter correct User Name ');
   END IF;

   IF l_org_id IS NULL
   THEN
      DBMS_OUTPUT.put_line ('Please enter correct Customer Trx Id ');
   END IF;

   mo_global.set_policy_context ('S', l_org_id);
   fnd_global.apps_initialize (l_user_id, l_responsibility_id, 695);
   arp_standard.enable_debug;
   iex_dispute_pub.cancel_dispute
                                (p_api_version          => 1.0,
                                 p_commit               => 'T',
                                 p_dispute_id           => 9006, --from RA_CM_REQUESTS_ALL.request_id
                                 p_cancel_comments      => 'XX Cancelled from API',
                                 x_return_status        => lv_return_status_txt,
                                 x_msg_count            => lv_msg_count_num,
                                 x_msg_data             => lv_msg_count_txt
                                );
   COMMIT;

   IF lv_return_status_txt = 'S'
   THEN
      DBMS_OUTPUT.put_line (' Dispute Cancelled successfully ');
   END IF;

   DBMS_OUTPUT.put_line ('x_return_status : ' || lv_return_status_txt);

   IF lv_return_status_txt != 'S'
   THEN
      DBMS_OUTPUT.put_line (   'Error: '
                            || lv_return_status_txt
                            || '; '
                            || lv_msg_count_txt
                           );

      FOR lv_index_num IN 1 .. lv_msg_count_num
      LOOP
         lv_err_msg_stack_txt :=
              fnd_msg_pub.get (p_msg_index      => lv_index_num,
                               p_encoded        => 'F');
         DBMS_OUTPUT.put_line (lv_err_msg_stack_txt);
      END LOOP;
   END IF;
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line ('Exception raised => ' || SQLERRM);
END;
/
Exit mobile version