MB5B problem

i have a problem with stock on posting date. when i run a program to get information for the last month 2 times, it shows me different opening quantity.
what the problem with this report when i run on day time.

Dear Hello,
You can check the detail transaction using MB51 for that material and plant, enter the posting date more then the 2 month that you mention, who knows there're transaction for that material that post  more  than 2 months before it.

Similar Messages

  • MB5B Report Qty Problem

    Hi All,
            I have some material Qty Problem while selecting different view in MB5B report.
    While in Storage Location view opening & closing stock is same as in valuated Stock,but Issue & recived Qty is doubled in Storage loaction view.i don't have PP & Qm Module.so we are doing PP Entry Thru 521 MVT.
    What is the possiable reaso for this.
    Regards
    Pavan

    Hi,
    MB5B is a standard report in which you will get the stock on particular date.You cna see the stock of previous or previous week.
    If you trying to execute the report with todays date as posting date,then system will consider all teh material movements happened today,so thats y system is showing 2 different stocks at different timings.
    to check what and all material movements happened today  for that material ,go to SE16 ,input table MSEG and check the material documents.take date and timings on which material document is created. then compare this with MB5B report
    Hope it helps

  • MB5B Report Problem

    Dear all,
    I have different kind of problem in standerd report MB5B.
    In same period report is showing me different values if  run at different timimgs.
    Required your valuable input.
    Thanks and regards
    Gitesh

    Hi,
    MB5B is a standard report in which you will get the stock on particular date.You cna see the stock of previous or previous week.
    If you trying to execute the report with todays date as posting date,then system will consider all teh material movements happened today,so thats y system is showing 2 different stocks at different timings.
    to check what and all material movements happened today  for that material ,go to SE16 ,input table MSEG and check the material documents.take date and timings on which material document is created. then compare this with MB5B report
    Hope it helps

  • URGENT------MB5B : PERFORMANCE PROBLEM

    Hi,
    We are getting the time out error while running the transaction MB5B. We have posted the same to SAP global support for further analysis, and SAP revrted with note 1005901 to review.
    The note consists of creating the Z table and some Z programs to execute the MB5B without time out error, and SAP has not provided what type logic has to be written and how we can be addressed this.
    Could any one suggest us how can we proceed further.
    Note as been attached for reference.
              Note 1005901 - MB5B: Performance problems
    Note Language: English Version: 3 Validity: Valid from 05.12.2006
    Summary
    Symptom
    o The user starts transaction MB5B, or the respective report
    RM07MLBD, for a very large number of materials or for all materials
    in a plant.
    o The transaction terminates with the ABAP runtime error
    DBIF_RSQL_INVALID_RSQL.
    o The transaction runtime is very long and it terminates with the
    ABAP runtime error TIME_OUT.
    o During the runtime of transaction MB5B, goods movements are posted
    in parallel:
    - The results of transaction MB5B are incorrect.
    - Each run of transaction MB5B returns different results for the
    same combination of "material + plant".
    More Terms
    MB5B, RM07MLBD, runtime, performance, short dump
    Cause and Prerequisites
    The DBIF_RSQL_INVALID_RSQL runtime error may occur if you enter too many
    individual material numbers in the selection screen for the database
    selection.
    The runtime is long because of the way report RM07MLBD works. It reads the
    stocks and values from the material masters first, then the MM documents
    and, in "Valuated Stock" mode, it then reads the respective FI documents.
    If there are many MM and FI documents in the system, the runtimes can be
    very long.
    If goods movements are posted during the runtime of transaction MB5B for
    materials that should also be processed by transaction MB5B, transaction
    MB5B may return incorrect results.
    Example: Transaction MB5B should process 100 materials with 10,000 MM
    documents each. The system takes approximately 1 second to read the
    material master data and it takes approximately 1 hour to read the MM and
    FI documents. A goods movement for a material to be processed is posted
    approximately 10 minutes after you start transaction MB5B. The stock for
    this material before this posting has already been determined. The new MM
    document is also read, however. The stock read before the posting is used
    as the basis for calculating the stocks for the start and end date.
    If you execute transaction MB5B during a time when no goods movements are
    posted, these incorrect results do not occur.
    Solution
    The SAP standard release does not include a solution that allows you to
    process mass data using transaction MB5B. The requirements for transaction
    MB5B are very customer-specific. To allow for these customer-specific
    requirements, we provide the following proposed implementation:
    Implementation proposal:
    o You should call transaction MB5B for only one "material + plant"
    combination at a time.
    o The list outputs for each of these runs are collected and at the
    end of the processing they are prepared for a large list output.
    You need three reports and one database table for this function. You can
    store the lists in the INDX cluster table.
    o Define work database table ZZ_MB5B with the following fields:
    - Material number
    - Plant
    - Valuation area
    - Key field for INDX cluster table
    o The size category of the table should be based on the number of
    entries in material valuation table MBEW.
    Report ZZ_MB5B_PREPARE
    In the first step, this report deletes all existing entries from the
    ZZ_MB5B work table and the INDX cluster table from the last mass data
    processing run of transaction MB5B.
    o The ZZ_MB5B work table is filled in accordance with the selected
    mode of transaction MB5B:
    - Stock type mode = Valuated stock
    - Include one entry in work table ZZ_MB5B for every "material +
    valuation area" combination from table MBEW.
    o Other modes:
    - Include one entry in work table ZZ_MB5B for every "material +
    plant" combination from table MARC
    Furthermore, the new entries in work table ZZ_MB5B are assigned a unique
    22-character string that later serves as a key term for cluster table INDX.
    Report ZZ_MB5B_MONITOR
    This report reads the entries sequentially in work table ZZ_MB5B. Depending
    on the mode of transaction MB5B, a lock is executed as follows:
    o Stock type mode = Valuated stock
    For every "material + valuation area" combination, the system
    determines all "material + plant" combinations. All determined
    "material + plant" combinations are locked.
    o Other modes:
    - Every "material + plant" combination is locked.
    - The entries from the ZZ_MB5B work table can be processed as
    follows only if they have been locked successfully.
    - Start report RM07MLBD for the current "Material + plant"
    combination, or "material + valuation area" combination,
    depending on the required mode.
    - The list created is stored with the generated key term in the
    INDX cluster table.
    - The current entry is deleted from the ZZ_MB5B work table.
    - Database updates are executed with COMMIT WORK AND WAIT.
    - The lock is released.
    - The system reads the next entry in the ZZ_MB5B work table.
    Application
    - The lock ensures that no goods movements can be posted during
    the runtime of the RM07MLBD report for the "material + Plant"
    combination to be processed.
    - You can start several instances of this report at the same
    time. This method ensures that all "material + plant"
    combinations can be processed at the same time.
    - The system takes just a few seconds to process a "material +
    Plant" combination so there is just minimum disruption to
    production operation.
    - This report is started until there are no more entries in the
    ZZ_MB5B work table.
    - If the report terminates or is interrupted, it can be started
    again at any time.
    Report ZZ_MB5B_PRINT
    You can use this report when all combinations of "material + plant", or
    "material + valuation area" from the ZZ_MB5B work table have been
    processed. The report reads the saved lists from the INDX cluster table and
    adds these individual lists to a complete list output.
    Estimated implementation effort
    An experienced ABAP programmer requires an estimated three to five days to
    create the ZZ_MB5B work table and these three reports. You can find a
    similar program as an example in Note 32236: MBMSSQUA.
    If you need support during the implementation, contact your SAP consultant.
    Header Data
    Release Status: Released for Customer
    Released on: 05.12.2006 16:14:11
    Priority: Recommendations/additional info
    Category: Consulting
    Main Component MM-IM-GF-REP IM Reporting (no LIS)
    The note is not release-dependent.     
    Thanks in advance.
    Edited by: Neliea on Jan 9, 2008 10:38 AM
    Edited by: Neliea on Jan 9, 2008 10:39 AM

    before you try any of this try working with database-hints as described in note 921165, 902157, 918992

  • Stock on MB5B

    Hi,
    I´m having a problem with material stock. I get two different values on MB5B and MBEWH table for the same material, plant and date.
    Material: TP05891070
    Company code: 531
    Plant: 7101
    Selection Date: 01.01.2008 to 31.01.2008
    On MB5B, I get:
    Stock/Value on  01.01.2008   14,203.100KG    374,010.90 PEN
    Total/Val. of Receipts             5,541.900KG     94,518.53 PEN
    Total/Value of Issues             19,745.000KG    468,549.25 PEN
    Stock/Value on  31.01.2008    0.000KG            19.82- PEN
    On MBEWH table, I get:
    TP05891070      2007        12       14,203.100 KG         374,010.90PEN
    TP05891070      2008        01        0.000KG            0.00PEN
    Why is there a difference on Final Stock for 01.2008?
    From which table or report does MB5B get -19.82?
    I was looking all tables MB5B use, but I haven´t found that value.
    I hope u can help me. Thanks!
    Jocelyne
    Edited by: Jocelyne Garibaldi on Sep 18, 2008 11:01 PM

    MB5B calculates backwards from today all the material documents and arrives at the stock quantities. The stock values are the values associated with each material document, either debit or credit. Apart from the material documents the price change documents (which get generated when MR21 is done) also will be taken into account for arriving at stock value.
    I think probably price change (MR21) might have been done on back date after 31.01.08.
    Regards,
    GSL.

  • MB5B - Stock on Posting Date, Specification for data base accec

    Hi,
      I am facing some problem with MB5B Transaction as when we login with t. code MB5B  at the bottom of screen there is radio button selection for specification of database access for best runtime and the default the first radio button is selected i.e Database determines optimum access    but with this report is coming very very slow we have to wait for 4 minuts for each material  and same if we execute by selectting the second radio button i.e start off with material number  i am getting data very fast  with in 5 second  so i want to know what is diffference between these radio buttons if we select first second or third radio buttons
      one more thing we are facing problem from last 4 days only .
    regards,
      zafar

    I dont have these 3 buttons in my MB5B in ECC6 system.
    But I saw OSS Note 1005901 - MB5B: Performance problems
    it explains why it is that slow.

  • Problem with Stock Value Report

    Hi Experts,
    We use MB5B report to see the opening and closing value of stock for the given period.
    Here i am facing one problem that even i am running the report for the same period ( already closed periods) ans same inputs the system gives me some different valus every time i am running .
    I observed that difference between the opening and closing values for every output is constant.
    What could be the reason that system gives such different values when i run MB5B . No backposting is done.
    Regards, B

    Thanks for replying,
    i have mentioned the
    company code, Plants ,
    Selection date,
    in stock type valuated stock,
    in settings selection
    Totals only - Non Hierarchy Display Layout
    Only Matls Handled in Batches ( But Batches w/o stock segment is not checked)
    It is giving me changed values after every 10-15 minutes.
    Regards,
    BB

  • Historical stock on table MARDH is different than calculation from MB5B.

    Hi expert,
    I've checked stock on posting date (MB5B) is correct, comparing with MMBE as well as the physical inventory stock.
    Now I'm checking my historical stock (table MARDH) on period 06.2010, for specific material, plant and storage location is not the same result with MB5B in the same selection. Using my own calculation, MB5B is the correct one.
    No problem found at period 04, 05 or 07.
    What is the possible reason of this difference in table MARDH?
    Kindly advise.
    regards,
    rob

    Does it means if any movement in the next period then it copies from MARD into MARDH for previous period entry?
    yes
    Kindly advise how the calculation the qty copied into MARDH.
    Please read OSS note 193554
    It explains how the history tables are updated and it may help to retrieve your value.

  • Closing value negetive at mb5b

    hi
    While checking day wise opening/reciept/issue/closing of diferent material at [MB5B], We found closing qty is negetive.
    I have checked negetive stock indicator at material level and it's not set. For beter understanding kindly see the mb51 report for the perticular material.
    PAFP1208040 2001 JF05 311 4900341567 26.08.2008 110
    PAFP1208040 2001 JF05 601 4900341568 25.08.2008 110-
    In this case pgi has been done on 26th but posting date was 25th. My question is material was available on 26th but how could system allowed pgi on 25th. Is there any configuration problem?
    kaushik

    Dear Kaushik
    In normal circumstances, if stock is not available on a particular day, you will not be able to do PGI for the same date, if you have made the settings as "Negative stocks not allowed".
    However, if you want to restrict users changing the "Actual GI Date"  (due to this change only, the inventory value will get changed),  apply the BADI definition name is LE_SHP_DELIVERY_PROC method name is CHANGE_DELIVERY_HEADER.  Here you can write a code in such a way that the above said field cannot be predated with the help of ABAPer
    thanks
    G. Lakshmipathi

  • MB5B views material stock

    Dear Expert,
    When I display MB5B for material xxxx with criteria :
    - it's a special stock
    - has batch number
    - special stock indicator : orders on hand
    - posting date : blank
    MB5B shows the date of 01.01.0000 with the stock 3000 kg.
    it is impossible because in our plant initial balance is done on 2005-2006
    Why it can happen?
    anyone experience this problem?
    thanks
    pauline

    Dear Experts,
    Thanks all for the reply.
    I have followed the OSS notes 194788
    Only enter the selection criteria which are required for the selection of the stock management unit for which the opening stock balance and closing stock should be determined.
    In MB5B I key in selection criteria which are :
    material number : xxxxxx
    company code : 1000
    plant : 1500
    batch : xxxxxx
    special stock indicator : orders on hand
    selection date : 01.08.2009 to current date
    stock type :special stock
    and the result comes out :
    there is initial balance of 3000 kg on 01.08.2009 - INCORRECT ( our team never enter this initial balance but still came out )
    therefore the stock of current date also WRONG
    if the total stock is adjusted using stock take , the accounting journal will be created, and reduce the financial asset with the same amount of 3000 kg (WRONG EFFECT)
    how to solve this issue without affecting the accounting journal ?
    Thanks
    Pauline

  • Problem in Stock Report

    Dear Sir,
    I am facing problem in MB5B, two months before i use this TCode and report are like this
    Opening Stock              27,179.437  MT                59,705,114.71  INR
    total value of Receipts 65,473.815  MT               132,382,668.98  INR
    total value of Issues    53,774.361- MT               108,659,912.15- INR
    Closing stock               38,878.891  MT                83,427,871.54  INR
    and now again today i am checking the report are changed, the report are like this
    Opening Stock              27,179.437  MT                60,007,580.64  INR
    total value of Receipts 65,473.815  MT               132,382,668.98  INR
    total value of Issues    53,774.361- MT               108,659,912.15- INR
    Closing stock               38,878.891  MT                83,730,337.47  INR
    Why the value changed, i am not able to getting it where does the problem. I am new to MM field. Anybody any idea about this. I want to sort out this issues as soon as possible.
    Please help.

    some problems can only be solved with OSS notes. if you someone who has to solve SAP issues, then you need access to OSS yourself, or you need one in your organisation who can lookup and implement SAP notes for you.
    Ask your basis team, they can grant you access to SAP Marketplace to search for OSS notes.
    In general you should differentiate with data that is audit relevant and non-audit relevant data like statistical data.
    MC.9 is statistical data, certainly not that important like audit relevant data in MB5B.
    if you see a difference, then just assume that the audit relevant data is okay, and the statistic may be wrong.
    Do not assume that the statistic has the right information and you need to adjust the audit relevant data, as this is certainly a wrong approach.
    when you post a movement then you create audit relevant and statistic relevant data. this does not happen in the same LUW, it is decoupled. if something is wrong and the audit relevant data cannot be posted to the database, then the whole data is rolled back and nothing is posted to any table.
    but if something is wrong with the statistic data, then the statistic data posting fails, but the audit relevant part is not rolled back, hence you get this kind of inconsistencies.
    (this is just one example how such inconsistencies can arise, there are more reasons which you can learn by reading OSS notes)

  • MB5B REPORT QUERY

    Dear All,
    I am facing the problem as said in the thread.
    My two queries are as follows:
    Query 1: In MB5B report When we select the valuated stock option ,We are unable to use movement type , storage location in the selection criteria nad getting the below messages.
    M7284 - Storage location is reset.
    M7298 - Movement type is reset .
    Query 2 :In MB5B report total receipts and total issues is showing incorrect values.
    Here say for example I prepared the grn, cancelled the grn and again made the grn. Here total receipts is considering in such a way that all the grn quantities are considered. and cancelled documents are considered as issues.
    ie have received material = 100 Nos 01-12-2009
    cancelled grn:100 Nos
    Redo grn:100 Nos
    Done transfer posting 415 Q = 10 nOS = 02-12-2009
    Issued = 10 nos = 02-12-2009
    In mB5B 01-12-2009 to 02-12-2009
    We are getting Opening stock= 0 which is correct
    Total receipts = 100(GRN IST TIME)+100(GR SECOND TIME) +10(TRANSFER POSTING)=210
    Total issues = 100(CANCEL GRN)10(TRANSFER POSTING)10(GOODS ISSUE) =120
    Closing stock = 90(CORRECT)
    Here actual recipt: should be 100
    actual issue should be 10
    Here though the closing stock is correct , Cancelled GRN'S  & 415 transfer posting are  considered as issue and receipt.Becoz of this total issues quantity & total receipts report is going wrong.
    Please give your valuable suggestions to the above two problems seperately.
    Regards,

    Hi,
    Solution for Querry: 2
    I also faced the same problem.
    We need to give the selection dates (from  - to dates) and system shows the opening and closing stocks (and values) on those dates.
    But problem still persist with Receipt and Issue stock (and values).
    For Receipt and Issue Qty (and values) you will nedd to develope the Z report, in which you can make logical correction.
    for example: In Receipt Qty you can add all 101 movt types and on the same time subtract 102 movt type (which is not there in standard report).
    Regards,

  • MB5B & MRN9 Report showing different values

    Hi All,
    I am facing a problem when i am running MB5B & MRN9 report on back date, In both the reports stock is displaying correct but there is some difference in value. Material is managed by moving average price. Please provide your valuable inputs.
    Thanks
    Rashid

    hello !
    The transaction MRN9 is not designed to display the stock quantities and values for each date in a month. The transaction MRN9 only displays the quantity and value to the 'period end' which refers to entered field 'key date' or displays the actual quantity and value if the 'key date' refers to actual period. These data are selected from database tables MBEW (actual) or MBEWH (historical periods).
    If you will get the quantities and values for a special date (not a period end) you should use transaction MB5B which is additional selecting the documents posted until 'selection date' with option 'valuated stock'= 'X'.
    The transaction MRN9 provides a comparision of stock values for a selected period end with the values according to 'new calculated price' from functions 'determine lowest value' or 'FIFO-price' and is calculating the 'devaluation value'. This devaluation is normaly done only for a period end date(especially at end of fiscal year).
    If your are using the function of 'determine lowest value' (transactions MRN0, MRN1, MRN2, or function 'FIFO-valuation' (transaction MRF1) you can store the calculated 'lowest price' of 'FIFO-price' in one of available fields(tax price1-3, commercial price1-3) in material master. (please see also SAP documentation).
    You can also see the notes for this as well.
    590699     MRN9 Connection to key date and stock data
    486442     Lowest value: Significance of key date
    I hope these informations will help to understand the functions of transaction MRN9.
    Good luck!
    Plauto

  • MB5B transaction report modification

    Dear SAP gurus,
    Can anybody help me to add material group and material type in MB5B transaction report .
    thanks and regards
    Amit

    Have you set the time in the Setup screen of the printer?
    Please mark my post as SOLVED if it has resolved your problem. It helps others with similar situations.

  • Facing problem in copy of standard SAP  program

    hi,,,,,,,,,,,,
           when i execute this program in production server it displays an error ....i  m    trying to find out this error but this type(error) i cudnt find plz help me .....
           i m sending the documents which i rcvd from the system after the  execution of this program.
    this program executes perfctlly in developmnt server but it creates problem in production server,,,i searched out the type kkblo_t_sortinfo in the whole program but i cud nt find it ,,,,,,,,,
    documents.....
    Runtime Errors SYNTAX_ERROR
    Date and Time 18.11.2006 12:01:19
    ShrtText
    Syntax error in program "ZVISA_RM07MLBD ".
    What happened?
    Error in ABAP application program.
    The current ABAP program "????????????????????????????????????????" had to be
    terminated because one of the
    statements could not be executed.
    This is probably due to an error in the ABAP program.
    In program "ZVISA_RM07MLBD ", the following syntax error occurred
    in the Include "RM07MLBD_FORM_01 " in line 1805:
    The type KKBLO_T_SORTINFO" is unknown."
    also i m sending the include program ver i m facing problem...*&----
    *&  Include           RM07MLBD_FORM_01                                 *
    correction Aug. 2005 MM                                   "n856424
    - the fields "entry time", "entry date", and "User" are   "n856424
      are not filled filled for price change documents        "n856424
    MB5B improved regarding accessibilty                      "n773673
    Improvements :                       March 2003 MM        "n599218
    - print the page numbers                                  "n599218
    - send warning M7 393 when user deletes the initial       "n599218
      display variant                                         "n599218
    - show the current activity and the progress              "n599218
    contains FORM routines without preprocessor commands and  "n547170
    no text elements                                          "n547170
    *&      Form  INITIALISIERUNG
          Vorbelegung der Anzeigevariante                                *
    form initialisierung.
      repid = sy-repid.
      variant_save = 'A'.
      clear variante.
      variante-report = repid.
    Default-Variante holen:
      def_variante = variante.
      call function 'REUSE_ALV_VARIANT_DEFAULT_GET'
           exporting
                i_save     = variant_save
           changing
                cs_variant = def_variante
           exceptions
                not_found  = 2.
      if sy-subrc = 0.
      save the initial, e.g. default variant                  "n599218
        move  def_variante-variant  to  alv_default_variant.    "n599218
        p_vari = def_variante-variant.
      endif.
    print-no_print_listinfos = 'X'.
    endform.                               " INITIALISIERUNG
    *&      Form  AKTUELLE_BESTAENDE
         Ermittlung der aktuellen eigenen Bestände,
         d.h. der bewerteten Bestände und des Retourensperrbestandes,
         auf Lagerortebene und auf Material- bzw. Chargenebene;
         folgende Sonderbestände können gesondert ausgewiesen werden:
          Lohnbearbeitung         ( Sonderbestandskennzeichen  O )
          Kundenkonsignation      (             "              V, W, M )
          Lieferantenkonsignation (             "              K )
          Projektbestand          (             "              Q )
          Kundenauftragsbestand   (             "              E )
    form aktuelle_bestaende.
    delete the range tables for the creation of table g_t_organ
      if  g_t_organ[] is initial.                               "n433765
        refresh : g_0000_ra_werks, g_0000_ra_bwkey, g_0000_ra_bukrs.
        clear   : g_0000_ra_werks, g_0000_ra_bwkey, g_0000_ra_bukrs.
      endif.
      if      bwbst = 'X'.
      select the valuated stocks
        perform                  aktuelle_bst_bwbst.
      elseif lgbst = 'X'.
      all own stock from storage locations or batches
        if xchar = ' '.
          perform                aktuelle_bst_lgbst_mard.
        elseif  xchar = 'X'.
          perform                aktuelle_bst_lgbst_xchar.
        endif.
      elseif   sbbst = 'X'.
       special stocks
        case    sobkz.
          when  'O'.
            perform              aktuelle_bst_sbbst_o.
          when  'V' or  'W'.
            perform              aktuelle_bst_sbbst_v_w.
          when  'K' or  'M'.
            perform              aktuelle_bst_sbbst_k_m.
          when  'Q'.
            perform              aktuelle_bst_sbbst_q.
          when  'E'.
            perform              aktuelle_bst_sbbst_e.
          when  others.
          Angegebener Sonderbestand nicht vorhanden.
            message s290.
            perform              anforderungsbild.
        endcase.
      endif.
    create table g_t_organ with the plants and valuation areas from
    the database selection if table g_t_organ is empty
      perform  f0000_create_table_g_t_organ
                                 using  c_no_error.
    endform.                     "aktuelle_bestaende.
    *&   AKTUELLE_BST_LGBST_MARD
    form aktuelle_bst_lgbst_mard.
    eigener Bestand auf Lagerortebene -
    ... auf Materialebene -
      select * from mard into corresponding fields of table imard
                                             where werks in g_ra_werks
                                             and   lgort in g_ra_lgort
                                             and   matnr in matnr.
      if sy-subrc ne 0.          "no records found ?
        message s289.
      Kein Material in Selektion vorhanden.
        perform                  anforderungsbild.
      endif.
    does the user has the the authority for the found entries ?
      loop at imard.
        perform    f9000_auth_plant_check
                                 using  imard-werks.
        if  g_flag_authority is initial.
          delete             imard.
        else.
          perform  f9200_collect_plant     using  imard-werks.
          perform  f9400_material_key      using  imard-matnr.
        endif.
      endloop.
      describe table imard       lines g_f_cnt_lines.
      if  g_f_cnt_lines is initial.       "no records left  ?
        message s289.
      Kein Material in Selektion vorhanden.
        perform                  anforderungsbild.
      endif.
      if not charg-low is initial or not charg-high is initial.
        clear charg.
        message w285.
      Charge wird zurückgesetzt.
      endif.
    endform.                     "aktuelle_bst_lgbst_mard
       AKTUELLE_BST_LGBST_XCHAR
    form aktuelle_bst_lgbst_xchar.
    read the stock table mchb for batches
      select * from mchb into corresponding fields of table imchb
                                 where   werks  in  g_ra_werks
                                   and   lgort  in  g_ra_lgort
                                   and   matnr  in  matnr
                                   and   charg  in  charg.
      describe table imchb       lines  g_f_cnt_lines.
      if g_f_cnt_lines is initial.         "no records found ?
        message s821 with matnr werks lgort.
      Keine Chargen zu Material & in Werk & Lagerort & vorhanden.
        perform anforderungsbild.
      endif.
    process working table with the batches
      loop at imchb.
      does the user has the the authority for the found entries ?
        perform    f9000_auth_plant_check
                                 using  imchb-werks.
        if  g_flag_authority is initial.
          delete             imchb.
        else.
          perform  f9200_collect_plant     using  imchb-werks.
          perform  f9400_material_key      using  imchb-matnr.
        endif.
      endloop.
    endform.                     "aktuelle_bst_lgbst_xchar
       AKTUELLE_BST_SBBST_O
    form aktuelle_bst_sbbst_o.
    process Special Stocks with Vendor
    Bemerkung: Im Gegensatz zu den anderen Sonderbeständen existieren
               der Lohnbearbeitungs- und Kundenkonsignationsbestand
               nur auf Werksebene.
      select * from mslb into corresponding fields of table xmslb
                                 where  werks  in  g_ra_werks
                                   and  matnr  in  matnr
                                   and  charg  in  charg
                                   and  sobkz  =   'O'.
      if sy-subrc <> 0.                     "no records found ?
         message s289.
       Kein Material in Selektion vorhanden.
         perform anforderungsbild.
      endif.
    process the found records special stock vendor
      loop at xmslb.
      check the authority
        perform  f9000_auth_plant_check
                                 using      xmslb-werks.
        if  g_flag_authority is initial.
          delete                 xmslb.
        else.
        fill range table g_0000_ra_werks if it is still empty
          perform  f9200_collect_plant     using  xmslb-werks.
          perform  f9400_material_key      using  xmslb-matnr.
        endif.
      endloop.
    error, if no records are left
      describe table xmslb       lines g_f_cnt_lines.
      if  g_f_cnt_lines is initial.
        message s289.
      Kein Material in Selektion vorhanden.
        perform anforderungsbild.
      endif.
          sort xmslb.
          loop at xmslb.
            move-corresponding xmslb to imslb.
            collect imslb.
          endloop.
          free xmslb. refresh xmslb.
          if xchar = ' '.
            loop at imslb.
              move-corresponding imslb to imslbx.
              collect imslbx.
            endloop.
            sort imslbx.
          elseif xchar = 'X'.
            loop at imslb.
              check imslb-charg is initial.
              delete imslb.
            endloop.
          endif.
    endform.                     "aktuelle_bst_sbbst_o.
       AKTUELLE_BST_SBBST_V_W
    form aktuelle_bst_sbbst_v_w.
    Sonderbestand Kundenkonsignation -
      elseif sobkz = 'V' or sobkz = 'W'.
          select * from msku into corresponding fields of table xmsku
                                             where werks in g_ra_werks
                                             and   matnr in matnr
                                             and   charg in charg
                                             and   sobkz eq sobkz.
      if sy-subrc <> 0.          "no records found
        message s289.
      Kein Material in Selektion vorhanden.
        perform anforderungsbild.
      endif.
    process Special Stocks with Customer
      loop at xmsku.
        perform  f9000_auth_plant_check    using     xmsku-werks.
        if  g_flag_authority is initial.
          delete                 xmsku.
        else.
          perform  f9200_collect_plant     using  xmsku-werks.
          perform  f9400_material_key      using  xmsku-matnr.
        endif.
      endloop.
      describe table xmsku       lines  g_f_cnt_lines.
      if g_f_cnt_lines is initial.         "no records found
        message s289.
      Kein Material in Selektion vorhanden.
        perform anforderungsbild.
      endif.
          sort xmsku.
          loop at xmsku.
            move-corresponding xmsku to imsku.
            collect imsku.
          endloop.
          free xmsku. refresh xmsku.
          if xchar = ' '.
            loop at imsku.
              move-corresponding imsku to imskux.
              collect imskux.
            endloop.
            sort imskux.
          elseif xchar = 'X'.
            loop at imsku.
              check imsku-charg is initial.
              delete imsku.
            endloop.
          endif.
          if sy-subrc ne 0.
            message s042.                             "#EC *    "n443935
          Charge ist nicht vorhanden.
            perform anforderungsbild.
          endif.
    endform.                     "aktuelle_bst_sbbst_v_w
       AKTUELLE_BST_SBBST_K_M
    form aktuelle_bst_sbbst_k_m.
    Sonderbestand Lieferantenkonsignation -
      elseif sobkz = 'K' or sobkz = 'M'.
          select * from mkol into corresponding fields of table xmkol
                                            where werks in g_ra_werks
                                            and   lgort in g_ra_lgort
                                            and   matnr in matnr
                                            and   charg in charg
                                            and   sobkz eq sobkz.
      if sy-subrc <> 0.          "no records found
        message s289.
      Kein Material in Selektion vorhanden.
        perform anforderungsbild.
      endif.
    process Special Stocks from Vendor
      loop at xmkol.
        perform  f9000_auth_plant_check    using  xmkol-werks.
        if  g_flag_authority is initial.
          delete             xmkol.
        else.
          perform  f9200_collect_plant     using  xmkol-werks.
          perform  f9400_material_key      using  xmkol-matnr.
        endif.
      endloop.
      describe table xmkol       lines  g_f_cnt_lines.
      if g_f_cnt_lines is initial.         "no records found
        message s289.
      Kein Material in Selektion vorhanden.
        perform anforderungsbild.
      endif.
          sort xmkol.
          loop at xmkol.
            move-corresponding xmkol to imkol.
            collect imkol.
          endloop.
          free xmkol. refresh xmkol.
          if xchar = ' '.
            loop at imkol.
              move-corresponding imkol to imkolx.
              collect imkolx.
            endloop.
            sort imkolx.
          elseif xchar = 'X'.
            loop at imkol.
              check imkol-charg is initial.
              delete imkol.
            endloop.
          endif.
          if sy-subrc ne 0.
            message s042.                             "#EC *    "n443935
          Charge ist nicht vorhanden.
            perform anforderungsbild.
          endif.
    endform.                     "aktuelle_bst_sbbst_k_m.
       AKTUELLE_BST_SBBST_Q
    form aktuelle_bst_sbbst_q.
    Projektbestand -
      elseif sobkz = 'Q'.
          select * from mspr into corresponding fields of table xmspr
                                             where werks in g_ra_werks
                                             and   lgort in g_ra_lgort
                                             and   matnr in matnr
                                             and   charg in charg
                                             and   sobkz eq sobkz.
      if sy-subrc <> 0.          "no record found
        message s289.
      Kein Material in Selektion vorhanden.
        perform anforderungsbild.
      endif.
    process project stock
      loop at xmspr.
        perform  f9000_auth_plant_check    using  xmspr-werks.
        if  g_flag_authority is initial.
          delete                 xmspr.
        else.
          perform  f9200_collect_plant     using  xmspr-werks.
          perform  f9400_material_key      using  xmspr-matnr.
        endif.
      endloop.
      describe table xmspr       lines  g_f_cnt_lines.
      if  g_f_cnt_lines is initial.        "no record left
        message s289.
      Kein Material in Selektion vorhanden.
        perform anforderungsbild.
      endif.
          sort xmspr.
          loop at xmspr.
            move-corresponding xmspr to imspr.
            collect imspr.
          endloop.
          free xmspr. refresh xmspr.
          if xchar = ' '.
            loop at imspr.
              move-corresponding imspr to imsprx.
              collect imsprx.
            endloop.
            sort imsprx.
          elseif xchar = 'X'.
            loop at imspr.
              check imspr-charg is initial.
              delete imspr.
            endloop.
          endif.
    endform.:                     "aktuelle_bst_sbbst_q
       AKTUELLE_BST_SBBST_E
    form aktuelle_bst_sbbst_e.
    Kundenauftragsbestand -
          select * from mska into corresponding fields of table xmska
                                             where werks in g_ra_werks
                                             and   lgort in g_ra_lgort
                                             and   matnr in matnr
                                             and   charg in charg
                                             and   sobkz eq sobkz.
      if sy-subrc <> 0.            "no records found
        message s289.
      Kein Material in Selektion vorhanden.
        perform anforderungsbild.
      endif.
    process Sales Order Stock
      loop at xmska.
        perform  f9000_auth_plant_check    using  xmska-werks.
        if  g_flag_authority is initial.
          delete                   xmska.
        else.
          perform  f9200_collect_plant     using  xmska-werks.
          perform  f9400_material_key      using  xmska-matnr.
        endif.
      endloop.
      describe table xmska       lines  g_f_cnt_lines.
      if  g_f_cnt_lines is initial.        "no records left ?
        message s289.
      Kein Material in Selektion vorhanden.
        perform anforderungsbild.
      endif.
          sort xmska.
          loop at xmska.
            move-corresponding xmska to imska.
            collect imska.
          endloop.
          free xmska. refresh xmska.
          if xchar = ' '.
            loop at imska.
              move-corresponding imska to imskax.
              collect imskax.
            endloop.
            sort imskax.
          elseif xchar = 'X'.
            loop at imska.
              check imska-charg is initial.
              delete imska.
            endloop.
          endif.
    endform.                     "aktuelle_bst_sbbst_e
    *&      Form  TABELLEN_LESEN
          Lesen der Materialkurztexte (Tabelle MAKT),                    *
          der Mengeneinheiten (Tabelle MARA) und                         *
          Mengen- und Wertfortschreibung zum Material (Tabelle T134M)    *
          (Letzteres ist zum Aussortieren der unbewerteten bzw.          *
          kontierten Warenbewegungen notwendig)                          *
    form tabellen_lesen.
      if  not g_t_mat_key[] is initial.                         "n451923
      select the material masters
        select matnr meins mtart from mara
                       into corresponding fields of table imara
                       for all entries in g_t_mat_key
                                 where  matnr  =  g_t_mat_key-matnr.
      select the short text for all materials
      take only the necessary fields                          "n451923
        select matnr maktx       from makt                      "n451923
             into corresponding fields of table g_t_makt        "n451923
                       for all entries in g_t_mat_key
                       where  matnr = g_t_mat_key-matnr
                         and  spras = sy-langu.
        sort  imara              by  matnr.                     "n451923
        sort  g_t_makt           by  matnr.                     "n451923
        free                     g_t_mat_key.
      endif.
      data: begin of k1 occurs 0,
        mtart like t134m-mtart,
      end of k1.
      refresh k1.
      loop at imara.
        k1-mtart = imara-mtart.
        collect k1.
      endloop.
      if  not k1[] is initial.                                  "n451923
        select * from t134m
               into corresponding fields of table it134m
               for all entries in k1         where mtart = k1-mtart
                                             and   bwkey in g_ra_bwkey.
      endif.                                                    "n451923
      loop at it134m.
      read table organ with key bwkey = it134m-bwkey.
        perform  f9300_read_organ
                       using     c_bwkey     it134m-bwkey.
        if sy-subrc ne 0.
          delete it134m.
        endif.
      endloop.
    To find postings with valuation string, but without relevance for
    the valuated stock, Big-G recommended this logic:
    Take lines from MSEG where for the combination BUSTW/XAUTO=XBGBB
    there is an entry in T156W with key BSX.
      select bustw xbgbb from t156w
                         into corresponding fields of table it156w
                         where vorsl = 'BSX'.
      sort it156w by bustw xbgbb.
      delete adjacent duplicates from it156w.
      delete it156w where bustw = space.
    endform.                               " TABELLEN_LESEN
    *&      Form  UNBEWERTET_WEG
          Löschen der unbewerteten Materialien aus der internen          *
          Tabelle IMBEW
    form unbewertet_weg.
      sort  it134m               by bwkey mtart.                "n451923
                                                                "n450764
    delete the materials in plants without valuation          "n450764
      loop at g_t_mbew           into  g_s_mbew.                "n450764
        read table imara                                        "n450764
                       with key matnr = g_s_mbew-matnr          "n450764
                       binary search.                           "n450764
                                                                "n450764
        read table it134m with key bwkey = g_s_mbew-bwkey       "n450764
                                   mtart = imara-mtart binary search.
        if sy-subrc ne 0.
        message ...
          delete                 g_t_mbew.                      "n450764
        else.
          if it134m-wertu = ' '.
            delete               g_t_mbew.                      "n450764
          else.                                                 "n450764
          enrich the entries with the quantity unit           "n450764
            move    imara-meins  to    g_s_mbew-meins.          "n450764
            modify  g_t_mbew     from  g_s_mbew                 "n450764
                                 transporting  meins.           "n450764
          endif.
        endif.
      endloop.
    endform.                               " UNBEWERTET_WEG
    *&      Form  FI_BELEGE_LESEN                                          *
          Lesen der Buchhaltungsbelege                                   *
    Beim Erfassen der Werte ist es notwendig, die Buchhaltungsbelege    *
    zum Material zu lesen, um abweichende Werte zwischen Wareneingang   *
    und Rechnungseingang sowie Nachbelastungen zu berücksichtigen.      *
    form fi_belege_lesen.
    Not related to note 184465, but a significant performance issue
    if ORGAN is large due to many plants/storage locations.
      data: begin of t_bwkey occurs 0,                               "184465
              bwkey like bsim-bwkey,                                 "184465
            end of t_bwkey.                                          "184465
      loop at g_t_organ          where  keytype  =  c_bwkey.
        move g_t_organ-bwkey     to  t_bwkey-bwkey.
        collect t_bwkey.                                             "184465
      endloop.                                                       "184465
      read table t_bwkey index 1.                                    "184465
      check sy-subrc = 0.                                            "184465
      select * from bsim                                        "n443935
             into corresponding fields of table g_t_bsim_lean   "n443935
               for all entries in t_bwkey   where  bwkey = t_bwkey-bwkey
                                            and    matnr in matnr
                                            and    bwtar in bwtar
                                            and    budat >= datum-low.
      loop at g_t_bsim_lean      into  g_s_bsim_lean.           "n443935
        perform  f9300_read_organ
                       using     c_bwkey  g_s_bsim_lean-bwkey.  "n443935
        if  sy-subrc is initial.
        record found : the user has the authority, go on
          move  g_s_organ-bukrs  to  g_s_bsim_lean-bukrs.       "n443935
          modify  g_t_bsim_lean  from  g_s_bsim_lean            "n443935
                                 transporting  bukrs.           "n451923
        create working table with the keys for the FI documents
          move-corresponding  g_s_bsim_lean                     "n443935
                                 to  g_t_bkpf_key.              "n443935
          append                 g_t_bkpf_key.
        else.
          delete                 g_t_bsim_lean.                 "n443935
        endif.
      endloop.
    endform.                               " FI_BELEGE_LESEN
    *&      Form  BELEGE_SORTIEREN
       Die Materialbelege werden anhand des Buchungsdatums sortiert.
       Die Materialbelege mit Buchungsdatum zwischen 'datum-high'
       und dem aktuellen Datum werden in der internen Tabelle IMSWEG
       gesammelt, während die Materialbelege mit Buchungsdatum
       zwischen 'datum-low' und 'datum-high' in der internen Tabelle
       IMSEG verbleiben.
    form belege_sortieren.
      aktdat = sy-datlo + 30.
      if not ( datum-high is initial or datum-high > aktdat ).
        loop at g_t_mseg_lean    into  g_s_mseg_lean
                                 where budat > datum-high.
          move-corresponding g_s_mseg_lean to imsweg.
          append imsweg.
          delete                 g_t_mseg_lean.
        endloop.
      endif.
      describe table imsweg lines index_2.
    endform.                               " BELEGE_SORTIEREN
    *&      Form  KONTIERT_AUSSORTIEREN
          Aussortierung der kontierten Belegpositionen,                  *
          da diese Mengen nicht bestandsrelevant sind                    *
    form kontiert_aussortieren.
    process table g_t_mseg_lean
    loop at imseg where kzvbr <> space and                         "144845
        ( kzbew = 'B' or kzbew = 'F' ).                            "144845
        read table imara with key matnr = imseg-matnr.
        read table it134m with key mtart = imara-mtart.
        if not it134m-mengu is initial and not it134m-wertu is initial.
    Die Felder 'mengu' und 'wertu' (Mengen- bzw. Wertfortschreibung)
    sind ab Release 3.0 D auch in die Tabelle MSEG aufgenommen.
    Die Einträge in der Tabelle T134M stellen nach wie vor die generelle
    Einstellung dar; auf Positionsebene sind jedoch Abänderungen möglich,
    die anhand der Einträge in der Tabelle MSEG nachverfolgt werden
    können.
          delete imseg.
        endif.
    endloop.
      data : l_f_bwkey           like  t001k-bwkey.             "n497992
      sort  it134m               by  bwkey  mtart.              "n497992
      loop at g_t_mseg_lean      into  g_s_mseg_lean
                                 where  kzvbr <> space
                                   and ( kzbew = 'B' or kzbew = 'F' ).
      get the valuation area                                  "n497992
        if  curm = '3'.                                         "n497992
        valuation level is company code                       "n497992
          if  g_s_mseg_lean-bukrs is initial.                   "n497992
          get the valuation area for this plant               "n497992
            perform  f9300_read_organ                           "n497992
                       using     c_werks   g_s_mseg_lean-werks. "n497992
                                                                "n497992
            move  g_s_organ-bwkey     to  l_f_bwkey.            "n497992
          else.                                                 "n497992
            move  g_s_mseg_lean-bukrs to  l_f_bwkey.            "n497992
          endif.                                                "n497992
        else.                                                   "n497992
        valuation level is plant                              "n497992
          move  g_s_mseg_lean-werks   to  l_f_bwkey.            "n497992
        endif.                                                  "n497992
        read table imara with key matnr = g_s_mseg_lean-matnr
                                 binary search.
        if  sy-subrc is initial.
          read table it134m      with key  bwkey = l_f_bwkey    "n497992
                                           mtart = imara-mtart  "n497992
                                 binary search.
          if  sy-subrc is initial.
            if not it134m-mengu is initial and
               not it134m-wertu is initial.
              delete              g_t_mseg_lean.
            endif.
          endif.
        else.
          delete                  g_t_mseg_lean.
        endif.
      endloop.
    endform.                               " KONTIERT_AUSSORTIEREN
    *&      Form  BELEGE_ERGAENZEN (engl. enrich documents)
    Material documents and FI documents from BSIM are merged together.
    Complications:
    - A material document can have more than one FI document.
    - There are FI documents without material documnts
    - There are material documents without FI documents
    - The document type is customizeable
    - There is no link from the materia document position to
      the FI document entry in BSIM (except URZEILE, but this
      can be filled incorrectly)
    form belege_ergaenzen.                         "Version from note 204872
    - show the current activity and the progress              "n599218
      call function 'SAPGUI_PROGRESS_INDICATOR'                 "n599218
        exporting                                               "n599218
          text = text-061.       "Reading FI documents          "n599218
    Eliminate material documents with valuation string, but without
    relevance to the valuated stock. IT156W contains all valuation
    strings with posting key BSX. XBGBB says: "I am an accrural posting".
    For more details please ask Big-G.
      loop at g_t_mseg_lean      into  g_s_mseg_lean.
      special processing for tied empties active ?            "n497992
        if  not g_cust_tied_empties is initial.                 "n497992
        look for MM documents with xauto = L and change       "n497992
        indicators                                            "n497992
          case  g_s_mseg_lean-xauto.                            "n497992
            when  'X'.                                          "n497992
            when  space.                                        "n497992
            when  others.                                       "n547170
            range table g_ra_xauto contains the special       "n547170
            indicators for the transfer movements of the      "n547170
            tied empties                                      "n547170
              if  g_s_mseg_lean-xauto in g_ra_xauto.            "n547170
                move  g_s_mseg_lean-xauto                         "n497992
                                 to  g_s_mseg_lean-retail.        "n497992
                clear              g_s_mseg_lean-xauto.           "n497992
                modify  g_t_mseg_lean    from  g_s_mseg_lean      "n497992
                                 transporting xauto retail.       "n497992
              endif.                                            "n547170
          endcase.                                              "n497992
        endif.                                                  "n497992
        read table it156w        with key
                                 bustw = g_s_mseg_lean-bustw
                                 xbgbb = g_s_mseg_lean-xauto
                                 transporting no fields
                                 binary search.
        if sy-subrc <> 0.
          delete                 g_t_mseg_lean.
        else.                                                   "n443935
        enrich the current entry with the company code        "n443935
          perform f9300_read_organ                              "n443935
                       using     c_werks  g_s_mseg_lean-werks.  "n443935
                                                                "n443935
          check : sy-subrc is initial.                          "n443935
          move  g_s_organ-bukrs  to  g_s_mseg_lean-bukrs.       "n443935
          modify  g_t_mseg_lean  from  g_s_mseg_lean            "n443935
                                 transporting  bukrs.           "n451923
        endif.
      endloop.
    For all available FI documents from BSIM, read the header data
    from BKPF to get the link to the originating material document.
      if  not g_t_bkpf_key[] is initial.
      look for the header of the matching FI documents
        sort  g_t_bkpf_key       by  bukrs belnr gjahr.
        delete adjacent duplicates from g_t_bkpf_key.
      save result from database selection into global hashed  "n856424
      table g_t_bkpf                                          "n856424
        select  *                 from bkpf                     "n856424
          into corresponding fields of table g_t_bkpf           "n856424
               for all entries in g_t_bkpf_key
                       where  bukrs = g_t_bkpf_key-bukrs
                         and  belnr = g_t_bkpf_key-belnr
                         and  gjahr = g_t_bkpf_key-gjahr.
        if  sy-subrc is initial.
        create working table l_t_keytab_m
          free                   g_t_bkpf_key.
          loop at g_t_bsim_lean  into  g_s_bsim_lean.           "n443935
          enrich the working table g_t_bsim_lean with the     "n443935
          MM doc info                                         "n443935
                                                                "n443935
          look for the matching FI document header            "n443935
            read table g_t_bkpf  assigning           "n856424
                       with key  bukrs = g_s_bsim_lean-bukrs    "n443935
                                 belnr = g_s_bsim_lean-belnr    "n443935
                                 gjahr = g_s_bsim_lean-gjahr.   "n443935
                                                                "n443935
            if  sy-subrc is initial.                            "n443935
            enrich table G_T_BSIM_LEAN with the MM doc        "n443935
            consider only FI docs created by MM docs here     "n856424
              check :

    Hi Ravi,
    possibly a service pack has been installed just in the time when you created the copy. I found
        data: lt_sort type kkblo_t_sortinfo.                    "n890109
    in the include mentioned on our system. Please check if the includes are identical in development and production server (remote-compare from editor).
    But we also have a copy of this in our system. In the copy I found type name like alv_type_sortinfo but no kkblo_t_sortinfo.
    Note KKBLO was the predecessor of ALV.
    Must have to dio something with version changed by service pack.
    Regards,
    Clemens

Maybe you are looking for

  • How to insert current date

    I'm working on a bulletin template and would like to have a text box with the current date automatically generated and placed in it.  Is this possible?  If so, how do I go about doing this?

  • Not able to connect to Lotus Domino server using java/corba

    Hi I am new to Lotus Domino server and Java. I have INstalled Lotus Domino server5 on 1 machine and was successful in installing the Lotus client on another machine. Throught the lotus client i am able to connect to the server and send and receive th

  • Web based PDF Search

    I am working on a website for my father. nepaninjas.com and one of the requests my father ( Danny Chris Reinke PhD ) has for the site is that he wants his massive database of legislative PDFs regarding NEPA and emvironmental law be searchable from th

  • PE 9 - Audiocompression in AVI?

    Hello, I´m using Adobe Premiere Elements 9 since two weeks now. It´s a great software, but I´ve got some problems with codecs. WMV is a bit slow, I don´t like MainConcept so far. So I decided to use AVI as the container for the video. Under "Video" I

  • Captivate 6 issue. Exits and says not complete/issues with videos too

    I use Captivate 6 on a Mac and I publish to SCORM 2.0. Previously we used Captivate 5.5 on a PC and had no problems at all. Our e-learning portal provider (World Manager) does not support questions when created in Captivate, so we have always added q