Search This Blog

Friday, July 31, 2026

EBS R12 To Create Code_combination

 CREATE OR REPLACE function APPS.create_ccid 

( p_concat_segs in varchar2

) return varchar2

is

  -- pragma autonomous_transaction; -- if you need autonomy!

  l_keyval_status     BOOLEAN;

  l_coa_id            NUMBER;

   l_err_msg          varchar2(2000);

   l_error varchar2(255);

begin


--SELECT * FROM  gl_sets_of_books;


  begin

    select chart_of_accounts_id

    into   l_coa_id

    from   gl_sets_of_books

    where  set_of_books_id = 2159;--fnd_profile.value('GL_SET_OF_BKS_ID');

  exception

    when no_data_found then

      dbms_output.put_line('Chart of Accounts ID not found from profile option GL_SET_OF_BKS_ID');

      dbms_output.put_line('Try setting up your environment with fnd_global.apps_initialize');

      raise;

  end;

  -- keyval_mode can be one of CREATE_COMBINATION CHECK_COMBINATION FIND_COMBINATION

  --create will only work if dynamic inserts on and cross validation rules not broken

  l_keyval_status := fnd_flex_keyval.validate_segs(

                                           'CREATE_COMBINATION',

                                           'SQLGL',

                                           'GL#',

                                           l_coa_id,

                                           p_concat_segs,

                                           'V',

                                           sysdate,

                                           'ALL', NULL, NULL, NULL, NULL,

                                           FALSE,FALSE, NULL, NULL, NULL);

                                

  if l_keyval_status then  

    return 'S';   

  else

   --return l_error;

    l_err_msg:=substr(fnd_flex_keyval.error_message, 1, 240);     --fnd_message.get;

    

    l_error := substr(fnd_flex_keyval.error_message, 1, 240); 

   dbms_output.put_line(l_error); 

   dbms_output.put_line('ERROR SEGMENT :');

   l_error := to_char(fnd_flex_keyval.error_segment);

   dbms_output.put_line(l_error); 

   dbms_output.put_line('ERROR ENCODED :');

   l_error := substr(fnd_flex_keyval.encoded_error_message, 1, 240);

   dbms_output.put_line(l_error); 

   dbms_output.put_line('FALSE'); 


    dbms_output.put_line(l_err_msg||substr(sqlerrm,150,3));

    return l_error;

  end if;

  EXCEPTION WHEN OTHERS THEN

  DBMS_OUTPUT.PUT_LINE(SQLERRM);

end create_ccid;

EBS R12 FND_FLEX_VALUES Uploading (Dependent Values)

 --DELETE FROM xx_vendor_api_gl WHERE NUM IS NULL


SET SERVEROUTPUT ON;


DECLARE

   c_value_set_name CONSTANT VARCHAR2(100) := 'XX_Sub Account';

   c_parent_value   CONSTANT VARCHAR2(100) := '2210000';


   l_storage_value  VARCHAR2(32000);

   l_exists         NUMBER;

   l_err_msg        VARCHAR2(2000);


   CURSOR fetch_details

   IS

      SELECT num,

             vendor_no,

             vendor_name,

             liability_account,


             /* Segment 5: 353 becomes 0353 */

             LPAD(

                REGEXP_SUBSTR(

                   TRIM(liability_account),

                   '[^.]+',

                   1,

                   5

                ),

                4,

                '0'

             ) sub_account

        FROM xx_vendor_api_gl

       WHERE --vendor_no = 'XX-0354' AND

          NVL(process_flag, 'N') = 'N';

          

          

