Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 10548

Re: Select statement not returning all records for specific cases

$
0
0

Hi Pavan,

 

In some cases you need to fetch all the KEY fields (In this case BELZEILE needs to be fetched). If you Rephrase your select query to

 

          Data : c_1001 type e_preis value '0000001001'.

 

          SELECT belnr BELZEILE nettobtr preisbtr INTO TABLE i_price

                                                       FROM dberchz3

                                                       FOR ALL ENTRIES in i_erch

                                                       WHERE

                                                            belnr = i_Erch-belnr and

                                                             preis = c_1001.

 

If you check the F1 help for FOR ALL ENTRIES, it clearly says that

The entire logical expression sql_cond is evaluated for each individual row of the internal table itab. The result set of the SELECT statement is the union set of the result sets produced by the individual evaluations. Rows that appear in duplicate are removed from the result set automatically(In our case since BELZEILE is not fetched, we have multiple belnr's which would be removed because of duplication) . If the internal table itab is empty, the entire WHERE condition is ignored and all rows from the database are placed in the result set.


Viewing all articles
Browse latest Browse all 10548

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>