顺查BOM(展开BOM清单、CS12)与逆查BOM(查上层物料、CS15)

1.顺查BOM

CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
    EXPORTING
       capid = pm_capid “应用程序一般为PP01
       datuv = pm_datuv “通常为系统的当前日期
       mtnrv = pm_mtnrv “要展开BOM的物料
       mehrs = 'X' “ x表示多层展开﹐space表示只展开第一层
       werks = pm_werks “通常为1000
    IMPORTING
       topmat = selpool
       dstst = dstst_flg
    TABLES
       stb = stb “展开的BOM存放在该内表
       matcat = matcat “下面含有元件的物料存放在该内表

2.逆查BOM

DATA: IT_WULTB LIKE STPOV OCCURS 0 WITH HEADER LINE,
        IT_EQUICAT LIKE CSCEQUI OCCURS 0 WITH HEADER LINE,
        IT_KNDCAT LIKE CSCKND OCCURS 0 WITH HEADER LINE,
        IT_MATCAT LIKE CSCMAT OCCURS 0 WITH HEADER LINE,
        IT_STDCAT LIKE CSCSTD OCCURS 0 WITH HEADER LINE,
        IT_TPLCAT LIKE CSCTPL OCCURS 0 WITH HEADER LINE,
        IT_PRJCAT LIKE CSCPRJ OCCURS 0 WITH HEADER LINE.

  CLEAR:IT_WULTB,IT_WULTB[].
  CALL  FUNCTION  'CS_WHERE_USED_MAT'
     EXPORTING
      DATUB              = SY-DATUM
      DATUV              = SY-DATUM
      MATNR              = P_C_MATNR
*     POSTP               = ' '
*     RETCODE_ONLY        = ' '
*     STLAN               = ' '
      MCLMT              = '00000000'
      WERKS              = S2_WERKS
*    IMPORTING
*    TOPMAT              =
     TABLES
          WULTB           = IT_WULTB
          EQUICAT         = IT_EQUICAT
          KNDCAT          = IT_KNDCAT
          MATCAT          = IT_MATCAT
          STDCAT          = IT_STDCAT
          TPLCAT          = IT_TPLCAT
     EXCEPTIONS
          CALL_INVALID        = 1
          MATERIAL_NOT_FOUND          = 2
          NO_WHERE_USED_REC_FOUND     = 3
          NO_WHERE_USED_REC_SELECTED = 4
          NO_WHERE_USED_REC_VALID     = 5
          OTHERS              = 6.

 

你可能感兴趣的:(c,function,header)