Skip to Content
author's profile photo Former Member
Former Member

Retrive data from mseg

Hi all,

I used the following code to retrieve the latest doc for each material from mseg.

select matnr max( mblnr ) from mseg into table phy_inv where matnr in s_matnr and xauto = ' ' and werks in s_werks group by matnr.

The performance is too slow. can anyone suggest me to improve my performance.

Thanks,

Rajesh.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Sep 27, 2006 at 02:07 AM

    Hi Rajesh,

    <b>types : begin of t_inv,

    mblnr type mseg-mblnr,

    matnr type mseg-matnr,

    end of t_inv.

    data : phy_inv type standard table of t_inv.

    select max( mblnr )

    matnr

    from mseg

    into table phy_inv

    where xauto = ' '

    and matnr in s_matnr and

    werks in s_werks

    group by matnr.</b>

    The order of fields in the selection and in the where clause should be same as of the order in the table.

    Best regards,

    Prashant

    PS : Please reward all helpful answers

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 27, 2006 at 02:41 AM

    Hi,

    I get the performance problem when i give a range of materials in my selection.

    for example:

    select-options:

    materials : a to k.

    ____________________________________________

    if i leave it blank the performance is good.

    Please send you suggestions,

    Rajesh.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Rajesh,

      Generally data in MSEG is very huge, when you perform group by functionality it will take lot of time, so retrieve the data into internal table sort by material and material doument number(Descending) and delete the adjacent duplicates from internal table.

      Regards,

      Arun.

  • Posted on Sep 27, 2006 at 02:45 AM

    I think it will be quicker if you get all the data and find the 'max' yourself.

    select matnr mblnr from mseg into table phy_inv where matnr in s_matnr and xauto = ' ' and werks in s_werks

    .

    sort phy_inv by matnr mblnr descending.

    delete adjacent duplicates from phy_inv comparing matnr.

    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.