@AbapCatalog.sqlViewName: 'IBPCUSTSLSADDR'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@AccessControl.personalData.blocking: #REQUIRED
@EndUserText.label: 'BP and Cust sls Addr Depdnt Info'
@ClientHandling.algorithm : #SESSION_VARIABLE
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.usageType.sizeCategory: #XXL
@ObjectModel.usageType.dataClass: #MASTER
@VDM.viewType: #BASIC
define view I_BPCustomerSalesAddressInfo
as select from I_BusPartAddress as BusinessPartnerAddress
inner join I_Businesspartnersalesarea as Businesspartnersalesarea on BusinessPartnerAddress.BusinessPartner = Businesspartnersalesarea.BusinessPartner
left outer to one join I_CustSlsAreaAddrDepdntInfo as CustSlsAreaAddrDepdntInfo on Businesspartnersalesarea.Customer = CustSlsAreaAddrDepdntInfo.Customer
and BusinessPartnerAddress.AddressID = CustSlsAreaAddrDepdntInfo.AddressID
and Businesspartnersalesarea.SalesOrganization = CustSlsAreaAddrDepdntInfo.SalesOrganization
and Businesspartnersalesarea.DistributionChannel = CustSlsAreaAddrDepdntInfo.DistributionChannel
and Businesspartnersalesarea.Division = CustSlsAreaAddrDepdntInfo.Division
association [1..1] to I_BusinessPartner as _BusinessPartner on _BusinessPartner.BusinessPartner = $projection.BusinessPartner
association [1..1] to I_Customer as _Customer on $projection.Customer = _Customer.Customer
{
key BusinessPartnerAddress.BusinessPartner as BusinessPartner,
key BusinessPartnerAddress.AddressID as AddressID,
key Businesspartnersalesarea.Customer as Customer,
key Businesspartnersalesarea.SalesOrganization as SalesOrganization,
key Businesspartnersalesarea.DistributionChannel as DistributionChannel,
key Businesspartnersalesarea.Division as Division,
// Fields common to both KNVV_ADDR and KNVV tables
// When an address number exists for customer sales address depdedent information, Fetch data from KNVV_ADDR table
// Else fetch data from KNVV table
case when CustSlsAreaAddrDepdntInfo.AddressID is not initial then CustSlsAreaAddrDepdntInfo.IncotermsClassification
else Businesspartnersalesarea.IncotermsClassification end as IncotermsClassification,
// case when CustSlsAreaAddrDepdntInfo.AddressID is not initial then CustSlsAreaAddrDepdntInfo.IncotermsTransferLocation
// else Businesspartnersalesarea.IncotermsTransferLocation end as IncotermsTransferLocation,
case when CustSlsAreaAddrDepdntInfo.AddressID is not initial then CustSlsAreaAddrDepdntInfo.IncotermsLocation1
else Businesspartnersalesarea.IncotermsLocation1 end as IncotermsLocation1,
case when CustSlsAreaAddrDepdntInfo.AddressID is not initial then CustSlsAreaAddrDepdntInfo.IncotermsLocation2
else Businesspartnersalesarea.IncotermsLocation2 end as IncotermsLocation2,
case when CustSlsAreaAddrDepdntInfo.AddressID is not initial then CustSlsAreaAddrDepdntInfo.IncotermsVersion
else Businesspartnersalesarea.IncotermsVersion end as IncotermsVersion,
// A delivery block value in the address-independent table KNVV shall count more than ‘No delivery block’ for any specific address.
//If for a specific combination (customer + address) a value is maintained, then this value has preference over the generic (address-independent) value in KNVV.
case when ( CustSlsAreaAddrDepdntInfo.AddressID is not initial and CustSlsAreaAddrDepdntInfo.DeliveryIsBlocked is not initial )
then CustSlsAreaAddrDepdntInfo.DeliveryIsBlocked
else Businesspartnersalesarea.DeliveryIsBlockedForCustomer end as DeliveryIsBlocked,
case when CustSlsAreaAddrDepdntInfo.AddressID is not initial then CustSlsAreaAddrDepdntInfo.SalesOffice
else Businesspartnersalesarea.SalesOffice end as SalesOffice,
case when CustSlsAreaAddrDepdntInfo.AddressID is not initial then CustSlsAreaAddrDepdntInfo.SalesGroup
else Businesspartnersalesarea.SalesGroup end as SalesGroup,
case when CustSlsAreaAddrDepdntInfo.AddressID is not initial then CustSlsAreaAddrDepdntInfo.SupplyingPlant
else Businesspartnersalesarea.SupplyingPlant end as SupplyingPlant,
case when CustSlsAreaAddrDepdntInfo.AddressID is not initial then CustSlsAreaAddrDepdntInfo.IncotermsSupChnLoc1AddlUUID
else Businesspartnersalesarea.IncotermsSupChnLoc1AddlUUID end as IncotermsSupChnLoc1AddlUUID,
case when CustSlsAreaAddrDepdntInfo.AddressID is not initial then CustSlsAreaAddrDepdntInfo.IncotermsSupChnLoc2AddlUUID
else Businesspartnersalesarea.IncotermsSupChnLoc2AddlUUID end as IncotermsSupChnLoc2AddlUUID,
case when CustSlsAreaAddrDepdntInfo.AddressID is not initial then CustSlsAreaAddrDepdntInfo.IncotermsSupChnDvtgLocAddlUUID
else Businesspartnersalesarea.IncotermsSupChnDvtgLocAddlUUID end as IncotermsSupChnDvtgLocAddlUUID,
// KNVV only fields
CustomerGroup,
AccountByCustomer,
CustomerABCClassification,
Currency,
CustomerPriceGroup,
//CustomerPricingProcedure,
DeliveryPriority,
OrderCombinationIsAllowed,
//DeliveryIsBlockedForCustomer,
CompleteDeliveryIsDefined,
PartialDeliveryIsAllowed,
// InvoiceDate,
CustomerPaymentTerms,
CustomerAccountAssignmentGroup,
SalesDistrict,
OrderIsBlockedForCustomer, //not in UI
PriceListType, //not in UI
_Customer.AuthorizationGroup as AuthorizationGroup,
//PaymentGuaranteeProcedure,
InvoiceListSchedule,
ExchangeRateType,
ItemOrderProbabilityInPercent,
AdditionalCustomerGroup1,
AdditionalCustomerGroup2,
AdditionalCustomerGroup3,
AdditionalCustomerGroup4,
AdditionalCustomerGroup5,
UnderdelivTolrtdLmtRatioInPct,
OverdelivTolrtdLmtRatioInPct,
MaxNmbrOfPartialDelivery,
SuplrIsRlvtForSettlmtMgmt,
ProductUnitGroup,
SlsDocIsRlvtForProofOfDeliv,
SlsUnlmtdOvrdelivIsAllwd,
CreditControlArea,
CustomerIsRebateRelevant,
InspSbstHasNoTimeOrQuantity,
ManualInvoiceMaintIsRelevant,
SalesItemProposal,
CustProdProposalProcedure,
_BusinessPartner,
_BPProtectedAddress,
_Customer
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_BUSINESSPARTNERSALESAREA",
"I_BUSPARTADDRESS",
"I_CUSTOMER",
"I_CUSTSLSAREAADDRDEPDNTINFO"
],
"ASSOCIATED":
[
"I_BPPROTECTEDADDRESS",
"I_BUSINESSPARTNER",
"I_CUSTOMER"
],
"BASE":
[
"I_BUSPARTADDRESS"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/