Created by Wang, Jerry, last modified on Jan 06, 2017

You can use tcode /SAPAPO/MAT1 to maintain SCM specific attribute of a given material in S4 system.

The material is queried from SCM specific “database table”: /SAPAPO/MATKEY

This table is redirected to CDS view: P_PRDSCM_MATKEY

This CDS view is reading data from MARA:

Source code of this CDS view:

@AbapCatalog.sqlViewName: 'PrdscmMatkey'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Redirect for /SAPAPO/MATKEY'
@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.usageType.sizeCategory : #L
@ObjectModel.usageType.dataClass: #MASTER
@ClientHandling.type: #INHERITED
@ClientHandling.algorithm: #AUTOMATEDdefine view P_Prdscm_Matkey
as  select from mara as mara
// left outer join /sapapo/tclsys _tclsys on mara.mandt = _tclsys.mandt
left outer join marm on marm.matnr = mara.matnr
and marm.meinh = mara.meins
left outer join mara as ref_mara_rmatp on mara.rmatp = ref_mara_rmatp.matnr
left outer join mara as ref_mara_satnr on mara.satnr = ref_mara_satnr.matnr
left outer join  inob  as inob on mara.scm_matid_guid22 = inob.objek
association [0..1] to E_Product as _ActiveProductExt on $projection.MATNR = _ActiveProductExt.Product
{
cast( mara.scm_matid_guid22  as /sapapo/matid preserving type) as MATID,
mara.matnr as MATNR,
cast(' ' as /sapapo/product_type preserving type) as PRODUCT_TYPE,
mara.lvorm as LVORM,
case
// when _tclsys.master_switch = 'C' then 'X'
// when _tclsys.master_switch = 'I' then '1'
when inob.klart = '300' or inob.klart = '400' or inob.klart = '230' then 'X'
end as FLAGCLASS,
cast(case
when mara.vhart is not null and mara.vhart <> '' then cast('X' as /sapapo/flgpack)
else ''
end as /sapapo/flgpack) as FLAGPACK,
mara.disst as DISST,
mara.meins as MEINS,
//map only, if MARA-ATTYP has one of the values: '00' (Single Produc), '01' (Generic Article), '02' (Variant of a Generic Article), '10' (Sales Set), '11' (Prepack), '12' (Display)
cast(case mara.attyp
when '00' then mara.attyp
when '01' then mara.attyp
when '02' then mara.attyp
when '10' then mara.attyp
when '11' then mara.attyp
when '12' then mara.attyp
else ''
end as /sapapo/attyp preserving type) as ATTYP,
mara.logunit as LOGUNIT,
mara.cwqrel as CWREL,
// map TY2TQ against MARM-TY2TQ
marm.ty2tq as TY2TQ,
mara.brgew as BRGEW,
mara.ntgew as NTGEW,
mara.gewei as GEWEI,
mara.volum as VOLUM,
mara.voleh as VOLEH,
// Calculated: True, if Shelf life duration not initial
case
when (mara.iprkz = ' ' or mara.iprkz = '1' or mara.iprkz = '2' or mara.iprkz = '3') and mara.mhdhb > 0 then 'X'
else ''
end as SHELF_LIFE_FLAG,
//Calculated: mhdhb * 240000 & IPRKZ (can be set to day, week(*7), month(*30) or year(*365))
//if result > 2399760000 then result = 2399760000
//
// -> for day: case ( mhdhb * 240000 ) > 2399760000 then SHELF_LIFE_DUR = 2399760000
// else SHELF_LIFE_DUR = mhdhb * 240000
// -> ( mhdhb * 240000 ) > 2399760000 -> case condition: mhdhb > 2399760000 / 240000 ( = 9999 )
// -> case condition iprkz ' ': mhdhb > 9999
// -> case condition iprkz '1': mhdhb > 1428,4286 -> DEC(4,0): 1428
// -> case condition iprkz '2': mhdhb > 333,3333 -> DEC(4,0): 333
// -> case condition iprkz '3': mhdhb > 27,3945 -> DEC(4,0): 27
cast(case
when mara.iprkz = ' ' and mara.mhdhb <= 9999 then mara.mhdhb * 240000
when mara.iprkz = ' ' and mara.mhdhb > 9999 then cast( 2399760000 as abap.dec(19) )
when mara.iprkz = '1' and mara.mhdhb <= 1428 then mara.mhdhb * 240000 * 7
when mara.iprkz = '1' and mara.mhdhb > 1428 then cast( 2399760000 as abap.dec(19) )
when mara.iprkz = '2' and mara.mhdhb <= 333 then mara.mhdhb * 240000 * 30
when mara.iprkz = '2' and mara.mhdhb > 333 then cast( 2399760000 as abap.dec(19) )
when mara.iprkz = '3' and mara.mhdhb <= 27 then mara.mhdhb * 240000 * 365
when mara.iprkz = '3' and mara.mhdhb > 27 then cast( 2399760000 as abap.dec(19) )
else 0
end as /sapapo/shelf_life_dur) as SHELF_LIFE_DUR,
mara.scm_maturity_dur as MATURITY_DUR,
cast(case
when mara.iprkz = ' ' and mara.mhdrz <= 9999 then mara.mhdrz * 240000
when mara.iprkz = ' ' and mara.mhdrz > 9999 then cast( 2399760000 as abap.dec(19) )
when mara.iprkz = '1' and mara.mhdrz <= 1428 then mara.mhdrz * 240000 * 7
when mara.iprkz = '1' and mara.mhdrz > 1428 then cast( 2399760000 as abap.dec(19) )
when mara.iprkz = '2' and mara.mhdrz <= 333 then mara.mhdrz * 240000 * 30
when mara.iprkz = '2' and mara.mhdrz > 333 then cast( 2399760000 as abap.dec(19) )
when mara.iprkz = '3' and mara.mhdrz <= 27 then mara.mhdrz * 240000 * 365
when mara.iprkz = '3' and mara.mhdrz > 27 then cast( 2399760000 as abap.dec(19) )
else 0
end as /sapapo/shelf_life_req_min) as SHLF_LFE_REQ_MIN,
mara.scm_shlf_lfe_req_max as SHLF_LFE_REQ_MAX,
mara.mhdlp as MHDLP,
mara.iprkz as IPRKZ,
// SLED_BBD: Map 'E' to SPACE and 'B' to 'X'
case mara.sled_bbd
when 'E' then ' '
when 'B' then 'X'
else ''
end as SLED_BBD,
// Rounding Rule for Calculation of Shelf Life Expiration Date
cast(case
when mara.iprkz = ' ' or mara.rdmhd = ' ' then ' ' // no rounding
when mara.iprkz = '1' and mara.rdmhd = '-' then '1' // beginning of the week
when mara.iprkz = '1' and mara.rdmhd = '+' then '2' // end of the week
when mara.iprkz = '1' and mara.rdmhd = 'F' then '3' // beginning of the next week
when mara.iprkz = '2' and mara.rdmhd = '-' then '4' // beginning of the month
when mara.iprkz = '2' and mara.rdmhd = '+' then '5' // end of the month
when mara.iprkz = '2' and mara.rdmhd = 'F' then '6' // beginning of the next month
when mara.iprkz = '3' and mara.rdmhd = '-' then '7' // beginning of the year
when mara.iprkz = '3' and mara.rdmhd = '+' then '8' // end of the year
when mara.iprkz = '3' and mara.rdmhd = 'F' then '9' // beginning of the next year
else ' ' // no rounding
end as /scmb/mdl_sldrnd) as SLDRND,
cast('' as /sapapo/mat_char40) as ATT01,
cast('' as /sapapo/mat_char30) as ATT02,
cast('' as /sapapo/mat_char20) as ATT03,
cast('' as /sapapo/mat_char10) as ATT04,
cast('' as /sapapo/mat_char10) as ATT05,
'' as BOD_DEPLVL,
'' as EXCL_EXPEDITE,
'' as PROD_PAOOPT,
'' as RESTRICT_INVBAL,
'' as DRP_GL_STOCK,
mara.matkl as MATKL,
mara.compl as COMPL,
// STFAC cannot be set by R/3
cast('' as /sapapo/stfac) as STFAC,
mara.tragr as TRAGR,
'' as TS_SDP_USE,
mara.prdha as PRDHA,
'' as GTIN_IND,
'' as DISPLAY,
mara.herkl as HERKL,
mara.xchpf as BATCH_REQ,
'' as KITCOMP,
'' as PRDSET_IND,
mara.serial as SERIAL,
cast('' as /scmb/mdl_data_checked_by) as DATA_CHECK_BY,
cast(0 as /scmb/mdl_data_checked_at) as DATA_CHECK_AT,
mara.kosch as KOSCH,
cast('' as /sapapo/kosch_grp) as KOSCH_GRP,
cast('' as /sapapo/vmikosch) as VMIKOSCH,
cast('' as /sapapo/vmikosch_grp) as VMIKOSCH_GRP,
mara.magrv as PACKGR,
//
//cast(rmatp as /SAPAPO/RMATID) as RMATP,
//rmatp as RMATP,
cast(ref_mara_rmatp.scm_matid_guid22 as /sapapo/rmatid) as RMATP,
mara.hutyp_dflt as HUTYP_DFLT,
mara.cuobf as CUOBJ,
cast(ref_mara_satnr.scm_matid_guid22 as /sapapo/satid) as SATID,
mara.kzkfg as KZKFG,
cast('' as /sapapo/matvers_head) as MATVERS_HEAD,
// remover by I321042
'' as MATVERS_TYPE,
cast( '' as /sapapo/aennr ) as MATVERS_CHNR,
cast('' as /sapapo/temprpblock) as TEMPRPBLOCK,
cast(0 as /sapapo/temprpfrom) as TEMPRPFROM,
cast(0 as /sapapo/temprpto) as TEMPRPTO,
mara.dummy_prd_incl_eew_ps,
cast('' as /sapapo/likeid) as LIKEID,
cast('' as abap.dats) as PHIN_FROM,
cast('' as abap.dats) as PHIN_TO,
cast('' as abap.char(22)) as PHIN_TSID,
cast('' as abap.dats) as PHOUT_FROM,
cast('' as abap.dats) as PHOUT_TO,
cast('' as abap.char(22)) as PHOUT_TSID,
cast('' as abap.char(22)) as LIFE_CYCLE_LOCID,
mara.ernam as CREATEUSER,
// siehe https://ld:44318/sap/public/bc/abap/docu?format=standard&object=abencds_f1_cast_expression&sap-language=DE&sap-client=000
// direct cast from DATS to DEC not possible, but cast from DATS to CHAR, from CHAR to NUMC and from NUMC to DEC is possible (concat makes cast from DATS to CHAR)
cast( cast( concat( mara.ersda, '000000') as abap.numc(15) ) as /sapapo/tsucr) as CREATEUTC,
mara.aenam as CHANGEUSER,
cast( cast( concat( mara.laeda, '000000') as abap.numc(15) ) as /sapapo/tsuup) as CHANGEUTC
}
where
mara.scm_matid_guid22 <> '0'
and mara.scm_matid_guid22 <> ''

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

