@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #MANDATORY
@EndUserText.label: 'Payment for Workforce Person'
@VDM: {
viewType: #COMPOSITE,
lifecycle.contract.type: #SAP_INTERNAL_API
}
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType:{
serviceQuality: #C,
sizeCategory: #L,
dataClass: #MIXED
}
//@ObjectModel: { semanticKey: [ 'ValidityStartDate', 'ValidityEndDate'] }
//@Metadata.allowExtensions: true
define view entity R_WorkAssignmentPayment_2
as select from I_Supplier_to_BusinessPartner as _SupplierBP
inner join I_SupplierCompany as _SupplierCompany on _SupplierCompany.Supplier = _SupplierBP.Supplier
and _SupplierCompany.PaymentMethodsList <> ''
//Get Company Code Country
inner join I_CompanyCode as _CompanyCode on _CompanyCode.CompanyCode = _SupplierCompany.CompanyCode
association [0..1] to I_CurrencyText as _CurrencyText on _CurrencyText.Currency = $projection.Currency
and _CurrencyText.Language = $session.system_language
{
key _SupplierBP.BusinessPartnerUUID as WorkAssignmentUUID,
//FI Payment Method (T, P, F) in Char 10 format(the original concatinated ZWELS field)
_SupplierCompany.PaymentMethodsList,
//FI Payment Method (T, P, F) in Char 1 format(in-order to show in UI with concatinated Text)
cast( _SupplierCompany.PaymentMethodsList as farp_schzw_bseg ) as PaymentMethod,
_CompanyCode.Currency,
//Payment Currency. Its a Calculated field from F4 Help during runtime(because its not stored in any DB?).
cast( '' as farp_pycur ) as PaymentCurrency,
_SupplierCompany.CompanyCode as CompanyCode,
_CompanyCode.Country as CompanyCodeCountry,
_CurrencyText
}
//// as select from I_BusinessPartnerBank_2 as _BusinessPartnerBank
//
//
// inner join R_WorkAssignmentBP as _BuPaIdentification on _BuPaIdentification.WorkAssignmentBusinessPartner = _BusinessPartnerBank.BusinessPartner
//
// //Below association/Join is to get the WA UUID
// inner join I_BusinessPartner as _WorkAssignmentBP on _WorkAssignmentBP.BusinessPartner = _BuPaIdentification.WorkAssignmentBusinessPartner
// and _WorkAssignmentBP.BusinessPartnerCategory = '1'
//
// inner join R_WorkAssignmentTP on R_WorkAssignmentTP.WorkAssignmentUUID = _WorkAssignmentBP.BusinessPartnerUUID
//
// //Below association/Join is to get the Supplier (Payment should be available/displayed/fetched only if there is a supplier for that - Double check)
// inner join I_Supplier_to_BusinessPartner as _SupplierBP on _SupplierBP.BusinessPartnerUUID = _WorkAssignmentBP.BusinessPartnerUUID
//
// //Below association/join is to get the Supplier Master from Supplier (Payment Method List)
// inner join I_SupplierCompany as _SupplierCompany on _SupplierCompany.Supplier = _SupplierBP.Supplier
// and _SupplierCompany.CompanyCode = R_WorkAssignmentTP.CompanyCode
// and _SupplierCompany.PaymentMethodsList <> ''
//
// //Get Company Code Country
// inner join I_CompanyCode as _CompanyCode on _CompanyCode.CompanyCode = R_WorkAssignmentTP.CompanyCode
//
// //Get Payment Method - TBD
// left outer to one join R_PaymentMethod as _PaymentMethod on _PaymentMethod.CompanyCodeCountry = _CompanyCode.Country
// and _PaymentMethod.BankCountryKey = _BusinessPartnerBank.BankCountryKey
// and _PaymentMethod.PaymentMethod = _SupplierCompany.PaymentMethodsList
//
// //Payment Method Text
// association [0..1] to R_PaymentMethodText as _PaymentMethodText on _PaymentMethodText.PaymentMethodInEmplCentral = $projection.PaymentMethodInEmplCentral
// and _PaymentMethodText.Language = $session.system_language
// //FI Payment Method Text
// association [0..1] to I_PaymentMethodText as _FinancePaymentMethodText on _FinancePaymentMethodText.Country = $projection.CompanyCodeCountry //TBD $projection.BankCountryKey
// and _FinancePaymentMethodText.PaymentMethod = $projection.PaymentMethod
// and _FinancePaymentMethodText.Language = $session.system_language
//// association [0..1] to I_CountryText as _CountryText on $projection.BankCountryKey = _CountryText.Country
//// and _CountryText.Language = $session.system_language
// association [0..1] to I_CurrencyText as _CurrencyText on $projection.Currency = _CurrencyText.Currency
// and _CurrencyText.Language = $session.system_language
//
// //Below association required for deriving PersonUUID - because BDEF authorization/lock is depends on PersonUUID
// association [1..1] to I_BusinessPartner as _WorkforcePersonBP on _WorkforcePersonBP.BusinessPartner = _BuPaIdentification.BusinessPartner
//
// //Below associations for handling DCL
// association [1..1] to R_WorkforcePersonTP as _WorkforcePerson on $projection.PersonUUID = _WorkforcePerson.PersonUUID
// association to parent R_WorkAssignmentTP as _WorkAssignment on $projection.WorkAssignmentUUID = _WorkAssignment.WorkAssignmentUUID
//{
// key _WorkAssignmentBP.BusinessPartnerUUID as WorkAssignmentUUID,
// key _BusinessPartnerBank.BankIdentification as BankIdentification,
// _BuPaIdentification.WorkforceAssignment as WorkforceAssignment,
//// _BusinessPartnerBank.BankAccountHolderName as BankAccountHolderName,
//// _BusinessPartnerBank.BankAccountName as BankAccountName,
//// _BusinessPartnerBank.BankControlKey as BankControlKey,
//// _BusinessPartnerBank.BankCountryKey as BankCountryKey,
//// _BusinessPartnerBank.BankNumber as Bank,
//// _BusinessPartnerBank.BankName as BankName,
//// _BusinessPartnerBank.BankAccount as BankAccount,
//// _BusinessPartnerBank.IBAN as IBAN,
//// _BusinessPartnerBank.SWIFTCode as SWIFTCode,
// _PaymentMethod.PaymentMethodInEmplCentral,
// //FI Payment Method (T, P, F)
// cast( _SupplierCompany.PaymentMethodsList as farp_schzw_bseg ) as PaymentMethod,
// //Company Currency.
// _CompanyCode.Currency,
// //Payment Currency. Its a Calculated field.
// cast( '' as farp_pycur ) as PaymentCurrency,
//
//// @Semantics.businessDate.from: true
//// case when _BusinessPartnerBank.ValidityStartDate != 00010101000000
//// then tstmp_to_dats(_BusinessPartnerBank.ValidityStartDate,'UTC', $session.client, 'NULL')
//// else cast ( '00010101' as abap.dats )
//// end as ValidityStartDate,
//// @Semantics.businessDate.to: true
//// case when _BusinessPartnerBank.ValidityEndDate != 00010101000000
//// then tstmp_to_dats(_BusinessPartnerBank.ValidityEndDate,'UTC', $session.client, 'NULL')
//// else cast ( '99991231' as abap.dats)
//// end as ValidityEndDate,
//
//// cast(_BusinessPartnerBank.BankAccountReferenceText as refbk) as BankReference,
//
// _SupplierCompany.CompanyCode as CompanyCode,
// _CompanyCode.Country as CompanyCodeCountry,
// _BusinessPartnerBank.BusinessPartner,
// _WorkforcePersonBP.BusinessPartnerUUID as PersonUUID,
// _WorkAssignment,
// _WorkforcePerson,
//// _CountryText,
// _CurrencyText,
// _PaymentMethodText,
// _FinancePaymentMethodText
//}