Ara
30
2017

Alacaklar Muhasebesi Hesaba Mahsup Ödeme Eşleme

Merhaba,

AR_RECEIPT_API_PUB.Apply_on_account apisinin kullanarak hesaba mahsup eşleme işlemi yapan script örneği aşağıdaki gibidir.

 
 
DECLARE
   v_return_status    VARCHAR2 (1);
   v_msg_count        NUMBER;
   v_msg_data         VARCHAR2 (240);
   v_count            NUMBER;
   v_receipt_number   VARCHAR2 (240) := 'SHAREORACLEAPPS';
   v_org_id           NUMBER         := 93;
   p_count            NUMBER;
   v_context          VARCHAR2 (100);
 
   FUNCTION set_context (
      i_user_name   IN   VARCHAR2,
      i_resp_name   IN   VARCHAR2,
      i_org_id      IN   NUMBER
   )
      RETURN VARCHAR2
   IS
      v_user_id        NUMBER;
      v_resp_id        NUMBER;
      v_resp_appl_id   NUMBER;
      v_lang           VARCHAR2 (100);
      v_session_lang   VARCHAR2 (100) := fnd_global.current_language;
      v_return         VARCHAR2 (10)  := 'T';
      v_nls_lang       VARCHAR2 (100);
      v_org_id         NUMBER         := i_org_id;
 
/* Cursor to get the user id information based on the input user name */
      CURSOR cur_user
      IS
         SELECT user_id
           FROM fnd_user
          WHERE user_name = i_user_name;
 
/* Cursor to get the responsibility information */
      CURSOR cur_resp
      IS
         SELECT responsibility_id, application_id, LANGUAGE
           FROM fnd_responsibility_tl
          WHERE responsibility_name = i_resp_name;
 
/* Cursor to get the nls language information for setting the language context */
      CURSOR cur_lang (p_lang_code VARCHAR2)
      IS
         SELECT nls_language
           FROM fnd_languages
          WHERE language_code = p_lang_code;
   BEGIN
      /* To get the user id details */
      OPEN cur_user;
 
      FETCH cur_user
       INTO v_user_id;
 
      IF cur_user%NOTFOUND
      THEN
         v_return := 'F';
      END IF;
 
      CLOSE cur_user;
 
      /* To get the responsibility and responsibility application id */
      OPEN cur_resp;
 
      FETCH cur_resp
       INTO v_resp_id, v_resp_appl_id, v_lang;
 
      IF cur_resp%NOTFOUND
      THEN
         v_return := 'F';
      END IF;
 
      CLOSE cur_resp;
 
      DBMS_OUTPUT.put_line (v_user_id || ' ' || v_resp_id || ' '
                            || v_resp_appl_id
                           );
      /* Setting the oracle applications context for the particular session */
      fnd_global.apps_initialize (user_id           => v_user_id,
                                  resp_id           => v_resp_id,
                                  resp_appl_id      => v_resp_appl_id
                                 );
      /* Setting the org context for the particular session */
      mo_global.set_policy_context ('S', v_org_id);
 
      /* setting the nls context for the particular session */
      IF v_session_lang != v_lang
      THEN
         OPEN cur_lang (v_lang);
 
         FETCH cur_lang
          INTO v_nls_lang;
 
         CLOSE cur_lang;
 
         fnd_global.set_nls_context (v_nls_lang);
      END IF;
 
      --IF v_session_lang != v_lang
      RETURN v_return;
   EXCEPTION
      WHEN OTHERS
      THEN
         RETURN 'F';
   END set_context;
BEGIN
   DBMS_OUTPUT.put_line ('1');
--–1. Set applications context if not already set.
   v_context := set_context ('&userid', '&responsibility', '&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');
   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;
Elvan Uysal

Elvan Uysal

1989 Aydın doğumlu.
2007-2008 Doğu Akdeniz Üniversitesi(EMU) Yabancı Dil Eğitimi aldı.
2013 İstanbul Aydın Üniversitesi-Matematik Bilgisayar Bilimlerinden
mezun oldu. Istanbul Aydın Üniversitesi-Master of Business
Administration(MBA) master programına devam etmektedir.
2013 yılından Beri Oracle e-Business Suite Uygulama Geliştirme
Fonksiyonel ve Teknik Danışman olarak DbOptimize bünyesinde
kariyerine devam etmektedir.
Mail: elvanuysal89@gmail.com
Elvan Uysal


Yorum yapın

*