Showing posts with label GL. Show all posts
Showing posts with label GL. Show all posts

Thursday, September 19, 2019

Receivables to GL Link in 11i

SELECT je_header_id, line_number, trx_number, myrank, item_number,
       customer_number, customer_name, SOURCE, CATEGORY, batch_name,
       transaction_date, posted_date, period_name, currency_code,
       account_number, description,
       CASE
          WHEN myrank = 1
             THEN debits
          ELSE NULL
       END debits, CASE
          WHEN myrank = 1
             THEN credits
          ELSE NULL
       END credits
  FROM (SELECT   rcta.trx_number, rcta.customer_trx_id, gh.je_header_id,
                 ac.customer_number, ac.customer_name, gh.je_source SOURCE,
                 gh.je_category CATEGORY, gh.NAME batch_name,
                 TO_CHAR (gh.default_effective_date,
                          'DD-MON-YYYY'
                         ) transaction_date,
                 TO_CHAR (gh.posted_date, 'DD-MON-YYYY') posted_date,
                 gh.period_name period_name, gh.currency_code currency_code,
                 gl.je_line_num line_number,
                    gcc.segment1
                 || '.'
                 || gcc.segment2
                 || '.'
                 || gcc.segment3
                 || '.'
                 || gcc.segment4
                 || '.'
                 || gcc.segment5
                 || '.'
                 || gcc.segment6 account_number,
                 gh.description description, gl.accounted_dr debits,
                 gl.accounted_cr credits, rctla.inventory_item_id,
                 (SELECT segment1
                    FROM mtl_system_items_b msib
                   WHERE msib.inventory_item_id =
                                          rctla.inventory_item_id
                     AND msib.organization_id = rctla.warehouse_id)
                                                                  item_number,
                 DENSE_RANK () OVER (PARTITION BY gh.je_header_id, gl.je_line_num ORDER BY rctlg.cust_trx_line_gl_dist_id)
                                                                    AS myrank
            FROM gl_je_headers gh,
                 gl_je_lines gl,
                 gl_code_combinations gcc,
                 fnd_user fu,
                 gl_sets_of_books gsob,
                 gl_import_references gir,
                 ra_customer_trx_all rcta,
                 ra_cust_trx_line_gl_dist_all rctlg,
                 ra_customer_trx_lines_all rctla,
                 ar_customers ac
           WHERE gh.je_header_id = gl.je_header_id
             AND gl.code_combination_id = gcc.code_combination_id
             AND gh.last_updated_by = fu.user_id
             AND gh.period_name = :p_period
             AND gh.status = 'P'
             AND gh.set_of_books_id = gsob.set_of_books_id
             AND gsob.set_of_books_id = 1
             AND gh.je_source = 'Receivables'
             AND gir.je_header_id = gh.je_header_id
             AND gir.je_line_num = gl.je_line_num
             AND gir.je_batch_id = gh.je_batch_id
             AND TO_CHAR (gir.reference_2) = TO_CHAR (rcta.customer_trx_id)
             AND TO_CHAR (gir.reference_3) =
                                      TO_CHAR (rctlg.cust_trx_line_gl_dist_id)
             AND rcta.customer_trx_id = rctlg.customer_trx_id
             AND rctla.customer_trx_line_id = rctlg.customer_trx_line_id
             AND rctlg.customer_trx_id = rctla.customer_trx_id
             AND rctla.customer_trx_id = rcta.customer_trx_id
             AND rcta.bill_to_customer_id = ac.customer_id(+)
        ORDER BY gh.je_header_id, gl.je_line_num)

Tuesday, September 26, 2017

Script to update natural account

CREATE OR REPLACE PROCEDURE XX_GL_EXTRACT_ENABLE_ACCOUNT AS

