Skip to Content
0
Aug 10, 2015 at 10:52 AM

Need FMS when Excess amount is billed???

14 Views

Hi All,

I need FMS if sum( OINV.DocTotal)-ORDR.DocTotal is greter than zero, then FMS gives that value,else it will be 0 itsef

here i have written query for that..but retrieving result is not correct....

select case

when (sum(T0.DocTotal)-R0.DocTotal) > 0

then (sum(T0.DocTotal)-R0.DocTotal)

else 0

end

from OINV T0

inner join INV1 T1 on T0.DocEntry = T1.DocEntry

left join RDR1 R1 on T1.BaseEntry = R1.DocEntry

inner join ORDR R0 on R1.DocEntry = R0.DocEntry

where R0.DocEntry=5

group by R0.DocEntry,R0.DocTotal

Regards

Karthik