Ver Mensaje Individual
  #4 (permalink)  
Antiguo 31/05/2010, 11:46
lvalenz
 
Fecha de Ingreso: abril-2007
Ubicación: Stgo-Chile
Mensajes: 5
Antigüedad: 17 años, 8 meses
Puntos: 0
Respuesta: eBusinness Suite - Necesito un SQL para linkear módulo GL y AP

finalmente he encontrado esta solución, que permite linkear GL con AP.
Trae todos los movimentos desde AP de un flexfield contable GL.

Oracle Business Suite.
Version 11.01
----------------------------------

select distinct
t2.segment1,
t3.name,
t4.je_category,
t4.je_source,
t4.name as name_header,
t4.doc_sequence_value,
t2.segment2,
t2.segment3,
t2.segment4,
t2.segment5,
t1.description as descrip_lines,
t1.entered_dr, t1.entered_cr ,
ia.invoice_num,
dis.amount, dis.line_type_lookup_code, dis.description as descrip_distrib
from apps.gl_je_lines t1,
apps.gl_code_combinations t2,
apps.gl_ledgers t3,
apps.gl_je_headers t4,
apps.gl_je_batches gjb,
gl_import_references gir,
xla_ae_lines ael,
xla_ae_headers aeh,
xla_events aea,
xla.xla_transaction_entities xte,
ap_invoices_all ia,
po_vendors pv,
ap_invoice_distributions_all dis


where t1.code_combination_id = t2.code_combination_id
and t1.ledger_id = t3.ledger_id
and gjb.je_batch_id = t4.je_batch_id
and t2.segment1 = ?
and t2.segment2 = ?
and t1.period_name = ?
and t1.je_header_id = t4.je_header_id
and t1.status = 'P'
and t3.ledger_category_code = 'PRIMARY'

and ael.gl_sl_link_id = gir.gl_sl_link_id
and gjb.je_batch_id = gir.je_batch_id
and T4.je_header_id = gir.je_header_id
and T1.je_line_num = gir.je_line_num
and gir.gl_sl_link_table in ('XLAJEL')
and ael.gl_sl_link_table in ('XLAJEL')
and aea.application_id = 200
and aea.event_id = aeh.event_id
and aeh.ae_header_id = ael.ae_header_id
and xte.application_id = 200
and xte.entity_id = aea.entity_id
and xte.source_id_int_1 = ia.invoice_id
and pv.vendor_id = ia.vendor_id

and ia.invoice_id = dis.invoice_id

and dis.dist_code_combination_id = t2.code_combination_id

and ((t1.entered_dr>0 and dis.amount > 0) or (t1.entered_cr>0 and dis.amount < 0))

order by doc_sequence_value, segment1, segment2, segment3, segment4, segment5, ia.invoice_num