2008 Apr 01 7:13 PM
i am doing an select like this
FROM bsak
INTO TABLE t_cleared
FOR ALL ENTRIES IN t_data1
WHERE lifnr = t_data1-lifnr
AND bukrs IN s_bukrs
AND augdt GT p_kdate
AND belnr NE bsik-augbl
AND budat LE p_kdate
AND bschl = 31.
AND hkont IN s_hkont.
now the problem is that the table t_data1 has got no records for this particular case and moreover for the particular s_hkont and bukrs combination there are no records in the table but still this select is fetching all the records
wat is wrong here?
Hello,
You cant fetch any data from a select stm if there arent values on t_data1
please fisrt check if there are values....
ie:
DESCRIBRE TABLE t_data1 LINES num.
if num > 0.
<YOUR CODE>
endif.
Hope this helps
Gabriel P
2008 Apr 01 7:17 PM
You know the answer. t_data1 has no records..so all the records will be fetched if you use for all entries addition. It's a standard behaviour.
Solution:
Execute the select query only when t_data1[] is not initial.
2008 Apr 01 9:36 PM
We have to check the internal table not initial whenever we use FOR ALL ENTRIES Statement
If t_data1[] is balnk. it fetches all the record.
So check for t_data1[] not inital.
IF NOT t_data1[] is INITIAL.
Select *
FROM bsak
INTO TABLE t_cleared
FOR ALL ENTRIES IN t_data1
WHERE lifnr = t_data1-lifnr
AND bukrs IN s_bukrs
AND augdt GT p_kdate
AND belnr NE bsik-augbl
AND budat LE p_kdate
AND bschl = 31.
AND hkont IN s_hkont.
ENDIF
2008 Apr 02 12:30 AM
Hello,
You cant fetch any data from a select stm if there arent values on t_data1
please fisrt check if there are values....
ie:
DESCRIBRE TABLE t_data1 LINES num.
if num > 0.
<YOUR CODE>
endif.
Hope this helps
Gabriel P
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |