2009 Jan 12 10:43 AM
Hi,
I need to select from BKPF from 7am of the entry date on selection screen(p_cpudt) to 7am of the following day. I'm using the code below; select both days and then two delete statements but is there anyway of making it more efficient and doing it in one select? Because the select spans two days i cant just say time greater than 7am one day and less than 7am the next?
DATA: l_cpudt1 TYPE cpudt.
l_cpudt1 = p_cpudt + 1.
SELECT * INTO TABLE lt_bkpf
FROM bkpf
WHERE bukrs IN s_bukrs
AND blart IN s_blart
AND cpudt GE p_cpudt
AND cpudt LE l_cpudt1.
DELETE lt_bkpf
WHERE cpudt = l_cpudt1
AND cputm GT '07:00:00'.
DELETE lt_bkpf
WHERE cpudt = p_cpudt
AND cputm LT '07:00:00'.
2009 Jan 12 10:48 AM
you can combine both conditions:
...
AND ( cpudt EQ p_cpudt AND cputm GE '070000' ) OR
( cpudt EQ l_cpudt1 AND cputm LE '065959' ).
you can combine both conditions:
...
AND ( cpudt EQ p_cpudt AND cputm GE '070000' ) OR
( cpudt EQ l_cpudt1 AND cputm LE '065959' ).
2009 Jan 12 10:48 AM
you can combine both conditions:
...
AND ( cpudt EQ p_cpudt AND cputm GE '070000' ) OR
( cpudt EQ l_cpudt1 AND cputm LE '065959' ).
2009 Jan 12 11:38 AM
Hi Eric,
That worked thanks....i had tried that before but i was entering time as '07:00:00' insted of '070000' so that probably caused the problem.
2009 Jan 12 10:53 AM
Hi,
Try to use ranges.
1. append the range for date with the yesterday's date in the range low field and todays date in the range's high field.
2. For time append the time in a range as 07:00:00 and give the options as 'GE'
Now you will have all the documents created from 7 am yesterday and documents created today.
The above can be done i one select statemet.
Here you will have to add one additional delete just to delete the documents that were created today after 7 am.
regards,
Advait
regards,
Advait
2009 Jan 12 10:59 AM
Hi Dave,
Try with the below statement.
SELECT * INTO TABLE lt_bkpf
FROM bkpf
WHERE bukrs IN s_bukrs
AND blart IN s_blart
AND ( ( cpudt EQ p_cpudt AND erzet GT u2018070000u2019 )
OR ( erdat EQ sy-datum AND erzet LE '065959') ).
This select statement will solve your problem.
Regards,
Phani.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |