‎2008 Feb 29 12:43 PM
in my report i am selectin data from bsak table into itab2 for all entries in itab1.
itab1 has got only one record but the problem is that it is picking all the data not only the data corresponding to the data in itab1.
in itab1 i am selecting data based on the vendor no enetred by the user in seelcetion screen
this is the code for second selectionm
SELECT bukrs "getting details of open items based on user input
lifnr
umskz
augdt
augbl
belnr
budat
zterm
waers
bschl
bstat
zfbdt
shkzg
zbd1t
zbd2t
zbd3t
rebzg
rebzt
bldat
dmbtr
FROM bsak
INTO TABLE t_cleared
FOR ALL ENTRIES IN t_data1
WHERE bukrs IN s_bukrs
AND lifnr = t_data1-lifnr
AND augdt LE p_kdate
OR augdt LE p_kdate
AND belnr NE bsik-augbl
AND bschl = 31.
ENDFORM. "f_get_cleared_data
‎2008 Feb 29 12:46 PM
Hi
Modify ur code as follows:
SELECT bukrs "getting details of open items based on user input
lifnr
umskz
augdt
augbl
belnr
budat
zterm
waers
bschl
bstat
zfbdt
shkzg
zbd1t
zbd2t
zbd3t
rebzg
rebzt
bldat
dmbtr
FROM bsak
INTO TABLE t_cleared
FOR ALL ENTRIES IN t_data1
WHERE lifnr = t_data1-lifnr
AND bukrs IN s_bukrs
AND augdt LE p_kdate
OR augdt LE p_kdate
AND belnr NE bsik-augbl
AND bschl = 31.
ENDFORM. "f_get_cleared_data
‎2008 Feb 29 12:49 PM
Hi,
What are the fields in itab1 and from which table are you filling the internal table itab1 ?
Regards
‎2008 Feb 29 12:54 PM
same fields as in itab2 and i am getting the data from bsik table
‎2008 Feb 29 12:54 PM
Hi,
When you are selecting from BSAK table , in order to get a single entry you need to enter all the key fields. Unless you enter all the key fields you may get multiple records.
Tell me thru which table are u filling itab1 and what are those fields.
Regards.
‎2008 Feb 29 1:00 PM
Hi,
When you are filling into the internal table itab1, fetch all the key fields from the table BSIK.
I think you should not have any problem then.
Regards.
‎2008 Feb 29 1:06 PM
Make sure ur internal table has data.
If internal table has no data, FOR ALL ENTRIES fetches all the records from the data base .
Regards,
Ajay
‎2008 Feb 29 1:12 PM
Hi,
Check ur where clause. Why u gave condition OR augdt LE p_kdate. Let me know this. Just remove this condition. U can get the proper out put.
WHERE bukrs IN s_bukrs
AND lifnr = t_data1-lifnr
AND augdt LE p_kdate
OR augdt LE p_kdate
AND belnr NE bsik-augbl
AND bschl = 31.
Thanks,
Vinod.