I_AcctgDocItmForChgDoc

DDL: I_ACCTGDOCITMFORCHGDOC Type: view BASIC

Accounting Documents

I_AcctgDocItmForChgDoc is a Basic CDS View that provides data about "Accounting Documents" in SAP S/4HANA. It reads from 7 data sources and exposes 44 fields with key fields DatabaseTable, AccountingDocumentItem, DatabaseTable, AccountingDocumentItem, DatabaseTable.

Data Sources (7)

SourceAliasJoin Type
bseg AccountingDocSeg from
bseg AccountingDocSeg union_all
bseg AccountingDocSeg union_all
bseg AccountingDocSeg union_all
bsed AccountingDocSegBillOfExchng inner
bsec AccountingDocSegOneTime inner
bset AccountingDocSegTax inner

Annotations (12)

NameValueLevelField
AbapCatalog.sqlViewName IACCDOCITM4CD view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #NOT_REQUIRED view
AccessControl.personalData.blocking #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view
EndUserText.label Accounting Documents view
ObjectModel.usageType.serviceQuality #X view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.dataClass #TRANSACTIONAL view
VDM.viewType #BASIC view
VDM.private false view

Fields (44)

KeyFieldSource TableSource FieldDescription
KEY DatabaseTable
KEY AccountingDocumentItem buzei
AccountingDocument
CompanyCode bukrs
FiscalYear gjahr
GLAccount hkont
Customer kunnr
Supplier lifnr
PostingKey bschl
AccountType koart
buzei4endasChangeDocumentTableKey
KEY DatabaseTable
KEY AccountingDocumentItem bseg buzei
AccountingDocument
CompanyCode bset bukrs
FiscalYear bset gjahr
GLAccount bseg hkont
Customer kunnr
Supplier lifnr
PostingKey bschl
AccountType koart
buzei4endasChangeDocumentTableKey
KEY DatabaseTable
KEY AccountingDocumentItem bseg buzei
AccountingDocument
CompanyCode bsed bukrs
FiscalYear bsed gjahr
GLAccount hkont
Customer kunnr
Supplier lifnr
PostingKey bschl
AccountType koart
buzei4endasChangeDocumentTableKey
KEY DatabaseTable
KEY AccountingDocumentItem bseg buzei
AccountingDocument
CompanyCode bsec bukrs
FiscalYear bsec gjahr
GLAccount hkont
Customer kunnr
Supplier lifnr
PostingKey bschl
AccountType koart
SpecialGLCode umskz
@AbapCatalog: {
    sqlViewName: 'IACCDOCITM4CD',
    compiler.compareFilter: true,
    preserveKey:true
}
@AccessControl: {
    authorizationCheck: #NOT_REQUIRED,
    personalData.blocking: #NOT_REQUIRED
}
@ClientHandling.algorithm: #SESSION_VARIABLE
@EndUserText.label: 'Accounting Documents'
@ObjectModel.usageType: {
    serviceQuality: #X,
    sizeCategory: #XL,
    dataClass: #TRANSACTIONAL
}
@VDM: {
    viewType: #BASIC,
    private: false
}

define view I_AcctgDocItmForChgDoc
  as select from bseg as AccountingDocSeg
{
  key case length( bukrs )
            when 4 then  ( concat(mandt,  concat(bukrs, concat(belnr, concat(gjahr, buzei) ) ) ) )      
            when 3 then  ( concat(mandt,  concat_with_space(bukrs, concat(belnr, concat(gjahr, buzei) ), 1 ) ) )
            when 2 then  ( concat(mandt,  concat_with_space(bukrs, concat(belnr, concat(gjahr, buzei) ), 2 ) ) ) 
            when 1 then  ( concat(mandt,  concat_with_space(bukrs, concat(belnr, concat(gjahr, buzei) ), 3 ) ) )
            else         ( concat(mandt,  concat_with_space(bukrs, concat(belnr, concat(gjahr, buzei) ), 4 ) ) )    
      end as ChangeDocumentTableKey,


  key cast( 'BSEG' as farp_database_table_name ) as DatabaseTable,
  key buzei                                      as AccountingDocumentItem,
      cast( belnr as farp_belnr_d )              as AccountingDocument,
      bukrs                                      as CompanyCode,
      gjahr                                      as FiscalYear,
      hkont                                      as GLAccount,
      kunnr                                      as Customer,
      lifnr                                      as Supplier,
      bschl                                      as PostingKey,
      koart                                      as AccountType,
      umskz                                      as SpecialGLCode
}

