@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":""
}
}*/