sap-abap 取销售订单行的已发货数量

以下是 oracle sql 语句,表述了取数逻辑,各表之间的关系,如用abap来写稍作修改即可.


--取订单行的已发货数量
select  
        vp2.vbeln,
        vp2.posnr,
        sum(va2.RFMNG)rfmng 
      from sapsr3.vbap vp2
      inner join sapsr3.vbfa va2  ON va2.VBELV  = vp2.vbeln   AND va2.POSNV = vp2.posnr and ( va2.VBTYP_N = 'T' or va2.VBTYP_N = 'J' )  --找到相应的交货单
      inner join sapsr3.vbup vu  on vu.vbeln = va2.VBELN   and vu.posnr = va2.POSNN and vu.WBSTA = 'C'    --交货单已完全交货
      group by vp2.vbeln, vp2.posnr


你可能感兴趣的:(sap-abap 取销售订单行的已发货数量)