‎2007 Sep 04 6:35 PM
Hi Experts,
In table PA0002 we are having active and future records. Can any body tell me how to fetch active and future records.
urgent.........
‎2007 Sep 04 6:40 PM
Hi,
Use like this:
SELECT *
FROM PA0002
INTO TABLE t_pa0002
WHERE BEGDA LE sy-datum
AND ENDDA GE sy-datum.
Thanks and Best Regards,
Vikas Bittera.
‎2007 Sep 04 8:25 PM
Which records you select will be determined by the dates you use for getting the information. If you use the GET PERNR statement in your program (logical database programming), you can use this to get the latest available record:
rp-provide-from-last p0002 space w_begda w_endda.
Use sy-datum for w_begda and '99991231' for w_endda if you want to get the last record available (including a future record). Use sy-datum for both w_begda and w_endda if you want to get the record that is valid as of today.
If you want to do a direct table select, use this to get all records valid from today going forward:
SELECT * FROM PA0002 INTO wa_0002
WHERE begda >= sy-datum AND endda >= sy-datum.
put code here for manipulating the records
ENDSELECT.
Or to just get the last record, whether it is from today or the future, use this:
SELECT SINGLE * FROM PA0002 INTO wa_0002 WHERE endda = '99991231'.
I hope this helps.
- April King