Monday, February 28, 2011

修复MC.9过账日期的库存值与实际不一样的问题

 最近财务部门调取MC.9报表查看过去某个时间段的库存,发现MC.9的值与MB5B值不一致.后调查发现,MC.9的值为错误值,MB5B的是正确的.查阅网上相关文章,遇到此类问题的还不止我们一个.
     MC.9的取值来自于信息结构S031和S032,具体内容可以通过SE16N查看.S031存放的是在每个周期中的异动情况 (可以是以周\月等等为周期,取决于IMG设置), S032存放当前的库存和库存价值,而S039则是链结了S031&S032,并且包含了一些没有在数据库中存储、只在运行报表时才依据其他一些数据计算值的附加字段.S039通常被用作参考,实际数据必须通过报表RMCBS039来写入S039.它的用途有:
a) 在标准分析功能中,对于计划/实际比较存储计划数据.(storing planned figures for planned/actual comparisons in the standard analysis.)
b) 在库存控制中,建立柔性的分析.
      S031的构成在NOTE 中有详细描述. S031的内容出错可能来自多方面,遇到这种情况只有重建信息结构了.
      S031表字段的说明:
MANDT    Client
SSOUR    Statistic(s) origin
VRSIO    Version number in the information structure
SPMON    Period to analyze - month
SPTAG    Period to analyze - current date
SPWOC    Period to analyze - week
SPBUP    Period to analyze - posting period
WERKS    Plant
MATNR    Material Number
LGORT    Storage Location
以上字段构成表主键。
Val. stock receipts 字段显示的是相关库存地点收货的数量,如果存在负数,则是存在收货撤消的项目,比如mvt 102的移动.如果行记录中没有显示库存地点,则表示为外包商从我方的收货,通常为541。
Val. stock issues 字段显示的是相关库存地点发货的数量,如果存在负数,则是存在发货撤消的项目,比如mvt 262的移动.如果记录中没有库存地点,则表示为外包商物料耗用,通常为543。
      关于S031的生成,可以使用TC:Oli1 (将程序设为后台运行较好,因为生成时间比较长),生成前, 用OLIX将S031中的不需要的版本数据删掉,防止操作上不慎生成重复累加的值.
    生成后使用OLIX将生成的版本COPY到版本000中.这一步是由于SAP生成时默认版本是&(,而MC.9默认调用的是000版,故需要COPY,否则MC.9报表运行时会显示没有记录的(当然你也可以设置用户参数MCR值X来使mc.9可以选择读取的版本).
    关于重新生成结构,实际有很多TC,从oli1到oli9都是,但不同的TC用于生成不同的信息结构。比如,oli1是根据物料移动的数据来生成,取自表mseg等,用来生成S031,oli3取的是采购相关的数据,生成S012,具体过程未研究完毕,以后再更新。    就我们公司的应用来看,S031用OLI1生成,S032使用OLI2生成,随机抽查没发现问题,发现问题再改这段文字吧。
   总之,按照SAP NOTE提到的标准方法有两种,可在Note 64636 - Procedure for statistical data setup in LIS中查到,我用的是B过程,大体如下:
   1、停用LIS 仓库控制相关的LIS报表更新.IMG-PATH:
 + Logistics - General + Logistics Information System (LIS) + Logistics Data Warehouse + Updating + Updating Control + Activate update
2、用程序RMCA0315删除S031,程序 RMCA0325删除 S032中相应000版本数据。
3、重新启用更新
4、使用程序RMCBNEUA更新S031、S032,再顺序执行程序RMCBNEUB,变式S031_S032,在此期间,不能有R3的操作。
附录:
    事务 NPRT 查看指定日期对信息结构的手动更新日志
     report RMCP6VER  复制实际数据到计划版本, Note 35200 - Copying actual data version into plan version
     report RMCBS039 传输S031&S032的最后数据到S039,Note 114960 - Planned/actual comparison of different versions
     相关IMG:
停用信息结构的更新 或设置周期配置
     + Logistics - General + Logistics Information System (LIS) + Logistics Data Warehouse + Updating + Updating Control + Activate update
重要的NOTES:Note 453420 - Incorrect stock values in LIS
                         Notes  79083            

另一部分参考资料,感谢原作者:

摘抄别人的原步骤:

Firstly, I used version “&(6” as temporary version – you could use any other name.
Delete version “&(6” for S031, S032, S033, S034, S035 (if they exists) -- tcode olix
Get material documents data for “&(6” – again S031, S032, S033, S034, S035 -- tcode oli1
Get invoices data for “&(6” – again S031, S032, S033, S034, S035 -- tcode oliz
Stock values for “&(6” – again S031, S032, S033, S034, S035 -- tcode oli2
Delete version “000” (the main version) of S031, S032, S033, S034, S035 -- tcode olix
Copy data in version “&(6” to version “000” for S031, S032, S033, S034, S035 -- tcode olix

Another article written by a IMG fellow for your reference, Please remember to have a test in your test system before you update IS data in your production machine .
SAP LIS - Wrong figures in Logistics Information System
Warning - Please test it in developer first.
Alert : It can result in data loss or inaccurate data in your LIS table if not done properly.
This is bound to happened especially if the users made changes to the Purchase Order and you have set the online updates for your LIS.   Fields like Material groups are consider keys fields and should not be change as it somehow impact the updates to LIS.
If the figures are wrong for a particular period, you can do a reorganization for all the Purchase Order for the particular months.
Assuming that you want to reorganize the whole S012.
When you execute OLI3, it will locked any Purchase Order that it is processing.  Therefore, it is advisable to run it during off office hours.
First Step :-
OLI3 - Statistical setup of info structures from purchasing documents
Info structure to be set up S012
Save under version &(
Tick Delete/create indices
Specify the Purchasing Documents or Document Date
Name of run S012-1
Tick New run?
Date of termination 99.99.9999
Time of termination 99:99:99
Tick Redetermine update group?
Tick Update documents?
NPRT - Log for Setup of Statistical Data
Final Step:-
OLIX - Copy/delete versions of an info structure
First Screen
Info structure S012
Processing type Copy + Delete
Second Screen
Source version &(
Untick Do not copy initial records
Tick Reset target version
Untick No automatic period conversion
Now, you can check the figures using transaction MCE5or any of the transaction that uses the table S012.

No comments:

Post a Comment