BEGIN

   FOR r IN fetch_details

   LOOP

      SAVEPOINT vendor_flex_value;


      BEGIN

         IF r.sub_account IS NULL THEN

            RAISE_APPLICATION_ERROR(

               -20001,

               'Unable to derive sub-account from: '

               || r.liability_account

            );

         END IF;


         /*

          * A dependent value is uniquely identified by:

          * value set + parent value + child value

          */

         SELECT COUNT(*)

           INTO l_exists

           FROM apps.fnd_flex_values_vl fv

           JOIN apps.fnd_flex_value_sets fvs

             ON fvs.flex_value_set_id = fv.flex_value_set_id

          WHERE fvs.flex_value_set_name = c_value_set_name

            AND fv.parent_flex_value_low = c_parent_value

            AND fv.flex_value = r.sub_account;


         IF l_exists = 0 THEN

            apps.fnd_flex_val_api.create_dependent_vset_value(

               p_flex_value_set_name => c_value_set_name,

               p_parent_flex_value   => c_parent_value,

               p_flex_value          => r.sub_account,

               p_description         => r.vendor_name,

               p_enabled_flag        => 'Y',

               p_start_date_active   => NULL,

               p_end_date_active     => NULL,

               p_hierarchy_level     => NULL,

               x_storage_value       => l_storage_value

            );


            DBMS_OUTPUT.put_line(

               'Created: parent=' || c_parent_value

               || ', child=' || r.sub_account

               || ', stored value=' || l_storage_value

            );

         ELSE

            /*

             * Record already exists. Update the description/vendor name

             * so rerunning this upload is safe.

             */

            apps.fnd_flex_val_api.update_dependent_vset_value(

               p_flex_value_set_name => c_value_set_name,

               p_parent_flex_value   => c_parent_value,

               p_flex_value          => r.sub_account,

               p_description         => r.vendor_name,

               p_enabled_flag        => 'Y',

               x_storage_value       => l_storage_value

            );


            DBMS_OUTPUT.put_line(

               'Updated existing value: parent=' || c_parent_value

               || ', child=' || r.sub_account

            );

         END IF;


         UPDATE xx_vendor_api_gl

            SET process_flag = 'Y',

                remarks      = NULL

          WHERE num = r.num;


         COMMIT;

      EXCEPTION

         WHEN OTHERS THEN

            l_err_msg :=

               SUBSTR(

                  SQLERRM

                  || ' | API: '

                  || apps.fnd_flex_val_api.message,

                  1,

                  2000

               );


            ROLLBACK TO vendor_flex_value;


            UPDATE xx_vendor_api_gl

               SET process_flag = 'N',

                   remarks      = l_err_msg

             WHERE num = r.num;


            COMMIT;


            DBMS_OUTPUT.put_line(

               'Failed vendor ' || r.vendor_no

               || ': ' || l_err_msg

            );

      END;

   END LOOP;

END;

/

Thursday, May 7, 2026

EBS R12 script to retry-rewind error workflows after uploading balances

 DECLARE


    l_result VARCHAR2(100);


BEGIN


    FOR r IN

    (

        SELECT DISTINCT wias.item_key,

                hat.transaction_id,

                hat.creation_date,

                ppf.full_name,

                paaf.assignment_id,

                paaf.payroll_id 

  FROM wf_item_activity_statuses_v  wias,

       hr_api_transactions          hat,

       per_all_people_f             ppf,

       per_all_assignments_f        paaf

 WHERE     wias.item_type = 'HRSSA'

       AND HAT.PROCESS_NAME = 'HR_GENERIC_APPROVAL_PRC' 

       AND TO_CHAR (hat.item_key) = wias.item_key

       AND hat.selected_person_id = ppf.person_id

       AND ppf.person_id = paaf.person_id

       AND paaf.primary_flag = 'Y'

       AND paaf.payroll_id = 192

       AND hat.ITEM_KEY = '697741'

       AND ACTIVITY_LABEL = 'HR_HR_COMMAPPLERR_V4_NTF'

       AND hat.creation_date BETWEEN TO_DATE ('01-JAN-2026', 'DD-MON-YYYY')

                                 AND TO_DATE ('31-DEC-2026 23:59:59',

                                              'DD-MON-YYYY HH24:MI:SS')

       AND hat.creation_date BETWEEN ppf.effective_start_date

                                 AND ppf.effective_end_date

       AND hat.creation_date BETWEEN paaf.effective_start_date

                                 AND paaf.effective_end_date

    )

    LOOP


        BEGIN


            wf_engine.handleerror

            (

                itemtype  => 'HRSSA',

                itemkey   => r.item_key,

                activity  => 'HR_COMMIT_TRANSACTION_V4_FCT',

                command   => 'RETRY',

                result    => l_result

            );


            dbms_output.put_line

            (

                'SUCCESS => Item Key : ' || r.item_key ||

                ' Result : ' || l_result

            );


            COMMIT;


        EXCEPTION

            WHEN OTHERS THEN


                dbms_output.put_line

                (

                    'FAILED => Item Key : ' || r.item_key ||

                    ' Error : ' || SQLERRM

                );


        END;


    END LOOP;


