Monday, May 22, 2023

Oracle Apps 12.2.x - Copy Responsibilities of one user account to another user

 /* Formatted on 2021/02/04 09:38 (Formatter Plus v4.8.8) */
/*******************************************************************************
 *PURPOSE: To copy responsibilities of one user account to another user account *
 *AUTHOR: Bharat Bhatia                                                         *
 *******************************************************************************/
--
--
DECLARE
   --
   resp_count   NUMBER := 0;
   --
   CURSOR src_user_resp_details
   IS
      SELECT DISTINCT fa.application_short_name, fr.responsibility_key,
                      fsg.security_group_key
                 FROM fnd_application fa,
                      fnd_responsibility fr,
                      fnd_user fu,
                      fnd_user_resp_groups_all furga,
                      fnd_security_groups fsg
                WHERE 1 = 1
                  AND fu.user_name = 'SYSADMIN'
                  AND fu.user_id = furga.user_id
                  AND fa.application_id = fr.application_id
                  AND furga.responsibility_id = fr.responsibility_id
                  AND furga.responsibility_application_id = fa.application_id
                  AND fsg.security_group_id = furga.security_group_id
                  AND furga.end_date IS NULL;
--
--
BEGIN
   FOR user_resp_details_rec IN src_user_resp_details
   LOOP
      BEGIN
         --
         fnd_user_pkg.addresp
                 (username            => 'BBHATIA',
                  resp_app            => user_resp_details_rec.application_short_name,
                  resp_key            => user_resp_details_rec.responsibility_key,
                  security_group      => user_resp_details_rec.security_group_key,
                  description         => NULL,
                  start_date          => SYSDATE,
                  end_date            => NULL
                 );
         --
         resp_count := resp_count + 1;
      --
      EXCEPTION
         WHEN OTHERS
         THEN
            --
            DBMS_OUTPUT.put_line (   'Error while Adding Responsibility: '
                                  || SQLERRM
                                 );
            DBMS_OUTPUT.put_line (   'resp_app: '
                                  || user_resp_details_rec.application_short_name
                                 );
            DBMS_OUTPUT.put_line (   'resp_key: '
                                  || user_resp_details_rec.responsibility_key
                                 );
      --
      END;
   END LOOP;
   --
   DBMS_OUTPUT.put_line (   resp_count
                         || ' Responsibilities Successfully Copied!!'
                        );
   --
   COMMIT;
END;

Create AR Receipt - Miscellaneous (12.2.xx)

 /* Formatted on 26/09/2022 11:43 (Formatter Plus v4.8.8) By Bharat Bhatia*/

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;

   END set_context;

BEGIN

   DBMS_OUTPUT.put_line ('1');

   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;

Exam 1Z0-1042-23: Oracle Cloud Infrastructure 2023 Application Integration Professional

Exam Topics The following table lists the exam objectives and their weightings. Objectives % of Exam Getting Started with OIC Integrations 1...