Apply On Account Receipt's

CREATE OR REPLACE PROCEDURE APPS.apply_on_account

--********************************************************************************
--                    
--                              
-- ********************************************************************************
--    Project        :  SaaS
--     Application    :  Receivables
--     Script         :
--     Created by     :  Sachin Ingle
--     Creation date  :  3-AUG-2013
--     Description    :  This Package picks data from staging table / Customer Created for specific Operating unit and inserts Data into
--                       Apply On ACCOUNT
--     Parameters     :  None
--     Inputs         :  None
--     Outputs        :  None
--     Database       :
--     Apps. Release  :  Oracle Applications 12.1.3
--
--     Development and Maintenance History :
--
--     Date                Version            Author               Description
--     ----------------------------------------------------------------------------
--     03-Aug-2013        1.0               Sachin Ingle              Initial
-- *********************************************************************************

IS
   v_return_status    VARCHAR2 (1);
   v_msg_count        NUMBER;
   v_msg_data         VARCHAR2 (240);
   v_count            NUMBER;
   v_receipt_number   VARCHAR2 (240):='OB/Mar-13/117';
   v_org_id           NUMBER         := 85;
   p_count            NUMBER;
   v_context          VARCHAR2 (100);

   CURSOR c1
   IS
      SELECT *
        FROM ar_cash_receipts where status='UNAPP';
/* Cursor to get the user id information based on the input user name */
BEGIN
   fnd_global.apps_initialize (110, 50639, 222);
   /* Setting the org context for the particular session */
   mo_global.set_policy_context ('S', 85);

   FOR j IN c1
   LOOP
      v_receipt_number := j.receipt_number;
      ar_receipt_api_pub.apply_on_account
                           (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         => v_return_status,
                            x_msg_count             => v_msg_count,
                            x_msg_data              => v_msg_data,
                            p_receipt_number        => v_receipt_number,
                            p_org_id                => v_org_id
                           );

      IF v_return_status = 'S'
      THEN
         DBMS_OUTPUT.put_line ('Receipt applied on account ');
      ELSE
         DBMS_OUTPUT.put_line ('Message count ' || v_msg_count);

         IF v_msg_count = 1
         THEN
            DBMS_OUTPUT.put_line ('v_msg_data ' || v_msg_data);
         ELSIF v_msg_count > 1
         THEN
            LOOP
               p_count := p_count + 1;
               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 ('Message' || p_count || '---'
                                     || v_msg_data
                                    );
            END LOOP;
         END IF;
      END IF;
   END LOOP;
END;
/

No comments:

Post a Comment

Query to find submitted Concurrent requests

  Query to find Concurrent Requests SELECT      user_concurrent_program_name,      responsibility_name,      request_date,      argument_tex...