SM30维护视图屏蔽按钮与增加选择条件
作者:互联网
*---------------------------------------------------------------------- * TABLES/Structure *---------------------------------------------------------------------- TABLES:T001W, YTDRIVERI, YTDRICAR. *---------------------------------------------------------------------- * DATA *---------------------------------------------------------------------- DATA: BEGIN OF GT_TAB OCCURS 0, WERKS LIKE T001W-WERKS, END OF GT_TAB. DATA: BEGIN OF GT_NAM OCCURS 0, TPNAM LIKE YTDRIVERI-TPNAM, END OF GT_NAM. DATA: BEGIN OF GT_DATA OCCURS 0. INCLUDE STRUCTURE YTDRICAR. DATA: END OF GT_DATA. DATA: IT_VIMSELLIST TYPE TABLE OF VIMSELLIST, IW_VIMSELLIST TYPE VIMSELLIST, IT_VIMEXCLFUN TYPE TABLE OF VIMEXCLFUN, IW_VIMEXCLFUN TYPE VIMEXCLFUN. *DATA: IT_MKOAR TYPE TABLE OF TY_MKOAR, * IW_MKOAR TYPE TY_MKOAR. DATA: W_FLG TYPE C. *====================================================================== * SELECTION-SCREEN *====================================================================== SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001. PARAMETERS: P_WERKS LIKE T001W-WERKS DEFAULT 'W001'. SELECT-OPTIONS: S_TPNAM FOR YTDRIVERI-TPNAM NO-EXTENSION NO INTERVALS. SELECTION-SCREEN END OF BLOCK BLK1. *---------------------------------------------------------------------- * INITIALIZATION *---------------------------------------------------------------------- INITIALIZATION. * 初始化数据 PERFORM FRM_INITIAL. *---------------------------------------------------------------------- * AT SELECTION-SCREEN *---------------------------------------------------------------------- AT SELECTION-SCREEN. * 权限检查部分 PERFORM FRM_CHECK_AUTHOR. *====================================================================== * MAIN PROGRAM *====================================================================== * START-OF-SELECTION *---------------------------------------------------------------------- START-OF-SELECTION. *&选择条件判断 SELECT WERKS INTO TABLE GT_TAB FROM YTDRIVERI WHERE WERKS EQ P_WERKS. IF SY-SUBRC NE 0. MESSAGE I001. ENDIF. *编辑过滤数据条件 IF P_WERKS IS NOT INITIAL. IW_VIMSELLIST-VIEWFIELD = 'WERKS'. IW_VIMSELLIST-OPERATOR = 'EQ'. IW_VIMSELLIST-AND_OR = 'AND'. IW_VIMSELLIST-VALUE = P_WERKS. APPEND IW_VIMSELLIST TO IT_VIMSELLIST. ENDIF. *&司机名称作为选择条件 IF S_TPNAM IS NOT INITIAL. SELECT TPNAM INTO TABLE GT_NAM FROM YTDRIVERI WHERE WERKS EQ P_WERKS AND TPNAM IN S_TPNAM. IF SY-SUBRC NE 0. MESSAGE I001. ENDIF. *&司机名称作为过滤选择条件 LOOP AT GT_NAM. IW_VIMSELLIST-VIEWFIELD = 'TPNAM'. IW_VIMSELLIST-OPERATOR = 'EQ'. IW_VIMSELLIST-AND_OR = 'OR'. IW_VIMSELLIST-VALUE = GT_NAM-TPNAM. APPEND IW_VIMSELLIST TO IT_VIMSELLIST. * CLEAR IW_MKOAR. ENDLOOP. ENDIF. *屏蔽按钮(按T-CODE) * IW_VIMEXCLFUN-FUNCTION = 'NEWL'. * APPEND IW_VIMEXCLFUN TO IT_VIMEXCLFUN. * IW_VIMEXCLFUN-FUNCTION = 'KOPE'. * APPEND IW_VIMEXCLFUN TO IT_VIMEXCLFUN. IW_VIMEXCLFUN-FUNCTION = 'DELE'. APPEND IW_VIMEXCLFUN TO IT_VIMEXCLFUN. " MKPF 全选 *BREAK AD_CAIXIANG. **& -锁表 CALL FUNCTION 'ENQUEUE_EYTDRIVERI' EXPORTING MODE_YTDRIVERI = 'E' MANDT = SY-MANDT WERKS = P_WERKS * WERKS = DBA_SELLIST-VALUE EXCEPTIONS FOREIGN_LOCK = 1 SYSTEM_FAILURE = 2 OTHERS = 3. IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. * CALL FUNCTION 'YH_YTDRIVERI_CALL' * EXPORTING * ACTION = 'S' * VIEW_NAME = 'YTDRIVERI' * TABLES * DBA_SELLIST = IT_VIMSELLIST * EXCL_CUA_FUNCT = IT_VIMEXCLFUN * EXCEPTIONS * CLIENT_REFERENCE = 1 * FOREIGN_LOCK = 2 * INVALID_ACTION = 3 * NO_CLIENTINDEPENDENT_AUTH = 4 * NO_DATABASE_FUNCTION = 5 * NO_EDITOR_FUNCTION = 6 * NO_SHOW_AUTH = 7 * NO_TVDIR_ENTRY = 8 * NO_UPD_AUTH = 9 * ONLY_SHOW_ALLOWED = 10 * SYSTEM_FAILURE = 11 * UNKNOWN_FIELD_IN_DBA_SELLIST = 12 * VIEW_NOT_FOUND = 13 * MAINTENANCE_PROHIBITED = 14 * OTHERS = 15. CALL FUNCTION 'VIEW_MAINTENANCE_CALL' EXPORTING ACTION = 'S' VIEW_NAME = 'YTDRIVERI' TABLES DBA_SELLIST = IT_VIMSELLIST EXCL_CUA_FUNCT = IT_VIMEXCLFUN EXCEPTIONS CLIENT_REFERENCE = 1 FOREIGN_LOCK = 2 INVALID_ACTION = 3 NO_CLIENTINDEPENDENT_AUTH = 4 NO_DATABASE_FUNCTION = 5 NO_EDITOR_FUNCTION = 6 NO_SHOW_AUTH = 7 NO_TVDIR_ENTRY = 8 NO_UPD_AUTH = 9 ONLY_SHOW_ALLOWED = 10 SYSTEM_FAILURE = 11 UNKNOWN_FIELD_IN_DBA_SELLIST = 12 VIEW_NOT_FOUND = 13 MAINTENANCE_PROHIBITED = 14 OTHERS = 15. IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. *&---------------------------------------------------------------------* *& Form FRM_INITIAL *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM FRM_INITIAL . ENDFORM. " FRM_INITIAL *&---------------------------------------------------------------------* *& Form FRM_CHECK_AUTHOR *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM FRM_CHECK_AUTHOR . DATA: BEGIN OF LT_T001W OCCURS 0, WERKS LIKE T001L-WERKS, END OF LT_T001W. SELECT WERKS INTO TABLE LT_T001W FROM T001L WHERE WERKS EQ P_WERKS. IF LT_T001W[] IS NOT INITIAL. LOOP AT LT_T001W. AUTHORITY-CHECK OBJECT 'YHLM_PLANT' ID 'ACTVT' FIELD '03' ID 'WERKS' FIELD LT_T001W-WERKS. IF SY-SUBRC NE 0. MESSAGE I002 WITH LT_T001W-WERKS . STOP. ENDIF. ENDLOOP. ELSE. MESSAGE I011 WITH '没有任何地点!'. STOP. ENDIF. ENDFORM. " FRM_CHECK_AUTHOR
标签:WERKS,SY,VIMEXCLFUN,NO,IW,视图,按钮,SM30,VIMSELLIST 来源: https://www.cnblogs.com/rainysblog/p/11507782.html