MKPF and MSEG table

What is diff between MKPF and MSEG table ?

Dear Balaji,
In MKPF you will get to know the transaction code which was used for posting the material document.
In MSEG,you will get to know the the item details from which it was posted along with the quantity and amount in LC.
Regards
Mangalraj.S

Similar Messages

  • Optimization of Join statement between MKPF and MSEG table for improving pe

    Hi All,
    I had a issue where we are executing one custom report and it is getting timed out after 45 minutes. We further executed with trace on and got to the conclusion with the help of BASIS that about 42 minutes of the 45 minutes tracetime are spent by a join over the tables  MKPF en MSEG.
    This join is done by the abap statement:
      SELECT mkpf~mblnr
             mkpf~mjahr
             mkpf~bldat
             mkpf~blart
             mseg~matnr
             mseg~werks
        INTO CORRESPONDING FIELDS OF TABLE i_matdoc_we
        FROM mkpf INNER JOIN mseg ON mkpfmblnr = msegmblnr
                                 AND mkpfmjahr = msegmjahr
    FOR ALL entries IN i_list
       WHERE mkpf~mblnr BETWEEN lv_interval-fromnumber
                            AND lv_interval-tonumber
         AND mkpf~blart = 'WE'
         AND mkpf~bldat LE gv_last_day_fisc_period
         AND mseg~matnr = i_list-matnr
         AND mseg~werks IN s_werks.
    Here, I_LIST comprises of stock for specific period as entered in the selection screen for that particular Material and plant
    LV_INTERVAL is range of all goods receipts for material and gv_last_day_fisc_period is current date.
    During the tracetime this statement was executed  more than 20.000 times, until the transaction timed out.
    The individual executions of this select stmnt  varied (roughly) between 50 and 1200 miliseconds. (depends wheter the requested database block is in the buffercache or must be read from disk).
    The acesspath used to execute the query ( see below) is optimal, given the present indexes.
    Index MSEG~M is covering al the specified selection criteria for  MSEG.
    Index MKPF-0 is used  to search the specified MBLNR criterium in MKPF.
    The  remaining selection criteria MKPF-BLART and MKPF-BLDAT are not indexed, and imho this would also not make sense for this query.
    BLART has only 3 different values n the MKPF table, and the selected value 'WE' has more than 1 million occurences.
    BLDAT is selected with =<20110903, so this is not distinctive as well.
    Can any one suggest some better way to write this query.
    Regards,
    Subhajit

    Actually there are 2 select statements where JOIN have been introduced and especially the time out is occurring in the second JOIN.
    Find all goods receipts for material
      PERFORM get_number_range_matdoc USING '03'
                                   CHANGING lv_interval.
      SELECT mkpf~mblnr
             mkpf~mjahr
             mkpf~bldat
             mkpf~blart
             mseg~matnr
             mseg~werks
        INTO CORRESPONDING FIELDS OF TABLE i_matdoc_we
        FROM mkpf INNER JOIN mseg ON mkpfmblnr = msegmblnr
                                 AND mkpfmjahr = msegmjahr
    FOR ALL entries IN i_list
       WHERE mkpf~mblnr BETWEEN lv_interval-fromnumber
                            AND lv_interval-tonumber
         AND mkpf~blart = 'WE'
         AND mkpf~bldat LE gv_last_day_fisc_period
    AND mseg~matnr = i_list-matnr
        AND mseg~werks IN s_werks.
      CLEAR lv_interval.
      PERFORM get_number_range_matdoc USING '02'
                                   CHANGING lv_interval.
    Find all goods issues for material
      SELECT mkpf~mblnr
             mkpf~mjahr
             mkpf~bldat
             mkpf~blart
             mseg~matnr
             mseg~werks
        INTO CORRESPONDING FIELDS OF TABLE i_matdoc_wa
        FROM mkpf INNER JOIN mseg ON mkpfmblnr = msegmblnr
                                 AND mkpfmjahr = msegmjahr
    FOR ALL entries IN i_list
       WHERE mkpf~mblnr BETWEEN lv_interval-fromnumber
                            AND lv_interval-tonumber
         AND ( mkpfblart = 'WA' OR mkpfblart = 'WI' )
         AND mkpf~bldat LE gv_last_day_fisc_period
    AND mseg~matnr = i_list-matnr
         AND mseg~bwart NE '561'
         AND mseg~bwart NE '562'
         AND mseg~bwart NE '961'
    AND mseg~bwart NE '962'
    AND mseg~werks IN s_werks.
    Mainly the second JOIN is creating the problem... In the backend ORACLE is being used as database.
    Please suggest how I can improve the performance of these joins as its taking more than 45 mins..

  • Info about mkpf and mseg

    I need to modify a report that brings all the production of all our materias for a given period of time.
    The code joins both tables mkpf and mseg and ask for the date:
    mkpf-budat between s_budat-low and s_budat-high
    This query is taking A LOT of time and I need to optimize it. All of the fields needed are in the mseg, but the date is in mkpf. In mseg there is a field called production date (hdat) Is this field the same than the budat located in mkpf (I want to query only one table)?  If not, what do I have to do to optimize my query????
    TIA
    Query:
    select smblnr smjahr sbwart smatnr swerks smenge  
    appending  corresponding fields of table t_mseg  
    from  mseg as s inner join mkpf as k             
    on smblnr = kmblnr and                       
    smjahr = kmjahr                           
    where                                           
    ( sbwart eq lit_101 or sbwart eq lit_102 )
    and s~matnr in s_matnr                          
    and s~werks in s_werks_full                     
    and k~budat between s_budat-low and s_budat-high
    and s~bukrs = p_bukrs.

    Well MSEG has an index on MATNR and WERKS. Try changing the order of the where:
    select s~mblnr s~mjahr s~bwart s~matnr s~werks s~menge
    appending corresponding fields of table t_mseg
    from mseg as s inner join mkpf as k
    on s~mblnr = k~mblnr and
    s~mjahr = k~mjahr
    where s~matnr in s_matnr
    and s~werks in s_werks_full
    and ( s~bwart eq lit_101 or s~bwart eq lit_102 )
    and k~budat between s_budat-low and s_budat-high
    and s~bukrs = p_bukrs.
    Also - make sure s_matnr is not empty.
    Also make sure s_matnr is either 'I'ncluding either ranges or single values. Indexes don't work very well with 'E'xcluding, patterns or NE.
    Rob
    Message was edited by: Rob Burbank

  • Link b/w QALS and MSEG TABLE

    hi,
    i want to make a link up between QALS AND MSEG table as i want to those inspection lot which have the UD = REJECTED and stored in SC01 etc storage locations. Till now i am able to find that the Item which are rejected having material documents present in the MSEG table but not present in QALS.
    I had tried to make a link up with fields such as MATRN,CHARG,KDAUF, KDPOS etc.. but the right data is not displayed in it.
    Please provide me guidelines to solve this problem.

    this i Functional question asked at wrong place .
    but i will gice you the relation :
    MSEG: Document Segment: Material
    Fields:      MBLNR
         MJAHR                               
         ZEILE
    Relation :
    MATNR      EBELN     EBELP  MJAHR MBLNR                         
    QALS:  Inspection lot record
    Fields:      PRUEFLOS
    can use this table also
    QAVE:  Inspection processing
    Fields:      PRUEFLOS
                    KZART
         ZAEHLER
    rgds aryan
    Edited by: Aryan@sap on Jun 4, 2009 8:21 AM

  • MB51 : add field not included in MKPF or MSEG table

    Dear.
    I need to show a new field in MB51.
    This field isnu2019t included in MKPF or MSEG table.
    I cannot add it in Customizing , do you know an exit for doing this ?
    Thanks.

    Hi There,
    The reports MB51/MB5B read the data from the tables MKPF/MSEG, so if you wish to add a new field in MB51 you need to add the field into one of these tables. Unfortunately there is no such exit.
    For Inventory Management, SAP provides the following customer exits:
    MB_CF001 Updating of material document data upon posting
    MBCF0002 Filling the item text in the material document
    MBCFC003 Maintaining batch master data upon goods movements
    MBCFC004 Maintaining batch specifications upon goods movements
    MBCF0005 Filling the item data on goods receipt/ issue slips
    MBCF0006 Transferring the number of the WBS element for subcontracting
    MBCF0007 Posting a reservation
    MBCF0009 Filling the Storage location field
    IQSM0007 Serial numbers, user exit for goods movements
    XMBF0001 Stock determination: - changing the stock determination rule -
             Adjusting the stock determination item table
    Kind Regards,
    Elaine.

  • The pur.doc numbers are nt displaying in besg and mseg tables

    hi experts!
                   The bseg and mseg tables having the field(ebeln) of  purchasing doc.but is nt having any value.the field is empty in table.pl anyone can tel me wat is the reason,is it configuartion pbm or wat else.wat is the soln for this.
                  Thanks!.

    Hi,
    if FI doc is getting generated ie...while migo and miro, then entry must hit the table....if its not hitting.....then you need to debug it and find out the reason.
    reg
    Arun

  • Oracle Hint on Table MKPF and MSEG : force index MSEG~M to be utilize

    Hi Experts, I'm quite new to ABAP performance tuning, I try to put details as much as I can in my question below, just to have a quick overview of my problem below, I want to use/force in my SQL below to force the utilization of index MSEG~M.
    added an Oracle Hint forcing index MSEG~M
      SELECT MATNR BWART MENGE
      FROM   MKPF
      INNER JOIN MSEG
         ON MKPFMANDT EQ MSEGMANDT
        AND MKPFMBLNR EQ MSEGMBLNR
        AND MKPFMJAHR EQ MSEGMJAHR
       INTO CORRESPONDING FIELDS OF TABLE T_MSEG2
      WHERE MKPF~BUDAT IN S_GSTRP    "(index bud should be used)
       AND  MSEG~MJAHR IN R_DOCYEAR
       AND  BWART IN ('931', '932',
                      '901', '902',
                      '701', '702',
                      '703', '704',
                      '707', '708',
                      '711', '712',
                      '713', '714',
                      '715', '716',
                      '717', '718',
                      '551', '552',
                      '553', '554',
                      '555', '556') "ZZCHK: Constants Not Applicable
             AND  MATNR IN R_MATNR3
             AND  MATNR IN R_COMPNTS
             AND  WERKS EQ P_WERKS
      %_hints oracle u2018INDEX(u201CMKPFu201D u201CMSEG~Mu201D)u2019.
    Note: I'm assuming that you'll take not some comments on further enhancement:
    - " INTO CORRESPONDING FIELDS "
    - use of field symbols
    - I didn't modify it yet since my focus if for MSEG~M
    - cannot make material number as mandatory field
    Objective: Force to use index MSEG~M
    Problem:
    After adding the Oracle Hint, I did the analysis in ST05 and it seems like index M is still not being forcefully
    utilize instead MSEG~0 is being used.
    I replaced the Oracle Hint with:
      %_hints oracle u2018INDEX(u201CT_01u201D u201CMSEG~Mu201D)u2019.
    In ST05, I can get see that index MSEG~M is now being utilize BUT worst thing happened after applying this, the program timed out.
    I already take a look on the following Notes: 129385, 130480, 772497, 162034, 818321 but nothing seems to be helpful in my problem.
    Questions:
    1.  In syntax %_hints oracle u2018INDEX(u201CT_01u201D u201CMSEG~Mu201D)u2019. T_01 stands for MKPF right which is the first table, do you what's the reason for the program time out after adding this Oracle Hint?  Is this the proper syntax?
    2.  How can I force in my code to use index MSEG~M without any program timeout?
    For the whole source code of my question above, please see the link:
    http://rapidshare.com/files/211740852/ZDXX0028.txt.html

    Hi Thomas, thanks with the prompt reply (even if it's Saturday )
    Yes, MKPF~BUD is being used.
    The budat selection is narrowed to 28 days though users can input any date range, a warning message will just be displayed if budat selection exceeded.
    Yes, optimizer usually chooses the right index; I'm not in as the same experience as you are though, but I find it interesting that after I added the Oracle hints (several combination) the performance of the program was optimize up to 40% to 50%.
    I uploaded a detailed SQL trace and the ABAP change done in my program, if you'll notice in the summary of the changes, after adding some hints, the duration of the program was improved..
    (SQL Trace Summary of my program) this worth taking a look
    http://rapidshare.com/files/211870091/ZD28_SQL_Trace.zip.html
    I made a custom index in MSEG, but unfortunately I doubt that it will be approve by our performance capacity team.  But I somehow have a hunch that this will further optimize the program.
    MSEG~Z03
    MANDT     Client
    WERKS     Plant
    BWART     Movement Type (Inventory Management)
    LGORT     Storage Location
    What do you think Thomas and SAP experts?
    **Sorry for pasting the whole ST05 result
         SELECT STATEMENT          ( Estimated Costs = 131.250 , Estimated #Rows = 450 )
                        6          FILTER
                        Filter Predicates
                        5          NESTED LOOPS
                        ( Estim. Costs = 131.249 , Estim. #Rows = 450 )
              Estim. CPU-Costs = 1.885.249.948 Estim. IO-Costs = 129.700
                        2          TABLE ACCESS BY INDEX ROWID          MKPF
                        ( Estim. Costs = 14.442 , Estim. #Rows = 288.570 )
                   Estim. CPU-Costs = 206.401.140 Estim. IO-Costs = 14.272
                   1          INDEX RANGE SCAN          MKPF~BUD
                        ( Estim. Costs = 655 , Estim. #Rows = 519.426 )
              Search Columns: 2
              Estim. CPU-Costs = 30.640.783 Estim. IO-Costs = 630
              Access Predicates          Filter Predicates
                        4          TABLE ACCESS BY INDEX ROWID          MSEG
                        Estim. CPU-Costs = 5.818 Estim. IO-Costs = 0
              Filter Predicates
              3          INDEX RANGE SCAN          MSEG~0
                   Search Columns: 3     
         Estim. CPU-Costs = 1.564 Estim. IO-Costs = 0
         Access Predicates          Filter Predicates

  • Querry for MKPF and MSEG

    Hi,
    In mY report,
    I have BUDAT as select-options and
             WERKS as select-options.
    Based on MBLNR, MJAHR from MKPF into table it_mkpf where Budat in s_BUDAT.
    after that I am fetching MSEG data using for all entries in it_mkpf where werks in s_werks.
    for low date range it is working fine.
    For higher date range ,I am getting around 2 Lacs of records in MKPF , but while fetching MSEG ,Its getting dump with message endless Loop.
    How can increase my performance.
    Is there any Function Module to fetch data.
    Can anybody suggest me.
    Thanks
    kumar n

    Hi Kumar,
    I have the same situation,
    where I will have 1.5 lakhs minimum records from MKPF every month,,,
    now my total database is nearly 35 million records till date from 1998.
    and getting records from MKPF is not difficult its very easy even 35 million records,,,
    But after getting from MSEG by MKPF is Hell,,,,
    but I see Joins are far better , best in these cases,,,
    So after that i have written a Code snippet in "Code-gallery" in SAP -Wiki, with title Joins are Better in some cases
    Author: Dileep Kumar
    Submitted: 11.02.2009
    Description  : Join Statement is the best in some cases as shown below than For All Entries. So Dont Forget about Joins Simply. Keep trying with joins
    sometimes, where you can get a better performance.
    Dont forget about joins simply like that due to performances. Now in this case(A Business Requirement) Joins is the best than FOR ALL ENTRIES.
    TYPES: BEGIN OF TY_MKPF ,
            MBLNR TYPE MKPF-MBLNR,          "Material document
            MJAHR TYPE MKPF-MJAHR,
            BUDAT TYPE MKPF-BUDAT,          "Posting Date in the document
          END OF TY_MKPF.
    TYPES: BEGIN OF TY_MSEG1 ,
            MJAHR TYPE MKPF-MJAHR,
            BUDAT TYPE MKPF-BUDAT,          "Posting Date in the document
            MBLNR TYPE MSEG-MBLNR,          "Material document
            MATNR TYPE MSEG-MATNR,          "Material Number
            ZEILE TYPE MSEG-ZEILE,          "Item in material document
            BWART TYPE MSEG-BWART,          "Movement Type
            CHARG TYPE MSEG-CHARG,          "Batch Number
            EBELN TYPE MSEG-EBELN,          "PO #
            SHKZG TYPE MSEG-SHKZG,          "Debit/Credit Indicator
            MENGE TYPE MSEG-MENGE,          "Quantity
            MEINS TYPE MSEG-MEINS,          "UOM
            DMBTR TYPE MSEG-DMBTR,          "Amount in local currency
            WAERS TYPE MSEG-WAERS,          "Currency Key
          END OF TY_MSEG1.
    TYPES: BEGIN OF TY_MSEG ,
            MBLNR TYPE MSEG-MBLNR,          "Material document
            MATNR TYPE MSEG-MATNR,          "Material Number
            ZEILE TYPE MSEG-ZEILE,          "Item in material document
            BWART TYPE MSEG-BWART,          "Movement Type
            CHARG TYPE MSEG-CHARG,          "Batch Number
            EBELN TYPE MSEG-EBELN,          "PO #
            SHKZG TYPE MSEG-SHKZG,          "Debit/Credit Indicator
            MENGE TYPE MSEG-MENGE,          "Quantity
            MEINS TYPE MSEG-MEINS,          "UOM
            DMBTR TYPE MSEG-DMBTR,          "Amount in local currency
            WAERS TYPE MSEG-WAERS,          "Currency Key
          END OF TY_MSEG.
    DATA : IT_MSEG TYPE TABLE OF TY_MSEG, WA_MSEG LIKE LINE OF IT_MSEG.
    DATA : IT_MKPF TYPE TABLE OF TY_MKPF, WA_MKPF LIKE LINE OF IT_MKPF.
    DATA : IT_MSEG1 TYPE TABLE OF TY_MSEG1, WA_MSEG1 LIKE LINE OF IT_MSEG1.
    SELECT-OPTIONS :
       S_BUDAT FOR MKPF-BUDAT," OBLIGATORY,       " Posting Date.
       S_MATNR FOR MSEG-MATNR," OBLIGATORY.       " Material No.
       S_WERKS FOR MSEG-WERKS." OBLIGATORY,       " Plant
    Start-of-Selection.
    *<<<<<<<<<<<<<<<<<<<<
        SELECT MBLNR MJAHR BUDAT
          INTO TABLE IT_MKPF
          FROM MKPF
          WHERE BUDAT IN S_BUDAT.
      IF IT_MKPF IS NOT INITIAL.
        SELECT MBLNR MATNR ZEILE BWART CHARG EBELN SHKZG MENGE MEINS DMBTR WAERS
          FROM MSEG
          INTO TABLE IT_MSEG
          FOR ALL ENTRIES IN IT_MKPF
          WHERE MBLNR = IT_MKPF-MBLNR AND
                MJAHR = IT_MKPF-MJAHR AND
                MATNR IN S_MATNR AND
                WERKS IN S_WERKS .
      ENDIF.
    *compared to the above For all entries, below Join can perform well &
    *Good for 2nd & third runs are much faster as they store data in Buffer memory..
    *<<<<<<<<<<<<<<<<<
      SELECT  AMJAHR  ABUDAT BMBLNR BMATNR BZEILE BBWART B~CHARG
              BEBELN BSHKZG BMENGE BMEINS BDMBTR BWAERS
              INTO TABLE IT_MSEG1
              FROM MKPF AS A INNER JOIN MSEG AS B ON AMBLNR = BMBLNR AND
                                                     AMJAHR = BMJAHR
              WHERE A~BUDAT IN S_BUDAT AND
                    B~MATNR IN S_MATNR AND
                    B~WERKS IN S_WERKS .
    *<<<<<<<<<<<<<<<<<<
    Thanks & regards,
    Dileep .C

  • SQ01 Query Help for (MKPF and MSEG)

    Is their anyway to have the field MSEG-ERFMG show up on the query results as postive or negative color or use a "-" or "+".  Need to try and show whether is was a negative or postive movement.

    F1 help for MSEG-SHKZG
    Debit/credit indicator in revaluation
    This indicator is used for internal program control.
    Please do not change the entry in this field.
    Any changes made could lead to program errors or terminations.
    I guess the "sign" is defined trough this field ("S" - sollen (debit), "H" - haben (credit)). If my assumption is true, you won't be able to see + / - in MSEG-ERFMG simply because this field contains no information on the sign.
    Using ABAP code you can solve it (or in SQ01 you can use calculated field in your query...I'm not sure you can define that calculated field to cover your requirement...).
    Regards,
    Csaba
    Edited by: Csaba Szommer on May 12, 2009 11:20 PM

  • To link MKPF and BKPF Tables.

    Hi Experts,
    I basically need to retieve all the accounting documents posted for a particular material document. How is this possible ?
    Regards,
    Sunitha

    Step 1
    GET KEY FIELDS FROM MKPF namely
    MKPF-MBLNR
    MKPF-MJAHR
    Now CONCATENATE these fields into say STR1
    SELECT all records from BKPF where
    BKPF-AWKEY = STR1
    You get the corresponding FI record

  • Procees for upload field in mkpf&mseg table

    Hi friends,
    i had return the code for uploading two fields in mkpf and mseg table  .when i am executing through f8 the updated value is not founding when we checkd through debugging the value is updating and appering in screen plz tell me how i will solve the issue.
    for u r referenece i am sending the code what i had return in logic.
    types: BEGIN OF it_tab,
            prueflos(16) type c,
            MBLNR type mblnr,
            TYP type QAMBTYPE,
            END OF it_tab.
          types: begin of it_tab1.
           include type mkpf.
          types: END OF it_tab1.
          types:begin of it_mseg.
          include type mseg.
          types:end of it_mseg.
    *        end of it_tab1.
         types: ts_tab1 type STANDARD TABLE OF it_tab1.
         types: ts_mseg type STANDARD TABLE OF it_mseg.
         data: ts_tab type STANDARD TABLE OF it_tab,
               wa_tab type it_tab,
               wa_tab1 type it_tab1,
               ts_tab2 type ts_tab1,
               ts_mseg type ts_mseg,
               wa_mseg type it_mseg,
               it_tab12 type  it_tab1 OCCURS 0 WITH HEADER LINE.
           select PRUEFLOS mblnr typ from QAMB
             into table ts_tab  where prueflos = it_final-prueflos
                                  and    typ = '3'.
             if ts_tab[] is not INITIAL.
               sort ts_tab[] by mblnr.
              select * from mkpf into TABLE ts_tab2 FOR ALL ENTRIES IN ts_tab where mblnr =  ts_tab-mblnr.
                if ts_tab2[] is not INITIAL.
                  sort ts_tab2[] by mblnr.
                  select * from mseg into table ts_mseg FOR ALL ENTRIES IN ts_tab2 where mblnr = ts_tab2-mblnr.
                    endif.
                endif.
             loop at ts_tab into wa_tab .
               READ TABLE ts_tab2 into wa_tab1 with key mblnr = wa_tab-mblnr.
               wa_tab1-FRBNR = it_data1-FRBNR.
               if sy-subrc eq 0.
                wait UP TO 2 SECONDS.
              update mkpf from wa_tab1.
              COMMIT WORK .
               endif.
               read table ts_mseg into wa_mseg with key mblnr = wa_tab1-mblnr.
               wa_mseg-sgtxt = it_data1-trucknum.
               if sy-subrc eq 0.
                 wait UP TO 2 seconds.
              update mseg from wa_mseg.
              COMMIT WORK .
               endif.
               ENDLOOP.
    thanks in advance,
    siva
    Edited by: Thomas Zloch on May 13, 2011 1:37 PM - please use code tags

    it is added in bdc code  only.
    now i will explaing proccess of bdc . this is used for converting meterial type from 103 movement type to 105 move ment type so whaterver data they got through 103 movemet type (migo data) they are uploading through xl and uploading through our bdc
    after uploading they are used QA11 tcode .record is done for this after recording completed it is converting 103 to 105 move ment type  and it is displaying message like succesfully proceesed . inthis 105 movement type we are not getting bill of lading no and truck no so i am updating these two field in this table so i done like this so do u get any idea to update the fields in another way means plz help me
    siva.

  • Tables MARDH and MSEG - daily stock position

    Hi gurus of MM.
    I'm from BW and posted a thread about data from MM:
    Thread: 1876587
    As I understand, I can calculate the stock for a given date directly from tables MKPF (field BUDAT) and MSEG.
    MSEG has normal movement and also the initial stock value (posted as movement type: field BWART = 561), so this is possible.
    But I still didn't understand what's the logic to fill the different types of stock: fields LABST (unrestricted), UMLME (in transfer), INSME (quality inspection), EINME (restricted), SPEME (blocked) and RETME (returns).
    With MSEG I arrived to the total value.
    Which is coherent with the values that I found in MARD and MARDH  (the sum of these types of stock).
    What's the logic to distribute total value among these types of stock ???
    Thanks in advance.
    César Menezes

    Dear Amit
    I'm looking for technical information.
    But if you can also indicate some documents that explain the business rules I'd appreciate.
    The technical question is:
    Using tables MKPF and MSEG (basically fields BUDAT, MENGE and SHKZG) I can arrive to the values in tables MARD and MARDH.
    But until now I can arrive only to the totals of MARD and MARDH (the sum of fields LABST, UMLME, INSME, EINME, SPEME and RETME).
    The question is: what's the logic to arrive to each type of stock: LABST (unrestricted) and so on.
    I'm doing this because I need a daily stock position.
    MARD has a position at the moment, I can't use it to a report like: stock at day 10 plus movement of day 11 equal stock at day 11.
    MARDH has a montly, not a daily position.
    And I saw that I can arrive to daily stock position using only MKPF and MSEG.
    Thanks
    César Menezes

  • Performance issue with MSEG table in Production

    Hi,
    I have written a report with 4 select queries.
    First i am selecting data from VBRK table in i_vbrk. Then for all entries in i_vbrk, i am fetching records from VBRP into i_vbrp table. Then for all entries in i_vbrp, records are fetched from MKPF into i_mkpf. Then, finally for all entries in i_mkpf, records are fetched from MSEG into i_mseg table.
    Performance of this report is good in Quality system, but it is very poor in Production systems. It is taking more than 20 mins to get executed. MSEG table query is taking most of the time.
    I have done indexing and packet sizing on MSEG table, but still performace issue persists. So, cqan you please let me know if there is any way by which performace of the program can be improved???
    Please help.
    Thanks,
    Archana

    Hi Archana,
    I was having the same issue for MKPF and MSEG , I am using INNER JOIN Condition .
    SELECT
    mkpf~mblnr
    mkpf~mjahr
    mkpf~budat
    mkpf~usnam
    mkpf~bktxt
    mseg~zeile
    mseg~bwart
    mseg~prctr
    mseg~matnr
    mseg~werks
    mseg~lgort
    mseg~menge
    mseg~meins
    mseg~ebeln
    mseg~sgtxt
    mseg~shkzg
    mseg~dmbtr
    mseg~waers
    mseg~sobkz
    mkpf~xblnr
    mkpf~frbnr
    mseg~lifnr
    INTO TABLE xmseg
    FROM mkpf
    INNER JOIN mseg
    ON mkpfmandt EQ msegmandt AND
    mkpfmblnr EQ msegmblnr AND
      mkpfmjahr EQ msegmjahr
    WHERE mkpf~vgart IN se_vgart
    AND   mkpf~budat IN se_budat
    AND   mkpf~usnam IN se_usnam
    AND   mkpf~bktxt IN se_bktxt
    AND   mseg~bwart IN se_bwart
    AND   mseg~matnr IN se_matnr
    AND   mseg~werks IN se_werks
    AND   mseg~lgort IN se_lgort
    AND   mseg~sobkz IN se_sobkz
    AND   mseg~lifnr IN se_lifnr
    %_HINTS ORACLE '&SUBSTITUTE VALUES&'.
    But still I have a issue in performance , Can anybody  give some suggestions , please .
    Regards,
    Shiv

  • Mver, mseg table

    WHZ THE relationship between mver and mseg tables?
    i want to link up mara and mkpf tables.

    Check the link
    material consumption history MVER
    Regarding MSEG ??
    Material Consumption at Storage Location level
    Thanks
    Seshu

  • Performance tuning fro a select stmnt consisting of View and DB Table

    Hi Gurus ,
    I have a select query which is consuming a lot of time for execution. Well it selects details from a custom view ZV_MKPF_MSEG (join of MKPF and MSEG) and table MARA as following
    SELECT GI~BUKRS                                   "company code
             GI~WERKS                                    "Plant
             GI~BWART                                    "Movement Type
             GI~BUDAT                                    "Posting Date
             GI~MBLNR                                    "Mat Doc Number
             GI~ZEILE                                    "Item
             GI~KOSTL                                    "cost center
             GI~MENGE                                    "Quantity
             GI~SHKZG                                    "Debit credit ind
             MAMATKL MAMATNR MA~MEINS
             INTO CORRESPONDING FIELDS OF TABLE PT_GITAB
             FROM ZV_MKPF_MSEG AS GI INNER JOIN MARA AS MA
                  ON MAMATNR = GIMATNR
             WHERE GI~BUKRS IN S_BUKRS AND
                   GI~WERKS IN S_WERKS AND
                   GI~BUDAT IN S_BUDAT AND
                   GI~BWART IN S_BWART AND
                   GI~MBLNR IN S_MBLNR AND
                   MA~MATKL IN S_MATKL                
             ORDER BY GIMBLNR GIZEILE.
    how we should manipulate this query in order to increase the perfromance ? And could anybody give some idea about the use of indexes for a table since both MSEG and MKPF tables have indexes attached.
    Thanx
    Kylie
    Edited by: kylietisha on Jun 7, 2010 5:01 PM

    Moderator message - Please see Please Read before Posting in the Performance and Tuning Forum before posting - post locked
    Rob

Maybe you are looking for

  • Swapping attachment to content on Receiver Mail Adapter

    Hi Experts, Can I move my attachment data to content on receiver mail adapter ? I am not using Mail package or mapping. I tried using Payloadswapbean on receiver adapter but adapter generated email with attachment only with and without Payload swap b

  • How to trigger a mail .

    Hi experts how i can trigger mail based submit button . Is there is any fm for genrating mail.

  • Can i get OS Lion if i'm using OS X 10.4?

    Can i get OS Lion if i'm using OS X 10.4? I have an iMac with 10.4

  • How to display two different hierarchical sequential lists in one o/p scree

    Hi Gurus, I have a requirement for displaying two hierarchical lists in one output screen. I have created my hierarchical sequential lists using function module : - 'REUSE_ALV_HIERSEQ_LIST_DISPLAY', but i dont know how to append my second hierarchica

  • Restriction of Workflow.

    Hi,     I am standar workflow for PO release with little bit customization. Its working fine. Now I need to restrict, the work flow for only some document types. Ex: EKKO-BSART = 'NB' then workflow should be triggered for only type NB. Please help me