SAP QM——IQC质检数量

IQC(Incoming Quality Control):来料质量控制

MMBE(库存概览)查看物料ATAA0062-22S当前的收货冻结库存为598PCS,也就是当前IQC数量为598PCS

第1种获取物料的IQC数量方式:

*&---------------------------------------------------------------------*
*& Report ZQMRTEST
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZQMRTEST.

DATA: l_iqc LIKE mseg-menge,
      l_iqc_in LIKE mseg-menge,
      l_iqc_out LIKE mseg-menge.

"103 采购进入冻结库存
"106 冻结库存过账到未限制回转
"125 退货冻结库存回转
SELECT SUM( menge ) INTO l_iqc_in
          FROM mseg
          WHERE werks = '2000'
          AND matnr = 'ATAA0062-22S'
          AND bwart IN ('103','106','125').

"104 采购进入冻结库存回转
"105 冻结库存过账到未限制
"124 退货冻结库存
SELECT SUM( menge ) INTO l_iqc_out
          FROM mseg
          WHERE werks = '2000'
          AND matnr = 'ATAA0062-22S'
          AND bwart IN ('104','105','124').

l_iqc = l_iqc_in - l_iqc_out.
cl_demo_output=>write( l_iqc ).
cl_demo_output=>display(  ).

第2种获取物料的IQC数量方式:

*&---------------------------------------------------------------------*
*& Report ZQMRTEST
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZQMRTEST.

TYPES: BEGIN OF ty_xtab2,
  werks LIKE ekpo-werks,
  matnr LIKE ekpo-matnr,
  ebeln LIKE ekpo-ebeln,
  ebelp LIKE ekpo-ebelp,
  wesbs LIKE ekbe-wesbs,
  wesb2 LIKE ekbe-wesbs,
  meinh LIKE ekpo-meins,
END OF ty_xtab2.

DATA: lt_xtab2 TYPE TABLE OF ty_xtab2,
      l_iqc LIKE mseg-menge.

RANGES: lr_werks FOR ekpo-werks.

lr_werks-sign = 'I'.
lr_werks-option = 'EQ'.
lr_werks-low = '2000'.
APPEND lr_werks.

CALL FUNCTION 'MB_SELECT_GR_BLOCKED_STOCK'
       EXPORTING
*        X_KZVBR       = ' '
         X_MATNR       = 'ATAA0062-22S'
         X_MEINS       = 'PCS'
*        X_KZWSO       = ' '
*        X_NOVBR       = ' '
       TABLES
         XTAB2         = lt_xtab2
         XWERKS        = lr_werks.

LOOP AT lt_xtab2 INTO DATA(ls_xtab2).
  l_iqc = l_iqc + ls_xtab2-wesbs.
ENDLOOP.

cl_demo_output=>write( l_iqc ).
cl_demo_output=>display(  ).

 

posted @ 2020-06-07 19:35  鲸与海  阅读(1150)  评论(0编辑  收藏  举报