如何在AMDP SQL(Operator Precedence)(+,-,*,/)中使用OPERATOR

2020-08-26 16:03发布

点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中) 跨度 { 字体家族: C...

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)



 跨度 {
 字体家族:" Courier New";
 字体大小:10pt;
 颜色:#000000;
 背景:#FFFFFF;
 }
 .L0S31 {
 字体样式:斜体;
 颜色:#808080;
 }
 .L0S33 {
 颜色:#4DA619;
 }
 .L0S52 {
 颜色:#0000FF;
 }
 .L0S55 {
 颜色:#800080;
 }
 .L0S70 {
 颜色:#808080;
 }

   方法M_FINAL_201通过数据库

                     组屋语言程序

                     SQLSCRIPT选项只读

                     使用MARA MAKT MCH1 AUSP ZMIGO_ADD_DATA ZMIGO_PROJECT MBEW MATDOC EKPO QALS。

   IT_QALS = SELECT PRUEFLOS,WERK,MATNR,CHARG,LAGORTCHRG,EBELN,EBELP,MBLNR,ZEILE,MJAHR,BWART,

                     LMENGE01,LMENGE02,LMENGE03,LMENGE04,LMENGE05,LMENGE06,LOSMENGE,MENGENEINH

                     从QALS

                     在哪里MBLNR(从:IT_IMP中选择MBLNR)

                       和MJAHR IN(从:IT_IMP中选择MJAHR)

                       和ZEILE IN(从:IT_IMP中选择ZEILE)

                       AND MATNR IN(从:IT_IMP中选择MATNR)

                       AND BWART ='101';

   IT_FINAL = SELECT S。*,A.MTART,A.MATKL,A.MEINS AS MEINS_MARA,A.BSTME AS BSTME_MARA,B.MAKTX,

                     E.ANFMENGE AS OP_QTY,

                     E.SOLL AS RC_QTY,

                     E.HABEN AS IS_QTY,

                     E.ENDMENGE AS CO_QTY,

                     C.CUOBJ_BM AS COUBJ,



              案例D1.ATINN

              当'0000000011'

                   然后D1.ATWRT

              当'0000000012'

                   然后D1.ATWRT

              当'0000000013'

                   然后D1.ATWRT

              当'0000000014'

                   然后D1.ATWRT

              结束

              作为布局,

              D2.ATWRT AS SUPPLIER_BATCH_NO,

              D3.ATWRT AS MANF_DATE,

              D4.ATWRT AS EXP_DATE,

              D5.ATWRT AS SUPPLIER_TCNUMBER,

              D6.ATWRT AS SUPPLIER_TCDATE,

              D7.ATWRT AS SUPPLIER_HEAT_NO,

              D8.ATWRT AS MAT_WT,

              D9.ATWRT AS CUST_SR_NO,

              D10.ATWRT AS DIE_BATCH,

              D11.ATWRT AS CUST_TOTAL_WT,

              D12.ATWRT AS CHALLANNO,

              D13.ATWRT AS CHALLAN_DATE,

              D14.ATWRT AS MAT_VALUE,

              D15.ATWRT AS CUST_TOTAL_VALUE,

              D16.ATWRT AS CUST_OP,

              D17。作为质量的ATWRT,

              D18。长度为ATWRT,

              D19.ATWRT AS外径,

              D20.ATWRT AS VMMKG,

              D21.ATWRT作为重量,

              D22。厚度的ATWRT,

              D23.ATWRT AS WIDTH,

              D24.ATWRT AS INDIADITERTER,

              D25.ATWRT AS AME_BATCH_NO,

              D26.ATWRT AS HEAT_TRTMNT_NO,

              D27.ATWRT AS FG_NETWT,

              D28.ATWRT AS NOS,

              D29.ATWRT AS KG,

              D30.ATWRT AS HRS,

              D31.ATWRT AS VNOKG,

              D32.ATWRT AS VNOHRS,

              D33。重量作为重量

              D34.ATWRT AS SUPPLY_PLANT,

              DAYS_BETWEEN(TO_DATE(s.budat,'YYYYMMDD'),TO_DATE(CURRENT_DATE,'YYYY-MM-DD'))为AGE,

              F.BEDNR AS PR_CODE,

              F.BEDNR1 AS PR_HEAD,

              F1.ZBEDNR_DESC AS CODE_DESC,

              F2.ZPROJ_DESC AS HEAD_DESC,

              案例S.BWART

                当'101'

                     然后我

                其他案例G.VPRSV

                     当'V'

                         然后G.VERPR

                     什么时候

                         当时的G.STPRS

                     结束

              以NETRATE结尾,

              J.LMENGE01 AS INS_QTY,

              J.MENGENEINH AS INS_UOM,

              J.LMENGE04 AS INS_BQTY,

              杰根·门根



              FROM:it_imp为S

              左外加入MARA AS

              开启S.MATNR = A.MATNR

              AND A.MANDT = IP_CLIENT

              左外侧联结AS

              ON B.MANDT = IP_CLIENT

              AND S.MATNR = B.MATNR

              AND B.SPRAS ='E'

              左外联接:IT_IMP_T AS E

              开启E.MATNR = S.MATNR

              AND E.WERKS = S.WERKS

              左外连接MCH1 AS C

              ON C.MANDT = IP_CLIENT

              AND C.MATNR = S.MATNR

              AND C.CHARG = S.charg

 * ---------------- U_PLATE_ID,U_BAR_ID,U_TUBE_ID,U_FORGING_ID在布局列中显示

              左外联接AUSP AS D1

              开启D1.MANDT = IP_CLIENT

              AND d1.objek = C.CUOBJ_BM

              AND D1.ATINN IN('0000000011','0000000012','0000000013','0000000014')

 * ---------------- U_SUPPLIER_BATCH_NO

              左外联接AUSP AS D2

              在D2.MANDT = IP_CLIENT

              AND D2.OBJEK = C.CUOBJ_BM

              AND D2.ATINN ='0000000018'

 * ---------------- U_MANF_DATE

              左外联接AUSP AS D3

              在D3.MANDT = IP_CLIENT

              AND D3.OBJEK = C.CUOBJ_BM

              AND D3.ATINN ='0000000048'

 * ---------------- U_EXP_DATE

              左外联接AUSP AS D4

              在D4.MANDT = IP_CLIENT

              AND D4.OBJEK = C.CUOBJ_BM

              AND D4.ATINN ='0000000049'

 * ---------------- U_SUPPLIER_TCNUMBER

              左外联接AUSP AS D5

              在D5.MANDT = IP_CLIENT

              AND D5.OBJEK = C.CUOBJ_BM

              AND D5.ATINN ='0000000015'

 * ---------------- U_SUPPLIER_TCDATE

              左外联接AUSP AS D6

              在D6.MANDT = IP_CLIENT

              AND D6.OBJEK = C.CUOBJ_BM

              AND D6.ATINN ='0000000017'

 * ---------------- U_SUPPLIER_HEAT_NO

              左外联接AUSP AS D7

              在D7.MANDT = IP_CLIENT

              AND D7.OBJEK = C.CUOBJ_BM

              AND D7.ATINN ='0000000016'

 * ---------------- U_MAT_WT

              左外联接AUSP AS D8

              在D8.MANDT = IP_CLIENT

              AND D8.OBJEK = C.CUOBJ_BM

              AND D8.ATINN ='0000000041'

 * ---------------- U_CUST_SR_NO

              左外联接AUSP AS D9

              在D9.MANDT = IP_CLIENT

              AND D9.OBJEK = C.CUOBJ_BM

              AND D9.ATINN ='0000000043'

 * ---------------- U_DIE_BATCH

              左外联接AUSP AS D10

              在D10.MANDT = IP_CLIENT

              AND D10.OBJEK = C.CUOBJ_BM

              AND D10.ATINN ='0000000029'

 * ---------------- U_CUST_TOTAL_WT

              左外联接AUSP AS D11

              在D11.MANDT = IP_CLIENT

              AND D11.OBJEK = C.CUOBJ_BM

              AND D11.ATINN ='0000000042'

 * ---------------- U_CHALLANNO

              左外联接AUSP AS D12

              在D12.MANDT = IP_CLIENT

              AND D12.OBJEK = C.CUOBJ_BM

              AND D12.ATINN ='0000000031'

 * ---------------- U_CHALLAN_DATE

              左外联接AUSP AS D13

              在D13.MANDT = IP_CLIENT

              AND D13.OBJEK = C.CUOBJ_BM

              AND D13.ATINN ='0000000038'

 * ---------------- U_MAT_VALUE

              左外联接AUSP AS D14

              在D14.MANDT = IP_CLIENT

              AND D14.OBJEK = C.CUOBJ_BM

              AND D14.ATINN ='0000000040'

 * ---------------- U_CUST_TOTAL_VALUE

              左外联接AUSP AS D15

              在D15.MANDT = IP_CLIENT

              AND D15.OBJEK = C.CUOBJ_BM

              AND D15.ATINN ='0000000039'

 * ---------------- U_CUST_OP

              左外联接AUSP AS D16

              在D16.MANDT = IP_CLIENT

              AND D16.OBJEK = C.CUOBJ_BM

              AND D16.ATINN ='0000000047'

 * ---------------- U_QUANTITY

              左外联接AUSP AS D17

              在D17.MANDT = IP_CLIENT

              AND D17.OBJEK = C.CUOBJ_BM

              AND D17.ATINN ='0000000001'

 * ---------------- U_LENGTH

              左外联接AUSP AS D18

              在D18.MANDT = IP_CLIENT

              AND D18.OBJEK = C.CUOBJ_BM

              AND D18.ATINN ='0000000007'

 * ---------------- U_OUTERDIAMETER

              左外联接AUSP AS D19

              在D19.MANDT = IP_CLIENT

              AND D19.OBJEK = C.CUOBJ_BM

              AND D19.ATINN ='0000000009'

 * ---------------- U_VMMKG

              左外联接AUSP AS D20

              在D20.MANDT = IP_CLIENT

              AND D20.OBJEK = C.CUOBJ_BM

              AND D20.ATINN ='0000000020'

 * ---------------- U_RWEIGHT

              左外联接AUSP AS D21

              在D21.MANDT = IP_CLIENT上

              AND D21.OBJEK = C.CUOBJ_BM

              AND D21.ATINN ='0000000019'

 * ---------------- U_THICKNESS

              左外联接AUSP AS D22

              在D22.MANDT = IP_CLIENT

              AND D22.OBJEK = C.CUOBJ_BM

              AND D22.ATINN ='0000000005'

 * ---------------- U_WIDTH

              左外联接AUSP AS D23

              在D23.MANDT = IP_CLIENT

              AND D23.OBJEK = C.CUOBJ_BM

              AND D23.ATINN ='0000000006'

 * ---------------- U_INNERDIAMETER

              左外联接AUSP AS D24

              在D24.MANDT = IP_CLIENT

              AND D24.OBJEK = C.CUOBJ_BM

              AND D24.ATINN ='0000000010'

 * ---------------- U_AME_BATCH_NO

              左外联接AUSP AS D25

              在D25.MANDT = IP_CLIENT

              AND D25.OBJEK = C.CUOBJ_BM

              AND D25.ATINN ='0000000028'

 * ---------------- U_HEAT_TRTMNT_NO

              左外联接AUSP AS D26

              在D26.MANDT = IP_CLIENT

              AND D26.OBJEK = C.CUOBJ_BM

              AND D26.ATINN ='0000000030'

 * ---------------- U_FG_NETWT

              左外联接AUSP AS D27

              在D27.MANDT = IP_CLIENT

              AND D27.OBJEK = C.CUOBJ_BM

              AND D27.ATINN ='0000000054'

 * ---------------- U_NOS

              左外联接AUSP AS D28

              在D28.MANDT = IP_CLIENT

              AND D28.OBJEK = C.CUOBJ_BM

              AND D28.ATINN ='0000000046'

 * ---------------- U_KG

              左外联接AUSP AS D29

              在D29.MANDT = IP_CLIENT

              AND D29.OBJEK = C.CUOBJ_BM

              AND D29.ATINN ='0000000024'

 * ---------------- U_HRS

              左外联接AUSP AS D30

              在D30.MANDT = IP_CLIENT

              AND D30.OBJEK = C.CUOBJ_BM

              AND D30.ATINN ='0000000025'

 * ---------------- U_VNOKG

              左外联接AUSP AS D31

              在D31.MANDT = IP_CLIENT

              AND D31.OBJEK = C.CUOBJ_BM

              AND D31.ATINN ='0000000026'

 * ---------------- U_VNOHRS

              左外联接AUSP AS D32

              开启D32.MANDT = IP_CLIENT

              AND D32.OBJEK = C.CUOBJ_BM

              AND D32.ATINN ='0000000027'

 * ---------------- U_WEIGHT

              左外联接AUSP AS D33

              在D33.MANDT = IP_CLIENT

              AND D33.OBJEK = C.CUOBJ_BM

              AND D33.ATINN ='0000000034'

 * ---------------- U_SUPPLY_PLANT

              左外联接AUSP AS D34

              在D34.MANDT = IP_CLIENT

              AND D34.OBJEK = C.CUOBJ_BM

              AND D34.ATINN ='0000000037'

 * ----------------项目代码项目负责人

              左外联接ZMIGO_ADD_DATA AS F

              开启F.MANDT = IP_CLIENT

              AND F.MBLNR = S.MBLNR

              AND F.ZEILE = S.ZEILE

 * ----------------项目代码desc项目负责人desc

              左外联接ZMIGO_PROJECT AS F1

              开启F1.MANDT = IP_CLIENT

              AND F1.BEDNR = F.BEDNR

              左外联接ZMIGO_PROJECT AS F2

              在F2.MANDT = IP_CLIENT

              AND F2.PROJ_HEAD = F.BEDNR1

 * ---------------净利率

              左外连接MBEW AS G

              开启G.MANDT = IP_CLIENT

              AND G.MATNR = S.MATNR

              AND G.BWKEY = S.WERKS

              左侧加入MATDOC AS H

              开启H.MANDT = IP_CLIENT

              AND H.MBLNR = S.MBLNR

              AND H.ZEILE = S.ZEILE

              AND H.WERKS = S.WERKS

              AND H.CHARG = S.CHARG

              AND H.LGORT = S.LGORT

              AND H.MATNR = S.MATNR

              左外加入EKPO AS I

              开启I.MANDT = IP_CLIENT

              AND I.EBELN = H.EBELN

              AND I.EBELP = H.EBELP

              AND I.MATNR = H.MATNR

 * ---------------检验数量和单位

              左外联接:IT_QALS AS J

              开启J.MBLNR = S.MBLNR

              AND J.ZEILE = S.ZEILE

              AND J.MATNR = S.MATNR

              AND J.BWART ='101'

              AND J.CHARG = S.CHARG

              ;



 IT_FINAL = APPLY_FILTER(:IT_FINAL,:IP_WERKS);

 IT_FINAL = APPLY_FILTER(:IT_FINAL,:IP_MATNR);

 IT_FINAL = APPLY_FILTER(:IT_FINAL,:IP_BUDAT);

 IT_FINAL = APPLY_FILTER(:IT_FINAL,:IP_LGORT);

 IT_FINAL = APPLY_FILTER(:IT_FINAL,:IP_CHARG);

 IT_FINAL = APPLY_FILTER(:IT_FINAL,:IP_MTART);

 IT_FINAL = APPLY_FILTER(:IT_FINAL,:IP_MATKL);

 IT_FINAL = APPLY_FILTER(:IT_FINAL,:IP_EKGRP);

   终结法。
 
客户要求为NETRATE * INS_QTY,结果存储在下一个字段中。

 我想在选择查询中乘以2个字段,所以