‎2006 Sep 19 8:52 PM
Hello friends I have to pull data from a table, based on records created from the last execution of the program till the current time.
I have written my logic as is below,
Can it be made more simple as it seems confusing to my lead.
where ( vbrkerdat EQ w_var_date AND vbrkerzet GT w_var_time )
OR ( vbrkerdat GT w_var_date AND vbrkerdat LT w_sys_date )
OR ( vbrkerdat EQ w_sys_date AND vbrkerzet LE w_sys_time ).
w_var_date - date when the program was executed last
w_var_time - time when the program was executed last
w_sys_date - sy-datum (Sysytm Date)
w_sys_time - sy-erzet (System time)
any advice,
Shejal Shetty.
‎2006 Sep 19 8:57 PM
Hi,
You don't have to consider the system date and time..
WHERE ( vbrkerdat >= w_var_date and vbrkerzet > w_var_time ).
I believe this should be enough..
Thanks,
Naren
‎2006 Sep 19 8:57 PM
Hi,
You don't have to consider the system date and time..
WHERE ( vbrkerdat >= w_var_date and vbrkerzet > w_var_time ).
I believe this should be enough..
Thanks,
Naren
‎2006 Sep 19 8:59 PM
Well, how about:
where ( vbrk~erdat EQ w_var_date AND vbrk~erzet GT w_var_time )
OR ( vbrk~erdat GT w_var_date ).
‎2006 Sep 19 9:03 PM
‎2006 Sep 19 9:04 PM
Hi,
Please try this.
SELECT vbrk~erdat vbrk~erzet
...
ORDER BY vbrk~erdat DESCENDING
vbrk~erzet DESCENDING.Regards,
Ferry Lianto
‎2006 Sep 19 9:07 PM
Thanks everyone.
I didnt think of not uding the current date and time.
Thanks again.
‎2006 Sep 19 9:07 PM
Hi Shejal,
To meet your requirement all conditions are necessary.
So, your WHERE condition is absolutely correct even though it looks confuse.
Note: You need to put additional parenthesis to your condition. Otherwise, it will leads to wrong results.
Your intention is meet to one of conditions, so all these conditions should be under one more pair of parenthesis.
where <b>(</b> ( vbrkerdat EQ w_var_date AND vbrkerzet GT w_var_time )
OR ( vbrkerdat GT w_var_date AND vbrkerdat LT w_sys_date )
OR ( vbrkerdat EQ w_sys_date AND vbrkerzet LE w_sys_time ) <b>)</b>.
Thanks,
Vinay
‎2006 Sep 19 9:17 PM
Thanks Vinay for the suggestion but i am kind of thinking that the way Rob has said would also meet all the conditions..Dosent It?
and looks smuch simplier than the one i had written it.
Shejal