Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7202945
  • 博文数量: 655
  • 博客积分: 10264
  • 博客等级: 上将
  • 技术积分: 8278
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-04 17:47
个人简介

ABAP顾问

文章分类

全部博文(655)

文章存档

2017年(2)

2014年(8)

2013年(3)

2012年(2)

2011年(18)

2010年(102)

2009年(137)

2008年(274)

2007年(134)

分类:

2010-06-08 17:33:27

REPORT z_barry_test NO STANDARD PAGE HEADING  .

PERFORM delete_cycle USING 'C:\ksu1.txt'.


*&---------------------------------------------------------------------*
*&      Form  delete
*&---------------------------------------------------------------------*
FORM delete_cycle USING filename TYPE string.
  DATA: uname LIKE sy-uname,
        t811c TYPE t811c,
        msgtxt(200) .
  DATA: BEGIN OF itab OCCURS 0 ,
          kokrs LIKE tka01-kokrs ,
          cycle LIKE t811c-cycle ,
          sdate LIKE t811c-sdate ,
        END OF itab.

  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      filename            = filename
      filetype            = 'ASC'
      has_field_separator = 'X'
    TABLES
      data_tab            = itab
    EXCEPTIONS
      OTHERS              = 17.

  SORT itab .
  DELETE ADJACENT DUPLICATES FROM itab.

  LOOP AT itab.
    t811c-tab = 'CCSS'.
    TRANSLATE itab TO UPPER CASE.
    CONCATENATE itab-kokrs itab-cycle INTO t811c-cycle .
    t811c-sdate = itab-sdate.

    CALL FUNCTION 'ENQUEUE_EKGALC'
      EXPORTING
        tab          = t811c-tab
        cycle        = t811c-cycle
        sdate        = t811c-sdate
      EXCEPTIONS
        foreign_lock = 2.
    CASE sy-subrc.
      WHEN 0.
      WHEN 2.
        IF sy-msgv1 = sy-uname.
          MESSAGE s055(ga) WITH t811c-cycle t811c-sdate.
          EXIT.
        ELSE.
          uname = sy-msgv1.
          MESSAGE s051(ga) WITH uname t811c-cycle t811c-sdate.
          EXIT.
        ENDIF.
    ENDCASE.

    CALL FUNCTION 'RK_AL_CYCLE_DELETE'
      EXPORTING
        im_t811c         = t811c
      EXCEPTIONS
        wrong_cycle      = 8
        has_postings     = 4
        no_authority     = 12
        error_change_doc = 16.

    CASE sy-subrc.
      WHEN 0.
        MESSAGE s008(ga) WITH t811c-cycle t811c-sdate INTO msgtxt.
        WRITE / msgtxt.
      WHEN 4.
        MESSAGE e007(ga) WITH t811c-cycle t811c-sdate sy-dbcnt.
      WHEN 8.
        MESSAGE a006(ga) WITH t811c-cycle t811c-sdate.
      WHEN 12.
        MESSAGE e176(ga) WITH t811c-cycle t811c-sdate.
      WHEN 16.
        MESSAGE e810(ga).
    ENDCASE.
  ENDLOOP.
ENDFORM.                    "delete

阅读(3210) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~