2008 Jul 30 6:26 AM
hi sap guru's,
please help me regarding performance tunning.
loop at itab
select matnr maktx from mara into jtab where matnr = itab-matnr.
append jtab.
endloop.
loop statement will work in application server,
and select query fires in database server.
now if i want to tune performance ,
which statement i need to tune,
please forward any document with is releated to performance tunning , that really helps me.
thanks & regards
prasad
2008 Jul 30 6:29 AM
Hi
Its not a good idea to write a SELECt statement inside a LOOP and ENDLOOP .
loop at itab
select matnr maktx from mara into jtab where matnr = itab-matnr.
append jtab.
endloop.
First you read all teh data into ITAb and then its better to use
FOR ALL ENTRIES
example
SELECT *
FROM <TAB>
INTO <itab>
SELECT *
FROM <tab2>
INTO <jtab>
FOR ALL ENTRIES IN TABLE <itab>
WHERE MATNR EQ = ITAB-MATNR.
I hope this helps you
Regards
Pavan
2008 Jul 30 6:29 AM
Hi
Its not a good idea to write a SELECt statement inside a LOOP and ENDLOOP .
loop at itab
select matnr maktx from mara into jtab where matnr = itab-matnr.
append jtab.
endloop.
First you read all teh data into ITAb and then its better to use
FOR ALL ENTRIES
example
SELECT *
FROM <TAB>
INTO <itab>
SELECT *
FROM <tab2>
INTO <jtab>
FOR ALL ENTRIES IN TABLE <itab>
WHERE MATNR EQ = ITAB-MATNR.
I hope this helps you
Regards
Pavan
2008 Jul 30 6:29 AM
2008 Jul 30 6:30 AM
Hi Prasad,
Please check this link
SELECT statement hit the database. If we write select statement in side the loop , then every time it hits the database.
For every record it hits the database and fetches the data. It better to get all the data from the database into a internal table and the process the data accordingly.
Best regards,
raam
2008 Jul 30 6:30 AM
Hi
try for this code
if there is a relation between itab and jtab
then
select * from mara into corresponding feilds of table itab
for all entries in jtab.
where matnr = jtab-matnr.
replace this code lie this
thanks
Sachhidananda
Edited by: sachhidananda tripathy on Jul 30, 2008 7:31 AM
2008 Jul 30 6:32 AM
dont use select inside loop, so its better go for all entries
select matnr maktx
from mara
into jtab
for all entiries in itab
where matnr = itab-matnr.
With luck,
pritam.
2008 Jul 30 7:14 AM
Hi kantu ,
Never used select inside a loop its blunder mistake but in some exceptional cases you can do with the approval from the quality team . better use for all entries like example
select matnr
maktx
from mara
into jtab
for all entiries in itab
where matnr = itab-matnr.
regards
fareed
2008 Jul 30 10:31 AM
Hi,
Do not use select statements inside a loop. You can use for all entries.
select matnr maktx from mara into table j1tab for all entries in itab where matnr = itab-matnr.
loop at itab
read table j1tab with key matnr = itab-matnr.
if sy-subrc = 0.
move j1tab to jtab.
append jtab.
endif.
endloop.
Regards
Samson.