‎2006 Oct 31 12:20 PM
i have a program which is extracting large amount data like some tables mseg,mkpf its performance is very low because its getting a large amount of data into internal tables is there a solution to solve the issue.
‎2006 Oct 31 12:24 PM
Hi,
Keep given points in mind while fetching data.
1. Always prefer SELECT rather that SELECT...ENDSELECT.
2. Always prefer INTO TABLE than INTO CORRESPONDING
FIELDS OF TABLE
3. Take only required fields into internal table and
define internal table accordingly.
4. Use all possible key fields in WHERE condition.
5. If you are specifying non-key fields in WHERE condition
then create secondary INDEX for them.
I think this will help you a lot.
Let me know if any specific reuqirement is there.
*REWARD if this helps
‎2006 Oct 31 12:26 PM
Hi chayaarungupta,
It is not a good idea to play with MSEG or MKPF tables. Instead use standard function modules which are available to read databases based on the document category. For instance MB_READ_GOODS_MOVEMENT Function module to read goods movement.
‎2006 Oct 31 1:10 PM
if i use the function module is it possible for me to check the condition as we check in select statement
‎2006 Oct 31 12:29 PM
Hi,
use transaction SLIN & execute the same giving ur program name. U'll get all kinds of performance degrading errors/ warnings there.
‎2006 Oct 31 12:49 PM
hi
for tables such as vbak mseg and mkpf its better to use function modules to retrieve data from those tables so that it improves ur performance
‎2006 Oct 31 1:14 PM
I would say you can use select statments on MKPF and MSEG, but it will depend on the fields you are specifying in your WHERE clause.
If you posted your select statement may help.
‎2006 Oct 31 1:14 PM
can any one tell me what function modules do i need to use for MKPF , MSEG , I am using this code
*Get MSEG data
IF i_mara[] IS NOT INITIAL.
SELECT mblnr
mjahr
zeile
bwart
matnr
werks
lgort
sobkz
bwtar
menge
wempf
bukrs
grund
INTO TABLE i_temp_mseg
FROM mseg
FOR ALL ENTRIES IN i_mara
WHERE bwart IN s_bwart AND
matnr EQ i_mara-matnr AND
werks EQ p_werks AND
lgort IN s_lgort .
IF sy-subrc EQ 0.
DELETE ADJACENT DUPLICATES FROM i_temp_mseg.
ENDIF.
ENDIF.
*Get MKPF data
IF i_temp_mseg[] IS NOT INITIAL.
SELECT mblnr
mjahr
budat
usnam
INTO TABLE i_temp_mkpf
FROM mkpf
FOR ALL ENTRIES IN i_temp_mseg
WHERE mblnr = i_temp_mseg-mblnr
AND mjahr = i_temp_mseg-mjahr
AND budat IN s_budat.
IF sy-subrc EQ 0.
DELETE ADJACENT DUPLICATES FROM i_temp_mkpf.
ENDIF.
ENDIF.
can u tell me how to improve the performance.