Skip to Content

MSEG query taking too long on rare occassions (intermittent)

Hi Friends,

I'd like to ask your expert opinion on the below query. It's a basic query, the team already modified the code and in my opinion working fine. from 6 hrs run time we were able to make it 1 hr (considering the number of records). The problem happens inconsistently, most of the time it runs fine, but twice it ran for too long that basis needed to stop the program. when basis checked it pointed out in this query. (note this doesn't happen all the time rare occassions only) code below:

-----------------------------------------------------code

IF i_mcha[] IS NOT INITIAL.

SELECT matnr
werks
charg
bwart
vfdat
erfme
mblnr
meins
ebeln
ebelp
INTO TABLE i_mseg
FROM mseg
FOR ALL ENTRIES IN i_mcha
WHERE matnr = i_mcha-matnr
AND werks = i_mcha-werks
AND charg = i_mcha-charg
AND vfdat = i_mcha-vfdat.

-----------------------------------------------------code

Just want to know how would you go and handle this kind of incident. Can basis help on this? is it possible that there are other jobs running same time that might have affected the processing time?

Thank you.

Jeff

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Apr 16 at 06:22 AM

    You could probably improve performance by using an INNER JOIN between MSEG and MCHA. See here and here.

    There is a transaction that basis can use (DB04, possibly), which shows the actual SQL being issued to the database server. This should give a hint as the the issue.

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 16 at 08:22 AM
    -1

    Hi,

    Maybe try:

    1. check BSEG Table. Maybe create an Index for the Field Combo of the select.

    2. dont know ur coding but maybe delete adjecent duplicates from the itab comparing the fields of the select.

    LG

    Stefan Seeburger

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 17 at 01:01 PM

    thanks for the feedback. I dont think its the code, cause most of the time it runs fine, the long run happens on very rare occassions only. i'm not sure if basis could check if there's another activity running that could have affected this process. by the way, this is run as a batch job, the initial findings given by the basis team is the specific select from mseg which seem to have been stuck from that query before they stop the processing. again this happens on rare occassions. can you suggest some tools that I can run in parallel given the test data provided ? tool can check exactly why mseg query takes forever.

    Thanks

    Add comment
    10|10000 characters needed characters exceeded