2022年2月6日 星期日

SAP ME 工單製程參數查詢 SQL

請參考如下:

SELECT * FROM  

 (SELECT P.SITE,I.ITEM, SFC.SFC,SO.BATCH_NUMBER

,SO.SHOP_ORDER

,O.OPERATION, OT.DESCRIPTION AS OP_DESC

,SRRS.STEP_ID

,PM.DESCRIPTION AS MEA_DESC

,PM.ACTUAL

,PM.TEST_DATE_TIME

,P.ROUTER_BO

,PM.MEASURE_NAME

,PM.MEASURE_GROUP

,PM.MEASURE_STATUS

,PM.DC_PARAMETER_BO

,DCP.PARAMETER_NAME

,DCP.DATA_FIELD_BO

  FROM WIP.PARAMETRIC P,  WIP.PARAMETRIC_MEASURE PM

,WIP.OPERATION O,WIP.OPERATION_T OT

, WIP.ITEM I

,WIP.DC_PARAMETER DCP

,WIP.SFC

,WIP.VIEW_SFC_ROUTING_ROUTER_STEP SRRS

,WIP.SHOP_ORDER SO

  WHERE  1=1

AND P.HANDLE = PM.PARAMETRIC_BO

AND P.OPERATION_BO = O.HANDLE

AND O.HANDLE = OT.OPERATION_BO

AND P.ITEM_BO = I.HANDLE

AND PM.DC_PARAMETER_BO = DCP.HANDLE

AND P.PARA_CONTEXT_GBO = SFC.HANDLE

AND SFC.HANDLE = SRRS.SFC_BO

AND LEFT (P.OPERATION_BO,22) = LEFT (SRRS.OPERATION_BO,22)

AND SFC.SHOP_ORDER_BO = SO.HANDLE

AND  PM.MEASURE_GROUP LIKE 'OP%'

AND OT.LOCALE = 'ZH_TW'

  ) AS A

LEFT OUTER JOIN

  (SELECT DF.HANDLE 

            ,DFL.DATA_VALUE , DFLT.DATA_TAG

   FROM WIP.DATA_FIELD DF  

        ,WIP.DATA_FIELD_LIST DFL

        ,WIP.DATA_FIELD_LIST_T DFLT

   WHERE 1=1

     AND DFL.DATA_FIELD_BO = DF.HANDLE

     AND DFLT.DATA_FIELD_LIST_BO = DFL.HANDLE      

  ) AS B

ON A.DATA_FIELD_BO = B.HANDLE AND A.ACTUAL = B.DATA_VALUE

WHERE 1=1

ORDER BY  A.SFC,A.STEP_ID ,A.MEASURE_GROUP,A.MEASURE_NAME

沒有留言:

張貼留言