I_RO_SAFTSTOCKMOVEMENTLINE
Stock Movement Line Items
I_RO_SAFTSTOCKMOVEMENTLINE is a CDS View in S/4HANA. Stock Movement Line Items. 2 CDS views read from this table.
CDS Views using this table (2)
| View | Type | Join | VDM | Description |
|---|---|---|---|---|
| C_RO_SAFTStockMovementLine | view | from | CONSUMPTION | RO SAFT Stock Movement Line |
| I_RO_SAFTStkMovementHeader | view | inner | COMPOSITE | Romania SAFT Stock Movement Header |
@AbapCatalog.sqlViewName: 'IROSAFTSTKMVTITM'
@AbapCatalog.compiler.compareFilter: true
//@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #MANDATORY
@VDM.viewType: #COMPOSITE
@ObjectModel: {
usageType: { sizeCategory: #XXL,
dataClass: #MIXED,
serviceQuality: #D } }
@ClientHandling.algorithm: #SESSION_VARIABLE
@Analytics.dataCategory:#DIMENSION
@Analytics.internalName:#LOCAL
@Metadata.allowExtensions:true
@EndUserText.label: 'Stock Movement Line Items'
define view I_RO_SAFTStockMovementLine
with parameters P_Ledger : fagl_rldnr,
P_AlternativeGLAccountIsUsed : boolean
as select from I_GLAccountLineItemRawData as _Acdoca
inner join I_RO_SAFTMaterialDocumentItem as _Matdoc on _Matdoc.MaterialDocument = _Acdoca.ReferenceDocument
and _Matdoc.MaterialDocumentYear = _Acdoca.ReferenceDocumentContext
and _Matdoc.MaterialDocumentLine = _Acdoca.ReferenceDocumentItem
inner join I_CompanyCode as _CompanyCode
on _Acdoca.CompanyCode = _CompanyCode.CompanyCode
inner join I_RO_SAFTDocumentTypeMap as _DocumentMap
on _DocumentMap.CompanyCode = _Acdoca.CompanyCode
and _DocumentMap.AccountingDocumentType = _Acdoca.AccountingDocumentType
and _DocumentMap.RO_SAFTSourceDocumentType = '05'
association [0..1] to I_ProductUnitsOfMeasure
as _ProductUom
on _Matdoc.Product = _ProductUom.Product
and _Matdoc.AlternativeUnit = _ProductUom.AlternativeUnit
association [0..1] to I_RO_SAFTUnitOfMeasureMap
as _Uom on _Matdoc.AlternativeUnit = _Uom.SourceUnitOfMeasure
association [0..*] to I_RO_BusinessPartnerTaxType
as _DCustomer on _DCustomer.BusinessPartner = _Acdoca.Customer
and _DCustomer.BusinessPartnerIsSAFTRelevant = 'X'
and _DCustomer.TaxType = '6'
and _DCustomer.FinancialAccountType = 'D'
and _DCustomer.ValidFrom <= $session.system_date
and _DCustomer.ValidTo >= $session.system_date
and _DCustomer.VATRegistration is not initial
association [0..*] to I_RO_BusinessPartnerTaxType
as _KSupplier on _KSupplier.BusinessPartner = _Acdoca.Supplier
and _KSupplier.BusinessPartnerIsSAFTRelevant = 'X'
and _KSupplier.TaxType = '6'
and _KSupplier.FinancialAccountType = 'K'
and _KSupplier.ValidFrom <= $session.system_date
and _KSupplier.ValidTo >= $session.system_date
and _KSupplier.VATRegistration is not initial
association [0..1] to I_GLAccountInCompanyCode
as _GLAccount on _GLAccount.CompanyCode = _Acdoca.CompanyCode
and _GLAccount.GLAccount = _Acdoca.GLAccount
association [0..1] to I_RO_SAFTMvtTypeTableEntry
as _MovementType1
on _MovementType1.GoodsMovementType = _Matdoc.GoodsMovementType
and _MovementType1.Plant = _Acdoca.Plant
and _MovementType1.TargetGLAccount = _Acdoca.GLAccount
and _MovementType1.AccountingDocumentType = _Acdoca.AccountingDocumentType
and _MovementType1.DebitCreditCode = _Acdoca.DebitCreditCode
association [0..1] to I_RO_SAFTMvtTypeTableEntry
as _MovementType2
on _MovementType2.GoodsMovementType = _Matdoc.GoodsMovementType
and _MovementType2.Plant = _Acdoca.Plant
and _MovementType2.TargetGLAccount = _Acdoca.GLAccount
and _MovementType2.AccountingDocumentType = _Acdoca.AccountingDocumentType
and _MovementType2.DebitCreditCode = ''
association [0..1] to I_RO_SAFTMvtTypeTableEntry
as _MovementType3
on _MovementType3.GoodsMovementType = _Matdoc.GoodsMovementType
and _MovementType3.Plant = _Acdoca.Plant
and _MovementType3.TargetGLAccount = _Acdoca.GLAccount
and _MovementType3.AccountingDocumentType = ''
and _MovementType3.DebitCreditCode = ''
association [0..1] to I_RO_SAFTMvtTypeTableEntry
as _MovementType4
on _MovementType4.GoodsMovementType = _Matdoc.GoodsMovementType
and _MovementType4.Plant = _Acdoca.Plant
and _MovementType4.TargetGLAccount = _Acdoca.GLAccount
and _MovementType4.AccountingDocumentType = ''
and _MovementType4.DebitCreditCode = _Acdoca.DebitCreditCode
association [0..1] to I_RO_SAFTMvtTypeTableEntry
as _MovementType5
on _MovementType5.GoodsMovementType = _Matdoc.GoodsMovementType
and _MovementType5.Plant = _Acdoca.Plant
and _MovementType5.TargetGLAccount = ''
and _MovementType5.AccountingDocumentType = _Acdoca.AccountingDocumentType
and _MovementType5.DebitCreditCode = _Acdoca.DebitCreditCode
association [0..1] to I_RO_SAFTMvtTypeTableEntry
as _MovementType6
on _MovementType6.GoodsMovementType = _Matdoc.GoodsMovementType
and _MovementType6.Plant = _Acdoca.Plant
and _MovementType6.TargetGLAccount = ''
and _MovementType6.AccountingDocumentType = ''
and _MovementType6.DebitCreditCode = ''
association [0..1] to I_RO_SAFTMvtTypeTableEntry
as _MovementType7
on _MovementType7.GoodsMovementType = _Matdoc.GoodsMovementType
and _MovementType7.Plant = ''
and _MovementType7.TargetGLAccount = ''
and _MovementType7.AccountingDocumentType = ''
and _MovementType7.DebitCreditCode = ''
{
key _Acdoca.AccountingDocument,
key _Acdoca.CompanyCode,
key _Acdoca.FiscalYear,
key _Acdoca.LedgerGLLineItem,
key _Matdoc.MaterialDocumentLine,
concat(
concat( _Acdoca.CompanyCode, _Acdoca.FiscalYear ),
concat( _Acdoca.AccountingDocumentType, _Acdoca.AccountingDocument ) ) as
BusinessTransactionTypeName,
_Acdoca.Product,
_Acdoca.Plant,
_Acdoca.DebitCreditCode,
_Acdoca.AccountingDocumentType,
_Acdoca.Quantity,
_Acdoca.PostingDate,
_Acdoca.DocumentDate,
_Acdoca.CompanyCodeCurrency,
@Semantics: { amount : {currencyCode: 'CompanyCodeCurrency'} }
_Acdoca.AmountInCompanyCodeCurrency as TransactionAmountInLocalCrcy,
_Acdoca.AccountingDocCreatedByUser as AccountingDocCreatedByUser,
cast(
case
when _Acdoca.FinancialAccountType = 'M'
then concat( '00', substring(_CompanyCode.VATRegistration, 3, 20) )
else
( case
when _DCustomer.VATRegistration is not null
then _DCustomer.VATRegistration
when _DCustomer.VATRegistration is null and _KSupplier.VATRegistration is null
then concat( '00', substring(_CompanyCode.VATRegistration, 3, 20) )
else
'0' end )
end as stceg ) as CustomerVATRegistration,
cast(
case
when _Acdoca.FinancialAccountType = 'M'
then concat( '00', substring(_CompanyCode.VATRegistration, 3, 20) )
else
( case
when _KSupplier.VATRegistration is not null
then _KSupplier.VATRegistration
when _KSupplier.VATRegistration is null and _DCustomer.VATRegistration is null
then concat( '00', substring(_CompanyCode.VATRegistration, 3, 20) )
else
'0' end )
end as stceg ) as SupplierVATRegistration,
_Matdoc.GoodsMovementType,
_Matdoc.Batch,
_Matdoc.MaterialDocumentItemText,
_Uom.SourceUnitOfMeasureFactor,
case
when _ProductUom.QuantityDenominator is not null
then division( _ProductUom.QuantityNumerator, _ProductUom.QuantityDenominator, 2)
else 0
end as ConversionFactor,
case $parameters.P_AlternativeGLAccountIsUsed
when 'X' then _Acdoca.CountryChartOfAccounts
else _Acdoca.ChartOfAccounts
end as ChartOfAccounts,
cast(
case $parameters.P_AlternativeGLAccountIsUsed
when 'X' then _GLAccount.AlternativeGLAccount
else _Acdoca.GLAccount
end as saknr ) as TargetGLAccount,
case
when _MovementType1.RO_SAFTMovementType is not initial
then _MovementType1.RO_SAFTMovementType
when _MovementType2.RO_SAFTMovementType is not initial
then _MovementType2.RO_SAFTMovementType
when _MovementType3.RO_SAFTMovementType is not initial
then _MovementType3.RO_SAFTMovementType
when _MovementType4.RO_SAFTMovementType is not initial
then _MovementType4.RO_SAFTMovementType
when _MovementType5.RO_SAFTMovementType is not initial
then _MovementType5.RO_SAFTMovementType
when _MovementType6.RO_SAFTMovementType is not initial
then _MovementType6.RO_SAFTMovementType
else _MovementType7.RO_SAFTMovementType
end as RO_SAFTMovementType
} where _Acdoca.SourceLedger = $parameters.P_Ledger
and _Acdoca.ReferenceDocumentType = 'MKPF'
// and _Acdoca.FinancialAccountType = 'M'
and ( _Acdoca.TransactionTypeDetermination = 'BSX'
or _Acdoca.TransactionTypeDetermination = 'KON' )
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_COMPANYCODE",
"I_GLACCOUNTINCOMPANYCODE",
"I_GLACCOUNTLINEITEMRAWDATA",
"I_PRODUCTUNITSOFMEASURE",
"I_RO_BUSINESSPARTNERTAXTYPE",
"I_RO_SAFTDOCUMENTTYPEMAP",
"I_RO_SAFTMATERIALDOCUMENTITEM",
"I_RO_SAFTMVTTYPETABLEENTRY",
"I_RO_SAFTUNITOFMEASUREMAP"
],
"ASSOCIATED":
[
"I_GLACCOUNTINCOMPANYCODE",
"I_PRODUCTUNITSOFMEASURE",
"I_RO_BUSINESSPARTNERTAXTYPE",
"I_RO_SAFTMVTTYPETABLEENTRY",
"I_RO_SAFTUNITOFMEASUREMAP"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/