I_IN_StRpGSTAnnexCube

DDL: I_IN_STRPGSTANNEXCUBE SQL: ISTRPGSTANX Type: view COMPOSITE

Tax Item Details for GST Returns

I_IN_StRpGSTAnnexCube is a Composite CDS View (Cube) that provides data about "Tax Item Details for GST Returns" in SAP S/4HANA. It reads from 3 data sources (I_IN_GSTStateCodeMap, I_StRpJournalEntryLog, P_IN_GSTRowColumnTrnsfmtn) and exposes 39 fields with key fields CompanyCode, AccountingDocument, FiscalYear, StatryRptgEntity, StatryRptCategory.

Data Sources (3)

SourceAliasJoin Type
I_IN_GSTStateCodeMap _StateCode left_outer
I_StRpJournalEntryLog I_StRpJournalEntryLog left_outer
P_IN_GSTRowColumnTrnsfmtn P_IN_GSTRowColumnTrnsfmtn from

Parameters (5)

NameTypeDefault
P_CompanyCode bukrs
P_BusinessPlace bupla
P_StartDate datum
P_EndDate datum
P_IN_GSTRetType abap.char( 8 )

Annotations (16)

NameValueLevelField
AbapCatalog.sqlViewName ISTRPGSTANX view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
VDM.viewType #COMPOSITE view
AccessControl.authorizationCheck #CHECK view
Analytics.dataCategory #CUBE view
Analytics.internalName #LOCAL view
ClientHandling.type #CLIENT_DEPENDENT view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.dataClass #MIXED view
ClientHandling.algorithm #SESSION_VARIABLE view
Metadata.allowExtensions true view
EndUserText.label Tax Item Details for GST Returns view
VDM.lifecycle.status #DEPRECATED view
VDM.lifecycle.successor view

Fields (39)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode _TaxItem CompanyCode
KEY AccountingDocument _TaxItem AccountingDocument
KEY FiscalYear _TaxItem FiscalYear
KEY StatryRptgEntity I_StRpJournalEntryLog StatryRptgEntity
KEY StatryRptCategory I_StRpJournalEntryLog StatryRptCategory
KEY StatryRptRunID I_StRpJournalEntryLog StatryRptRunID
TaxCode TaxCode
TaxCalculationProcedure TaxCalculationProcedure
TaxRate TaxRate
DocumentReferenceID DocumentReferenceID
PostingDate PostingDate
TaxReportingDate TaxReportingDate
ReportingDate ReportingDate
FiscalPeriod FiscalPeriod
IsReversal IsReversal
IsReversed IsReversed
InvoiceReference InvoiceReference
InvoiceReferenceFiscalYear InvoiceReferenceFiscalYear
InvoiceItemReference InvoiceItemReference
FollowOnDocumentType FollowOnDocumentType
IN_GSTPlaceOfSupply IN_GSTPlaceOfSupply
IN_HSNOrSACCode IN_HSNOrSACCode
Country _TaxItem Country
CustomerTaxClassification CustomerTaxClassification
Customer Customer
Supplier Supplier
SupplierName SupplierName
TaxItemGroup TaxItemGroup
IN_GSTDocumentType IN_GSTDocumentType
DebitCreditCode DebitCreditCode
BusinessPartnerName BusinessPartnerName
BusinessPartner BusinessPartner
TaxNumber3 TaxNumber3
DocumentDate DocumentDate
FinancialAccountType FinancialAccountType
CompanyCodeCurrency CompanyCodeCurrency
BusinessPlace BusinessPlace
IN_GSTLegalStateCode I_IN_GSTStateCodeMap IN_GSTLegalStateCode
curr232endasIN_TotalGSTAmtInCoCodeCrcy
@AbapCatalog.sqlViewName: 'ISTRPGSTANX'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@VDM.viewType: #COMPOSITE
@AccessControl.authorizationCheck: #CHECK
@Analytics.dataCategory: #CUBE
@Analytics.internalName:#LOCAL
@ClientHandling.type : #CLIENT_DEPENDENT
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass: #MIXED
@ClientHandling.algorithm: #SESSION_VARIABLE
@Metadata.allowExtensions:true
@EndUserText.label: 'Tax Item Details for GST Returns'
@VDM.lifecycle.status: #DEPRECATED     //ATC fixes

@VDM.lifecycle.successor: ' '          //ATC Fixes



