Bom dia JC
A consulta ficou da seguinte forma
SELECT T0.NumAtCard, t0.docdate, t0.cardcode, t0.cardname, T0.SlpCode,T1.SlpName,
case
when T0.groupnum='-1' then 'F.Contado'
else 'F.Crédito' END as 'Tipo Venda',
(select doctotal from oinv where docnum = t0.docnum)as 'Total',
(select doctotal from oinv where docnum = t0.docnum and T0.groupnum='-1')as 'Total Contado',
(select doctotal from oinv where docnum = t0.docnum and T0.groupnum <>'-1') as 'Total Crédito'
FROM OINV T0 INNER JOIN OSLP T1 ON T0.SlpCode = T1.SlpCode
UNION ALL
SELECT T0.NumAtCard, t0.docdate, t0.cardcode, t0.cardname, T0.SlpCode,T1.SlpName,
case
when T0.groupnum='-1' then 'Contado'
else 'N/Crédito' END as 'Tipo Venda',
(select doctotal from ORIN where docnum = t0.docnum)as 'Total',
(select doctotal from ORIN where docnum = t0.docnum and T0.groupnum='-1')as 'Total Contado',
(select doctotal from ORIN where docnum = t0.docnum and T0.groupnum <>'-1') as 'Total Crédito'
FROM ORIN T0 INNER JOIN OSLP T1 ON T0.SlpCode = T1.SlpCode
where T0.DocDate >=[%0] and T0.DocDate <=[%1]
ORDER BY T0.DocDate
mas ao passar para o Gerador de Consulta do SAP, não funciona.
Tenho a Versão do SAP 9 PL 7