ZPPFM006 获取标准BOM数

FUNCTION zppfm006.
*"----------------------------------------------------------------------
*"*"本地接口:
*"  IMPORTING
*"     VALUE(I_MATNR) TYPE  MATNR
*"  EXPORTING
*"     VALUE(O_MSG) TYPE  TEXT200
*"  TABLES
*"      O_STPOX STRUCTURE  STPOX
*"      O_CSCMAT STRUCTURE  CSCMAT
*"      O_MARA STRUCTURE  MARA
*"      O_MAKT STRUCTURE  MAKT
*"----------------------------------------------------------------------

  TABLES: mara.
  TABLES: makt.

  SELECT *
  INTO CORRESPONDING FIELDS OF TABLE o_mara"主表
  FROM mara
  WHERE mara~matnr = i_matnr.

  IF sy-subrc IS NOT INITIAL.
    o_msg = '物料不存在'.
    EXIT.
  ELSE.
    o_msg = 'OK'.
  ENDIF.

  SELECT *
  INTO CORRESPONDING FIELDS OF TABLE o_makt"主表
  FROM makt
  WHERE makt~matnr = i_matnr.





  CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
    EXPORTING
      capid  = 'PP01'                   "BOM类型,比如生产BOM,研发BOM,销售BOM等等
      datuv  = sy-datum                 "填入日期,函数据此日期筛选出有效的组件
      ehndl  = '1'
      emeng  = 1000                     "设定的用量单位
      mehrs  = 'X'                      "有值表示多层展开,类似事物码CS12
      mtnrv  = i_matnr                  "BOM料号
      stlan  = '1'                      "类似参数CAPID,限定被展开BOM的性质
      werks  = '1001'
    TABLES
      stb    = o_stpox
      matcat = o_cscmat.
ENDFUNCTION.

你可能感兴趣的:(SAP,APAP)