ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Job Rules Upload

Job Rules Upload

原创 Linux操作系统 作者:superhua 时间:2009-05-08 15:43:53 0 删除 编辑

TABLES: AGR_1251,AGR_1252.
DATA:FILESIZE  TYPE I,
     TRECCT    TYPE I,
     TAGRNAME  LIKE AGR_1251-AGR_NAME,
     TFIELD    LIKE AGR_1251-FIELD,
     TVARBL    LIKE AGR_1252-VARBL.
DATA: BEGIN OF ITAB OCCURS 0,
     AGR_NAME(40) TYPE C,
     COUNTER(40)  TYPE C,
     FIELD(40)    TYPE C,
     LOW(40)      TYPE C,
     HIGH(40)     TYPE C,
   END OF ITAB.
DATA: WAGR_1252 LIKE AGR_1252.

*TOP-OF-PAGE.
ULINE.
WRITE:/'|',  2(20) '      Rolename      ', 22 '|',
       23(9) ' Counter ', 32 '|',
       33(10) '  Field   ' , 43 '|',
       44(40) 'ValueFrom                               ', 84 '|',
       85(40) 'ValueTo                                 ', 125 '|'.
ULINE.

CALL FUNCTION 'UPLOAD'
  EXPORTING
*    CODEPAGE = 'IBM'
*    FILENAME = P_FILENAME
    FILETYPE = 'DAT'
  IMPORTING
    FILESIZE = FILESIZE
  TABLES
    DATA_TAB = ITAB
  EXCEPTIONS
    CONVERSION_ERROR        = 1
    INVALID_TABLE_WIDTH     = 2
    INVALID_TYPE            = 3
    NO_BATCH                = 4
    UNKNOWN_ERROR           = 5
    GUI_REFUSE_FILETRANSFER = 6.
CLEAR TRECCT.
DESCRIBE TABLE ITAB LINES TRECCT.
IF TRECCT > 0.
  IF NOT ITAB IS INITIAL.
    CLEAR ITAB.
  ENDIF.
  SORT ITAB BY AGR_NAME FIELD ASCENDING.
  LOOP AT ITAB.
    SHIFT ITAB-AGR_NAME LEFT DELETING LEADING SPACE.
    SHIFT ITAB-COUNTER  LEFT DELETING LEADING SPACE.
    SHIFT ITAB-FIELD    LEFT DELETING LEADING SPACE.
    SHIFT ITAB-LOW      LEFT DELETING LEADING SPACE.
    SHIFT ITAB-HIGH     LEFT DELETING LEADING SPACE.
    CONCATENATE '$' ITAB-FIELD INTO TVARBL.
    IF ITAB-AGR_NAME <> TAGRNAME OR ITAB-FIELD <> TFIELD.
      TAGRNAME = ITAB-AGR_NAME.
      TFIELD   = ITAB-FIELD.
      DELETE FROM AGR_1252
        WHERE AGR_NAME = ITAB-AGR_NAME AND VARBL = TVARBL.
    ENDIF.

    CLEAR WAGR_1252.
    WAGR_1252-AGR_NAME = ITAB-AGR_NAME.
    WAGR_1252-COUNTER  = ITAB-COUNTER.
    WAGR_1252-VARBL    = TVARBL.
    WAGR_1252-LOW      = ITAB-LOW.
    WAGR_1252-HIGH     = ITAB-HIGH.

    INSERT INTO AGR_1252 VALUES WAGR_1252.

    WRITE: /2(20) WAGR_1252-AGR_NAME,
       23(9)  WAGR_1252-COUNTER,
       33(10) WAGR_1252-VARBL,
       44(40) WAGR_1252-LOW,
       85(40) WAGR_1252-HIGH.

    UPDATE AGR_1251 SET LOW = TVARBL
                        MODIFIED = 'S'
      WHERE AGR_NAME = ITAB-AGR_NAME AND FIELD = ITAB-FIELD.

  ENDLOOP.
ENDIF.
CLEAR:FILESIZE,TRECCT,TAGRNAME,TFIELD,TVARBL.
REFRESH: ITAB.

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

上一篇: 没有了~
下一篇: Guide
请登录后发表评论 登录
全部评论

注册时间:2008-11-21

  • 博文量
    3
  • 访问量
    1435

最新文章