Search This Blog

Friday, May 1, 2020

Updating Translations for lookups in Oracle Apps R12


The below code with update the Transalation of Lookups.
Example: Arabic Translation.

First you need to upload lookups normally using the below link.
https://mogalafzal.blogspot.com/2020/05/uploading-lookups-in-oracle-apps-r12.html


/*
1. set the language you want to update.

alter session set NLS_LANGUAGE ='ARABIC';--'ARABIC' AMERICAN

select userenv('lang') from dual

COMMIT

2. custom interface table.

    CREATE TABLE XXLOOKUP_CODES_AR
    (LOOKUP_CODE VARCHAR2(30),
     MEANING_EN VARCHAR2(240),
     MEANING_AR VARCHAR2(240),
     DESCRIPTION_EN VARCHAR2(240),
     DESCRIPTION_AR VARCHAR2(240),
     ATTRIBUTE1 VARCHAR2(240),
     ATTRIBUTE2 VARCHAR2(240))
   
     alter table xxlookup_codes_ar
add (lkp_err_msg varchar2(240))

update xxlookup_codes_ar
set lkp_process_flag_ar = 'N';

SELECT * FROM xxlookup_codes_ar

SELECT * FROM FND_LOOKUP_VALUES_VL
WHERE LOOKUP_TYPE = 'TESTA'

*/



DECLARE
   CURSOR get_lookup_details
   IS
 
      SELECT ltype.application_id,
             ltype.customization_level,
             ltype.creation_date,
             ltype.created_by,
             ltype.last_update_date,
             ltype.last_updated_by,
             ltype.last_update_login,
             tl.lookup_type,
             tl.security_group_id,
             tl.view_application_id,
             tl.description,
             tl.meaning
        FROM fnd_lookup_types_tl tl, fnd_lookup_types ltype
       WHERE     ltype.lookup_type = 'FFZA_LICENSE_TYPE'
             AND ltype.lookup_type = tl.lookup_type
             AND language = 'US';

   CURSOR get_value
   IS
 

      SELECT DISTINCT
             lookup_code,
             meaning_en,
             meaning_ar,
             description_en, description_ar,lkp_err_msg,lkp_process_flag_ar
        FROM xxlookup_codes_ar
       WHERE     lkp_process_flag_ar = 'N'   
       and lookup_code <> '58'
       --AND LENGTH(substr(meaning_ar,1,80)) > 60
     
       ;

   l_err_msg   VARCHAR2 (1000) := NULL;
   l_db_nls_language       VARCHAR2 (500) := NULL;
   l_db_nls_language2 varchar2(30) := 'ARABIC';
   L_USERNAME VARCHAR2(30) := 'EG_AFZAL'; --USERNAME
BEGIN
   FOR i IN get_lookup_details
   LOOP
      FOR j IN get_value
      LOOP
         BEGIN
            fnd_lookup_values_pkg.translate_row (
               x_lookup_type           => i.lookup_type,
               x_security_group_id     => i.security_group_id,
               x_view_application_id   => i.view_application_id,
               x_owner                 => L_USERNAME, --> User NAME
               x_meaning               => j.meaning_ar,
               x_description           => j.description_ar,
               x_lookup_code           => j.lookup_code,
               X_LAST_UPDATE_DATE      => NULL,--TO_DATE('4/22/2020 9:20:58 PM'),
               X_CUSTOM_MODE            => 'FORCE');

            UPDATE xxlookup_codes_ar --> Stagging Table to Log Status
               SET lkp_process_flag_ar = 'Y', lkp_err_msg = NULL
             WHERE lookup_code = j.lookup_code;

            COMMIT;
         EXCEPTION
            WHEN OTHERS
            THEN
               l_err_msg := SQLERRM;

               UPDATE xxlookup_codes_ar
                  SET lkp_process_flag_ar = 'N', lkp_err_msg = l_err_msg
                 WHERE lookup_code = j.lookup_code;

               COMMIT;
         END;
      END LOOP;
   END LOOP;
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line ('Main Exception: ' || SQLERRM);
END;

No comments:

Post a Comment