cancel
Showing results for 
Search instead for 
Did you mean: 

Reporte de Pagos Recibidos

0 Kudos
426

Estimados expertos

Tengo el siguiente Query necesito que me ayuden por favor soy nuevo en SAP, lo que quiero es un reporte de pagos recibidos y tengo el siguiente código:

SELECT T0."CardCode" AS "Cedula",T0."CardName" AS "Nombre",T0."DocNum" AS "NumRecibo", T0."DocDate" AS "FechaRecibo", T0."DocTotal" AS "TotalRecibo",T2."DocNum" AS "NumFactura", T2."DocDate" AS "FechaFactura", T2."DocTotal" AS "TotalFactura"

FROM ORCT T0

INNER JOIN RCT2 T1 ON T0."DocEntry" = T1."DocNum"

INNER JOIN OINV T2 ON T1."DocEntry" = T2."DocEntry"

WHERE T2."DocNum" = T2."DocNum"

Ayúdenme verificando si esta correcto o como deberia ser

Accepted Solutions (1)

Accepted Solutions (1)

SonTran
Active Contributor
0 Kudos

Hi,

Try this

SELECT T0.[DocDate] AS 'Payment Date',
T0.[DocNum] AS 'DocNum',
CASE WHEN T1.InvType = 13 THEN 'AR Invoice'
WHEN T1.InvType = 30 THEN 'JE'
WHEN T1.InvType = 14 THEN 'AR Credit Memo'
ELSE 'Others'
END AS 'Document Type',
T0.[CardCode] AS 'Customer Code',
T0.[CardName] AS 'Customer Name',
T3.[DocNum] AS 'Customer Invoice',
T3.[NumAtCard] AS 'Customer Invoice Ref',
T3.[DocTotal] AS 'Invoice Amount',
Case When T0.[CashSum] > 0 Then 'Cash'
When T0.[CreditSum] > 0 Then 'Credit Card'
When T0.[TrsfrSum] > 0 Then 'BankTrnsfer'
Else 'Check' End AS 'Paid By',
T2.[CheckNum] AS 'Check #',
T0.[TrsfrRef] AS 'BankTrnsfer',
T0.[DocTotal] AS 'Paid Amount'
FROM ORCT T0
LEFT JOIN RCT2 T1 ON T1.DocNum = T0.DocEntry
LEFT JOIN RCT1 T2 ON T1.DocNum = T2.DocNum
LEFT JOIN OINV T3 ON T1.DocEntry = T3.DocEntry<br>

Hope this helps,

Son Tran

Answers (0)