union all select from bseg as AccountingDocSeg
  inner join          bset as AccountingDocSegTax on  AccountingDocSeg.bukrs = AccountingDocSegTax.bukrs
                                                  and AccountingDocSeg.belnr = AccountingDocSegTax.belnr
                                                  and AccountingDocSeg.gjahr = AccountingDocSegTax.gjahr
{
  key case length( AccountingDocSegTax.bukrs )
            when 4 then  ( concat(AccountingDocSegTax.mandt,  concat(AccountingDocSegTax.bukrs, concat(AccountingDocSegTax.belnr, concat(AccountingDocSegTax.gjahr, AccountingDocSegTax.buzei) ) ) ) )      
            when 3 then  ( concat(AccountingDocSegTax.mandt,  concat_with_space(AccountingDocSegTax.bukrs, concat(AccountingDocSegTax.belnr, concat(AccountingDocSegTax.gjahr, AccountingDocSegTax.buzei) ), 1 ) ) )
            when 2 then  ( concat(AccountingDocSegTax.mandt,  concat_with_space(AccountingDocSegTax.bukrs, concat(AccountingDocSegTax.belnr, concat(AccountingDocSegTax.gjahr, AccountingDocSegTax.buzei) ), 2 ) ) ) 
            when 1 then  ( concat(AccountingDocSegTax.mandt,  concat_with_space(AccountingDocSegTax.bukrs, concat(AccountingDocSegTax.belnr, concat(AccountingDocSegTax.gjahr, AccountingDocSegTax.buzei) ), 3 ) ) )
            else         ( concat(AccountingDocSegTax.mandt,  concat_with_space(AccountingDocSegTax.bukrs, concat(AccountingDocSegTax.belnr, concat(AccountingDocSegTax.gjahr, AccountingDocSegTax.buzei) ), 4 ) ) )    
      end as ChangeDocumentTableKey,
  key cast( 'BSET' as farp_database_table_name )        as DatabaseTable,
  key AccountingDocSeg.buzei                            as AccountingDocumentItem,
      cast( AccountingDocSegTax.belnr as farp_belnr_d ) as AccountingDocument,
      AccountingDocSegTax.bukrs                         as CompanyCode,
      AccountingDocSegTax.gjahr                         as FiscalYear,
      AccountingDocSeg.hkont                            as GLAccount,
      kunnr                                             as Customer,
      lifnr                                             as Supplier,
      bschl                                             as PostingKey,
      koart                                             as AccountType,
      umskz                                             as SpecialGLCode
}

