2 Replies Latest reply: Aug 21, 2013 11:58 PM by Adit102 RSS

    Cannot create receipt with AR_RECEIPT_API_PUB.CREATE_CASH

    Adit102

      Hi,

       

      I am trying to create a receipt using AR_RECEIPT_API_PUB.CREATE_CASH. Below is the script.

       

      DECLARE

      l_cr_id integer;

      l_msg_count integer;

      l_msg_data varchar2(200);

      l_return_status varchar2(20);

      BEGIN

      AR_RECEIPT_API_PUB.CREATE_CASH

                       (p_api_version       => 1.0,

                       p_init_msg_list     => apps.fnd_api.g_true,

                       p_receipt_number    => 'Mig-Test',

                       p_amount            => 10000,

                       p_receipt_method_id => 1000,

                       p_customer_name     => 'Natalia Aguiar',

                       p_customer_number   => 1020,

                      p_currency_code     => 'GBP',

                       p_receipt_date      => SYSDATE,

                       p_gl_date           => SYSDATE,

                       p_maturity_date     => SYSDATE,

                       p_comments          => 'Test comments',

                       p_org_id            => 143,

                       p_cr_id             => l_cr_id,

                       x_return_status     => l_return_status,

                       x_msg_count         => l_msg_count,

                       x_msg_data          => l_msg_data

                       );

      COMMIT;

      EXCEPTION

         WHEN OTHERS

         THEN

            DBMS_OUTPUT.put_line ('Others Exception' || SQLERRM);

      END;               

      /

       

      This script gets executed successfully, but do not see any receipt created in the AR_CASH_RECEIPTS_ALL table with receipt name 'Mig-Test'.

      Is there anything I need to initialize before running this script?

       

      Thanks,

      Aditya

        • 1. Re: Cannot create receipt with AR_RECEIPT_API_PUB.CREATE_CASH
          ThAn

          Hi,

           

          two things that might help:

          1. Add following code below your call to AR_RECEIPT_API_PUB.CREATE_CASH

          dbms_output.put_line('Return status from api call: ' || l_return_status);

          IF ( FND_MSG_PUB.Count_Msg > 0) THEN

            FOR i IN 1.. l_msg_count    LOOP

            FND_MSG_PUB.Get(p_msg_index     => i,

                    p_encoded       => 'F',

                    p_data          => l_msg_data,

                    p_msg_index_OUT => l_msg_index_out );

            dbms_output.put_line('l_msg_data :' ||out_message);

            END LOOP;

          END IF;

          The for loop will check the content of variable l_msg_data and give more details on why the api call might have failed.

          Don't forget to add variable l_msg_index_out of type number to your declare section.

           

          2. Your script is missing the calls to mo_global procedures to set the org and application context.

          You should add following lines before calling the api:

          mo_global.SET_POLICY_CONTEXT('S', 143); -- your org id

          mo_global.init('AR');


          Regards

          • 2. Re: Cannot create receipt with AR_RECEIPT_API_PUB.CREATE_CASH
            Adit102

            Thank you...
            MO and error status worked...