Wednesday, May 11, 2011

AR_RECEIPT_API_PUB.CREATE_MISC - R12 - Create Miscellaneous Cash Receipt in Oracle Apps

                                                                                                                        

Below script is used to create a miscellaneous cash receipt using the API AR_RECEIPT_API_PUB.CREATE_MISC in R12 oracle apps.
TEST INSTANCE: R12.1.1

SCRIPT:

SET SERVEROUTPUT ON;
DECLARE
   l_return_status     VARCHAR2 (1);
   l_msg_count         NUMBER;
   l_msg_data          VARCHAR2 (240);
   l_count             NUMBER;
   l_cash_receipt_id   NUMBER;
   l_msg_data_out      VARCHAR2 (240);
   l_mesg              VARCHAR2 (240);
   p_count             NUMBER;
   l_receipt_number    VARCHAR (100)  DEFAULT 'SHAREORACLEAPPS';
   v_context           VARCHAR2 (10);

   FUNCTION set_context (
      i_user_name   IN   VARCHAR2,
      i_resp_name   IN   VARCHAR2,
      i_org_id      IN   NUMBER
   )
      RETURN VARCHAR2
   IS
   BEGIN
      NULL;
-- Inorder to reduce the content of the post I moved the implementation part of this function to another post and it is available here
   END set_context;
BEGIN
   DBMS_OUTPUT.put_line ('1');
--1. Set applications context if not already set.
   v_context := set_context ('&username', '&resp_name', '&org_id');

   IF v_context = 'F'
   THEN
      DBMS_OUTPUT.put_line ('Error while setting the context');
   END IF;

   DBMS_OUTPUT.put_line ('2');
   mo_global.init ('AR');

   BEGIN
      ar_receipt_api_pub.create_misc
                (p_api_version            => 1.0,
                 p_init_msg_list          => fnd_api.g_true,
                 p_commit                 => fnd_api.g_true,
                 p_validation_level       => fnd_api.g_valid_level_full,
                 x_return_status          => l_return_status,
                  x_msg_count              => l_msg_count,
                  x_msg_data               => l_msg_data,
                  p_currency_code          => 'USD',
                  p_amount                 => 500,
                  p_receipt_date           => SYSDATE,
                  p_gl_date                => SYSDATE,
                  p_receipt_method_id      => 8002,
                  p_activity               => 'Miscellaneous Cash',
                  p_misc_receipt_id        => l_cash_receipt_id,
                  p_receipt_number         => l_receipt_number
                  );
      DBMS_OUTPUT.put_line ('Message count ' || l_msg_count);
      DBMS_OUTPUT.put_line ('Cash Receipt ID ' || l_cash_receipt_id);
      DBMS_OUTPUT.put_line ('Status ' || l_return_status);

      IF l_msg_count = 1
      THEN
         DBMS_OUTPUT.put_line ('l_msg_data ' || l_msg_data);
      ELSIF l_msg_count > 1
      THEN
         LOOP
            p_count := p_count + 1;
            l_msg_data :=
                        fnd_msg_pub.get (fnd_msg_pub.g_next, fnd_api.g_false);

            IF l_msg_data IS NULL
            THEN
               EXIT;
            END IF;

            DBMS_OUTPUT.put_line ('Message' || p_count || ' ---' || l_msg_data);
         END LOOP;
      END IF;
   END;
END;

Queries Used:

SELECT *
  FROM ar_receivables_trx_all
 WHERE NAME = 'Miscellaneous Cash';

SELECT *
  FROM ar_receipt_methods
 WHERE receipt_class_id = 8002;

SELECT *
  FROM ar_cash_receipts_all
 WHERE cash_receipt_id = '1991';

4 Responses to “AR_RECEIPT_API_PUB.CREATE_MISC - R12 - Create Miscellaneous Cash Receipt in Oracle Apps”

Joe said...
September 19, 2011 at 2:05 AM

im facing the following error everytime i run this API :


Message count 2
Cash Receipt ID
Status U
Message ---CREATE_MISC : ORA-01403: no data found
Message ---ORA-01403: no data found in Package AR_RECEIPT_API_PUB Procedure Create_misc


Any idea the cause of this error ?


Anonymous said...
September 6, 2013 at 7:32 AM

Was a solution ever posted for this?
Sorry about the time lag - we're only upgrading to R12 now.

James.


Unknown said...
September 30, 2013 at 12:36 AM

did u get the solution for this issue...if u found solution please share....


ARC api said...
March 3, 2016 at 1:46 PM

can you customer number value to ar_receipt_api_pub.create_misc ?


Post a Comment

Disclaimer

The ideas, thoughts and concepts expressed here are my own. They, in no way reflect those of my employer or any other organization/client that I am associated. The articles presented doesn't imply to any particular organization or client and are meant only for knowledge Sharing purpose. The articles can't be reproduced or copied without the Owner's knowledge or permission.