@ObjectModel.usageType.sizeCategory: ‘L’ @ObjectModel.usageType.serviceQuality: #C @ObjectModel.usageType.dataClass: #TRANSACTIONAL @ClientHandling.algorithm: #AUTOMATED @AccessControl.authorizationCheck: #NOT_ALLOWED @AbapCatalog.viewEnhancementCategory: #PROJECTION_LIST define view nsdm_e_MKPF as select key mandt, key mblnr, key mjahr, vgart, blart, blaum, bldat, budat, cpudt, cputm, aedat, usnam, tcode, xblnr, bktxt, frath, frbnr, wever, xabln, awsys, bla2d, tcode2, bfwms, exnum, spe_budat_uhr, spe_budat_zone, le_vbeln, spe_logsys, spe_mdnum_ewm, gts_cusref_no, fls_rsto, msr_active / Fields which do belong to APPENDs on MSEG will be provided via EXTEND VIEW to this view. Hence, Industries having also APPENDs can use the same technique and just because the alphabetical sequence of APPENDs is also valid for EXTEND VIEW the compability will be ensured. The name of the IS EXTEND VIEW has to be the same as the APPEND. Rules are: ABAP Catalog Objekt: <Append>_V DDL Source <Append>_DDL CDS View = <Append>_E The alphabetical order of the EXTEND VIEW in the final proxy view is according to the name of sqlViewAppendName and not accroding to DDL source name or the EXTEND VIEW name! Hence there is still a restriction on 16 chars! / / DDL sources of known extensions so far: JVMKPF_DDL MILL_MKPF_DDL / from matdoc where record_type = ‘MDOC’ and header_counter = 1
define view nsdm_e_mard as select from mard as t left outer join nsdm_e_mard_diff as m on t.mandt = m.mandt and t.matnr = m.matnr and t.werks = m.werks and t.lgort = m.lgort association [0…1] to E_Productstoragelocation as _ActiveExtension on $projection.matnr = _ActiveExtension.Product and $projection.werks = _ActiveExtension.Plant and $projection.lgort = _ActiveExtension.StorageLocation { key t.mandt, key t.matnr, key t.werks, key t.lgort,
t.dummy_stl_incl_eew_ps, –Fields added for EA-RETAIL(FASHION) t.fsh_salloc_qty_s, case when m./cwm/labst is null then 0 else m./cwm/labst end as /cwm/labst, // note 2413597 case when m./cwm/insme is null then 0 else m./cwm/insme end as /cwm/insme, // note 2413597 case when m./cwm/einme is null then 0 else m./cwm/einme end as /cwm/einme, // note 2413597 case when m./cwm/speme is null then 0 else m./cwm/speme end as /cwm/speme, // note 2413597 case when m./cwm/retme is null then 0 else m./cwm/retme end as /cwm/retme, // note 2413597 case when m./cwm/umlme is null then 0 else m./cwm/umlme end as /cwm/umlme, // note 2413597 case when m./cwm/klabs is null then 0 else m./cwm/klabs end as /cwm/klabs, // note 2413597 case when m./cwm/kinsm is null then 0 else m./cwm/kinsm end as /cwm/kinsm, // note 2413597 case when m./cwm/keinm is null then 0 else m./cwm/keinm end as /cwm/keinm, // note 2413597 case when m./cwm/kspem is null then 0 else m./cwm/kspem end as /cwm/kspem, // note 2413597 case when m./cwm/vmlab is null then 0 else m./cwm/vmlab end as /cwm/vmlab, // note 2413597 case when m./cwm/vmins is null then 0 else m./cwm/vmins end as /cwm/vmins, // note 2413597 case when m./cwm/vmein is null then 0 else m./cwm/vmein end as /cwm/vmein, // note 2413597 case when m./cwm/vmspe is null then 0 else m./cwm/vmspe end as /cwm/vmspe, // note 2413597 case when m./cwm/vmret is null then 0 else m./cwm/vmret end as /cwm/vmret, // note 2413597 case when m./cwm/vmuml is null then 0 else m./cwm/vmuml end as /cwm/vmuml // note 2413597
sum(case lbbsa when ‘01’ then case sobkz when ‘’ then stock_qty else 0 end else 0 end) as labst, sum(case lbbsa when ‘04’ then case sobkz when ‘’ then stock_qty else 0 end else 0 end) as umlme, sum(case lbbsa when ‘02’ then case sobkz when ‘’ then stock_qty else 0 end else 0 end) as insme, sum(case lbbsa when ‘08’ then case sobkz when ‘’ then stock_qty else 0 end else 0 end) as einme, sum(case lbbsa when ‘07’ then case sobkz when ‘’ then stock_qty else 0 end else 0 end) as speme, sum(case lbbsa when ‘03’ then case sobkz when ‘’ then stock_qty else 0 end else 0 end) as retme,
cast(0 as abap.quan(13, 3)) as vmlab, cast(0 as abap.quan(13, 3)) as vmuml, cast(0 as abap.quan(13, 3)) as vmins, cast(0 as abap.quan(13, 3)) as vmein, cast(0 as abap.quan(13, 3)) as vmspe, cast(0 as abap.quan(13, 3)) as vmret,
sum(case lbbsa when ‘01’ then case sobkz when ‘K’ then stock_qty else 0 end else 0 end) as klabs, sum(case lbbsa when ‘02’ then case sobkz when ‘K’ then stock_qty else 0 end else 0 end) as kinsm, sum(case lbbsa when ‘08’ then case sobkz when ‘K’ then stock_qty else 0 end else 0 end) as keinm, sum(case lbbsa when ‘07’ then case sobkz when ‘K’ then stock_qty else 0 end else 0 end) as kspem,
sum(case lbbsa when ‘01’ then case sobkz when ‘’ then stock_vkwrt else 0 end else 0 end) as vklab, sum(case lbbsa when ‘04’ then case sobkz when ‘’ then stock_vkwrt else 0 end else 0 end) as vkuml,
sum(case lbbsa when ‘01’ then case sobkz when ‘’ then /cwm/stock_qty else 0 end else 0 end) as /cwm/labst, sum(case lbbsa when ‘04’ then case sobkz when ‘’ then /cwm/stock_qty else 0 end else 0 end) as /cwm/umlme, sum(case lbbsa when ‘02’ then case sobkz when ‘’ then /cwm/stock_qty else 0 end else 0 end) as /cwm/insme, sum(case lbbsa when ‘08’ then case sobkz when ‘’ then /cwm/stock_qty else 0 end else 0 end) as /cwm/einme, sum(case lbbsa when ‘07’ then case sobkz when ‘’ then /cwm/stock_qty else 0 end else 0 end) as /cwm/speme, sum(case lbbsa when ‘03’ then case sobkz when ‘’ then /cwm/stock_qty else 0 end else 0 end) as /cwm/retme, cast(0 as abap.quan(13, 3)) as /cwm/vmlab, cast(0 as abap.quan(13, 3)) as /cwm/vmuml, cast(0 as abap.quan(13, 3)) as /cwm/vmins, cast(0 as abap.quan(13, 3)) as /cwm/vmein, cast(0 as abap.quan(13, 3)) as /cwm/vmspe, cast(0 as abap.quan(13, 3)) as /cwm/vmret, sum(case lbbsa when ‘01’ then case sobkz when ‘K’ then /cwm/stock_qty else 0 end else 0 end) as /cwm/klabs, sum(case lbbsa when ‘02’ then case sobkz when ‘K’ then /cwm/stock_qty else 0 end else 0 end) as /cwm/kinsm, sum(case lbbsa when ‘08’ then case sobkz when ‘K’ then /cwm/stock_qty else 0 end else 0 end) as /cwm/keinm, sum(case lbbsa when ‘07’ then case sobkz when ‘K’ then /cwm/stock_qty else 0 end else 0 end) as /cwm/kspem,
sobkz為特殊庫存標識。也就是說這是一種行轉列的變換。舉個例子,代碼sum(case lbbsa when '01' then case sobkz when '' then stock_qty else 0 end else 0 end) as labst, 代表著如果庫存類型是“未限制使用的庫存”,特殊庫存標識為“K”,則它屬于MARD中的LABST,即“未限制使用的估價的庫存”
define view nsdm_e_mard_agg as select from matdoc_extract { key mandt, key matbf as matnr, key werks, key lgort_sid as lgort,
lbbsa_sid as lbbsa, sobkz,
sum(stock_qty_l2) as stock_qty, sum(stock_vkwrt_l2) as stock_vkwrt, max(gjper_curr_per) as gjper_max, sum(/cwm/stock_qty_l2) as /cwm/stock_qty } where stock_ind_l2 = ‘’ and (((sobkz = ‘’ or sobkz = ‘K’) and (lbbsa_sid = ‘01’ or lbbsa_sid = ‘02’ or lbbsa_sid = ‘07’ or lbbsa_sid = ‘08’)) or (sobkz = ‘’ and (lbbsa_sid = ‘03’ or lbbsa_sid = ‘04’)))
group by mandt, matbf, werks, lgort_sid, lbbsa_sid, sobkz