码迷,mamicode.com
首页 > 其他好文 > 详细

使用弹窗批量修改数据POPUP_GET_VALUES

时间:2019-11-04 17:35:26      阅读:93      评论:0      收藏:0      [点我收藏+]

标签:png   生产   index   not   end   int   import   turn   sdn   

转自:https://blog.csdn.net/huanglin6/article/details/81231215

 

业务场景:在SAP内,有时候需要用户批量维护某些数据,这时候可以使用标准函数POPUP_GET_VALUES可以进行批量的维护。

效果图

技术图片

 

参考代码

FORM CALL_CHANGE CHANGING P_L_RETURN_CODE .

DATA: BEGIN OF FIELDS OCCURS 5.
       INCLUDE STRUCTURE SVAL.
DATA: END   OF FIELDS.

DATA: L_RETURN_CODE TYPE C.
DATA: DATE  LIKE  T5A4A-DLYDY.

CLEAR:FIELDS.
FIELDS-TABNAME    = ZTSD_SCXQ_H.
FIELDS-FIELDNAME  = WERKS.
APPEND FIELDS.

CLEAR:FIELDS.
FIELDS-TABNAME    = EKKO.
FIELDS-FIELDNAME  = EKORG.
APPEND FIELDS.

CLEAR:FIELDS.
FIELDS-TABNAME    = EKKO.
FIELDS-FIELDNAME  = EKGRP.
APPEND FIELDS.

CLEAR:FIELDS.
FIELDS-TABNAME    = LFA1.
FIELDS-FIELDNAME  = LIFNR.
APPEND FIELDS.

*FIELDS-TABNAME    = ‘LFA1‘.
*FIELDS-FIELDNAME  = ‘NAME1‘.
*APPEND FIELDS.

CLEAR:FIELDS.
FIELDS-TABNAME    = T001L.
FIELDS-FIELDNAME  = LGORT.
APPEND FIELDS.

CLEAR:FIELDS.
FIELDS-TABNAME    = ZTMM_ZMWSKZ.
FIELDS-FIELDNAME  = MWSKZ.
APPEND FIELDS.

CLEAR:FIELDS.
FIELDS-TABNAME    = EKKO.
FIELDS-FIELDNAME  = BSART.
APPEND FIELDS.

CLEAR:FIELDS.
FIELDS-TABNAME    = ZTPP_CPDM.
FIELDS-FIELDNAME  = ZDM.
FIELDS-FIELDTEXT  = 产品代码.
APPEND FIELDS.

CLEAR:FIELDS.
FIELDS-TABNAME    = ZTPP_SCDM.
FIELDS-FIELDNAME  = ZDM.
FIELDS-FIELDTEXT  = 生产代码.
APPEND FIELDS.

CLEAR:FIELDS.
FIELDS-TABNAME    = EKKO.
FIELDS-FIELDNAME  = ZYFK.
APPEND FIELDS.

CLEAR:FIELDS.
FIELDS-TABNAME    = ZTMM_ZTERM.
FIELDS-FIELDNAME  = ZTERM.
APPEND FIELDS.

CLEAR:FIELDS.
FIELDS-TABNAME    = BAPIMEPOITEM.
FIELDS-FIELDNAME  = UNDER_DLV_TOL.
APPEND FIELDS.

CLEAR:FIELDS.
FIELDS-TABNAME    = BAPIMEPOITEM.
FIELDS-FIELDNAME  = OVER_DLV_TOL.
APPEND FIELDS.

CLEAR:FIELDS.
FIELDS-TABNAME    = ZTMM_JYD.
FIELDS-FIELDNAME  = ZJYD.
APPEND FIELDS.

CLEAR:FIELDS.
FIELDS-TABNAME    = EKKO.
FIELDS-FIELDNAME  = ZCGXY.
APPEND FIELDS.

CLEAR:FIELDS.
FIELDS-TABNAME    = EKKO.
FIELDS-FIELDNAME  = PINCR.
FIELDS-FIELDTEXT  = 日期加.
APPEND FIELDS.

CLEAR:FIELDS.
FIELDS-TABNAME    = EKKO.
FIELDS-FIELDNAME  = LPONR.
FIELDS-FIELDTEXT  = 日期减.
APPEND FIELDS.

CLEAR:FIELDS.
FIELDS-TABNAME    = EKPO.
FIELDS-FIELDNAME  = NETPR.
FIELDS-FIELDTEXT  = 含税单价.
APPEND FIELDS.

CLEAR:FIELDS.
FIELDS-TABNAME    = EKKO.
FIELDS-FIELDNAME  = WAERS.
FIELDS-FIELD_ATTR = 04  .
APPEND FIELDS.


CALL FUNCTION POPUP_GET_VALUES
  EXPORTING
*   NO_VALUE_CHECK        = ‘ ‘
    POPUP_TITLE           = 批量赋值