union all select from bseg as AccountingDocSeg
  inner join          bsed as AccountingDocSegBillOfExchng on  AccountingDocSegBillOfExchng.bukrs = AccountingDocSeg.bukrs
                                                           and AccountingDocSegBillOfExchng.belnr = AccountingDocSeg.belnr
                                                           and AccountingDocSegBillOfExchng.gjahr = AccountingDocSeg.gjahr
{

  key case length( AccountingDocSegBillOfExchng.bukrs )
            when 4 then  ( concat(AccountingDocSegBillOfExchng.mandt,  concat(AccountingDocSegBillOfExchng.bukrs, concat(AccountingDocSegBillOfExchng.belnr, concat(AccountingDocSegBillOfExchng.gjahr, AccountingDocSegBillOfExchng.buzei) ) ) ) )      
            when 3 then  ( concat(AccountingDocSegBillOfExchng.mandt,  concat_with_space(AccountingDocSegBillOfExchng.bukrs, concat(AccountingDocSegBillOfExchng.belnr, concat(AccountingDocSegBillOfExchng.gjahr, AccountingDocSegBillOfExchng.buzei) ), 1 ) ) )
            when 2 then  ( concat(AccountingDocSegBillOfExchng.mandt,  concat_with_space(AccountingDocSegBillOfExchng.bukrs, concat(AccountingDocSegBillOfExchng.belnr, concat(AccountingDocSegBillOfExchng.gjahr, AccountingDocSegBillOfExchng.buzei) ), 2 ) ) ) 
            when 1 then  ( concat(AccountingDocSegBillOfExchng.mandt,  concat_with_space(AccountingDocSegBillOfExchng.bukrs, concat(AccountingDocSegBillOfExchng.belnr, concat(AccountingDocSegBillOfExchng.gjahr, AccountingDocSegBillOfExchng.buzei) ), 3 ) ) )
            else         ( concat(AccountingDocSegBillOfExchng.mandt,  concat_with_space(AccountingDocSegBillOfExchng.bukrs, concat(AccountingDocSegBillOfExchng.belnr, concat(AccountingDocSegBillOfExchng.gjahr, AccountingDocSegBillOfExchng.buzei) ), 4 ) ) )   
            end as ChangeDocumentTableKey,
  key cast( 'BSED' as farp_database_table_name )                 as DatabaseTable,
  key AccountingDocSeg.buzei                                     as AccountingDocumentItem,
      cast( AccountingDocSegBillOfExchng.belnr as farp_belnr_d ) as AccountingDocument,
      AccountingDocSegBillOfExchng.bukrs                         as CompanyCode,
      AccountingDocSegBillOfExchng.gjahr                         as FiscalYear,
      hkont                                                      as GLAccount,
      kunnr                                                      as Customer,
      lifnr                                                      as Supplier,
      bschl                                                      as PostingKey,
      koart                                                      as AccountType,
      umskz                                                      as SpecialGLCode
}

union all select from bseg as AccountingDocSeg
  inner join          bsec as AccountingDocSegOneTime on  AccountingDocSegOneTime.bukrs = AccountingDocSeg.bukrs
                                                      and AccountingDocSegOneTime.belnr = AccountingDocSeg.belnr
                                                      and AccountingDocSegOneTime.gjahr = AccountingDocSeg.gjahr
{

  key case length( AccountingDocSegOneTime.bukrs )
            when 4 then  ( concat(AccountingDocSegOneTime.mandt,  concat(AccountingDocSegOneTime.bukrs, concat(AccountingDocSegOneTime.belnr, concat(AccountingDocSegOneTime.gjahr, AccountingDocSegOneTime.buzei) ) ) ) )      
            when 3 then  ( concat(AccountingDocSegOneTime.mandt,  concat_with_space(AccountingDocSegOneTime.bukrs, concat(AccountingDocSegOneTime.belnr, concat(AccountingDocSegOneTime.gjahr, AccountingDocSegOneTime.buzei) ), 1 ) ) )
            when 2 then  ( concat(AccountingDocSegOneTime.mandt,  concat_with_space(AccountingDocSegOneTime.bukrs, concat(AccountingDocSegOneTime.belnr, concat(AccountingDocSegOneTime.gjahr, AccountingDocSegOneTime.buzei) ), 2 ) ) ) 
            when 1 then  ( concat(AccountingDocSegOneTime.mandt,  concat_with_space(AccountingDocSegOneTime.bukrs, concat(AccountingDocSegOneTime.belnr, concat(AccountingDocSegOneTime.gjahr, AccountingDocSegOneTime.buzei) ), 3 ) ) )
            else         ( concat(AccountingDocSegOneTime.mandt,  concat_with_space(AccountingDocSegOneTime.bukrs, concat(AccountingDocSegOneTime.belnr, concat(AccountingDocSegOneTime.gjahr, AccountingDocSegOneTime.buzei) ), 4 ) ) )   
            end as ChangeDocumentTableKey,
  key cast( 'BSEC' as farp_database_table_name )            as DatabaseTable,
  key AccountingDocSeg.buzei                                as AccountingDocumentItem,
      cast( AccountingDocSegOneTime.belnr as farp_belnr_d ) as AccountingDocument,
      AccountingDocSegOneTime.bukrs                         as CompanyCode,
      AccountingDocSegOneTime.gjahr                         as FiscalYear,
      hkont                                                 as GLAccount,
      kunnr                                                 as Customer,
      lifnr                                                 as Supplier,
      bschl                                                 as PostingKey,
      koart                                                 as AccountType,
      umskz                                                 as SpecialGLCode
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"BSEC",
"BSED",
"BSEG",
"BSET"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/