co03子屏幕增强除了使用cmod[PPCO0012]、badi增强外,还可以使用TAB上直接复制子屏幕,效果如下图所示:
具体步骤如下:
一、找到要复制的子屏幕:如下图所示,
二、在下图红框中,点右键,在弹出菜单中点复制按钮
三、复制出新的子屏幕“齐套期管理”如下图所示。
四、SE51,画屏幕,如下三个图所示:
1、屏幕代码:
PROCESS BEFORE OUTPUT.
* MODULE STATUS_0103.
*{ REPLACE R3DK918438 1
*\*
MODULE INITCTR.
LOOP AT IT_ZQTQCHECK
WITH CONTROL TC2
CURSOR TC2-CURRENT_LINE.
ENDLOOP.
*} REPLACE
PROCESS AFTER INPUT.
*{ REPLACE R3DK918438 2
*\* MODULE USER_COMMAND_0103.
MODULE USER_COMMAND_0103.
*} REPLACE
*{ REPLACE R3DK918438 1
*\
LOOP.
ENDLOOP.
PROCESS ON VALUE-REQUEST.
FIELD V_BUPD
MODULE ZGET_DATE_PWERK.
*} REPLACE
2、MODULE INITCTR
*----------------------------------------------------------------------*
***INCLUDE LCOKO1O29 .
*----------------------------------------------------------------------*
*{ INSERT R3DK918438 1
*&---------------------------------------------------------------------*
*& Module INITCTR OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE INITCTR OUTPUT.
REFRESH IT_ZQTQCHECK.
CLEAR IT_ZQTQCHECK.
SELECT *
INTO CORRESPONDING FIELDS OF TABLE IT_ZQTQCHECK
FROM ZQTQCHECK
WHERE AUFNR = CAUFVD-AUFNR.
SORT IT_ZQTQCHECK BY FINDX DESCENDING.
CLEAR IT_ZQTQCHECK.
READ TABLE IT_ZQTQCHECK INDEX 1.
IF SY-SUBRC EQ 0.
V_BUPD = IT_ZQTQCHECK-AUPD.
V_GXYY = IT_ZQTQCHECK-GXYY.
V_NOTES = IT_ZQTQCHECK-NOTES.
ELSE.
V_BUPD = SY-DATUM.
ENDIF.
DATA:LV_DAYS(100).
LOOP AT IT_ZQTQCHECK.
IF IT_ZQTQCHECK-FINDX = 1.
IT_ZQTQCHECK-ZTDEC = '初次更改'.
ELSE.
LV_DAYS = IT_ZQTQCHECK-BUPD - IT_ZQTQCHECK-AUPD.
CONDENSE LV_DAYS.
IF LV_DAYS > 0.
CONCATENATE '提前' LV_DAYS '天' INTO IT_ZQTQCHECK-ZTDEC.
ELSEIF LV_DAYS = 0.
IT_ZQTQCHECK-ZTDEC = '齐套期无变化'.
ELSE.
REPLACE ALL OCCURRENCES OF REGEX '-' IN LV_DAYS WITH space.
CONCATENATE '延迟' LV_DAYS '天' INTO IT_ZQTQCHECK-ZTDEC.
ENDIF.
ENDIF.
MODIFY IT_ZQTQCHECK.
CLEAR IT_ZQTQCHECK.
ENDLOOP.
IF IT_ZQTQCHECK[] IS NOT INITIAL.
DESCRIBE TABLE IT_ZQTQCHECK LINES TC2-LINES.
ELSE.
TC2-LINES = 1.
ENDIF.
ENDMODULE. " INITCTR OUTPUT
*} INSERT
3、IT_ZQTQCHECK声明
4、TC2声明
5、Module USER_COMMAND_0103
*{ INSERT R3DK918438 1
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0103 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0103 INPUT.
DATA:T_ZQTQCHECK TYPE STANDARD TABLE OF ZQTQCHECK WITH HEADER LINE,
TT_ZQTQCHECK TYPE STANDARD TABLE OF ZQTQCHECK WITH HEADER LINE.
OK_CODE = SY-UCOMM.
CASE OK_CODE.
WHEN 'UPD_QT'.
IF V_BUPD = '' OR V_BUPD = '00000000'.
MESSAGE '齐套期字段不能为空!' TYPE 'I'.
ELSE.
REFRESH TT_ZQTQCHECK.
CLEAR TT_ZQTQCHECK.
SELECT *
INTO CORRESPONDING FIELDS OF TABLE TT_ZQTQCHECK
FROM ZQTQCHECK
WHERE AUFNR = CAUFVD-AUFNR.
SORT TT_ZQTQCHECK BY FINDX DESCENDING.
REFRESH T_ZQTQCHECK.
CLEAR T_ZQTQCHECK.
T_ZQTQCHECK-AUPD = V_BUPD.
T_ZQTQCHECK-AUFNR = CAUFVD-AUFNR.
CLEAR TT_ZQTQCHECK.
READ TABLE TT_ZQTQCHECK INDEX 1.
IF SY-SUBRC EQ 0.
T_ZQTQCHECK-BUPD = TT_ZQTQCHECK-AUPD.
T_ZQTQCHECK-FINDX = TT_ZQTQCHECK-FINDX + 1.
ELSE.
T_ZQTQCHECK-FINDX = 1.
ENDIF.
T_ZQTQCHECK-UPDER = SY-UNAME.
T_ZQTQCHECK-UPDAT = SY-DATUM.
T_ZQTQCHECK-UPDTM = SY-UZEIT.
T_ZQTQCHECK-GXYY = V_GXYY.
T_ZQTQCHECK-NOTES = V_NOTES.
APPEND T_ZQTQCHECK.
CLEAR T_ZQTQCHECK.
SORT TT_ZQTQCHECK BY FINDX ASCENDING.
LOOP AT TT_ZQTQCHECK.
MOVE-CORRESPONDING TT_ZQTQCHECK TO T_ZQTQCHECK.
APPEND T_ZQTQCHECK.
CLEAR T_ZQTQCHECK.
ENDLOOP.
MODIFY ZQTQCHECK FROM TABLE T_ZQTQCHECK.
ENDIF.
ENDCASE.
ENDMODULE. " USER_COMMAND_0103 INPUT
*} INSERT
6、Module ZGET_DATE_PWERK
*{ INSERT R3DK918438 1
*&---------------------------------------------------------------------*
*& Module ZGET_DATE_PWERK INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE ZGET_DATE_PWERK INPUT.
CALL FUNCTION 'F4_DATE'
EXPORTING
DATE_FOR_FIRST_MONTH = SY-DATUM
IMPORTING
SELECT_DATE = V_BUPD
EXCEPTIONS
CALENDAR_BUFFER_NOT_LOADABLE = 1
DATE_AFTER_RANGE = 2
DATE_BEFORE_RANGE = 3
DATE_INVALID = 4
FACTORY_CALENDAR_NOT_FOUND = 5
HOLIDAY_CALENDAR_NOT_FOUND = 6
PARAMETER_CONFLICT = 7
OTHERS = 8.
ENDMODULE. " ZGET_DATE_PWERK INPUT
*} INSERT
五、点击标签页“齐套期管理”时,执行以下代码,调用子屏幕0103
六、OK-CODE赋值。