会加入DUMMY的表 IN_ITEM,IN_ITEM_SITE,IN_SALES_ORDER

加入DUMMY的存储过程名为SAP_MATERIAL_SO、

FP_CHANGE_MO_ROUTING的第122行数据IN_ROUTING_HEADER

--存储过程SAP_MATERIAL_SO
SELECT * FROM TEMP_MATERIAL_SALESORDER WHERE DUMMY_ITEM_ID LIKE '000000101%'; SELECT SO_ID,
SO_LINE_ID,
SITEID,
ITEM_ID,
QTYUOM,
ITEM_ID || V_LastChar DUMMY_ITEM_ID,
SO_ID || '_' || SITEID || '_' || SO_LINE_ID DUMMY_BOM_ID,
V_DummyRouting || '_' || SITEID DUMMY_ROUTING_ID
FROM (SELECT SO_ID,
SUBSTR (SO_LINE_ID, 1, INSTR (SO_LINE_ID, '_') - 1)
SO_LINE_ID,
SITEID,
ITEM_ID,
QTYUOM,
ROW_NUMBER ()
OVER (
PARTITION BY SO_ID,
SUBSTR (SO_LINE_ID,
1,
INSTR (SO_LINE_ID, '_') - 1)
ORDER BY SO_LINE_ID)
RN,UDF_MATERIAL_SO,BOMID
FROM IN_SALES_ORDER
WHERE SO_ID='' AND SO_LINE_ID='490_1' AND UDF_MATERIAL_SO = '' AND BOMID IS NULL )
WHERE RN = 1; SELECT SO_ID,
SUBSTR (SO_LINE_ID, 1, INSTR (SO_LINE_ID, '_') - 1)
SO_LINE_ID,
SITEID,
ITEM_ID,
QTYUOM,
ROW_NUMBER ()
OVER (
PARTITION BY SO_ID,
SUBSTR (SO_LINE_ID,
1,
INSTR (SO_LINE_ID, '_') - 1)
ORDER BY SO_LINE_ID)
RN,UDF_MATERIAL_SO,BOMID
FROM IN_SALES_ORDER
WHERE SO_ID='' AND SO_LINE_ID='490_1' AND UDF_MATERIAL_SO = '' AND BOMID IS NULL ;
--SAP_SALES_ORDER

