If we have selected some data into an internal table and now we have to fetch more data from other tables based on the entries in internal table, it's always advisable to use 'For all entries in Itab' option with Select statement rather than using loop endloop option. **** And we should try to directly fetch data in internal table rather than fetching in a variable and then moving this variable into internal table.
data: begin of itab occurs 1000. equnr like v_equi-equnr. data: end of itab. data: begin of itab2 occurs 1000. tplnr like v_equi-tplnr. data: end of itab2. ***** With out For all Entries option ****** Select equnr from afih into table itab where aufnr > '100000'. loop at itab. select tplnr from v_equi where equnr = itab-equnr. itab2-tplne = v_equi-tplnr. append itab2. clear itab2. endselect. endloop. ****** Now using 'For all entries option' Select tplnr into table itab2 from v_equi for all entries in itab where] equnr = itab-equnr. Here data will be fetched in single shot and communication server will be reduced which in turn will improve performance of the code. **********