Uploaded by n.bedoya

2206980 E 20230810

advertisement
SAP Note
2206980 - Material Inventory Managment: change of data model in S/4HANA
Component: MM-IM-GF (Basic Functions), Version: 20, Released On: 20.05.2022
Symptom
You want to install SAP S/4HANA and need additional information how to adjust your customer enhancements,
modifications or own functionalities to the new, simplified data model of SAP S/4HANA Supply Chain (MM - Inventory
Management).
You want to have information about what is different in SAP S/4HANA Supply Chain (MM - Inventory Management)
compared to Suite on HANA MM-IM.
Other Terms
S4TC, S/4 transition, MM-IM, Material Management
Reason and Prerequisites
You have customer enhancements, modifications or own functionalities in the area of inventory management (component
MM-IM) which were built for SAP ERP 6.0.
You are using functionalities which behave different in SAP S/4HANA Supply Chain (MM - Inventory Management)
compared to Suite on HANA.
The SAP ERP 6.0 stock inventory management data model consists of the two document tables MKPF for document header
information and MSEG for document item data. Additionally there were aggregated actual stock quantity data stored in
several tables. Some of these tables do also store material master data attributes like the tables MARC, MARD and MCHB.
Such tables with material master data attributes as well as actual stock quantities will be named as hybrid tables in the
following. In contrast there are also tables like MSSA containing only aggregated actual stock quantities for sales order stock.
Such tables will be called in the following as replaced aggregation tables.
With S/4HANA this data model has been changed significantly. The new de-normalized table MATDOC has been introduced which contains the former
header and item data of a material document as well as a lot of further attributes. Material document data will be stored in MATDOC only and not anymore
in MKPF and MSEG. Additionally the aggregated actual stock quantities will not be persisted anymore in the hybrid or replaced aggregation tables. Instead,
actual stock quantity data will be calculated on-the-fly from the new material document table MATDOC for which some of those additional special fields are
used. Hence, with the new MM-IM data model the system will work on database level in an INSERT only mode without DB locks. Nevertheless, for stock
decreasing processes there will be still ABAP locks to ensure stock consistency. A further advantage of the new MM-IM data model is the capability of
simple and fast reporting because the most information is all in one place: MATDOC.
All below mentioned tables of the SAP ERP 6.0 product do still exist in S/4HANA as DDIC definition as well as database object and the hybrid tables will
still be used to store the material master data attributes. For compatibility reasons there are Core Data Service (CDS) Views assigned as proxy objects to
all those tables ensuring that each read access to one of the mentioned tables below still returns the data as before in SAP ERP 6.0. The CDS Views do
the on-the-fly aggregation of actual stock quantities from the new MM-IM data model and join the master data attributes from the material master data
table. Hence all customer coding reading data from those tables will work as before because each read access to one of the tables will get redirected in the
database interface layer of NetWeaver to the assigned CDS view. Write accesses to those tables have to be adjusted.
The affected tables are:
Table description
Tabl
e
DDL Source of CD
S View for redirect
View to read the content of the database
table (w/o redirect to compatibility view)
View to read the mast
er data attributes only
MKP
F
Material document header
NSDM_DDL_MKPF
NSDM_MIG_MKPF
-
MSE
G
Material document item
NSDM_DDL_MSEG
NSDM_MIG_MSEG
-
Plant Data for Material
NSDM_DDL_MARC
NSDM_MIG_MARC
V_MARC_MD
MAR
D
Storage Location Data for
Material
NSDM_DDL_MARD
NSDM_MIG_MARD
V_MARD_MD
MC
HB
Batch stocks
NSDM_DDL_MCHB
NSDM_MIG_MCHB
V_MCHB_MD
MK
OL
Special Stocks from Vend
or
NSDM_DDL_MKOL
NSDM_MIG_MKOL
V_MKOL_MD
MSL
B
Special Stocks with Vendo
r
NSDM_DDL_MSLB
NSDM_MIG_MSLB
V_MSLB_MD
MSK
A
Sales Order Stock
NSDM_DDL_MSKA
NSDM_MIG_MSKA
V_MSKA_MD
MSS
A
Total Customer Orders on
Hand
NSDM_DDL_MSSA
NSDM_MIG_MSSA
MSP
R
Project Stock
NSDM_DDL_MSPR
NSDM_MIG_MSPR
MSS
L
Total Special Stocks with
Vendor
NSDM_DDL_MSSL
NSDM_MIG_MSSL
MSS
Q
Project Stock Total
NSDM_DDL_MSSQ
NSDM_MIG_MSSQ
MSK
U
Special Stocks with Custo
mer
NSDM_DDL_MSKU
NSDM_MIG_MSKU
MST
B
Stock in Transit
NSDM_DDL_MSTB
NSDM_MIG_MSTB
-
MST
E
Stock in Transit to Sales a
nd Distribution Document
NSDM_DDL_MSTE
NSDM_MIG_MSTE
-
MST
Q
Stock in Transit for Project
NSDM_DDL_MSTQ
NSDM_MIG_MSTQ
-
MCS
D
DIMP: Customer Stock
NSDM_DDL_MCSD
NSDM_MIG_MCSD
MCSD_MD
MCS
S
DIMP: Total Customer Sto
ck
NSDM_DDL_MCSS
NSDM_MIG_MCSS
MCSS_MD
MSC
D
DIMP: Customer stock wit
h vendor
NSDM_DDL_MSCD
NSDM_MIG_MSCD
MSCD_MD
MSC
S
DIMP: Customer stock wit
h vendor - Total
NSDM_DDL_MSCS
NSDM_MIG_MSCS
MSCS_MD
MSF
D
DIMP: Sales Order Stock
with Vendor
NSDM_DDL_MSFD
NSDM_MIG_MSFD
MSFD_MD
MSF
S
DIMP: Sales Order Stock
with Vendor - Total
NSDM_DDL_MFS
NSDM_MIG_MSFS
MSFS_MD
MSI
D
DIMP: Vendor Stock with
Vendor
NSDM_DDL_MSID
NSDM_MIG_MSID
MSID_MD
MSI
S
DIMP: Vendor Stock with
Vendor - Total
NSDM_DDL_MSIS
NSDM_MIG_MSIS
MSIS_MD
MAR
C
-
V_MSPR_MD
-
V_MSKU_MD
MSR
D
DIMP: Project Stock with
Vendor
NSDM_DDL_MSRD
NSDM_MIG_MSRD
MSRD_MD
MSR
S
DIMP: Project Stock with
Vendor - Total
NSDM_DDL_MSRS
NSDM_MIG_MSRS
MSRS_MD
History
NSDM_DDL_MARC
H
NSDM_MIG_MARCH
-
MAR
DH
History
NSDM_DDL_MARD
H
NSDM_MIG_MARDH
-
MC
HBH
History
NSDM_DDL_MCHB
H
NSDM_MIG_MCHBH
-
MK
OLH
History
NSDM_DDL_MKOL
H
NSDM_MIG_MKOLH
-
MSL
BH
History
NSDM_DDL_MSLB
H
NSDM_MIG_MSLBH
-
MSK
AH
History
NSDM_DDL_MSKA
H
NSDM_MIG_MSKAH
-
MSS
AH
History
NSDM_DDL_MSSA
H
NSDM_MIG_MSSAH
-
MSP
RH
History
NSDM_DDL_MSPR
H
NSDM_MIG_MSPRH
-
MSS
QH
History
NSDM_DDL_MSSQ
H
NSDM_MIG_MSSQH
-
MSK
UH
History
NSDM_DDL_MSKU
H
NSDM_MIG_MSKUH
-
MST
BH
History
NSDM_DDL_MSTB
H
NSDM_MIG_MSTBH
-
MST
EH
History
NSDM_DDL_MSTE
H
NSDM_MIG_MSTEH
-
MST
QH
History
NSDM_DDL_MSTQ
H
NSDM_MIG_MSTQH
-
MCS
DH
History
NSDM_DDL_MCSD
H
NSDM_MIG_MCSDH
-
MCS
SH
History
NSDM_DDL_MCSS
H
NSDM_MIG_MCSSH
-
MSC
DH
History
NSDM_DDL_MSCD
H
NSDM_MIG_MSCDH
-
MSF
DH
History
NSDM_DDL_MSFD
H
NSDM_MIG_MSFDH
-
MSI
DH
History
NSDM_DDL_MSID
H
NSDM_MIG_MSIDH
-
MSR
DH
History
NSDM_DDL_MSRD
H
NSDM_MIG_MSRDH
-
MAR
CH
The hybrid tables of the former Industry Solution DIMP have now new tables containing the material master data only. The name of the new tables is
presented in the right column of above table.
According to the fact that data will not persisted anymore in the header and item tables MKPF and MSEG the transaction DB15 behaves differently in the
environment of archiving.
Transaction DB15, which allows the retrieval of statistical data for DB tables grouped by the archiving objects that refer to these tables, does not provide
correct information for tables MKPF and MSEG. When selecting tables from which data is archived for archiving object MM_MATBEL, and navigating to
“Online Space” or “Space Statistics” for tables MKPF or MSEG, the statistics “No. Records” and “Table Space” are shown in the result screen. These
numbers are taken from the original tables MKPF and MSEG, and not calculated by redirecting the request to table MATDOC. Consequently, when
executing archiving for arching object MM_MATBEL, this will have no effect on the numbers shown for tables MKPF and MSEG in transaction DB15.
Some of the hybrid tables contain a field with the semantic "date of last change" (in many cases field name is LAEDA). In the ERP solution this field has
been updated with each material document posting. With the introduction of the new data model in S/4 the hybrid tables will not be updated with actual
stock data anymore and also the field LAEDA will not be updated. Hence, the semantic of this field for the material master data hybrid tables changes to
"date of last change of master data".
Solution
One impact of the simplified MM-IM data model does exist if there are customer APPENDs or INCLUDEs with customer fields on the mentioned tables. The
NetWeaver redirect capability requires that DB table and assigned proxy view is compatible in the structure: number of fields, their sequence and their type.
Thus if there is an APPEND or INCLUDE on one of the above mentioned tables then the assigned DDL source of the CDS view must be made compatible.
In some cases for S/4HANA on-premise 1511 this does not require customer interaction especially in those cases where the append has been put at the
end of a table which is strongly recommended (not somewhere in between which may happen if a table is composed by include structures like for MARC).
For other cases and in general for S/4HANA on-premise 1610 the structure of the proxy view can be made compatible to the table by extension view. This
extension view is always an extension to the above mentioned view in the DDL source of the CDS view used for redirect. In the extension view the fields
have to be listed in exactly the same order as in the append. For more information about view extension see e.g. SAP NetWeaver 7.4 documentation.
Another impact of the simplified MM-IM data model is a performance decrease of DB read operations on the above mentioned tables just because a data
fetch on one of the mentioned tables is in S/4HANA slower than in SAP ERP 6.0 due to the on-the-fly aggregation and the JOIN operation. Hence
performance critical customer coding may be adjusted to improve performance. Furthermore customer coding writing data to aggregated actual stock
quantity or to the former document header or item table shall be adjusted!
1. Customer Appends
With SAP Note 2194618 and 2197392 SAP offers a check to be executed on the start release to identify APPEND issues described in the following sub
chapters. Hence customer is not forced to scan all above listed tables manually.
1.1 Customer Appends on the former document tables MKPF and MSEG
If there are APPENDs on MKPF and MSEG where fields with the same fieldname do exist then there is a name conflict in case that the content of field
MKPF-A is different from field MSEG-A (fields with same name and identical content do exist on MKPF and MSEG also in SAP Standard for performance
reasons e.g. BUDAT). In this case it is required to add a further field A_NEW to the append, copy the data from A to A_NEW with a special customer
program and then all coding sections, Dynpros, etc. need to be adjusted to use A_NEW and then field A needs to be dropped from the append. This must
be done before migration from ERP 6.0 to S/4HANA.
If the attributes in the APPENDs or INCLUDEs (e.g. CI_M* INCLUDEs as introduced with consulting note 906314) on table MKPF and MSEG do have a
master data or process controlling character then the fields from the APPENDs/INCLUDEs need to be appended to the table MATDOC and the assigned
proxy views can be made compatible via extension views.
In case of a system conversion all these customer fields in such APPENDs or INCLUDEs need to be appended to table MATDOC during the ACT_UPG
phase (SPDD). It has to be done in any case before the MM-IM converison program will be executed which move the data from MKPF and MSEG to
MATDOC otherwise data in customer fields gets lost. The structure compatibility between table MKPF/MSEG and their assigned proxy view shall be
created directly after system conversion by creating extend views, see note 2242679.
Fields from APPENDs/INCLUDEs to table MKPF should be appended to sub structure NSDM_S_HEADER of table MATDOC.
Fields from APPENDs/INCLUDEs to table MSEG should be appended to sub structure NSDM_S_ITEM of table MATDOC.
1.1.1 Customer include CI_COBL in table MSEG
Table MSEG contains the customer include CI_COBL where customers can insert own fields. The CI_COBL include has been made available also in the
new MM-IM data model with note 2240878. This note must be applied before the data migration starts in the ACT_UPG phase (SPDD); otherwise you may
loose data. With the implemented CI_COBL the table MSEG and it's assigned proxy view is not compatible in their structure anymore. The structural
compatibility can be re-created by applying note 2242679. This must be done directly after system conversion has been finished.
If you later on like to make use of one of the fields in EXTEND VIEW for CI_COBL in the app "Custom fields and logic" then you need to follow the
instructions given in this article in the SAP Help portal. Basically you need to remove the field from the EXTEND VIEW for CI_COBL, save without activate
and then add the field in the app "Custom fields and logic". This is valid for release 1709 and higher.
1.2 Customer Appends on the hybrid and replaced aggregation tables
1.2.1 Fields containing material master data attributes
If the append is not at the end of the hybrid table then the append should be moved to the end if possible and then no further action is required because the
delivered DDL sources for the proxy views provide the $EXTENSION feature within S/4HANA on-premise 1511. Due to too many side effects like
unpredictable sequence of fields from APPENDs, this has been changed with S/4HANA On-Premise 1610 where always an EXTEND VIEW for a CDS
proxy view has to be created for an APPEND on a material master data table. For the DIMP tables the append has to be appended also to the new pure
DIMP material master data tables.
The structural compatibility between table and CDS proxy view can be re-created by applying note 2242679. This must be done directly after system
conversion has been finished (e.g. creating just an EXTEND VIEW with the customer fields using ABAP Development Tools for S/4HANA On Premise 1610
and higher).
For replaced aggregation tables appends with master data attributes are not supported. If such appends are really required in the customer processes then
the approach described in the next chapter maybe feasible. In the core functionality of material document processing there will be no write process on
these tables. Thus update of the fields in the appends requires maybe some additional customer coding.
1.2.2 Fields representing a customer defined stock type or quantity/value to be aggregated
If own stock types or a dimension which needs to be aggregated have been introduced by the customer then the view stack of the CDS view assigned to
the table with the additional stock type needs to be modified. Right now, there is no technology support for modification free enhancement. If the stock type
has not been introduced by new entries or enhancements in the tables T156x (T156, T156SY, T156M, T156F) - which controls in the core functionality the
mapping between a posting and a stock type - then the process logic needs to be adapted.
1.3 Customer Appends on views
There are several views in SAP Standard which also do have an assigned proxy view because the view provide actual stock quantity data. View and
assigned proxy view must be compatible in structure too. If there are customer appends on such view the same rules as for tables apply. Views with
assigned proxy compatibility view can be determined by searching via transaction SE16N in table DD02L with TABCLASS = VIEW and VIEWREF <> '' or
you may use above mentioned check functionality in your start release.
1.3.1 Customer views on MKPF/MSEG
Views are database objects and thus a view is executed on the database. Because the table MKPF and MSEG will not contain data anymore (except
legacy data from migration) such a customer view will never return any record. Such views have to be either adjusted by fetching data from table MATDOC
or to be created new as DDL source with a different name. In the last case all usages of the old DDIC SQL view must be replaced by the new CDS view.
1.3.2 Customer views on material master attributes
Such views using only material master data attributes from the hybrid tables do not need to be changed.
1.3.3 Customer views using aggregated stock quantity data
Customer views having at least one actual stock quantity aggregate cannot be used anymore because
the field representing this aggregate on the database will be empty forever
the quantity must be aggregated from table MATDOC which is not possible with DDIC SQL views.
Such views must be defined new as DDL source with a new name. Each of the above mentioned DDL sources can be used as template. All usages of the
old DDIC SQL view must be replaced by the new CDS view.
2 Code adjustments and optimizations
Technically it is still possible to do DB write operations (INSERT, UPDATE, DELETE, MODIFY) on the tables MKPF, MSEG as well as the fields
representing actual stock quantities in the hybrid and replaced aggregation tables. But such write operations are without any effect! Therefore write
operations on MKPF, MSEG as well as the fields representing actual stock quantities in the hybrid and replaced aggregation tables shall be removed from
customer coding. Write operations on the material master data attributes in the hybrid tables are still possible. Write operations on table MATDOC and your
moved customer append fields are done by class CL_NSDM_STOCK.
DB read operations on the hybrid and replaced aggregation tables have a performance decrease. In general, it shall be avoided to read any stock
quantities when only master data is required. Therefore it is recommended to adjust the customer coding in the following way:
If material master data as well as actual stock quantity data are required then the SELECT....<table> should be replaced by using a data access
method from class CL_NSDM_SELECT_<table>. These classes provide access methods for single as well as array read operations. Those access
methods shall not be used if the KEY table contains more than 1000 records to to limitations of the SELECT.....FOR ALL ENTRIES.
If material master data are required then the SELECT....<table> should be replaced by SELECT....V_<table>_MD where V_<table>_MD is one of the
above mentioned views for master data access. Alternatively corresponding material master data read methods in the class
CL_NSDM_SELECT_<table> can be used (those access methods shall not be used if the KEY table contains more than 1000 records to to
limitations of the SELECT.....FOR ALL ENTRIES.). Also the data type declarations should be adjusted from TYPE...<table> to
TYPE...V_<table>_MD.
If actual stock quantity data are required then the SELECT....<table> should be replaced by SELECT....NSDM_V_<table>_DIFF where
NSDM_V_<table>_DIFF is one of the views in the view stack of the above mentioned proxy view. Also the data type declarations should be adjusted
from TYPE...<table> to TYPE...NSDM_V_<table>_DIFF.
For table MARC and field STAWN valid from S/4HANA On Premise 1610 please read note #mce_temp_url#
For performance critical coding parts these adjustments are strongly recommended. For non critical parts it is optional short term but recommended on long
term.
To identify such locations, it is required to make use of the where-used functionality of transaction SE11 and considering other techniques like transaction
CODE_SCANNER to find locations which SE11 cannot handle – like dynamic programming or native SQL statements.
Consider SAP Note 28022 if there are issues with the where-used functionality in the customer system. In the where-used dialog it is possible via the button
"Search Range" to search specific for key words like SELECT, INSERT and so on.
Manual Activities
Attributes
Key
Value
Other Components
MM-IM-GF-MIG (Migration to the new material document data model)
Software Components
Software Component
And subsequent
S4CORE
S4CORE
X
This document refers to
SAP Note/KBA
Title
2378796
Material classification: Change in data model in SAP S/4HANA 1610
2242679
Redirect inconsistency - Proxy Substitution
2240878
MM-IM: Add customer include CI_COBL to MATDOC
2197392
Resolve findings of core ERP MM-IM S/4HANA pre checks
2194618
S4TC SAP_APPL - Checks for MM-IM
28022
Customer system: Where-used list for SAP Objects
This document is referenced by
SAP
Note/KBA
Title
3216468
Procurement - Inventory Management - Standard behaviors guide and How-to scenarios
2000002
FAQ: SAP HANA SQL Optimization
3163754
S/4HANA: History stock tables within the new data model for Inventory Management
3030981
Stock exchange table is not getting updated
3023744
S/4: sales order/project stock postings into non-valuated GR blocked stock - special stock fields usage in table
MATDOC
2995838
J_3RMOBVEDH Stock Overview (New). Issues after adaptation of the report to the new Inventory Management data
model
2753888
Increase Precheck performance: skip KALNR-check (class CLS4SIC_MM_IM_SI1)
2713495
S/4HANA: Performance issues in custom code when using the obsolete stock data model
2686694
How-To: MSEG - DBSQL_REDIRECT_INCONSISTENCY
2600991
DI_PCS_MRP: S4HANA MM-IM data model improvements
2592627
RRP: performance of MARC access
2569435
Remove content from obsolete tables in MM-IM: Save DB memory and remove data that is not covered by
Information Lifecycle Management
2493434
Restriction note for inventory management data conversion
2425478
Proxy substitution: Reset to SAP delivered proxy
2345668
Resolve findings of ERP IS-OIL S/4HANA pre checks
2319579
S4TWL - Performance optimizations within Material Document Processing - lock behavior and stock underrun
protection
2236753
S/4HANA MM-IM migration: error, post-processing and info messages
2281657
S/4HANA MM-IM migration by SUM with sMIG feature
2270451
MM-IM S/4HANA customer fields in MKPF or MSEG are not updated with MB_CHANGE_DOCUMENT into
MATDOC
2259038
S/4HANA: Partitioning of table MATDOC
2249800
MM-IM: Number of table entries to be migrated to S/4HANA
2246602
Precompacting scheduling in case system performance gets slowed down during a posting period
2197392
Resolve findings of core ERP MM-IM S/4HANA pre checks
2242679
Redirect inconsistency - Proxy Substitution
2238690
S/4HANA MM-IM migration by SUM
2197379
Resolve findings of DIMP specific MM-IM S/4HANA pre checks
Attachments
File Name
File Size
Mime Type
SI1_Logistics_MM_IM_New_Datamodel.pdf
1131
application/pdf
Download