How is SCM product maintenance tcode redirecting access to MARA相关推荐

  1. C#操作Access之读取mdb浅析

    原文出处:http://blog.csdn.net/liuzhuoran1110/article/details/8611366?locationNum=1 C#操作Access之读取mdb是如何实现 ...

  2. 企业大数据CDH管理平台搭建方案

    1 基本介绍 1.1 概述 Hadoop的发行版本有很多,有华为发行版,Intel发行版,Cloudera发行版(CDH),MapR版本,以及HortonWorks版本等.所有发行版都是基于Apach ...

  3. ABAP代码静态分析工具SQF - Support Query Framework

    如果系统里没有SQF这个tcode,可以参考note 1814328: SQF: Plug-In for Source Code Scans进行安装. ABAP static analysis too ...

  4. ABB KUC321AE HIEE300698R0001、KUC755AE106 3BHB005243R0106、KUC711AE 3BHB004661R0001、KUC720AE01

    W; 18 03 0 1 7 77 59 ABB KUC321AE HIEE300698R0001.KUC755AE106 3BHB005243R0106.KUC711AE 3BHB004661R00 ...

  5. A002-186-2623-余友龙

    A002-186-2623-余友龙 问题域(problem domain) 名词定义 参考文献 项目联系 需求分析(Requirements analysis) 名词定义 参考文献 项目联系 类模型( ...

  6. 亚马逊云和谷歌云_云产品免费套餐-Amazon vs Google

    亚马逊云和谷歌云 作为开发人员,您是服务提供商的重要资源. 没有开发人员,服务提供商将无法根据规模进行节省. 拥有开发人员还意味着某人在您的服务之上拥有杀手idea的机会,创造更多价值的机会更高. 开 ...

  7. SAP CRM settype的创建,背后发生了什么

    来自我的同事Sara. 当我们在CRM系统里创建一个settype之后,其实系统后台悄悄的帮我们创建了很多ABAP对象,比如对应的database tables, other ABAP Diction ...

  8. JAVA中的GridView每一个赋值,在ASP.NET 2.0中操作数据之六十二:GridView批量更新数据...

    导言: 在前面的教程,我们对数据访问层进行扩展以支持数据库事务.数据库事务确保一系列的操作要么都成功,要么都失败.本文我们将注意力转到创建一个批更新数据界面. 在本文,我们将创建一个GridView控 ...

  9. python3 xpath_Python 3中用XPath解析XML

    我有以下xml: Biscuits Wrapped Finished Biscuits Biscuits (Wrapped) Biscuits Sweet Finished Biscuits Bisc ...

最新文章

  1. logistic回归 如何_第七章:利用Python实现Logistic回归分类模型
  2. 2019年我只想明白了这5点
  3. RMAN异机恢复步骤及故障处理
  4. 「PKUWC2018」随机游走
  5. catia钣金根据线段折弯_钣金折弯加工注意事项有哪些?钣金折弯要点介绍
  6. 蚂蚁金服分布式事务开源以及实践 | SOFA 开源一周年献礼
  7. java学习笔记IO之字节输入输出流
  8. 信息学奥赛一本通 1155:回文三位数
  9. python 通过ip获取城市_Python根据用户IP判断所属城市 !
  10. android学习1:初识Activity
  11. web前端基础面试题
  12. python新建画布_Python tkinter Canvas画布完全攻略-Python
  13. 服务器输出字符流数据到浏览器 使用println浏览器无显示
  14. 查询计算机物理地址指令,怎么查询mac地址命令_如何查mac地址
  15. docker onlyoffice7.1.1 word excel ppt在线编辑、在线预览_部署01
  16. 怎样搭建serveru ftp个人服务器
  17. php 在文本域中添加qq表情 createelement,仿微信在对话框文字中插入Emoji表情包
  18. 联想小新+Windows10+Ubuntu18.04双系统安装+引导设置过程全记录
  19. 解决Ubuntu屏幕分辨率不正常问题
  20. 打开word文档提示文件未找到_word文档打开,提示“向程序发送命令时出现问题”的原因...

热门文章

  1. 计算机基础-软件梗概
  2. NPOI office操作
  3. Redis 源码走读(二)对象系统
  4. [洛谷P1074] 靶形数独
  5. org.hibernate.PersistentObjectException: detached entity passed to persist
  6. xshell有大量打印时,显示信息不全
  7. Flume的Avro Sink和Avro Source研究之一: Avro Source
  8. Win7+xp命令行 一键修改IP、DNS
  9. Activity四种加载模式
  10. python学习高级篇(part9)--对象的引用计数