Una buena mañana, un buen café y la bendición de Dios
pueden hacer de un día gris, un día grandioso.
Hola esta es mi primer entrada a este Blog dedicado a la informática y pasatiempos personales.
Para los que andamos en el mundo de SAP BO, aquí les dejo dos Querys que les pueden salvar la vida, como ami. Son querys estándares, así que deben de funcionar en cualquier DB de SAP BO.
--REPORTE DE FACTURAS Y PAGOS
SELECT distinct T0.DocNum 'Factura', T0.DocStatus 'Estatus',
T0.DocDate 'Fecha',
T0.CardCode 'Cliente', T0.CardName 'Nombre', T0.DocCur 'Moneda',
T0.DocTotal 'Total Factura', T0.PaidToDate 'Total Pagado',
T1.SlpName 'Vendedor', T2.PymntGroup 'Cond. Pago',
T0.DocTotalSy 'Total USD', T3.DocNum 'No.Doc. Pago',
T3.CashSum 'Efectivo', T3.CreditSum 'T.Crédito',
T3.CheckSum 'Cheque', T3.TrsfrSum 'Transf', T3.DocTotal 'Total Pago',
T3.DocDate 'Fecha Pago'
FROM OINV T0
INNER JOIN OSLP T1 ON T0.SlpCode = T1.SlpCode
INNER JOIN OCTG T2 ON T0.GroupNum = T2.GroupNum
INNER JOIN ORCT T3 ON T0.DocNum = T3.DocNum
INNER JOIN NNM1 T4 ON T3.Series = T4.Series
INNER JOIN RCT2 T5 ON T3.DocEntry = T5.DocNum
WHERE T0.DocDate >= '2011.01.01' and t0.docdate <= '2011.01.31'
AND T3.Canceled = 'N'
ORDER BY T0.DocNum
-- PEDIDOS COMPRAS Y FACTURAS
SELECT T0.[Docnum] AS 'Pedido', T0.[Docstatus] AS 'Estado', T0.[Docdate] AS 'Fechadoc',
T0.[Cardcode] AS 'Cod Prov', T0.[Cardname] AS 'Proveedor', T0.[NumAtCard] 'Referencia proveedor',
T0.[Doctotal] AS 'Importe Total', T0.[PaidToDate] AS 'Pagado hasta la fecha', T0.[Comments] 'Comentarios',
T0.[JrnlMemo] AS 'Asiento en el diario', T0.[CtlAccount] AS 'Cuenta asociada', T0.[OwnerCode] 'Autor',
T1.[ItemCode] AS 'Artículo', T1.[Dscription] AS 'Descripción', T1.[OpenSum] AS 'Importe pendiente', T1.[AcctCode] AS 'Código de cuenta',
T1.[OcrCode] AS 'Ceco', T1.[Project] AS 'Proyecto', T2.[Linestatus] AS 'Estado linea', T3.[DocNum] AS 'Entrada de mercancías',
T3.[Comments] AS 'Comentarios', T3.[JrnlMemo] AS 'Entrada diario', T5.[Docnum] AS 'Factura',
T5.[Transid] AS 'Apunte contable', T4.[Acctcode] AS 'Cuenta apunte', T5.[PeyMethod] AS 'Vía de pago'
from opor t0 inner join por1 t1 on t0.docentry=t1.docentry
left join pdn1 t2 on t2.baseentry=t1.docentry and t2.basetype=22 and t2.baseline=t1.linenum
left join opdn t3 on t2.docentry=t3.docentry
left join pch1 t4 on t4.baseentry=t2.docentry and t4.basetype=20 and t4.baseline=t2.linenum
left join opch t5 on t4.docentry=t5.docentry
where t1.project='xyz'
que cuentan...?
FUENTE: http://scn.sap.com/