Skip to Content

Performance while read MSEG

Hi Gurs,

Kindly guide me ....

I developed a report for Age wise stock analysis.. It is taking so much time when running in production server because of so many records in MSEG Table ...

Give the alternate if any ??

This is my code..

SELECT MSEGMBLNR MSEGMJAHR MSEGZEILE MSEGWERKS MSEGMATNR MSEGBWART MSEGMENGE MKPFBUDAT

INTO TABLE IT_TRANS

FROM MSEG AS MSEG JOIN MKPF AS MKPF

ON MSEGMANDT = MKPFMANDT AND

MSEGMBLNR = MKPFMBLNR AND

MSEGMJAHR = MKPFMJAHR

FOR ALL ENTRIES IN T_AGE_TMP

WHERE MSEG~MATNR EQ T_AGE_TMP-MATNR

AND MSEG~WERKS EQ PR_BWKEY

AND MSEG~LGORT IN SO_LGORT

AND MSEG~BWART IN BWART

AND MSEG~SHKZG EQ 'S'

AND MKPF~BUDAT IN BUDAT.

Thanks & Regards,

Murugesh R

Add a comment
10|10000 characters needed characters exceeded

Related questions

6 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 28, 2008 at 10:45 AM

    Hi

    U should check wich indexes are active your system for both tables MSEG and MKPF, probably your selection can't use any index.

    Max

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 28, 2008 at 10:44 AM

    MSEG is such a big table, you have to use the indexes (primary or secondary) to read it. If there is no index for your use you can create your own.

    regards,

    Hans

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 01, 2008 at 01:10 PM

    Dear Muragesh,

    U can use READ statement with BINARY SEARCH.

    check the internal table shoiuld not be initial.

    Best Regards,

    Flavya

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 02, 2008 at 07:40 AM

    Hi ,

    what are the fields u are using in the index MSEG~M ?

    regards

    Prabhu

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Murugesh Kumar Ramasamy

      With whatever you had mentioned above, I don't think of any other way of improving performance.

      At most, you can make sure user enters LGORT on screen, if user agrees, you may make LGORT and BWART as mandatory field.

      Also make sure, you index M is active at database level. If it is not active at databse level, you will get warning message displayed while viewing index.

      Regards,

      Mohaiyuddin

  • author's profile photo Former Member
    Former Member
    Posted on Dec 02, 2008 at 10:28 AM

    Hi,

    You can reduce DB time by removing FOR ALL ENTRIES clause in select query ,and use Ranges to delete IT_TRANS entries based on MATNR i.e. use a delete statement

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 02, 2008 at 03:56 PM

    a JOIN is not always the better way to retrieve records...........maybe you should try it with 2 selects

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.