07-10-2007 10:01 AM
Hallo
Has anyone any tips to speed up MSEG operations? I need history from this table from 30 days back. I need only a few fields from MSEG but any select on this table is 50min time long ;-( Any guidance how to create views (if this will speed up my queries).
Thank you for any help.
Radek
07-10-2007 10:55 AM
Hi,
MSEG generally is VERY BIG table therefore you have to count that queries would be take a long time.
to improve it --
1) check if your select use any of indexes or primary key of MSEG
2) select as less as possible
3) check database statistic
4) post the select statement you do, might be we found something
BR, Artem
remember points
Message was edited by:
Artem Ruzak
07-10-2007 10:59 AM
Hi,
1. give condition in where clause which is primary keys in table (mblnr mjhr, posnr only) or chk secondary index and give condition in that field only.
2. donot give conditon on non key fields.!!!
3. or use for all entires command
Jogdand M B
07-10-2007 11:02 AM
Hi Radoslaw,
Reading MSEG can be quick - see for example transaction MB51 which uses the supplied index on plant and material. What kind of data selection are you making?
If the selection is based on fields that are not key fields and not in an index, then the selection will be slow.
I have also seen it where people are reading MSEG when there are better tables to read e.g. table EKBE if you want to get details of movements against a purchase order.
It would not make sense to set up a view, you might have to create a new index on MSEG.
07-10-2007 2:20 PM
SELECT on MKPF first using the posting date (BUDAT). There is an index on this field. Use the document number you get from MKPF to select against MSEG. This will definitely speed up the program.
Rob
07-10-2007 3:51 PM
<b>Hello all.
I would like to share yet another SQL performance tip, its relevant for anyone developing in SAP R3/ECC. I found some very useful notes on customer developments in MM/SD/PP/PM. They describe common sql errors made by developers when they develop programs that select from the following tables:
MSEG, LTAP, EBAN, RSEG, AFRU, AFKO, AUFK, CAUFV, RESB, VBAK, VBAP, VMVA, LIKP, LIPS, VBRK, VBRP, VBFA
Here are the note numbers : 191492,187906,185530.
They are very hard to find by regular means. (like searching for "mseg sql performance".) In general they describe the use of "INDEX TABLES", these are tables that act as indexes to the sap tables. They are maintained by sap (you may need to do some customizing for this to actually work).
These notes may save you time/trouble/performance problems/creating additional indexes. In other words, if your installation has customer developments in these areas (MM,SD,PP,PM) these notes are MUST READS.</b>
reward points if it is usefull ....
Girish
07-10-2007 4:41 PM
Excellent information Girish. I wasn't aware of these notes.
I couldn't find anything similar for FI.
Rob
07-12-2007 3:42 PM
Another way to speed up queries against MSEG and other big ones might be to keep your own data excerpts for those purposes. To do so, you can implement the BADI MB_DOCUMENT_UPDATE where you check already then the document against your selection criteria and if it applies, write it to your own Z-Table. However, this makes only sense, if the amount of records that apply is comparably small, otherwise you might things even worse.
Depending on what you want to achieve, you might also consider to implement a logistics information system (LIS)
Hope that helps
Frank