‎2007 Jan 31 4:43 PM
Hi,
I am facing a serious performance issue with a query. This query is fetching data definions of all the fields of a given table. Table /Insurance/DD02T has short descriptions of the fields, and hence I am doing inner join between dd03l and /Insurance/DD02T as follows
I was using query :
Loop
select Afieldname Adatatype Aleng BDDTEXT into table IT_TABDD03L
from DD03L AS A inner join /Insurance/DD02T AS B
on Afieldname = Bfieldname
AND ATABNAME = BTABNAME
where A~tabname = P_TABLE
AND B~DDLANGUAGE = 'EN'.
Then read table with:
read table IT_TABDD03L with key fieldname = IT_TABFIELDS-fieldname.
:
:
Endloop.
But using above select inside loop was not agood idea, so I used seelct outside loop and then used read statement inside loop as follows:
select Afieldname Adatatype Aleng Atabname B~DDTEXT into table
IT_TABDD03L
from DD03L AS A inner join /Insurance/DD02T AS B
on Afieldname = Bfieldname
AND ATABNAME = BTABNAME
where B~DDLANGUAGE = 'EN'.
Loop.
read table IT_TABDD03L with key fieldname = IT_TABFIELDS-fieldname TABNAME = P_table.
:
:
endloop.
But this select is more horrible then previous one which I was using inside loop. Please help me to optimize this..
‎2007 Jan 31 4:57 PM
Hi,
In the first place why do you want a unlimited loop...endloop.
Loop.
read table IT_TABDD03L with key fieldname = IT_TABFIELDS-fieldname TABNAME = P_table.
:
:
endloop.
The select query is fine.
Regards
Subramanian
‎2007 Jan 31 5:07 PM
Do a binary search:
sort IT_TABDD03L by fieldname.
read table IT_TABDD03L with key
fieldname = IT_TABFIELDS-fieldname TABNAME = P_table
binary search.
Nested loops can be more of a performance problem that poorly coded SELECT statements.
Rob
Message was edited by:
Rob Burbank
‎2007 Jan 31 5:15 PM
Hi,
Have you looked FM DDIF_FIELDINFO_GET instead?
Regards,
Ferry Lianto
‎2007 Jan 31 6:13 PM
hi
good
i think you have done some mistake in the condition that you have given in the second select statement ,plz check that again and do the changes accordingly.
Thanks
mrutyun^