END;

/

Monday, November 24, 2025

Messages in Fast Formula EBs R12

 L_MSG = '1-Basic: ' + TO_TEXT(CURR_BASIC_SAL)

          + ' | Prorated: ' + TO_TEXT(PRORATED_BASIC)

          + ' | DEDUCTION: ' + TO_TEXT(DEDUCTION)

          + ' | UNWORKED_DED: ' + TO_TEXT(UNWORKED_DED)

 


Before --> 

  RETURN DEDUCTION, PAY_VAL, CURR_BASIC_SAL, PRORATED_COPLE, PRORATED_BASIC, ANNUAL_DED, ADJ_ADD, ADJ_SUB


After --> 

  RETURN DEDUCTION, PAY_VAL, CURR_BASIC_SAL, PRORATED_COPLE, PRORATED_BASIC, ANNUAL_DED, ADJ_ADD, ADJ_SUB,L_MSG



IN FORMULA RESULTS screen 

NAME L_MSG 

TYPE MESSAGE

SERVERITY INFORMATION 

Sunday, November 23, 2025

Oracle Ebs R12 Workflow in Arabic instance (issue and solution)

 Updated CS_MSGS.wtf workflow with new attribute as XX_URL as URl type.

Added to the notification, worked fine in the English instance, but not in the arabic instance.

In arabic instance it was not showing this new attribute in the Notification Message.


Solution: 

FOR Issue of arabic attributes not appearing 

EDIT  WF_MESSAGES_TL where type LIKE 'CS_MS%'

copy and Paste HTML_BODY SAME TO THE ENGLISH US


Tried below, but didnt work, dont know why 

export NLS_LANG=ARABIC_AMERICA.AR8MSWIN1256

echo $NLS_LANG

/u01/DEV/R122/fs1/EBSapps/appl/per/12.0.0/patch/115/import/AR/loc_ae/afzal

WFLOAD apps/apps@1.2.3.4:1544/DEV  0 Y FORCE CS_MSGS.wft


View the notification from backend: 

SELECT wf_notification.getbody(15605787)  FROM dual; 

Monday, June 30, 2025

Oracle EBS Update FND_USER user password

 DECLARE

    lc_user_name       VARCHAR2(100)  := 'AFZAL_BAIG';

--    ld_user_end_date   DATE  := SYSDATE;

l_password varchar2(40) := '123456';



BEGIN

   fnd_user_pkg.updateuser

   (  x_user_name               => lc_user_name,

      x_owner                   => NULL,

      x_unencrypted_password    => l_password,

      x_start_date              => NULL,

      x_end_date                => NULL,

      x_password_date           => to_date('2','J'), --forcing user to reset the password after the first login

      x_password_lifespan_days  => NULL,

      x_employee_id             => NULL,

      x_email_address           => NULL

   );


 COMMIT;



EXCEPTION

  WHEN OTHERS THEN

    ROLLBACK;

    DBMS_OUTPUT.PUT_LINE(SQLERRM);

END;

Sunday, June 29, 2025

EBS R12 Error in AME workflow when new approver is added

 Solution: 

1. Remove the employee name in the fnd_user form and add again and save.

2. Check tables wf_roles, wf_user_roles compare with the working employee.

3. In the AME Approval list check if the approvers are coming dynamic, then change it to the static and all the approvers.


Clear cache and test again.