ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 订单BOM

订单BOM

原创 Linux操作系统 作者:salonwang01 时间:2009-06-03 10:50:44 0 删除 编辑

REPORT  zr_ddbom.

TABLES : rc29k,afko,plpo,afpo,aufk,resb.

TYPE-POOLS slis.
DATA:   wf_fieldcat        TYPE slis_t_fieldcat_alv WITH HEADER LINE .
DATA:   ws_fieldcat        TYPE slis_t_fieldcat_alv WITH HEADER LINE .
DATA:   ws_fieldgroups_tab TYPE slis_t_sp_group_alv .
DATA:   ws_sortfields_tab  TYPE slis_t_sortinfo_alv WITH HEADER  LINE .
DATA:   wf_layout          TYPE slis_layout_alv  .
DATA    i_repid LIKE sy-repid.
i_repid = sy-repid.

DATA : BEGIN OF itab OCCURS 0 ,
        matnr LIKE rc29k-matnr ,
        maktx LIKE makt-maktx  ,
        psmng LIKE rc29p-menge ,
        meins LIKE mseg-meins  ,
       END OF itab .

SELECTION-SCREEN BEGIN OF BLOCK ot WITH FRAME. TITLE text-001.
PARAMETERS : p_werks LIKE rc29k-werks OBLIGATORY DEFAULT 1855.
SELECT-OPTIONS : p_aufnr FOR  afko-aufnr .
*  scrcnt type i no-display.
SELECTION-SCREEN END OF BLOCK ot.

INITIALIZATION.

START-OF-SELECTION.
  PERFORM. get_data ."获得物料和数量
  PERFORM. init_fieldcat ."初始化ALV
  PERFORM. show_data ."ALV显示数据

 

END-OF-SELECTION.


*&---------------------------------------------------------------------*
*&      Form  GET_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM. get_data.
  SELECT  resb~matnr makt~maktx resb~meins  SUM( resb~bdmng ) AS psmng
  APPENDING CORRESPONDING FIELDS OF TABLE itab
  FROM afko
  INNER JOIN resb ON resb~rsnum = afko~rsnum
  INNER JOIN aufk ON aufk~aufnr = afko~aufnr
  INNER JOIN makt ON makt~matnr = resb~matnr
   WHERE
  NOT EXISTS ( SELECT objnr FROM jest  WHERE bjnr = aufk~objnr  AND
  inact = ''   AND stat IN ('I0523','I0013','I0076','I0560' ) ) AND
    afko~aufnr IN p_aufnr AND aufk~werks = p_werks AND resb~dumps =  ''
   AND makt~spras = sy-langu AND resb~xloek = ''
   GROUP BY  resb~matnr  makt~maktx resb~meins.
*'I0523','I0013','I0076','I0560'
*dltd,dlt,dlid,deld删除

ENDFORM.                    "GET_DATA
*&---------------------------------------------------------------------*
*&      Form  init_fieldcat
*&---------------------------------------------------------------------*
FORM. init_fieldcat .
  CLEAR wf_fieldcat[].
  PERFORM. alv_field_column USING wf_fieldcat[] 'MATNR' '物料编码' 'CHAR' '8'.
  PERFORM. alv_field_column USING wf_fieldcat[] 'MAKTX' '物料描述' 'CHAR' '25'.
  PERFORM. alv_field_column USING wf_fieldcat[] 'PSMNG' '需求数量' 'CURR' '8'.
  PERFORM. alv_field_column USING wf_fieldcat[] 'MEINS' '单位' 'CHAR' '8' .
ENDFORM.                    " init_fieldcat

*&---------------------------------------------------------------------*
*&      Form  alv_field_column
*&---------------------------------------------------------------------*
FORM. alv_field_column  USING lt_fieldcat  TYPE slis_t_fieldcat_alv
                                         value(p_fieldname)
                                         value(p_seltext_l)
                                         value(p_datatype)
                                         value(p_outputlen).

  DATA: ls_fieldcat TYPE slis_fieldcat_alv.
  CLEAR ls_fieldcat.

  ls_fieldcat-fieldname = p_fieldname.
  ls_fieldcat-seltext_l = p_seltext_l.
  ls_fieldcat-datatype  = p_datatype.
  ls_fieldcat-outputlen = p_outputlen.
  ls_fieldcat-no_zero   = ''.
*    ls_fieldcat-reprep = 'X'.
  ls_fieldcat-edit = 'X'.
  APPEND ls_fieldcat TO lt_fieldcat.

ENDFORM.                    " alv_field_column
*&---------------------------------------------------------------------*
*&      Form  show_data
*&---------------------------------------------------------------------*
FORM. show_data .

  SORT itab BY matnr.

  wf_layout-colwidth_optimize = 'X' .
*     wf_layout-detail_initial_lines = 'X'.
*     wf_layout-coltab_fieldname = 'COLOR'.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program      = i_repid
*      i_callback_user_command = g_command
      is_layout               = wf_layout
      it_fieldcat             = wf_fieldcat[]
*      i_grid_title            = title
    TABLES
      t_outtab                = itab
    EXCEPTIONS
      program_error           = 1
      OTHERS                  = 2.

ENDFORM.                    " show_data

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9394055/viewspace-604959/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 自动刷新List数据
下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2009-05-13

  • 博文量
    4
  • 访问量
    5522