SELECT vbap.VBELN,vbep.POSNR,
vbep.POSNR || '_' || vbep.ETENR AS SO_LINE_ID,
vbak.VBTYP,
vbak.KUNNR,
vbap.MATNR,
vbap.WERKS,
vbap.ERDAT,
knvv.BZIRK,
knvv.VTWEG,
vbak.VDATU, SUBSTR (mara.matnr, 1, 9), TRIM (MARA.MTART),VBAP.MATNR || VBAP.WERKS , CASE
WHEN TRIM (MARA.MTART) = 'Z001'
AND SUBSTR (mara.matnr, 1, 9) NOT IN
('', '')
THEN
''
-- add by zhangguipeng on 20170323 增加SO\STO需求出货物料编码开头为402或102,设定为材料订单;
WHEN SUBSTR(VBAP.MATNR,1,9) IN('','') THEN
''
WHEN VBAP.MATNR || VBAP.WERKS IN
(SELECT DISTINCT MATNR || WERKS FROM SAP_MAST)
THEN
''
ELSE
''
END
AS UDF_MATERIAL_SO,-------- IN_BOM_HEADER.BOM_ID,
VBAK.AUART,
CASE WHEN TRIM(VBAK.VKORG) = '' AND TRIM(VBAK.ERNAM) = 'SAPRFC' THEN VBEP.EDATU
ELSE
NVL (so_date.edatu3, so_date.edatu2) END AS edatu2,
--ALTER BY HUANGYANGXIONG ON 20150114 新增栏位判断是否回写SO交期
CASE
WHEN TRIM (SO_DATE.EDATU2) IS NOT NULL
THEN
VBEP.EDATU
ELSE
NULL
END
AS EXT_FORDATE,
ROW_NUMBER ()
OVER (
PARTITION BY VBAK.VBELN,
vbep.POSNR || '_' || vbep.ETENR
ORDER BY
vbap.VBELN,
vbep.POSNR || '_' || vbep.ETENR DESC,
VBEP.EDATU DESC)
rn
FROM SAP_VBAP vbap
JOIN
SAP_VBEP vbep
ON vbap.VBELN = vbep.VBELN
AND vbep.posnr = vbap.posnr
JOIN SAP_VBAK vbak ON vbap.VBELN = vbak.VBELN
JOIN
SAP_KNVV knvv
ON vbak.KUNNR = knvv.KUNNR
AND vbak.vkorg = knvv.vkorg
AND vbak.vtweg = knvv.vtweg
JOIN
SAP_MARC MARC
ON VBAP.MATNR = MARC.MATNR
AND MARC.WERKS = VBAP.WERKS
JOIN SAP_MARA MARA ON VBAP.MATNR = MARA.MATNR
LEFT JOIN
SAP_CUSTOMER_INSPECT
ON VBAK.KUNNR = SAP_CUSTOMER_INSPECT.KUNNR
AND VBAP.MATNR = SAP_CUSTOMER_INSPECT.MATNR
LEFT JOIN
IN_BOM_HEADER
ON VBAP.MATNR = IN_BOM_HEADER.PRODUCT_ID
AND IN_BOM_HEADER.MO_BOM_MARK = ''
AND VBAP.WERKS =
SUBSTR (
IN_BOM_HEADER.bom_id,
INSTR (IN_BOM_HEADER.bom_id, '_') + 1,
4)
LEFT JOIN SAP_SHIPPING_CODE SHIPPING
ON VBAK.VBELN = SHIPPING.VBELN
LEFT JOIN
SAP_OSAL_OUT osal_out
ON vbep.vbeln = osal_out.vbeln
AND VBEP.POSNR = OSAL_OUT.POSNR
AND VBEP.ETENR = OSAL_OUT.ETENR
LEFT JOIN
TEMP_SAP_MSKA MSKA
ON VBEP.VBELN = MSKA.VBELN
AND VBEP.POSNR = MSKA.POSNR
AND VBEP.ETENR = MSKA.ETENR
AND VBAP.MATNR = MSKA.MATNR
LEFT JOIN
SAP_SO_DATE SO_DATE
ON VBEP.VBELN = SO_DATE.VBELN
AND VBEP.POSNR = SO_DATE.POSNR
AND VBEP.ETENR = SO_DATE.ETENR
WHERE TRIM (MARC.LVORM) IS NULL
AND TRIM (MARA.LVORM) IS NULL AND vbap.VBELN='' AND vbep.POSNR=''
SELECT * FROM SAP_MAST WHERE MATNR || WERKS ='';--有问题
SELECT * FROM SAP_MAST WHERE MATNR || WERKS ='';--无 --INSERT INTO STG.SAP_MAST(MATNR,WERKS,STLNR,STLAN,ANDAT,AEDAT)
SELECT DISTINCT
TRIM(MAST.MATNR) as MATNR,
TRIM(MAST.WERKS) as WERKS,
TRIM(MAST.STLNR) as STLNR,
--TRIM(MAST.STLAN) as STLAN,
TRIM(MAST.STLAL) as STLAN,
TO_DATE(SUBSTR(MAST.ANDAT,1,4)||'-'||SUBSTR(MAST.ANDAT,5,2)||'-'||SUBSTR(MAST.ANDAT,7,2),'YYYY-MM-DD')
AS ANDAT,
CASE WHEN AEDAT='' then null
WHEN AEDAT IS NULL THEN NULL
ELSE
TO_DATE(SUBSTR(MAST.AEDAT,1,4)||'-'||SUBSTR(MAST.AEDAT,5,2)||'-'||SUBSTR(MAST.AEDAT,7,2),'YYYY-MM-DD')
END AS AEDAT
FROM SAPSR3.MAST@SAP_SEP MAST
JOIN SAPSR3.ZFP_STLNR@SAP_SEP ZFP_STLNR ON MAST.MANDT = ZFP_STLNR.MANDT
AND MAST.STLNR = ZFP_STLNR.STLNR
WHERE TRIM(MAST.WERKS) IN (SELECT WERKS FROM SAPSR3.ZFM_FP_WERKS@SAP_SEP SZ WHERE SZ.ID IN (1,2,3))
AND MAST.MATNR IN ('',''); SELECT * FROM SAPSR3.ZFP_STLNR@SAP_SEP WHERE MATNR IN ('',''); --INSERT INTO SAPSR3.ZFP_STLNR(MANDT,STLNR,MATNR,WERKS)
SELECT
DISTINCT TRIM(MAST.MANDT) AS MANDT,
TRIM(MAST.STLNR) AS STLNR,
TRIM(MAST.MATNR) AS MATNR,
TRIM(MAST.WERKS) AS WERKS
FROM SAPSR3.MAST@SAP_SEP MAST JOIN SAPSR3.MARC@SAP_SEP MARC ON MAST.MATNR = MARC.MATNR AND MAST.WERKS = MARC.WERKS AND MAST.MANDT = MARC.MANDT
WHERE MAST.MANDT = ''
--AND MAST.WERKS IN (SELECT WERKS FROM SAPSR3.ZFM_FP_WERKS@SAP_SEP SZ WHERE SZ.ID IN (1,2,3))
--AND TRIM(MARC.BESKZ) IN ('E','X')
AND MAST.MATNR IN ('',''); SELECT * FROM SAPSR3.MAST@SAP_SEP WHERE MATNR IN ('','');

有问题的数据为MAST中没有数据导致

