Pages

Friday, January 31, 2014

GL Query for Purchase India(source) - Receiving India(category)

SELECT msib.segment1 item, msib.description, rsh.receipt_num,
       mp.organization_code, gjl.accounted_dr, gjl.accounted_cr, gjh.je_source, gjh.je_category
  FROM apps.gl_je_headers gjh,
       apps.gl_je_lines gjl,
       apps.gl_code_combinations_kfv gcc,
       apps.gl_import_references gir,
       apps.rcv_transactions rt,
       apps.rcv_shipment_headers rsh,
       apps.rcv_shipment_lines rsl,
       apps.gl_je_batches gjb,
       apps.mtl_parameters mp,
       apps.mtl_system_items_b msib
 WHERE gjh.je_header_id = gjl.je_header_id
   AND gjh.je_header_id = gir.je_header_id
   AND gir.je_header_id = gjl.je_header_id
   AND gir.je_line_num = gjl.je_line_num
   AND gjb.je_batch_id = gir.je_batch_id
   AND gjh.je_source = 'Purchasing India'
   AND gjl.reference_2 LIKE 'India Localization Entry'
   AND gjl.code_combination_id = gcc.code_combination_id
   AND rt.organization_id = mp.organization_id
   AND rt.transaction_id = gjl.reference_5
   AND rt.shipment_header_id = rsh.shipment_header_id
   AND rsl.shipment_header_id = rsh.shipment_header_id
   AND rsl.shipment_line_id = rt.shipment_line_id
   AND msib.inventory_item_id = rsl.item_id
   AND msib.organization_id = rt.organization_id
   AND gjl.period_name in (select distinct period_name from apps.gl_periods where start_date between :p_from_per and :p_to_per)
   AND gcc.segment4 in (3021000, 3021100)--, 3021700, 3023000, 3023100)
   AND gcc.segment3 in (100603)
   AND gcc.segment2 not in (102)  

No comments:

Post a Comment