我是靠谱客的博主 想人陪盼望,最近开发中收集的这篇文章主要介绍【测试】批量删除供应商配额(Quota ),觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

【测试代码】

 

查询代码:

主要涉及Table:EQUK(配额文件: 标题)和 EQUP(配额文件:项目)

 

***选择屏幕
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS: P_WERKS TYPE EQUK-WERKS DEFAULT '1200' OBLIGATORY.
SELECT-OPTIONS: S_MATNR FOR EQUK-MATNR MODIF ID G2.
SELECTION-SCREEN END OF BLOCK B1.

*** 定义内表
TYPES:BEGIN OF TY_DISPLAY,
        MATNR   TYPE EQUK-MATNR,
        WERKS   TYPE EQUK-WERKS,
        BDATU   TYPE EQUK-BDATU,
        VDATU   TYPE EQUK-VDATU,
        QUNUM   TYPE EQUK-QUNUM,
        ERDAT   TYPE EQUK-ERDAT,
        ERNAM   TYPE EQUK-ERNAM,
        SCMNG   TYPE EQUK-SCMNG,
        MESSAGE TYPE BAPI_MSG, 
      END OF TY_DISPLAY.
DATA: GT_EQUP    TYPE EQUP OCCURS 0 WITH HEADER LINE,
      GT_DISPLAY TYPE TY_DISPLAY OCCURS 0 WITH HEADER LINE.

*** 查询数据
  SELECT * 
  FROM EQUK
  INTO CORRESPONDING FIELDS OF TABLE GT_DISPLAY 
  WHERE WERKS = P_WERKS
    AND MATNR IN S_MATNR.

  IF GT_DISPLAY[] IS NOT INITIAL.
    SORT GT_DISPLAY BY QUNUM.

    SELECT * 
    FROM EQUP
    INTO CORRESPONDING FIELDS OF TABLE  GT_EQUP
    FOR ALL ENTRIES IN GT_DISPLAY 
    WHERE QUNUM = GT_DISPLAY-QUNUM.
    SORT  GT_EQUP BY QUNUM.

    LOOP AT  GT_DISPLAY .
      LV_INDEX = SY-TABIX.
      READ TABLE  GT_EQUP WITH  KEY QUNUM = GT_DISPLAY-QUNUM BINARY SEARCH.
      IF SY-SUBRC <> 0.
        DELETE GT_DISPLAY INDEX LV_INDEX.
      ENDIF.
    ENDLOOP.
  ENDIF.

删除代码:

*** 定义内表
DATA: T_XEQUK TYPE EQUKU OCCURS 0 WITH HEADER LINE,"
      T_XEQUP TYPE UEQUP OCCURS 0 WITH HEADER LINE,"
      T_YEQUK TYPE EQUKU OCCURS 0 WITH HEADER LINE,"
      T_YEQUP TYPE UEQUP OCCURS 0 WITH HEADER LINE."

*** 删除配额
  LOOP AT GT_DISPLAY INTO GW_DISPLAY.

    READ TABLE  GT_EQUP WITH KEY QUNUM = GW_DISPLAY-QUNUM BINARY SEARCH.

    IF SY-SUBRC = 0.
      LV_INDEX = SY-TABIX.

*** 配额抬头信息
      CLEAR : T_XEQUK,T_YEQUK.
      MOVE-CORRESPONDING GW_DISPLAY TO T_XEQUK.
      APPEND T_XEQUK.

      MOVE-CORRESPONDING GW_DISPLAY TO T_YEQUK.
      T_YEQUK-KZ = 'U'. "更改类型 (U, I, E, D)
      APPEND T_YEQUK.

*** 项目明细信息
      CLEAR GT_EQUP.
      LOOP AT GT_EQUP FROM LV_INDEX.
        IF GT_EQUP-QUNUM <>  GW_DISPLAY-QUNUM.
          EXIT.
        ENDIF.

        CLEAR T_YEQUP.
        MOVE-CORRESPONDING GT_EQUP TO T_YEQUP.
        APPEND T_YEQUP.

        CLEAR: GT_EQUP.
      ENDLOOP.

    ENDIF.

    CLEAR W_DISPLAY.
  ENDLOOP.

  CALL FUNCTION 'ME_UPDATE_QUOTA'
    TABLES
      XEQUK = T_XEQUK
      XEQUP = T_XEQUP
      YEQUK = T_YEQUK
      YEQUP = T_YEQUP.

  IF SY-SUBRC = 0.
*** 删除成功
  ELSE.
*** 删除失败
  ENDIF.

最后

以上就是想人陪盼望为你收集整理的【测试】批量删除供应商配额(Quota )的全部内容,希望文章能够帮你解决【测试】批量删除供应商配额(Quota )所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(61)

评论列表共有 0 条评论

立即
投稿
返回
顶部