物料没加DUMMY的更多相关文章

  1. java项目发布到linux服务器,tomcat正常启动但没加载项目

    问题描述: java项目发布到linux服务器,一切操作正确,linux命令启动tomcat后,查看日志启动tomcat正常,上传的war包已经解压成功,但是tomcat没加载项目. 解决方法: 1. ...

  2. 使用selenium操作ant design前端的页面,感觉页面没加载完

    因需要收集页面数据,遂准备使用selenium爬取瓦斯阅读页面, 瓦斯网站使用的是ant design,元素定位非常困难,页面元素都没有ID,现在还只是能做到操作登录,不能自动打开订阅,查询某公众号, ...

  3. selenium网页没加载完成就停止加载并自动刷新

    判断一个网页10秒没加载完成就停止加载并自动刷新 driver=webdriver.Chome() driver.set_page_load_timeout(10) while True: try: ...

  4. Kali信息收集系列:(都是我以前的笔记整理了一下,就没加水印,习惯就好)

    好几天没发微信公众号了,今天一起发下.(最近有点事情) 前些天老业界的一位朋友问我一些Safe新时代信息收集的问题 逆天虽然好多年不干老本行,但隔段时间都会关注一下 于是就花了点时间整理了一下,你们就 ...

  5. Myeclipse在debug模式下没加断点程序卡住,start模式下可以正常启动

    参考<eclipse在debug模式下卡住,start模式下可以启动>,地址:https://blog.csdn.net/jack_chen1994/article/details/761 ...

  6. VUE在页面没加载完的时候会显示原代码的处理方法

    CSS: [v-cloak] { display: none; } HTML : <div v-cloak> {{ message }} </div> 其中 v-cloak官方 ...

  7. css 命名 有的加# ,有的加点 ,有的没加。请问下都在什么情况下用的?

    [nav{}]这样的样式是给特定的标签直接定义样式时使用的,这个样式名称是跟标签是相对应的,比如我要给<p></p>这个标签设置样式,那我就可以直接写:p{样式}就可以,但是这 ...

  8. nginx访问目录是没加/的重定向控制

    static 模块提供了root与alias功能:发现目标是目录时:但URI末尾未加/时:会返回301重定向:重定向后会加/ 指令 Syntax: server_name_in_redirect on ...

  9. PHP图片加文字水印和图片水印方法(鉴于李老师博客因没加水印被盗,特搜集的办法。希望能有用!)

    $dst_path = 'dst.jpg'; //创建图片的实例 $dst = imagecreatefromstring(file_get_contents($dst_path)); //打上文字 ...

随机推荐

  1. jquery mobile开发中页面跳转后js不执行的问题

    为了实现在移动设备上的无缝客户体验,jQueryMobile默认采用AJAX的方式载入一个目的链接页面.因此,当在浏览器中点击一个链接打一个新的页面时,jQueryMobile接收这个链接,通过AJA ...

  2. 【每日一学】pandas_透视表函数&交叉表函数

    每日一悟 [分开工作内外8小时] 前一个月,我经常把工作内的问题带到路上.地铁上.睡觉前,甚至是周末. 然而很快发现,我工作外的成就几乎没有,而工作内的进展也并不理想. 仔细想想,工作外是需要学新东西 ...

  3. myeclipse项目 不能打开

    重启电脑后, myeclipse项目 不能打开了, 之前都是好好的!! 出现: Failed to read the project description file (.project) for ' ...

  4. 13. 字符串转为json对象或json数组

    ##########1.json字符串转json数组########### var str="[{name:'zhangsan',age:'24'},{name:'lisi',age:'30 ...

  5. Android呼吸灯效果实现

    最近需要做一个搜索动画的呼吸灯效果,在网上查了下有以下两种实现方式,现记录下来. 实现呼吸灯效果本质上都是使用ImageView动画,实现alpha值变化. 第一种方式,直接使用动画实现,代码如下: ...

  6. AspxGridView使用手记

    AspxGridView使用手记   一.  基本使用方法  4 1.导入Dll文件   4 2.Asp.Net页面控件注册 4 3. Asp.Net页面控件声明    5 4.删除licenses. ...

  7. leetcode1004

    class Solution: def getMax(self,B:'List[int]'): n = len(B) maxlen = 0 curlen = 0 for i in range (n): ...

  8. Django从MySQL数据库生成model

    字段太多的话,手动建表,然后用 inspectdb 命令生成model文件,效率会高很多: inspectdb  表名 >> model文件名.py >> 是追加在文件末尾:& ...

  9. delphi 调用 c++builder

    delphi 调用 c++builder c++builder 调用delphi 混合调用,mix https://community.embarcadero.com/blogs/entry/mixi ...

  10. jsp不解析el表达式,不识别jstl标签,找不到http://java.sun.com/jsp/jstl/core

    问题描述: jsp页面中el表达式,例如:${pageContext.request.contextPath},原样呈现,未被解析. 解决方案: 为jsp页添加page指令如下: <%@ pag ...