注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

XINBO'S SAP BLOG

你所浪费的今天,是昨天死去的人奢望的明天。你所厌恶的现在,是未来的你回不去的曾经

 
 
 

日志

 
 

MMBE 里面的部分数量  

2009-06-17 16:40:08|  分类: FUCTIONS |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
*&---------------------------------------------------------------------*
*& Report  ZMM012
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT  zmm012.
TABLES: marcv,resb .
DATA: BEGIN OF xtab OCCURS 10,        "未清采购订单数
         werks LIKE ekpo-werks,
         lgort LIKE ekpo-lgort,
         matnr LIKE ekpo-matnr,
         menge LIKE ekpo-menge,
         mengk LIKE ekpo-menge,
       END OF xtab.
DATA: BEGIN OF xtab1 OCCURS 10,        "预留的
         werks LIKE resb-werks,
         lgort LIKE resb-lgort,
         charg LIKE resb-charg,
         matnr LIKE resb-matnr,
         bdmng LIKE resb-bdmng,
         bdmns LIKE resb-bdmng,
         erfme LIKE resb-erfme,
         erfmg LIKE resb-erfmg,
       END OF xtab1.
DATA: BEGIN OF xtab2 OCCURS 10,         "收货冻结的库存
         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 xtab2.
DATA: BEGIN OF xtab4 OCCURS 100,         "交货计划
         matnr LIKE vbbe-matnr,
         werks LIKE vbbe-werks,
         lgort LIKE vbbe-lgort,
         charg LIKE vbbe-charg,
         vbmna LIKE vbbe-omeng,
         vbmnb LIKE vbbe-omeng,
         vbmnc LIKE vbbe-omeng,
         vbmne LIKE vbbe-omeng,
         vbmng LIKE vbbe-omeng,
         vbmni LIKE vbbe-omeng,
         omeng LIKE vbbe-omeng,
         vrkme LIKE vbep-vrkme,
         wmeng LIKE vbep-wmeng,
       END OF xtab4.
DATA: BEGIN OF xtab5 OCCURS 10.
        INCLUDE STRUCTURE werks_quan.
DATA: END OF xtab5.

SELECT-OPTIONS: s_werks  FOR marcv-werks .
RANGES: xbdart FOR resb-bdart.
 
START-OF-SELECTION.
  CLEAR xtab. REFRESH xtab.
  CALL FUNCTION 'MB_ADD_PURCHASE_ORDER_QUANTITY' "未清采购订单数
    EXPORTING
      x_elikz = ''
      x_loekz = ''
      x_matnr = '002100000000000618'
      x_meins = 'PC'
    TABLES
      xtab    = xtab
      xwerks  = s_werks.
  WRITE / 'XTAB:'.
  LOOP AT xtab.
    PERFORM write_wa USING xtab 'XXXXXXX' 'X' 'X'.
  ENDLOOP.

  REFRESH xbdart.
  CLEAR   xbdart.
  xbdart-sign   = 'I'.
  xbdart-option = 'EQ'.
  xbdart-low    = 'AR'.
  APPEND xbdart.
  xbdart-low    = 'MR'.
  APPEND xbdart.
  CLEAR xtab1. REFRESH xtab1.
  CALL FUNCTION 'MB_ADD_RESERVATION_QUANTITIES' "预留的
    EXPORTING
      x_matnr = '002100000000000618'
      x_xloek = space
      x_kzear = space
      x_kzwso = ''
    TABLES
      xtab1   = xtab1
      xwerks  = s_werks
      xbdart  = xbdart.
  WRITE / 'XTAB1:'.
  LOOP AT xtab1.
    PERFORM write_wa USING xtab1 'XXXXXXX' 'X' 'X'.
  ENDLOOP.

  CLEAR xtab2. REFRESH xtab2.
  CALL FUNCTION 'MB_SELECT_GR_BLOCKED_STOCK' "收货冻结的库存
    EXPORTING
      x_matnr = '002100000000000618'
      x_meins = 'PC'
      x_kzwso = ''
    TABLES
      xtab2   = xtab2
      xwerks  = s_werks.
  WRITE / 'XTAB2:'.
  LOOP AT xtab2.
    PERFORM write_wa USING xtab2 'XXXXXXX' 'X' 'X'.
  ENDLOOP.

  CLEAR xtab4. REFRESH xtab4.
  CALL FUNCTION 'MB_SELECT_SD_SCHEDULED_STOCK' "交货计划
    EXPORTING
      x_matnr = '002100000000000618'
      x_kzwso = ''
    TABLES
      xtab4   = xtab4
      xwerks  = s_werks.
  WRITE / 'XTAB4:'.
  LOOP AT xtab4.
    PERFORM write_wa USING xtab4 'XXXXXXX' 'X' 'X'.
  ENDLOOP.

  CLEAR xtab5. REFRESH xtab5.
  CALL FUNCTION 'MATERIAL_QUANTITIES_FAUF'
    EXPORTING
      matnr     = '002100000000000618'
      kzwso     = ''
    TABLES
      famng_tab = xtab5
      werks_tab = s_werks.
  WRITE / 'XTAB5:'.
  LOOP AT xtab5.
    PERFORM write_wa USING xtab5 'XXXXXXX' 'X' 'X'.
  ENDLOOP.

*&---------------------------------------------------------------------*
*&      Form  write_wa
*&---------------------------------------------------------------------*
FORM write_wa USING wa fieldmask newline alllen.
  DATA: str TYPE string ,
        str_idx TYPE string ,
        f_index TYPE i ,
        f_len TYPE i .
  FIELD-SYMBOLS: <f_field> .
  f_len = STRLEN( fieldmask ).
  IF newline = 'X'. WRITE  / ''.ENDIF.
  POSITION 1 .
  DO .
    ASSIGN COMPONENT sy-index OF STRUCTURE wa TO <f_field>.
    IF sy-subrc <> 0 OR sy-index > f_len.
      EXIT.
    ELSE.
      str_idx = sy-index .
      CONDENSE str_idx.
      f_index = sy-index - 1.
      IF fieldmask+f_index(1) = 'X'.
        IF alllen = ''.
          str = <f_field> .
          WRITE str.
        ELSE.
          WRITE <f_field>.
        ENDIF.
      ENDIF.
    ENDIF.
  ENDDO.
ENDFORM.                    "write_wa
  评论这张
 
阅读(888)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017