v_set_id    number;
v_position_account_type    number:=3;
v_acc_flex_value_set    varchar2(240):='XXX_COA_ACCOUNT'; /**Pass the COA name/
flex_value_exeception    EXCEPTION;
v_upd_count    number:=0;

BEGIN
 
   SELECT   flex_value_set_id
     INTO   v_set_id
     FROM   fnd_flex_value_sets
    WHERE   flex_value_set_name = v_acc_flex_value_set;


   IF v_set_id IS NULL
   THEN
      RAISE flex_value_exeception;
   END IF;



   IF v_set_id IS NOT NULL
   THEN
     
      SELECT   COUNT (v.flex_value)
        INTO   v_upd_count
        FROM   fnd_flex_hierarchies_tl h,
               fnd_flex_values v,
               fnd_flex_values_tl vt,
               gl_lookups l1,
               gl_lookups l2,
               gl_lookups l5
       WHERE       h.flex_value_set_id(+) = v_set_id
               AND h.hierarchy_id(+) = v.structured_hierarchy_level
               AND h.language(+) = USERENV ('LANG')
               AND v.flex_value_set_id = v_set_id
               AND vt.flex_value_id = v.flex_value_id + 0
               AND vt.language = USERENV ('LANG')
               AND v.enabled_flag = l1.lookup_code
               AND l1.lookup_type = 'YES/NO'
               AND v.summary_flag = l2.lookup_code
               AND l2.lookup_type = 'YES/NO'
               AND NVL (
                     SUBSTRB (
                           fnd_global.newline
                        || v.compiled_value_attributes
                        || fnd_global.newline,
                        INSTRB (
                              fnd_global.newline
                           || v.compiled_value_attributes
                           || fnd_global.newline,
                           fnd_global.newline,
                           1,
                           v_position_account_type
                        )
                        + 1,
                        1
                     ),
                     'A'
                  ) = l5.lookup_code(+)
               AND l5.lookup_type(+) = 'ACCOUNT TYPE'
               AND l5.lookup_code IN ('A', 'L', 'O');

      IF v_upd_count > 1
      THEN
         UPDATE   fnd_flex_values
            SET   attribute1 = 'Y', value_category = 'XXX_COA_ACCOUNT'
          WHERE   flex_value IN
                        (SELECT   v.flex_value
                           FROM   fnd_flex_hierarchies_tl h,
                                  fnd_flex_values v,
                                  fnd_flex_values_tl vt,
                                  gl_lookups l1,
                                  gl_lookups l2,
                                  gl_lookups l5
                          WHERE   h.flex_value_set_id(+) = v_set_id
                                  AND h.hierarchy_id(+) =
                                        v.structured_hierarchy_level
                                  AND h.language(+) = USERENV ('LANG')
                                  AND v.flex_value_set_id = v_set_id
                                  AND vt.flex_value_id = v.flex_value_id + 0
                                  AND vt.language = USERENV ('LANG')
                                  AND v.enabled_flag = l1.lookup_code
                                  AND l1.lookup_type = 'YES/NO'
                                  AND v.summary_flag = l2.lookup_code
                                  AND l2.lookup_type = 'YES/NO'
                                  AND NVL (
                                        SUBSTRB (
                                              fnd_global.newline
                                           || v.compiled_value_attributes
                                           || fnd_global.newline,
                                           INSTRB (
                                                 fnd_global.newline
                                              || v.compiled_value_attributes
                                              || fnd_global.newline,
                                              fnd_global.newline,
                                              1,
                                              v_position_account_type
                                           )
                                           + 1,
                                           1
                                        ),
                                        'A'
                                     ) = l5.lookup_code(+)
                                  AND l5.lookup_type(+) = 'ACCOUNT TYPE'
                                  AND l5.lookup_code IN ('A', 'L', 'O'));
      END IF;
   Commit;
   END IF;

   DBMS_OUTPUT.put_line (
      'Number of Records updated :' || TO_CHAR (v_upd_count)
   );
EXCEPTION
   WHEN flex_value_exeception
   THEN
      DBMS_OUTPUT.put_line('Unable to deriver flex value set id for the value set XXX_COA_ACCOUNT');
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line ('Error in updating DFF values for Natural account'
      );
END XX_GL_EXTRACT_ENABLE_ACCOUNT;
/


Wednesday, June 22, 2016

Third Party Process - Colombia

This page explains the steps involved in generating the Colombia Third party report balances.

This process ensures the passage of the third party details to GL. This is mandatory in reporting the third party details to the Colombian government and to comply with the regulations of the Commercial Code, Decree 2649 of 1993 and No.5 Orientation Professional Technical Council of Public Accounting for submitting tax information.

The report should be generated by the system recorded books so as to provide a clear, complete and reliable business history trader, subject to regulations issued by the Colombian government.

Colombia GL à CLL F041: Generate Magnetic Media SLA à
1.       Third Party Maintenance Balances
2.       Third Party Report Attributes
3.       Third Party Report Balances