define view I_IN_StRpGSTAnnexCube
with parameters P_CompanyCode : bukrs,
                P_BusinessPlace : bupla,
                P_StartDate : datum,
                P_EndDate : datum,
                P_IN_GSTRetType : abap.char( 8 )
  as select from    P_IN_GSTRowColumnTrnsfmtn( P_SAPClient:$session.client , P_CompanyCode : $parameters.P_CompanyCode,
                                               P_BusinessPlace: $parameters.P_BusinessPlace, P_StartDate: $parameters.P_StartDate,
                                               P_EndDate : $parameters.P_EndDate ) as _TaxItem

    left outer join I_StRpJournalEntryLog                                                  on  I_StRpJournalEntryLog.CompanyCode        = _TaxItem.CompanyCode
                                                                                           and I_StRpJournalEntryLog.AccountingDocument = _TaxItem.AccountingDocument
                                                                                           and I_StRpJournalEntryLog.FiscalYear         = _TaxItem.FiscalYear

    left outer join I_IN_GSTStateCodeMap                                     as _StateCode on  _StateCode.Country = 'IN'
                                                                                           and _StateCode.Region  = _TaxItem.IN_GSTPlaceOfSupply
{
  key _TaxItem.CompanyCode,
  key _TaxItem.AccountingDocument,
  key _TaxItem.FiscalYear,
  key I_StRpJournalEntryLog.StatryRptgEntity,
  key I_StRpJournalEntryLog.StatryRptCategory,
  key I_StRpJournalEntryLog.StatryRptRunID,
      TaxCode,
      TaxCalculationProcedure,
      //      @Semantics.amount.currencyCode: 'CompanyCodeCurrency'

      TaxRate,
      DocumentReferenceID,
      PostingDate,
      TaxReportingDate,
      ReportingDate,
      FiscalPeriod,
      IsReversal,
      IsReversed,
      InvoiceReference,
      InvoiceReferenceFiscalYear,
      InvoiceItemReference,
      FollowOnDocumentType,
      IN_GSTPlaceOfSupply,
      IN_HSNOrSACCode,
      _TaxItem.Country,
      CustomerTaxClassification,
      Customer,
      Supplier,
      SupplierName,
      TaxItemGroup,
//      IN_GSTSection,

      IN_GSTDocumentType,
      DebitCreditCode,
      BusinessPartnerName,
      BusinessPartner,
      TaxNumber3,
      DocumentDate,
      FinancialAccountType,
      CompanyCodeCurrency,
      BusinessPlace,
      _StateCode.IN_GSTLegalStateCode,

      @DefaultAggregation:#SUM
      @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
    case
//    Since B2C is summarization level reporting, we need to report net of Dedit and Credit

      when ( IN_GSTSection = 'B2C' and FinancialAccountType = 'D' )
        then
           (AmountInCompanyCodeCurrency) * -1
           
//   Since REV, IMPS is on summarization level, we need to report net of debit, credit and Advances

      when ( ( IN_GSTSection = 'REV' or IN_GSTSection = 'IMPS' )
         and ( FinancialAccountType = 'K' ) )
        then
           (AmountInCompanyCodeCurrency)
           
//  For ANX2 Information

      when ( IN_GSTSection = 'B2B' or IN_GSTSection = 'SEZWP' or IN_GSTSection = 'SEZWOP' or IN_GSTSection = 'DE')
       and (FinancialAccountType = 'K' )
        then
           (AmountInCompanyCodeCurrency)
          else
        abs( AmountInCompanyCodeCurrency)
      end as AmountInCompanyCodeCurrency,

      @DefaultAggregation:#SUM
      @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
    case
      //    Since B2C is summarization level reporting, we need to report net of Dedit and Credit

      when ( IN_GSTSection = 'B2C' and FinancialAccountType = 'D' )
        then
            (TaxBaseAmountInRptgCrcy) * -1
//   Since REV, IMPS is on summarization level, we need to report net of debit, credit and Advances

       when ( ( IN_GSTSection = 'REV' or IN_GSTSection = 'IMPS' )
          and ( FinancialAccountType = 'K' ) )
        then
              (TaxBaseAmountInRptgCrcy)
//  ANX2

       when ( IN_GSTSection = 'B2B' or IN_GSTSection = 'SEZWP' or IN_GSTSection = 'SEZWOP' or IN_GSTSection = 'DE')
        and (FinancialAccountType = 'K' )
        then
            (TaxBaseAmountInRptgCrcy)
        else
         abs(TaxBaseAmountInRptgCrcy)
      end as TaxBaseAmountInRptgCrcy,

      @DefaultAggregation:#SUM
      @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
    case
//    Since B2C is summarization level reporting, we need to report net of Dedit and Credit

      when ( IN_GSTSection = 'B2C' and FinancialAccountType = 'D' )
        then
           (IN_CentralGSTAmount) * -1
//   Since REV, IMPS is on summarization level, we need to report net of debit, credit and Advances

       when ( ( IN_GSTSection = 'REV' or IN_GSTSection = 'IMPS' )
              and ( FinancialAccountType = 'K' ) )
             then
               ( IN_CentralGSTAmount )
//  ANX2

      when ( IN_GSTSection = 'B2B' or IN_GSTSection = 'SEZWP' or IN_GSTSection = 'SEZWOP' or IN_GSTSection = 'DE')
       and (FinancialAccountType = 'K' )
          then
           (IN_CentralGSTAmount)
      else
        abs(IN_CentralGSTAmount)
      end as IN_CentralGSTAmount,

      @DefaultAggregation:#SUM
      @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
    case
//    Since B2C is summarization level reporting, we need to report net of Dedit and Credit

      when ( IN_GSTSection = 'B2C' and FinancialAccountType = 'D' )// and DebitCreditCode = 'S' )

        then
            (IN_StateGSTAmount) * -1
//   Since REV, IMPS is on summarization level, we need to report net of debit, credit and Advances

      when ( ( IN_GSTSection = 'REV' or IN_GSTSection = 'IMPS' )
         and ( FinancialAccountType = 'K' ) )
             then
             (IN_StateGSTAmount)
//  ANX2 Information

          when ( IN_GSTSection = 'B2B' or IN_GSTSection = 'SEZWP' or IN_GSTSection = 'SEZWOP' or IN_GSTSection = 'DE')
           and (FinancialAccountType = 'K' )
          then
               (IN_StateGSTAmount)
      else
           abs(IN_StateGSTAmount)
      end as IN_StateGSTAmount,

      @DefaultAggregation:#SUM
      @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
  case
     when IN_IntegratedCessAmount <> 0.0
      then
  case
     when ( IN_GSTSection = 'B2C' and FinancialAccountType = 'D' )
      then IN_IntegratedCessAmount * -1
//   Since REV, IMPS is on summarization level, we need to report net of debit, credit and Advances

     when ( ( IN_GSTSection = 'REV' or IN_GSTSection = 'IMPS' )
        and ( FinancialAccountType = 'K' ) )
         then
            ( IN_IntegratedCessAmount )
//ANX2

     when ( IN_GSTSection = 'B2B' or IN_GSTSection = 'SEZWP' or IN_GSTSection = 'SEZWOP' or IN_GSTSection = 'DE')
      and (FinancialAccountType = 'K' )
        then IN_IntegratedCessAmount
      else
        abs (IN_IntegratedCessAmount)
           end
      else
  case
     when IN_StateCessAmount <> 0.0
       then
         case
            when ( IN_GSTSection = 'B2C' and FinancialAccountType = 'D' )
            then IN_StateCessAmount * -1
//   Since REV, IMPS is on summarization level, we need to report net of debit, credit and Advances

     when ( ( IN_GSTSection = 'REV' or IN_GSTSection = 'IMPS' )
        and ( FinancialAccountType = 'K' ) )
          then
            ( IN_StateCessAmount )
//ANX2

     when ( IN_GSTSection = 'B2B' or IN_GSTSection = 'SEZWP' or IN_GSTSection = 'SEZWOP' or IN_GSTSection = 'DE')
      and (FinancialAccountType = 'K' )
          then IN_StateCessAmount
      else
          abs (IN_StateCessAmount)
      end
          end
      end as IN_CessGSTAmtInCoCodeCrcy,
      
      @DefaultAggregation:#SUM
      @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
   case
//    Since B2C is summarization level reporting, we need to report net of Dedit and Credit

    when ( IN_GSTSection = 'B2C' and FinancialAccountType = 'D' )//and DebitCreditCode = 'S' )

        then
         (IN_IntegratedGSTAmount) * -1
//   Since REV, IMPS is on summarization level, we need to report net of debit, credit and Advances

    when ( ( IN_GSTSection = 'REV' or IN_GSTSection = 'IMPS' )
       and ( FinancialAccountType = 'K' ) )
         then
           (IN_IntegratedGSTAmount)
//  ANX2

    when ( IN_GSTSection = 'B2B' or IN_GSTSection = 'SEZWP' or IN_GSTSection = 'SEZWOP' or IN_GSTSection = 'DE')
     and (FinancialAccountType = 'K' )
      then
         (IN_IntegratedGSTAmount)
      else
      abs(IN_IntegratedGSTAmount)
      end as IN_IntegratedGSTAmount,

      @DefaultAggregation:#SUM
      @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
      case
      when ( IN_IntegratedGSTAmount = 0.0 )
         then cast ( ( abs(IN_CentralGSTAmount) + abs(IN_StateGSTAmount) + coalesce(abs(IN_StateCessAmount ),0))as abap.curr(23,2))
      else
         cast ( ( abs( IN_IntegratedGSTAmount ) + coalesce(abs(IN_IntegratedCessAmount ),0))as abap.curr(23,2))
      end as IN_TotalGSTAmtInCoCodeCrcy,

// Indicator to specify GST under Sec7Act

   case
     when ( IN_GSTSection = 'B2C' or IN_GSTSection = 'B2B' or IN_GSTSection = 'DE' )
      and ( FinancialAccountType = 'D' ) and ( IN_IntegratedGSTAmount is not initial )
      then
          'Y'
     when ( IN_GSTSection = 'REV' ) and ( FinancialAccountType = 'K' ) 
      and ( IN_IntegratedGSTAmount is not initial )
      then
          'Y'
      else
          'N'
      end as IN_GSTSection7,

   case ($parameters.P_IN_GSTRetType)
      when  'ANX2' 
      then
        case 
        when ( IN_GSTSection = 'IMPGSEZ' ) and ( IN_CentralGSTAmount = 0.0 ) and ( IN_IntegratedGSTAmount = 0.0 )
        then
          'SEZWOP'
        when ( IN_GSTSection = 'IMPGSEZ' ) 
        then 
           'SEZWP'
        else 
           IN_GSTSection    
        end  
      else 
           IN_GSTSection           
      end as IN_GSTSection         
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_IN_GSTSTATECODEMAP",
"I_STRPJOURNALENTRYLOG"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/