*   START_COLUMN          = ‘5‘
*   START_ROW             = ‘5‘
  IMPORTING
    RETURNCODE            = L_RETURN_CODE
  TABLES
    FIELDS                = FIELDS
  EXCEPTIONS
    ERROR_IN_FIELDS       = 1
    OTHERS                = 2
          .
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.

READ TABLE FIELDS WITH KEY FIELDNAME = WERKS.
IF SY-SUBRC EQ 0.
  MOVE FIELDS-VALUE TO G_WERKS.
ENDIF.

READ TABLE FIELDS WITH KEY FIELDNAME = EKORG.
IF SY-SUBRC EQ 0.
  MOVE FIELDS-VALUE TO G_EKORG.
ENDIF.

READ TABLE FIELDS WITH KEY FIELDNAME = EKGRP.
IF SY-SUBRC EQ 0.
  MOVE FIELDS-VALUE TO G_EKGRP.
ENDIF.

READ TABLE FIELDS WITH KEY FIELDNAME = LIFNR.
IF SY-SUBRC EQ 0.
  MOVE FIELDS-VALUE TO G_LIFNR.
ENDIF.

READ TABLE FIELDS WITH KEY FIELDNAME = NAME1.
IF SY-SUBRC EQ 0.
  MOVE FIELDS-VALUE TO G_NAME1.
ENDIF.

READ TABLE FIELDS WITH KEY FIELDNAME = LGORT.
IF SY-SUBRC EQ 0.
  MOVE FIELDS-VALUE TO G_LGORT.
ENDIF.

READ TABLE FIELDS INDEX 8."WITH KEY FIELDNAME = ‘ZDM‘.
IF SY-SUBRC EQ 0.
  MOVE FIELDS-VALUE TO G_ZDM_CP.
ENDIF.

READ TABLE FIELDS INDEX 9."WITH KEY FIELDNAME = ‘ZDM‘.
IF SY-SUBRC EQ 0.
  MOVE FIELDS-VALUE TO G_ZDM_GS.
ENDIF.


*G_ZDM_CP  LIKE ZTPP_CPDM-ZDM,"产品代码
*  LIKE ZTPP_CPDM-ZDM."生产代码
READ TABLE FIELDS WITH KEY FIELDNAME = BSART.
IF SY-SUBRC EQ 0.
  MOVE FIELDS-VALUE TO G_BSART.
ENDIF.

READ TABLE FIELDS WITH KEY FIELDNAME = MWSKZ.
IF SY-SUBRC EQ 0.
  MOVE FIELDS-VALUE TO G_MWSKZ.
ENDIF.

"是否预付款 ADD BY HANDLH 2018.5.22
READ TABLE FIELDS WITH KEY FIELDNAME = ZYFK.
IF SY-SUBRC EQ 0.
  MOVE FIELDS-VALUE TO G_ZYFK.
ENDIF.

"付款条件 ADD BY HANDLH 2018.5.22
READ TABLE FIELDS WITH KEY FIELDNAME = ZTERM.
IF SY-SUBRC EQ 0.
  MOVE FIELDS-VALUE TO G_ZTERM.
ENDIF.

"交货不足限度 ADD BY HANDLH 2018.5.22
READ TABLE FIELDS WITH KEY FIELDNAME = UNDER_DLV_TOL.
IF SY-SUBRC EQ 0.
  MOVE FIELDS-VALUE TO G_UNTTO.
ENDIF.

"过量交货限度 ADD BY HANDLH 2018.5.22
READ TABLE FIELDS WITH KEY FIELDNAME = OVER_DLV_TOL.
IF SY-SUBRC EQ 0.
  MOVE FIELDS-VALUE TO G_UEBTO.
ENDIF.

"采购单价
READ TABLE FIELDS WITH KEY FIELDNAME = NETPR.
IF SY-SUBRC EQ 0.
  MOVE FIELDS-VALUE TO G_NETPR.
ENDIF.

"检验地点
READ TABLE FIELDS WITH KEY FIELDNAME = ZJYD.
IF SY-SUBRC EQ 0.
  MOVE FIELDS-VALUE TO G_ZJYD.
ENDIF.

"采购协议号
READ TABLE FIELDS WITH KEY FIELDNAME = ZCGXY.
IF SY-SUBRC EQ 0.
  MOVE FIELDS-VALUE TO G_ZCGXY.
ENDIF.

"日期加
READ TABLE FIELDS WITH KEY FIELDNAME = PINCR.
IF SY-SUBRC EQ 0.
  MOVE FIELDS-VALUE TO G_DAY_ADD.
ENDIF.

"日期减
READ TABLE FIELDS WITH KEY FIELDNAME = LPONR.
IF SY-SUBRC EQ 0.
  MOVE FIELDS-VALUE TO G_DAY_DEC.
ENDIF.

