08-10-2009 8:13 PM
Dears,
I used select statement like
select rnn
pucustctycode
into table gt_zgrrnnh
from zgrrnnh
where rnn in s_rnn
and lrcdate gt gv_update
and deleteind eq space.
and
select rnn
pucustctycode
appending table gt_zgrrnnh
from zgrrnnh
where rnn in s_rnn
and lrcdate eq gv_update
and lrctime gt gv_uptime
and deleteind eq space.
in my program. and now i want to combinate them using just one select.
and the different select conditions is lrdate and lrtime. and the firest selections has no limit to lrtime, but just limit to lrdate.
Anyone could help me how to use select ............when ..........(...........or............)?
Thanks a lot.
Julie.
08-10-2009 8:58 PM
Hi,
Try like this.
select rnn pucustctycode lrcdate lrctime
into table gt_zgrrnnh
from zgrrnnh
where rnn in s_rnn
and lrcdate >= gv_update
and deleteind eq space.
sort gt_zgrrnnh by lrcdate lrctime
loop at gt_zgrrnnh.
if gt_zgrrnnh-lrcdate < gv_update or gt_zgrrnnh-lrcdate > gv_update and lrctime < gv_uptime.
delete gt_zgrrnh index sy-tabix.
endif.
endloop.
Regards,
vik
08-10-2009 8:37 PM
Try this way
select rnn
lrcdate
lrctime
pucustctycode
into table gt_zgrrnnh
from zgrrnnh
where rnn in s_rnn
and lrcdate ge gv_update
and lrctime ge '000001'
and deleteind eq space.
delete gt_zgrrnnh where lrcdate eq gv_update
and lrctime lt gy_uptime.
Will it do ?
a®
08-10-2009 8:58 PM
Hi,
Try like this.
select rnn pucustctycode lrcdate lrctime
into table gt_zgrrnnh
from zgrrnnh
where rnn in s_rnn
and lrcdate >= gv_update
and deleteind eq space.
sort gt_zgrrnnh by lrcdate lrctime
loop at gt_zgrrnnh.
if gt_zgrrnnh-lrcdate < gv_update or gt_zgrrnnh-lrcdate > gv_update and lrctime < gv_uptime.
delete gt_zgrrnh index sy-tabix.
endif.
endloop.
Regards,
vik
08-14-2009 12:27 PM
hi,
good way to solve the problem, and still i get another way
select rnn
frcdate
frctime
into table gt_zgrrnnh
from zgrrnnh
where rnn in s_rnn
and ibmoccode in s_owning
and rnntype eq p_typrtn
and ( ( lrcdate gt gv_update ) or
( lrcdate eq gv_update and
lrctime ge gv_uptime ) )
and deleteind eq space.
08-10-2009 9:03 PM
Change your select query like this:
Select time also, u have to change your internal table Strucutre.
SELECT rnn
pucustctycode
lrctime
INTO TABLE gt_zgrrnnh
FROM zgrrnnh
WHERE rnn IN s_rnn
AND lrcdate GE gv_update
AND deleteind EQ space.
from this you will all the data irrespective of time , but you have time field in your internal table .
Now Loop at your internal table and delete those records whoes LRCTIME is less than GV_UPTIME.
This is one way, i am sure there can be many ways to do this.
One has to keep trying...
Let me know ,if you face further issue..
Regards,
Mayank
08-10-2009 9:10 PM
define two different ranges for date and time, populate them accordingly, use them in a select