smusba
18th January 2009, 10:54
Hi Gurus,
the Query is :
"Take the data from tdrpl100 based on order date and check the status should be delivered and then check that order into tdsfl003 table if RPL order no is available then print it otherwise leave it blank.

Join between two table is RPL order no and warehouse and date. "

This is my script but i am not getting the required output. Please help..
I am getting output only from tdrpl100 only..not from tdsfl003
functions:
function read.main.table()
{

select tdrpl100.*
from tdrpl100
where tdrpl100.rwar = :rwar
and tdrpl100.dwar = :dwar
and tdrpl100.odat between :odat.f and :odat.t
and tdrpl100.srpl > 1
order by tdrpl100.orno
selectdo
select tdsfl003.*
from tdsfl003
where tdsfl003.orno = :tdrpl100.orno
and tdsfl003.rwar = :tdrpl100.rwar
and tdsfl003.dwar = :tdrpl100.dwar
and tdsfl003.trtp = "MREQ"
selectdo
tdsfl003.orno = tdrpl100.orno
tdsfl003.rwar = tdrpl100.rwar
tdsfl003.dwar = tdrpl100.dwar
selectempty
tdsfl003.orno = tdrpl100.orno
tdsfl003.rwar = tdrpl100.rwar
tdsfl003.dwar = tdrpl100.dwar

endselect

select tiitm001.*
from tiitm001
where tiitm001.item = :tdrpl100.item
selectdo
endselect

rprt_send()

endselect
}


I have attached two tables.

grzegorz
18th January 2009, 20:22
O would suggest:

select tdrpl100.*
from tdrpl100
where tdrpl100.rwar = :rwar
and tdrpl100.dwar = :dwar
and tdrpl100.odat between dat.f and dat.t
and tdrpl100.srpl > 1
order by tdrpl100.orno
selectdo
| Here we have RPL oreders selected
select tdsfl003.*
from tdsfl003
where tdsfl003.orno = :tdrpl100.orno
and tdsfl003.rwar = :tdrpl100.rwar
and tdsfl003.dwar = :tdrpl100.dwar
and tdsfl003.trtp = "MREQ"
selectdo
| order present in your tdsft003 table
| tdsfl003.orno = tdrpl100.orno ! dont need this
| tdsfl003.rwar = tdrpl100.rwar ! due to where clause
| tdsfl003.dwar = tdrpl100.dwar !
... here select itm data from itm001..
rprt_send()
endselect


I hope my select matches you requiremnent better.

smusba
19th January 2009, 07:19
no,still the same

mark_h
21st January 2009, 16:07
Please do not delete threads that others have replied to.

Thanks