IF L_RETURN_CODE NE A."不是取消 .
  LOOP AT GT_OUTPUT ASSIGNING FIELD-SYMBOL(<FW_OUTPUT>) WHERE SLBOX EQ X.
    IF G_WERKS IS NOT INITIAL.
      MOVE G_WERKS  TO <FW_OUTPUT>-DWERK.
    ENDIF.

    IF G_EKORG IS NOT INITIAL .
      MOVE G_EKORG  TO <FW_OUTPUT>-EKORG.
    ENDIF.

    IF G_EKGRP IS NOT INITIAL .
      MOVE G_EKGRP  TO <FW_OUTPUT>-EKGRP.
    ENDIF.

    IF G_LIFNR IS NOT INITIAL.
      MOVE G_LIFNR  TO <FW_OUTPUT>-LIFNR.
    ENDIF.

    IF G_NAME1 IS NOT INITIAL .
      MOVE G_NAME1  TO <FW_OUTPUT>-NAME1.
    ENDIF.

    IF G_LGORT IS NOT INITIAL.
      MOVE G_LGORT  TO <FW_OUTPUT>-LGORT.
    ENDIF.

    IF G_MWSKZ IS NOT INITIAL.
      MOVE G_MWSKZ  TO <FW_OUTPUT>-MWSKZ.
    ENDIF.

    IF G_BSART IS NOT INITIAL .
      MOVE G_BSART  TO <FW_OUTPUT>-BSART.
    ENDIF.

    IF G_ZDM_CP IS NOT INITIAL.
      MOVE G_ZDM_CP TO <FW_OUTPUT>-ZDM_CP.
    ENDIF.

    IF G_ZDM_GS IS NOT INITIAL.
      MOVE G_ZDM_GS TO <FW_OUTPUT>-ZDM_GS.
    ENDIF.

    IF G_ZDM_GS IS NOT INITIAL.
      MOVE G_ZDM_GS TO <FW_OUTPUT>-ZDM_GS.
    ENDIF.

    IF G_ZYFK IS NOT INITIAL.
      MOVE G_ZYFK TO <FW_OUTPUT>-ZYFK.
    ENDIF.

    IF G_ZTERM IS NOT INITIAL.
      MOVE G_ZTERM TO <FW_OUTPUT>-ZTERM.
    ENDIF.

    IF G_UNTTO IS NOT INITIAL.
      MOVE G_UNTTO TO <FW_OUTPUT>-UNTTO.
    ENDIF.

    IF G_UEBTO IS NOT INITIAL.
      MOVE G_UEBTO TO <FW_OUTPUT>-UEBTO.
    ENDIF.

    IF G_MAKTX IS NOT INITIAL.
      MOVE G_MAKTX TO <FW_OUTPUT>-MAKTX.
    ENDIF.

    IF G_NETPR IS NOT INITIAL.
      MOVE G_NETPR TO <FW_OUTPUT>-NETPR.
    ENDIF.

    IF G_ZJYD IS NOT INITIAL.
      MOVE G_ZJYD TO <FW_OUTPUT>-ZJYD.
    ENDIF.

    IF G_ZCGXY IS NOT INITIAL.
      MOVE G_ZCGXY TO <FW_OUTPUT>-ZCGXY.
    ENDIF.

    IF G_DAY_ADD IS NOT INITIAL .
      MOVE G_DAY_ADD TO DATE.
      CALL FUNCTION RP_CALC_DATE_IN_INTERVAL
          EXPORTING
            date      = <FW_OUTPUT>-ZJHRK_DAT
            days      = DATE  "天数加N或者减N  不加也不减 写0
            months    = 0     "月份加N或者减N  不加也不减 写0
            signum    = +   "可以是+或者-
            years     = 0     "年份加N或者减N  不加也不减 写0
          IMPORTING
            calc_date = <FW_OUTPUT>-ZDDJQ."得到加减之后的日期
    ENDIF.

    IF G_DAY_DEC IS NOT INITIAL .
      MOVE G_DAY_DEC TO DATE.
      CALL FUNCTION RP_CALC_DATE_IN_INTERVAL
          EXPORTING
            date      = <FW_OUTPUT>-ZJHRK_DAT
            days      = DATE  "天数加N或者减N  不加也不减 写0
            months    = 0     "月份加N或者减N  不加也不减 写0
            signum    = -   "可以是+或者-
            years     = 0     "年份加N或者减N  不加也不减 写0
          IMPORTING
            calc_date = <FW_OUTPUT>-ZDDJQ."得到加减之后的日期
    ENDIF.

    SELECT SINGLE
      NAME1
      INTO <FW_OUTPUT>-NAME1
      FROM LFA1
      WHERE LIFNR EQ <FW_OUTPUT>-LIFNR.

  ENDLOOP.
ENDIF.

ENDFORM.
————————————————
版权声明:本文为CSDN博主「SAP-Joker」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/huanglin6/article/details/81231215

 

使用弹窗批量修改数据POPUP_GET_VALUES

标签:png   生产   index   not   end   int   import   turn   sdn   

原文地址:https://www.cnblogs.com/rainysblog/p/11792956.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!