Reputation: 335
I'm creating a report on SAP Inventory - not by ABAP or any other native tool, I have instead a direct connection to the database and use an external tool.
The MBEW
table has the following keys:
MANDT
MATNR
BWKEY
BWTAR
I know how to deal with the first 3, but I'm having a hard time with the last one. I got to understand that BWTAR
is related to "Split Valuation": an item may have different value depending on various conditions, like e.g. whether it comes from Procurement or from Production. If Split Valuation is enabled, Inventory Movements are recorded at the Batch level, in table MCHB
.
If I got it right, in any case stock is recorded in MBEW
at the Valuation Area level (which roughly corresponds to the Plant level) and in MARD
at the Inventory Location level, with the corresponding historical tables MBEWH
and MARDH
. MBEW
has values in it, whilst MARD
only has quantities. Conversely, it looks like records are put into MCHB
only if the Item is managed in Batches and/or with Split Valuation.
I'm trying to report at the Inventory Location level, including value. If the Item is not Split Valued, this should be doable by joining MARD
to MBEW
and using the latter to catch the unit value. If the Item is Split Valued, it is necessary to look at MCHB
joined to MCHA
to understand what is the Valuation Type (BWTAR
) for each Batch, and this gives the 4th key to lookup MBEW
and get the unit value.
My first question is whether what I have written up to now is correct - but I should be able to check by testing. My real problem is instead: how do I figure out whether an Item is Split Valued? I see there is a field called BWTTY
(Valuation Category) in MARC
, replicated in MBEW
, which is non empty when the Item is Split Valued; is that the right field to look at? And I found out that this field is not recorded in the history tables MARCH
and MBEWH
, which brings to my last (and most difficult, apparently) question: is it even possible for an Item to be Split Valued sometime in the past and not Split Valued in some other times?
Upvotes: 0
Views: 366
Reputation: 10621
You'd better use native tools like modules
BAPI_MATERIAL_AVAILABILITY
orBAPI_MATERIAL_STOCK_REQ_LIST
Manully recreating the logic of the stock query is tricky and would be much more time-consuming than you think.
Upvotes: 0