ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Water fall备份数据

Water fall备份数据

原创 Linux操作系统 作者:ytfsrs2008 时间:2009-02-14 09:54:12 0 删除 编辑
REPORT ZRPP0012 .
*Back up Forecast Data
tables: PBIM,     "Forecast data header
        PBED,     "Forecast data item
        ZPP015.   "Customer table, Use for backup

DATA:BEGIN OF FCSTLINE,
     MATNR TYPE PBIM-MATNR,
     WERKS TYPE PBIM-WERKS,
     PLNMG TYPE PBED-PLNMG,
     MEINS TYPE PBED-MEINS,
     PDATU TYPE PBED-PDATU,
     PERXX TYPE PBED-PERXX,
     END OF FCSTLINE.


DATA:LINE TYPE  ZPP015.

DATA:FCST LIKE TABLE OF FCSTLINE.
data:lineobj type zpp015.
data:fcst1 type table of zpp015.


Data:WEEK LIKE SCAL-WEEK,
     WEEK1 LIKE SCAL-WEEK.
data: de type i.

PARAMETERS: XWERKS LIKE MARC-WERKS OBLIGATORY.
parameters: CUR_PER like sy-datum default sy-datum.
START-OF-SELECTION.

  CUR_PER = SY-DATUM.
  CALL FUNCTION 'DATE_GET_WEEK'
       EXPORTING
            DATE         = CUR_PER
       IMPORTING
            WEEK         = WEEK
       EXCEPTIONS
            DATE_INVALID = 1.

  DELETE FROM ZPP015
    where WERKS = XWERKS and BACKWEEK = WEEK.
  commit work and wait.
  do 999 times. add 1 to de. enddo.

 SELECT PBIM~MATNR PBIM~WERKS
        PBED~PLNMG PBED~MEINS
        PBED~PDATU PBED~PERXX
        FROM PBIM  INNER JOIN PBED
        ON PBIM~BDZEI = PBED~BDZEI
        INTO CORRESPONDING FIELDS OF TABLE FCST
        WHERE PBIM~WERKS = XWERKS AND PBIM~LOEVR <> 'D'
        AND   PBED~PLNMG <> 0.

LOOP AT FCST into fcstline.
     CLEAR LINEOBJ.
     LINEOBJ-MATNR = FCSTLINE-MATNR.
     LINEOBJ-WERKS = FCSTLINE-WERKS.
     LINEOBJ-PLNMG = FCSTLINE-PLNMG.
     LINEOBJ-MEINS = FCSTLINE-MEINS.
     LINEOBJ-BACKWEEK = WEEK.
     IF FCSTLINE-PERXX = SPACE.
       CALL FUNCTION 'DATE_GET_WEEK'
       EXPORTING
            DATE         = FCSTLINE-PDATU
       IMPORTING
            WEEK         = WEEK1
       EXCEPTIONS
            DATE_INVALID = 1.
      LINEOBJ-PERXX = WEEK1.
     ELSE.
      LINEOBJ-PERXX = FCSTLINE-PERXX.
     ENDIF.
    COLLECT LINEOBJ INTO FCST1.
endloop.

END-OF-SELECTION.
* Main Program ---------------------------------------------------------

PERFORM. INSERT_DB.

FORM. INSERT_DB.
INSERT ZPP015 FROM TABLE FCST1.
  commit work and wait.
  do 200 times. add 1 to de. enddo.
ENDFORM.

*--------------------------------------------------------*
表ZPP015的数据结构如下:
MATNR    MATNR    CHAR    18    0                        Material number
WERKS    WERKS_D    CHAR    4    0                        Plant
BACKWEEK    PERXX    CHAR    6    0                        Planning period
PERXX    PERXX    CHAR    6    0                        Planning period
MEINS    MEINS    UNIT    3    0                        Base unit of measure
PLNMG    PLNMG    QUAN    13    3                        Planned quantity

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

上一篇: Water fall 报表
下一篇: 表名前面加*
请登录后发表评论 登录
全部评论

注册时间:2008-10-31

  • 博文量
    52
  • 访问量
    50013