--@EndUserText.label: 'Analyze Payment Detail BCM Item'
--@Analytics.dataCategory: #FACT
@VDM.private: true
@VDM.viewType: #BASIC
@AccessControl.authorizationCheck: #CHECK //or #NOT_REQUIRED
@AbapCatalog.sqlViewName: 'PBCMITEM' //must start with "I"
@ClientHandling.algorithm: #SESSION_VARIABLE
@Metadata.ignorePropogatedAnnotations: true
define view P_Bcmitem
as select from bnk_batch_item as item
left outer join crm_jest as i_status
on item.status = i_status.objnr and i_status.inact <> 'X'
left outer join tj02t as i_status_text
on i_status.stat = i_status_text.istat and i_status_text.spras = $session.system_language --'E'
left outer join bnk_batch_header as header
on header.guid = item.guid and item.mandt = header.mandt
left outer join crm_jest as h_status on header.status = h_status.objnr and h_status.inact <> 'X' and header.mandt = h_status.mandt
left outer join tj02t as h_status_text on h_status.stat = h_status_text.istat and h_status_text.spras = $session.system_language --'E'
//left outer join usr21 as userinfo on header.cur_processor = userinfo.bname
//left outer join adrp as person on userinfo.persnumber = person.persnumber
//left outer join adcp as address on userinfo.persnumber = address.persnumber and userinfo.addrnumber = address.addrnumber
//left outer join adr6 as email on userinfo.persnumber = email.persnumber and userinfo.addrnumber = email.addrnumber
//left outer join tbnk_rule_t as rule on header.rule_id = rule.rule_id and rule.langu = $session.system_language --'E'
left outer join reguh as settlement
on settlement.laufd = item.laufd and settlement.laufi = item.laufi and settlement.xvorl = ' '
and settlement.zbukr = item.zbukr and settlement.lifnr = item.lifnr and settlement.kunnr = item.kunnr
and settlement.empfg = item.empfg and settlement.vblnr = item.vblnr
left outer join t015w as instruc on instruc.banks = settlement.ubnks and instruc.zlsch = settlement.rzawe and instruc.dtaws = settlement.dtaws
left outer join I_CompanyCode as cc on item.zbukr = cc.CompanyCode
left outer join I_FiscalCalendarDate as _FiscalCalendarDate on settlement.zaldt = _FiscalCalendarDate.CalendarDate and
cc.FiscalYearVariant = _FiscalCalendarDate.FiscalYearVariant
{
key item.vblnr as AccountingDocument,
key item.batch_no as PaymentBatch,
key item.item_no as PaymentBatchItem,
key header.batch_no as BatchNo,
//Fields for List Page
item.zbukr as CompanyCode,
_FiscalCalendarDate.FiscalYear,
item.hbkid as HouseBank,
i_status.stat as ObjectStatus,
//Fields for Detail Page
// person.name_text as UserName ,
//rule.text as RuleDesp ,
// address.tel_number as Telephone,
//address.fax_number as Fax,
// email.smtp_srch as Email ,
instruc.dturg as Urgency,
h_status_text.txt30 as PaymentBatchStatus,
h_status_text.istat as PaymentBatchStatusCode,
i_status_text.txt30 as PaymentBatchItemStatus,
i_status_text.istat as PaymentBatchItemStatusCode
}
where header.xreset = ''
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_COMPANYCODE",
"I_FISCALCALENDARDATE",
"BNK_BATCH_HEADER",
"BNK_BATCH_ITEM",
"CRM_JEST",
"REGUH",
"T015W",
"TJ02T"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/