‎2008 Jan 28 1:05 PM
Hi,
I am making hitting database using following Select query.
It is taking lots of time . It is making selection on View.
OPEN CURSOR l_mvmnt FOR "2D202626
SELECT mblnr
mjahr
budat
zeile
bwart
matnr
werks
FROM v_bam_mkpf
FOR ALL ENTRIES IN t_matnr_werks
WHERE budat IN r_sydatum AND
( bwart IN r_bwart OR
bwart IN r_bwart_rev ) and
MATNR = T_MATNR_WERKS-MATNR AND
werks = t_matnr_werks-werks.
DO.
REFRESH :lt_mvmnt.
*-- Fetch data from the cursor to the internal table
*-- based on the package size
FETCH NEXT CURSOR l_mvmnt INTO CORRESPONDING FIELDS OF
TABLE lt_mvmnt PACKAGE SIZE l_pkgsiz.
IF NOT sy-subrc IS INITIAL.
CLOSE CURSOR l_mvmnt.
EXIT.
ELSE.
APPEND LINES OF lt_mvmnt TO t_mvmnt.
ENDIF.
ENDDO.
I tried with various different values of package size also
But query is taking lots of time.
Thanks in Advance
‎2008 Jan 28 1:08 PM
well i didnt had a real close look on it, but a FOR ALL ENTRIES statement forces a full table scan. this is pobably a part of your performance problem.
‎2008 Jan 28 3:05 PM
This view doesn't exist in any of our systems. Is it a view on MKPF and MSEG?
I think I would start by getting rid of the CURSOR.
Rob
‎2008 Jan 28 3:09 PM
Hi Shivani, try like this.
try to use the MOVE CORREPOSDING FIELDS OF statement with the select query and see the difference,try to use the key field in the select query.
Also,
performance of the select statement might be low bcoz of the selection strategy you followed while coding the select statement. i think this link might help u to solve ur problem upto some extent
http://help.sap.com/saphelp_47x200/helpdata/en/69/c250684ba111d189750000e8322d00/frameset.htm
hope this helps.
kindly reward if found helpful.
cheers,
Hema.