Use the SQL trace (transaction ST05
) to analyze your query. One of the major issues - apart from the fact that you're potentially throwing thousands of queries at the database - would be that you're not using any index at all, not even to perform a range scan. This will probably force the DBMS to perform thousands of full-table scans. If you would supply PGMID
and OBJECT
, it should speed up things quite significantly.
It might also be a good idea to restrict the number of transport requests you're looking at by using its prefix. I just checked several of our systems - depending upon the age of the system, half of the entries in E071
do not belong to transports at all. In one system, only 75,000 entries of over 4,5 million entries were created locally, the others are piece lists of support packages and the like.
From an earlier question, I've got an idea of what you're trying to achieve. Be aware that you can't rely on the main object name being at the very beginning of the partial object name. You may want to check the coding of the function module TR_CHECK_TYPE
to get an idea of how partial (LIMU
) entries can be mapped to entire object entries (R3TR
). However, I don't know of a function module that would work the opposite direction.
I would not worry about selecting individual fields instead of SELECT *
at this stage. Contrary to what you might read in other responses or comments, E071
is a relatively narrow table with very few fields, and you already need the largest fields in your query. There's probably very little to gain by only selecting individual fields.